TelegramPWA/dist/9451.e652ee1b913babd03763.js
Alexander Zinchuk aef5c08a38 [Build]
2025-11-17 12:33:29 +04:00

2 lines
683 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([[9451],{3178:(e,t,i)=>{i.d(t,{A:()=>p});var s=i(84051),n=i(31481),a=i(58443),o=i(14737),r=i(43874),l=i(37661),c=i(18104),d=i(20021);const h=[0,50],u=[0,20],m=[20,0],p=(0,s.ph)(({isPasswordVisible:e,isBig:t})=>{const[i,p]=(0,l.A)(!1),[v,g]=(0,l.A)(!1),{isMobile:A}=(0,r.Ay)(),f=A?n.UyP:n.H6l;(0,o.A)(g,2e3);const b=(0,s.hb)(p,[p]);return(0,d.FD)("div",{id:"monkey",className:t?"big":"",children:[!i&&(0,d.Y)("div",{className:"monkey-preview"}),(0,d.Y)(c.A,{size:t?n.r2x:f,className:v?"hidden":"shown",tgsUrl:a.w.MonkeyClose,playSegment:h,noLoop:!0,onLoad:b}),(0,d.Y)(c.A,{size:t?n.r2x:f,className:v?"shown":"hidden",tgsUrl:a.w.MonkeyPeek,playSegment:e?u:m,noLoop:!0})]})})},84286:(e,t,i)=>{i.r(t),i.d(t,{AboutAdsModal:()=>pl,AboutMonetizationModal:()=>gl,AgeVerificationModal:()=>Zr,ArchivedChats:()=>lm,AttachBotInstallModal:()=>oa,AttachBotRecipientPicker:()=>Os,AttachmentModal:()=>pp,BoostModal:()=>Gr,BotCommandMenu:()=>jp,BotTrustModal:()=>aa,CalendarModal:()=>an,ChatCommandTooltip:()=>Gp,ChatFolderModal:()=>cm,ChatInviteModal:()=>ll,ChatLanguageModal:()=>mc,ChatlistModal:()=>al,CollectibleInfoModal:()=>Ac,ContactList:()=>Wu,ContextMenuContainer:()=>um.A,CountryPickerModal:()=>dc,CreateTopic:()=>yg,CustomEmojiSetsModal:()=>gm,CustomEmojiTooltip:()=>$p,CustomSendMenu:()=>Wp,DeleteAccountModal:()=>Wr,DeleteFolderDialog:()=>ra,DeleteMessageModal:()=>zl,Dialogs:()=>Gs,DraftRecipientPicker:()=>Us,DropArea:()=>Qp.A,EditTopic:()=>kg,EmojiInteractionAnimation:()=>uc,EmojiStatusAccessModal:()=>yl,EmojiTooltip:()=>sv,ForwardRecipientPicker:()=>_s,FrozenAccountModal:()=>jA,GifSearch:()=>vv,GiftCodeModal:()=>$r,GiveawayModal:()=>qo,HeaderMenuContainer:()=>Cm,HistoryCalendar:()=>on,InlineBotTooltip:()=>dv,InviteViaLinkModal:()=>OA,LeftSearch:()=>bd,LocationAccessModal:()=>Sl,Management:()=>aA,MapModal:()=>Ws,MediaViewer:()=>Rt,MentionTooltip:()=>lp,MessageSelectToolbar:()=>Wl,MessageStatistics:()=>eg,MiddleSearch:()=>Dm,MinimizedWebAppModal:()=>Sn,MuteChatModal:()=>hm,NewChat:()=>em,NewContactModal:()=>dn,Notifications:()=>zs,OneTimeMediaModal:()=>JA,PaymentModal:()=>RA,PinMessageModal:()=>Hl,PollModal:()=>vp,PollResults:()=>cg,PremiumLimitReachedModal:()=>tr,PremiumMainModal:()=>bo,PreparedMessageModal:()=>Fl,PrivacySettingsNoticeModal:()=>sc,ProfileRatingModal:()=>HA,QuickPreviewModal:()=>ZA,ReactionPicker:()=>Vm,ReactorListModal:()=>hc,ReceiptModal:()=>VA,ReportAdModal:()=>Nl,ReportModal:()=>Il,SafeLinkModal:()=>$s,SeenByModal:()=>Ql,SendAsMenu:()=>hv,Settings:()=>qu,SharePreparedMessageModal:()=>Tl,SponsoredContextMenuContainer:()=>dl.A,Statistics:()=>jv,StatusPickerMenu:()=>xr,StealthModeModal:()=>XA,StickerSearch:()=>pv,StickerSetModal:()=>pm,StickerTooltip:()=>zp,StoryStatistics:()=>og,StoryViewer:()=>ws,SuggestMessageModal:()=>Rl,SuggestedPostApprovalModal:()=>El,SuggestedStatusModal:()=>_r,SymbolMenu:()=>Op,TextFormatter:()=>tv,ToDoListModal:()=>Ap,UnpinAllMessagesModal:()=>$l,UrlAuthModal:()=>Zs,VerificationMonetizationModal:()=>bl,WebAppModal:()=>na,WebAppsCloseConfirmationModal:()=>GA});var s=i(84051),n=i(13439),a=i(89925),o=i(31481),r=i(66644),l=i(90709),c=i(91048),d=i(53827),h=i(63495),u=i(96454),m=i(11778),p=i(14680),v=i(48899),g=i(76023),A=i(49086);function f({message:e,avatarOwner:t,profilePhotos:i,standaloneMedia:s,mediaIndex:n,sponsoredMessage:a}){return t&&i?{type:"avatar",avatarOwner:t,profilePhotos:i,mediaIndex:n}:s?{type:"standalone",media:s,mediaIndex:n}:e?{type:"message",message:e,mediaIndex:n}:a?{type:"sponsoredMessage",message:a,mediaIndex:n}:void 0}function b(e,t,i){if(!i)return;if("standalone"===i.type)return{media:i.media[i.mediaIndex],isSingle:1===i.media.length};if("avatar"===i.type){const e=i.profilePhotos?.photos[i.mediaIndex];return e?{media:e}:void 0}const{action:s,document:n,photo:a,video:o,paidMedia:r}=(0,l.r_)(i.message);if("chatEditPhoto"===s?.type||"suggestProfilePhoto"===s?.type)return{media:s.photo,isSingle:!0};if(n&&((0,l.Ml)(n)||(0,l.hr)(n)))return{media:n};const d=(0,c.Pn$)(e,i.message);if("full"===d?.webpageType){const{photo:e,video:t,document:i}=d,s=i&&((0,l.Ml)(i)||(0,l.hr)(i)),n=t||(s?i:void 0)||e;if(n)return{media:n,isSingle:!0}}if(r){const e=r.extendedMedia[i.mediaIndex||0];if(!("mediaType"in e)){const{photo:t,video:i}=e;return{media:t||i}}}const h=o||a;return h?{media:h}:void 0}var C=i(19822),y=i(83868),S=i(16460),k=i(41512),N=i(43503);function w(e,t){const i=document.createElement("div");i.classList.add("ghost");const s=new Image;if(s.draggable=!1,s.oncontextmenu=y.A,"string"==typeof e?s.src=e:e instanceof HTMLVideoElement?s.src=e.poster:s.src=e.src,i.appendChild(s),t===a.TQ.ProfileAvatar||t===a.TQ.SettingsAvatar){i.classList.add("ProfileInfo"),t===a.TQ.SettingsAvatar&&i.classList.add("self");const e=document.querySelector(t===a.TQ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&i.appendChild(e.cloneNode(!0))}return i}function I(e,t,i){let s,n;switch(e){case a.TQ.Album:case a.TQ.ScheduledAlbum:s=`.Transition_slide-active > .MessageList #album-media-${(0,l.GZ)(t.id,i)}`,n=".full-media";break;case a.TQ.PreviewMedia:s=`#preview-media${i}`,n="img";break;case a.TQ.SharedMedia:s=`#shared-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.SearchResult:s=`#search-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.MiddleHeaderAvatar:s=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",n=".avatar-media";break;case a.TQ.SettingsAvatar:s="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ProfileAvatar:s="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ChannelAvatar:case a.TQ.SuggestedAvatar:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=".Avatar img";break;case a.TQ.StarsTransaction:s=".transaction-media-preview",n=0===i?`.stars-transaction-media-${i} :is(img, video)`:void 0;break;case a.TQ.SponsoredMessage:s=".Transition_slide-active > .MessageList .sponsored-media-preview",n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`;break;case a.TQ.ScheduledInline:case a.TQ.Inline:default:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`}const r=document.querySelector(s),c=n?r?.querySelectorAll(n):void 0;return{container:r,mediaEl:c?.[0]}}function P(e,t){switch(t){case a.TQ.Album:case a.TQ.ScheduledAlbum:case a.TQ.Inline:case a.TQ.ScheduledInline:case a.TQ.StarsTransaction:case a.TQ.PreviewMedia:e.classList.add("rounded-corners");break;case a.TQ.SharedMedia:case a.TQ.SettingsAvatar:case a.TQ.ProfileAvatar:case a.TQ.SearchResult:e.firstChild.style.objectFit="cover";break;case a.TQ.MiddleHeaderAvatar:case a.TQ.SuggestedAvatar:case a.TQ.ChannelAvatar:e.classList.add("circle")}}var Y=i(43874),F=i(37661),D=i(30857),M=i(17712),T=i(59030),B=i(41733),L=i(22237);const R=(0,L.n5)(!1),x=R[1],E=R;function V(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function _(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){o.Oig&&console.log("[MV] PictureInPicture Error",e)}}var U=i(73767),O=i(34780),K=i(23174),J=i(32587),G=i(87679);const j=new Map;var z=i(35297);var H=i(62587),$=i(69419);const q=g.cf,W=({media:e,isAvatar:t,origin:i,delay:n})=>{const o=t&&"photo"===e?.mediaType&&!e.isVideo,r=t&&"photo"===e?.mediaType&&e.isVideo,c="document"===e?.mediaType,d="video"===e?.mediaType&&!e.isRound||c&&(0,l.hr)(e),h="photo"===e?.mediaType||c&&(0,l.Ml)(e),u="video"===e?.mediaType&&e.isGif,m=i===a.TQ.SharedMedia,p=i===a.TQ.SearchResult,v=e&&(0,l.JU)(e),A=(0,s.Kr)(()=>t=>{if(e)return!o&&!r||t?r&&t?(0,l.Pg)(e):(0,l.VO)(e,t?"full":"preview"):(0,l.mU)(e)},[r,o,e]),f=(0,H.A)(e&&(m||p||c)&&(0,l.VO)(e,"pictogram"),void 0,K.qZ.BlobUrl,n),b=A(),C=(0,H.A)(b,void 0,K.qZ.BlobUrl,n),{mediaData:y,loadProgress:S}=(0,$.A)(A(!0),void 0,e&&(0,l.Cz)(e,"full"),n),k=e&&"blobUrl"in e?e.blobUrl:void 0;let N=!d&&(k||y)||C||f;const w=function(e){const t=(0,s.li)();let i=!1;(0,z.A)(()=>{if(i=!0,t.current=void 0,!e)return;const s=new Image;if(s.src=e,!s.width)return;const n=(0,G.PR)(s);(0,J.A)(n.getContext("2d"),0,0,n.width,n.height,2,2),t.current=n.toDataURL()},[e]);const n=function(e,t=!1,i){const n=(0,s.li)(e?j.get(e):void 0),a=(0,s.li)(),o=(0,D.A)();return a.current&&t&&(clearTimeout(a.current),a.current=void 0),(0,s.vJ)(()=>{if(!e||n.current||t)return;const s=new Image;s.onload=()=>{const t=(0,G.PR)(s);(0,J.A)(t.getContext("2d"),0,0,t.width,t.height,2,2);const i=t.toDataURL();n.current=i,o(),j.size>=1e3&&j.clear(),j.set(e,i)},i?a.current=window.setTimeout(()=>{s.src=e},i):s.src=e},[e,i,o,t]),n.current}(e||void 0,Boolean(t.current));return t.current||!i&&n||e||void 0}(!N&&e&&(0,l.VD)(e));N||i===a.TQ.SearchResult||(N=w),r&&C&&(N=C);const I=k||y||(r||d?void 0:C||f||N),P=e&&(0,l.si)(e),Y=Boolean(k),F=(0,s.Kr)(()=>t?r?g._e:g.cf:c?e.mediaSize||q:h?(0,l.Xn)(e):d?(0,l.NZ)(e):q,[t,c,h,d,r,e]);return{getMediaHash:A,media:e,isVideo:d,isPhoto:h,isGif:u,isDocument:c,bestImageData:N,bestData:I,dimensions:F,contentType:v,isVideoAvatar:r,isLocal:Y,loadProgress:S,mediaSize:P}};var Q=i(18276),Z=i(64493),X=i(40664),ee=i(22337),te=i(1087),ie=i(20021);const se=(0,s.ph)(({isOpen:e,peerId:t,photo:i,onClose:a,onCloseAnimationEnd:o})=>{const{reportProfilePhoto:r}=(0,n.ko)(),[l,c]=(0,s.J0)("spam"),[d,h]=(0,s.J0)(""),u=(0,M.A)(()=>{r({chatId:t,photo:i,reason:l,description:d}),a()}),m=(0,M.A)(e=>{c(e)}),p=(0,M.A)(e=>{h(e.target.value)}),v=(0,T.A)(),g=(0,s.Kr)(()=>[{value:"spam",label:v("lng_report_reason_spam")},{value:"violence",label:v("lng_report_reason_violence")},{value:"pornography",label:v("lng_report_reason_pornography")},{value:"childAbuse",label:v("lng_report_reason_child_abuse")},{value:"copyright",label:v("ReportPeer.ReasonCopyright")},{value:"illegalDrugs",label:"Illegal Drugs"},{value:"personalDetails",label:"Personal Details"},{value:"other",label:v("lng_report_reason_other")}],[v]);if(!t||!i)return;const A=v("ReportPeer.Report");return(0,ie.FD)(ee.A,{isOpen:e,onClose:a,onEnter:e?u:void 0,onCloseAnimationEnd:o,className:"narrow",title:A,children:[(0,ie.Y)(te.A,{className:"dialog-checkbox-group",name:"report-message",options:g,onChange:m,selected:l}),(0,ie.Y)(X.A,{label:v("lng_report_reason_description"),value:d,onChange:p}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u,children:v("lng_report_button")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:v("Cancel")})]})]})});var ne=i(26607),ae=i(41036);const[oe,re]=(0,L.n5)(1);function le(){return(0,s._W)(()=>{re(1)}),[oe,re]}const ce=(0,s.ph)(({isOpen:e,photo:t,profileId:i,onClose:a,onConfirm:o})=>{const{deleteProfilePhoto:r,deleteChatPhoto:l}=(0,n.ko)(),c=(0,s.hb)(()=>{o?.(),(0,v.L8)(i)?r({photo:t}):l({photo:t,chatId:i}),a()},[o,i,a,r,t,l]),d=(0,T.A)();return(0,ie.Y)(ee.A,{isOpen:e,onClose:a,onEnter:c,className:"delete dialog-buttons-column",title:d("AreYouSure"),children:(0,ie.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ie.Y)(Z.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:c,children:d("Preview.DeletePhoto")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:d("Cancel")})]})})});var de=i(22699),he=i(24433),ue=i(35913);const me=(0,s.ph)((0,n.EK)((e,{item:t,canUpdateMedia:i})=>{const s=(0,c.nTw)(e),{origin:n}=s.mediaViewer,a="message"===t?.type?t.message:void 0,o="avatar"===t?.type?t.avatarOwner:void 0,r="avatar"===t?.type&&t.profilePhotos.photos[t.mediaIndex],l=(0,c.meB)(e),d=(0,c.Xf0)(e),{threadId:h}=(0,c.Xf0)(e)||{},u=(0,c.ynf)(e,a),m=(0,c.yuw)(e),p=a&&(0,c.ryq)(e,a?.chatId),{canDelete:v}=h&&a&&(0,c.WAX)(e,a,h)||{},g=r&&r.id===o?.avatarPhotoId,A=i&&Boolean(r),f=v||A,C=i&&Boolean(r)&&!g,y=d?.type;return{activeDownloads:m,isProtected:u,chat:l,isChatProtected:p,canDelete:f,canUpdate:C,messageListType:y,origin:n,viewableMedia:b(e,0,t)}})(({item:e,mediaData:t,isVideo:i,chat:a,isChatProtected:o,isProtected:r,canReportAvatar:c,canDelete:d,canUpdate:h,messageListType:u,activeDownloads:m,origin:p,viewableMedia:g,onReportAvatar:A,onCloseMediaViewer:f,onBeforeDelete:b,onForward:C})=>{const[y,S,k]=(0,F.A)(!1),[N,w]=le(),{isMobile:I}=(0,Y.Ay)(),{downloadMedia:P,cancelMediaDownload:D,updateProfilePhoto:B,updateChatPhoto:L,openMediaViewer:R,openDeleteMessageModal:x}=(0,n.ko)(),E="message"===e?.type,{media:V}=g||{},_=V&&(0,l.sd)(V),U=V&&(0,l.$r)(m,V),{loadProgress:O}=(0,$.A)(V&&(0,l.VO)(V,"download"),!U,V&&(0,l.Cz)(V,"download")),K=(0,M.A)(()=>{if(V)if(U)D({media:V});else{const t="message"===e?.type?e.message:void 0;P({media:V,originMessage:t})}}),J=(0,M.A)(()=>{const e=N();w((e<0?e:0)-1)}),G=(0,M.A)(()=>{const e=N();w((e>0?e:0)+1)}),j=(0,M.A)(()=>{if("avatar"!==e?.type)return;const{avatarOwner:t,profilePhotos:i,mediaIndex:s}=e,n=i?.photos[s];(0,v.L8)(t.id)?B({photo:n}):L({chatId:t.id,photo:n}),R({origin:p,chatId:t.id,mediaIndex:0,isAvatarView:!0},{forceOnHeavyAnimation:!0})}),z=(0,T.A)(),H=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions",children:(0,ie.Y)(Q.A,{name:"more"})}),[]);function q(){return"avatar"===e?.type?(0,ie.Y)(ce,{isOpen:y,onClose:k,onConfirm:b,profileId:e.avatarOwner.id,photo:e.profilePhotos.photos[e.mediaIndex]}):void 0}const W=(0,M.A)(()=>{"message"===e?.type&&a?x({chatId:a?.id,messageIds:[e.message.id],isSchedule:"scheduled"===u,onConfirm:b}):S()});if(I){const s=[];if(E&&e.message.isForwardingAllowed&&!e.message.content.action&&!o&&s.push({icon:"forward",onClick:C,children:z("Forward")}),r||(i?s.push({icon:U?"close":"download",onClick:K,children:U?`${Math.round(100*O)}% Downloading...`:"Download"}):s.push({icon:"download",href:t,download:_,children:z("AccActionDownload")})),c&&s.push({icon:"flag",onClick:A,children:z("ReportPeer.Report")}),h&&s.push({icon:"copy-media",onClick:j,children:z("ProfilePhoto.SetMainPhoto")}),d&&s.push({icon:"delete",onClick:W,children:z("Delete"),destructive:!0}),0===s.length)return;return(0,ie.FD)("div",{className:"MediaViewerActions-mobile",children:[(0,ie.Y)(de.A,{trigger:H,positionX:"right",children:s.map(({icon:e,onClick:t,href:i,download:s,children:n,destructive:a})=>(0,ie.Y)(he.A,{icon:e,href:i,download:s,onClick:t,destructive:a,children:n},e))}),U&&(0,ie.Y)(ue.A,{progress:O,size:"s",noCross:!0}),d&&q()]})}return(0,ie.FD)("div",{className:"MediaViewerActions",children:[E&&e.message.isForwardingAllowed&&!o&&(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Forward"),onClick:C,children:(0,ie.Y)(Q.A,{name:"forward"})}),function(){if(!r&&"standalone"!==e?.type)return"sponsoredMessage"!==e?.type&&(i?(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("AccActionDownload"),onClick:K,children:U?(0,ie.Y)(ue.A,{progress:O,size:"s",onClick:K}):(0,ie.Y)(Q.A,{name:"download"})}):(0,ie.Y)(Z.A,{href:t,download:_,round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("AccActionDownload"),children:(0,ie.Y)(Q.A,{name:"download"})}))}(),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("MediaZoomOut"),onClick:J,children:(0,ie.Y)(Q.A,{name:"zoom-out"})}),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("MediaZoomIn"),onClick:G,children:(0,ie.Y)(Q.A,{name:"zoom-in"})}),c&&(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z(i?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:A,children:(0,ie.Y)(Q.A,{name:"flag"})}),h&&(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("ProfilePhoto.SetMainPhoto"),onClick:j,children:(0,ie.Y)(Q.A,{name:"copy-media"})}),d&&(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Delete"),onClick:W,children:(0,ie.Y)(Q.A,{name:"delete"})}),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Close"),onClick:f,children:(0,ie.Y)(Q.A,{name:"close"})}),d&&q()]})}));var pe=i(87357),ve=i(50442),ge=i(43336),Ae=i(37836),fe=i(14737),be=i(16581),Ce=i(19129),ye=i(26072),Se=i(15283);function ke(e){const t=(0,s.li)(e());return(0,Se.A)(()=>e.subscribe(()=>{t.current=e()})),t}var Ne=i(90423),we=i(39751),Ie=i(83414);const[Pe,Ye]=(0,L.n5)(!1),[Fe,De]=(0,L.n5)(!1);function Me(){return[(0,Ie.A)(()=>Pe()&&!Fe(),[Pe,Fe]),Ye,De]}var Te=i(56494);const[Be,Le]=(0,L.n5)(0);function Re(){return(0,s._W)(()=>{Le(0)}),[Be,Le]}var xe=i(5718),Ee=i(672),Ve=i(57474);const _e=({text:e="",buttonText:t,isForVideo:i,onClick:n,handleSponsoredClick:a,isProtected:o,isForceMobileVersion:r})=>{const[l,c]=(0,s.J0)(!1),{isMobile:d}=(0,Y.Ay)(),[h]=Me(),m=(0,Ce.A)(()=>!!u.TF&&!h(),[h]);(0,s.vJ)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;c(t>2*g.$)};t();const i=(0,Ae.nF)(t,500,!0);return window.addEventListener("resize",i,!1),()=>{window.removeEventListener("resize",i,!1)}},[]);const p=(0,M.A)(()=>{a()}),v=(0,pe.A)("MediaViewerFooter",i&&"is-for-video",m&&"is-hidden",o&&"is-protected",r&&"mobile");return(0,ie.FD)("div",{className:v,onClick:function(t){e&&t.stopPropagation()},children:[Boolean(e)&&(0,ie.Y)("div",{className:"media-viewer-footer-content",onClick:d?void 0:n,children:(0,ie.Y)("p",{className:"media-text custom-scroll allow-selection "+(l?"multiline":""),dir:"auto",children:e})}),Boolean(t)&&(0,ie.Y)(Z.A,{className:(0,pe.A)("media-viewer-footer-content","media-viewer-button"),size:"default",color:"primary",isRectangular:!0,onClick:p,children:t})]})};var Ue=i(15640),Oe=i(84313),Ke=i(71533),Je=i(50680),Ge=i(73622);const[je,ze]=(0,L.n5)(!1);function He(){return(0,s._W)(()=>{ze(!1)}),[je,ze]}var $e=i(17663),qe=i(70832),We=i(71429),Qe=i(82497),Ze=i(41074),Xe=i(4875);const et=u.Ni||u.pz,tt=u.Ni||u.pz?.3:.25,it=et?40:80,st=200,nt=(0,Ze.Ay)();let at;class ot{frames=new Map;currentTime=0;constructor(e,t){this.canvas=t,nt.forEach(({connector:t},i)=>{t.request({name:"video-preview:init",args:[e,it,i,Ze.bP,this.onFrame.bind(this)]})})}onFrame(e,t){this.frames.set(e,t),e===this.currentTime&&this.render(e)}clearCache(){this.frames.forEach(e=>{e.close()}),this.frames.clear()}render(e){this.currentTime=e;const t=this.frames.get(e);return!!t&&((0,r.RK)(()=>{this.canvas.width=t.width,this.canvas.height=t.height,this.canvas.getContext("2d").drawImage(t,0,0,this.canvas.width,this.canvas.height)}),!0)}destroy(){this.clearCache(),nt.forEach(({connector:e})=>{e.request({name:"video-preview:destroy",args:[]})})}}nt.forEach(({worker:e})=>{e.addEventListener("message",async t=>{const{type:i,messageId:s,params:n}=t.data;if("requestPart"!==i)return;const a=await(0,Xe.px)("downloadMedia",{mediaFormat:K.qZ.Progressive,...n});if(!a)return;const{arrayBuffer:o}=a;e.postMessage({type:"partResponse",messageId:s,result:o},[o])})});var rt=i(63988);const lt="Od9ZSc1U";let ct;const dt=(0,s.ph)(({duration:e,bufferedRanges:t,isReady:i,posterSize:n,playbackRate:a,url:o,isActive:r,isPlaying:l,isPreviewDisabled:c,onSeek:d,onSeekStart:h})=>{const m=(0,s.li)(),[p]=Re(),[v]=He(),g=(0,rt.aG)(p,250),[A,f]=(0,s.Ul)(g()),[b,y]=(0,s.Ul)(0),[S,k]=(0,s.Ul)(0),N=(0,s.li)(!1),[w,I]=(0,s.J0)(!1),[P,Y]=(0,s.J0)(!1),F=(0,s.li)(),D=(0,s.li)(),T=(0,s.li)(),B=(0,s.li)(),L=(0,s.Kr)(()=>function(e,t){const i=(e=Math.round(e*tt))/(t=Math.round(t*tt));return e>st&&(e=st,t=Math.round(e/i)),t>st&&(t=st,e=Math.round(t*i)),{width:e,height:t}}(n?.width||0,n?.height||0),[n]),R=(0,M.A)(e=>{e=Math.floor(e),k(e),function(e){at&&at.render(e)}(e)});return(0,s.vJ)(()=>{if(!c&&o&&i)return function(e,t){return at&&at.destroy(),at=new ot(e,t),()=>{at?.destroy(),at=void 0}}(o,F.current)},[o,i,c]),(0,s.vJ)(()=>{I(!1)},[r]),(0,s.vJ)(()=>{if(ct&&ct(),ct=void 0,!N.current&&!P){const t=g(),i=e-t;ct=(0,C.Hd)({from:t,to:e,duration:1e3*i/a,onUpdate:f})}},[g,P,f,a,e]),(0,s.vJ)(()=>{l&&!v()||(ct&&ct(),ct=void 0)},[l,A,v]),(0,s.vJ)(()=>{if(l){ct&&ct(),ct=void 0;const t=g(),i=e-t;ct=(0,C.Hd)({from:t,to:e,duration:1e3*i/a,onUpdate:f})}},[l,a,e]),(0,s.Nf)(()=>{if(!T.current)return;const t=(0,ge.LI)(A()/e*100,2);T.current.style.width=`${t}%`},[A,e]),(0,s.Nf)(()=>{D.current&&(D.current.style.left=`${b()}px`)},[b]),(0,s.Nf)(()=>{B.current&&(B.current.innerText=(0,$e.QO)(S()))},[S]),(0,s.vJ)(()=>{if(!m.current||!r)return;const t=m.current;let i=t.getBoundingClientRect(),s=0,n=0;const a=s=>{const n=(0,Ue.A)(s).x,a=(0,ge.qE)(e*((n-i.left)/i.width),0,e);if(c)return[a,0];i.width||(i=t.getBoundingClientRect());const o=D.current;return[a,(0,ge.qE)(n-i.left-o.clientWidth/2,-4,i.width-o.clientWidth+4)]},o=()=>{ct&&ct(),ct=void 0},l=()=>{o(),N.current=!0,I(!1),Y(!1),f(s),d(s),setTimeout(()=>{N.current=!1},250)},p=(0,ve.wJ)(t,{onCapture:()=>{o(),I(!0),Y(!0),h()},onRelease:l,onClick:l,onDrag:e=>{o(),I(!0),[s,n]=a(e),R(s),y(n),f(s)}});if(u.TF||c)return p;const v=e=>{I(!0),[s,n]=a(e),y(n),R(s)},g=()=>{I(!1)};return t.addEventListener("mousemove",v),t.addEventListener("mouseenter",v),t.addEventListener("mouseleave",g),()=>{p(),t.removeEventListener("mousemove",v),t.removeEventListener("mouseenter",v),t.removeEventListener("mouseleave",g)}},[e,R,r,d,h,y,f,Y,c,a]),(0,ie.FD)("div",{className:"ingarEvU",ref:m,children:[!c&&(0,ie.FD)(ne.A,{isOpen:!0,isHidden:!w,className:"TqpEWfl3",style:`width: ${L.width}px; height: ${L.height}px`,ref:D,children:[(0,ie.Y)("canvas",{className:"fKVz2lln",ref:F}),(0,ie.Y)("div",{className:"bGiNvx5D",children:(0,ie.Y)("span",{className:"mnkqvOMR",ref:B})})]}),(0,ie.Y)("div",{className:lt,children:t.map(({start:e,end:t})=>(0,ie.Y)("div",{className:"ANe2DKfp",style:`left: ${100*e}%; right: ${100-100*t}%`},`${e}-${t}`))}),(0,ie.Y)("div",{className:lt,children:(0,ie.Y)("div",{ref:T,className:(0,pe.A)("igaGLblf",P&&"beUP6SqY")})})]})}),ht=e=>{e.stopPropagation()},ut=[.5,1,1.5,2];function mt(e,t){return(0,ie.Y)("div",{className:"player-time",children:`${(0,$e.QO)(e)} / ${(0,$e.QO)(t)}`})}const pt=(0,s.ph)(({url:e,bufferedRanges:t,bufferedProgress:i,duration:n,isReady:a,fileSize:o,isForceMobileVersion:r,isPlaying:l,isFullscreenSupported:c,isFullscreen:d,isBuffered:h,isPreviewDisabled:m,volume:p,isMuted:v,playbackRate:g,posterSize:A,onChangeFullscreen:f,onVolumeClick:b,onVolumeChange:C,onPlaybackRateChange:y,isPictureInPictureSupported:S,onPictureInPictureChange:k,onPlayPause:N,onSeek:w,onSeekingChange:I})=>{const[P,D,B]=(0,F.A)(),[L]=Re(),R=(0,Ce.A)(()=>Math.trunc(L()),[L]),[x,E]=(0,s.Ul)(!1),V=(0,s.li)(),{isMobile:_}=(0,Y.Ay)(),[U,O]=Me(),K=(0,Ce.A)(U);(0,s.vJ)(()=>{if(u.TF||r){if(K&&l&&!P&&!x())return V.current=window.setTimeout(()=>{O(!1)},3e3),()=>{V.current&&window.clearTimeout(V.current)};V.current&&window.clearTimeout(V.current)}},[l,K,O,P,x,r]),(0,s.Nf)(()=>(K?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[K]),(0,s.vJ)(()=>{K||B()},[B,K]);const J=(0,T.A)(),G=(0,M.A)(e=>{E(!1),w(e),I(!1)}),j=(0,M.A)(()=>{E(!0),I(!0)}),z=(0,s.Kr)(()=>0===p||v?"muted":p<.3?"volume-1":p<.6?"volume-2":"volume-3",[p,v]);return(0,ie.FD)("div",{className:(0,pe.A)("VideoPlayerControls",r&&"mobile",K&&"active"),onClick:ht,children:[(0,ie.Y)(dt,{url:e,duration:n,isReady:a,isPlaying:l,isPreviewDisabled:m,posterSize:A,bufferedRanges:t,playbackRate:g,onSeek:G,onSeekStart:j,isActive:K}),(0,ie.FD)("div",{className:"buttons",children:[(0,ie.Y)(Z.A,{ariaLabel:J("AccActionPlay"),size:"tiny",ripple:!_,color:"translucent-white",className:"play",round:!0,onClick:N,children:(0,ie.Y)(Q.A,{name:l?"pause":"play"})}),(0,ie.Y)(Z.A,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:b,children:(0,ie.Y)(Q.A,{name:z})}),!u.pz&&(0,ie.Y)(Qe.A,{bold:!0,className:"volume-slider",value:v?0:100*p,onChange:C}),mt(R,n),!h&&(0,ie.Y)("div",{className:"player-file-size",children:(0,ie.Y)(qe.A,{size:o,progress:i})}),(0,ie.Y)("div",{className:"spacer"}),(0,ie.Y)(Z.A,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:D,children:`${g}x`}),S&&(0,ie.Y)(Z.A,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:k,children:(0,ie.Y)(Q.A,{name:"pip"})}),c&&(0,ie.Y)(Z.A,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:f,children:(0,ie.Y)(Q.A,{name:d?"smallscreen":"fullscreen"})})]}),(0,ie.Y)(We.A,{isOpen:P,className:(0,pe.A)("playback-rate-menu",!c&&"no-fullscreen",!S&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:B,children:ut.map(e=>(0,ie.Y)(he.A,{disabled:g===e,onClick:()=>y(e),children:`${e}x`}))})]})}),vt=(0,s.ph)(({url:e,isGif:t,posterData:i,posterSize:a,loadProgress:r,fileSize:l,isMediaViewerOpen:c,noPlay:d,volume:h,isMuted:m,playbackRate:p,isForceMobileVersion:v,shouldCloseOnClick:g,isProtected:A,isClickDisabled:f,isPreviewDisabled:b,isSponsoredMessage:C,timestamp:S,handleSponsoredClick:k,onClose:N})=>{const{setMediaViewerVolume:w,setMediaViewerMuted:I,setMediaViewerPlaybackRate:P,setMediaViewerHidden:F}=(0,n.ko)(),D=(0,s.li)(),[T,L]=(0,s.J0)(!u.TF||!u.pz),[R,E,U]=(0,Ne.Ay)(D,L),{isMobile:O}=(0,Y.Ay)(),K=D.current?.duration||0,J=t||K<=30,G=(0,M.A)(()=>{u.Nd||F({isHidden:!0})}),j=(0,M.A)(()=>{u.Nd||F({isHidden:!1})}),[z,H,$]=function(e,t,i){const[n,a]=(0,s.J0)(!1),[r,l]=(0,s.J0)(!1);(0,s.Nf)(()=>{if(u.pz&&u._7||!e.current)return;const s=e.current,n=V(s);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===n)return;s.autoPictureInPicture=!0,a(!0);const o=()=>{t(),l(!0),x(!0)},r=()=>{x(!1),l(!1),i()};return s.addEventListener("enterpictureinpicture",o),s.addEventListener("leavepictureinpicture",r),()=>{s.removeEventListener("enterpictureinpicture",o),s.removeEventListener("leavepictureinpicture",r)}},[e,t,i]);const c=(0,s.hb)(()=>{if(!e.current)return;const t=V(e.current);t?t("inline"):_()},[e]),d=(0,s.hb)(()=>{if(!e.current)return;c();const t=e.current,i=(0,B.e)(t),s=V(t);s?s("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){o.Oig&&console.log("[MV] PictureInPicture Error",e)}}(t),i&&(0,B.A)(t)},[e,c]);return n?[n,d,r]:[!1]}(D,G,j),[,q,W]=Me(),[X,ee]=(0,s.Ul)(!1),te=(0,s.li)({x:0,y:0});(0,s.vJ)(()=>{const e=e=>{te.current=(0,Ue.A)(e)};return window.addEventListener("mousemove",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}},[]);const se=(0,M.A)((e,t)=>{const i=D.current?.getBoundingClientRect();i&&(e<=i.left||e>=i.right||t<=i.top||t>=i.bottom)&&(X()||q(!1))}),ne=(0,M.A)(()=>{q(!0)}),ae=(0,M.A)(e=>{se(e.clientX,e.clientY)}),oe=(0,M.A)(e=>{if(ee(e),!e){const{x:e,y:t}=te.current;se(e,t)}}),{isReady:re,isBuffered:le,bufferedRanges:ce,bufferingHandlers:de,bufferedProgress:he}=(0,Ke.A)(),me=(0,Oe.A)(D,void 0,!e),{shouldRender:pe,transitionClassNames:ve}=(0,Je.A)(!le&&!me,void 0,void 0,"slow"),{shouldRender:Ae,transitionClassNames:fe}=(0,Je.A)(u.pz&&!T&&!pe&&!me,void 0,void 0,"slow"),[,be]=Re(),[,Ce]=He();(0,s.vJ)(()=>{W(pe)},[W,pe]),(0,s.vJ)(()=>{d||!c||me?D.current.pause():e&&!u.TF&&(0,B.A)(D.current)},[d,c,e,I,me]),(0,s.vJ)(()=>{D.current.volume=h},[h]),(0,s.vJ)(()=>{D.current.playbackRate=p},[p]),(0,s.vJ)(()=>{S&&(D.current.currentTime=S,be(S))},[be,S]);const ye=(0,M.A)(e=>{e.stopPropagation(),T?(D.current.pause(),L(!1)):((0,B.A)(D.current),L(!0))}),Se=(0,M.A)(e=>{C&&(k?.(!0),N(e)),f||(g?N(e):ye(e))});(0,Ge.A)(D,de);const ke=(0,M.A)(e=>{const t=e.currentTarget;t.readyState>=4&&(Ce(!1),be(t.currentTime)),J||t.currentTime!==t.duration||(be(0),L(!1))}),we=(0,M.A)(()=>{J||(be(0),L(!1),q(!0))}),Ie=(0,M.A)(()=>{R&&U?U():!R&&E&&E()}),Pe=(0,M.A)(e=>{D.current.currentTime=e}),Ye=(0,M.A)(e=>{w({volume:e/100})}),Fe=(0,M.A)(()=>{D.current.muted=!D.current.muted,I({isMuted:!m})}),De=(0,M.A)(e=>{P({playbackRate:e})});(0,s.vJ)(()=>{if(!c)return;const e=e=>{if(!R)return;const t=D.current,i=(0,ge.qE)(t.currentTime+5*e,0,t.duration);Number.isFinite(i)&&(t.currentTime=i)},t=t=>{if(!$)switch(t.key){case" ":case"Enter":t.preventDefault(),ye(t);break;case"Left":case"ArrowLeft":t.preventDefault(),e(-1);break;case"Right":case"ArrowRight":t.preventDefault(),e(1)}};return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}},[ye,c,R,$]);const Te=a&&`width: ${a.width}px; height: ${a.height}px`,Be=`background-image: url(${i})`,Le=!u.TF&&!v;return(0,ie.FD)("div",{className:"VideoPlayer",onMouseMove:Le?ne:void 0,onMouseLeave:Le?ae:void 0,children:[(0,ie.FD)("div",{style:Te,children:[A&&(0,ie.Y)("div",{onContextMenu:y.A,onDoubleClick:u.TF?void 0:Ie,onClick:O?void 0:ye,className:"protector"}),(0,ie.Y)("video",{ref:D,autoPlay:u.TF,controlsList:"nodownload",playsInline:!0,loop:J,muted:t||m,id:"media-viewer-video",style:Be,onWaiting:()=>Ce(!0),onPlay:()=>L(!0),onEnded:we,onClick:O||R?void 0:Se,onDoubleClick:u.TF?void 0:Ie,...de,onPause:e=>{L(!1),de.onPause(e)},onTimeUpdate:ke,src:e})]}),Ae&&(0,ie.Y)(Z.A,{round:!0,className:`play-button ${fe}`,onClick:ye,children:(0,ie.Y)(Q.A,{name:"play"})}),pe&&(0,ie.FD)("div",{className:["spinner-container",ve].join(" "),children:[!le&&(0,ie.Y)("div",{className:"buffering",children:"Buffering..."}),(0,ie.Y)(ue.A,{size:"xl",progress:le?1:r,onClick:N})]}),!t&&!C&&!me&&(0,ie.Y)(pt,{url:e,isPlaying:T,bufferedRanges:ce,bufferedProgress:he,isBuffered:le,isFullscreenSupported:Boolean(E),isPictureInPictureSupported:z,isFullscreen:R,isPreviewDisabled:b,fileSize:l,duration:K,isReady:re,posterSize:a,isForceMobileVersion:v,onSeek:Pe,onChangeFullscreen:Ie,onPictureInPictureChange:H,onPlayPause:ye,volume:h,playbackRate:p,isMuted:m,onVolumeClick:Fe,onVolumeChange:Ye,onPlaybackRateChange:De,onSeekingChange:oe})]})}),gt=(0,s.ph)((0,n.EK)((e,{item:t})=>{const{volume:i,isMuted:s,playbackRate:n,isHidden:a,origin:o,timestamp:r,threadId:l}=(0,c.nTw)(e).mediaViewer,d="message"===t.type?t.message:void 0,h="sponsoredMessage"===t.type?t.message:void 0,u=d||h,m=b(e,0,t),p=d&&(0,Te.me)(e,d,!0);return{origin:o,textMessage:u,isProtected:d&&(0,c.ynf)(e,d),volume:i,isMuted:s,isHidden:a,playbackRate:n,threadId:l,timestamp:r,maxTimestamp:p,viewableMedia:m}})(({item:e,viewableMedia:t,isActive:i,textMessage:s,origin:a,withAnimation:r,isProtected:l,volume:c,playbackRate:d,isMuted:m,isHidden:p,isMoving:v,threadId:f,timestamp:b,maxTimestamp:C,onClose:y,onFooterClick:S,handleSponsoredClick:k})=>{const{updateLastPlaybackTimestamp:N}=(0,n.ko)(),w=(0,T.A)(),I="avatar"===e.type,P="sponsoredMessage"===e.type,{media:F}=t||{},{isVideo:D,isPhoto:B,bestImageData:L,bestData:R,dimensions:x,isGif:E,isLocal:V,isVideoAvatar:_,mediaSize:U,loadProgress:O}=W({media:F,isAvatar:I,origin:a,delay:!!r&&350}),[,K]=Me(),[J]=Re(),G=Boolean(F),{isMobile:j}=(0,Y.Ay)(),z=(0,M.A)(()=>{K(!0)}),H=(0,Ee.A)(()=>{if(!i||!s||"video"!==F?.mediaType)return;if(F.duration<o.u4b)return;const e="id"in s?s:void 0,t=J();if(!t||!e||e.isInAlbum)return;const n=F.duration-t>1?t:void 0;N({chatId:e.chatId,messageId:e.id,timestamp:n})},[J,i,F,s],1e3);if((0,xe.R)(H,[J]),!F)return;if("avatar"===e.type)return _?(0,ie.Y)("div",{className:"MediaViewerContent",children:(0,ie.Y)(vt,{url:R,isGif:!0,posterData:L,posterSize:(0,g.sk)(x,!1,!0),loadProgress:O,fileSize:U,isMediaViewerOpen:G&&i,isProtected:l,isPreviewDisabled:!h.G9||V,noPlay:!i,onClose:y,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:v,playbackRate:1,isSponsoredMessage:P,handleSponsoredClick:k},F.id)},F.id):(0,ie.Y)("div",{className:"MediaViewerContent",children:At(R,(0,g.sk)(x,!1),!j&&!l,l)},F.id);const $=s&&(s.content.action?"suggestProfilePhoto"===s.content.action.type?w("Conversation.SuggestedPhotoTitle"):void 0:(0,A.V)({message:s,maxTimestamp:C,threadId:f,forcePlayback:!0,isForMediaViewer:!0})),q=s&&"buttonText"in s?s.buttonText:void 0,Q=Boolean($),Z=(0,g.sk)(x,Q,D),X=j||function(e){return!!e&&e.width<350}(Z);return(0,ie.FD)("div",{className:(0,pe.A)("MediaViewerContent",Q&&"has-footer"),onMouseMove:X&&!u.TF?z:void 0,children:[B&&At(R,Z,!j&&!l,l),D&&(i?(0,ie.Y)(vt,{url:R,isGif:E,posterData:L,posterSize:Z,loadProgress:O,fileSize:U,isMediaViewerOpen:G&&i,noPlay:!i,isPreviewDisabled:!h.G9||V,onClose:y,isMuted:m,isHidden:p,isForceMobileVersion:X,isProtected:l,volume:c,isClickDisabled:v,playbackRate:d,isSponsoredMessage:P,handleSponsoredClick:k,timestamp:b},F.id):ft(L,Z,!j&&!l,l)),$&&(0,ie.Y)(_e,{text:$,buttonText:q,onClick:S,isProtected:l,isForceMobileVersion:X,isForVideo:D&&!E,handleSponsoredClick:k})]})}));function At(e,t,i,s){return e?(0,ie.FD)("div",{style:"position: relative;",children:[s&&(0,ie.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,ie.Y)("img",{src:e,alt:"",className:(0,pe.A)(s&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(i)})]}):(0,ie.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ie.Y)(Ve.A,{color:"white"})})}function ft(e,t,i,s){const n=t&&`width: ${t.width}px; height: ${t.height}px`,a=`background-image: url(${e})`;return e?(0,ie.FD)("div",{className:"VideoPlayer",children:[s&&(0,ie.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,ie.Y)("div",{style:n,children:(0,ie.Y)("video",{style:a,className:(0,pe.A)(s&&"is-protected"),draggable:Boolean(i)})})]}):(0,ie.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ie.Y)(Ve.A,{color:"white"})})}const{easeOutCubic:bt,easeOutQuart:Ct}=C.qM,yt=u.TF?40:0,St=350;let kt,Nt;var wt=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(wt||{});const It=(0,s.ph)(({item:e,isVideo:t,isGif:i,isOpen:n,withAnimation:a,isHidden:o,isLoadingMoreMedia:r,isSynced:l,loadMoreItemsIfNeeded:c,getNextItem:d,selectItem:h,onClose:m,onFooterClick:p,handleSponsoredClick:v})=>{const g=(0,s.li)(),A=(0,s.li)(),f=(0,s.li)(),b=(0,s.li)(),y=(0,s.li)({x:0,y:0,scale:1}),S=(0,s.li)(void 0),k=(0,s.li)(void 0),N=(0,s.li)(!1),[w,I]=(0,s.J0)(!0),[P]=le(),Y=(0,s.li)(P()),F=(0,Ne.zk)(),[D,B]=(0,s.J0)(!1),[L,R]=(0,s.Ul)({x:0,y:0,scale:1}),x=ke(L),[E,V]=(0,s.Ul)(e),_=ke(E),U=(0,Ce.A)(()=>1!==L().scale,[L]),O=(0,Ce.A)(E),{height:K,width:J,isResizing:G}=(0,we.A)(),[j,z,H]=Me(),$=(0,T.A)();(0,ye.A)({isActive:n,onBack:m,shouldBeReplaced:!0});const q=(0,be.A)(h,[h],350,!0),W=(0,be.A)(()=>{S.current=void 0},[],500,!0),Q=(0,be.A)(e=>I(e),[],800,!0),Z=Boolean(i&&!u.pz),X=u.TF?40:J/10,ee=(0,M.A)(e=>{if(!u.TF)return;const t=K-e.pageY<80;!t&&e.pageX<X||!t&&e.pageX>J-X||z(!j())});(0,fe.A)(()=>z(!0),St),(0,s.vJ)(()=>{const{scale:t,x:i,y:s}=x.current;0===i&&0===s&&1===t&&V(e)},[e,V,x]),(0,s.vJ)(()=>{l&&O&&!r&&c(O)},[O,c,l,r]),(0,s.Nf)(()=>{const{x:e,y:t,scale:i}=L();H(1!==i),f.current&&(f.current.style.transform=Pt(-J+e-yt)),A.current&&(A.current.style.transform=Pt(e,t,i)),b.current&&(b.current.style.transform=Pt(J+e+yt))},[L,H,J]),(0,s.vJ)(()=>{if(!g.current||void 0===_.current||o||F)return;let e=y.current;const t={x:0,y:0},i={x:0,y:0},s={x:0,y:0};let n,r=Date.now();const l=(0,Ae.sg)(()=>{r=Date.now()},500,!1,!0),c=t=>{const i=_.current;if(void 0===i)return!1;const s=d(i,t);if(void 0!==s){const i=(J+yt)*t,n=x.current.x+i;return I(!1),V(s),q(s),Q(!0),e={x:0,y:0,scale:1},a?(kt=(0,C.Hd)({from:n,to:0,duration:St,timing:bt,onUpdate:e=>R({y:0,x:e,scale:1})}),!0):(R(e),!0)}return!1},h=e=>{const{scale:t}=x.current;if(1!==t)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let i=0;return K-e.pageY<80?[!1,!1]:(e.pageX<X?i=-1:e.pageX>J-X&&(i=1),[0!==i,c(i)])},p=e=>{const{scale:t}=x.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},v=({x:e,y:t,scale:i},s=0)=>{const n=k.current;if(!n)return[{x:e,y:t,scale:i},!0,!0];let a=!0,o=!0;const r=(J-J*i)/2,l=(K-K*i)/2,c=Math.max(-n.left*i,r),d=J-n.right*i;a=(0,ge.Bt)(e,d,c),e=(0,ge.qE)(e,d,c);const h=Math.max(-n.top*i+s,l),u=K-n.bottom*i;return o=(0,ge.Bt)(t,u,h),[{x:e,y:t=(0,ge.qE)(t,u,h),scale:i},a,o]},f=n=>{if(N.current)return void(N.current=!1);"mouseup"===n.type&&B(!1);const a=x.current,{y:o,scale:l}=a;let c=a.x;const h=Math.abs(c),u=Math.abs(o);if(W(),Q(!0),l<1)return e={x:0,y:0,scale:1},void(kt=(0,C.Hd)({from:[c,o,l],to:[0,0,1],duration:St,timing:bt,onUpdate:e=>R({x:e[0],y:e[1],scale:e[2]})}));if(l>1){const a=Math.min(l,4),d=a/l;let h=c*d+(i.x-d*i.x),u=o*d+(i.y-d*i.y);const m=.15;if("wheel"!==n.type&&e.scale===l){const e=Math.abs(t.x)/(Date.now()-r),i=Math.abs(t.y)/(Date.now()-r);h-=Math.abs(t.x)*e*m*s.x,u-=Math.abs(t.y)*i*m*s.y}return[e]=v({x:h,y:u,scale:a},60),void(kt=(0,C.Hd)({from:[c,o,l],to:[e.x,e.y,e.scale],duration:St,timing:bt,onUpdate:e=>R({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:c,y:o,scale:l},u>=50)return void m();if(u>0)return void(kt=(0,C.Hd)({from:o,to:0,duration:St,timing:bt,onUpdate:e=>R({x:0,y:e,scale:l})}));const p=c<0?1:-1,g=_.current,A=g&&d(g,c<0?1:-1),f=s.x<0?-1:1;void 0!==A&&h>=50&&p===f&&(c+=(J+yt)*p,V(A),q(A)),kt=(0,C.Hd)({from:c,to:0,duration:St,timing:bt,onUpdate:e=>R({y:0,x:e,scale:l??1})})},b=(0,ve.wJ)(g.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls, .VideoPlayerControls",minZoom:1,maxZoom:4,doubleTapZoom:3,withWheelDrag:!0,onCapture:e=>{if(Ft(e))return;const{x:t,y:i,scale:s}=x.current;if("mousedown"!==e.type||(B(!0),1===s)){if(r=Date.now(),0===t&&0===i&&1===s){if(!A.current)return;if(n=A.current.querySelector("img, video"),!n)return;k.current=n.getBoundingClientRect()}}else e.preventDefault()},onDrag:(i,n,{dragOffsetX:a,dragOffsetY:o},r)=>{if(N.current||Ft(i))return;if(u.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=ve.h6||e>=J-ve.h6)return}kt&&(kt(),kt=void 0),s.x=t.x-a,s.y=t.y-o,t.x=a,t.y=o;const c=Math.abs(a),d=Math.abs(o),{x:h,y:m,scale:p}=x.current;if(l(),1!==p){const t=e.x+a,s=e.y+o;if(["wheel","mousemove"].includes(i.type)){const[e,i,n]=v({x:t,y:s,scale:p},60);return r&&r(!i,!n),void R(e)}return void("touches"in i&&1===i.touches.length&&R({x:t,y:s,scale:p}))}if("mousemove"!==i.type){if(S.current!==wt.Vertical&&(S.current===wt.Horizontal||Math.abs(h)>ve.no||c/d>ve.fG)){S.current=wt.Horizontal,I(!1);const e=J+yt,t=(0,ge.qE)(a,-e,e);return R({x:t,y:0,scale:p}),void("wheel"===i.type&&Math.abs(t)>100&&(f(i),N.current=!0))}if(S.current===wt.Vertical||Math.abs(m)>ve.no||d/c>ve.fG){S.current=wt.Vertical;const e=K,t=(0,ge.qE)(o,-e,e);R({x:0,y:t,scale:p}),"wheel"===i.type&&Math.abs(t)>100&&(f(i),N.current=!0)}}},onZoom:(t,{zoom:s,zoomFactor:n,initialCenterX:a,initialCenterY:o,dragOffsetX:r,dragOffsetY:l,currentCenterX:c,currentCenterY:d})=>{kt&&kt(),a=a||J/2,o=o||K/2,c=c||J/2,d=d||K/2;const h=s??(0,ge.qE)(e.scale*n,.5,12),u=h/e.scale,m=Math.abs(Math.min(e.x,0)),p=Math.abs(Math.min(e.y,0));i.x=c,i.y=d;const g=m+a,A=p+o,f=g-u*g,b=A-u*A,[C]=v({x:e.x+f+r,y:e.y+b+l,scale:h});R(C)},onClick(t){B(!1);const[i,s]=h(t);if(i){if(t.preventDefault(),t.stopPropagation(),u.TF)return;s||m()}else 1!==e.scale||u.TF||!Z&&Yt(t.target,".VideoPlayer")||m()},onDoubleClick(t,{centerX:i,centerY:s}){const[n]=h(t);if(n)return t.preventDefault(),void t.stopPropagation();if(!u.TF&&"wheel"!==t.type)return;const{x:a,y:o,scale:r}=x.current;if(1===r){if(0!==a||0!==o)return;e=v({x:i-3*i,y:s-3*s,scale:3})[0]}else e={x:0,y:0,scale:1};kt=(0,C.Hd)({from:[a,o,r],to:[e.x,e.y,e.scale],duration:St,timing:bt,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};R(t)}})},onRelease:f});return document.addEventListener("keydown",p,!1),()=>{b(),document.removeEventListener("keydown",p,!1)}},[_,W,X,d,F,o,m,q,V,Q,R,Z,x,K,J,a]),(0,s.vJ)(()=>{const e=P(),t=void 0!==Y.current&&Y.current!==e;if(!g.current||!t||o||F)return;Y.current=e;const{scale:i}=x.current,s=e>0?-1:1;let n=100,a=0;i<=.6&&s>0||i>=12&&s<0||(1===i&&s>0&&(n=20),Nt&&Nt(),Nt=(0,C.Hd)({from:s,to:s*n,duration:St,timing:Ct,onUpdate:e=>{if(!g.current)return;const t=(0,ge.LI)(e-a,2);a=e;const i=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});g.current.dispatchEvent(i)}}))},[P,o,F,x]);const[te,se]=(0,s.Kr)(()=>void 0===O?[void 0,void 0]:[d(O,-1),d(O,1)],[O,d]);if(void 0===O)return;const ne=void 0!==te,ae=void 0!==se,oe=D&&U;return(0,ie.FD)("div",{className:"MediaViewerSlides",ref:g,children:[(0,ie.Y)("div",{className:"MediaViewerSlide",ref:f,children:ne&&!U&&!G&&(0,ie.Y)(gt,{withAnimation:a,isMoving:oe,item:te,onClose:m,onFooterClick:p,handleSponsoredClick:v})}),(0,ie.Y)("div",{className:(0,pe.A)("MediaViewerSlide","MediaViewerSlide--active",oe&&"MediaViewerSlide--moving"),onClick:ee,ref:A,children:(0,ie.Y)(gt,{item:O,withAnimation:a,isActive:w,isMoving:oe,onClose:m,onFooterClick:p,handleSponsoredClick:v})}),(0,ie.Y)("div",{className:"MediaViewerSlide",ref:b,children:ae&&!U&&!G&&(0,ie.Y)(gt,{withAnimation:a,isMoving:oe,item:se,onClose:m,onFooterClick:p,handleSponsoredClick:v})}),ne&&!U&&!u.TF&&(0,ie.Y)("button",{type:"button",className:`navigation prev ${t&&!i&&"inline"}`,"aria-label":$("AccDescrPrevious"),dir:$.isRtl?"rtl":void 0}),ae&&!U&&!u.TF&&(0,ie.Y)("button",{type:"button",className:`navigation next ${t&&!i&&"inline"}`,"aria-label":$("Next"),dir:$.isRtl?"rtl":void 0})]})});function Pt(e=0,t=0,i=1){return`translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${i.toFixed(3)})`}function Yt(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function Ft(e){const t=e.target;return!!Yt(t,".VideoPlayerControls")&&(Yt(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu, .SeekLine")||e.preventDefault(),!0)}var Dt=i(70636),Mt=i(4961),Tt=i(21849);const Bt=(0,n.EK)((e,{item:t})=>{const i="message"===t?.type?t.message:void 0,s=i&&(0,c.Y7C)(e,i);return{owner:"avatar"===t?.type?t.avatarOwner:s}})(({owner:e,item:t})=>{const{closeMediaViewer:i,focusMessage:a,toggleChatInfo:o}=(0,n.ko)(),{isMobile:r}=(0,Y.Ay)(),c=(0,M.A)(()=>{if(i(),"message"!==t?.type)return;const e=t.message;r?setTimeout(()=>{o({force:!1},{forceSyncOnIOs:!0}),a({chatId:e.chatId,messageId:e.id})},350):a({chatId:e.chatId,messageId:e.id})}),d=(0,T.A)(),h=(0,s.Kr)(()=>{if(!t||"standalone"===t.type)return;const e="avatar"===t.type?t.avatarOwner:void 0,i="avatar"===t.type?t.profilePhotos:void 0,s=i?.photos[t.mediaIndex],n=s?.id===i?.fallbackPhoto?.id,a=s?.id===i?.personalPhoto?.id,o="message"===t.type?t.message.date:s?.date;if(!o)return;const r=(0,$e.fS)(d,1e3*o,!0),c=i?.count&&i.count+(i?.fallbackPhoto?1:0),h=t.mediaIndex+1+(i?.personalPhoto?-1:0),u=c&&d("Of",[h,c]),m=[];if(s){const t=(0,v.L8)(e.id)?void 0:e,i=t&&(0,l.WX)(t),s=t&&(0,l.YE)(t);m.push(d(a?"lng_mediaview_profile_photo_by_you":n?"lng_mediaview_profile_public_photo":i?"lng_mediaview_channel_photo":s?"lng_mediaview_group_photo":"lng_mediaview_profile_photo"))}return!u||a||n||m.push(u),m.push(r),m.join(" • ")},[t,d]);if(!e)return;const u=(0,Dt.F9)(d,e);return(0,ie.FD)("div",{className:"SenderInfo",onClick:c,children:[(0,ie.Y)(Tt.A,{size:"medium",peer:e},e.id),(0,ie.FD)("div",{className:"meta",children:[(0,ie.Y)("div",{className:"title",dir:"auto",children:u&&(0,Mt.A)(u)}),(0,ie.Y)("div",{className:"date",dir:"auto",children:h})]})]})}),Lt=250,Rt=(0,s.ph)((0,n.EK)(e=>{const{mediaViewer:t,shouldSkipHistoryAnimations:i}=(0,c.nTw)(e),{chatId:s,threadId:n,messageId:o,origin:r,isHidden:d,withDynamicLoading:h,standaloneMedia:u,mediaIndex:m,isAvatarView:p,isSponsoredMessage:g}=t,A=(0,c.xYJ)(e,"mediaViewerAnimations"),{currentUserId:C,isSynced:y}=e,S=Boolean(s)&&(0,c.nZ4)(e,s);if(p){const t=(0,c.PVB)(e,s);let a=!1;t&&(a=(0,v.L8)(t.id)?t.id===C:(0,l.SJ)(t));const p=(0,c.IVq)(e,s),g=f({avatarOwner:t,standaloneMedia:u,profilePhotos:p,mediaIndex:m}),k=b(e,0,g);return{profilePhotos:p,avatar:p?.photos[m],avatarOwner:t,isLoadingMoreMedia:p?.isLoading,isChatWithSelf:S,canUpdateMedia:a,withAnimation:A,origin:r,shouldSkipHistoryAnimations:i,isHidden:d,standaloneMedia:u,mediaIndex:m,isSynced:y,currentItem:g,viewableMedia:k,chatId:s,threadId:n,messageId:o,message:void 0,collectedMessageIds:void 0,chatMessages:void 0,sponsoredMessage:void 0,withDynamicLoading:h}}let k,N;s&&o&&(k=r&&[a.TQ.ScheduledAlbum,a.TQ.ScheduledInline].includes(r)?(0,c.Jl6)(e,s,o):(0,c.O5q)(e,s,o)),g&&s&&r===a.TQ.SponsoredMessage&&(N=(0,c.v8U)(e,s));const w=f({message:k,standaloneMedia:u,mediaIndex:m,sponsoredMessage:N}),I=b(e,0,w);let P;s&&(P=r&&[a.TQ.ScheduledAlbum,a.TQ.ScheduledInline].includes(r)?(0,c.yFI)(e,s):(0,c.zeq)(e,s));let Y=!1;const F=r===a.TQ.Inline,D=r===a.TQ.Album;let M;if(s&&n&&o)if(h&&(F||D)){const t=(0,c.CuV)(e);Y=Boolean(t?.isLoading);const{foundIds:i}=t?.currentSegment||{};M=i}else if(r===a.TQ.SharedMedia){const t=(0,c.BU_)(e),i=t?.resultsByType,s=I&&(0,l.JU)(I?.media),{foundIds:n}=s&&i?.[s]||{};M=n}else(F||D)&&(M=(0,c.Lzh)(e,s,n,o)||(0,c.gCU)(e,s,n));return{chatId:s,threadId:n,messageId:o,isChatWithSelf:S,origin:r,message:k,chatMessages:P,sponsoredMessage:N,collectedMessageIds:M,withAnimation:A,isHidden:d,shouldSkipHistoryAnimations:i,withDynamicLoading:h,standaloneMedia:u,mediaIndex:m,isLoadingMoreMedia:Y,isSynced:y,currentItem:w,viewableMedia:I,canUpdateMedia:void 0,avatar:void 0,avatarOwner:void 0,profilePhotos:void 0}})(({chatId:e,threadId:t,messageId:i,message:c,collectedMessageIds:f,isChatWithSelf:b,canUpdateMedia:y,origin:B,avatar:L,avatarOwner:R,profilePhotos:x,chatMessages:V,sponsoredMessage:K,standaloneMedia:J,mediaIndex:G,withAnimation:j,isHidden:z,shouldSkipHistoryAnimations:H,withDynamicLoading:$,isLoadingMoreMedia:q,isSynced:X,currentItem:ee,viewableMedia:te})=>{const{openMediaViewer:oe,closeMediaViewer:re,openForwardMenu:le,focusMessage:ce,toggleChatInfo:de,searchChatMediaMessages:he,loadMoreProfilePhotos:ue,clickSponsored:pe,openUrl:ve}=(0,n.ko)(),ge=Boolean(R||c||J||K),{isMobile:Ae}=(0,Y.Ay)(),{media:fe,isSingle:be}=te||{},Ce=(0,s.li)(),ye=c?.senderId||R?.id||c?.chatId,Se=(0,U.A)(ye),ke=j?"slideFade":"none",Ne=Boolean(j&&!H),[we,Ie,Pe]=(0,F.A)(),{isVideo:Ye,isPhoto:Fe,bestImageData:De,bestData:Me,dimensions:Te,isGif:Be,contentType:Le}=W({media:fe,isAvatar:Boolean(R),origin:B,delay:Ne&&Lt}),Re=(()=>{if(b)return!1;if("avatar"!==ee?.type||!R)return!1;const e=ee.profilePhotos;return fe!==e.personalPhoto})(),xe=!z&&ge,Ee=(0,s.Kr)(()=>$?f:(0,l.lH)(V||{},f||[],Le||"media"),[V,f,Le,$]);!ge||Se&&Se===ye&&void 0!==Ce.current||(Ce.current=be?0:i||G);const[Ve]=E;(0,s.vJ)(()=>{if(!ge||Ve())return;(0,p.FD)();const e=(0,O.w4)();return()=>{e(),(0,p.wb)()}},[ge,Ve]),(0,s.vJ)(()=>{xe&&_()},[xe]),(0,s.vJ)(()=>{Ae&&(0,r.RK)(()=>{document.body.classList.toggle("is-media-viewer-open",ge)})},[Ae,ge]);const _e=(0,D.A)();(0,s.vJ)(()=>{const e=window.matchMedia(g.wy);return e.addEventListener("change",_e),()=>{e.removeEventListener("change",_e)}},[_e]);const Ue=(0,U.A)(c),Oe=(0,U.A)(z),Ke=(0,U.A)(B),Je=(0,U.A)(ee),Ge=(0,U.A)(De),je=c?(0,A.V)({message:c,forcePlayback:!0,isForMediaViewer:!0}):void 0,ze=Boolean(je),He=Oe&&Je!==ee;(0,s.vJ)(()=>{Ne&&ge&&(He||!Je)&&((0,s.VK)(Lt+o.xB5),function(e,t,i,s,n,l,c){const{mediaEl:d}=I(t,l,c);if(!d)return;const{width:h}=N.A.get(),{width:m,height:p}=(0,g.$w)(e,n),{width:v,height:A}=(0,g.ky)(m,p,s.width,s.height),f=(h-v)/2,b=function(e){const t=window.matchMedia(g.wy);let i=4.125;return e&&!u.TF&&(i+=t.matches?.875:2.125),i*g.$}(e)+(p-A)/2;let{top:y,left:S,width:k,height:Y}=d.getBoundingClientRect();if([a.TQ.SharedMedia,a.TQ.Album,a.TQ.ScheduledAlbum,a.TQ.SearchResult].includes(t)){const e=function(e,t,i,s,n,a){if(e===t){const o=Math.max(n,a)*(e/t);s-=(o-n)/2,i-=(o-a)/2,n=o,a=o}else if(e>t){const i=n;s-=((n=a*(e/t))-i)/2}else if(t>e){const s=a;i-=((a=n*(t/e))-s)/2}return{top:i,left:s,width:n,height:a}}(v,A,y,S,k,Y);y=e.top,S=e.left,k=e.width,Y=e.height}const F=S+k/2-(f+v/2),D=y+Y/2-(b+A/2),M=k/v,T=Y/A;(0,r.RK)(()=>{const e=w(i||d);(0,C.ZM)(e,{top:`${b}px`,left:`${f}px`,width:`${v}px`,height:`${A}px`,transform:`translate3d(${F}px, ${D}px, 0) scale(${M}, ${T})`}),P(e,t),document.body.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{e.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(e),setTimeout(()=>{(0,r.RK)(()=>{document.body.contains(e)&&document.body.removeChild(e),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(ze,B,De,Te,Ye,c,G)),Ne&&!ge&&Je&&((0,s.VK)(Lt+o.xB5),function(e,t,i,s){const{container:n,mediaEl:l}=I(e,i,s);if(!l)return;const c=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!c)return;const{top:d,left:h,width:u,height:m}=c.getBoundingClientRect(),{top:p,left:v,width:g,height:A}=l.getBoundingClientRect();let f=p;if(!(0,k.Y)(n)){const{height:e}=N.A.get();f=p<d?-A:e}const b=h+u/2-(v+g/2),y=d+m/2-(f+A/2);let Y=u/g,F=m/A;const D=[a.TQ.Inline,a.TQ.ScheduledInline,a.TQ.Album,a.TQ.ScheduledAlbum].includes(e)&&!function(e){const t=document.querySelector(".Transition_slide-active > .MessageList"),{top:i}=(0,S.A)(e,t);return i>t.scrollTop&&i+e.offsetHeight<t.scrollTop+t.offsetHeight}(l);[a.TQ.SharedMedia,a.TQ.Album,a.TQ.ScheduledAlbum,a.TQ.SearchResult].includes(e)&&(Y>F?Y=F:F>Y&&(F=Y));const M=document.getElementsByClassName("ghost")[0],T=M||w(t||l,e);let B;if(M){const{top:e,left:t,width:i,height:s}=M.getBoundingClientRect();B={transition:"none",top:`${f}px`,left:`${v}px`,transformOrigin:"top left",transform:`translate3d(${t-v}px, ${e-f}px, 0) scale(${i/g}, ${s/A})`,width:`${g}px`,height:`${A}px`}}else B={top:`${f}px`,left:`${v}px`,width:`${g}px`,height:`${A}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${Y}, ${F})`};(0,r.RK)(()=>{(0,C.ZM)(T,B),M||document.body.appendChild(T),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{M&&(M.style.transition=""),T.style.transform="",D&&(T.style.opacity="0"),P(T,e),setTimeout(()=>{(0,r.RK)(()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(Ke,Ge,Ue,Je?.mediaIndex))},[De,Te,ze,Ne,ge,Ye,c,B,Ge,Je,Ue,Ke,He,G]);const $e=(0,M.A)(()=>re()),qe=(0,M.A)(s=>{s.target instanceof HTMLElement&&s.target.closest("a")||($e(),e&&i&&(Ae?setTimeout(()=>{de({force:!1},{forceSyncOnIOs:!0}),ce({chatId:e,threadId:t,messageId:i})},Lt):ce({chatId:e,threadId:t,messageId:i})))}),We=(0,M.A)(t=>{K&&e&&(pe({isMedia:t,isFullscreen:!0,randomId:K.randomId}),ve({url:K.url}),re())}),Qe=(0,M.A)(()=>{le({fromChatId:e,messageIds:[i]})});(0,s.vJ)(()=>ge?(0,m.A)(()=>{$e()}):void 0,[$e,ge]),(0,s.vJ)(()=>{Ye&&!Be&&(0,d._K)()},[Be,Ye]);const Ze=(0,M.A)(i=>{if(i&&!q){if("avatar"===i.type){if(!(i.mediaIndex>=i.profilePhotos.photos.length-4))return;ue({peerId:i.avatarOwner.id})}"message"===i.type&&$&&he({chatId:e,threadId:t,currentMediaMessageId:i.message.id})}}),Xe=(0,M.A)((e,t)=>{if(0===t||be)return;if("standalone"===e.type){const{media:i,mediaIndex:s}=e,n=s+t;return n>=0&&n<i.length?{type:"standalone",media:i,mediaIndex:n}:void 0}if("avatar"===e.type){const{avatarOwner:i,profilePhotos:s,mediaIndex:n}=e,a=n+t;return a>=0&&s&&a<s.photos.length?{type:"avatar",avatarOwner:i,profilePhotos:s,mediaIndex:a}:void 0}if("sponsoredMessage"===e.type){const{message:i,mediaIndex:s}=e,n=s+t;return n>=0&&i?{type:"sponsoredMessage",message:i,mediaIndex:n}:void 0}const{message:i,mediaIndex:s}=e,n=(0,l.qG)(i);if(n){const e=s+t;if(e>=0&&e<n.extendedMedia.length)return{type:"message",message:i,mediaIndex:e}}const a=Ee?.indexOf(i.id);if(void 0===a||-1===a)return;const o=Ee[a+t],r=V?.[o];return r?{type:"message",message:r}:void 0}),et=(0,M.A)(e=>{if(!e)return void $e();const t="avatar"===e.type?e.avatarOwner.id:"message"===e.type?e.message.chatId:void 0,i="message"===e.type?e.message.id:void 0,s="standalone"===e.type?e.media:void 0;oe({origin:B,chatId:t,messageId:i,standaloneMedia:s,mediaIndex:e.mediaIndex,isAvatarView:"avatar"===e.type,withDynamicLoading:$},{forceOnHeavyAnimation:!0})}),tt=(0,M.A)(()=>{if((x?.photos.length||J?.length||Ee?.length||0)<=1||!ee)return void $e();const e=Xe(ee,-1);e?et(e):"avatar"===ee.type&&(0,v.L8)(ee.avatarOwner.id)||"standalone"===ee.type||$e()}),it=(0,T.A)();return(0,ie.FD)(ne.A,{id:"MediaViewer",isOpen:ge,isHidden:z,shouldAnimateFirstRender:!0,noCloseTransition:H,children:[(0,ie.FD)("div",{className:"media-viewer-head",dir:it.isRtl?"rtl":void 0,"data-tauri-drag-region":!(!h.Vq||!u.MP)||void 0,children:[Ae&&(0,ie.Y)(Z.A,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:it("Close"),onClick:$e,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)(ae.Ay,{activeKey:Ce.current,name:ke,children:(0,ie.Y)(Bt,{item:ee},fe?.id)}),(0,ie.Y)(me,{mediaData:Me,isVideo:Ye,item:ee,canUpdateMedia:y,canReportAvatar:Re,onBeforeDelete:tt,onReportAvatar:Ie,onCloseMediaViewer:$e,onForward:Qe}),(0,ie.Y)(se,{isOpen:we,onClose:Pe,photo:L,peerId:R?.id})]}),(0,ie.Y)(It,{item:ee,loadMoreItemsIfNeeded:Ze,isLoadingMoreMedia:q,isSynced:X,getNextItem:Xe,chatId:e,isPhoto:Fe,isGif:Be,threadId:t,avatarOwnerId:R?.id,origin:B,isOpen:ge,hasFooter:ze,isVideo:Ye,withAnimation:j,onClose:$e,selectItem:et,isHidden:z,onFooterClick:qe,handleSponsoredClick:We})]})}));var xt=i(2429);const Et="W9A8SEMl",Vt="gLHHo5k8",_t="GJVwqV9e",Ut="_Yn4SWUB",Ot="hGCH03qc",Kt="ZecqXqKy",Jt="PVZ8TOWS",Gt="Wi0DXPH2",jt="Ka1CGfzq",zt="urTtSsk9",Ht="AjXOHOgE",$t="uAlXNXJN",qt="g8ypsnnC",Wt="hGTnZuar",Qt="TkphaPyQ",Zt="CvnxnCxN",Xt="nZ30pf4g",ei="MnNC7VHS",ti="G8OgmMDJ",ii=3.5*g.$,si=.5*g.$;function ni(e,t=!1,i=!1){const s=document.createElement("div");s.classList.add(i?"TYicp2_K":"fME2l_yv");const n=new Image;if(n.draggable=!1,n.oncontextmenu=y.A,n.classList.add("HjoURJRK"),t){const t=document.createElement("canvas");t.classList.add(ei),n.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:i,height:s}=n;(0,r.RK)(()=>{t.width=i,t.height=s,u.QH&&(e.filter="blur(2px)"),e.drawImage(n,-4,-4,i+8,s+8),u.QH||(0,J.A)(e,0,0,i,s,2,2)})},n.src=e,s.appendChild(t)}else n.src=e,s.appendChild(n);return s}function ai(e,t){let i;const s=`#${(0,l.kR)(t)}`;switch(e){case a.G9.StoryRibbon:i=`#LeftColumn .${xt.A.root}`;break;case a.G9.MiddleHeaderAvatar:i=".MiddleHeader .Transition_slide-active .ChatInfo";break;case a.G9.ChatList:i="#LeftColumn .chat-list";break;case a.G9.SearchResult:i="#LeftColumn .LeftSearch--container"}const n=document.querySelector(i),o=n&&n.querySelectorAll(`${s} img`);return{container:n,mediaEl:o?.[0]}}function oi({scale:e,slideAmount:t,isActiveSlideSize:i,isMoveThroughActiveSlide:s,isBackward:n}){const a=40+(i?405:135),o=(Math.abs(t)-1)*(40+(s?405:135)),r=(0,ge.Ki)((a+o)*e);return n?-r:r}function ri(){const{width:e,height:t}=(0,we.A)();return(0,s.Kr)(()=>function(e,t){const i=function(e,t,i,s){const n=i/1200,a=s/800;return Math.min(n,a)}(0,0,e,t),s=(0,ge.Ki)(405*i),n=(0,ge.Ki)(135*i);return{activeSlide:{width:s,height:(0,ge.Ki)(720*i)},slide:{width:n,height:(0,ge.Ki)(240*i)},scale:i,toActiveScale:s/n,fromActiveScale:n/s}}(e,t),[e,t])}function li(e,t=!1,i=!1){const s=e&&"content"in e,n=e&&"isDeleted"in e,a=!!s&&(0,l.XR)(e),o=s&&Boolean(e.forwardInfo);let r;s&&(e.content.photo?.thumbnail&&(r=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(r=e.content.video.thumbnail.dataUri));const c=s?(0,l.EN)(e):void 0,d=(0,H.A)(c),h=Boolean(s&&e.content.video),u=s&&e.content.video?.noSound,m=s?(0,l.EN)(e,"full"):void 0,p=(0,H.A)(m,!e,h?K.qZ.Progressive:K.qZ.BlobUrl),v=h&&s?(0,l.EN)(e,"full",!0):void 0,g=(0,H.A)(v,!e,K.qZ.Progressive),A=Boolean(p||g),f=h?d:p||d,b=!d&&!A,C=t&&s&&!e.noForwards,y=s?(0,l.EN)(e,"download"):void 0;return{isLoadedStory:s,isDeletedStory:n,hasText:a,hasForwardInfo:o,thumbnail:r,previewHash:c,previewBlobUrl:d,isVideo:h,noSound:u,fullMediaHash:m,fullMediaData:p,altMediaHash:v,altMediaData:g,hasFullData:A,bestImageData:f,hasThumb:b,canDownload:C,downloadMediaData:(0,H.A)(y,!C&&!i)}}var ci=i(94189);const di=(0,s.ph)(function({isOpen:e,story:t,onClose:i}){const{deleteStory:a,openNextStory:o}=(0,n.ko)(),r=(0,T.A)(),l=(0,s.hb)(()=>{t&&(o(),a({peerId:t.peerId,storyId:t.id}),i())},[i,t]);return(0,ie.Y)(ci.A,{isOpen:e,onClose:i,title:r("DeleteStoryTitle"),text:r("DeleteStorySubtitle"),confirmLabel:r("Delete"),confirmHandler:l,confirmIsDestructive:!0,className:"component-theme-dark"})});var hi=i(21309),ui=i(22720),mi=i(63152),pi=i(87894),vi=i(79824),gi=i(54960);const Ai=(0,s.ph)(function({id:e,contactListIds:t,currentUserId:i,selectedIds:n,lockedIds:a,onSelect:o}){const r=(0,T.A)(),[l,c]=(0,s.J0)(""),d=(0,s.Kr)(()=>{const e=(t||[]).filter(e=>e!==i);return(0,pi.Am)((0,Dt.PU)({ids:[...n||[],...e],query:l,type:"user"}))},[t,i,l,n]);return(0,ie.Y)(gi.A,{itemIds:d,selectedIds:n??vi.p,lockedSelectedIds:a,filterValue:l,filterPlaceholder:r("Search"),searchInputId:`${e}-picker-search`,isSearchable:!0,withDefaultPadding:!0,forceShowSelf:!0,onSelectedIdsChange:o,onFilterChange:c,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"},e)});var fi=i(82117),bi=i(12933);const Ci=(0,s.ph)(function({isActive:e,contactListIds:t,usersById:i,currentUserId:a,onClose:o}){const{saveCloseFriends:r}=(0,n.ko)(),l=(0,T.A)(),[c,d]=(0,s.J0)(""),[h,u]=(0,s.J0)(!1),[m,p]=(0,s.J0)([]),v=(0,s.Kr)(()=>(t||[]).filter(e=>i[e]?.isCloseFriend),[t,i]),g=(0,s.Kr)(()=>{const e=(t||[]).filter(e=>e!==a);return(0,pi.Am)((0,Dt.PU)({ids:[...v,...e],query:c,type:"user"}))},[v,t,a,c]);(0,fi.A)(([t])=>{!t&&e&&(u(!1),p(v))},[e,v]);const A=(0,s.hb)(e=>{p(e),u(!0)},[]),f=(0,M.A)(()=>{r({userIds:m}),o()});return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(gi.A,{itemIds:g||[],selectedIds:m,filterValue:c,filterPlaceholder:l("Search"),searchInputId:"close-friends-picker-search",isSearchable:!0,withDefaultPadding:!0,onSelectedIdsChange:A,onFilterChange:d,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),(0,ie.Y)("div",{className:(0,pe.A)("BDK_pgpt",h&&"N8ujSwlC"),children:(0,ie.Y)(bi.A,{isShown:h,onClick:f,ariaLabel:l("Save"),iconName:"check"})})]})}),yi={modal:"hz7SomkK",header:"NV6Rt2g9",closeButton:"SN1GFS6L",headerTitle:"gi0Y6Ns6",content:"sTaVDkiD",section:"eUiuPoEC",title:"iPPiw9DI",list:"OUP1Ss0W",option:"JL33Sa3b",checked:"qVPo_cVL",input:"zsDaUk0i",icon:"AfYCVlys",action:"njMeBBwY",optionContent:"TUAAnG2w",footer:"r24Qz2bf",info:"ljeRVBOm",submit:"RwNLN_rH"},Si=[{name:"StoryPrivacyOptionEveryone",value:"everybody",color:["#50ABFF","#007AFF"],icon:"channel-filled",actions:"blockUserIds"},{name:"StoryPrivacyOptionContacts",value:"contacts",color:["#C36EFF","#8B60FA"],icon:"user-filled",actions:"blockContactUserIds"},{name:"StoryPrivacyOptionCloseFriends",value:"closeFriends",color:["#88D93A","#30B73B"],icon:"favorite-filled",actions:"closeFriends"},{name:"StoryPrivacyOptionSelectedContacts",value:"nobody",color:["#FFB743","#F69A36"],icon:"group-filled",actions:"allowUserIds"}];var ki=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(ki||{});const Ni=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{storyId:t,peerId:i}}=(0,c.nTw)(e),s=i&&t?(0,c.Msb)(e,i,t):void 0;return{story:s&&"content"in s?s:void 0,visibility:s&&"visibility"in s?s.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}})(function({isOpen:e,story:t,visibility:i,contactListIds:a,usersById:o,currentUserId:r,onClose:c}){const{editStoryPrivacy:d,toggleStoryInProfile:h}=(0,n.ko)(),u=(0,T.A)(),[m,p,v]=(0,F.A)(!1),[g,A]=(0,s.J0)(i),[f,b]=(0,s.J0)(t?.isInProfile),[C,S]=(0,s.J0)(ki.privacy),[k,N]=(0,s.J0)("everybody"),w=C!==ki.privacy,I=(0,s.Kr)(()=>(a||[]).filter(e=>o[e]?.isCloseFriend),[a,o]),P=(0,s.Kr)(()=>{if(C===ki.allowList&&(!g?.allowUserIds?.length||g.allowUserIds[0]===r))return[r]},[C,r,g?.allowUserIds]),Y=(0,s.Kr)(()=>k!==g?.visibility?[]:g?.blockUserIds||[],[k,g?.blockUserIds,g?.visibility]),D=(0,M.A)(e=>{A({...g,allowUserIds:e?.length?e?.filter(e=>e!==r):[r]})}),B=(0,M.A)(e=>{A({...g,blockUserIds:e,visibility:k})});(0,s.vJ)(()=>{e&&(S(ki.privacy),p())},[e]),(0,s.vJ)(()=>{A(i)},[i]);const L=(0,M.A)(()=>{C!==ki.privacy?S(ki.privacy):v()}),R=(0,M.A)(()=>{b(!f)}),x=(0,M.A)(()=>{d({peerId:t.peerId,storyId:t.id,privacy:g}),t.isInProfile!==f&&h({peerId:t.peerId,storyId:t.id,isInProfile:f}),v()});return(0,ie.FD)(ee.A,{isOpen:m,className:(0,pe.A)(yi.modal,"component-theme-dark"),onClose:v,noBackdrop:!0,onCloseAnimationEnd:c,children:[(0,ie.FD)("div",{className:yi.header,children:[(0,ie.Y)(Z.A,{className:(0,pe.A)(yi.closeButton,"close-button"),round:!0,color:"translucent",size:"smaller",onClick:L,ariaLabel:u(w?"Common.Back":"Common.Close"),children:(0,ie.Y)("div",{className:(0,pe.A)("animated-close-icon",w&&"state-back")})}),(0,ie.Y)(ae.Ay,{name:"slideFade",activeKey:C,children:function(){switch(C){case ki.privacy:return(0,ie.Y)("h3",{className:yi.headerTitle,children:u("StoryPrivacyAlertEditTitle")});case ki.allowList:return(0,ie.Y)("h3",{className:yi.headerTitle,children:u("StoryPrivacyAlertSelectContactsTitle")});case ki.closeFriends:return(0,ie.Y)("h3",{className:yi.headerTitle,children:u("CloseFriends")});case ki.denyList:return(0,ie.Y)("h3",{className:yi.headerTitle,children:u("StoryPrivacyAlertExcludedContactsTitle")})}}()})]}),(0,ie.Y)(ae.Ay,{activeKey:C,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:yi.content,children:function(e){switch(C){case ki.privacy:return function(){const e=t?(0,hi.qZ)(t.expireDate-t.date):0;return(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:yi.section,children:[(0,ie.Y)("h3",{className:yi.title,children:u("StoryPrivacyAlertSubtitleProfile")}),(0,ie.Y)("div",{className:yi.list,children:Si.map(e=>{return(0,ie.FD)("label",{className:(0,pe.A)(yi.option,e.value===g?.visibility&&yi.checked),children:[(0,ie.Y)("input",{type:"radio",name:"story_privacy",className:yi.input,value:e.value,checked:e.value===g?.visibility,onChange:()=>{return t=e.value,void A({...g,visibility:t});var t},teactExperimentControlled:!0}),(0,ie.Y)("span",{className:yi.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`,children:(0,ie.Y)(Q.A,{name:e.icon})}),(0,ie.FD)("div",{className:yi.optionContent,children:[(0,ie.Y)("span",{className:(0,pe.A)(yi.option_name),children:u(e.name)}),e.actions&&(0,ie.FD)("div",{tabIndex:0,role:"button",className:yi.action,"aria-label":u("Edit"),onClick:t=>{!function(e,t){switch((0,y.A)(e),t){case"closeFriends":S(ki.closeFriends);break;case"allowUserIds":S(ki.allowList);break;case"blockUserIds":S(ki.denyList),N("everybody");break;case"blockContactUserIds":S(ki.denyList),N("contacts")}}(t,e.actions)},children:[(0,ie.Y)("span",{className:yi.actionInner,children:(t=e.actions,"closeFriends"===t?0===I.length?u("StoryPrivacyOptionCloseFriendsDetail"):1===I.length?(0,Dt.F9)(u,o[I[0]]):u("StoryPrivacyOptionPeople",I.length,"i"):"blockUserIds"===t&&"everybody"===g?.visibility||"blockContactUserIds"===t&&"contacts"===g?.visibility?g?.blockUserIds?.length?1===g.blockUserIds.length?u("StoryPrivacyOptionExcludePerson",(0,l.Yg)(o[g.blockUserIds[0]])):u("StoryPrivacyOptionExcludePeople",g.blockUserIds.length,"i"):u("StoryPrivacyOptionContactsDetail"):g?.allowUserIds&&0!==g.allowUserIds.length?1===g.allowUserIds.length?(0,l.Yg)(o[g.allowUserIds[0]]):u("StoryPrivacyOptionPeople",g.allowUserIds.length,"i"):u("StoryPrivacyOptionSelectedContactsDetail"))}),(0,ie.Y)(Q.A,{name:"next"})]})]})]},e.value);var t})})]}),(0,ie.Y)("div",{className:yi.section,children:(0,ie.FD)(ui.A,{ripple:!0,onClick:R,children:[(0,ie.Y)("span",{children:u("StoryKeep")}),(0,ie.Y)(mi.A,{id:"group-notifications",label:u("StoryKeep"),checked:f,inactive:!0})]})}),(0,ie.FD)("div",{className:yi.footer,children:[(0,ie.Y)("div",{className:yi.info,children:u("StoryKeepInfo",e)}),(0,ie.Y)("div",{className:yi.submit,children:(0,ie.Y)(Z.A,{onClick:x,children:u("StoryPrivacyButtonSave")})})]})]})}();case ki.closeFriends:return(0,ie.Y)(Ci,{isActive:e,contactListIds:a,currentUserId:r,usersById:o,onClose:L},"close-friends");case ki.denyList:return(0,ie.Y)(Ai,{id:"deny-list",contactListIds:a,currentUserId:r,selectedIds:Y,onSelect:B},"deny-list");case ki.allowList:return(0,ie.Y)(Ai,{id:"allow-list",contactListIds:a,lockedIds:P,currentUserId:r,selectedIds:g?.allowUserIds,onSelect:D},"allow-list")}}})]})}));var wi=i(95807),Ii=i(36353),Pi=i(73104),Yi=i(14),Fi=i(52674),Di=i(95362),Mi=i(48775),Ti=i(80140),Bi=i(46051),Li=i(45470),Ri=i(39351),xi=i(38218),Ei=i(83057),Vi=i(66991),_i=i(61157),Ui=i(92111),Oi=i(22081),Ki=i(65843),Ji=i(55158),Gi=i(59816),ji=i(61433),zi=i(91800),Hi=i(23565),$i=i(18501),qi=i(11217),Wi=i(39996),Qi=i(86070),Zi=i(39877);const Xi=(0,s.ph)((0,n.EK)((e,{forwardInfo:t})=>({sender:t.fromPeerId?(0,c.PVB)(e,t.fromPeerId):void 0,story:t.storyId&&t.fromPeerId?(0,c.Msb)(e,t.fromPeerId,t.storyId):void 0,theme:(0,c.SJA)(e)}))(({className:e,forwardInfo:t,sender:i,story:a,theme:o})=>{const{openStoryViewer:r,loadPeerStoriesByIds:l,openChat:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,T.A)();(0,s.vJ)(()=>{!a&&t.fromPeerId&&t.storyId&&l({peerId:t.fromPeerId,storyIds:[t.storyId]})},[t,a]);const{className:u,style:m}=(0,Wi.Ay)({peer:i,noUserColors:!0,shouldReset:!0,theme:o}),p=i?(0,Dt.F9)(h,i):t.fromName,g=(0,M.A)(()=>{const{fromPeerId:e,storyId:i}=t;e&&(!a||"isDeleted"in a&&a.isDeleted?c({id:e}):r({peerId:e,storyId:i,isSingleStory:!0}))}),{handleClick:A,handleMouseDown:f}=(0,qi.Q)(g);return(0,ie.FD)(Qi.A,{ref:d,className:(0,pe.A)("EmbeddedMessage",e,u),style:m,dir:h.isRtl?"rtl":void 0,onClick:A,onMouseDown:f,children:[i?.color?.backgroundEmojiId&&(0,ie.Y)(Zi.A,{emojiDocumentId:i.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),(0,ie.FD)("div",{className:"message-text",children:[function(){if(a&&"content"in a&&a.content.text)return(0,ie.Y)("p",{className:"embedded-text-wrapper",children:(0,$i.fd)(a.content.text)})}(),(0,ie.Y)("div",{className:"message-title",children:function(){if(!i||!p)return;const e=(0,v.L8)(i.id)?"user-filled":"channel-filled";return(0,ie.FD)(ie.FK,{children:[e&&(0,ie.Y)(Q.A,{name:e,className:"embedded-chat-icon"}),p&&(0,Mt.A)(p)]})}()})]})]})}));var es=i(57076);const ts=(0,s.ph)(function({story:e,isExpanded:t,className:i,onExpand:n,onFold:a}){const o=(0,T.A)(),l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(),u=(0,Yi.A)(e,!0),m=u?.content.text,[p,v]=(0,s.J0)(!1),g=(0,Hi.A)(t||void 0,400),A=t||g;(0,s.vJ)(()=>{(0,r.RK)(()=>{c.current&&(t?(0,ji.YM)(c.current,Zt):(0,ji.HW)(c.current,Zt))})},[t]);const f=p&&!A,{shouldRender:b,transitionClassNames:C}=(0,Je.A)(f,void 0,!0,"slow",!0);(0,s.Nf)(()=>{(0,r.YS)(()=>{const e=c.current,t=h.current;if(!e||!t)return;const{offsetWidth:i}=t;(0,r.RK)(()=>{e.style.setProperty("--expand-button-width",`${i}px`)})})},[b,o]),(0,s.Nf)(()=>{(0,r.gm)(()=>{if(!c.current||!d.current)return;const e=c.current,t=d.current,i=t.offsetTop,{lineHeight:s,totalLines:n}=(0,zi.A)(t),a=n>3,o=i+3*s;return()=>{a&&((0,ji.YM)(e,"e1gyTmKe"),v(!0)),e.style.setProperty("--_overflow-shift",`${o}px`)}})},[m]),(0,s.vJ)(()=>{t||l.current?.scrollTo({top:0})},[t]);const y=(0,pe.A)("ilyTRZtw",A&&"HIMnUViv",b&&"Vq8pl_kQ");return(0,ie.FD)("div",{className:(0,pe.A)("RKedwa0I",i),children:[(0,ie.Y)("div",{ref:c,className:y,role:f?"button":void 0,onClick:f?n:a,children:(0,ie.FD)("div",{ref:l,className:(0,pe.A)("D_5mWNmi","allow-selection","custom-scroll"),children:[u?.forwardInfo&&(0,ie.Y)(Xi,{forwardInfo:u.forwardInfo,className:"_M8CgT7s"}),u&&m&&(0,ie.Y)("div",{ref:d,className:"hmFA5qb1",children:(0,ie.Y)(es.A,{messageOrStory:u,withTranslucentThumbs:!0,forcePlayback:!0})})]})}),b&&(0,ie.Y)("div",{ref:h,className:(0,pe.A)("bM5rlQtM",C),onClick:n,children:o("Story.CaptionShowMore")})]})});var is=i(26875),ss=i(11241);const ns="YVD19vOP",as="vJRk_UUk",os="nIv3YAnZ",rs=(0,s.ph)(({story:e,className:t})=>{const{openStoryViewModal:i,openForwardMenu:a,sendStoryReaction:r}=(0,n.ko)(),c=(0,T.A)(),{views:d,isOut:h,peerId:u,id:m,sentReaction:p}=e,{viewsCount:g,forwardsCount:A,reactionsCount:f}=d||{},b=!(0,v.L8)(u),C=p&&(0,l.a0)(p,o.tNZ),y=Boolean((h||b)&&e.isPublic&&!e.noForwards),S=(0,l.$_)(u,m),k=(0,s.Kr)(()=>{const{users:{byId:e}}=(0,n.mS)(),t=d&&"recentViewerIds"in d?d.recentViewerIds:void 0;if(t)return t.map(t=>e[t]).filter(Boolean)},[d]),N=(0,M.A)(()=>{i({storyId:m})}),w=(0,M.A)(()=>{a({fromChatId:u,storyId:m})}),I=(0,M.A)(()=>{const e=p?void 0:o.tNZ;r({peerId:u,storyId:m,containerId:S,reaction:e})});return g?(0,ie.FD)("div",{className:(0,pe.A)(ns,t),children:[(0,ie.FD)("div",{className:(0,pe.A)("cknL5COh",!b&&"pJAyeGkG"),onClick:b?void 0:N,children:[Boolean(k?.length)&&(0,ie.Y)(is.A,{size:"small",peers:k,className:"Vz_VtJ16"}),b?(0,ie.FD)("span",{className:os,children:[(0,ie.Y)(Q.A,{name:"channelviews",className:"WyBiNM6e"}),g]}):(0,ie.Y)("span",{className:os,children:c("Views",g,"i")}),Boolean(f)&&!b&&(0,ie.FD)("span",{className:"sf3u_6Vh",children:[(0,ie.Y)(Q.A,{name:"heart",className:"Er2XKRqi"}),f]})]}),(0,ie.Y)("div",{className:"kKoeDk3Z"}),y&&(0,ie.Y)(Z.A,{color:"translucent",size:"smaller",round:!0,onClick:w,ariaLabel:c("Forward"),className:as,children:(0,ie.Y)(Q.A,{name:"forward"})}),b&&(0,ie.FD)(ie.FK,{children:[Boolean(A)&&(0,ie.FD)("div",{className:as,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:c("PublicShares"),children:(0,ie.Y)(Q.A,{name:"loop"})}),(0,ie.Y)("span",{children:A})]}),(0,ie.FD)("div",{className:as,children:[(0,ie.FD)(Z.A,{round:!0,className:"lpDXVIuf",color:"translucent",size:"smaller",onClick:I,ariaLabel:c("AccDescrLike"),children:[p&&(0,ie.Y)(ss.A,{containerId:S,reaction:p,withEffectOnly:C},(0,l.Jj)(p)),(!p||C)&&(0,ie.Y)(Q.A,{name:C?"heart":"heart-outline",className:(0,pe.A)(C&&"twgMDT1y")})]}),Boolean(f)&&(0,ie.Y)("span",{children:f})]})]})]}):(0,ie.Y)("div",{className:(0,pe.A)(ns,t),children:c("NobodyViewed")})}),ls=(0,s.ph)(function({isActive:e,isViewed:t,isVideo:i,duration:s=6,isPaused:n,onImageComplete:a}){const o=(0,M.A)(e=>{i||"XY98E7VM"!==e.animationName||a()}),r=(0,pe.A)("c1fbGgcx",t&&"xwOKghO2",e&&"ZuByYcIx",n&&"n9V6B7hP");return(0,ie.Y)("span",{className:r,"aria-hidden":!0,children:e&&(0,ie.Y)("i",{style:`--progress-duration: ${s}s`,className:"qyBCpJct",onAnimationEnd:o})})}),cs=u.Yw?4:3,ds=(0,s.ph)((0,n.EK)((e,{peerId:t,storyId:i,isDeleteModalOpen:s})=>{const{appConfig:n}=e,a=(0,c.mBe)(e,t),o=(0,c.hds)(e,t),r=(0,c.vGo)(e,t),l=(0,c.nTw)(e),{storyViewer:{isMuted:d,viewModal:h,isPrivacyModalOpen:u,storyList:m},forwardMessages:{storyId:p},premiumModal:v,safeLinkModalUrl:g,mapModal:A,reportModal:f,giftInfoModal:b,isPaymentMessageConfirmDialogOpen:C,storyStealthModal:y}=l,{isOpen:S}=v||{},k=Boolean(y),N=(0,c.Msb)(e,t,i),w=N&&"content"in N,I=Boolean(C||h||p||l.reactionPicker?.storyId||f||u||S||s||g||k||A||b),P=w?N.forwardInfo:void 0,Y=w?N.mediaAreas:void 0,F=P?.fromPeerId||Y?.find(e=>"channelPost"===e.type)?.channelId,D=F?(0,c.PVB)(e,F):void 0,M=(0,c.xYJ)(e,"mediaViewerAnimations"),T=w&&N.fromId?(0,c.PVB)(e,N.fromId):void 0,B=(0,c.WA9)(e,t),L=(0,c.trm)(e);return{peer:a||o,forwardSender:D,fromPeer:T,story:N,orderedIds:m?.storyIdsByPeerId[t],isMuted:d,isCurrentUserPremium:(0,c.g29)(e),shouldForcePause:I,storyChangelogUserId:n.storyChangelogUserId,viewersExpirePeriod:n.storyViewersExpirePeriod,isChatExist:Boolean(o),arePeerSettingsLoaded:Boolean(r?.settings),stealthMode:e.stories.stealthMode,withHeaderAnimation:M,paidMessagesStars:B,isAccountFrozen:L}})(function({peerId:e,storyId:t,peer:i,forwardSender:a,fromPeer:r,isMuted:c,isArchivedStories:d,isPrivateStories:h,story:u,orderedIds:m,isSingleStory:p,dimensions:g,shouldForcePause:A,storyChangelogUserId:f,viewersExpirePeriod:b,isChatExist:C,arePeerSettingsLoaded:y,getIsAnimating:S,isCurrentUserPremium:k,stealthMode:N,withHeaderAnimation:w,paidMessagesStars:I,isAccountFrozen:P,onDelete:D,onClose:B,onReport:L}){const{viewStory:R,setStoryViewerMuted:x,openPreviousStory:E,openNextStory:V,loadPeerSkippedStories:_,openForwardMenu:U,copyStoryLink:O,toggleStoryInProfile:J,openChat:G,showNotification:j,openStoryPrivacyEditor:z,loadPeerSettings:H,fetchChat:$,loadStoryViews:q,openStealthModal:W}=(0,n.ko)(),X=(0,Ti.Fm)(),ee=(0,T.A)(),te=(0,Ri.A)(),{isMobile:se}=(0,Y.Ay)(),[ne,oe,re]=(0,F.A)(!1),[le,ce,ue]=(0,F.A)(!1),[me,ve,Ae]=(0,F.A)(!1),[fe,be,Ce]=(0,F.A)(!0),[ye,Se,ke]=(0,F.A)(!1),[Ne,we]=(0,s.J0)(!1),[Ie,Pe,Ye]=(0,F.A)(!1),[Fe,De,Me]=(0,F.A)(!1),Te=(0,s.li)(),{isDeletedStory:Be,hasText:Le,hasForwardInfo:Re,thumbnail:xe,previewBlobUrl:Ee,isVideo:Ve,noSound:_e,fullMediaData:Ue,altMediaHash:Ke,altMediaData:Ge,hasFullData:je,hasThumb:ze,canDownload:He,downloadMediaData:qe}=li(u,k,Fe),We=u&&"content"in u,Qe=e===f,Ze=(0,v.L8)(e),Xe=!Ze,et=Xe&&(0,l.WX)(i),tt=We&&u.isOut,it=We&&0===Object.keys(u.content).length,st=(0,Yi.A)(tt?!u.isInProfile:void 0,!0),nt=(0,Yi.A)(tt?u.isInProfile:void 0,!0),at=Boolean(tt&&u.date+b<(0,Ti.Fm)()),ot=a?(0,Dt.F9)(te,a):We&&u.forwardInfo?.fromName,rt=Boolean(We&&u.isPublic&&!Qe&&i?.hasUsername),lt=Boolean(We&&u.isPublic&&!u.noForwards&&!Qe&&!ye),ct=Boolean((je||it)&&!A&&fe&&!ne&&!ye&&!Ne&&!Ie),dt=We&&u.content.video?.duration?u.content.video.duration:void 0,ht=!(tt&&Ze||Qe||et||P),ut=We&&!ht&&(tt||et),mt=se&&w?"slideFade":"none",{shouldRender:pt,transitionClassNames:vt}=(0,Je.A)(!je&&!it),{transitionClassNames:gt}=(0,Je.A)(Boolean(Ue)&&!it),At=(0,Li.A)(xe,!ze),ft=(0,Ei.A)(Ee),{shouldRender:bt,transitionClassNames:Ct}=(0,Je.A)(ht),{shouldRender:yt,transitionClassNames:St}=(0,Je.A)(Le&&ye),{transitionClassNames:kt}=(0,Je.A)(!0),{shouldRender:Nt,transitionClassNames:wt}=(0,Je.A)(Le||Re),It=(0,Vi.Y)(Te,Ue,Bi.G);(0,Ui.A)(e,t),(0,s.vJ)(()=>{t&&R({peerId:e,storyId:t})},[t,e]),(0,s.vJ)(()=>{_({peerId:e})},[e]),(0,s.vJ)(()=>{const t=(0,v.L8)(e);!C&&t&&$({chatId:e})},[C,e]),(0,s.vJ)(()=>{C&&!y&&H({peerId:e})},[y,C,e]);const Pt=(0,M.A)(()=>{Ve&&Te.current?.pause(),Ae(),ue()}),Yt=(0,M.A)(()=>{ct&&(ce(),Ve||ve())}),Ft=(0,M.A)(()=>{Pe()}),Bt=(0,M.A)(()=>{Ye()}),Lt=(0,M.A)(()=>{De(),Pt()}),Rt=(0,M.A)(()=>{Me(),Yt()}),{onMouseDown:xt,onMouseUp:Vt,onMouseLeave:_t,onTouchStart:Ut,onTouchEnd:Kt}=(0,xi.A)({onStart:Ft,onEnd:Bt}),zt=(0,Oe.A)(Te,void 0,!Ve||!Ue||It),Ht=Ue&&(!Ke||Ge);(0,s.vJ)(()=>{(Ht||zt||it)&&Yt()},[Ht,zt,it]),(0,_i.Ay)(Ce,be),(0,s.vJ)(()=>{Ht&&Te.current?.load()},[Ht]),(0,s.vJ)(()=>{!We||Be||at||(tt||et)&&q({peerId:e,storyId:t})},[Be,at,We,e,t,tt,et]),(0,s.vJ)(()=>{A||!fe||ne||ye||Ne||Ie?Pt():Yt()},[Yt,fe,ye,ne,A,Ne,Ie]),(0,s.vJ)(()=>{if(!(ne||A||ye))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),we(!Ne))}},[ye,ne,Ne,A]),(0,fi.A)(([e,t,i,s,n])=>{!Ne||ye||ne||A||!fe||Ie||t===ye&&e===ne&&i===A&&s===fe&&n===Ie||we(!1)},[ne,ye,A,fe,Ie,Ne]);const $t=(0,M.A)(()=>{B(),G({id:e})}),Zt=(0,M.A)(()=>{B(),G({id:a.id})}),ii=(0,M.A)(()=>{B(),G({id:r.id})}),si=(0,M.A)(()=>{E()}),ni=(0,M.A)(()=>{V()}),ai=(0,M.A)(e=>{const t=e.currentTarget;t.readyState>=cs?ve():Ae(),dt&&(0,ge.LI)(t.currentTime,2)>=(0,ge.LI)(dt,2)&&ni()});(0,s.vJ)(()=>S()||ne?void 0:(0,Fi.A)({onRight:ni,onLeft:si}),[S,ne]);const oi=(0,M.A)(()=>{O({peerId:e,storyId:t})}),ri=(0,M.A)(()=>{J({peerId:e,storyId:t,isInProfile:!0})}),ci=(0,M.A)(()=>{J({peerId:e,storyId:t,isInProfile:!1})}),di=(0,M.A)(()=>{D(u)}),hi=(0,M.A)(()=>{L()}),ui=(0,M.A)(()=>{U({fromChatId:e,storyId:t})}),mi=(0,M.A)(()=>{z()}),pi=(0,M.A)(()=>{const e=!We||u.isPublic?void 0:u.isForContacts?"contacts":u.isForCloseFriends?"closeFriends":"nobody";let t;const s=(0,Dt.F9)(te,i);switch(e){case"nobody":t=ee("StorySelectedContactsHint",s);break;case"contacts":t=ee("StoryContactsHint",s);break;case"closeFriends":t=ee("StoryCloseFriendsHint",s);break;default:return}j({message:t})}),vi=(0,M.A)(()=>{_e?j({message:ee("Story.TooltipVideoHasNoSound")}):(Te.current.muted=!Te.current.muted,x({isMuted:!c}))}),gi=(0,M.A)(()=>{if(N.activeUntil&&(0,Ti.Fm)()<N.activeUntil){const e=N.activeUntil-(0,Ti.Fm)();return void j({title:te("StealthModeOnTitle"),message:te("StealthModeOnHint",{time:(0,$e.QO)(e)}),duration:4e3})}W({})}),Ai=(0,M.A)(()=>{qe&&(0,Di.A)(qe,`story-${e}-${t}.${Ve?"mp4":"jpg"}`)});(0,s.vJ)(()=>{Be&&j({message:ee("StoryNotFound")})},[ee,Be]);const bi=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{round:!0,ripple:!se,size:"tiny",color:"translucent-white",onClick:e,className:(0,pe.A)(Qt,t&&"active"),ariaLabel:te("AriaLabelOpenMenu"),children:(0,ie.Y)(Q.A,{name:"more"})}),[se,te]);const Ci=I?te("ComposerPlaceholderPaidReply",{amount:(0,Mi.U2)(te,I,{asFont:!0,className:"placeholder-star-icon"})},{withNodes:!0}):ee(Xe?"ReplyToGroupStory":"ReplyPrivately");return(0,ie.FD)("div",{className:(0,pe.A)(qt,"component-theme-dark"),onMouseDown:xt,onMouseUp:Vt,onMouseLeave:_t,onTouchStart:Ut,onTouchEnd:Kt,children:[(0,ie.FD)("div",{className:(0,pe.A)("e7HHuS1g",kt),children:[(0,ie.Y)("div",{className:"jGDd2sza",children:(p?[t]:m??[]).map(e=>(0,ie.Y)(ls,{isActive:e===u?.id,isVideo:Ve,isViewed:Boolean(u?.id&&(h||d?e>u?.id:e<u?.id)),isPaused:!me,duration:dt,onImageComplete:ni},`progress-${e}`))}),(0,ie.FD)("div",{className:"eMYhXF_X",children:[(0,ie.Y)(ae.Ay,{activeKey:Number(e),name:mt,className:"PXnfXZur",children:(0,ie.FD)("div",{className:"WpyVfrsc",children:[(0,ie.Y)(Tt.A,{peer:i,size:"tiny",onClick:$t}),(0,ie.FD)("div",{className:"jmKI_lhC",children:[(0,ie.Y)("span",{onClick:$t,className:"H1uod43o",children:(0,Mt.A)((0,Dt.F9)(te,i)||"")}),(0,ie.FD)("div",{className:"zimpR8Hz",children:[ot&&(0,ie.FD)("span",{className:(0,pe.A)(Wt,"JJFtefb9",a&&"BsqMBS2I"),onClick:a?Zt:void 0,children:[(0,ie.Y)(Q.A,{name:"loop"}),(0,ie.Y)("span",{className:ti,children:(0,Mt.A)(ot)})]}),r&&(0,ie.FD)("span",{className:(0,pe.A)(Wt,"nJr8QgYX"),onClick:ii,children:[(0,ie.Y)(Tt.A,{peer:r,size:"micro"}),(0,ie.Y)("span",{className:ti,children:(0,Mt.A)((0,Dt.F9)(te,r)||"")})]}),u&&"date"in u&&(0,ie.Y)("span",{className:Wt,children:(0,$e.jy)(ee,X,u.date)}),We&&u.isEdited&&(0,ie.Y)("span",{className:Wt,children:ee("Story.HeaderEdited")})]})]})]})}),(0,ie.FD)("div",{className:"GrsJNw3y",children:[function(){if(!Ze)return;let e="channel-filled";const t={"channel-filled":["#50ABFF","#007AFF"],"user-filled":["#C36EFF","#8B60FA"],"favorite-filled":["#88D93A","#30B73B"],"group-filled":["#FFB743","#F69A36"]};if(tt){const{visibility:t}=u&&"visibility"in u&&u.visibility||{};switch(t){case"everybody":e="channel-filled";break;case"contacts":e="user-filled";break;case"closeFriends":e="favorite-filled";break;case"nobody":e="group-filled"}}else{if(!u||!("content"in u)||u.isPublic)return;e=u.isForCloseFriends?"favorite-filled":u.isForContacts?"user-filled":"group-filled"}return(0,ie.FD)("div",{className:(0,pe.A)("prxptFFf",tt&&"_MVsZpgB"),onClick:tt?mi:pi,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`,children:[(0,ie.Y)(Q.A,{name:e}),tt&&(0,ie.Y)(Q.A,{name:"next"})]})}(),Ve&&(0,ie.Y)(Z.A,{className:Qt,round:!0,ripple:!se,size:"tiny",color:"translucent-white",disabled:!je,onClick:vi,ariaLabel:ee("Volume"),children:(0,ie.Y)(Q.A,{name:c||_e?"speaker-muted-story":"speaker-story"})}),(0,ie.FD)(de.A,{className:"K0_xAdzf",trigger:bi,positionX:"right",onOpen:Lt,onClose:Rt,children:[rt&&(0,ie.Y)(he.A,{icon:"copy",onClick:oi,children:ee("CopyLink")}),st&&(0,ie.Y)(he.A,{icon:"save-story",onClick:ri,children:ee(Ze?"StorySave":"SaveToPosts")}),nt&&(0,ie.Y)(he.A,{icon:"delete",onClick:ci,children:ee(Ze?"ArchiveStory":"RemoveFromPosts")}),He&&(0,ie.Y)(he.A,{icon:"download",disabled:!qe,onClick:Ai,children:ee("lng_media_download")}),!tt&&Ze&&(0,ie.Y)(he.A,{icon:"eye-crossed-outline",onClick:gi,children:ee("StealthMode")}),!tt&&(0,ie.Y)(he.A,{icon:"flag",onClick:hi,children:ee("lng_report_story")}),tt&&(0,ie.Y)(he.A,{icon:"delete",destructive:!0,onClick:di,children:ee("Delete")})]}),(0,ie.Y)(Z.A,{className:(0,pe.A)(Qt,"WlLsjJ2Z"),round:!0,size:"tiny",color:"translucent-white",ariaLabel:ee("Close"),onClick:B,children:(0,ie.Y)(Q.A,{name:"close"})})]})]})]}),(0,ie.FD)("div",{className:"YiuvOPgT",style:`width: ${g.width}px; height: ${g.height}px`,children:[(0,ie.Y)("canvas",{ref:At,className:ei}),Ee&&(0,ie.Y)("img",{src:Ee,draggable:!1,alt:"",className:(0,pe.A)(Jt,"lQfkulvp",ft)},`preview-${t}`),pt&&(0,ie.Y)(Ji.A,{className:(0,pe.A)(vt,Et)}),!Ve&&Ue&&(0,ie.Y)("img",{src:Ue,alt:"",className:(0,pe.A)(Jt,gt),draggable:!1}),Ve&&Ue&&(0,ie.FD)(Ki.A,{ref:Te,className:(0,pe.A)(Jt,gt),canPlay:le,muted:c,width:720,height:1280,draggable:!1,playsInline:!0,disablePictureInPicture:!0,isPriority:!0,onPause:Ae,onWaiting:Ae,disableRemotePlayback:!0,onTimeUpdate:ai,children:[(0,ie.Y)("source",{src:Ue,type:Bi.G,width:"720"}),Ge&&(0,ie.Y)("source",{src:Ge,type:Bi.w,width:"480"})]},`video-${t}`),it&&(0,ie.Y)("div",{className:(0,pe.A)(Jt,"snxbMlts"),children:(0,ie.Y)("span",{children:te("StoryUnsupported")})}),!Ie&&!ne&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("button",{type:"button",className:(0,pe.A)(Xt,"SXpRZiax"),onClick:si,"aria-label":ee("Previous")}),(0,ie.Y)("button",{type:"button",className:(0,pe.A)(Xt,"twOBFwUE"),onClick:ni,"aria-label":ee("Next")})]}),We&&Ue&&(0,ie.Y)(Gi.A,{story:u,isActive:!0,isStoryPlaying:Fe},`area-overlay-${t}-${e}`),!se&&(0,ie.Y)("div",{className:Ot,children:(0,ie.FD)("div",{className:Gt,children:[(0,ie.Y)(Tt.A,{peer:i,withStory:!0,storyViewerMode:"disabled"}),(0,ie.Y)("div",{className:jt,children:(0,Mt.A)((0,Dt.F9)(te,i)||"")})]})})]}),ut&&(0,ie.Y)(rs,{story:u,className:kt}),yt&&(0,ie.Y)("div",{tabIndex:0,role:"button",className:(0,pe.A)("Jd1DYS6Y",St),onClick:()=>ke(),"aria-label":ee("Close")}),Le&&(0,ie.Y)("div",{className:(0,pe.A)("sHNAfxzf",wt)}),Nt&&(0,ie.Y)(ts,{story:u,isExpanded:ye,onExpand:Se,onFold:ke,className:wt},`caption-${t}-${e}`),bt&&(0,ie.Y)(Oi.A,{type:"story",chatId:e,threadId:K.l3,storyId:t,isReady:!tt,messageListType:"thread",isMobile:(0,Y.Ny)(),editableInputCssSelector:o.iKt,editableInputId:o.YVZ,inputId:"story-input-text",className:(0,pe.A)("FXineBYO",Ct),inputPlaceholder:Ci,onForward:lt?ui:void 0,onFocus:oe,onBlur:re})]})})),hs=(0,s.ph)((0,n.EK)((e,{peer:t})=>{const{storyViewer:{lastViewedByPeerId:i,origin:s,storyList:n}}=(0,c.nTw)(e);return{lastViewedId:t?.id?i?.[t.id]:void 0,origin:s,storyIdsForViewer:t?.id?n?.storyIdsByPeerId[t.id]:void 0}})(function({peer:e,peerStories:t,lastViewedId:i,storyIdsForViewer:a,origin:o}){const{openStoryViewer:r,loadPeerSkippedStories:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,s.Kr)(()=>{if(!t)return;const{orderedIds:e,lastReadId:s,byId:n}=t,o=e[e.length-1]!==s,r=i&&a?.includes(i)?i??(o?s??-1:-1):-1;return n[n[r]?.id||a?.[0]||e[0]]},[i,t,a]),u=h&&"content"in h;(0,s.vJ)(()=>{h&&!u&&c({peerId:h.peerId})},[h,u]);const m=u?h.content.video:void 0,p=u?(0,l.EN)(h):void 0,v=(0,H.A)(p)||m?.thumbnail?.dataUri;if(e&&h&&!("isDeleted"in h))return(0,ie.FD)("div",{className:qt,onClick:()=>{r({peerId:h.peerId,storyId:h.id,origin:o})},children:[v&&(0,ie.Y)("img",{src:v,alt:"",className:Jt,draggable:!1}),u&&(0,ie.Y)(Gi.A,{story:h}),(0,ie.Y)("div",{className:Ot,children:(0,ie.FD)("div",{className:Gt,children:[(0,ie.Y)(Tt.A,{peer:e,withStory:!0,storyViewerMode:"disabled"}),(0,ie.Y)("div",{className:jt,children:(0,Mt.A)((0,Dt.F9)(d,e)||"")})]})})]})}));var us=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(us||{});const ms=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{peerId:t,storyId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o,storyList:r}}=(0,c.nTw)(e),{byPeerId:l,orderedPeerIds:{active:d}}=e.stories;return{byPeerId:l,peerIds:r?.peerIds??d,currentPeerId:t,currentStoryId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o}},e=>(0,c.gd2)(e))(function({peerIds:e,currentPeerId:t,currentStoryId:i,isOpen:a,isSinglePeer:d,isSingleStory:h,isPrivate:m,isArchive:p,byPeerId:v,isDeleteModalOpen:g,onDelete:A,onClose:f,onReport:b}){const{stopActiveReaction:C}=(0,n.ko)(),y=(0,s.li)(),[S,k]=(0,s.J0)(t),[N,w]=(0,s.J0)(i),I=(0,U.A)(t),P=(0,Yi.A)(p,!0),F=(0,Yi.A)(m,!0),D=(0,Yi.A)(d,!0),T=(0,Yi.A)(h,!0),B=ri(),{height:L,width:R}=(0,we.A)(),x=(0,s.li)(void 0),E=(0,s.li)(!1),{isMobile:V}=(0,Y.Ay)(),_=(0,s.li)({}),[O,K]=(0,s.Ul)(!1);function J(e,t){e&&(_.current[t]?_.current[t].current=e:_.current[t]={current:e})}(0,ye.A)({isActive:a,onBack:f,shouldBeReplaced:!0});const G=(0,s.Kr)(()=>{if(S&&(D||T))return[S];const t=S?e.indexOf(S):-1;if(!S||-1===t)return[];const i=Math.max(t-4,0),s=Math.min(t+5,e.length);return e.slice(i,s)},[T,D,S,e]),j=(0,s.Kr)(()=>G.length&&S?G.indexOf(S):-1,[S,G]),z=(0,s.Kr)(()=>G.length&&t?G.indexOf(t):-1,[t,G]);(0,s.vJ)(()=>{V&&k(t)},[t,V]),(0,s.vJ)(()=>{S===t&&i!==N&&w(i)},[t,i,S,N]),(0,s.vJ)(()=>{if(!V)return I&&I!==t&&K(!0),()=>{K(!1)}},[I,t,K,V]),(0,s.vJ)(()=>()=>{i&&t&&C({containerId:(0,l.$_)(t,i)})},[i,t]);const H=z-j,$=j>z,q=(0,M.A)(()=>e.reduce((i,s,n)=>{if(s===S)i[s]=oi({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:$});else{let a=!1;!$&&n>0&&e[n-1]===S&&(a=!0),$&&n<e.length-1&&e[n+1]===S&&(a=!0),i[s]=oi({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:t===s&&!$,isMoveThroughActiveSlide:a})}return i},{}));(0,s.vJ)(()=>{if(!y.current||!a)return;let e=0;const t=()=>S?_.current[S]?.current:void 0,i=i=>{if(E.current)return void(E.current=!1);const s=t();if(s){if(e<-50){const e=document.getElementById(o.YVZ);return void(e&&(0,r.RK)(()=>{(0,Ii.A)(e)}))}e>50?(f(),"wheel"===i.type&&((0,Pi.M6)(),setTimeout(Pi.v5,1500))):(0,r.RK)(()=>{s.style.setProperty("--slide-translate-y","0px")})}};return(0,ve.wJ)(y.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(s,n,{dragOffsetX:a,dragOffsetY:o})=>{if(E.current)return;if(u.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=ve.h6||e>=R-ve.h6)return}if("mousemove"===s.type)return;const l=Math.abs(a),c=Math.abs(o),d=t();if(d&&(x.current===us.Vertical||Math.abs(c)>ve.no||c/l>ve.fG)){x.current=us.Vertical;const t=L;e=(0,ge.qE)(o,-t,t),e>0&&(0,r.RK)(()=>{d.style.setProperty("--slide-translate-y",e*(V?1:-1)+"px")}),"wheel"===s.type&&Math.abs(e)>100&&(i(s),E.current=!0)}},onRelease:i})},[a,f,R,L,V,S]),(0,s.Nf)(()=>{if(V)return;const e=q();Object.entries(_.current).forEach(([i,{current:s}])=>{if(!s)return;if(!O())return s.classList.remove(_t,Ut,Kt),s.style.setProperty("--slide-translate-x","0px"),s.style.setProperty("--slide-translate-y","0px"),s.style.setProperty("--slide-translate-scale","1"),void s.style.setProperty("--slide-content-scale",String(B.toActiveScale));let n=0;i===S&&(n=-1.75*B.fromActiveScale,s.classList.add(Kt)),i===t&&(n=1.75,s.classList.add(Ut)),s.classList.add(_t),s.style.setProperty("--slide-translate-x",`${e[i]||0}px`),s.style.setProperty("--slide-translate-y",`${n}rem`),s.style.setProperty("--slide-translate-scale",t===i?String(B.toActiveScale):i===S?String(B.fromActiveScale):"1")})},[t,O,S,B,V]);const W=(0,M.A)(e=>{const s=e.target;s&&s.classList.contains($t)&&(S!==t?(k(t),w(i)):i!==N&&w(i),K(!1))});return V?(0,ie.Y)("div",{className:Vt,ref:y,children:(0,ie.Y)("div",{className:Ht,ref:e=>J(e,S),children:(0,ie.Y)(ds,{peerId:S,storyId:N,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:g,isSingleStory:h,getIsAnimating:O,onClose:f,onReport:b})})}):(0,ie.FD)("div",{className:Vt,ref:y,style:`--story-viewer-scale: ${B.scale}`,onTransitionEnd:W,children:[(0,ie.Y)("div",{className:Et,onClick:f}),G.length>1&&(0,ie.Y)("div",{className:"xe67dhtF",style:`height: ${B.slide.height}px`}),G.map((e,t)=>e===S?function(e){const t=V?void 0:(0,wi.A)(`width: ${B.activeSlide.width}px`,`--slide-media-height: ${B.activeSlide.height}px`);return(0,ie.Y)("div",{ref:t=>J(t,e),className:(0,pe.A)(zt,$t),style:t,children:(0,ie.Y)(ds,{peerId:e,storyId:N,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:g,isSingleStory:h,getIsAnimating:O,onClose:f,onReport:b})},e)}(S):function(e,t,i){const s=(0,wi.A)(`width: ${B.slide.width}px`,`height: ${B.slide.height}px`),a=(0,pe.A)(zt,"Sef28wEh",`slide-${i}`);return(0,ie.Y)("div",{ref:t=>J(t,e),className:a,style:s,children:(0,ie.Y)(hs,{peer:(0,c.PVB)((0,n.mS)(),e),peerStories:v?.[e]})},e)}(e,0,t-j))]})}));var ps=i(47366),vs=i(46222),gs=i(283),As=i(36393),fs=i(51083),bs=i(17751),Cs=i(17794);const ys={"views-list":"gpDY8bos",viewsList:"gpDY8bos","views-list-loading":"vuRAfQ5v",viewsListLoading:"vuRAfQ5v",info:"AOSUIChK",centeredInfo:"oGLhkkS7","view-reaction":"MLaabS6n",viewReaction:"MLaabS6n",header:"d3N2bktu",content:"QmRA3HZK","top-button":"Dkv8GAxf",topButton:"Dkv8GAxf","contact-filter":"YpB_9VxE",contactFilter:"YpB_9VxE",selected:"DoUlpdZJ",sort:"axDpgq9G","sort-button":"Bm5VA66f",sortButton:"Bm5VA66f","icon-sort":"YVQiH93R",iconSort:"YVQiH93R","icon-down":"NXP9aMD0",iconDown:"NXP9aMD0",search:"QQQqBLK6","bottom-info":"_CSv6suH",bottomInfo:"_CSv6suH",scrolled:"RYQ0liYe",footer:"dUK7rP37",closeButton:"abPzLiCH","opacity-fade-in":"cX8oY3zb",opacityFadeIn:"cX8oY3zb",fadeIn:"Sx_aeh1o",blocked:"L82sciL8",check:"UqGBKwjg",menuBubble:"dRqemuTA","with-colored-status":"GQ96fta9",withColoredStatus:"GQ96fta9"},Ss=1.5*g.$,ks=(0,s.ph)((0,n.EK)((e,{storyView:t})=>({peer:(0,c.PVB)(e,t.peerId),availableReactions:e.reactions.availableReactions}))(({storyView:e,peer:t,availableReactions:i})=>{const{openChat:a,closeStoryViewer:o,unblockUser:r,blockUser:c,deleteContact:d,updateStoryView:h,focusMessage:u,openStoryViewer:m,closeStoryViewModal:p}=(0,n.ko)(),g=(0,T.A)(),A=(0,M.A)(()=>{const{type:t}=e;if("repost"===t)return p(),void m({peerId:e.peerId,storyId:e.storyId});o(),setTimeout(()=>{"user"===t?a({id:e.peerId}):"forward"===t&&u({chatId:e.peerId,messageId:e.messageId})},100)}),f=(0,s.Kr)(()=>{if(!(0,v.L8)(e.peerId))return;const{peerId:i,areStoriesBlocked:s,isUserBlocked:n}=e,a=t,{isContact:o}=a||{},u=(0,l.Yg)(a),m=[];return n||(s?m.push({handler:()=>{r({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!1})},title:g("StoryShowBackTo",u),icon:"play-story"}):m.push({handler:()=>{c({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!0})},title:g("StoryHideFrom",u),icon:"hand-stop"})),o?m.push({handler:()=>{d({userId:i})},title:g("DeleteContact"),icon:"delete-user",destructive:!0}):m.push({handler:()=>{n?(r({userId:i}),h({userId:i,isUserBlocked:!1})):(c({userId:i}),h({userId:i,isUserBlocked:!0}))},title:g(n?"Unblock":"BlockUser"),icon:n?"user":"delete-user",destructive:!n}),m},[g,e,t]),b="user"===e.type?"message-read":"forward"===e.type?"forward":"loop",C="forward"===e.type||"repost"===e.type,y=(0,s.Kr)(()=>{const t="repost"===e.type&&e.story.forwardInfo?.isModified,i=[(0,$e.U)(g,1e3*e.date)];return t&&i.push(g("lng_edited")),i.join(" • ")},[g,e]);return(0,ie.Y)(ui.A,{className:(0,pe.A)("chat-item-clickable small-icon",ys.opacityFadeIn,(e.isUserBlocked||e.areStoriesBlocked)&&ys.blocked),onClick:A,rightElement:"user"===e.type&&e.reaction?(0,ie.Y)(Cs.A,{reaction:e.reaction,className:ys.viewReaction,size:Ss,availableReactions:i,withIconHeart:!0}):void 0,contextActions:f,withPortalForMenu:!0,menuBubbleClassName:ys.menuBubble,children:(0,v.L8)(e.peerId)?(0,ie.Y)(bs.A,{className:(0,pe.A)(C&&ys.withColoredStatus),userId:e.peerId,noStatusOrTyping:!0,status:y,statusIcon:b,withStory:!0,forceShowSelf:!0}):(0,ie.Y)(fs.A,{className:(0,pe.A)(C&&ys.withColoredStatus),chatId:e.peerId,status:y,statusIcon:b,withStory:!0})},e.peerId)})),Ns=(0,s.ph)((0,n.EK)(e=>{const{appConfig:t}=e,{storyViewer:{viewModal:i}}=(0,c.nTw)(e),{storyId:s,views:n,nextOffset:a,isLoading:o}=i||{},r=s?(0,c.Msb)(e,e.currentUserId,s):void 0,l="story"===r?.["@type"]?r.expireDate:void 0;return{views:n,viewersExpireDate:l?l+t.storyViewersExpirePeriod:void 0,story:r&&"content"in r?r:void 0,nextOffset:a,isLoading:o,isCurrentUserPremium:(0,c.g29)(e)}})(function({story:e,viewersExpireDate:t,views:i,nextOffset:a,isLoading:r,isCurrentUserPremium:l}){const{loadStoryViewList:c,closeStoryViewModal:d,clearStoryViews:h}=(0,n.ko)(),[u,m,p]=(0,F.A)(!1),[v,g,A]=(0,F.A)(!0),[f,b]=(0,s.J0)(""),C=(0,T.A)(),y=Boolean(e),S=Boolean(t)&&t<(0,Ti.Fm)(),{viewsCount:k=0,reactionsCount:N=0}=e?.views||{},w=e?.isPublic&&k>o.XQO,I=N>o.$4F,P=k>o.frj,Y=w||I||P;(0,s.vJ)(()=>{y||(b(""),p(),g())},[y]);const D=(0,be.A)(()=>{h({isLoading:!0})},[],250,!0);(0,s.vJ)(()=>{D()},[u,v,f,D]);const B=(0,s.Kr)(()=>i?.sort(function(e){return(t,i)=>{if(e){const e="user"===t.type&&t.reaction,s="user"===i.type&&i.reaction;if(e&&!s)return-1;if(!e&&s)return 1}return i.date-t.date}}(v)),[v,i]),L=B?.length?1:Math.min(k,8),R=Boolean(B?.length)&&B.length<k&&S,x=(0,M.A)(()=>{e?.id&&void 0!==a&&c({peerId:e.peerId,storyId:e.id,offset:a,areReactionsFirst:v||void 0,areJustContacts:u||void 0,query:f})}),{handleScroll:E,isAtBeginning:V}=(0,ps.A)(),_=(0,M.A)(()=>{d()}),U=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.FD)(Z.A,{fluid:!0,size:"tiny",color:"translucent",className:(0,pe.A)(!t&&"active",ys.sortButton,ys.topButton),faded:t,onClick:e,ariaLabel:C("SortBy"),children:[(0,ie.Y)(Q.A,{name:v?"heart-outline":"recent",className:ys.iconSort}),(0,ie.Y)(Q.A,{name:"down",className:ys.iconDown})]}),[v,C]);return(0,ie.FD)(ee.A,{isOpen:y,onClose:_,className:"component-theme-dark",contentClassName:ys.viewsList,isSlim:!0,children:[Y&&(0,ie.FD)("div",{className:ys.header,children:[w&&(0,ie.FD)("div",{className:ys.contactFilter,children:[(0,ie.Y)(Z.A,{className:(0,pe.A)(!u&&ys.selected,ys.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:p,children:C("AllViewers")}),(0,ie.Y)(Z.A,{className:(0,pe.A)(u&&ys.selected,ys.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:m,children:C("Contacts")})]}),I&&(0,ie.FD)(de.A,{className:ys.sort,trigger:U,positionX:"right",children:[(0,ie.FD)(he.A,{icon:"heart-outline",onClick:g,children:[C("SortByReactions"),v&&(0,ie.Y)(Q.A,{name:"check",className:ys.check})]}),(0,ie.FD)(he.A,{icon:"recent",onClick:A,children:[C("SortByTime"),!v&&(0,ie.Y)(Q.A,{name:"check",className:ys.check})]})]}),P&&(0,ie.Y)(As.A,{className:ys.search,value:f,onChange:b})]}),(0,ie.FD)("div",{className:(0,pe.A)(ys.content,!V&&ys.topScrolled,"custom-scroll"),onScroll:E,children:[S&&!r&&!f&&Boolean(!B?.length)&&(0,ie.Y)("div",{className:(0,pe.A)(ys.info,ys.centeredInfo),children:(0,Mt.A)(C(l?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])}),!r&&Boolean(f.length)&&!B?.length&&(0,ie.Y)("div",{className:ys.info,children:C("Story.ViewList.EmptyTextSearch")}),(0,ie.FD)(vs.A,{items:B,onLoadMore:x,children:[B?.map(e=>{const t="forward"===e.type?e.messageId:"repost"===e.type?e.storyId:"user";return(0,ie.Y)(ks,{storyView:e},`${e.peerId}-${e.date}-${t}`)}),r&&Array.from({length:L}).map((e,t)=>(0,ie.Y)(ui.A,{className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0,children:(0,ie.Y)(gs.A,{})},`placeholder-${t}`)),R&&(0,ie.Y)("div",{className:(0,pe.A)(ys.info,ys.bottomInfo),children:C("Story.ViewList.NotFullyRecorded")},"not-all-available")]})]}),(0,ie.Y)("div",{className:(0,pe.A)(ys.footer,"dialog-buttons"),children:(0,ie.Y)(Z.A,{className:(0,pe.A)("confirm-dialog-button",ys.close),isText:!0,onClick:_,children:C("Close")})})]})})),ws=(0,s.ph)((0,n.EK)(e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:i,peerId:s,isPrivacyModalOpen:n,origin:a}}=(0,c.nTw)(e),o=s&&i?(0,c.Msb)(e,s,i):void 0,r=(0,c.xYJ)(e,"mediaViewerAnimations");return{isOpen:(0,c.gd2)(e),shouldSkipHistoryAnimations:t,peerId:s,storyId:i,story:o,origin:a,withAnimation:r,isPrivacyModalOpen:n}})(function({isOpen:e,peerId:t,storyId:i,story:a,origin:l,shouldSkipHistoryAnimations:c,withAnimation:d,isPrivacyModalOpen:h}){const{closeStoryViewer:u,closeStoryPrivacyEditor:v,reportStory:g}=(0,n.ko)(),A=(0,T.A)(),[f,b]=(0,s.J0)(void 0),[y,S,k]=(0,F.A)(!1),{bestImageData:w,thumbnail:I}=li(a),P=ri(),Y=(0,U.A)(e),D=(0,U.A)(w),B=(0,U.A)(t),L=(0,U.A)(l),R=Boolean(d&&!c);(0,s.vJ)(()=>{e||(b(void 0),k())},[e]),(0,s.vJ)(()=>{if(!e)return;(0,p.FD)();const t=(0,O.w4)();return()=>{(0,p.wb)(),t()}},[e]);const x=(0,s.hb)(()=>{u()},[u]),E=(0,M.A)(e=>{b(e),S()}),V=(0,M.A)(()=>{k(),b(void 0)}),_=(0,M.A)(()=>{i&&g({storyId:i,peerId:t})});return(0,s.vJ)(()=>e?(0,m.A)(()=>{x()}):void 0,[x,e]),(0,s.vJ)(()=>{R&&!Y&&e&&t&&I&&void 0!==l&&((0,s.VK)(250+o.xB5),function(e,t,i,s,n){const{mediaEl:a}=ai(t,e);if(!a)return;const{width:l,height:c}=N.A.get();let{width:d,height:h}=n;const u=l<=600;if(u){d=l-2*si,h=c-ii-2*si;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(h-=parseFloat(e))}const m=u?si:(l-d)/2,p=u?si:(c-(h+ii))/2,{top:v,left:g,width:A,height:f}=a.getBoundingClientRect(),b=g+A/2-(m+d/2),y=v+f/2-(p+h/2),S=A/d,k=f/h;(0,r.RK)(()=>{const e=ni(s||i,!s);(0,C.ZM)(e,{top:`${p}px`,left:`${m}px`,width:`${d}px`,height:`${h}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${S}, ${k})`});const t=document.getElementById("StoryViewer");t.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{(0,C.ZM)(e,{transform:""}),setTimeout(()=>{(0,r.RK)(()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(t,l,I,w,P.activeSlide)),R&&Y&&!e&&B&&D&&void 0!==L&&((0,s.VK)(250+o.xB5),function(e,t,i){const{mediaEl:s}=ai(t,e),n=document.getElementById("StoryViewer").querySelector(`.${Ht} .${Jt}, .${$t} .${Jt}`);if(!n||!s)return;const{top:a,left:l,width:c,height:d}=n.getBoundingClientRect(),{top:h,left:u,width:m,height:p}=s.getBoundingClientRect(),v=u+m/2-(l+c/2),g=h+p/2-(a+d/2),A=m/c,f=p/d;(0,r.RK)(()=>{const e=ni(i);(0,C.ZM)(e,{top:`${a}px`,left:`${l}px`,width:`${c}px`,height:`${d}px`});const t=ni(s.src,void 0,!0),n=a+d/2-c/2;(0,C.ZM)(t,{top:`${n}px`,left:`${l}px`,width:`${c}px`,height:`${c}px`});const h=document.getElementById("StoryViewer");h.appendChild(e),document.body.appendChild(t),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{(0,C.ZM)(e,{transform:`translate3d(${v}px, ${g}px, 0) scale(${A}, ${f})`}),(0,C.ZM)(t,{transform:`translate3d(${v}px, ${g}px, 0) scale(${A})`,opacity:"1"}),setTimeout(()=>{(0,r.RK)(()=>{h.contains(e)&&h.removeChild(e),document.body.contains(t)&&document.body.removeChild(t),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(B,L,D))},[R,w,D,e,Y,P.activeSlide,I,t,B,l,L]),(0,ie.FD)(ne.A,{id:"StoryViewer",className:"bu_hGbaa",isOpen:e,shouldAnimateFirstRender:!0,noCloseTransition:c,children:[(0,ie.Y)("div",{className:"OFh6u50Q",onClick:x}),(0,ie.Y)(Z.A,{className:"Mye8Dwxa",round:!0,size:"smaller",color:"translucent-white",ariaLabel:A("Close"),onClick:x,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)(ms,{isOpen:e,isDeleteModalOpen:y,onReport:_,onClose:x,onDelete:E}),(0,ie.Y)(di,{isOpen:y,story:f,onClose:V}),(0,ie.Y)(Ns,{}),(0,ie.Y)(Ni,{isOpen:h,onClose:v})]})}));var Is=i(79582),Ps=i(63527),Ys=i(96374),Fs=i(79174),Ds=i(10328),Ms=i(52745),Ts=i(34431),Bs=i(38102),Ls=i(45780);const Rs=2.75*g.$,xs="ChatOrUserPicker-item",Es=(0,s.ph)(({isOpen:e,currentUserId:t,chatOrUserIds:i,search:a,searchPlaceholder:r,className:d,loadMore:h,onSearchChange:u,onSelectChatOrUser:m,onClose:p,onCloseAnimationEnd:v,isLowStackPriority:g})=>{const{loadTopics:A}=(0,n.ko)(),f=(0,T.A)(),b=(0,Ri.A)(),C=(0,s.li)(),y=(0,s.li)(),S=(0,s.li)(),k=(0,s.li)(),[N,w]=(0,Ys.A)(h,i,Boolean(a)),[I,P]=(0,s.J0)(void 0),[Y,F]=(0,s.J0)(""),D=I?1:0,B=i.indexOf(N[0]),L=(0,M.A)(()=>{u("")});(0,Fs.A)(S,e&&0===D,L),(0,Fs.A)(k,e&&1===D);const R=(0,M.A)(e=>{if(I)return(0,c.pSx)(e,I)}),x=(0,Ps.A)(R),[E,V]=(0,s.Kr)(()=>{const e=(0,n.mS)(),t=e.chats.byId,i=e.chats.fullInfoById,s=t[I];if(!s||!x)return[void 0,void 0];const a=Y.toLowerCase(),o=x?Object.values(x).reduce((e,t)=>(!(0,l.__)(s,t,void 0,i[I])||a&&!t.title.toLowerCase().includes(a)||(e[t.id]=t),e),{}):x;return[Object.keys(o).map(Number),o]},[I,Y,x]),_=(0,M.A)(()=>{P(void 0),F("")}),U=(0,M.A)(e=>{u(e.currentTarget.value)}),O=(0,M.A)(e=>{F(e.currentTarget.value)}),K=(0,Ds.A)(C,e,e=>{if(N&&N.length>0){const t=(0,n.mS)().chats.byId,i=N[-1===e?0:e],s=t[i];s?.isForum?(x||A({chatId:i}),P(i)):m(i)}},`.${xs}`,!0),J=(0,Ds.A)(y,e,e=>{E?.length&&m(I,E[-1===e?0:e])},`.${xs}`,!0),G=(0,M.A)(e=>{const t=(0,n.mS)().chats.byId,i=t?.[e];i?.isForum?(x||A({chatId:e}),P(e),L()):m(e)}),j=(0,s.hb)((e,i)=>{const s=(0,n.mS)();let a=(0,c.PVB)(s,e);if(!a)return;const r=(0,c.k2W)(s,e);r&&(a=r);const d=a&&!(0,Dt.vj)(a)?a.isSelf:void 0,[h,u]=function(){if(!a)return;if(a.id===t)return[f("SavedMessagesInfo")];if((0,Dt.vj)(a))return[(0,l.sT)(f,a)];const e=(0,c.K0y)(s,a.id);return[(0,l.CD)(f,a,e),(0,pe.A)((0,l.PF)(a,e,!0)&&"online")]}()||[];return(0,ie.Y)(Ls.A,{className:xs,title:(0,ie.Y)("div",{className:"title-wrapper",children:(0,ie.Y)(Ts.A,{className:"item-title",peer:a,isMonoforum:Boolean(r),isSavedMessages:d})}),avatarElement:(0,ie.Y)(Tt.A,{peer:a,asMessageBubble:Boolean(r),isSavedMessages:d,size:"medium"}),subtitle:h,subtitleClassName:u,ripple:!0,style:`top: ${(B+i)*o.xw7}px;`,onClick:()=>G(e)},e)},[t,f,B]);return(0,ie.Y)(ee.A,{isOpen:e,className:(0,pe.A)("ChatOrUserPicker",d),isLowStackPriority:g,onClose:p,onCloseAnimationEnd:v,children:(0,ie.Y)(ae.Ay,{activeKey:D,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",children:()=>1===D?(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"modal-header modal-header-condensed",dir:b.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:f("Back"),onClick:_,children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),(0,ie.Y)(X.A,{ref:k,value:Y,onChange:O,onKeyDown:J,placeholder:r})]}),(0,ie.FD)(vs.A,{ref:y,className:"picker-list custom-scroll",items:E,withAbsolutePositioning:!0,maxHeight:56*(E?.length||0),onKeyDown:J,children:[!E&&(0,ie.Y)(Ms.A,{}),E?.map((e,t)=>(0,ie.Y)(Ls.A,{className:xs,onClick:()=>m(I,e),style:`top: ${56*(B+t)}px;`,avatarElement:(0,ie.Y)(Bs.A,{size:Rs,topic:V[e],className:"topic-icon",letterClassName:"topic-icon-letter"}),title:(0,Mt.A)(V[e].title)},`${I}_${e}`))]})]}):(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"modal-header modal-header-condensed",dir:b.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:f("Close"),onClick:p,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)(X.A,{ref:S,value:a,onChange:U,onKeyDown:K,placeholder:r})]}),N?.length?(0,ie.Y)(vs.A,{ref:C,className:"picker-list custom-scroll",items:N,itemSelector:`.${xs}`,onLoadMore:w,withAbsolutePositioning:!0,maxHeight:i.length*o.xw7,onKeyDown:K,children:N.map(j)}):N&&!N.length?(0,ie.Y)("p",{className:"no-results",children:f("lng_blocked_list_not_found")}):(0,ie.Y)(Ms.A,{})]})})})}),Vs=(0,s.ph)((0,n.EK)(e=>{const{chats:{listIds:t,orderedPinnedIds:i},currentUserId:s}=e;return{activeListIds:t.active,archivedListIds:t.archived,pinnedIds:i.active,contactIds:e.contactList?.userIds,currentUserId:s}})(({isOpen:e,currentUserId:t,activeListIds:i,archivedListIds:a,pinnedIds:r,contactIds:d,filter:h=o.K_A,className:u,searchPlaceholder:m,loadMore:p,onSelectRecipient:v,onClose:g,onCloseAnimationEnd:A,isLowStackPriority:f,isForwarding:b})=>{const[C,y]=(0,s.J0)(""),S=(0,s.Kr)(()=>{if(!e)return;let s=r||[];t&&(s=(0,pi.Am)([t,...s]));const o=(0,n.mS)(),u=[...i||[],...C&&a||[]].filter(e=>{const t=(0,c.hds)(o,e),i=(0,c.mBe)(o,e),s=t&&(0,l.ub)(t,"postMessages"),n=t&&(0,l.WX)(t);if(b&&n&&!s)return!1;if(i&&!(0,l.PL)(i))return!0;if(!t)return!1;if(t.isMonoforum&&(0,c.ODG)(o,e))return!1;const a=(0,c.AWZ)(o,e);return!a||(0,l.__)(t,void 0,void 0,a)}),m=(0,Is.A)((0,Dt.PU)({ids:(0,pi.Am)([...t?[t]:[],...u,...d||[]]),query:C}),void 0,s,t);return(0,c.yMZ)(o,m,h)},[e,r,t,i,C,a,d,h,b]),k=(0,Yi.A)(S,!0);return(0,ie.Y)(Es,{isOpen:e,className:u,chatOrUserIds:k,currentUserId:t,searchPlaceholder:m,search:C,onSearchChange:y,loadMore:p,onSelectChatOrUser:v,onClose:g,onCloseAnimationEnd:A,isLowStackPriority:f})})),_s=(0,s.ph)((0,n.EK)(e=>{const{messageIds:t,storyId:i}=(0,c.nTw)(e).forwardMessages,s=t&&t.length>0;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(i),isForwarding:s}})(({isOpen:e,currentUserId:t,isManyMessages:i,isStory:a,isForwarding:o})=>{const{openChatOrTopicWithReplyInDraft:r,setForwardChatOrTopic:d,exitForwardMode:h,forwardToSavedMessages:u,forwardStory:m,showNotification:p}=(0,n.ko)(),g=(0,T.A)(),A=(0,U.A)(a,!0),[f,b,C]=(0,F.A)();(0,s.vJ)(()=>{e&&b()},[e,b]);const y=(0,s.hb)((e,s)=>{const h=e===t;if(a){m({toChatId:e});const t=(0,n.mS)();if((0,v.L8)(e))p({message:h?g("Conversation.StoryForwardTooltip.SavedMessages.One"):g("StorySharedTo",(0,l.u0)((0,c.mBe)(t,e)))});else{const i=(0,c.hds)(t,e);if(!i)return;p({message:g("StorySharedTo",(0,l.Js)(g,i))})}return}if(h){const e=g(i?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");u(),p({message:e})}else{const t=e,i=s?Number(s):void 0;o?d({chatId:t,topicId:i}):r({chatId:t,topicId:i})}},[t,i,a,g,o]),S=(0,s.hb)(()=>{h()},[h]);if(e||f)return(0,ie.Y)(Vs,{isOpen:e,className:A?"component-theme-dark":void 0,searchPlaceholder:g(o?"ForwardTo":"ReplyToDialog"),onSelectRecipient:y,onClose:S,onCloseAnimationEnd:C,isForwarding:o})})),Us=(0,s.ph)(({requestedDraft:e})=>{const t=Boolean(e&&!e.chatId),{openChatWithDraft:i,resetOpenChatWithDraft:a}=(0,n.ko)(),o=(0,T.A)(),[r,l,c]=(0,F.A)();(0,s.vJ)(()=>{t&&l()},[t,l]);const d=(0,s.hb)((t,s)=>{i({chatId:t,threadId:s,text:e.text,files:e.files})},[i,e]),h=(0,s.hb)(()=>{a()},[a]);if(t||r)return(0,ie.Y)(Vs,{isOpen:t,searchPlaceholder:o("ForwardTo"),filter:e?.filter,onSelectRecipient:d,onClose:h,onCloseAnimationEnd:c})}),Os=(0,s.ph)(({requestedAttachBotInChat:e})=>{const{cancelAttachBotInChat:t,callAttachBot:i}=(0,n.ko)(),a=(0,T.A)(),o=Boolean(e),[r,l,c]=(0,F.A)();(0,s.vJ)(()=>{o&&l()},[o,l]);const{bot:d,filter:h,startParam:u}=e||{},m=(0,s.hb)(e=>{i({bot:d,chatId:e,startParam:u}),t()},[d,i,t,u]);if(o||r)return(0,ie.Y)(Vs,{isOpen:o,searchPlaceholder:a("Search"),filter:h,onSelectRecipient:m,onClose:t,onCloseAnimationEnd:c})});var Ks=i(99375);function Js(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Gs=(0,s.ph)((0,n.EK)(e=>({dialogs:(0,c.nTw)(e).dialogs,currentMessageList:(0,c.Xf0)(e)}))(({dialogs:e,currentMessageList:t})=>{const{dismissDialog:i,sendMessage:a}=(0,n.ko)(),[o,r,l]=(0,F.A)(),c=(0,Ri.A)();var d,h,u;if((0,s.vJ)(()=>{e.length>0&&r()},[e,r]),e.length)return Boolean(e.length)&&("phoneNumber"in(d=e[e.length-1])?(h=d,(0,ie.FD)(ee.A,{isOpen:o,onClose:l,className:"confirm",title:c("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:i,children:[c("AreYouSureShareMyContactInfoBot",void 0,{withNodes:!0,withMarkdown:!0,renderTextFilters:["br","emoji"]}),(0,ie.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:()=>{t&&(a({contact:h,messageList:t}),l())},children:c("OK")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:c("Cancel")})]})]})):(u=d,(0,ie.FD)(ee.A,{isOpen:o,onClose:l,onCloseAnimationEnd:i,className:"error",title:Js(u),children:[u.hasErrorKey?(0,Ks.Ay)(u):(0,Mt.A)(u.message,["simple_markdown","emoji","br"]),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{isText:!0,onClick:l,children:c("OK")})})]})))}));var js=i(17208);const zs=(0,s.ph)((0,n.EK)(e=>(0,pi.Up)((0,c.nTw)(e),["notifications"]))(({notifications:e})=>{if(e.length)return(0,ie.Y)("div",{id:"Notifications",children:e.map(e=>(0,ie.Y)(js.A,{notification:e},e.localId))})}));var Hs=i(24585);const $s=(0,s.ph)(({url:e})=>{const{toggleSafeLinkModal:t}=(0,n.ko)(),i=(0,Ri.A)(),a=(0,s.hb)(()=>{e&&(window.open((0,Hs.Tc)(e),"_blank","noopener noreferrer"),t({url:void 0}))},[t,e]),o=(0,s.hb)(()=>{t({url:void 0})},[t]),r=(0,Yi.A)(e);return(0,ie.Y)(ci.A,{isOpen:Boolean(e),onClose:o,title:i("OpenUrlTitle"),textParts:(0,Mt.A)(i("OpenUrlText",{url:r},{withNodes:!0,withMarkdown:!0})),confirmLabel:i("OpenUrlConfirm"),confirmHandler:a})});var qs=i(47526);const Ws=(0,s.ph)(({modal:e})=>{const{closeMapModal:t}=(0,n.ko)(),{point:i,zoom:a}=e||{},o=(0,T.A)(),r=Boolean(i),l=(0,M.A)(()=>{t()}),[c,d,h,m]=(0,s.Kr)(()=>{if(!i)return[];const e=(0,qs.zS)("google",i,a),t=(0,qs.zS)("bing",i,a),s=(0,qs.zS)("osm",i,a);return[e,t,(0,qs.zS)("apple",i,a),s]},[i,a]),p=(0,M.A)(e=>{t(),window.open(e,"_blank","noopener")}),v=(0,M.A)(()=>{p(c)}),g=(0,M.A)(()=>{p(d)}),A=(0,M.A)(()=>{p(h)}),f=(0,M.A)(()=>{p(m)});return(0,ie.FD)(ee.A,{contentClassName:"VJDwJpsF",title:o("OpenMapWith"),isOpen:r,onClose:l,isSlim:!0,children:[(0,ie.FD)("div",{className:"aYO2C2Hx",children:[(u.pz||u.MP)&&(0,ie.Y)(Z.A,{fluid:!0,size:"smaller",onClick:A,children:"Apple Maps"}),(0,ie.Y)(Z.A,{fluid:!0,size:"smaller",onClick:v,children:"Google Maps"}),(0,ie.Y)(Z.A,{fluid:!0,size:"smaller",onClick:g,children:"Bing Maps"}),(0,ie.Y)(Z.A,{fluid:!0,size:"smaller",onClick:f,children:"OpenStreetMap"})]}),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:o("Cancel")})})]})});var Qs=i(19806);const Zs=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({modal:e,currentUser:t})=>{const{closeUrlAuthModal:i,acceptBotUrlAuth:a,acceptLinkUrlAuth:o}=(0,n.ko)(),[r,c]=(0,s.J0)(!0),[d,h]=(0,s.J0)(!0),u=(0,Yi.A)(e,!1),{domain:m,botId:p,shouldRequestWriteAccess:v}=u?.request||{},g=p?(0,n.mS)().users.byId[p]:void 0,A=(0,T.A)(),f=(0,s.hb)(()=>{e?.url&&r?(e.button?a:o)({isWriteAllowed:d}):u?.url&&window.open((0,Hs.Tc)(u.url),"_blank","noopener"),i()},[e,r,i,a,o,d,u]),b=(0,s.hb)(()=>{i()},[i]),C=(0,s.hb)(e=>{c(e),h(e)},[c]);return(0,s.vJ)(()=>{m&&(c(!0),h(Boolean(v)))},[v,m]),(0,ie.FD)(ci.A,{isOpen:Boolean(e?.url),onClose:b,title:A("OpenUrlTitle"),confirmLabel:A("OpenUrlTitle"),confirmHandler:f,children:[(0,Mt.A)(A("OpenUrlAlert2",u?.url),["links"]),m&&(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:r,label:(0,ie.Y)(ie.FK,{children:(0,Mt.A)(A("Conversation.OpenBotLinkLogin",[m,(0,l.Yg)(t)]),["simple_markdown"])}),onCheck:C}),v&&(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:d,label:(0,ie.Y)(ie.FK,{children:(0,Mt.A)(A("Conversation.OpenBotLinkAllowMessages",(0,l.Yg)(g)),["simple_markdown"])}),onCheck:h,disabled:!r})]})})),Xs=1e3*o.fRl,en=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function tn(e,t,i,s,n){const a=new Date(e,t,i),o=s&&(0,$e.pU)(s),r=n&&(0,$e.pU)(n);return!!(r&&a>r)||!!(o&&a<o)}function sn(e){return String(e).padStart(2,"0")}function nn(e,t,i){return`${e}-${t+1}-${i}`}const an=(0,s.ph)(({selectedAt:e,minAt:t,maxAt:i,isFutureMode:n,isPastMode:a,isOpen:o,withTimePicker:r,submitButtonLabel:l,secondButtonLabel:c,description:d,onClose:h,onSubmit:u,onDateChange:m,onSecondButtonClick:p})=>{const v=(0,T.A)(),g=new Date,A=(0,s.Kr)(()=>n&&!t?new Date:new Date(Math.max(t||0,0)),[n,t]),f=(0,s.Kr)(()=>a&&!i?new Date:new Date(Math.min(i||Xs,Xs)),[a,i]),b=(0,s.Kr)(()=>e?new Date(e):new Date,[e]),C=(0,U.A)(o),[y,S]=(0,F.A)(!1),[k,N]=(0,s.J0)(b),[w,I]=(0,s.J0)(()=>new Date(k.getFullYear(),k.getMonth(),1)),[P,Y]=(0,s.J0)(()=>sn(b.getHours())),[D,M]=(0,s.J0)(()=>sn(b.getMinutes())),B=nn(k.getFullYear(),k.getMonth(),k.getDate()),L=w.getFullYear(),R=w.getMonth(),x=n&&k.getTime()<A.getTime()||a&&k.getTime()>f.getTime();(0,s.vJ)(()=>{!C&&o&&(N(b),I(new Date(b.getFullYear(),b.getMonth(),1)),r&&(Y(sn(b.getHours())),M(sn(b.getMinutes()))))},[b,o,C,r]),(0,s.vJ)(()=>{n&&!y&&k.getTime()<A.getTime()&&(N(A),Y(sn(A.getHours())),M(sn(A.getMinutes())))},[n,y,A,k]),(0,s.vJ)(()=>{a&&!y&&k.getTime()>f.getTime()&&(N(f),Y(sn(f.getHours())),M(sn(f.getMinutes())))},[n,a,y,f,A,k]),(0,s.vJ)(()=>{if(e){const t=new Date(e);N(t),Y(sn(t.getHours())),M(sn(t.getMinutes()))}},[e]);const E=a&&L>=g.getFullYear()&&R>=g.getMonth()||f&&L>=f.getFullYear()&&R>=f.getMonth(),V=n&&L<=g.getFullYear()&&R<=g.getMonth(),{prevMonthGrid:_,currentMonthGrid:O,nextMonthGrid:K}=(0,s.Kr)(()=>function(e,t){const i=[],s=[],n=[],a=new Date;a.setDate(1),a.setMonth(t),a.setFullYear(e);const o=a.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<o;e++)i.push(r-o+e+1);for(;a.getMonth()===t;){const e=a.getDate();s.push(e),a.setDate(e+1)}const l=(s.length+i.length)%7;if(l>0)for(let e=1;e<=7-l;e++)n.push(e);return{prevMonthGrid:i,currentMonthGrid:s,nextMonthGrid:n}}(L,R),[R,L]),J=(0,s.Kr)(()=>l||function(e,t){const i=(0,$e.A)(t,e.code);return i===(0,$e.A)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,$e.fU)(e,t)):e("Conversation.ScheduleMessage.SendOn",[i,(0,$e.fU)(e,t)])}(v,k),[v,k,l]),G=(0,s.hb)(()=>{u(n&&k<A?A:a&&k>f?f:k)},[n,a,A,f,u,k]),j=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return Y(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),23)),s=new Date(k.getTime());s.setHours(i),N(s),m?.(s);const n=sn(i);Y(n),e.target.value=n},[k,m]),z=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return M(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),59)),s=new Date(k.getTime());s.setMinutes(i),N(s),m?.(s);const n=sn(i);M(n),e.target.value=n},[k,m]);return(0,ie.FD)(ee.A,{isOpen:o,onClose:h,className:"CalendarModal",onEnter:G,children:[(0,ie.Y)("div",{className:"container",children:(0,ie.FD)("div",{className:"month-selector",children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:h,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.FD)("h4",{children:[v(`lng_month${R+1}`)," ",L]}),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",disabled:V,onClick:V?void 0:function(){I(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})},children:(0,ie.Y)(Q.A,{name:"previous"})}),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",disabled:E,onClick:E?void 0:function(){I(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t})},children:(0,ie.Y)(Q.A,{name:"next"})})]})}),(0,ie.Y)("div",{className:"calendar-wrapper",children:(0,ie.FD)("div",{className:"calendar-grid",children:[en.map(e=>(0,ie.Y)("div",{className:"day-button faded weekday",children:(0,ie.Y)("span",{children:v(e)})})),_.map(e=>(0,ie.Y)("div",{className:"day-button disabled",children:(0,ie.Y)("span",{children:e})})),O.map(e=>(0,ie.Y)("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void N(e=>{const i=new Date(e);return i.setDate(t),i.setMonth(R),i.setFullYear(L),m?.(i),i});var t},className:(0,pe.A)("day-button","div-button",tn(L,R,e,A,f)?"disabled":e?"clickable":"",B===nn(L,R,e)&&"selected"),children:Boolean(e)&&(0,ie.Y)("span",{children:e})})),K.map(e=>(0,ie.Y)("div",{className:"day-button disabled",children:(0,ie.Y)("span",{children:e})}))]})}),r&&(0,ie.FD)("div",{className:"timepicker",children:[(0,ie.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:P,onChange:j,onFocus:S}),":",(0,ie.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:D,onChange:z,onFocus:S})]}),(0,ie.FD)("div",{className:"footer",children:[d&&(0,ie.Y)("div",{className:"description",children:d}),(0,ie.FD)("div",{className:"footer",children:[(0,ie.Y)(Z.A,{onClick:G,disabled:x,children:J}),c&&(0,ie.Y)(Z.A,{onClick:p,isText:!0,children:c})]})]})]})}),on=(0,s.ph)((0,n.EK)(e=>({selectedAt:(0,c.nTw)(e).historyCalendarSelectedAt}))(({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:i,closeHistoryCalendar:a}=(0,n.ko)(),o=(0,s.hb)(e=>{i({timestamp:e.getTime()/1e3}),a()},[a,i]),r=(0,T.A)();return(0,ie.Y)(an,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:a,onSubmit:o})}));var rn=i(64713),ln=i(13235),cn=i(94079);const dn=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=t?(0,c.mBe)(e,t):void 0,s=t?(0,c.vGo)(e,t):void 0,n=e.appConfig?.contactNoteLimit||ln.tI;return{user:i,userStatus:t?(0,c.K0y)(e,t):void 0,phoneCodeList:e.countryList.phoneCodes,contactNoteLimit:n,noteText:s?.note?.text}})(({isOpen:e,userId:t,isByPhoneNumber:i,user:a,userStatus:o,phoneCodeList:r,contactNoteLimit:c,noteText:d})=>{const{updateContact:h,importContact:m,closeNewContactDialog:p}=(0,n.ko)(),v=(0,T.A)(),g=(0,Ri.A)(),A=(0,Yi.A)(a),f=(0,Yi.A)(i),b=(0,s.li)(),[C,y,S]=(0,F.A)(),[k,N]=(0,s.J0)(A?.firstName??""),[w,I]=(0,s.J0)(A?.lastName??""),[P,Y]=(0,s.J0)(A?.phoneNumber??""),[D,M]=(0,s.J0)(""),[B,L]=(0,s.J0)(!0),R=Boolean(k&&(!i||P)),x=c-D.length,E=(0,s.li)();(0,s.vJ)(()=>{e&&(y(),N(A?.firstName??""),I(A?.lastName??""),Y(A?.phoneNumber??""),M(d??""),L(!0))},[e,y,d,A?.firstName,A?.lastName,A?.phoneNumber]),(0,s.vJ)(()=>{!u.TF&&C&&setTimeout(()=>{b.current?.focus()},200)},[C]);const V=(0,s.hb)(e=>{N(e.target.value)},[]),_=(0,s.hb)(e=>{Y((0,rn.Ox)(r,e.target.value))},[r]),U=(0,s.hb)(e=>{I(e.target.value)},[]),O=(0,s.hb)(e=>{M(e.target.value)},[]),K=(0,s.hb)(()=>{p(),N(""),I(""),Y(""),M("")},[p]),J=(0,s.hb)(()=>{const e=D.trim()?{text:D,entities:[]}:void 0;i||!t?m({firstName:k,lastName:w,phoneNumber:P}):h({userId:t,firstName:k,lastName:w,shouldSharePhoneNumber:B,note:e})},[k,m,i,w,D,P,B,h,t]);if(e||C)return(0,ie.FD)(ee.A,{className:"NewContactModal",title:v("NewContact"),isOpen:e,onClose:K,onCloseAnimationEnd:S,children:[A&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"NewContactModal__profile",dir:g.isRtl?"rtl":void 0,children:[(0,ie.Y)(Tt.A,{size:"jumbo",peer:A,text:`${k} ${w}`}),(0,ie.FD)("div",{className:"NewContactModal__profile-info",children:[(0,ie.Y)("p",{className:"NewContactModal__phone-number",children:A?.phoneNumber?(0,rn.Ox)(r,A.phoneNumber):v("MobileHidden")}),(0,ie.Y)("span",{className:"NewContactModal__user-status",dir:"auto",children:(0,l.CD)(v,A,o)})]})]}),(0,ie.Y)(X.A,{ref:b,value:k,label:v("FirstName"),tabIndex:0,onChange:V}),(0,ie.Y)(X.A,{value:w,label:v("LastName"),tabIndex:0,onChange:U}),(0,ie.Y)(cn.A,{ref:E,id:"user-note",label:g("UserNoteTitle"),onChange:O,value:D,maxLength:c,maxLengthIndicator:x.toString(),noReplaceNewlines:!0}),(0,ie.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__edit",children:g("EditUserNoteHint")}),(0,ie.Y)("p",{className:"NewContactModal__help-text",children:(0,Mt.A)(v("NewContact.Phone.Hidden.Text",A?.firstName||""),["emoji","simple_markdown"])}),(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:B,tabIndex:0,onCheck:L,label:v("lng_new_contact_share")}),(0,ie.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__negative",children:(0,Mt.A)(v("AddContact.SharedContactExceptionInfo",A?.firstName))})]}),f&&(0,ie.FD)("div",{className:"NewContactModal__new-contact",dir:g.isRtl?"rtl":void 0,children:[(0,ie.Y)(Tt.A,{size:"jumbo",text:`${k} ${w}`}),(0,ie.FD)("div",{className:"NewContactModal__new-contact-fieldset",children:[(0,ie.Y)(X.A,{ref:b,value:P,inputMode:"tel",label:v("lng_contact_phone"),tabIndex:0,onChange:_}),(0,ie.Y)(X.A,{value:k,label:v("FirstName"),tabIndex:0,onChange:V}),(0,ie.Y)(X.A,{value:w,label:v("LastName"),tabIndex:0,onChange:U})]})]}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",disabled:!R,onClick:J,children:v("Done")}),(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:K,children:v("Cancel")})]})]})}));var hn=i(20179),un=i(30708),mn=i(48894),pn=i(32625),vn=i(10722);let gn=function(e){return e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.TopLeft=4]="TopLeft",e[e.TopRight=5]="TopRight",e[e.BottomLeft=6]="BottomLeft",e[e.BottomRight=7]="BottomRight",e}({});const An={top:gn.Top,bottom:gn.Bottom,left:gn.Left,right:gn.Right,topLeft:gn.TopLeft,topRight:gn.TopRight,bottomLeft:gn.BottomLeft,bottomRight:gn.BottomRight},fn=Object.keys(An);let bn;const Cn={x:0,y:0};var yn=i(36838);const Sn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).webApps,{botId:i}=(0,c.ES7)(e)||{},{modalState:s,openedWebApps:n}=t||{},a="minimized"===s;return{activeTabBot:i?(0,c.mBe)(e,i):void 0,isMinimizedState:a,openedWebApps:n}})(({activeTabBot:e,isMinimizedState:t,openedWebApps:i})=>{const{changeWebAppModalState:a,closeWebAppModal:o}=(0,n.ko)(),r=(0,T.A)(),l=(0,Ri.A)(),d=(0,s.li)(),h=(0,s.Kr)(()=>i&&Object.values(i),[i]),u=h?.length,m=(0,s.Kr)(()=>{if(!u)return[];const t=(0,n.mS)(),i=e?.id;return(0,pi.Am)([i,...h.map(e=>e.botId)]).map(e=>e&&(0,c.mBe)(t,e)).filter(Boolean).slice(0,3)},[u,e,h]),p=(0,M.A)(()=>{o()}),v=(0,M.A)(()=>{a({state:"maximized"})});if(t)return(0,ie.FD)("div",{ref:d,className:(0,pe.A)("kUZmBlnN"),children:[(0,ie.Y)(Z.A,{className:"SMRJmUuE",round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:p,children:(0,ie.Y)(Q.A,{className:"P0P4gW6a",name:"close"})}),(0,ie.Y)(is.A,{className:"GP17QhNN",size:"mini",peers:m}),function(){const e=m.length>0&&m[0]?.firstName,t=u&&e&&u>1?l("MiniAppsMoreTabs",{botName:e,count:u-1},{pluralValue:u-1}):e;return(0,ie.Y)("div",{className:"TZFjRaG4",children:t})}(),(0,ie.Y)(Z.A,{className:(0,pe.A)("Rax9j_TK","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:v,children:(0,ie.Y)(Q.A,{className:"sdbTXCxq",name:"expand-modal"})})]})}));var kn=i(14242),Nn=i(59852),wn=i(84991);const In={container:"RFg0Ey2I","user-count-badge":"UZtJ6ZXb",userCountBadge:"UZtJ6ZXb","user-badge-icon":"pTiZFhsG",userBadgeIcon:"pTiZFhsG",name:"TzA5nqCC"},Pn=(0,s.ph)((0,n.EK)((e,{chatId:t})=>({user:(0,c.mBe)(e,t)}))(function({user:e,isPopularApp:t}){const{requestMainWebView:i}=(0,n.ko)(),s=(0,Ri.A)(),a=(0,M.A)(()=>{if(!e)return;const t=e?.id;if(!t)return;const s=(0,Nn.A)();i({botId:t,peerId:t,theme:s})});if(!e)return;const o=e?.firstName,r=e?.botActiveUsers,l=r&&t?(0,kn.Vw)(s,r):void 0;return(0,ie.Y)("div",{className:In.container,onClick:a,children:(0,ie.Y)(wn.A,{className:(0,pe.A)(In.avatarContainer,t&&"PopularAppGridItem"),textClassName:In.name,badgeClassName:In.userCountBadge,badgeIconClassName:In.userBadgeIcon,peer:e,text:o,badgeText:l,badgeIcon:"user-filled"})})})),Yn={root:"BJV09FsC",search:"bdi8G7GR","section-title":"ex3kxgWX",sectionTitle:"ex3kxgWX","section-content":"uIZzLhEh",sectionContent:"uIZzLhEh",showMoreLink:"h_Zs9ypA"},Fn=(0,Ae.nF)(e=>e(),500,!0),Dn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(({foundIds:e,recentBotIds:t})=>{const i=(0,T.A)(),o=(0,Ri.A)(),[r,l]=(0,s.J0)(!1),{searchPopularBotApps:c}=(0,n.ko)(),d=(0,M.A)(()=>{l(e=>!e)}),[h,u]=(0,s.J0)(""),m=(0,s.Kr)(()=>e?(0,Dt.PU)({ids:e,query:h,type:"user"}):[],[e,h]),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Fn(()=>{c()})},[]),v=(0,s.hb)(()=>{u("")},[]);return(0,ie.FD)(vs.A,{className:(0,pe.A)(Yn.root,"custom-scroll"),items:m,onLoadMore:p,itemSelector:".PopularAppGridItem",noFastList:!0,preloadBackwards:30,children:[(0,ie.Y)(As.A,{className:Yn.search,value:h,onChange:u,onReset:v,placeholder:o("SearchApps")}),t&&!h&&(0,ie.FD)("div",{className:Yn.section,children:[(0,ie.FD)("div",{className:Yn.sectionTitle,children:[(0,ie.Y)("span",{children:i("SearchAppsMine")}),(0,ie.Y)("span",{className:Yn.showMoreLink,onClick:d,children:i(r?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")})]}),(0,ie.Y)("div",{className:Yn.sectionContent,children:t.map((e,t)=>{if(r||!(t>=5))return(0,ie.Y)(Pn,{chatId:e})})})]}),(0,ie.FD)("div",{className:Yn.section,children:[(0,ie.Y)("div",{className:Yn.sectionTitle,children:o(h?"Apps":"PopularApps")}),(0,ie.Y)("div",{className:Yn.sectionContent,children:m&&m.map(e=>(0,ie.Y)(Pn,{chatId:e,isPopularApp:!h}))})]})]})})),Mn=3.675*g.$,Tn="jEAibDyh",Bn="ablUg8HU",Ln="Wrl63uWL",Rn="vOFiAq3l",xn="KwI4XdkC",En="oq6HKJur",Vn="a0AI_he5",_n="MvCwTbk_",Un=250,On=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),Kn={ok:"OK",cancel:"Cancel",close:"Close"},Jn=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=t?.modalState,a=s?e.attachMenu.bots[s]:void 0,o=s?(0,c.mBe)(e,s):void 0,r=s?(0,c.vGo)(e,s):void 0,l=r?.botInfo?.appSettings,d=e.currentUserId?(0,c.mBe)(e,e.currentUserId):void 0,h=(0,c.SJA)(e),{isPaymentModalOpen:u,status:m}=(0,c.nTw)(e).payment,{status:p,inputInvoice:v}=(0,c.nTw)(e).starsPayment,g=o?(0,c.XOs)(e,o.id):void 0,A=p||m;return{attachBot:a,bot:o,currentUser:d,theme:h,isPaymentModalOpen:u||Boolean(v),paymentStatus:A,modalState:n,botAppPermissions:g,botAppSettings:l}})(({modal:e,webApp:t,bot:i,theme:a,isPaymentModalOpen:r,paymentStatus:c,registerSendEventCallback:d,registerReloadFrameCallback:h,isTransforming:m,modalState:p,isMultiTabSupported:v,onContextMenuButtonClick:g,botAppPermissions:A,botAppSettings:f,modalHeight:b})=>{const{closeActiveWebApp:C,sendWebViewData:y,toggleAttachBot:S,openTelegramLink:k,setWebAppPaymentSlug:N,switchBotInline:w,sharePhoneWithBot:I,updateWebApp:P,resetPaymentStatus:D,openChatWithInfo:B,showNotification:L,openEmojiStatusAccessModal:R,openLocationAccessModal:x,changeWebAppModalState:E,closeWebAppModal:V,openPreparedInlineMessageModal:_}=(0,n.ko)(),[U,O]=(0,s.J0)(),[K,J]=(0,s.J0)(),[G,j,H]=(0,F.A)(!1),[$,q]=(0,s.J0)(),[W,X]=(0,s.J0)(!1),[te,se]=(0,s.J0)(!1),[ne,oe]=(0,s.J0)(),[re,le]=(0,s.J0)(),{unlockPopupsAt:ce,handlePopupOpened:de,handlePopupClosed:he}=function(){const[e,t]=(0,s.J0)(0),i=(0,s.li)(0),n=(0,s.li)(0),a=(0,M.A)(()=>{const e=Date.now();e-n.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&t(e+2e3)}),o=(0,M.A)(()=>{e<Date.now()&&(n.current=Date.now())});return{unlockPopupsAt:e,handlePopupOpened:a,handlePopupClosed:o}}(),ue=(0,s.li)(),me=(0,s.li)(),ve=(0,s.li)(),ge="fullScreen"===p,Ae="minimized"===p,fe=(0,M.A)(()=>{setTimeout(()=>{E({state:"maximized"})},350)}),be=(0,s.li)();(0,s.vJ)(()=>{be.current=document.querySelector("#portals")},[]);const[,Ce,ye]=(0,Ne.Ay)(be,fe),Se=e?.activeWebAppKey?e.openedWebApps[e.activeWebAppKey]:void 0,{appName:ke,backgroundColor:Ie}=Se||{},{url:Pe,buttonText:Ye,isBackButtonVisible:Fe}=t||{},{placeholderPath:De}=f||{},Me=Boolean(t?.isCloseModalOpen),Te=Boolean(t?.isRemoveModalOpen),Be=t&&(0,hn.rp)(t),Le=Se&&(0,hn.rp)(Se),Re=Se&&t&&Le===Be,xe=u.H$,Ee=void 0!==A?.geolocation,_e=Boolean(A?.geolocation),Ue=(0,M.A)(e=>{Be&&P({key:Be,update:e})}),Oe=(0,s.Kr)(()=>(0,Nn.A)(),[a]);(0,s.vJ)(()=>{le(Oe.secondary_bg_color)},[Oe]);const Ke=Oe.bg_color,[Je,Ge]=(0,s.J0)(),je="light"===a?f?.backgroundColor:f?.backgroundDarkColor;(0,s.vJ)(()=>{Ue({backgroundColor:Je||je||Ke})},[Ke,Je,je]);const ze=Oe.bg_color,[He,$e]=(0,s.J0)(),qe="light"===a?f?.headerColor:f?.headerDarkColor;(0,s.vJ)(()=>{Ue({headerColor:He||qe||ze})},[ze,He,qe]);const We=(0,s.li)(),Qe=(0,T.A)(),Ze=(0,Ri.A)(),et=e?.isModalOpen||!1,tt=Boolean(Ye),{reloadFrame:it,sendEvent:st,sendFullScreenChanged:nt,sendViewport:at,sendSafeArea:ot,sendTheme:rt}=((e,t,i,a,r,c,d)=>{const{showNotification:h,setWebAppPaymentSlug:u,openInvoice:m,closeWebApp:p,openSuggestedStatusModal:v,updateWebApp:g,updateContentSettings:A}=(0,n.ko)(),f=(0,s.li)(!1),b=(0,s.li)(),C=(0,s.li)(!1),y=(0,s.li)(),S=(0,we.A)();(0,s.vJ)(()=>{if(!e.current||!t)return;const i=()=>{d?.()},s=e.current;return s.addEventListener("load",i),()=>{s.removeEventListener("load",i)}},[d,e,t]);const k=(0,s.hb)(t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")},[e]),N=(0,s.hb)(e=>{k({eventType:"fullscreen_changed",eventData:{is_fullscreen:e}})},[k]),w=(0,M.A)(t=>{if(!e.current)return;const i=e.current;i.src="about:blank",i.addEventListener("load",()=>{i.src=t},{once:!0})}),I=(0,s.hb)(e=>{if(f.current)return k({eventType:"reload_iframe"}),void(b.current=setTimeout(()=>{w(e)},500));w(e)},[k]),P=(0,s.hb)(t=>{if(!e.current)return;const{width:i,height:s}=e.current.getBoundingClientRect();k({eventType:"viewport_changed",eventData:{width:i,height:s,is_expanded:!0,is_state_stable:!t}})},[k,e]),Y=(0,s.hb)(()=>{e.current&&(k({eventType:"safe_area_changed",eventData:{left:0,right:0,top:0,bottom:0}}),k({eventType:"content_safe_area_changed",eventData:{left:0,right:0,top:i?Mn:0,bottom:0}}))},[k,i,e]),F=(0,s.hb)(()=>{k({eventType:"theme_changed",eventData:{theme_params:(0,Nn.A)()}})},[k]),D=(0,s.hb)(e=>{k({eventType:"set_custom_style",eventData:e})},[k]),T=(0,s.hb)(t=>{if(C.current)return;const i=e.current?.contentWindow;if(i===t.source)try{const e=JSON.parse(t.data),{eventType:i,eventData:s}=e;if("web_app_ready"===i&&d?.(),"web_app_close"===i&&c){const e=(0,l.rp)(c);p({key:e,skipClosingConfirmation:!0})}if("web_app_request_viewport"===i&&P(S.isResizing),"web_app_request_safe_area"===i&&Y(),"web_app_request_content_safe_area"===i&&Y(),"web_app_request_theme"===i&&F(),"iframe_ready"===i){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");D("* {\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)),f.current=Boolean(s.reload_supported)}if("iframe_will_reload"===i&&clearTimeout(b.current),"web_app_data_send"===i){if(!a)return;C.current=!0}if("web_app_read_text_from_clipboard"===i&&k({eventType:"clipboard_text_received",eventData:{req_id:s.req_id,data:null}}),"web_app_open_scan_qr_popup"===i&&h({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===i&&(u({slug:s.slug}),m({type:"slug",slug:s.slug})),"web_app_open_link"===i){const e=s.url;window.open(e,"_blank","noreferrer")}if("web_app_biometry_get_info"===i&&k({eventType:"biometry_info_received",eventData:{available:!1}}),"web_app_device_storage_clear"===i||"web_app_device_storage_get_key"===i||"web_app_device_storage_save_key"===i){const{req_id:e}=s;k({eventType:"device_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_secure_storage_clear"===i||"web_app_secure_storage_get_key"===i||"web_app_secure_storage_restore_key"===i||"web_app_secure_storage_save_key"===i){const{req_id:e}=s;k({eventType:"secure_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_start_accelerometer"===i&&k({eventType:"accelerometer_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_gyroscope"===i&&k({eventType:"gyroscope_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_device_orientation"===i&&k({eventType:"device_orientation_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_add_to_home_screen"===i&&k({eventType:"home_screen_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_check_home_screen"===i&&k({eventType:"home_screen_checked",eventData:{status:"unsupported"}}),"web_app_set_emoji_status"===i){const{custom_emoji_id:e,duration:t}=s;if(!e||"string"!=typeof e)return void k({eventType:"emoji_status_failed",eventData:{error:"SUGGESTED_EMOJI_INVALID"}});if(t)try{BigInt(t)}catch(e){return void k({eventType:"emoji_status_failed",eventData:{error:"DURATION_INVALID"}})}if(!c)return void k({eventType:"emoji_status_failed",eventData:{error:"UNKNOWN_ERROR"}});v({webAppKey:(0,l.rp)(c),customEmojiId:e,duration:Number(t),botId:c.botId})}if("web_app_verify_age"===i){const{passed:e}=s,t=(0,n.mS)().appConfig.verifyAgeMin||o.lYi,i=s.age||0;e&&i>=t?(h({message:{key:"TitleAgeCheckSuccess"}}),A({isSensitiveEnabled:!0})):h({message:{key:"TitleAgeCheckFailed"}})}r(e)}catch(e){}},[a,k,r,D,c,F,P,Y,d,S.isResizing,e]);return(0,s.vJ)(()=>{const{width:e,height:t,isResizing:i}=S;y.current&&y.current.width===e&&y.current.height===t&&!y.current.isResizing||(y.current={width:e,height:t,isResizing:i},P(i))},[P,Y,S]),(0,s.vJ)(()=>{c?.plannedEvents?.length&&(c.plannedEvents.forEach(e=>{k(e)}),g({key:(0,l.rp)(c),update:{plannedEvents:[]}}))},[k,c]),(0,s.vJ)(()=>(window.addEventListener("message",T),()=>window.removeEventListener("message",T)),[T,e]),(0,s.vJ)(()=>{t&&e.current?.contentWindow?(P(),Y(),C.current=!1):y.current=void 0},[t,i,P,Y,e]),{sendEvent:k,sendFullScreenChanged:N,reloadFrame:I,sendViewport:P,sendSafeArea:Y,sendTheme:F}})(We,et,ge,tt,function(e){const{eventType:t,eventData:s}=e;if("web_app_request_fullscreen"===t&&((0,Y.cB)()?E({state:"fullScreen"}):st({eventType:"fullscreen_failed",eventData:{error:"UNSUPPORTED"}})),"web_app_exit_fullscreen"===t&&bt(),"web_app_open_tg_link"===t){E({state:"minimized"});const e=o.jsp+s.path_full;k({url:e,shouldIgnoreCache:s.force_request})}if("web_app_setup_back_button"===t&&Ue({isBackButtonVisible:s.is_visible}),"web_app_setup_settings_button"===t&&Ue({isSettingsButtonVisible:s.is_visible}),"web_app_set_background_color"===t&&Ge((0,Nn.To)(s.color)?s.color:void 0),"web_app_set_header_color"===t){const e=s.color_key;$e(s.color||(e?Oe[e]:void 0))}if("web_app_set_bottom_bar_color"===t&&le(s.color),"web_app_data_send"===t&&(C(),y({bot:i,buttonText:Ye,data:s.data})),"web_app_setup_main_button"===t){const e=s.color,t=s.text_color;O({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible})}if("web_app_setup_secondary_button"===t){const e=s.color,t=s.text_color;J({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible,position:s.position})}if("web_app_setup_closing_behavior"===t&&Ue({shouldConfirmClosing:!0}),"web_app_open_popup"===t){if($||!s.message.trim().length||!s.buttons?.length||s.buttons.length>3||W||te||ce>Date.now())return void vt(void 0);q(s),de()}if("web_app_switch_inline_query"===t){const e=s.chat_types?.map(l.Xj).filter(Boolean),t=!e?.length;w({botId:i.id,query:s.query,filter:e,isSamePeer:t}),C()}if("web_app_request_phone"===t){if($||te||ce>Date.now())return void kt();X(!0),de()}if("web_app_request_write_access"===t){if($||W||ce>Date.now())return void It();!async function(){if(!i)return;const e=await(0,Xe.px)("fetchBotCanSendMessage",{bot:i});e&&st({eventType:"write_access_requested",eventData:{status:"allowed"}}),se(!e)}(),de()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:n}=s;!async function(e,t,s){const n=await(0,Xe.px)("invokeWebViewCustomMethod",{bot:i,customMethod:t,parameters:s});st({eventType:"custom_method_invoked",eventData:{req_id:e,...n}})}(n,e,JSON.stringify(t))}if("web_app_request_file_download"===t){if(ne||ce>Date.now())return void wt();!async function(e,t){await(0,Xe.px)("checkBotDownloadFileParams",{bot:i,url:e,fileName:t})?(oe({url:e,fileName:t}),de()):st({eventType:"file_download_requested",eventData:{status:"cancelled"}})}(s.url,s.file_name)}if("web_app_send_prepared_message"===t){if(!i||!Be)return;const{id:e}=s;_({botId:i.id,messageId:e,webAppKey:Be})}if("web_app_request_emoji_status_access"===t){if(!i)return;R({bot:i,webAppKey:Be})}"web_app_check_location"===t&&st({eventType:"location_checked",eventData:{available:xe,access_requested:Ee,access_granted:_e}}),"web_app_request_location"===t&&(async()=>{const e=await(0,u.Bu)(),{accessRequested:t,accessGranted:s,geolocation:n}=e;if(!s||!t)return st({eventType:"location_requested",eventData:{available:!1}}),L({message:Qe("PermissionNoLocationPosition")}),void vt(void 0);xe?Ee?st({eventType:"location_requested",eventData:{available:Boolean(A?.geolocation),latitude:n?.latitude,longitude:n?.longitude,altitude:n?.altitude,course:n?.heading,speed:n?.speed,horizontal_accuracy:n?.accuracy,vertical_accuracy:n?.altitudeAccuracy}}):x({bot:i,webAppKey:Be}):(L({message:Qe("PermissionNoLocationPosition")}),vt(void 0))})(),"web_app_open_location_settings"===t&&Ft()},t,j);(0,s.vJ)(()=>{Re&&d(st)},[st,d,Re]),(0,s.vJ)(()=>{Re&&h(it)},[it,h,Re]);const lt=G&&U?.isVisible&&U.text.trim().length>0,ct=G&&K?.isVisible&&K.text.trim().length>0,dt=(0,M.A)(()=>{Ue({isCloseModalOpen:!1})}),ht=(0,M.A)(()=>{Ue({shouldConfirmClosing:!1,isCloseModalOpen:!1}),setTimeout(()=>{C()},400)}),ut=(0,M.A)(()=>{Ue({isRemoveModalOpen:!1})}),mt=(0,M.A)(()=>{st({eventType:"main_button_pressed"})}),pt=(0,M.A)(()=>{st({eventType:"secondary_button_pressed"})}),vt=(0,M.A)(e=>{q(void 0),he(),st({eventType:"popup_closed",eventData:{button_id:e}})}),gt=(0,M.A)(()=>{vt()}),At=(0,M.A)(()=>{rt()});(0,z.A)(()=>{setTimeout(()=>{At()},400)},[a]);const ft=(0,M.A)(()=>{!(0,Ne.j9)()&&Re&&Ce?.()}),bt=(0,M.A)(()=>{(0,Ne.j9)()&&Re&&ye?.()}),Ct=(0,M.A)(e=>{Re&&nt(e)});(0,s.vJ)(()=>{ge?(ft(),Ct(!0)):(bt(),Ct(!1))},[ge]);const yt=(0,M.A)(e=>{st({eventType:"visibility_changed",eventData:{is_visible:e}})});(0,s.vJ)(()=>{G&&yt(Boolean(Re))},[Re,G]),(0,fi.A)(([e])=>{"minimized"===p&&yt(!1),p&&"minimized"===e&&yt(!0)},[p]),(0,z.A)(([e])=>{r!==e&&t?.slug&&!r&&c&&(st({eventType:"invoice_closed",eventData:{slug:t.slug,status:c}}),N({slug:void 0}),D())},[r,c,st,t?.slug]);const St=(0,M.A)(()=>{S({botId:i.id,isEnabled:!1}),C()}),kt=(0,M.A)(()=>{X(!1),he(),st({eventType:"phone_requested",eventData:{status:"cancelled"}})}),Nt=(0,M.A)(()=>{I({botId:i.id}),X(!1),he(),st({eventType:"phone_requested",eventData:{status:"sent"}})}),wt=(0,M.A)(e=>{e&&(oe(void 0),he()),st({eventType:"file_download_requested",eventData:{status:"cancelled"}})}),It=(0,M.A)(()=>{st({eventType:"write_access_requested",eventData:{status:"cancelled"}}),se(!1),he()}),Pt=(0,M.A)(async()=>{i&&(await(0,Xe.px)("allowBotSendMessages",{bot:i})?(st({eventType:"write_access_requested",eventData:{status:"allowed"}}),se(!1),he()):It())}),Yt=(0,M.A)(()=>{ne&&(oe(void 0),he(),(0,Di.A)(ne.url,ne.fileName),st({eventType:"file_download_requested",eventData:{status:"downloading"}}))});(0,s.vJ)(()=>{et||(q(void 0),X(!1),se(!1),O(void 0),J(void 0),Ue({isSettingsButtonVisible:!1,shouldConfirmClosing:!1,isBackButtonVisible:!1,isCloseModalOpen:!1,isRemoveModalOpen:!1}),H())},[et]);const Ft=(0,M.A)(()=>{B({id:i.id})}),Dt=(0,Yi.A)(U?.color,!0),Tt=(0,Yi.A)(U?.textColor,!0),Bt=(0,Yi.A)(U&&Boolean(U.isActive),!0),Lt=(0,Yi.A)(U?.text,!0),Rt=(0,Yi.A)(K?.position,!0),xt=(0,Yi.A)(K?.color,!0),Et=(0,Yi.A)(K?.textColor,!0),Vt=(0,Yi.A)(K&&Boolean(K.isActive),!0),_t=(0,Yi.A)(K?.text,!0),[Ut,Ot]=(0,s.J0)(!1),[Kt,Jt]=(0,s.J0)(!0),[Gt,jt]=(0,s.J0)(!0),[zt,Ht]=(0,s.J0)(!1),[$t,qt]=(0,s.J0)(!1),[Wt,Qt]=(0,s.J0)(!1),[Zt,Xt]=(0,s.J0)(0);(0,z.A)(()=>{setTimeout(()=>{at(),ot()},m?0:400)},[$t,Gt,zt,zt,K?.position,at,m,b,ot]);const ei="top"===Rt||"bottom"===Rt,ti=ei&&zt&&$t?2:zt||$t?1:0,ii=ei||Kt||Gt?"vertical":"horizontal",si=(0,s.li)(),ni=(0,s.li)(),ai=(0,s.li)(),oi=(0,s.li)(),ri=(0,s.li)();(0,s.vJ)(()=>(ge&&et&&Boolean(ke)?(Qt(!0),ri.current&&clearTimeout(ri.current),ri.current=setTimeout(()=>{Qt(!1),ri.current=void 0},3800)):(Qt(!1),ri.current&&(clearTimeout(ri.current),ri.current=void 0)),()=>{ri.current&&clearTimeout(ri.current)}),[ge,et,ke]),(0,s.vJ)(()=>{si.current&&clearTimeout(si.current),ni.current&&clearTimeout(ni.current),lt&&(ni.current=setTimeout(()=>{Ht(!0)},35),Jt(!1),si.current=setTimeout(()=>{Ot(!0)},Un)),lt||(Ht(!1),si.current=setTimeout(()=>{Jt(!0)},Un))},[lt]),(0,s.vJ)(()=>{ai.current&&clearTimeout(ai.current),oi.current&&clearTimeout(oi.current),ct&&(oi.current=setTimeout(()=>{qt(!0)},35),jt(!1),ai.current=setTimeout(()=>{Ot(!0)},Un)),ct||(qt(!1),ai.current=setTimeout(()=>{jt(!0)},Un))},[ct]),(0,s.vJ)(()=>{$t||zt||Ot(!1)},[Ot,$t,zt]);const li=(0,wi.A)(`background-color: ${Ie||"var(--color-background)"}`,m&&"pointer-events: none;"),di=(0,M.A)(()=>{Fe?st({eventType:"back_button_pressed"}):(bt(),nt(!1),E({state:"maximized"}),V())}),hi=(0,M.A)(()=>{bt()}),ui=(0,M.A)(e=>{g(e)}),mi=(0,pe.A)("BvNtfigU",Fe&&"rC2wkMIk"),pi=Wt?ke:Qe(Fe?"Back":"Close"),vi=ve?.current;return(0,s.vJ)(()=>{Xt(ve?.current?.clientWidth||0)},[pi,vi]),(0,ie.FD)("div",{ref:ue,className:(0,pe.A)("LeeJZdwH",!Re&&Rn,v&&"ESsGT5OD"),children:[ge&&(0,Y.cB)()&&(0,ie.FD)("div",{className:"eYrhewMy",children:[(0,ie.FD)("div",{ref:me,className:_n,onClick:di,children:[(0,ie.Y)("div",{className:"JXsuZ01s",children:(0,ie.Y)("div",{className:mi})}),(0,ie.Y)("span",{className:"dpZR3YT7",style:`width: ${Zt}px;`,children:(0,ie.Y)(ae.Ay,{activeKey:Wt?0:Fe?1:2,name:"slideFade",children:(0,ie.Y)("div",{ref:ve,className:"dWDprnWa",children:pi})})})]}),(0,ie.FD)("div",{className:"Tl4_05AQ",children:[(0,ie.Y)("div",{className:(0,pe.A)(_n,"emOpAMBm"),tabIndex:0,role:"button","aria-label":Ze("WebAppCollapse"),onClick:hi,children:(0,ie.Y)(Q.A,{name:"down",className:Vn})}),(0,ie.Y)("div",{className:(0,pe.A)(_n,"z4C5VD5o"),tabIndex:0,role:"button","aria-haspopup":"menu","aria-label":Ze("AriaMoreButton"),onClick:ui,children:(0,ie.Y)(Q.A,{name:"more",className:(0,pe.A)(Vn,"T58ozRyW")})})]})]}),!Ae&&(De?(0,ie.Y)("svg",{className:(0,pe.A)(Tn,G&&Ln),viewBox:"0 0 512 512",children:(0,ie.Y)("path",{className:"Gx1BIECZ",d:De})}):function(){const e=(0,pe.A)(Tn,"Ig_t1R7i",G&&Ln);return(0,ie.FD)("div",{className:e,children:[(0,ie.Y)("div",{className:Bn}),(0,ie.Y)("div",{className:Bn}),(0,ie.Y)("div",{className:Bn}),(0,ie.Y)("div",{className:Bn})]})}()),(0,ie.Y)("iframe",{className:(0,pe.A)("OmY14FFl",Ut&&"liDRl1xT",!G&&Ln),style:li,src:Pe,title:Ze("AriaMiniApp",{bot:i?.firstName}),sandbox:On,allow:"camera; microphone; geolocation; clipboard-write;",allowFullScreen:!0,ref:We}),!Ae&&(0,ie.FD)("div",{style:`background-color: ${re};`,className:(0,pe.A)("mR_hsBdT","left"===Rt&&"ntESqwQ_","right"===Rt&&"q6IUFEL0","top"===Rt&&"gb4iHJ9H","bottom"===Rt&&"R_bh3GF8","horizontal"===ii&&"oYaRA7u4",1===ti&&"YfQO314y",2===ti&&"gUldkEoy"),children:[(0,ie.FD)(Z.A,{className:(0,pe.A)("ypxiUCFQ",$t&&!Gt&&xn,Gt&&Rn),fluid:!0,style:`background-color: ${xt}; color: ${Et}`,disabled:!Vt&&!K?.isProgressVisible,nonInteractive:K?.isProgressVisible,onClick:pt,children:[!K?.isProgressVisible&&_t,K?.isProgressVisible&&(0,ie.Y)(Ve.A,{className:En,color:"blue"})]}),(0,ie.FD)(Z.A,{className:(0,pe.A)("U_ggDKn1",zt&&!Kt&&xn,Kt&&Rn),fluid:!0,style:`background-color: ${Dt}; color: ${Tt}`,disabled:!Bt&&!U?.isProgressVisible,nonInteractive:U?.isProgressVisible,onClick:mt,children:[!U?.isProgressVisible&&Lt,U?.isProgressVisible&&(0,ie.Y)(Ve.A,{className:En,color:"white"})]})]}),$&&(0,ie.FD)(ee.A,{isOpen:Boolean($),title:$.title||" ",className:(0,pe.A)("YEOURXza",!$.title?.trim().length&&"gvljUzY9"),hasAbsoluteCloseButton:!0,onClose:gt,children:[$.message,(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:$.buttons.map(e=>(0,ie.Y)(Z.A,{className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,onClick:()=>vt(e.id),children:e.text||Qe(Kn[e.type])},e.id||e.type))})]}),(0,ie.Y)(ci.A,{isOpen:W,onClose:kt,title:Ze("ShareYouPhoneNumberTitle"),textParts:Ze("AreYouSureShareMyContactInfoBot",void 0,{withNodes:!0,withMarkdown:!0,renderTextFilters:["br","emoji"]}),confirmHandler:Nt,confirmLabel:Ze("ContactShare")}),(0,ie.Y)(ci.A,{isOpen:te,onClose:It,title:Qe("lng_bot_allow_write_title"),text:Qe("lng_bot_allow_write"),confirmHandler:Pt,confirmLabel:Qe("lng_bot_allow_write_confirm")}),(0,ie.Y)(ci.A,{isOpen:Boolean(ne),title:Qe("BotDownloadFileTitle"),textParts:Ze("BotDownloadFileDescription",{bot:i?.firstName,filename:ne?.fileName},{withNodes:!0,withMarkdown:!0}),confirmLabel:Qe("BotDownloadFileButton"),onClose:wt,confirmHandler:Yt}),(0,ie.Y)(ci.A,{isOpen:Me,onClose:dt,title:Qe("lng_bot_close_warning_title"),text:Qe("lng_bot_close_warning"),confirmHandler:ht,confirmIsDestructive:!0,confirmLabel:Qe("lng_bot_close_warning_sure")}),(0,ie.Y)(ci.A,{isOpen:Te,onClose:ut,title:Qe("BotRemoveFromMenuTitle"),textParts:(0,Mt.A)(Qe("BotRemoveFromMenu",i?.firstName),["simple_markdown"]),confirmHandler:St,confirmIsDestructive:!0})]})})),Gn="oHX2d8Or",jn="O4NxErFX",zn="dgdyQDsZ",Hn="xGefqS93",$n="f7EicoVH",qn="s6pBIYMI",Wn="txS0KiU0",Qn="XpHR_yo0",Zn="DoeOewUR",Xn="YRMGpqUS",ea="b13oE9uA",ta={width:300,height:40},ia={width:420,height:730},sa={width:300,height:300},na=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=s?e.attachMenu.bots[s]:void 0,a=s?(0,c.mBe)(e,s):void 0,o=(0,c.meB)(e),r=(0,c.SJA)(e),{miniAppsCachedPosition:l,miniAppsCachedSize:d}=(0,un.l)(e);return{attachBot:n,bot:a,chat:o,theme:r,cachedPosition:l,cachedSize:d}})(({modal:e,chat:t,bot:i,attachBot:a,theme:r,cachedSize:l,cachedPosition:c})=>{const{closeActiveWebApp:d,closeWebAppModal:h,prolongWebView:u,toggleAttachBot:m,openChat:p,changeWebAppModalState:v,openWebAppTab:g,updateWebApp:A,openMoreAppsTab:f,closeMoreAppsTab:b,updateMiniAppCachedPosition:C,updateMiniAppCachedSize:y}=(0,n.ko)(),[S,k]=(0,s.Ul)(l||ia);function w(){return"fullScreen"===e?.modalState?N.A.get():"maximized"===e?.modalState?S():ta}const{openedWebApps:I,activeWebAppKey:P,openedOrderedKeys:D,sessionKeys:B,isMoreAppsTabActive:L}=e||{},R=P?I?.[P]:void 0,{isBackButtonVisible:x,headerColor:E,backgroundColor:V,isSettingsButtonVisible:_}=R||{},U=(0,s.Kr)(()=>D?.map(e=>{const t=I[e];return{bot:(0,n.mS)().users.byId[t.botId],webApp:t,isOpen:Boolean(R&&e===(0,hn.rp)(R))}}),[D,I,R]),{isMobile:O}=(0,Y.Ay)(),K=e?.isModalOpen||!1,J="maximized"===e?.modalState,G="minimized"===e?.modalState,j="fullScreen"===e?.modalState,z=!O,H=(0,s.li)(),$=(0,s.li)(),q=(0,s.li)(),W=(0,M.A)(()=>H.current),X=(0,M.A)(()=>H.current),te=(0,M.A)(()=>q.current),{isContextMenuOpen:se,contextMenuAnchor:ne,handleContextMenu:ae,handleContextMenuClose:oe,handleContextMenuHide:re}=(0,vn.A)(H),[le,ce]=(0,s.J0)(!1),ue=$.current,me=H.current;(0,s.vJ)(()=>{ce(Boolean(z&&ue&&me&&!j))},[z,ue,me,j]),(0,s.vJ)(()=>{v({state:"maximized"})},[z]);const{isDragging:ge,isResizing:Ae,style:fe,size:be,position:Ce}=function(e,t,i=!0,n,a=!1,r={width:0,height:0},l){const[c,d]=(0,s.J0)(l),[h,u]=(0,s.J0)(void 0),[m,p]=(0,s.Ul)({x:0,y:0}),[v,g]=(0,s.Ul)({width:0,height:0}),[A,f]=(0,s.Ul)({x:0,y:0}),b=m(),C=A(),y=e.current,S=t.current,[k,N]=(0,F.A)(!1),[w,I]=(0,F.A)(!1),[P,Y,D]=(0,F.A)(!1),[T,B,L]=(0,F.A)(!1),[R,x,E]=(0,F.A)(!1),[V,_]=(0,s.J0)(void 0);function U(){return{width:window.innerWidth,height:window.innerHeight}}const O=(0,M.A)(e=>{a||d({x:e.x,y:e.y})}),K=(0,M.A)(()=>a?Cn:c),J=(0,M.A)(()=>{if(!h)return;const{width:e,height:t}=h,i=U();return{x:(i.width-e)/2,y:(i.height-t)/2}});(0,s.vJ)(()=>{y&&I()},[y]),(0,s.vJ)(()=>{if(!k&&h){const e=J();if(!e)return;O(e),N()}},[h,k,y]);const G=(0,M.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;if(e.target.closest(".no-drag")||!y)return;const{x:t,y:i}=(0,Ue.A)(e),{left:s,top:n}=y.getBoundingClientRect();p({x:s,y:n}),f({x:t,y:i}),Y()}),j=(0,M.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;const t=e.target;if(!y||!t)return;const i=function(e){const t=t=>e.closest(t);if(t(o.cnh))for(const e of fn)if(t(`.${e}`))return An[e]}(t);if(void 0===i)return;_(i);const{x:s,y:n}=(0,Ue.A)(e),{left:a,right:r,top:l,bottom:c}=y.getBoundingClientRect();p({x:a,y:l}),g({width:r-a,height:c-l}),f({x:s,y:n}),B()}),z=(0,M.A)(()=>{D()}),H=(0,M.A)(()=>{L()});(0,s.vJ)(()=>{i||D()},[i]);const $=(e,t)=>{const i=U(),s=i.width,n=i.height,a=h.width,o=h.height;let r=e,l=t;return r<0&&(r=0),l<0&&(l=0),r+a>s&&(r=s-a),l+o>n&&(l=n-o),{x:r,y:l}},q=(0,M.A)(()=>{if(a)return;const e=w||l?c:J();if(!h||!e)return;const t=$(e.x,e.y);O(t)}),W=(0,M.A)(e=>{const t=e,i=U(),s=n.width,a=n.height;return t.width=Math.min(i.width,Math.max(s,t.width)),t.height=Math.min(i.height,Math.max(a,t.height)),t});(0,s.vJ)(()=>{if(T)return;const e=W({width:n.width,height:n.height});e&&u(e)},[n,T]);const Q=(0,M.A)(()=>{if(!h||T)return;const e=W(h);e&&u(e)});(0,s.vJ)(()=>{T||q()},[h,T]),(0,s.vJ)(()=>{const e=()=>{x(),Q(),q(),bn&&(clearTimeout(bn),bn=void 0),bn=window.setTimeout(()=>{bn=void 0,E()},250)};return window.addEventListener("resize",e),()=>{clearTimeout(bn),bn=void 0,window.removeEventListener("resize",e)}},[q]);const Z=(0,M.A)(e=>{if(!P||!y)return;const{x:t,y:i}=(0,Ue.A)(e),s=t-C.x,n=i-C.y,a=b.x+s,o=b.y+n;h&&d($(a,o))}),X=(0,M.A)(e=>{if(!T||!y||void 0===V)return;const{x:t,y:i}=(0,Ue.A)(e),s=v(),n=Math.min(Math.max(0,t),U().width),a=Math.min(Math.max(0,i),U().height),o=n-C.x,l=a-C.y,c=b.x+s.width-r.width,h=b.y+s.height-r.height,m={x:b.x,y:b.y,width:s.width,height:s.height};V!==gn.Left&&V!==gn.TopLeft&&V!==gn.BottomLeft||(m.width=Math.max(s.width-o,r.width),m.x=Math.min(m.x+o,c)),V!==gn.Right&&V!==gn.TopRight&&V!==gn.BottomRight||(m.width=Math.max(s.width+o,r.width)),V!==gn.Top&&V!==gn.TopLeft&&V!==gn.TopRight||(m.height=Math.max(s.height-l,r.height),m.y=Math.min(m.y+l,h)),V!==gn.Bottom&&V!==gn.BottomLeft&&V!==gn.BottomRight||(m.height=Math.max(s.height+l,r.height)),u({width:m.width,height:m.height}),d({x:m.x,y:m.y})});(0,s.vJ)(()=>{let e;return S&&i&&(e=(0,ve.wJ)(S,{onCapture:G,onDrag:Z,onRelease:z,onClick:z,onDoubleClick:z})),e},[i,S]),(0,s.vJ)(()=>{const e=[];if(y&&i)for(const t of fn){const i=y.querySelector(`.resizeHandle.${t}`);if(i){const t=(0,ve.wJ)(i,{onCapture:j,onDrag:X,onRelease:H,onClick:H,onDoubleClick:H});t&&e.push(t)}}return()=>{e.forEach(e=>e())}},[i,y]);const ee=P?"cursor: grabbing !important; ":"",te=K();if(!k||!h||!te)return{isDragging:!1,style:ee};const ie=(0,wi.A)(`left: ${te.x}px;`,`top: ${te.y}px;`,!a&&`max-width: ${h.width}px;`,!a&&`max-height: ${h.height}px;`,"position: fixed;",(P||T||R)&&"transition: none !important;",ee);return{position:c,size:h,isDragging:P,isResizing:T,style:ie}}(H,$,le,w(),j,function(){if("maximized"===e?.modalState)return sa}(),c),ye=Ce?.x,Se=Ce?.y;(0,s.vJ)(()=>{ge||void 0===ye||void 0===Se||C({position:{x:ye,y:Se}})},[ge,ye,Se]),(0,s.vJ)(()=>{!ge&&be&&J&&y({size:be})},[ge,J,be]);const ke=be||w(),Ne=ke.width,we=ke.height;(0,s.vJ)(()=>{Ae&&k({width:Ne,height:we})},[we,Ne,Ae,k]);const Ie=(0,T.A)(),Pe=(0,Ri.A)(),{queryId:Ye}=R||{},Fe=I?Object.values(I).length:0;(0,pn.A)(()=>{I&&Object.keys(I).forEach(e=>{const i=I[e];i.queryId&&u({botId:i.botId,queryId:i.queryId,peerId:i.peerId||t.id,replyInfo:i.replyInfo})})},Ye?45e3:void 0,!0);const De=(0,s.li)(null),Me=(0,s.li)(null),Te=(0,M.A)(e=>{De.current=e}),Be=(0,M.A)(e=>{De.current&&De.current(e)}),Le=(0,M.A)(e=>{Me.current=e}),Re=(0,M.A)(e=>{Me.current&&Me.current(e)}),xe=(0,M.A)(()=>{Be({eventType:"settings_button_pressed"})}),Ee=(0,M.A)(()=>{Re(R.url)}),Ve=(0,M.A)(()=>{h()}),_e=(0,M.A)(()=>{b()}),Oe=(0,M.A)(()=>{Fe>1?d():h()}),Ke=(0,M.A)(()=>{if(a){const e=(0,hn.rp)(R);return void A({key:e,update:{isRemoveModalOpen:!0}})}m({botId:i.id,isEnabled:!0})}),Je=(0,M.A)(()=>{x?Be({eventType:"back_button_pressed"}):Ve()}),Ge=(0,M.A)(()=>{v({state:"minimized"})}),je=(0,M.A)(()=>{v({state:"fullScreen"})}),ze=(0,M.A)(()=>{f()}),He=(0,M.A)(e=>{g({webApp:e.webApp})}),$e=(0,M.A)(()=>{p({id:i.id})}),qe=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{className:(0,pe.A)(z?"gkji2_RB":"kKPD09tc",t&&"active"),round:!0,ripple:!O,size:z?"tiny":"smaller",color:"translucent",onClick:e,ariaLabel:"More actions",children:(0,ie.Y)(Q.A,{name:"more"})}),[O,z]);function Qe(){return(0,ie.FD)(ie.FK,{children:[t&&i&&t.id!==i.id&&(0,ie.Y)(he.A,{icon:"bots",onClick:$e,children:Ie("BotWebViewOpenBot")}),(0,ie.Y)(he.A,{icon:"reload",onClick:Ee,children:Ie("WebApp.ReloadPage")}),_&&(0,ie.Y)(he.A,{icon:"settings",onClick:xe,children:Ie("Settings")}),i?.isAttachBot&&(0,ie.Y)(he.A,{icon:a?"stop":"install",onClick:Ke,destructive:Boolean(a),children:Ie(a?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")})]})}function Ze(){return(0,ie.Y)(We.A,{isOpen:se,anchor:ne,ref:q,className:(0,pe.A)(z?Wn:"web-app-more-menu","with-menu-transitions"),getTriggerElement:W,getMenuElement:te,getRootElement:X,autoClose:!0,onClose:oe,onCloseAnimationEnd:re,children:Qe()})}const Xe=(0,pe.A)("RuJ3d9N6",x&&"IWA50OWU"),et=(0,s.Kr)(()=>{if(L)return"color-text";if(!E)return;const{r:e,g:t,b:i}=(0,mn.hF)(E),s=(0,mn.LS)([e,t,i]);return("dark"===r?255-s:s)>128?"color-text":"color-background"},[E,r,L]);function tt(e){return(0,ie.Y)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,ie.Y)("path",{className:"bOuMHiVw","fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 16V0C16 12 12 16 0 16H16Z"})})}const it=(0,s.li)();function st(e){return(0,pe.A)(o.jQ1,e)}return(0,yn.A)(it,!K||G||!it.current),(0,ie.FD)(ee.A,{dialogRef:H,className:(0,pe.A)("XWfkIDLY",z&&"gBVR7Hec",G&&"dJ1Ld_PX",j&&"ciSTWz16"),dialogStyle:z?fe:void 0,dialogContent:le&&!G?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:st("top")}),(0,ie.Y)("div",{className:st("bottom")}),(0,ie.Y)("div",{className:st("left")}),(0,ie.Y)("div",{className:st("right")}),(0,ie.Y)("div",{className:st("topLeft")}),(0,ie.Y)("div",{className:st("topRight")}),(0,ie.Y)("div",{className:st("bottomLeft")}),(0,ie.Y)("div",{className:st("bottomRight")})]}):void 0,isOpen:K,isLowStackPriority:!0,onClose:Ve,header:(0,ie.Y)("div",{ref:$,children:z?J?(0,ie.FD)("div",{className:(0,pe.A)("modal-header","multiTab"),style:(0,wi.A)(et&&`--color-header-text: var(--${et})`),children:[(0,ie.Y)(Z.A,{className:"GE5AkJOU",round:!0,color:"translucent",size:"tiny",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,ie.Y)("div",{className:Xe})}),(0,ie.FD)("div",{className:"X18WbDa5",ref:it,children:[U?.map(e=>e.isOpen?function(){const e=(0,wi.A)(et&&`--color-header-text: var(--${et})`,E&&`--active-tab-background: ${E}`);return(0,ie.FD)("div",{className:Gn,style:e,children:[tt($n),(0,ie.FD)("div",{className:jn,children:[(0,ie.FD)("div",{className:"z39ojrWc",children:[(0,ie.Y)(Tt.A,{size:"mini",peer:i}),(0,ie.Y)(qe,{onTrigger:ae,isOpen:se})]}),a?.shortName??i?.firstName,(0,ie.Y)("div",{className:zn}),(0,ie.Y)(Z.A,{className:Hn,round:!0,color:"translucent",size:"tiny",ariaLabel:Ie("Close"),onClick:Oe,children:(0,ie.Y)(Q.A,{className:Zn,name:"close"})})]}),tt(qn)]})}():(0,ie.Y)(Tt.A,{className:"tI6TE6HP",size:"mini",peer:e.bot,onClick:()=>He(e)})),L&&(0,ie.FD)("div",{className:Gn,children:[tt($n),(0,ie.FD)("div",{className:jn,children:[(0,ie.Y)("div",{className:"Obu3ui67",children:(0,ie.Y)(Q.A,{className:ea,name:"add"})}),Pe("OpenApp"),(0,ie.Y)("div",{className:zn}),(0,ie.Y)(Z.A,{className:Hn,round:!0,color:"translucent",size:"tiny",ariaLabel:Ie("Close"),onClick:_e,children:(0,ie.Y)(Q.A,{className:Zn,name:"close"})})]}),tt(qn)]})]}),Ze(),(0,ie.FD)("div",{className:"qK4q0Sat",children:[!L&&(0,ie.Y)(Z.A,{className:(0,pe.A)("cEuW1_hJ","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:ze,children:(0,ie.Y)(Q.A,{className:ea,name:"add"})}),!L&&(0,ie.Y)(Z.A,{className:(0,pe.A)(Qn,"otlJULGy","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:je,children:(0,ie.Y)(Q.A,{className:Xn,name:"expand-modal"})}),(0,ie.Y)(Z.A,{className:(0,pe.A)(Qn,"no-drag"),round:!0,color:"translucent",size:"tiny",onClick:Ge,children:(0,ie.Y)(Q.A,{className:Xn,name:"collapse-modal"})})]})]}):(0,ie.Y)(Sn,{}):(0,ie.FD)("div",{className:"modal-header",style:(0,wi.A)(E&&`background-color: ${E}`,et&&`--color-header-text: var(--${et})`),children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,ie.Y)("div",{className:Xe})}),(0,ie.Y)("div",{className:"modal-title",children:a?.shortName??i?.firstName}),!L&&(0,ie.Y)(de.A,{className:(0,pe.A)(z?Wn:"web-app-more-menu","with-menu-transitions"),trigger:qe,positionX:z?"left":"right",children:Qe()})]})}),style:`background-color: ${V||"var(--color-background)"}`,noBackdrop:!0,noBackdropClose:!0,children:[j&&Ze(),I&&B?.map(t=>(0,ie.Y)(Jn,{modal:e,registerSendEventCallback:Te,registerReloadFrameCallback:Le,webApp:I[t],isTransforming:ge||Ae,onContextMenuButtonClick:ae,isMultiTabSupported:z,modalHeight:we},t)),L&&(0,ie.Y)(Dn,{})]})})),aa=(0,s.ph)(({bot:e,type:t,shouldRequestWriteAccess:i})=>{const{cancelBotTrustRequest:a,markBotTrusted:o}=(0,n.ko)(),[r,c]=(0,s.J0)(i||!1),d=(0,T.A)(),h=(0,s.hb)(()=>{o({botId:e.id,isWriteAllowed:r})},[o,r,e]),u=(0,s.hb)(()=>{a()},[]),m=d("game"===t?"AppName":"BotOpenPageTitle"),p=(0,s.Kr)(()=>{switch(t){case"game":return d("BotPermissionGameAlert",(0,l.Yg)(e));case"webApp":return d("BotOpenPageMessage",(0,l.Yg)(e));default:return d("BotWebViewStartPermission")}},[e,t,d]);return(0,ie.FD)(ci.A,{isOpen:Boolean(e),onClose:u,title:m,confirmHandler:h,children:[(0,Mt.A)(p,["simple_markdown"]),i&&(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:r,label:(0,Mt.A)(d("WebApp.AddToAttachmentAllowMessages",e?.firstName),["simple_markdown"]),onCheck:c})]})}),oa=(0,s.ph)(({modal:e})=>{const{confirmAttachBotInstall:t,cancelAttachBotInstall:i}=(0,n.ko)(),a=e?.bot,[r,l]=(0,s.J0)(!1),c=(0,T.A)(),d=(0,s.hb)(()=>{t({isWriteAllowed:Boolean(a?.shouldRequestWriteAccess)})},[t,a]);(0,s.vJ)(()=>{a&&l(!1)},[a]);const h=(0,s.Kr)(()=>{const e=c("lng_mini_apps_disclaimer_button").split("{link}"),t=c("lng_mini_apps_disclaimer_link");return[e[0],(0,ie.Y)("a",{href:o.Pje,target:"_blank",rel:"noopener noreferrer",children:t}),e[1]]},[c]);return(0,ie.FD)(ci.A,{isOpen:Boolean(a),onClose:i,title:c("lng_mini_apps_disclaimer_title"),confirmHandler:d,isConfirmDisabled:!r,children:[(0,Mt.A)(c("lng_mini_apps_disclaimer_text",a?.shortName),["simple_markdown"]),(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:r,label:h,onCheck:l}),(0,Mt.A)(c("WebBot.Account.Desclaimer.Desc",a?.shortName),["simple_markdown"])]})}),ra=(0,s.ph)(({folder:e})=>{const{closeDeleteChatFolderModal:t,deleteChatFolder:i,openDeleteChatFolderModal:a}=(0,n.ko)(),o=(0,T.A)(),r=Boolean(e),l=(0,U.A)(e)||e,c=l?.hasMyInvites,d=(0,s.hb)(()=>{t(),c?a({folderId:l.id,isConfirmedForChatlist:!0}):i({id:l.id})},[c,l]);return(0,ie.Y)(ci.A,{isOpen:r,onClose:t,text:o(c?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:o("Delete"),confirmHandler:d,confirmIsDestructive:!0})});var la=i(64520),ca=i(17142),da=i(66833),ha=i(87412),ua=i(38777);const ma={root:"Wn7D2H1e",text:"IQ1U2TrZ",header:"F6qqXRvD",description:"ILLaH6qQ",icon:"DzGwbpu5","font-icon":"Pa9h5mh3",fontIcon:"Pa9h5mh3"},pa=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(mn.hF),va=(0,s.ph)(({icon:e,isFontIcon:t,title:i,text:s,index:n,count:a,section:o,onClick:r})=>{const l=n/a*pa.length,c=pa[Math.floor(l)],d=pa[Math.ceil(l)]??c,{r:h,g:u,b:m}=(0,mn.R5)(c,d,.5),p=(0,M.A)(()=>{r?.(o)});return(0,ie.FD)(ui.A,{buttonClassName:ma.root,onClick:p,inactive:!r,children:[t?(0,ie.Y)(Q.A,{name:e,className:ma.fontIcon,style:`--item-color: rgb(${h},${u},${m})`}):(0,ie.Y)("img",{src:e,className:ma.icon,alt:"",style:`--item-color: rgb(${h},${u},${m})`,draggable:!1}),(0,ie.FD)("div",{className:ma.text,children:[(0,ie.Y)("div",{className:ma.title,children:(0,Mt.A)(i,["br"])}),(0,ie.Y)("div",{className:ma.description,children:s})]})]})});var ga=i(57446);const Aa="cqNhvdib",fa="wDzTWXzO",ba=(0,s.ph)(({length:e,active:t,onSelectSlide:i})=>{const n=Math.max(0,Math.min(e-8,t-4)),a=n===e-8-1,o=n===e-8,r=0===n,l=1===n,c=Math.min(e,8),d=(0,s.hb)(()=>{i(t+1)},[t,i]),h=(0,s.hb)(()=>{i(t-1)},[t,i]),m=Math.min(8,e);return(0,ie.FD)("div",{children:[!u.TF&&(0,ie.Y)(Z.A,{className:(0,pe.A)(Aa,0===t&&fa),color:"translucent",disabled:0===t,round:!0,onClick:h,children:(0,ie.Y)(Q.A,{name:"previous"})}),(0,ie.Y)("div",{className:"HmY1pYD9",style:`--start-from: ${n}; --length: ${e}; --count: ${m};`,children:Array(e).fill(void 0).map((e,s)=>{const d=s,h=s===n+c-1&&!o&&!a,u=s===n+c-2&&!a&&!o||s===n+c-1&&a,m=s===n&&!r&&!l,p=s===n+1&&!r&&!l||s===n&&l,v=s<n||s>=n+c;return(0,ie.Y)("div",{onClick:()=>i(s),className:(0,pe.A)("Ac0pMX9w",d===t&&"NYDxCNdz",(u||p)&&"yDo_8Y7X",(h||m||v)&&"bhODNwmU",v&&"O9pyrgj0")})})}),!u.TF&&(0,ie.Y)(Z.A,{className:(0,pe.A)(Aa,t===e-1&&fa,"hIgQCprt"),color:"translucent",round:!0,disabled:t===e-1,onClick:d,children:(0,ie.Y)(Q.A,{name:"next"})})]})}),Ca="Hy5kWx0p",ya=(0,s.ph)(({leftValue:e,rightValue:t,className:i,floatingBadgeIcon:s,rightStyle:n})=>{const a=(0,T.A)();return(0,ie.FD)("div",{className:(0,pe.A)("u84X0r2z",i),children:[s&&(0,ie.FD)("div",{className:"hPi4fICJ",children:[(0,ie.Y)(Q.A,{name:s,className:"XkiOXdMP"}),(0,ie.Y)("div",{className:"iC3LJrvy",dir:a.isRtl?"rtl":void 0,children:e}),(0,ie.Y)("div",{className:"jufjjcX9",children:(0,ie.Y)("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none",children:(0,ie.Y)("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"})})})]}),(0,ie.FD)("div",{className:(0,pe.A)(Ca,"scGr4JS9"),children:[(0,ie.Y)("div",{className:"OejVAPj6 YaiSoFKE YaiSoFKE",dir:a.isRtl?"rtl":void 0,children:a("LimitFree")}),!s&&(0,ie.Y)("div",{className:"RJosx238 YaiSoFKE",children:e})]}),(0,ie.FD)("div",{className:(0,pe.A)(Ca,"nPaUalQf"),style:n,children:[(0,ie.Y)("div",{className:"COQdFBQk YaiSoFKE YaiSoFKE",dir:a.isRtl?"rtl":void 0,children:a("LimitPremium")}),(0,ie.Y)("div",{className:"BEq3jFlz YaiSoFKE YaiSoFKE",children:t})]})]})}),Sa=[91,160,255],ka=[197,100,243],Na=(0,s.ph)(({title:e,description:t,leftValue:i,rightValue:n,colorStepProgress:a})=>{const o=(0,s.Kr)(()=>Sa.map((e,t)=>(0,ge.Cc)(e,ka[t],a)),[a]);return(0,ie.FD)("div",{className:"ZXp65Wgy",children:[(0,ie.Y)("div",{className:"W1xG3pjS",children:e}),(0,ie.Y)("div",{className:"b_CBXIkT",children:t}),(0,ie.Y)(ya,{leftValue:i,rightValue:n,rightStyle:`background: rgb(${o.join(",")})`})]})});var wa=i(67054),Ia=i(18104);const Pa=({size:e,realIndex:t,canPlay:i,sticker:n,index:a,maxLength:o,onClick:r,onEnded:l})=>{const c=(0,H.A)(`sticker${n.id}`),d=(0,H.A)(`sticker${n.id}?size=f`),h=0===a,[u,m,p]=(0,F.A)(h),v=e-.6*e,g=3*v,A=3.2*v,f=a/o*(2*Math.PI),b=h?1:.66,C=Math.cos(f)*g-2.8*v,y=Math.sin(f)*A,S=(0,M.A)(()=>{r(t)}),k=(0,M.A)(()=>{p(),l(t)});return(0,s.vJ)(()=>{h&&m()},[h,m]),(0,ie.FD)(ie.FK,{children:[h&&(0,ie.Y)(Ia.A,{className:"Stdz4UIW ogaoEAcn",tgsUrl:d,play:i,isLowPriority:!0,noLoop:!0,size:.8*e,style:`--x: calc(${C}px - 10%); --y: ${y}px;`}),(0,ie.Y)(Ia.A,{className:"ogaoEAcn",tgsUrl:c,play:i&&u,noLoop:!0,size:.6*e,style:`--x: ${C}px; --y: ${y}px; --opacity: ${b}`,onClick:S,onEnded:k})]})},Ya=(0,s.ph)((0,n.EK)(e=>({stickers:e.stickers.premium.stickers}))(({stickers:e,isActive:t})=>{const i=(0,s.li)(),[n,a]=(0,s.J0)(0),[o,r]=(0,s.J0)(0),l=e?.slice(0,15),c=(0,M.A)(e=>{a(-e)}),d=(0,M.A)(e=>{0===(0,wa.A)(l.length,e+n)&&setTimeout(()=>{a(e=>(0,wa.A)(l.length,e+1))},150)});return(0,s.vJ)(()=>{const e=i.current;e&&r(e.closest(".modal-dialog").clientWidth)},[]),(0,ie.Y)("div",{className:"O1fqNCy0",ref:i,children:Boolean(o)&&l?.map((e,i)=>(0,ie.Y)(Pa,{size:o,sticker:e,realIndex:i,index:(i+n+l.length)%l.length,maxLength:l.length,onClick:c,onEnded:d,canPlay:t}))})}));var Fa=i(38691),Da=i(88554);const Ma=["#A667FF","#55A5FF"],Ta={stories_order:"PremiumStoriesPriority",stories_stealth:"PremiumStoriesStealth",stories_views:"PremiumStoriesViews",stories_timer:"lng_premium_stories_subtitle_expiration",stories_save:"PremiumStoriesSaveToGallery",stories_caption:"lng_premium_stories_subtitle_caption",stories_link:"lng_premium_stories_subtitle_links"},Ba={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},La={stories_order:"story-priority",stories_stealth:"eye-crossed-outline",stories_views:"eye-outline",stories_timer:"timer",stories_save:"arrow-down-circle",stories_caption:"story-caption",stories_link:"link-badge"},Ra=Object.keys(Ta),xa=.25*g.$,Ea=Tt.R.giant+xa,Va=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({currentUser:e})=>{const t=(0,s.li)(),i=(0,T.A)(),n=(0,Fa.A)();(0,s.Nf)(()=>{t.current&&(0,Da.$)({canvas:t.current,size:Ea,strokeWidth:xa,segmentsCount:8,colorStops:Ma,readSegmentsCount:0,readSegmentColor:"transparent",dpr:n})},[n]);const{handleScroll:a,isAtBeginning:o}=(0,ps.A)(),r=Ea;return(0,ie.FD)("div",{className:"mFElmm7a",children:[(0,ie.FD)("div",{className:"Jjbochk6",children:[(0,ie.Y)(Tt.A,{forPremiumPromo:!0,peer:e,size:"giant"}),(0,ie.Y)("canvas",{className:"ChteQ9C3",ref:t,style:`max-width: ${r}px; max-height: ${r}px`})]}),(0,ie.Y)("div",{className:"d2ayix6L",children:i("UpgradedStories")}),(0,ie.FD)("div",{className:(0,pe.A)("ensyCeMe",!o&&"iN1T0a2Y","custom-scroll"),onScroll:a,children:[Ra.map((e,t)=>(0,ie.Y)(va,{title:i(Ta[e]),text:i(Ba[e]),icon:La[e],isFontIcon:!0,index:t,count:Ra.length,section:e},e)),(0,ie.Y)("div",{className:"DFbZJafh",children:i("lng_premium_stories_about_mobile")})]})]})})),_a={root:"Ot0dA1yZ",wrapper:"yxSAGAc1",down:"Jcy6cDoc",frame:"Vn81yTTJ",video:"rrVJClLL"},Ua=i.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg",Oa=(0,s.ph)(({videoId:e,isReverseAnimation:t,isDown:i,videoThumbnail:s,index:n,isActive:a})=>{const o=(0,H.A)(`document${e}`),r=(0,Li.A)(s.dataUri),l=(0,Ei.A)(o);return(0,ie.Y)("div",{className:_a.root,children:(0,ie.FD)("div",{className:(0,pe.A)(_a.wrapper,t&&_a.reverse,i&&_a.down),id:`premium_feature_preview_video_${n}`,children:[(0,ie.Y)("img",{src:Ua,alt:"",className:_a.frame,draggable:!1}),(0,ie.Y)("canvas",{ref:r,className:_a.video}),(0,ie.Y)(Ki.A,{canPlay:a,className:(0,pe.A)(_a.video,l),src:o,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})]})})}),Ka="a7IoUtQG",Ja="gubS9KP1",Ga="iZLwcL8v",ja="A7YHY8qF",za={double_limits:"PremiumPreviewLimits",infinite_reactions:"PremiumPreviewReactions2",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",emoji_status:"PremiumPreviewEmojiStatus",translations:"PremiumPreviewTranslations",stories:"PremiumPreviewStories",saved_tags:"PremiumPreviewTags2",last_seen:"PremiumPreviewLastSeen",message_privacy:"PremiumPreviewMessagePrivacy",effects:"Premium.MessageEffects",todo:"PremiumPreviewTodo"},Ha={double_limits:"PremiumPreviewLimitsDescription",infinite_reactions:"PremiumPreviewReactions2Description",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",emoji_status:"PremiumPreviewEmojiStatusDescription",translations:"PremiumPreviewTranslationsDescription",stories:"PremiumPreviewStoriesDescription",saved_tags:"PremiumPreviewTagsDescription2",last_seen:"PremiumPreviewLastSeenDescription",message_privacy:"PremiumPreviewMessagePrivacyDescription",effects:"Premium.MessageEffectsInfo",todo:"PremiumPreviewTodoDescription"},$a={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle",recommendedChannels:"SimilarChannelsLimitTitle",moreAccounts:"ConnectedAccountsLimitTitle"},qa={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle",recommendedChannels:"SimilarChannelsLimitSubtitle",moreAccounts:"ConnectedAccountsLimitSubtitle"},Wa=(0,s.ph)(({promo:e,initialSection:t,isPremium:i,limits:n,premiumPromoOrder:a,subscriptionOption:l,onBack:c,onClickSubscribe:d})=>{const h=(0,T.A)(),u=(0,Ri.A)(),m=(0,s.li)(),[p,v]=(0,s.J0)(o.O2i.indexOf(t)),[g,A]=(0,s.J0)(0),[f,b,C]=(0,F.A)(),[y,S]=(0,s.J0)(!0),[k,N]=(0,s.J0)(!1),w=(0,U.A)(t),I=(0,s.Kr)(()=>a?a.filter(e=>o.O2i.includes(e)):o.O2i,[a]),P=(0,s.Kr)(()=>{if(!l)return;const{amount:e,months:t,currency:s}=l,n=Math.floor(e/t);return i?u("OK"):u("SubscribeToPremium",{price:(0,ca.vv)(u,n,s)},{withNodes:!0})},[i,u,l]),Y=(0,M.A)(()=>{d(t)});function D(e){const{scrollTop:t,clientHeight:i,scrollHeight:s}=e.currentTarget;S(t<=20),N(t>=s-i-20)}(0,s.vJ)(()=>{const e=m.current;if(!e||w===t)return;const i=I.indexOf(t);v(i),b(),(0,ga.A)(e,e.clientWidth*i,0).then(C)},[p,I,t,w]);const B=(0,M.A)(async e=>{const t=m.current;t&&(v(e),b(),await(0,ga.A)(t,t.clientWidth*e,800),C())}),L=I[p],R="double_limits"!==L&&"stories"!==L;return(0,ie.FD)("div",{className:"oyUTEj8I",children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",className:(0,pe.A)("njYoMrKM",R&&"SB4pczOo"),color:R?"translucent-white":"translucent",onClick:c,ariaLabel:h("Back"),children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),(0,ie.Y)("div",{className:"dIVBSdWi"}),(0,ie.Y)("div",{className:(0,pe.A)("sJubG84j","no-scrollbar"),onScroll:function(e){const t=e.currentTarget,{clientWidth:i,scrollLeft:s}=t,n=Math.round(s),a=n%i/i,o=Math.ceil((n+1)/i);A(o);const l=t.querySelector("#premium_feature_preview_video_"+(o-1)),c=t.querySelector(`#premium_feature_preview_video_${o}`);if((0,r.RK)(()=>{t.style.setProperty("--scroll-progress",a.toString()),t.style.setProperty("--abs-scroll-progress",Math.abs(a).toString()),l&&(0,ji.dH)(l,"reverse",!1),c&&(0,ji.dH)(c,"reverse",!0)}),f)return;const d=Math.round(n/i);v(d)},ref:m,children:I.map((t,i)=>{if("double_limits"===t)return(0,ie.FD)("div",{className:(0,pe.A)(Ja,"U7ePgVBR"),children:[(0,ie.Y)("h2",{className:(0,pe.A)("mz2Hmd83",y&&"AgmNOqi7"),children:h(za.double_limits)}),(0,ie.Y)("div",{className:(0,pe.A)("n_rowVPI","custom-scroll"),onScroll:D,children:o.M$8.map((e,t)=>{const i=n?.[e][0].toString(),s=n?.[e][1].toString();return(0,ie.Y)(Na,{title:h($a[e]),description:h(qa[e],s),leftValue:i,rightValue:s,colorStepProgress:t/(o.M$8.length-1)})})})]});if("premium_stickers"===t)return(0,ie.FD)("div",{className:Ja,children:[(0,ie.Y)("div",{className:Ka,children:(0,ie.Y)(Ya,{isActive:p===i})}),(0,ie.Y)("h1",{className:Ga,children:h(za.premium_stickers)}),(0,ie.Y)("div",{className:ja,children:(0,Mt.A)(h(Ha.premium_stickers),["br"])})]});if("stories"===t)return(0,ie.Y)("div",{className:(0,pe.A)(Ja,"J1M6fEdo"),children:(0,ie.Y)(Va,{})});const s=e.videoSections.indexOf(t);if(-1===s)return;const a="todo"===e.videoSections[s];return(0,ie.FD)("div",{className:Ja,children:[(0,ie.Y)("div",{className:Ka,children:(0,ie.Y)(Oa,{isActive:p===i,videoId:e.videos[s].id,videoThumbnail:e.videos[s].thumbnail,isDown:o.jhT.includes(t),index:i,isReverseAnimation:i===g})}),(0,ie.Y)("h1",{className:Ga,children:a?u(za[e.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(za[e.videoSections[s]])}),(0,ie.Y)("div",{className:ja,children:(0,Mt.A)(a?u(Ha[e.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(Ha[e.videoSections[s]]),["br"])})]})})}),(0,ie.FD)("div",{className:(0,pe.A)("yN2611rA",(k||0!==p)&&"rCHMABcD"),children:[(0,ie.Y)(ba,{length:o.O2i.length,active:p,onSelectSlide:B}),Boolean(P)&&(0,ie.Y)(Z.A,{className:(0,pe.A)("EPfM7AgT"),isShiny:!i,withPremiumGradient:!i,onClick:i?c:Y,children:P})]})]})}),Qa=(0,s.ph)(({option:e,checked:t,fullMonthlyAmount:i,onChange:n,className:a,isGiveaway:o})=>{const r=(0,T.A)(),l=(0,Ri.A)(),{months:c,amount:d,currency:h}=e,u="users"in e?e.users:void 0,m=Math.floor(d/c),p=u?u>1:void 0,v=(0,s.Kr)(()=>i&&i>m?Math.ceil(100-m/(i/100)):void 0,[i,m]),g=(0,s.hb)(e=>{e.target.checked&&n(c)},[c,n]);return(0,ie.FD)("label",{className:(0,pe.A)(o?"PkseWxFK":"qZA6S2kc",t&&!o&&"EJOQwnRj",a),dir:l.isRtl?"rtl":void 0,children:[(0,ie.Y)("input",{className:"WOEkhx6R",type:"radio",name:"subscription_option",value:c,checked:t,onChange:g}),(0,ie.FD)("div",{className:"BHUCScsU",children:[(0,ie.FD)("div",{className:"DfYCMUkL",children:[Boolean(v)&&(0,ie.FD)("span",{className:(0,pe.A)("ublijP0j","uqDlP3Zt"),title:r("GiftDiscount"),children:[" ","",v,"%"]}),r("Months",c)]}),(0,ie.Y)("div",{className:"poxOXJ2o",children:o||p?`${(0,ca.Ad)(d,h,r.code)} x ${u}`:r("PricePerMonth",(0,ca.Ad)(m,h,r.code))}),(0,ie.Y)("div",{className:"IGMrERf_",children:(0,ca.Ad)(d,h,r.code)})]})]})}),Za="yKm9hKQP",Xa=i.p+"PremiumAds.a758f19ece91fe91318e.svg",eo=i.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",to=i.p+"PremiumChats.89d9d315638e283ca895.svg",io=i.p+"PremiumEffects.4eab9caad8e9c276842d.svg",so=i.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",no=i.p+"PremiumFile.884dd3865acfe594fc61.svg",ao=i.p+"PremiumLastSeen.9575a548770d23785846.svg",oo=i.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",ro=i.p+"PremiumMessagePrivacy.950cab3e87c60c5733a6.svg",lo=i.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",co=i.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",ho=i.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",uo=i.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",mo=i.p+"PremiumTags.3b187054cc90f8e16cb7.svg",po=i.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",vo=i.p+"PremiumVideo.288cb61931e33d913f0a.svg",go=i.p+"PremiumVoice.b3a2893dbe481108ab94.svg",Ao=8*g.$,fo={stories:ho,double_limits:oo,infinite_reactions:lo,premium_stickers:uo,animated_emoji:so,no_ads:Xa,voice_to_text:go,profile_badge:eo,faster_download:co,more_upload:no,advanced_chat_management:to,animated_userpics:vo,emoji_status:ho,translations:po,saved_tags:mo,last_seen:ao,message_privacy:ro,effects:io,todo:eo},bo=(0,s.ph)((0,n.EK)(e=>{const{premiumModal:t}=(0,c.nTw)(e),i=t?.fromUserId?(0,c.mBe)(e,t.fromUserId):void 0,s=i?.emojiStatus?(0,c.O8F)(e,i.emojiStatus.documentId):void 0,n=s?(0,c.ycM)(e,s.stickerSetInfo):void 0;return{currentUserId:e.currentUserId,promo:t?.promo,isSuccess:t?.isSuccess,isGift:t?.isGift,monthsAmount:t?.monthsAmount,gift:t?.gift,fromUser:i,fromUserStatusEmoji:s,fromUserStatusSet:n,toUser:t?.toUserId?(0,c.mBe)(e,t.toUserId):void 0,initialSection:t?.initialSection,isPremium:(0,c.g29)(e),limitChannels:(0,la.B)(e,"channels"),limitFolders:(0,la.B)(e,"dialogFilters"),limitPins:(0,la.B)(e,"dialogFolderPinned"),limitLinks:(0,la.B)(e,"channelsPublic"),limits:e.appConfig.limits,premiumSlug:e.appConfig.premiumInvoiceSlug,premiumBotUsername:e.appConfig.premiumBotUsername,premiumPromoOrder:e.appConfig.premiumPromoOrder}})(({isOpen:e,currentUserId:t,fromUser:i,fromUserStatusEmoji:a,fromUserStatusSet:r,promo:c,initialSection:d,isPremium:h,limitChannels:u,limitLinks:m,limitFolders:p,limitPins:v,limits:g,premiumSlug:A,premiumBotUsername:f,isSuccess:b,isGift:C,toUser:y,monthsAmount:S,premiumPromoOrder:k,gift:N})=>{const w=(0,s.li)(),{closePremiumModal:I,openInvoice:P,requestConfetti:Y,openTelegramLink:F,loadStickers:D,openStickerSet:B}=(0,n.ko)(),L=(0,T.A)(),R=(0,Ri.A)(),[x,E]=(0,s.J0)(!0),[V,_]=(0,s.J0)(d),[U,O]=(0,s.J0)();(0,s.vJ)(()=>{e?d&&_(d):(E(!0),_(void 0))},[e,d]);const K=(0,M.A)(e=>{_(e)}),J=(0,M.A)(()=>{_(void 0)}),G=(0,M.A)(e=>{w.current&&(A?P({type:"slug",slug:A}):f&&(F({url:`${o.jsp}${f}?start=${e||"promo"}`}),I()))}),j=(0,M.A)(()=>{U?G(String(U.months)):G()}),H=(0,M.A)(e=>{const t=c?.options.find(t=>t.months===e);O(t)}),$=(0,M.A)(()=>{const t=w.current;if(t&&e){const{top:e,left:i,width:s,height:n}=t.querySelector(".modal-content").getBoundingClientRect();Y({top:e,left:i,width:s,height:n,withStars:!0})}});(0,s.vJ)(()=>{b&&$()},[b,$]),(0,z.A)(([e])=>{e!==h&&$()},[h,$]);const q=(0,s.Kr)(()=>k?k.filter(e=>o.O2i.includes(e)):o.O2i,[k]);(0,s.vJ)(()=>{a&&!r&&D({stickerSetInfo:a.stickerSetInfo})},[D,a,r]),(0,s.vJ)(()=>{const[e]=c?.options??[];O(e)},[c]);const W=(0,M.A)(()=>{r&&B({stickerSetInfo:r})}),X=(0,s.Kr)(()=>{const e=c?.options.find(e=>1===e.months);if(e)return Number(e.amount)},[c]),te=(0,s.Kr)(()=>{if(!U)return;const{amount:e,months:t,currency:i}=U,s=Math.floor(e/t);return(0,ca.vv)(R,s,i)},[U,R]);if(c&&(!a||r))return(0,ie.Y)(ee.A,{className:"sfbpMFHM",onClose:I,isOpen:e,dialogRef:w,children:(0,ie.Y)(ae.Ay,{name:"slide",activeKey:V?1:0,className:"ELNkgPve",children:V?(0,ie.Y)(Wa,{initialSection:V,onBack:J,promo:c,onClickSubscribe:G,isPremium:h,limits:g,premiumPromoOrder:k,subscriptionOption:U}):(0,ie.FD)("div",{className:(0,pe.A)("ZpOIPrhp","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;E(t<=150)},children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",className:"XyN3eWog",color:"translucent",onClick:()=>I(),ariaLabel:L("Close"),children:(0,ie.Y)(Q.A,{name:"close"})}),function(){if(N){const e=(0,da.yQ)(N);return(0,ie.Y)(ua.A,{model:"sticker",sticker:e,color:"purple",title:se(),description:(0,Mt.A)(ne(),["simple_markdown","emoji"]),className:"lzalivui"})}return a?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(ha.A,{className:"mQwvY9LA",onClick:W,documentId:a.id,isBig:!0,size:Ao}),(0,ie.Y)("h2",{className:(0,pe.A)("y71v6ECL",r&&"xw_GbDj7"),children:se()}),(0,ie.Y)("div",{className:"cUcKXV3j",children:(0,Mt.A)(ne(),["simple_markdown","emoji"])})]}):(0,ie.Y)(ua.A,{model:"swaying-star",color:"purple",title:se(),description:(0,Mt.A)(ne(),["simple_markdown","emoji"]),className:"z0zfJObh"})}(),!h&&!C&&(0,ie.Y)("div",{className:"xZC_Oajr",children:c?.options.map(e=>(0,ie.Y)(Qa,{className:"gygsbDbE",option:e,onChange:H,fullMonthlyAmount:X,checked:U?.months===e.months},e.amount))}),(0,ie.Y)("div",{className:(0,pe.A)("Bc_F0RKb",x&&"ltXo0Xi7"),children:(0,ie.Y)("h2",{className:"xysPdANX",children:L("TelegramPremium")})}),(0,ie.FD)("div",{className:(0,pe.A)("c3Ee2oSo",h&&"yWEHoJOL"),children:[q.map((e,t)=>{const i="todo"===e;return(0,ie.Y)(va,{title:i?R(za[e]):L(za[e]),text:"double_limits"===e?L(Ha[e],[u,p,v,m,4]):i?R(Ha[e]):L(Ha[e]),icon:fo[e],index:t,count:q.length,section:e,onClick:K},e)}),(0,ie.FD)("div",{className:(0,pe.A)(Za,"l1WlNpmu"),dir:R.isRtl?"rtl":void 0,children:[(0,ie.Y)("p",{children:(0,Mt.A)(L("AboutPremiumDescription"),["simple_markdown"])}),(0,ie.Y)("p",{children:(0,Mt.A)(L("AboutPremiumDescription2"),["simple_markdown"])})]}),function(){if(c&&(!C||i?.id!==t))return(0,ie.Y)("div",{className:Za,dir:R.isRtl?"rtl":void 0,children:(0,$i.fd)({text:c.statusText,entities:c.statusEntities})})}()]}),!h&&U&&(0,ie.Y)("div",{className:"nCnlO9UZ",children:(0,ie.Y)(Z.A,{className:"c1tMxuFH",isShiny:!0,withPremiumGradient:!0,onClick:j,children:L("SubscribeToPremium",te)})})]})})});function se(){if(N)return R("PremiumGiftHeader");if(C)return(0,Mt.A)(i?.id===t?L("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,l.Yg)(y),S]):L("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,l.Yg)(i),S]),["simple_markdown","emoji"]);if(r&&i){const e=L("lng_premium_emoji_status_title").replace("{user}",(0,l.Yg)(i)),[t,s]=e.split("{link}"),n=r.thumbCustomEmojiId?(0,ie.Y)(ha.A,{className:"Y0jTcadE",documentId:r.thumbCustomEmojiId}):void 0,a=(0,ie.FD)("span",{className:"FLzl2ng5",onClick:W,children:[n,(0,Mt.A)(r.title)]});return[(0,Mt.A)(t),a,(0,Mt.A)(s)]}return(0,Mt.A)(i?L("TelegramPremiumUserDialogTitle",(0,l.Yg)(i)):L(h?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])}function ne(){return N&&"starGiftUnique"!==N.type&&N.perUserTotal?R("DescriptionGiftPremiumRequired2",{count:N.perUserTotal},{pluralValue:N.perUserTotal}):C?i?.id===t?L("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Yg)(y)):L("TelegramPremiumUserGiftedPremiumDialogSubtitle"):L(r?"TelegramPremiumUserStatusDialogSubtitle":i?"TelegramPremiumUserDialogSubtitle":h?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle")}}));var Co=i(80089),yo=i(80464);const So=e=>{const{isOpen:t}=e,i=(0,yo.A)(Co.ar.Extra,"CountryPickerModal",!t);return i?(0,ie.Y)(i,{...e}):void 0};var ko=i(1526),No=i(96530),wo=i(11124),Io=i(34642);const Po=(0,s.ph)(({isOpen:e,giveawayChatId:t,selectionLimit:i,initialSelectedIds:a,onSelectedIdsConfirmed:o,onClose:r})=>{const{showNotification:c}=(0,n.ko)(),d=(0,T.A)(),[h,u]=(0,s.J0)(void 0),[m,p]=(0,s.J0)(""),[v,g,A]=(0,F.A)(),[f,b]=(0,s.J0)(a);(0,s.vJ)(()=>{b(a)},[a]);const C=(0,s.Kr)(()=>{const e=(0,n.mS)(),i=e.chats.byId,{active:s,archived:a}=e.chats.listIds,o=(s||[]).concat(a||[]);return(0,pi.Am)(o).map(e=>i[e]).filter(e=>e&&((0,l.WX)(e)||(0,l.Vs)(e))&&e.id!==t).map(e=>e.id)},[t]),y=(0,s.Kr)(()=>{const e=C?(0,Dt.PU)({ids:C,query:m,type:"chat"}):[];return(0,Is.A)(e,!1,f)},[C,m,f]),S=(0,M.A)(e=>{const t=(0,n.mS)().chats.byId,s=e.filter(e=>!f.includes(e)).find(e=>{const i=t[e];return i&&!(0,l.gA)(i)});f?.length>=i?c({message:d("BoostingSelectUpToWarningChannelsPlural",i)}):s?(u(s),g()):b(e)}),k=(0,M.A)(()=>{h&&b((0,pi.Am)([...f,h])),A()}),N=(0,M.A)(()=>{o(f),r()});return(0,ie.FD)(Io.A,{isOpen:e,onClose:r,title:d("RequestPeer.ChooseChannelTitle"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:d("Save"),onConfirm:N,onEnter:N,children:[(0,ie.Y)(gi.A,{itemIds:y,selectedIds:f,filterValue:m,filterPlaceholder:d("Search"),onSelectedIdsChange:S,onFilterChange:p,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"}),(0,ie.Y)(ci.A,{title:d("BoostingGiveawayPrivateChannel"),text:d("BoostingGiveawayPrivateChannelWarning"),confirmLabel:d("Add"),isOpen:v,onClose:A,confirmHandler:k})]})}),Yo=(0,s.ph)(({option:e,checked:t,name:i,text:s,img:n,isLink:a,onChange:o,onClickAction:r,className:l,userNames:c,selectedMemberIds:d})=>{const h=(0,T.A)();let u=h(s);a&&d?.length&&(u=d.length>2?d.length.toString():c);const m=(0,M.A)(t=>{t.target.checked&&o(e)}),p=(0,M.A)(()=>{r?.()});return(0,ie.FD)("label",{className:(0,pe.A)("w3OGYFKn",l),dir:h.isRtl?"rtl":void 0,role:"button",tabIndex:0,children:[(0,ie.Y)("input",{className:"xy4AclZa",type:"radio",name:"giveaway_option",value:e,checked:t,onChange:m,onClick:e=>e.stopPropagation()}),(0,ie.FD)("div",{className:"TTgSI7Xh",children:[(0,ie.Y)("img",{className:"lGhZJbMF",src:n,alt:"",draggable:!1}),(0,ie.FD)("div",{className:"sEt7TF59",children:[(0,ie.Y)("h3",{className:"u4NzVBBi",children:h(i)}),a?(0,ie.FD)("div",{className:"y7XfPOoG",onClick:p,children:[(0,ie.Y)("span",{children:u}),(0,ie.Y)(Q.A,{name:"next"})]}):(0,ie.Y)("span",{className:"kt2ZKZ6j",children:u})]})]})]})}),Fo=(0,s.ph)((0,n.EK)((e,{giveawayChatId:t})=>{const i=t?(0,c.AWZ)(e,t):void 0;return i?{members:i.members,adminMembersById:i.adminMembersById}:{members:void 0,adminMembersById:void 0}})(({isOpen:e,selectionLimit:t,members:i,adminMembersById:a,initialSelectedIds:o,onSelectedIdsConfirmed:r,onClose:c})=>{const{showNotification:d}=(0,n.ko)(),h=(0,T.A)(),[u,m]=(0,s.J0)(""),[p,v]=(0,s.J0)(o);(0,s.vJ)(()=>{v(o)},[o]);const g=(0,s.Kr)(()=>{const e=(0,n.mS)(),{byId:t,statusesById:s}=e.users;if(!i?.length)return[];const o=a&&new Set(Object.keys(a)),r=(0,l.UB)(i.map(({userId:e})=>e),t,s);return o?r.filter(e=>!o.has(e)):r},[a,i]),A=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=g?(0,Dt.PU)({ids:g,query:u,type:"user"}):[];return(0,Is.A)((0,pi.Am)(t).filter(t=>{const i=e[t];return!i||!(0,l.tv)(i)}))},[g,u]),f=(0,M.A)(e=>{e.length>t?d({message:h("BoostingSelectUpToWarningUsers",t)}):v(e)}),b=(0,M.A)(()=>{r(p),c()});return(0,ie.Y)(Io.A,{isOpen:e,onClose:c,title:h("BoostingAwardSpecificUsers"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:h("Save"),onConfirm:b,onEnter:b,children:(0,ie.Y)(gi.A,{itemIds:A,selectedIds:p,filterValue:u,filterPlaceholder:h("Search"),onSelectedIdsChange:f,onFilterChange:m,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"})})})),Do="rZRDMqUL",Mo="JjDLNrKG",To="p5Hn4Q6E",Bo="rniPcuiP",Lo="G9H3tm6D",Ro="xKl2UeV8",xo="HLx3wTBD",Eo="Ftr7zf2v",Vo="Ce0Ob2tg",_o="rDFQAfTt",Uo="LZ3vPzak",Oo="Z9QJQ6IS",Ko="ldn4mh2T";var Jo=i(72078),Go=i(68153),jo=i(65741),zo=i(45318);const Ho=i.p+"PremiumStar.39c1ff364d35554f4b80.svg",$o={3:Go,6:Jo,12:jo},qo=(0,s.ph)((0,n.EK)(e=>{const{giveawayModal:t}=(0,c.nTw)(e),i=t?.chatId,s=i?(0,c.hds)(e,i):void 0,n=s&&(0,l.WX)(s);return{chatId:i,gifts:t?.gifts,selectedMemberList:t?.selectedMemberIds,selectedChannelList:t?.selectedChannelIds,giveawayBoostPerPremiumLimit:e.appConfig.giveawayBoostsPerPremium,isStarsGiftEnabled:e.appConfig.isStarsGiftEnabled,userSelectionLimit:e.appConfig.giveawayAddPeersMax,countrySelectionLimit:e.appConfig.giveawayCountriesMax,countryList:e.countryList.general,prepaidGiveaway:t?.prepaidGiveaway,isChannel:n,starsGiftOptions:t?.starOptions}})(({chatId:e,gifts:t,isOpen:i,isChannel:a,selectedMemberList:r,selectedChannelList:c,giveawayBoostPerPremiumLimit:d=o.CQG,countryList:h,prepaidGiveaway:u,countrySelectionLimit:m=o.y67,userSelectionLimit:p=o.qbC,isStarsGiftEnabled:v,starsGiftOptions:g})=>{const A=(0,s.li)(),{closeGiveawayModal:f,openInvoice:b,openPremiumModal:C,launchPrepaidGiveaway:y,launchPrepaidStarsGiveaway:S}=(0,n.ko)(),k=(0,T.A)(),[N,w,I]=(0,F.A)(),[P,Y,D]=(0,F.A)(),[B,L,R]=(0,F.A)(),[x,E,V]=(0,F.A)(),[_,U,O]=(0,F.A)(),K=[{name:"Premium.Title",text:"BoostingWinnersRandomly",value:"premium_giveaway",img:Jo,actions:"createPremiumGiveaway",isLink:!0,onClickAction:()=>{E()}}];v&&K.push({name:"TelegramStars",text:"BoostingWinnersRandomly",value:"stars_giveaway",img:zo,actions:"createStarsGiveaway",isLink:!1});const[J,G]=(0,s.J0)(()=>Date.now()+2592e5),[j,z]=(0,s.J0)(!0),[H,$]=(0,s.J0)(5),[q,W]=(0,s.J0)(K[0].value),[se,ne]=(0,s.J0)(),[ae,oe]=(0,s.J0)("all"),[re,le]=(0,s.J0)(),[ce,de]=(0,s.J0)([]),[he,ue]=(0,s.J0)([]),[me,ve]=(0,s.J0)([]),[ge,Ae]=(0,s.J0)(!1),[fe,be]=(0,s.J0)(!1),[Ce,ye]=(0,s.J0)(void 0),[Se,ke]=(0,s.J0)(void 0),[Ne,we]=(0,s.J0)(void 0),Ie="premium_giveaway"===q,Pe="stars_giveaway"===q,Ye=Ie&&!ce.length?H:ce.length,Fe=Ye*d,De=se?.yearlyBoosts,Me=(0,s.Kr)(()=>[{value:"all",label:k(a?"BoostingAllSubscribers":"BoostingAllMembers"),subLabel:me&&me.length>0?k("Giveaway.ReceiverType.Countries",me.length):k("BoostingFromAllCountries")},{value:"new",label:k(a?"BoostingNewSubscribers":"BoostingNewMembers"),subLabel:me&&me.length>0?k("Giveaway.ReceiverType.Countries",me.length):k("BoostingFromAllCountries")}],[a,k,me]),Te=k("Months",re),Be="starsGiveaway"===u?.type,Le="giveaway"===u?.type,Re=(0,s.Kr)(()=>t?.find(e=>e.months===re&&e.users===Ye),[t,re,Ye]),xe=(0,s.Kr)(()=>g?.find(e=>Be&&e.stars===Ne?.stars),[Ne,g,Be]),Ee=(0,s.Kr)(()=>t?.filter(e=>e.users===Ye&&e.currency!==o.OUy),[t,Ye]),Ve=(0,s.Kr)(()=>{const e=Ee?.reduce((e,t)=>t.amount<e.amount?t:e,Ee[0]);return e&&Math.floor(e.amount/e.months)},[Ee]),_e=(0,s.Kr)(()=>(0,pi.Am)(t?.filter(e=>e.currency!==o.OUy)?.map(e=>e.users)||[]).sort((e,t)=>e-t),[t]),Ue=(0,s.Kr)(()=>(0,pi.Am)(se?.winners?.map(e=>e.users)||[]).sort((e,t)=>e-t),[se]);(0,s.vJ)(()=>{i&&t?.length&&!Be&&le(t?.[0].months)},[i,t,Be]),(0,s.vJ)(()=>{i&&g?.length&&!Le&&ne(g?.[0])},[i,g,Le]),(0,s.vJ)(()=>{i&&Be&&($(u.quantity),we(u))},[i,Be,u]),(0,s.vJ)(()=>{i&&Le&&($(u.quantity),ke(u),le(u.months))},[i,Le,u]),(0,s.vJ)(()=>{r&&de(r)},[r]),(0,s.vJ)(()=>{c&&ue(c)},[c]);const Oe=(0,M.A)(()=>{C()}),Ke=(0,M.A)(()=>{we(void 0),ke(void 0),ne(void 0),le(void 0),$(5),f()}),Je=(0,M.A)(()=>{b(Ie?ce?.length?{type:"giftcode",boostChannelId:e,userIds:ce,currency:Re.currency,amount:Re.amount,option:Re}:{type:"giveaway",chatId:e,additionalChannelIds:he,isOnlyForNewSubscribers:"new"===ae,countries:me,areWinnersVisible:ge,prizeDescription:Ce,untilDate:J/1e3,currency:Re.currency,amount:Re.amount,option:Re}:{type:"starsgiveaway",chatId:e,additionalChannelIds:he,isOnlyForNewSubscribers:"new"===ae,countries:me,areWinnersVisible:ge,prizeDescription:Ce,untilDate:J/1e3,currency:se.currency,amount:se.amount,stars:se.stars,users:H}),Ke()}),Ge=(0,M.A)(()=>{Be?S({chatId:e,giveawayId:Ne.id,paymentPurpose:{additionalChannelIds:he,countries:me,prizeDescription:Ce,areWinnersVisible:ge,untilDate:J/1e3,stars:Ne.stars,currency:xe.currency,amount:xe.amount,users:Ne.quantity}}):y({chatId:e,giveawayId:Se.id,paymentPurpose:{additionalChannelIds:he,countries:me,prizeDescription:Ce,areWinnersVisible:ge,untilDate:J/1e3,currency:Re.currency,amount:Re.amount}}),R(),Ke()}),je=(0,M.A)(e=>{$(e)}),ze=(0,M.A)(e=>{$(e)}),He=(0,M.A)(e=>{ye(e.target.value)}),qe=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;return ce?.map(t=>(0,l.Yg)(e[t])).join(", ")},[ce]),We=(0,M.A)(e=>{oe(e)}),Qe=(0,M.A)(e=>{W(e),de([]),$(5)}),Ze=(0,M.A)(e=>{G(e.getTime()),I()}),Xe=(0,M.A)(e=>{ve(e)}),et=(0,M.A)(e=>{de(e),e.length||W("premium_giveaway")}),tt=(0,M.A)(e=>{ue(e)}),it=(0,M.A)(e=>{Ae(e.target.checked)}),st=(0,M.A)(e=>{be(e.target.checked)}),nt=(0,M.A)(()=>{Y()}),at=(0,M.A)(e=>{ne(e)});function ot(){return(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:Do,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingChannelsGroupsIncludedGiveaway")}),(0,ie.Y)(ui.A,{inactive:!0,className:"chat-item-clickable contact-list-item",children:(0,ie.Y)(fs.A,{chatId:e,status:k(a?"BoostingChannelWillReceiveBoost":"BoostingGroupWillReceiveBoost",Fe||De,"i")})}),he?.map(e=>(0,ie.Y)(ui.A,{ripple:!0,className:"chat-item-clickable contact-list-item",onClick:()=>function(e){const t=he.filter(t=>t!==e);ue(t)}(e),rightElement:(0,ie.Y)(Q.A,{name:"close",className:"UZdErfVI"}),children:(0,ie.Y)(fs.A,{chatId:e.toString()})},e)),he.length<9&&(0,ie.Y)(ui.A,{icon:"add",ripple:!0,onClick:U,className:"sOXvh85b",iconClassName:"aGbyR60s",children:k("BoostingAddChannelOrGroup")})]}),(0,ie.FD)("div",{className:Do,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingEligibleUsers")}),(0,ie.Y)("div",{className:Mo,children:(0,ie.Y)(te.A,{name:"subscribers",options:Me,selected:ae,onChange:We,onClickAction:nt,subLabelClassName:"txXJxVFu",isLink:!0})})]}),(0,ie.Y)("div",{className:Bo,children:(0,Mt.A)(k(a?"BoostGift.LimitSubscribersInfo":"lng_giveaway_users_about_group"))}),(0,ie.FD)("div",{className:Do,children:[(0,ie.FD)("div",{className:Oo,children:[(0,ie.Y)("h2",{className:Uo,children:k("BoostingGiveawayAdditionalPrizes")}),(0,ie.Y)(mi.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:fe,onChange:st})]}),fe&&(0,ie.FD)("div",{className:"eQVP0Nx8",children:[(0,ie.Y)("h2",{className:Uo,children:H}),(0,ie.Y)(X.A,{className:"qMYNwiUZ",value:Ce,onChange:He,label:k("BoostingGiveawayEnterYourPrize")})]})]}),fe?Pe||Be?void 0:(0,ie.Y)("div",{className:Bo,children:Ce?.length?(0,Mt.A)(k("BoostingGiveawayAdditionPrizeCountNameHint",Se?[Se.quantity,Ce,Te]:[Ye,Ce,Te],void 0,re),["simple_markdown"]):(0,Mt.A)(k("BoostingGiveawayAdditionPrizeCountHint",Se?[Se.quantity,Te]:[Ye,Te],void 0,re),["simple_markdown"])}):(0,ie.Y)("div",{className:Bo,children:(0,Mt.A)(k("BoostingGiveawayAdditionPrizeHint"))}),(0,ie.Y)("div",{className:Do,children:(0,ie.FD)("div",{className:Oo,children:[(0,ie.Y)("h2",{className:Uo,children:k("BoostingGiveawayShowWinners")}),(0,ie.Y)(mi.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:ge,onChange:it})]})}),(0,ie.Y)("div",{className:Bo,children:(0,Mt.A)(k("BoostingGiveawayShowWinnersHint"))}),(0,ie.FD)("div",{className:(0,pe.A)(Do,(Se||Ne||Pe)&&_o),children:[(0,ie.Y)("h2",{className:To,children:k("BoostingDateWhenGiveawayEnds")}),(0,ie.FD)(Z.A,{ariaLabel:k("BoostGift.DateEnds"),className:(0,pe.A)("GeKqKRgP","expire-limit"),isText:!0,onClick:w,children:[(0,ie.Y)("h3",{className:Uo,children:k("BoostGift.DateEnds")}),(0,$e.L2)(J,k.code)]})]})]})}return(0,ie.FD)(ee.A,{className:"P0kLOw15",onClose:Ke,isOpen:i,dialogRef:A,onEnter:Se||Ne?L:Je,children:[(0,ie.FD)("div",{className:(0,pe.A)("SqiN63Ef","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;z(t<=150)},children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",className:"OX6_HqAd",color:"translucent",onClick:Ke,ariaLabel:k("Close"),children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("img",{className:"Me2hCsMs",src:Ho,alt:"",draggable:!1}),(0,ie.Y)("h2",{className:"UVDnB0Wq",children:(0,Mt.A)(k("BoostingBoostsViaGifts"))}),(0,ie.Y)("div",{className:"v5yGzV6v",children:(0,Mt.A)(k(a?"BoostingGetMoreBoost":"BoostingGetMoreBoostsGroup"))}),(0,ie.Y)("div",{className:(0,pe.A)("U6XNIToQ",j&&"tDZc21ZC"),children:(0,ie.Y)("h2",{className:"v6hiGpEn",children:k("BoostingBoostsViaGifts")})}),Se||Ne?(0,ie.FD)("div",{className:"q1y2qUTn",children:[(0,ie.Y)("div",{children:Ne?(0,ie.Y)("img",{className:Ko,src:zo,alt:""}):(0,ie.Y)("img",{className:Ko,src:$o[Se.months]||$o[3],alt:""})}),(0,ie.FD)("div",{className:"IsT38nlq",children:[(0,ie.Y)("h3",{className:Uo,children:Ne?k("Giveaway.Stars.Prepaid.Title",Ne?.stars):k("BoostingTelegramPremiumCountPlural",Se.quantity)}),(0,ie.Y)("p",{className:"TsGuei3B",children:Ne?k("Giveaway.Stars.Prepaid.Desc",Ne?.quantity):k("PrepaidGiveawayMonths",Se?.months)})]}),(0,ie.Y)("div",{className:Lo,children:(0,ie.FD)("div",{className:(0,pe.A)(Ro,xo),children:[(0,ie.Y)(Q.A,{name:"boost",className:Eo}),(0,ie.Y)("div",{className:Vo,dir:k.isRtl?"rtl":void 0,children:Ne?Ne?.boosts:Se.quantity*(d??o.CQG)})]})})]}):(0,ie.Y)("div",{className:(0,pe.A)(Do,"sQ5PkKEs"),children:(0,ie.Y)("div",{className:Mo,children:K.map(e=>(0,ie.Y)(Yo,{name:e.name,text:e.text,option:e.value,img:e.img,onChange:Qe,checked:q===e.value,isLink:e.isLink,userNames:qe,selectedMemberIds:ce,onClickAction:e.onClickAction},e.name))})}),Ie&&!ce?.length&&(0,ie.FD)(ie.FK,{children:[!Se&&!Ne&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:Do,children:[(0,ie.FD)("div",{className:Lo,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingQuantityPrizes")}),(0,ie.FD)("div",{className:(0,pe.A)(Ro,xo),children:[(0,ie.Y)(Q.A,{name:"boost",className:Eo}),(0,ie.Y)("div",{className:Vo,dir:k.isRtl?"rtl":void 0,children:Fe})]})]}),(0,ie.Y)(wo.A,{rangeCount:Ye,marks:_e,onChange:je})]}),(0,ie.Y)("div",{className:Bo,children:(0,Mt.A)(k("BoostingChooseHowMany"))})]}),ot()]}),Pe&&(0,ie.FD)(ie.FK,{children:[!Ne&&!Se&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:Do,children:[(0,ie.FD)("div",{className:Lo,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingStarsOptions")}),(0,ie.FD)("div",{className:(0,pe.A)(Ro,xo),children:[(0,ie.Y)(Q.A,{name:"boost",className:Eo}),(0,ie.Y)("div",{className:Vo,dir:k.isRtl?"rtl":void 0,children:De})]})]}),(0,ie.Y)(ko.A,{className:"cLhNkYPB",options:g,selectedStarCount:H,selectedStarOption:se,onClick:at})]}),(0,ie.Y)("div",{className:(0,pe.A)(Bo,"bzRAETfR"),children:(0,Mt.A)(k("BoostGift.Stars.Info"))}),(0,ie.FD)("div",{className:Do,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingStarsQuantityPrizes")}),(0,ie.Y)(wo.A,{rangeCount:H,marks:Ue,onChange:ze}),(0,ie.Y)("div",{className:Bo,children:(0,Mt.A)(k("BoostingStarsQuantityPrizesInfo"))})]})]}),ot()]}),!Se&&!Ne&&Ie&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:Do,children:[(0,ie.Y)("h2",{className:To,children:k("BoostingDurationOfPremium")}),(0,ie.Y)("div",{className:Mo,children:Ee?.map(e=>(0,ie.Y)(Qa,{isGiveaway:!0,option:e,fullMonthlyAmount:Ve,checked:e.months===re,onChange:le},e.months))})]}),(0,ie.Y)("div",{className:(0,pe.A)(Bo,_o),children:function(){const e=k("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return(0,ie.FD)("p",{className:"eNQ_nrKr",children:[e[1],(0,ie.Y)(No.A,{isPrimary:!0,onClick:Oe,children:e[2]}),e[3]]})}()})]}),q&&(0,ie.Y)("div",{className:"hD_AEzjd",children:(0,ie.Y)(Z.A,{className:"ILuhBsJG",onClick:Se||Ne?L:Je,children:k("BoostingStartGiveaway")})})]}),(0,ie.Y)(an,{isOpen:N,isFutureMode:!0,withTimePicker:!0,onClose:I,onSubmit:Ze,selectedAt:J,submitButtonLabel:k("Save")}),(0,ie.Y)(So,{isOpen:P,onClose:D,countryList:h,onSubmit:Xe,selectionLimit:m}),(0,ie.Y)(Fo,{isOpen:x,onClose:V,onSelectedIdsConfirmed:et,initialSelectedIds:ce,selectionLimit:p,giveawayChatId:e}),(0,ie.Y)(Po,{isOpen:_,onClose:O,initialSelectedIds:he,onSelectedIdsConfirmed:tt,selectionLimit:o.cgU,giveawayChatId:e}),(0,ie.Y)(ci.A,{title:k("BoostingStartGiveawayConfirmTitle"),text:k("BoostingStartGiveawayConfirmText"),confirmLabel:k("Start"),isOpen:B,onClose:R,confirmHandler:Ge})]})})),Wo={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders",savedDialogsPinned:"LimitReachedPinSavedDialogs"},Qo={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked",savedDialogsPinned:"LimitReachedPinSavedDialogsLocked"},Zo={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium",savedDialogsPinned:"LimitReachedPinSavedDialogsPremium"},Xo={dialogFiltersChats:"chat-badge",uploadMaxFileparts:"file-badge",dialogFilters:"folder-badge",dialogFolderPinned:"pin-badge",channelsPublic:"link-badge",channels:"chats-badge",chatlistInvites:"link-badge",chatlistJoined:"folder-badge",savedDialogsPinned:"pin-badge"},er={uploadMaxFileparts:(e,t)=>8e3===t?e("MediaSizeGB",{size:4},{pluralValue:4}):4e3===t?e("MediaSizeGB",{size:2},{pluralValue:2}):(0,kn.v7)(e,t*o.dK5)},tr=(0,s.ph)((0,n.EK)((e,{limit:t})=>{const{limits:i}=e.appConfig,s=(0,c.g29)(e);return{defaultValue:t?i?.[t][0]:void 0,premiumValue:t?i?.[t][1]:void 0,canBuyPremium:!(0,c.n_C)(e),isPremium:s}})(({defaultValue:e,premiumValue:t,limit:i,isPremium:a,canBuyPremium:o})=>{const{closeLimitReachedModal:r,openPremiumModal:l}=(0,n.ko)(),c=(0,Ri.A)(),d=(0,T.A)(),[h,u,m]=(0,F.A)(),p=(0,s.hb)(()=>{l(),u()},[l,u]);(0,s.vJ)(()=>{!i&&h&&m()},[h,i,m]);const v=c("LimitReached"),g=i&&er[i],A=function({lang:e,oldLang:t,limitType:i,isPremium:s,canBuyPremium:n,defaultValue:a,premiumValue:o,valueFormatter:r}){if(!i)return;const l=r?r(e,a):a,c=r?r(e,o):o;return s?t(Zo[i],c):n?t(Wo[i],"channelsPublic"===i?c:[l,c]):t(Qo[i],l)}({lang:c,oldLang:d,limitType:i,isPremium:a,canBuyPremium:o,defaultValue:e,premiumValue:t,valueFormatter:g}),f=i&&Xo[i],b=o&&!a;return(0,ie.FD)(ee.A,{onClose:u,onCloseAnimationEnd:r,isOpen:Boolean(i)&&!h,title:v,className:"QAs_iFxO",children:[!b&&(0,ie.FD)("div",{className:"Q5d_7bB4",children:[(0,ie.Y)("i",{className:(0,pe.A)("rbnU7JVX",f,"icon")}),(0,ie.Y)("div",{className:"ArEy3hhB",children:g?.(c,a?t:e)||(a?t:e)})]}),b&&(0,ie.Y)(ya,{className:"k0O6Rnjh",leftValue:g?.(c,e)||e?.toString(),rightValue:g?.(c,t)||t?.toString(),floatingBadgeIcon:f}),(0,ie.Y)("div",{children:(0,Mt.A)(A||"",["simple_markdown","br"])}),(0,ie.FD)("div",{className:"RVM_RSap",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary",children:c(b?"Cancel":"OK")}),b&&(0,ie.FD)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",children:[c("IncreaseLimit"),(0,ie.Y)(Q.A,{name:"double-badge",className:"esB1OhAF"})]})]})]})}));var ir=i(93809),sr=i(81954),nr=i(5912);const ar=350+o.xB5,or=.5*g.$;function rr(e,t,i,n){const a=(0,s.li)([]),[o,r]=(0,s.J0)(0),{observe:l,freeze:c,unfreeze:d}=(0,nr.BL)({rootRef:e},e=>{const t=a.current;e.forEach(e=>{const s=Number(e.target.id.replace(`${i}-`,""));t[s]=e.isIntersecting});const s=t.reduce((e,t,i)=>t&&i<e?i:e,1/0);s!==1/0&&r(s)}),{observe:h,freeze:u,unfreeze:m}=(0,nr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:p}=(0,nr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:v}=(0,nr.BL)({rootRef:t});return(0,z.A)(()=>{n?(c(),u()):setTimeout(()=>{m(),d()},ar)},[c,u,n,d,m]),{activeSetIndex:o,observeIntersectionForSet:l,observeIntersectionForShowingItems:h,observeIntersectionForPlayingItems:p,observeIntersectionForCovers:v,selectStickerSet:(0,M.A)(t=>{r(s=>{const n=document.getElementById(`${i}-${t}`),a=1===Math.abs(s-t);return(0,sr.Ay)({container:e.current,element:n,position:"start",margin:or,maxDistance:a?200:80}),t})})}}var lr=i(37479),cr=i(87094),dr=i(94519),hr=i(45294);const ur=(0,s.ph)(({stickerSet:e,size:t=o.TBj,noPlay:i,forcePlayback:a,observeIntersection:r,sharedCanvasRef:d})=>{const{loadStickers:h}=(0,n.ko)(),m=(0,s.li)(),{hasThumbnail:p,hasVideoThumb:v,hasAnimatedThumb:g,hasStaticThumb:A,thumbCustomEmojiId:f}=e,{customEmoji:b}=(0,hr.A)(f),C=b?.shouldUseTextColor,y=(0,cr.A)(m,void 0,!C),S=(0,lr.A)(y),k=(0,nr.Vz)(m,r),N=k&&!i,w=!p||v&&!u.OF&&!g&&!A,I=w&&e.stickers?.[0]&&(0,l.Mw)(e.stickers[0],"preview"),P=(0,H.A)(I,!k),Y=(p&&!I||g)&&`stickerSet${e.id}`,F=(0,H.A)(Y,!k),D=f||F||P,M=(0,Ei.A)(D),T=(0,dr.A)(m,d);return(0,s.vJ)(()=>{k&&!e.stickers?.length&&h({stickerSetInfo:e})},[k,h,e]),(0,ie.Y)("div",{ref:m,className:(0,pe.A)("m6XpTzQX","sticker-set-cover"),style:`--_size: ${t}px`,children:D?f?(0,ie.Y)(ha.A,{documentId:f,size:t,observeIntersectionForPlaying:r,noPlay:i}):g?(0,ie.Y)(Ia.A,{className:M,tgsUrl:F,size:t,play:N,isLowPriority:!(0,c.CzR)((0,n.mS)(),e),sharedCanvas:d?.current||void 0,sharedCanvasCoords:T,forceAlways:a}):v&&!w?(0,ie.Y)(Ki.A,{className:(0,pe.A)("OZHqKbDL",M),src:F,canPlay:N,style:S,isPriority:a,loop:!0,disablePictureInPicture:!0}):(0,ie.Y)("img",{src:F||P,style:S,className:(0,pe.A)("enA6c8gc",M),alt:"",draggable:!1}):(0,kn.Qh)(e.title,2)})});var mr=i(54464),pr=i(82855);const vr=[{title:"SetTimeoutFor.Hours",value:1,arg:3600},{title:"SetTimeoutFor.Hours",value:2,arg:7200},{title:"SetTimeoutFor.Hours",value:8,arg:28800},{title:"SetTimeoutFor.Days",value:1,arg:86400},{title:"SetTimeoutFor.Days",value:2,arg:172800}],gr=(0,s.ph)(({sticker:e,size:t,noPlay:i,title:a,className:o,noContextMenu:r,isSavedMessages:l,isStatusPicker:c,canViewSet:d,observeIntersection:h,observeIntersectionForShowing:m,isSelected:p,isCurrentUserPremium:v,shouldIgnorePremium:g,noShowPremium:A,sharedCanvasRef:f,withTranslucentThumb:b,forcePlayback:C,onClick:y,clickArg:S,onFaveClick:k,onUnfaveClick:N,onRemoveRecentClick:w,onContextMenuOpen:I,onContextMenuClose:P,onContextMenuClick:Y,isEffectEmoji:F})=>{const{openStickerSet:D,openPremiumModal:B,setEmojiStatus:L}=(0,n.ko)(),R=(0,s.li)(),x=(0,s.li)(),E=(0,T.A)(),V=e.shouldUseTextColor,_=(0,cr.A)(R,void 0,!V),{id:U,stickerSetInfo:O}=e,K=!e.isFree||e.hasEffect,J=e.isCustomEmoji||F,G=!v&&K&&!g,j=(0,nr.Vz)(R,h),z=j,H=j&&!i,$=(0,nr.Vz)(R,m),{isContextMenuOpen:q,contextMenuAnchor:W,handleBeforeContextMenu:X,handleContextMenu:ee,handleContextMenuClose:te,handleContextMenuHide:se}=(0,vn.A)(R),ne=Boolean(!r&&W),ae=(0,M.A)(()=>R.current),oe=(0,M.A)(()=>R.current.closest(".custom-scroll, .no-scrollbar")),re=(0,M.A)(()=>c?x.current:R.current.querySelector(".sticker-context-menu .bubble")),le=(0,M.A)(()=>({withPortal:c,shouldAvoidNegativePosition:!0}));(0,s.vJ)(()=>{q?I?.():P?.()},[q,P,I]),(0,s.vJ)(()=>{j||te()},[te,j]);const ce=(0,M.A)(t=>{t.stopPropagation(),t.preventDefault(),w(e)}),de=(0,M.A)(()=>{w(e)}),ue=(0,M.A)(()=>{N(e)}),me=(0,M.A)(()=>{k(e)}),ve=(0,M.A)(()=>{y?.(S,!0)}),ge=(0,M.A)(()=>{y?.(S,void 0,!0)}),Ae=(0,M.A)(()=>{D({stickerSetInfo:O})}),fe=(0,M.A)((t,i=0)=>{t.preventDefault(),t.stopPropagation(),te(),Y?.(),L({emojiStatus:{type:"regular",documentId:e.id,until:(0,Ti.Fm)()+i}})}),be=!u.TF&&w,Ce=(0,pe.A)("StickerButton",y&&"interactive",p&&"selected",J&&"custom-emoji",F&&"effect-emoji",o),ye=(0,s.Kr)(()=>{if(!ne||r||J&&!c)return[];const e=[];return J?(vr.forEach(t=>{e.push((0,ie.Y)(he.A,{onClick:fe,clickArg:t.arg,children:E(t.title,t.value,"i")}))}),e):(N&&e.push((0,ie.Y)(he.A,{icon:"favorite",onClick:ue,children:E("Stickers.RemoveFromFavorites")})),k&&e.push((0,ie.Y)(he.A,{icon:"favorite",onClick:me,children:E("Stickers.AddToFavorites")})),!G&&y&&(l||e.push((0,ie.Y)(he.A,{onClick:ve,icon:"muted",children:E("SendWithoutSound")})),e.push((0,ie.Y)(he.A,{onClick:ge,icon:"calendar",children:E(l?"SetReminder":"ScheduleMessage")}))),d&&e.push((0,ie.Y)(he.A,{onClick:Ae,icon:"stickers",children:E("ViewPackPreview")})),w&&e.push((0,ie.Y)(he.A,{icon:"delete",onClick:de,children:E("DeleteFromRecent")})),e)},[ne,r,J,c,N,k,G,y,d,w,fe,E,ue,me,l,ge,ve,Ae,de]);return(0,ie.FD)("div",{ref:R,className:Ce,title:a||e?.emoji,"data-sticker-id":U,onMouseDown:e=>{(0,mr.u)(e),X(e)},onClick:()=>{if(!q)return G?(B(F?{initialSection:"effects"}:J?{initialSection:"animated_emoji"}:{initialSection:"premium_stickers"}),void P?.()):void y?.(S)},onContextMenu:ee,children:[$&&(0,ie.Y)(pr.A,{containerRef:R,sticker:e,isSmall:!0,size:t,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!z,noPlay:!H,noVideoOnMobile:!0,withSharedAnimation:!0,sharedCanvasRef:f,withTranslucentThumb:b,customColor:_,forceAlways:C}),!A&&G&&(0,ie.Y)("div",{className:"sticker-locked",children:(0,ie.Y)(Q.A,{name:"lock-badge"})}),!A&&K&&!G&&(0,ie.Y)("div",{className:"sticker-premium",children:(0,ie.Y)(Q.A,{name:"star"})}),be&&(0,ie.Y)(Z.A,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:ce,children:(0,ie.Y)(Q.A,{name:"close"})}),Boolean(ye.length)&&(0,ie.Y)(We.A,{ref:x,isOpen:q,anchor:W,getTriggerElement:ae,getRootElement:oe,getMenuElement:re,getLayout:le,className:"sticker-context-menu",autoClose:!0,withPortal:c,onClose:te,onCloseAnimationEnd:se,children:ye})]})});var Ar=i(93545),fr=i(95773),br=i(58443),Cr=i(64489);const yr=(0,s.ph)(({reaction:e,availableReactions:t,isSelected:i,loadAndPlay:n,observeIntersection:a,sharedCanvasRef:r,sharedCanvasHqRef:c,forcePlayback:d,onClick:h,onContextMenu:u})=>{const m=(0,s.li)(),p="custom"===e.type,v=(0,s.Kr)(()=>t?.find(t=>(0,l.a0)(t.reaction,e)),[t,e]),g=v?.staticIcon?.thumbnail?.dataUri,A=v?.selectAnimation?.id,f=(0,dr.A)(m,r),b=(0,H.A)(v?.selectAnimation?(0,l.mr)(v.selectAnimation,"full"):void 0,!A),{isContextMenuOpen:C,handleBeforeContextMenu:y,handleContextMenu:S,handleContextMenuClose:k,handleContextMenuHide:N}=(0,vn.A)(m,"paid"!==e.type,void 0,void 0,void 0,!0);(0,s.vJ)(()=>{C&&(u?.(e),k(),N())},[k,u,N,C,e]);const w="paid"===e.type?br.w.StarReaction:b,I=(0,M.A)(()=>{h(e)}),P=(0,Ei.A)(b),Y=(0,pe.A)("AVrrYEbM",i&&"QkdO_lz1",!p&&"sticker-reaction");return(0,ie.Y)("div",{ref:m,className:Y,onClick:I,title:v?.title,"data-sticker-id":p?e.documentId:void 0,onMouseDown:y,onContextMenu:S,children:p?(0,ie.Y)(ha.A,{ref:m,documentId:e.documentId,size:o.g0Q,noPlay:!n,observeIntersectionForPlaying:a,sharedCanvasRef:r,sharedCanvasHqRef:c,withTranslucentThumb:!0,forceAlways:d}):(0,ie.Y)(Cr.A,{tgsUrl:w,thumbDataUri:g,play:n,noLoop:!1,size:o.g0Q,isLowPriority:!0,className:P,sharedCanvas:r.current||void 0,sharedCanvasCoords:f,forceAlways:d})})});var Sr=i(38027);const kr=(0,s.ph)((0,n.EK)(e=>{const t=e.collectibleEmojiStatuses?.statuses;return{collectibleStatuses:t}})(({stickerSet:e,loadAndPlay:t,index:i,idPrefix:a,isNearActive:r,favoriteStickers:d,availableReactions:h,isSavedMessages:u,isStatusPicker:m,isReactionPicker:p,isCurrentUserPremium:v,shouldHideHeader:g,withDefaultTopicIcon:A,selectedReactionIds:f,withDefaultStatusIcon:b,isChatEmojiSet:C,isChatStickerSet:y,isTranslucent:S,noContextMenus:k,forcePlayback:N,observeIntersection:w,observeIntersectionForPlayingItems:I,observeIntersectionForShowingItems:P,onReactionSelect:D,onReactionContext:B,onStickerSelect:L,onStickerUnfave:R,onStickerFave:x,onStickerRemoveRecent:E,onContextMenuOpen:V,onContextMenuClose:_,onContextMenuClick:U,collectibleStatuses:O})=>{const{clearRecentStickers:K,clearRecentCustomEmoji:J,clearRecentReactions:G,openPremiumModal:j,toggleStickerSet:z,loadStickers:H}=(0,n.ko)(),$=(0,s.li)(),q=(0,s.li)(),W=(0,s.li)(),X=(0,T.A)(),{width:ee}=(0,we.A)(),[te,se,ne]=(0,F.A)(),{isMobile:ae}=(0,Y.Ay)(),[oe,re]=(0,s.J0)(()=>Nr(ee)),le=(0,nr.Vz)($,w??P),ce=(0,Ei.A)(le),de=r||le,he=ae?8:4,ue=ae?8:10,me=ae?8:4,ve=e.id===o.sR2,ge=e.id===o.j1l,Ae=e.id===o.tRH,fe=e.id===o.EPW,be=e.isEmoji,Ce=!ve&&(0,c.Q31)(e),ye=(0,M.A)(()=>{p?G():be?J():K(),ne()}),Se=(0,M.A)(()=>{Ce&&!v?j({initialSection:"animated_emoji"}):z({stickerSetId:e.id})}),ke=(0,M.A)(()=>{L?.({mediaType:"sticker",id:o.MyF,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Ne=(0,M.A)(()=>{L?.({mediaType:"sticker",id:o.zNY,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Ie=be?o.g0Q:o.bkT,Pe=be?ue:he,Ye=be?me:he,Fe=(0,M.A)(e=>e?Math.floor((e+Pe)/(Ie+Pe)):Nr(ee)),De=(0,M.A)(e=>{re(Fe(e.contentRect.width))});(0,Ar.A)($,De),(0,s.vJ)(()=>{$.current&&re(Fe($.current.clientWidth))},[Fe]),(0,s.vJ)(()=>{de&&!e.stickers?.length&&!e.reactions?.length&&e.accessHash&&H({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})},[de,H,e]);const Me=!u&&!v&&Ce&&!C,Te=e.installedDate&&!e.isArchived,Be=!Te&&e.id!==o.sR2&&e.id!==o.EPW&&e.id!==o.hfH&&e.id!==o.Kp3&&!C&&!y,[Le,,Re]=(0,F.A)(Be),xe=3*oe-1,Ee=A||b?e.count+1:e.count,Ve=Ie+Ye,_e=Math.ceil(Math.min(xe,Ee)/oe)*Ve-Ye,Ue=Le?_e:Math.ceil(Ee/oe)*Ve-Ye,Oe=(0,s.Kr)(()=>d?new Set(d.map(({id:e})=>e)):void 0,[d]),Ke=(0,s.Kr)(()=>O?new Set(O.map(({documentId:e})=>e)):void 0,[O]),Je=!g&&!ve&&!ge&&be&&!fe&&!C&&(!Te||!v&&!u),Ge=(0,s.Kr)(()=>X(Me?Te?"lng_emoji_premium_restore":"Unlock":"Add"),[Me,X,Te]);return(0,ie.FD)("div",{ref:$,id:`${a}-${i}`,className:(0,pe.A)("symbol-set",Me&&"symbol-set-locked"),children:[!g&&(0,ie.FD)("div",{className:"symbol-set-header",children:[(0,ie.FD)("p",{className:(0,pe.A)("symbol-set-title",Je&&"symbol-set-title-external"),children:[Me&&(0,ie.Y)(Q.A,{name:"lock-badge",className:"symbol-set-locked-icon"}),(0,ie.Y)("span",{className:"symbol-set-name",children:e.title}),(C||y)&&(0,ie.Y)("span",{className:"symbol-set-chat",children:X(C?"GroupEmoji":"GroupStickers")}),Je&&Boolean(e.stickers)&&(0,ie.Y)("span",{className:"symbol-set-amount",children:X(be?"EmojiCount":"Stickers",e.stickers.length,"i")})]}),ve&&(0,ie.Y)(Q.A,{className:"symbol-set-remove",name:"close",onClick:se}),Je&&(0,ie.Y)(Z.A,{className:"symbol-set-add-button",withPremiumGradient:Ce&&!v,onClick:Se,pill:!0,size:"tiny",fluid:!0,children:Ge})]}),(0,ie.FD)("div",{className:(0,pe.A)("symbol-set-container shared-canvas-container",ce,e.id===o.hfH&&"effect-emojis"),style:`height: ${Ue}px;`,children:[(0,ie.Y)("canvas",{ref:q,className:"shared-canvas",style:Be?`height: ${_e}px;`:void 0}),(ve||Ae||Be)&&(0,ie.Y)("canvas",{ref:W,className:"shared-canvas"}),A&&(0,ie.Y)(Z.A,{className:"StickerButton custom-emoji",color:"translucent",onClick:ke,children:(0,ie.Y)("img",{src:Sr,alt:"Reset",className:"sticker-media",draggable:!1})},"default-topic-icon"),b&&(0,ie.Y)(Z.A,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:Ne,children:(0,ie.Y)(Q.A,{name:"star"})},"default-status-icon"),de&&e.reactions?.map(i=>{const s=(0,l.Jj)(i),n=s?f?.includes(s):void 0;return(0,ie.Y)(yr,{reaction:i,isSelected:n,loadAndPlay:t,availableReactions:h,observeIntersection:I,onClick:D,onContextMenu:B,sharedCanvasRef:q,sharedCanvasHqRef:W,forcePlayback:N},`${e.id}_${s}`)}),de&&e.stickers?.slice(0,Le?xe:e.stickers.length).map((i,s)=>{const a=(ve||Ae)&&(0,c.CzR)((0,n.mS)(),i.stickerSetInfo),r=Be&&s>=xe||a?W:q,l=i.isCustomEmoji?i.id:i.emoji,d=l?f?.includes(l):void 0,h=e.id===o.j1l||Ke?.has(i.id),p=(0,ie.Y)(gr,{sticker:i,size:Ie,observeIntersection:I,observeIntersectionForShowing:P,noPlay:!t,isSavedMessages:u,isStatusPicker:m,canViewSet:!0,noContextMenu:k,isCurrentUserPremium:v,shouldIgnorePremium:C,sharedCanvasRef:r,withTranslucentThumb:S,onClick:L,clickArg:i,isSelected:d,onUnfaveClick:Ae&&Oe?.has(i.id)?R:void 0,onFaveClick:Oe?.has(i.id)?void 0:x,onRemoveRecentClick:ve?E:void 0,onContextMenuOpen:V,onContextMenuClose:_,onContextMenuClick:U,forcePlayback:N,isEffectEmoji:e.id===o.hfH,noShowPremium:v&&(e.id===o.Kp3||e.id===o.hfH)},i.id);return h?(0,ie.Y)(fr.A,{className:"gift-effect-wrapper",withSparkles:!0,children:p}):p}),Le&&Ee>xe&&(0,ie.FD)(Z.A,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:Re,children:["+",Ee-xe]},"more")]}),ve&&(0,ie.Y)(ci.A,{text:X(p?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:te,onClose:ne,confirmHandler:ye,confirmIsDestructive:!0})]},e.id)}));function Nr(e){return e>440?8:e<362?6:7}const wr="p7c8y0LH",Ir="zTGriBHY",Pr="Qn3lBUNs",Yr="HMspKpNp",Fr="YKO0Obwy",Dr="BZfaP1GD",Mr=2.5*g.$,Tr=new Set([o.sR2,o.tRH,o.EPW]),Br=new Set([o.sR2,o.tRH,o.EPW]),Lr=(0,s.ph)((0,n.EK)((e,{chatId:t,isStatusPicker:i,isReactionPicker:s})=>{const{stickers:{setsById:n},customEmojis:{byId:a,featuredIds:o,statusRecent:{emojis:r}},recentCustomEmojis:l,reactions:{availableReactions:d,recentReactions:h,topReactions:u,defaultTags:m}}=e,p=Boolean(t&&(0,c.nZ4)(e,t)),v=t?(0,c.AWZ)(e,t):void 0,g=e.collectibleEmojiStatuses?.statuses;return{customEmojisById:a,recentCustomEmojiIds:i?void 0:l,recentStatusEmojis:i?r:void 0,collectibleStatuses:i?g:void 0,stickerSetsById:n,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,c.BWX)(e),isSavedMessages:p,isCurrentUserPremium:(0,c.g29)(e),customEmojiFeaturedIds:o,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:s?u:void 0,recentReactions:s?h:void 0,chatEmojiSetId:v?.emojiSet?.id,isWithPaidReaction:s&&v?.isPaidReactionAvailable,availableReactions:s?d:void 0,defaultTagReactions:s?m:void 0}})(({className:e,pickerListClassName:t,isHidden:i,loadAndPlay:a,addedCustomEmojiIds:r,customEmojisById:d,recentCustomEmojiIds:h,selectedReactionIds:m,recentStatusEmojis:p,collectibleStatuses:v,stickerSetsById:g,chatEmojiSetId:A,topReactions:f,recentReactions:b,availableReactions:C,idPrefix:y="custom-emoji-set",customEmojiFeaturedIds:S,canAnimate:k,isReactionPicker:N,isStatusPicker:w,isTranslucent:I,isSavedMessages:P,isCurrentUserPremium:F,withDefaultTopicIcons:D,defaultTopicIconsId:B,defaultStatusIconsId:L,defaultTagReactions:R,isWithPaidReaction:x,onCustomEmojiSelect:E,onReactionSelect:V,onReactionContext:_,onContextMenuOpen:U,onContextMenuClose:O,onContextMenuClick:K})=>{const J=(0,s.li)(),G=(0,s.li)(),j=(0,s.li)(),z=(0,s.li)(),{isMobile:H}=(0,Y.Ay)(),{handleScroll:$,isAtBeginning:q}=(0,ps.A)(),W=(0,s.Kr)(()=>w?p:Object.values((0,pi._E)(d,h)),[d,w,h,p]),X=(0,s.Kr)(()=>{const e=v?.map(e=>e.documentId);return d&&e?.map(e=>d[e]).filter(Boolean)},[d,v]),ee=`${y}-custom-emoji`,{activeSetIndex:te,observeIntersectionForSet:se,observeIntersectionForPlayingItems:ne,observeIntersectionForShowingItems:oe,observeIntersectionForCovers:re,selectStickerSet:le}=rr(J,G,ee,i),ce=(0,Hi.A)(a||void 0,o.jhd),de=(0,T.A)(),he=(0,Ri.A)(),ue=Boolean(r),me=(0,s.Kr)(()=>{const e=[];if(N&&P&&R?.length&&e.push({id:o.G3A,accessHash:"",title:de("PremiumPreviewTags"),reactions:R,count:R.length,isEmoji:!0}),N&&!P){const t=f?.slice(0,16)||[];x&&t.unshift({type:"paid"}),t?.length&&e.push({id:o.G3A,accessHash:"",title:de("Reactions"),reactions:t,count:t.length,isEmoji:!0});const i=(b||[]).filter(e=>!t.some(t=>(0,l.a0)(t,e))).slice(0,32),s=(C||[]).filter(({isInactive:e})=>!e).map(({reaction:e})=>e).filter(e=>!t.some(t=>(0,l.a0)(t,e))&&!i.some(t=>(0,l.a0)(t,e)));if(s?.length||i?.length){const t=!i?.length,n=i.concat(s);e.push({id:t?o.EPW:o.sR2,accessHash:"",title:de(t?"PopularReactions":"RecentStickers"),reactions:n,count:n.length,isEmoji:!0})}}else if(w){const t=g[L];if(t?.stickers?.length){const i=(0,pi.Xd)(t.stickers.slice(0,7).concat(W||[]),"id");e.push({...t,stickers:i,count:i.length,id:o.sR2,title:de("RecentStickers"),isEmoji:!0})}X?.length&&e.push({id:o.j1l,accessHash:"",count:X.length,stickers:X,title:he("CollectibleStatusesCategory"),isEmoji:!0})}else if(D){const t=g[B];t.stickers?.length&&e.push({...t,id:o.sR2,title:de("RecentStickers")})}else W?.length&&e.push({id:o.sR2,accessHash:"0",title:de("RecentStickers"),stickers:W,count:W.length,isEmoji:!0});const t=[...r||[]];A&&t.unshift(A);const i=(0,pi.Am)(t.concat(S||[])),s=Object.values((0,pi._E)(g,i));return[...e,...s]},[r,N,w,D,W,S,g,f,C,de,b,L,B,P,R,A,x,X,he]),ve=(0,s.Kr)(()=>ue&&0===me.filter(e=>e.stickers?.length).length,[me,ue]),ge=(0,ir.A)([],o.jhd),Ae=ue&&ge&&!ve;(0,yn.A)(G,H||!Ae),(0,s.vJ)(()=>{if(!ue)return;const e=G.current;if(!e)return;const t=te*Mr-(e.offsetWidth/2-Mr/2);(0,ga.A)(e,t)},[ue,te]);const fe=(0,M.A)(e=>{E(e)}),be=(0,pe.A)("StickerPicker","Qk9PEGRE",e),Ce=(0,pe.A)(Pr,"no-scrollbar",!q&&Yr),ye=(0,pe.A)(wr,"U0BL1VvK",u.TF?"no-scrollbar":"custom-scroll",t,Ir),Se=!Ae&&!ve;return(0,ie.Y)(ae.Ay,{className:be,name:"fade",activeKey:Se?0:1,shouldCleanup:!0,children:Ae||ve?!Ae&&ve?(0,ie.Y)("div",{className:Dr,children:de("NoStickers")}):(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{ref:G,className:Ce,children:(0,ie.FD)("div",{className:"shared-canvas-container",children:[(0,ie.Y)("canvas",{ref:j,className:"shared-canvas"}),(0,ie.Y)("canvas",{ref:z,className:"shared-canvas"}),me.map(function(e,t){const i=e.stickers?.[0],s=(0,pe.A)(Fr,t===te&&"WYeuJNQx"),a=t<o.j41,r=(0,c.CzR)((0,n.mS)(),e);if(e.id!==o.G3A){if(Br.has(e.id)||e.hasThumbnail||!i){const i=e.id===o.sR2||e.id===o.EPW,n=Tr.has(e.id);return(0,ie.Y)(Z.A,{className:s,ariaLabel:e.title,round:!0,faded:n,color:"translucent",onClick:()=>le(i?0:t),children:i?(0,ie.Y)(Q.A,{name:"recent"}):(0,ie.Y)(ur,{stickerSet:e,noPlay:!k||!ce,forcePlayback:!0,observeIntersection:re,sharedCanvasRef:a?r?z:j:void 0})},e.id)}return(0,ie.Y)(gr,{sticker:i,size:o.TBj,title:e.title,className:s,noPlay:!k||!ce,observeIntersection:re,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?r?z:j:void 0,withTranslucentThumb:I,onClick:le,clickArg:t,forcePlayback:!0},e.id)}})]})}),(0,ie.Y)("div",{ref:J,onScroll:$,className:ye,children:me.map((e,t)=>{const i=e.id===o.G3A||e.id===o.sR2&&(D||w),s=e.id===A;return(0,ie.Y)(kr,{stickerSet:e,loadAndPlay:Boolean(k&&ce),index:t,idPrefix:ee,observeIntersection:se,observeIntersectionForPlayingItems:ne,observeIntersectionForShowingItems:oe,isNearActive:te>=t-1&&te<=t+1,isSavedMessages:P,isStatusPicker:w,isReactionPicker:N,shouldHideHeader:i,withDefaultTopicIcon:D&&e.id===o.sR2,withDefaultStatusIcon:w&&e.id===o.sR2,isChatEmojiSet:s,isCurrentUserPremium:F,selectedReactionIds:m,availableReactions:C,isTranslucent:I,onReactionSelect:V,onReactionContext:_,onStickerSelect:fe,onContextMenuOpen:U,onContextMenuClose:O,onContextMenuClick:K,forcePlayback:!0},e.id)})})]}):(0,ie.Y)(Ms.A,{})})}));var Rr=i(3325);const xr=(0,s.ph)((0,n.EK)(e=>({areFeaturedStickersLoaded:Boolean(e.customEmojis.featuredIds?.length),isTranslucent:(0,c.cwE)(e)}))(({isOpen:e,statusButtonRef:t,areFeaturedStickersLoaded:i,isTranslucent:a,onEmojiStatusSelect:o,onClose:r})=>{const{loadFeaturedEmojiStickers:l}=(0,n.ko)(),c=(0,s.li)(),[d,h,u]=(0,F.A)();(0,s.vJ)(()=>{c.current=t.current.getBoundingClientRect().right},[e,t]),(0,s.vJ)(()=>{e&&!i&&l()},[i,e,l]);const m=(0,s.hb)(e=>{o(e),r()},[r,o]);return(0,ie.Y)(Rr.A,{children:(0,ie.Y)(We.A,{isOpen:e,noCompact:!0,positionX:"right",bubbleClassName:"hRzvfaRb",onClose:r,transformOriginX:c.current,noCloseOnBackdrop:d,children:(0,ie.Y)(Lr,{idPrefix:"status-emoji-set-",loadAndPlay:e,isHidden:!e,isStatusPicker:!0,isTranslucent:a,onContextMenuOpen:h,onContextMenuClose:u,onCustomEmojiSelect:m,onContextMenuClick:r})})})}));var Er=i(10187);const Vr=6*g.$,_r=(0,s.ph)((0,n.EK)((e,{modal:t})=>({currentUser:(0,c.mBe)(e,e.currentUserId),bot:t?.botId?(0,c.mBe)(e,t.botId):void 0}))(({modal:e,currentUser:t,bot:i})=>{const{setEmojiStatus:a,closeSuggestedStatusModal:o,sendWebAppEvent:r}=(0,n.ko)(),c=(0,Ri.A)(),d=Boolean(e),h=(0,Yi.A)(e),u=(0,s.Kr)(()=>{if(t&&h)return{...t,emojiStatus:{type:"regular",documentId:h.customEmojiId}}},[t,h]),m=(0,s.Kr)(()=>{if(!h||!i)return;const e=(0,l.Yg)(i);return h.duration?c("BotSuggestedStatusFor",{bot:e,duration:(0,$e.A$)(c,h.duration)},{withNodes:!0,withMarkdown:!0}):c("BotSuggestedStatus",{bot:e},{withNodes:!0,withMarkdown:!0})},[i,c,h]),p=(0,M.A)(()=>{const e=h?.webAppKey;e&&r({webAppKey:e,event:{eventType:"emoji_status_failed",eventData:{error:"USER_DECLINED"}}}),o()}),v=(0,M.A)(()=>{if(!h)return;const e=h.duration?(0,Ti.Fm)()+h.duration:void 0;a({referrerWebAppKey:h.webAppKey,emojiStatus:{type:"regular",documentId:h.customEmojiId,until:e}}),o()});return(0,ie.FD)(ee.A,{isOpen:d,contentClassName:"C9sWDINB",hasAbsoluteCloseButton:!0,isSlim:!0,onClose:p,children:[h&&(0,ie.Y)(ha.A,{className:"gdG3oY21",documentId:h.customEmojiId,size:Vr,loopLimit:1,forceAlways:!0}),(0,ie.FD)("div",{children:[(0,ie.Y)("h3",{className:"KVpsce1g",children:c("BotSuggestedStatusTitle")}),(0,ie.Y)("p",{className:"p7S4AH8A",children:m})]}),u&&(0,ie.Y)(Er.A,{mockPeer:u,withEmojiStatus:!0}),(0,ie.Y)(Z.A,{onClick:v,children:c("GeneralConfirm")})]})}));var Ur=i(55317),Or=i(20333);const Kr="j6xEoljc";function Jr(e,t){return e.find(e=>!e.chatId)||e.filter(e=>t&&e.chatId!==t).sort((e,t)=>e.date-t.date)[0]}const Gr=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t&&(0,c.hds)(e,t?.chatId),s=i&&(0,c.AWZ)(e,i.id),n=t?.myBoosts&&Jr(t.myBoosts,t.chatId);return{chat:i,chatFullInfo:s,prevBoostedChat:n?.chatId?(0,c.hds)(e,n?.chatId):void 0,isCurrentUserPremium:(0,c.g29)(e)}})(({modal:e,chat:t,chatFullInfo:i,prevBoostedChat:a,isCurrentUserPremium:o})=>{const{applyBoost:r,closeBoostModal:c,requestConfetti:d,openPremiumModal:h,loadFullChat:u}=(0,n.ko)(),[m,p,v]=(0,F.A)(),[g,A,f]=(0,F.A)(),[b,C,y]=(0,F.A)(),S=t&&(0,l.WX)(t),k=Boolean(e),N=(0,T.A)(),w=(0,Ri.A)();(0,s.vJ)(()=>{t&&!i&&u({chatId:t.id})},[t,i]);const I=(0,s.Kr)(()=>{if(t)return(0,l.Js)(N,t)},[t,N]),P=(0,s.Kr)(()=>{if(a)return(0,l.Js)(N,a)},[a,N]),{isStatusLoaded:Y,isBoosted:D,boost:B,title:L,leftText:R,rightText:x,value:E,progress:V,descriptionText:_,canBoostMore:U}=(0,s.Kr)(()=>{if(!e?.boostStatus||!t)return{isStatusLoaded:!1,title:N("Loading")};const{hasMyBoost:s}=e.boostStatus,n=e?.myBoosts&&Jr(e.myBoosts,t.id),a=e?.myBoosts&&(o=e.myBoosts,r=t.id,!o.every(e=>e.chatId===r));var o,r;const{boosts:c,currentLevel:d,hasNextLevel:h,levelProgress:u,remainingBoosts:m,isMaxLevel:p}=(0,Ur.z)(e.boostStatus,!0),v=s,g=N("BoostsLevel",d),A=h?N("BoostsLevel",d+1):void 0,f=N("ChannelBoost.MoreBoosts",m),b=N(S?"BoostChannel":"BoostGroup"),C=(i?.boostsToUnrestrict||0)-(i?.boostsApplied||0);let y;if(p)y=N("BoostsMaxLevelReached");else if(C>0&&!(0,l.SJ)(t)){const e=N("GroupBoost.BoostToUnrestrict.Times",C);y=N("GroupBoost.BoostToUnrestrict",[e,I])}else y=N("ChannelBoost.MoreBoostsNeeded.Text",[I,f]);return{isStatusLoaded:!0,title:b,leftText:g,rightText:A,value:c.toString(),progress:u,remainingBoosts:m,descriptionText:y,boost:n,isBoosted:v,canBoostMore:a&&!p}},[t,I,e,N,i,S]),O=!e?.myBoosts?.length&&o,K=B?.chatId&&B.chatId!==e?.chatId,J=(0,M.A)(()=>{v(),r({chatId:t.id,slots:[B.slot]}),d({})}),G=(0,M.A)(()=>{h(),y(),c()}),j=(0,M.A)(()=>{if(!B)return o?void c():void C();U?B.cooldownUntil?A():K?p():J():c()}),z=(0,M.A)(()=>{c()});return(0,ie.FD)(ee.A,{isOpen:k,title:L,className:"IK2mBqbm",contentClassName:"pUyNTysT",onClose:c,children:[Y?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(Or.A,{leftText:R,rightText:x,progress:V,floatingBadgeText:E,floatingBadgeIcon:"boost"}),D&&(0,ie.Y)("div",{className:(0,pe.A)(Kr,"hAA6B1lc"),children:N("ChannelBoost.YouBoostedChannelText",I)}),(0,ie.Y)("div",{className:Kr,children:(0,Mt.A)(_,["simple_markdown","emoji"])}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",disabled:O,onClick:j,children:U?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(Q.A,{name:"boost"}),N(S?"ChannelBoost.BoostChannel":"GroupBoost.BoostGroup")]}):N("OK")}),(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:z,children:N("Cancel")})]})]}):(0,ie.Y)(Ms.A,{className:"zjXCH3pT"}),K&&P&&(0,ie.FD)(ee.A,{isOpen:m,className:"GIFAjZPY",contentClassName:"Jxyz9TaL",onClose:v,children:[(0,ie.FD)("div",{className:"OKp6HS1U",children:[(0,ie.FD)("div",{className:"NU9itcIm",children:[(0,ie.Y)(Tt.A,{peer:a,size:"large"}),(0,ie.Y)(Q.A,{name:"boostcircle",className:"upXvhNRY"})]}),(0,ie.Y)(Q.A,{name:"next",className:"WSJdWV7L"}),(0,ie.Y)(Tt.A,{peer:t,size:"large"})]}),(0,ie.Y)("div",{children:(0,Mt.A)(N("ChannelBoost.ReplaceBoost",[P,I]),["simple_markdown","emoji"])}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:J,children:N("Replace")}),(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:v,children:N("Cancel")})]})]}),Boolean(B?.cooldownUntil)&&(0,ie.Y)(ci.A,{isOpen:g,isOnlyConfirm:!0,confirmLabel:N("OK"),title:N("ChannelBoost.Error.BoostTooOftenTitle"),onClose:f,confirmHandler:f,children:(0,Mt.A)(N("ChannelBoost.Error.BoostTooOftenText",(0,$e.A$)(w,B.cooldownUntil-(0,Ti.Fm)())),["simple_markdown","emoji"])}),!o&&(0,ie.Y)(ci.A,{isOpen:b,confirmLabel:N("Common.Yes"),title:N("PremiumNeeded"),onClose:y,confirmHandler:G,children:(0,Mt.A)(N("PremiumNeededForBoosting"),["simple_markdown","emoji"])})]})}));var jr=i(47058),zr=i(70046);const Hr="xVLGjLub",$r=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{message:i}=t||{},s=i&&(0,c.O5q)(e,i.chatId,i.messageId),n=s&&(0,c.Y7C)(e,s);return{currentUserId:e.currentUserId,messageSender:n}})(({currentUserId:e,modal:t,messageSender:i})=>{const{closeGiftCodeModal:a,applyGiftCode:r,focusMessage:l}=(0,n.ko)(),c=(0,T.A)(),d=Boolean(t),h=!(t?.info.toId&&t?.info.toId!==e||t?.info.usedAt),u=(0,M.A)(()=>{t&&t.info.giveawayMessageId&&(l({chatId:t.info.fromId,messageId:t.info.giveawayMessageId}),a())}),m=(0,M.A)(()=>{h?r({slug:t.slug}):a()}),p=(0,s.Kr)(()=>{if(!t)return;const{slug:e,info:s}=t,n=s.fromId||i?.id,a=(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("img",{src:Ho,alt:"",className:"Mtx4SWww"}),(0,ie.Y)("p",{className:Hr,children:(0,Mt.A)(c("lng_gift_link_about"),["simple_markdown"])}),(0,ie.Y)(jr.A,{title:"BoostingGiftLink",link:`${o.jsp}/giftcode/${e}`})]}),r=[[c("BoostingFrom"),n?{chatId:n}:c("BoostingNoRecipient")],[c("BoostingTo"),s.toId?{chatId:s.toId}:c("BoostingNoRecipient")],[c("BoostingGift"),c("BoostingTelegramPremiumFor",c("Months",s.months,"i"))]];return s.isFromGiveaway&&r.push([c("BoostingReason"),(0,ie.Y)("span",{className:(0,pe.A)(s.giveawayMessageId&&"IzcASdzD"),onClick:u,children:s.isFromGiveaway&&!s.toId?c("BoostingIncompleteGiveaway"):c("BoostingGiveaway")})]),r.push([c("BoostingDate"),(0,$e.L2)(1e3*s.date,c.code,!0)]),{header:a,tableData:r,footer:(0,ie.Y)("span",{className:Hr,children:(0,Mt.A)(s.usedAt?c("BoostingUsedLinkDate",(0,$e.L2)(1e3*s.usedAt,c.code,!0)):c("BoostingSendLinkToAnyone"),["simple_markdown"])})}},[c,i?.id,t]);if(p)return(0,ie.Y)(zr.A,{isOpen:d,title:c("lng_gift_link_title"),tableData:p.tableData,header:p.header,footer:p.footer,buttonText:c(h?"BoostingUseLink":"Close"),onButtonClick:m,onClose:a})}));function qr(e,t){return e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)}const Wr=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{selfDestructAccountDays:i}=t||{};return{selfDestructAccountDays:i}})(({modal:e,selfDestructAccountDays:t})=>{const{closeGiftCodeModal:i,closeDeleteAccountModal:a,setAccountTTL:r}=(0,n.ko)(),l=(0,Ri.A)(),c=Boolean(e),[d,h]=(0,s.J0)(),u=(0,M.A)(e=>30*Number(e)),m=(0,s.Kr)(()=>{if(t)return qr(o.WF4,t/30).toString()},[t]);(0,s.vJ)(()=>{m&&h(m)},[m]);const p=(0,s.Kr)(()=>o.WF4.map(e=>({value:String(e),label:l("Months",{count:e},{pluralValue:1})})),[l]),v=(0,M.A)(e=>{h(e)}),g=(0,M.A)(()=>{d&&r({days:u(d)})}),A=(0,M.A)(()=>{a()});return(0,ie.FD)(ee.A,{isOpen:c,title:l("SelfDestructTitle"),onClose:i,className:"X6K5oA8U",children:[(0,ie.Y)("p",{children:l("SelfDestructSessionsDescription")}),(0,ie.Y)(te.A,{className:"dialog-checkbox-group",name:"quick-reaction-settings",options:p,selected:d,onChange:v,withIcon:!0}),(0,ie.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:g,children:l("Save")}),(0,ie.Y)(Z.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:A,children:l("Cancel")})]})]})})),Qr={root:"OviJR58x",content:"BlpqzGYt",header:"b9RUzfpF",iconWrapper:"l1X5kBUM",icon:"qOoRnv_Y",mainText:"s2SOQSml",description:"wiKBjcl2"},Zr=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig;return{verifyAgeBotUsername:t.verifyAgeBotUsername,verifyAgeMin:t.verifyAgeMin||o.lYi}})(({modal:e,verifyAgeBotUsername:t,verifyAgeMin:i})=>{const{closeAgeVerificationModal:s,openChatByUsername:a}=(0,n.ko)(),o=(0,Ri.A)(),r=Boolean(e),l=(0,M.A)(()=>{t&&a({shouldStartMainApp:!0,username:t}),s()}),c=(0,M.A)(()=>{s()});return(0,ie.FD)(ee.A,{isOpen:r,onClose:c,className:Qr.root,children:[(0,ie.FD)("div",{className:Qr.content,children:[(0,ie.Y)("div",{className:Qr.header,children:(0,ie.Y)("div",{className:Qr.iconWrapper,children:(0,ie.Y)(Q.A,{name:"user",className:Qr.icon})})}),(0,ie.Y)("h2",{className:Qr.title,children:o("TitleAgeVerificationModal")}),(0,ie.Y)("p",{className:Qr.mainText,children:o("TextAgeVerificationModal",{count:i},{withMarkdown:!0,withNodes:!0,pluralValue:i})}),(0,ie.Y)("p",{className:Qr.description,children:o("DescriptionAgeVerificationModal")})]}),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{onClick:l,children:o("ButtonAgeVerification")})})]})}));var Xr=i(34132),el=i(24713);const tl={description:"dl10exNi","picker-wrapper":"gxWY5c6x",pickerWrapper:"gxWY5c6x","picker-header":"h8N7eyob",pickerHeader:"h8N7eyob","picker-header-info":"Rth2Qu07",pickerHeaderInfo:"Rth2Qu07","selection-toggle":"B6eAugx8",selectionToggle:"B6eAugx8",foldersWrapper:"mwcvgD2S",folders:"LKavx8ww",folder:"qglLx5Dn","button-text":"bgaRuEMs",buttonText:"bgaRuEMs","button-badge":"rTe14Z22",buttonBadge:"rTe14Z22"},il=(0,s.ph)(({invite:e,folder:t})=>{const{closeChatlistModal:i,joinChatlistInvite:a}=(0,n.ko)(),o=(0,Ri.A)(),r=(0,T.A)(),[l,c]=(0,s.J0)(e.missingPeerIds),d=Boolean(e.missingPeerIds.length),h=0===e.alreadyPeerIds.length,u=d?e.missingPeerIds.length:0,m=l.length?l.length.toString():void 0,p=h?o("FolderLinkSubtitleNew"):u?o("FolderLinkSubtitleAdd",{chats:o("FolderLinkSubtitleAddCount",{count:u},{pluralValue:u}),title:(0,$i.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})},{withNodes:!0,withMarkdown:!0}):o("FolderLinkSubtitleAlready"),v=(0,s.hb)(()=>{i(),l.length&&a({invite:e,peerIds:l})},[e,l]),g=(0,s.hb)(()=>{const t=l.length===e.missingPeerIds.length;c(t?[]:e.missingPeerIds)},[e.missingPeerIds,l.length]);return(0,ie.FD)("div",{className:tl.content,children:[(0,ie.Y)("div",{className:tl.description,children:(0,Mt.A)(p,["simple_markdown","emoji"])}),(0,ie.FD)("div",{className:(0,pe.A)(tl.pickerWrapper,"custom-scroll"),children:[Boolean(e.missingPeerIds.length)&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:tl.pickerHeader,children:[(0,ie.Y)("div",{className:tl.pickerHeaderInfo,children:r("FolderLinkHeaderChatsJoin",l.length,"i")}),(0,ie.Y)("div",{className:tl.selectionToggle,role:"button",tabIndex:0,onClick:g,children:l.length===e.missingPeerIds.length?r("DeselectAll"):r("SelectAll")})]}),(0,ie.Y)(gi.A,{itemIds:e.missingPeerIds,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ie.Y)("div",{className:tl.pickerHeader,children:(0,ie.Y)("div",{className:tl.pickerHeaderInfo,children:r("FolderLinkHeaderAlready")})}),(0,ie.Y)(gi.A,{itemIds:e.alreadyPeerIds,lockedSelectedIds:e.alreadyPeerIds,selectedIds:e.alreadyPeerIds,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ie.Y)(Z.A,{onClick:v,children:(0,ie.FD)("div",{className:tl.buttonText,children:[!l.length&&r("OK"),Boolean(l.length)&&(0,ie.FD)(ie.FK,{children:[r("FolderLinkButtonJoinPlural",l.length,"i"),(0,ie.Y)(el.A,{className:tl.buttonBadge,text:m,isAlternateColor:!0})]})]})})]})}),sl=(0,s.ph)(({folder:e,suggestedPeerIds:t=vi.p})=>{const{closeChatlistModal:i,leaveChatlist:a}=(0,n.ko)(),o=(0,T.A)(),[r,l]=(0,s.J0)([]),c=r.length?r.length.toString():void 0,d=(0,s.hb)(()=>{const e=r.length===t.length;l(e?[]:t)},[t,r.length]),h=(0,s.hb)(()=>{i(),a({folderId:e.id,peerIds:r})},[e.id,r]);return(0,ie.FD)("div",{className:tl.content,children:[Boolean(t?.length)&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:tl.description,children:(0,Mt.A)(o("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])}),(0,ie.FD)("div",{className:(0,pe.A)(tl.pickerWrapper,"custom-scroll"),children:[(0,ie.FD)("div",{className:tl.pickerHeader,children:[(0,ie.Y)("div",{className:tl.pickerHeaderInfo,children:o("FolderLinkHeaderChatsQuit",r.length,"i")}),(0,ie.Y)("div",{className:tl.selectionToggle,role:"button",tabIndex:0,onClick:d,children:r.length===t.length?o("DeselectAll"):o("SelectAll")})]}),(0,ie.Y)(gi.A,{itemIds:t,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]})]}),(0,ie.Y)(Z.A,{onClick:h,children:(0,ie.FD)("div",{className:tl.buttonText,children:[!r.length&&o("FolderLinkButtonRemove"),Boolean(r.length)&&(0,ie.FD)(ie.FK,{children:[o("FolderLinkButtonRemoveChats"),(0,ie.Y)(el.A,{className:tl.buttonBadge,text:c,isAlternateColor:!0})]})]})})]})}),nl=(0,s.ph)(({invite:e})=>{const{closeChatlistModal:t,joinChatlistInvite:i}=(0,n.ko)(),a=(0,Ri.A)(),o=(0,T.A)(),[r,l]=(0,s.J0)(e.peerIds),c=(0,s.Kr)(()=>{const t=(0,n.mS)().chats.byId;return e.peerIds.filter(e=>!t[e].isNotJoined)},[e.peerIds]),d=r.length-c.length,h=d?d.toString():void 0,u=(0,s.hb)(()=>{t(),i({invite:e,peerIds:r})},[e,r]),m=(0,s.hb)(()=>{const t=r.length===e.peerIds.length;l(t?c:e.peerIds)},[e.peerIds,c,r.length]);return(0,ie.FD)("div",{className:tl.content,children:[(0,ie.Y)("div",{className:tl.description,children:a("FolderLinkSubtitleNew")}),(0,ie.FD)("div",{className:(0,pe.A)(tl.pickerWrapper,"custom-scroll"),children:[(0,ie.FD)("div",{className:tl.pickerHeader,children:[(0,ie.Y)("div",{className:tl.pickerHeaderInfo,children:o("FolderLinkHeaderChatsJoin",d,"i")}),(0,ie.Y)("div",{className:tl.selectionToggle,role:"button",tabIndex:0,onClick:m,children:r.length===e.peerIds.length?o("DeselectAll"):o("SelectAll")})]}),(0,ie.Y)(gi.A,{itemIds:e.peerIds,lockedSelectedIds:c,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ie.Y)(Z.A,{onClick:u,disabled:!r.length,children:(0,ie.FD)("div",{className:tl.buttonText,children:[a("FolderLinkAddFolder"),(0,ie.Y)(el.A,{className:tl.buttonBadge,text:h,isAlternateColor:!0})]})})]})}),al=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{invite:i,removal:s}=t||{},n=s?.folderId||(i&&"folderId"in i?i.folderId:void 0);return{folder:n?(0,c.$aQ)(e,n):void 0}})(({modal:e,folder:t})=>{const{closeChatlistModal:i}=(0,n.ko)(),a=(0,T.A)(),o=Boolean(e),r=(0,U.A)(e)||e,l=(0,U.A)(t)||t,c=(0,s.Kr)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?a("FolderLinkTitleAddChats"):a("FolderLinkTitleAlready"):a("FolderLinkTitleAdd")}return r.removal?a("FolderLinkTitleRemove"):void 0}},[a,r]),d=(0,s.Kr)(()=>l?(0,$i.fd)({text:l.title.text,entities:l.title.entities,noCustomEmojiPlayback:l.noTitleAnimations}):r?.invite&&"title"in r.invite?(0,$i.fd)({text:r.invite.title.text,entities:r.invite.title.entities,noCustomEmojiPlayback:r.invite.noTitleAnimations}):void 0,[l,r]),h=(0,s.Kr)(()=>{if(r?.invite)return"missingPeerIds"in r.invite?r.invite.missingPeerIds.length:void 0},[r]),u=(0,s.hb)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?(0,ie.Y)(il,{invite:e,folder:l}):(0,ie.Y)(nl,{invite:e})}return r.removal?(0,ie.Y)(sl,{folder:l,suggestedPeerIds:r.removal.suggestedPeerIds}):void 0}},[l,r]);return(0,ie.FD)(ee.A,{isOpen:o,title:c,onClose:i,isSlim:!0,hasCloseButton:!0,children:[d&&(m=d,(0,ie.Y)("div",{className:tl.foldersWrapper,children:(0,ie.FD)("div",{className:tl.folders,children:[(0,ie.Y)(Xr.A,{className:tl.folder,title:a("FolderLinkPreviewLeft")}),(0,ie.Y)(Xr.A,{className:tl.folder,isActive:!0,badgeCount:h,isBadgeActive:!0,title:m}),(0,ie.Y)(Xr.A,{className:tl.folder,title:a("FolderLinkPreviewRight")})]})})),u()]});var m}));var ol=i(29886);const rl={content:"MZ0RCecx",title:"ar8XeydN",participantCount:"un00TXYY",participants:"YvkZ6c2D",participant:"DHJSBDeE",buttons:"KFtrPtNr"},ll=(0,s.ph)(({modal:e})=>{const{acceptChatInvite:t,closeChatInviteModal:i,showNotification:a}=(0,n.ko)(),o=(0,s.li)(),r=(0,T.A)(),d=(0,ol.A)(e),{hash:h,inviteInfo:u}=e||d||{},{about:m,isBroadcast:p,participantIds:v,participantsCount:g,photo:A,isRequestNeeded:f}=u||{},b=(0,M.A)(()=>{i()}),C=(0,M.A)(()=>{t({hash:h}),f&&a({message:r(p?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),b()}),y=p?"ProfileJoinChannel":"JoinGroup",S=p?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup",k=(0,s.Kr)(()=>{if(u)return(0,l.nr)(u)},[u]),N=(0,s.Kr)(()=>{if(!v)return;const e=(0,n.mS)();return v.map(t=>(0,c.mBe)(e,t)).filter(Boolean)},[v]);return(0,yn.A)(o,!e||!N),(0,ie.FD)(ee.A,{isOpen:Boolean(e),contentClassName:rl.content,isSlim:!0,onClose:b,onEnter:C,children:[k&&(0,ie.Y)(Tt.A,{size:"jumbo",photo:A,peer:k,withVideo:!0}),k&&(0,ie.Y)(Ts.A,{className:rl.title,peer:k}),m&&(0,ie.Y)("p",{className:rl.about,children:m}),(0,ie.Y)("p",{className:rl.participantCount,children:r(p?"Subscribers":"Members",g,"i")}),N&&(0,ie.Y)("div",{ref:o,className:(0,pe.A)(rl.participants,"no-scrollbar"),children:N.map(e=>(0,ie.Y)(wn.A,{className:rl.participant,peer:e,text:(0,l.Yg)(e)}))}),(0,ie.FD)("div",{className:(0,pe.A)("dialog-buttons",rl.buttons),children:[(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:C,children:r(f?S:y)}),(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:b,children:r("Cancel")})]})]})});var cl=i(84685),dl=i(89873),hl=i(5463);const ul="La4sUYaq",ml="Bn5kz5br",pl=(0,s.ph)((0,n.EK)(e=>({minLevelToRestrictAds:e.appConfig.channelRestrictAdsLevelMin}))(({modal:e,minLevelToRestrictAds:t})=>{const{closeAboutAdsModal:i}=(0,n.ko)(),a=(0,s.li)(),o=Boolean(e),r=(0,Yi.A)(e),{canReport:l,randomId:c,additionalInfo:d,sponsorInfo:h}=r||{},u=l,m=(0,Yi.A)(u),p=(0,T.A)(),v=(0,s.Kr)(()=>(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{children:p("SponsoredMessageInfoScreen.Title")}),(0,ie.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription1"),["br"])}),(0,ie.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription2"),["br"])}),(0,ie.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription3"),["br"])}),(0,ie.Y)("p",{children:(0,ie.Y)(cl.A,{url:p("SponsoredMessageAlertLearnMoreUrl"),text:p("SponsoredMessageAlertLearnMoreUrl")})}),(0,ie.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription4"),["br"])})]}),[p]),{isContextMenuOpen:g,contextMenuAnchor:A,handleContextMenu:f,handleContextMenuClose:b,handleContextMenuHide:C}=(0,vn.A)(a,!m),y=(0,M.A)(()=>{i(),b(),C()}),S=(0,s.Kr)(()=>{if(o)return{header:(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:ul,children:p("AboutRevenueSharingAds")}),(0,ie.Y)("p",{className:(0,pe.A)(ml,"hbsLlXSH"),children:p("RevenueSharingAdsAlertSubtitle")}),(0,ie.Y)(Z.A,{ref:a,round:!0,size:"smaller",color:"translucent",className:"JdN5pGTw",onClick:f,children:(0,ie.Y)(Q.A,{name:"more"})})]}),listItemData:[["lock",p("RevenueSharingAdsInfo1Title"),(0,Mt.A)(p("RevenueSharingAdsInfo1Subtitle"),["simple_markdown"])],["revenue-split",p("RevenueSharingAdsInfo2Title"),(0,Mt.A)(p("RevenueSharingAdsInfo2Subtitle"),["simple_markdown"])],["nochannel",p("RevenueSharingAdsInfo3Title"),(0,Mt.A)(p("RevenueSharingAdsInfo3Subtitle",t),["simple_markdown"])]],footer:(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:ul,children:(0,Mt.A)(p("RevenueSharingAdsInfo4Title"),["simple_markdown"])}),(0,ie.FD)("p",{className:ml,children:[(0,Mt.A)(p("RevenueSharingAdsInfo4Subtitle2",""),["simple_markdown"]),(0,ie.Y)(cl.A,{url:p("PromoteUrl"),text:p("LearnMoreArrow")})]})]})}},[o,p,f,t]);return m?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(hl.A,{isOpen:o,listItemData:S?.listItemData,headerIconName:"channel",headerIconPremiumGradient:!0,withSeparator:!0,header:S?.header,footer:S?.footer,buttonText:p("RevenueSharingAdsUnderstood"),onClose:y}),A&&c&&(0,ie.Y)(dl.A,{isOpen:g,anchor:A,triggerRef:a,randomId:c,additionalInfo:d,canReport:l,sponsorInfo:h,shouldSkipAbout:!0,onItemClick:y,onClose:b,onCloseAnimationEnd:C})]}):(0,ie.FD)(ee.A,{isOpen:o,className:"LFkgLoAk",contentClassName:"TZE15Pt_",onClose:y,children:[v,(0,ie.Y)(Z.A,{onClick:y,children:p("RevenueSharingAdsUnderstood")})]})})),vl="t9iZUzOj",gl=(0,s.ph)(({isOpen:e,onClose:t})=>{const i=(0,T.A)(),n=(0,Ri.A)(),a=(0,s.Kr)(()=>{const e=i("LearnMore");return n("ChannelEarnLearnCoinAbout",{link:(0,ie.FD)(cl.A,{url:i("MonetizationInfoTONLink"),text:e,children:[e,(0,ie.Y)(Q.A,{name:"next"})]})},{withNodes:!0})},[n,i]),o=(0,s.Kr)(()=>n("MonetizationInfoTONTitle",void 0,{withNodes:!0,specialReplacement:{"💎":(0,ie.Y)(Q.A,{className:"ATkOSqJ7",name:"toncoin"})}}),[n]),r=(0,s.Kr)(()=>{if(e)return{header:(0,ie.Y)("h3",{className:vl,children:i("lng_channel_earn_learn_title")}),listItemData:[["channel",i("lng_channel_earn_learn_in_subtitle"),(0,Mt.A)(i("lng_channel_earn_learn_in_about"),["simple_markdown"])],["revenue-split",i("lng_channel_earn_learn_split_subtitle"),(0,Mt.A)(i("Monetization.Intro.Split.Text"),["simple_markdown"])],["cash-circle",i("lng_channel_earn_learn_out_subtitle"),(0,Mt.A)(i("lng_channel_earn_learn_out_about"),["simple_markdown"])]],footer:(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:vl,children:o}),(0,ie.Y)("p",{className:"mjveZmdr",children:a})]})}},[e,i,o,a]);if(r)return(0,ie.Y)(hl.A,{isOpen:e,listItemData:r.listItemData,headerIconName:"cash-circle",headerIconPremiumGradient:!0,withSeparator:!0,header:r.header,footer:r.footer,buttonText:i("RevenueSharingAdsUnderstood"),onClose:t})});var Al=i(15535);const fl="oofoCYlu",bl=(0,s.ph)((0,n.EK)(e=>{const{twoFaSettings:{hint:t}}=e;return{passwordHint:t}})(({modal:e,passwordHint:t})=>{const{closeMonetizationVerificationModal:i,clearMonetizationVerificationError:a,processMonetizationRevenueWithdrawalUrl:o}=(0,n.ko)(),r=Boolean(e),l=(0,Yi.A)(e),c=(0,Ri.A)(),[d,h]=(0,s.J0)(!1),u=(0,M.A)(e=>{l&&o({peerId:l.chatId,currentPassword:e})}),m=(0,M.A)(()=>{a()}),p=(0,M.A)(()=>{i()});return(0,ie.Y)(ee.A,{isOpen:r,hasCloseButton:!0,title:c("CheckPasswordTitle"),className:"WqeWhMAS",contentClassName:fl,onClose:p,children:(0,ie.Y)("div",{className:(0,pe.A)(fl,"settings-content password-form custom-scroll"),children:(0,ie.Y)("div",{className:"settings-item pt-0",children:(0,ie.Y)(Al.A,{shouldShowSubmit:!0,placeholder:c("CheckPasswordPlaceholder"),error:l?.errorKey&&c.withRegular(l.errorKey),description:c("CheckPasswordDescription"),onClearError:m,isLoading:l?.isLoading,hint:t,isPasswordVisible:d,shouldResetValue:r,onChangePasswordVisibility:h,onSubmit:u})})})})})),Cl={content:"MKdSUg2P",chatItem:"qEIwBtp0"},yl=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.mBe)(e,e.currentUserId),i=(0,c.g29)(e);return{currentUser:t,stickerSet:e.defaultStatusIconsId?(0,c.ycM)(e,e.defaultStatusIconsId):void 0,isPremium:i,isAccountFrozen:(0,c.trm)(e)}})(({modal:e,currentUser:t,stickerSet:i,isPremium:a,isAccountFrozen:o})=>{const{closeEmojiStatusAccessModal:r,toggleUserEmojiStatusPermission:c,sendWebAppEvent:d,openPremiumModal:h,loadDefaultStatusIcons:u}=(0,n.ko)(),m=Boolean(e),p=(0,T.A)(),v=(0,Ri.A)(),g=(0,s.li)(),[A,f]=(0,s.J0)(0);(0,s.vJ)(()=>{!m||i?.stickers||o||u()},[m,i,o]);const b=(0,s.Kr)(()=>{if(t&&i?.stickers)return{...t,emojiStatus:{type:"regular",documentId:i.stickers[A].id}}},[t,i,A]),C=i?.stickers?.length;(0,pn.A)(()=>{C&&f(e=>(e+1)%C)},C?3200:void 0);const y=(0,M.A)(()=>(0,ie.Y)(Er.A,{withEmojiStatus:!0,className:Cl.chatItem,itemClassName:Cl.itemName,mockPeer:b})),S=(0,M.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&(a?(d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"allowed"}}}),c({botId:e.bot.id,isEnabled:!0,isBotAccessEmojiGranted:!0})):(h(),d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}))))}),k=(0,M.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}),a&&c({botId:e.bot.id,isEnabled:!1}))}),N=(0,M.A)(()=>{if(e?.bot)return v("EmojiStatusAccessText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,ie.FD)(ee.A,{className:(0,pe.A)("confirm"),contentClassName:Cl.content,isOpen:m,onClose:k,children:[y(),(0,ie.FD)("div",{children:[N(),(0,ie.FD)("div",{className:"dialog-buttons mt-2",ref:g,children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:S,color:"primary",children:p("lng_bot_allow_write_confirm")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:k,children:v("Cancel")})]})]})]})})),Sl=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({modal:e,currentUser:t})=>{const{closeLocationAccessModal:i,toggleUserLocationPermission:a,sendWebAppEvent:o}=(0,n.ko)(),r=Boolean(e),c=(0,T.A)(),d=(0,Ri.A)(),h=(0,s.li)(),m=(0,M.A)(async()=>{const t=await(0,u.Bu)(),{geolocation:s}=t;e?.bot?.id&&(i(),e?.webAppKey&&(a({botId:e.bot.id,isAccessGranted:!0}),o({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!0,latitude:s?.latitude,longitude:s?.longitude,altitude:s?.altitude,course:s?.heading,speed:s?.speed,horizontal_accuracy:s?.accuracy,vertical_accuracy:s?.accuracy}}})))}),p=(0,M.A)(()=>{e?.bot?.id&&(i(),e?.webAppKey&&(a({botId:e.bot.id,isAccessGranted:!1}),o({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}})))}),v=(0,M.A)(()=>{if(e?.bot)return(0,ie.FD)("div",{className:"CGPoDaLo",children:[(0,ie.Y)(Tt.A,{size:"large",peer:t}),(0,ie.Y)(Q.A,{name:"next",className:"pzERgD5x"}),(0,ie.Y)(Tt.A,{size:"large",peer:e.bot})]})}),g=(0,M.A)(()=>{if(e?.bot)return d("LocationPermissionText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,ie.FD)(ee.A,{className:(0,pe.A)("confirm"),isOpen:r,onClose:p,children:[v(),(0,ie.FD)("div",{children:[g(),(0,ie.FD)("div",{className:"dialog-buttons mt-2",ref:h,children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:m,color:"primary",children:c("lng_bot_allow_write_confirm")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:d("Cancel")})]})]})]})})),kl="qJDgUtjV",Nl=(0,s.ph)(({modal:e})=>{const{reportSponsored:t,closeReportAdModal:i,openPreviousReportAdModal:a}=(0,n.ko)(),o=(0,T.A)(),l=Boolean(e),c=(0,s.li)(),d=(0,M.A)((i,s)=>{const{chatId:n,randomId:a}=e;t({peerId:n,randomId:a,option:s})}),[h,u]=(0,s.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e.sections[t],t]},[e]),m=(0,M.A)(()=>{u?a():i()}),p=(0,s.Kr)(()=>{if(!e)return;const t=o("lng_report_sponsored_reported_learn").split("{link}");return[t[0],(0,ie.Y)(cl.A,{text:o("lng_report_sponsored_reported_link"),url:o("ReportAd.Help_URL")}),t[1]]},[o,e]),v=(0,s.Kr)(()=>{if(!e)return;const t=Boolean(h?.subtitle);return(0,ie.FD)("div",{className:"modal-header-condensed",children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:o(u?"Back":"Close"),onClick:m,children:(0,ie.Y)(Q.A,{name:u?"arrow-left":"close"})}),(0,ie.FD)("div",{className:(0,pe.A)("modal-title","ZAdG13Ah",t&&"lVVyV0py"),children:[(0,ie.Y)("h3",{className:"mMmY6YR4",children:o("ReportAd")}),t&&(0,ie.Y)("span",{className:"gSkAFc4u",children:h.subtitle})]})]})},[o,e,u,h?.subtitle]);(0,s.vJ)(()=>{if(!e)return;const t=document.querySelector(`.${ae.uo} > .${kl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)(()=>{c.current.style.height=`${i+56}px`})},[e]);const g=(0,M.A)(()=>{const e=document.querySelector(`.${ae.VY} > .${kl}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{c.current.style.height=`${t+56}px`})})});return(0,ie.Y)(ee.A,{isOpen:l,hasCloseButton:!0,className:"njPBcVYr",header:v,onClose:i,children:(0,ie.FD)(ae.Ay,{name:"slide",className:"HjsGIG6e",ref:c,activeKey:u,onStart:g,children:[(0,ie.FD)("div",{className:kl,children:[(0,ie.Y)("h3",{className:"jrA2dOiw",children:h?.title}),h?.options.map(e=>(0,ie.Y)(ui.A,{narrow:!0,secondaryIcon:"next",className:"aFbjDzNo",buttonClassName:"VbE0HzDs",clickArg:e.option,onClick:d,children:(0,ie.Y)("div",{className:"oWujoaSC",children:e.text})}))]}),(0,ie.Y)("p",{className:"k71Zrc_P",children:p})]})})}),wl="kq9LwNTZ",Il=(0,s.ph)(({modal:e})=>{const{reportMessages:t,reportStory:i,closeReportModal:a,openPreviousReportModal:o}=(0,n.ko)(),l=(0,T.A)(),c=Boolean(e),d=(0,s.li)(),[h,u]=(0,s.J0)(""),m=(0,M.A)((s,n)=>{const{messageIds:a,subject:o,peerId:r,chatId:l}=e;if(a)switch(o){case"message":t({chatId:l,messageIds:a,option:n});break;case"story":i({storyId:a[0],peerId:r,option:n})}}),[p,v]=(0,s.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e?.sections[t],t]},[e]),g=(0,M.A)(()=>{o()}),A=(0,M.A)(()=>{a()}),f=(0,s.Kr)(()=>{if(!e)return;const t=Boolean(p?.subtitle);return(0,ie.FD)("div",{className:"modal-header-condensed",children:[v?(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Back"),onClick:g,children:(0,ie.Y)(Q.A,{name:"arrow-left"})}):(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Close"),onClick:A,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.FD)("div",{className:(0,pe.A)("modal-title","Lj_ezEWU",t&&"OYFbu8fQ"),children:[(0,ie.Y)("h3",{className:(0,pe.A)("QawchdxB",v&&"CV7kzv9H"),children:p?.options?l("story"===e?.subject?"ReportStory":"Report"):p?.title}),t&&(0,ie.Y)("span",{className:"OUFckTb7",children:p.subtitle})]})]})},[l,e,v,p?.options,p?.subtitle,p?.title]),b=(0,M.A)(e=>{u(e.target.value)});(0,s.vJ)(()=>{if(!e)return;const t=document.querySelector(`.${ae.uo} > .${wl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${i}px`})},[e]);const C=(0,M.A)(()=>{const e=document.querySelector(`.${ae.VY} > .${wl}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${t+20}px`})})}),y=(0,M.A)(()=>{u(""),a()}),S=(0,M.A)(()=>{const{messageIds:s,subject:n,peerId:a,chatId:o}=e;switch(n){case"message":t({chatId:o,messageIds:s,option:p?.option,description:h});break;case"story":i({storyId:s?.[0],peerId:a,option:p?.option,description:h})}y()});return(0,ie.Y)(ee.A,{isOpen:c,header:f,onClose:y,contentClassName:"tNysQgHL",className:(0,pe.A)("E1bGWeON","story"===e?.subject&&"component-theme-dark"),children:(0,ie.Y)(ae.Ay,{name:"slide",className:"n2VxPirU",ref:d,activeKey:v,onStart:C,children:(0,ie.FD)("div",{className:wl,children:[p?.options?(0,ie.Y)("h3",{className:"GSfUuTet",children:p?.title}):void 0,p?.options?.map(e=>(0,ie.Y)(ui.A,{narrow:!0,nonInteractive:!0,secondaryIcon:"next",className:"RoxwMzvA",buttonClassName:"Z6skYdvb",clickArg:e.option,onClick:m,children:(0,ie.Y)("div",{className:"FU8m6NUU",children:e.text})})),p?.option?(0,ie.FD)("div",{className:"KpptZ3Mk",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Report,size:100,className:"kO8JC4gK",nonInteractive:!0,forceAlways:!0,noLoop:!1}),(0,ie.Y)(cn.A,{id:"option",className:"yc3szGcx",label:p.isOptional?l("Report2CommentOptional"):l("Report2Comment"),onChange:b,value:h,maxLength:512,maxLengthIndicator:(512-h.length).toString(),noReplaceNewlines:!0}),(0,ie.Y)(Z.A,{onClick:S,disabled:p.isOptional?void 0:!h.length,children:l("ReportSend")})]}):void 0]})})})});var Pl=i(65632),Yl=i(90596);const Fl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:s,patternColor:n,background:a,backgroundColor:o}=(0,c.Gyz)(e,i)||{};return{theme:i,isBackgroundBlurred:s,patternColor:n,customBackground:a,backgroundColor:o,bot:t?(0,c.mBe)(e,t?.botId):void 0,currentUserId:e.currentUserId}})(({modal:e,theme:t,isBackgroundBlurred:i,patternColor:a,customBackground:o,backgroundColor:r,bot:c})=>{const{closePreparedInlineMessageModal:d,sendWebAppEvent:h,openSharePreparedMessageModal:u}=(0,n.ko)(),m=(0,Ri.A)(),p=Boolean(e),{webAppKey:v,message:g,botId:A}=e||{},f=(0,s.li)(),b=(0,Pl.A)(t,o),C=(0,M.A)(()=>{v&&A&&g&&(u({webAppKey:v,message:g}),d())}),y=(0,M.A)(()=>{d(),v&&h({webAppKey:v,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),S=(0,s.Kr)(()=>{if(e)return(0,ie.FD)("div",{className:"P1fPh6h8",children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:y,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("h3",{className:(0,pe.A)("modal-title","E42tgAwD"),children:m("BotShareMessage")})]})},[m,e]),k=(0,s.Kr)(()=>{if(A&&g&&v)return(0,l.i7)(A,g)},[A,g,v]),N=(0,pe.A)("_6w75ldP","lElCwweL",o&&"CZkpv8n0",r&&"VJAYrDF_",o&&i&&"m8xzfVvU");return(0,ie.FD)(ee.A,{dialogRef:f,isOpen:p,header:S,onClose:y,className:"Rzj2LMLf",contentClassName:"Ve4u2KVI",children:[(0,ie.FD)("div",{className:(0,pe.A)("McJgXCtB","MessageList"),inert:!0,style:(0,wi.A)(`--pattern-color: ${a}`,r&&`--theme-background-color: ${r}`),children:[(0,ie.Y)("div",{className:N,style:b?`--custom-background: ${b}`:void 0}),k&&(0,ie.Y)(Yl.A,{message:k,threadId:K.l3,messageListType:"thread",noComments:!0,noReplies:!0,appearanceOrder:0,isJustAdded:!1,isFirstInGroup:!0,isLastInGroup:!0,isLastInList:!1,isFirstInDocumentGroup:!1,isLastInDocumentGroup:!1},A)]}),(0,ie.FD)("div",{className:"pNSCKAVN",children:[(0,ie.Y)("p",{className:"xWnXsG7q",children:m("WebAppShareMessageInfo",{user:(0,l.Yg)(c)})}),(0,ie.Y)(Z.A,{onClick:C,children:m("BotShareMessageShare")})]})]})}));var Dl=i(20247),Ml=i(48227);const Tl=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{isPaymentMessageConfirmDialogOpen:i}=t;return{isPaymentMessageConfirmDialogOpen:i,starsBalance:e.stars?.balance.amount||0,isStarsBalanceModalOpen:Boolean(t.starsBalanceModal)}})(({modal:e,isPaymentMessageConfirmDialogOpen:t,isStarsBalanceModalOpen:i,starsBalance:a})=>{const{closeSharePreparedMessageModal:o,sendInlineBotResult:r,sendWebAppEvent:l,showNotification:d,updateSharePreparedMessageModalSendArgs:h}=(0,n.ko)(),u=(0,T.A)(),m=Boolean(e),[p,v,g]=(0,F.A)();(0,s.vJ)(()=>{m&&v()},[m,v]);const{message:A,filter:f,webAppKey:b,pendingSendArgs:C}=e||{},{starsForSendMessage:y}=C||{},{closeConfirmDialog:S,dialogHandler:k,shouldAutoApprove:N,setAutoApprove:w,handleWithConfirmation:I}=(0,Dl.A)(y||0,i,a),P=(0,M.A)(()=>{o(),b&&l({webAppKey:b,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),Y=(0,M.A)((e,t)=>{if(A&&b){const i=(0,n.mS)(),s=(0,c.PVB)(i,e);r({chatId:e,threadId:t||K.l3,id:A.result.id,queryId:A.result.queryId}),y||d({message:u("BotSharedToOne",(0,Dt.F9)(u,s))}),l({webAppKey:b,event:{eventType:"prepared_message_sent"}}),o(),h({args:void 0})}}),D=(0,M.A)((e,t)=>{h({args:{peerId:e,threadId:t}})}),B=(0,M.A)(()=>{C&&I(Y,C.peerId,C.threadId)}),L=(0,M.A)(()=>{S(),h({args:void 0})});(0,s.vJ)(()=>{C&&B()},[C]);const R=(0,n.mS)(),x=C?(0,c.PVB)(R,C.peerId):void 0,E=x?(0,Dt.F9)(u,x):void 0;if(m||p)return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(Vs,{isOpen:m,searchPlaceholder:u("Search"),filter:f,onSelectRecipient:D,onClose:P,onCloseAnimationEnd:g,isLowStackPriority:!0}),(0,ie.Y)(Ml.A,{isOpen:t,onClose:L,userName:E,messagePriceInStars:y||0,messagesCount:1,shouldAutoApprove:N,setAutoApprove:w,confirmHandler:k})]})}));var Bl=i(19408);const Ll={content:"iGABsB4C",modalHeader:"Ofq4u4pq",section:"k44LZ99u",form:"VhNBPaMY",label:"anDcU5bi",input:"kYxuUcwe",description:"A_JjwhXv",timeInputIcon:"pHne2E6K",offerButton:"d_PCM2tC",currencySelector:"genSNudF",currencyIcon:"fT5aRs0H"},Rl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=e.stars?.balance,s=t?(0,c.PVB)(e,t.chatId):void 0,n=t?(0,Bl.GA)(e,t.chatId,K.l3):void 0,{appConfig:a}=e,o=a.starsSuggestedPostAmountMax,r=a.starsSuggestedPostAmountMin,l=a.starsSuggestedPostAgeMin,d=a.starsSuggestedPostFutureMin,h=a.starsSuggestedPostFutureMax,u=a.tonSuggestedPostAmountMax,m=a.tonSuggestedPostAmountMin,p=!!t&&(0,c.ODG)(e,t.chatId);return{peer:s,starBalance:i,tonBalance:e.ton?.balance?.amount,currentDraft:n,maxStarsAmount:o,minStarsAmount:r,tonMaxAmount:u,tonMinAmount:m,ageMinSeconds:l,futureMin:d,futureMax:h,isMonoforumAdmin:p}})(({modal:e,starBalance:t,tonBalance:i,peer:a,currentDraft:r,maxStarsAmount:l,minStarsAmount:c,tonMaxAmount:d,tonMinAmount:h,ageMinSeconds:u,futureMin:m,futureMax:p,isMonoforumAdmin:v})=>{const{closeSuggestMessageModal:g,updateDraftSuggestedPostInfo:A,openStarsBalanceModal:f}=(0,n.ko)(),[b,C,y]=(0,F.A)(),S=r?.suggestedPostInfo,k=r?.replyInfo,N=Boolean(k),[w,I]=(0,s.J0)(S?.price?.amount||void 0),[P,Y]=(0,s.J0)(S?.price?.currency||o.OUy),[D,B]=(0,s.J0)(S?.scheduleDate?1e3*S.scheduleDate:void 0);(0,s.vJ)(()=>{const e=S?.price,t=e?.currency===o.ykW?(0,ca.wD)(e.amount):e?.amount;I(t),Y(S?.price?.currency||o.OUy),B(S?.scheduleDate?1e3*S.scheduleDate:void 0)},[S]);const L=(0,Ri.A)(),R=(0,T.A)(),x=P===o.OUy,E=Math.floor(Date.now()/1e3),V=1e3*(E+m),_=1e3*(E+p),U=1e3*(E+2*m),O=(0,M.A)(e=>{const t=e.target.value,i=parseFloat(t),s=""===t||Number.isNaN(i)?void 0:Math.min(Math.max(i,0),j);I(s)}),K=(0,M.A)(e=>{B(e.getTime()),y()}),J=(0,M.A)(()=>{B(void 0),y()}),G=x?c:(0,ca.wD)(h),j=x?l:(0,ca.wD)(d),z=Boolean(w)&&w<G,H=(0,M.A)(()=>{const e=w?x?w:(0,ca.tT)(w):0;if(!z){if(!v)if(x){if(e>(t?.amount||0))return void f({topup:{balanceNeeded:e}})}else if(e>(i||0))return void f({currency:o.ykW});A({price:{currency:P,amount:e,nanos:0},scheduleDate:D?Math.max(D/1e3,(0,Ti.Fm)()+m+60):void 0}),g()}});return(0,ie.Y)(ee.A,{headerClassName:Ll.modalHeader,isOpen:Boolean(e),onClose:g,isSlim:!0,isLowStackPriority:!0,hasCloseButton:!0,contentClassName:Ll.content,title:L(N?"TitleSuggestedChanges":"TitleSuggestMessage"),children:(0,ie.FD)("div",{className:Ll.form,children:[(0,ie.FD)("div",{className:Ll.section,children:[(0,ie.FD)("div",{className:Ll.currencySelector,children:[(0,ie.FD)(Z.A,{className:Ll.currencyButton,color:x?"primary":"translucent",pill:!0,fluid:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(o.OUy),children:[(0,ie.Y)(Q.A,{name:"star",className:Ll.currencyIcon}),L("CurrencyStars")]}),(0,ie.FD)(Z.A,{className:Ll.currencyButton,fluid:!0,color:x?"translucent":"primary",pill:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(o.ykW),children:[(0,ie.Y)(Q.A,{name:"toncoin",className:Ll.currencyIcon}),L("CurrencyTon")]})]}),(0,ie.Y)(X.A,{label:L("InputPlaceholderPrice"),className:(0,pe.A)(Ll.input),value:w?.toString(),onChange:O,inputMode:"numeric",tabIndex:0,teactExperimentControlled:x}),(0,ie.Y)("div",{className:Ll.description,children:void 0!==w&&w>0&&w<G?L("DescriptionSuggestedPostMinimumOffer",{amount:x?(0,Mi.Kk)(L,G):(0,Mi.QH)(L,G)},{withNodes:!0,withMarkdown:!0}):L(x?"SuggestMessagePriceDescriptionStars":"SuggestMessagePriceDescriptionTon")})]}),(0,ie.FD)("div",{className:Ll.section,children:[(0,ie.FD)("div",{className:(0,pe.A)(Ll.input,"input-group","touched"),children:[(0,ie.Y)("input",{type:"text",className:(0,pe.A)("form-control",b&&"focus"),value:D?(0,$e.e0)(D/1e3,L,R):L("SuggestMessageAnytime"),autoComplete:"off",onClick:C,onFocus:C,readOnly:!0}),(0,ie.Y)("label",{children:L("InputTitleSuggestMessageTime")}),(0,ie.Y)(Q.A,{name:"down",className:Ll.timeInputIcon})]}),(0,ie.Y)("div",{className:Ll.description,children:L("SuggestMessageTimeDescription",{hint:L("SuggestMessageDateTimeHint"),duration:(0,$e.A$)(L,u,!0)})})]}),(0,ie.Y)(an,{isOpen:b,isFutureMode:!0,withTimePicker:!0,minAt:V,maxAt:_,onClose:y,onSubmit:K,selectedAt:D||U,submitButtonLabel:L("Save"),secondButtonLabel:L("SuggestMessageAnytime"),onSecondButtonClick:J,description:L("SuggestMessageDateTimeHint")}),(0,ie.Y)(Z.A,{className:Ll.offerButton,onClick:H,disabled:z,children:N?L("ButtonUpdateTerms"):w?L("ButtonOfferAmount",{amount:x?(0,Mi.U2)(L,w,{asFont:!0}):(0,Mi.Ms)(L,w)},{withNodes:!0,withMarkdown:!0}):L("ButtonOfferFree")})]})})})),xl="xqyFGV8R",El=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t&&(0,c.O5q)(e,t.chatId,t.messageId),s=i?(0,c.Y7C)(e,i):void 0,n=t&&(0,c.ODG)(e,t.chatId),{appConfig:a}=e,o=a.starsSuggestedPostCommissionPermille,r=a.tonSuggestedPostCommissionPermille,l=a.starsSuggestedPostAgeMin,d=a.starsSuggestedPostFutureMin,h=a.starsSuggestedPostFutureMax,u=i?.suggestedPostInfo?.scheduleDate;return{minAge:l,futureMin:d,futureMax:h,message:i,sender:s,isAdmin:n,commissionPermille:o,tonCommissionPermille:r,scheduleDate:u}})(({modal:e,message:t,sender:i,isAdmin:a,commissionPermille:r,tonCommissionPermille:l,minAge:c,futureMin:d,futureMax:h,scheduleDate:u})=>{const{closeSuggestedPostApprovalModal:m,approveSuggestedPost:p}=(0,n.ko)(),v=(0,Ri.A)(),g=(0,T.A)(),[A,f,b]=(0,F.A)(),C=Math.floor(Date.now()/1e3),y=1e3*(C+d),S=1e3*(C+h),k=C+2*d,[N,w]=(0,s.J0)(k),I=(0,M.A)(()=>{m()}),P=(0,M.A)(t=>{e&&(p({chatId:e.chatId,messageId:e.messageId,scheduleDate:t}),m())}),Y=(0,M.A)(e=>{const t=Math.floor(e.getTime()/1e3);w(t)}),D=(0,M.A)(e=>{const t=Math.floor(e.getTime()/1e3);b(),P(t)}),B=(0,M.A)(()=>{b(),P()}),L=(0,M.A)(()=>{u?P(u):f()});if(!e||!t)return;const R=i?(0,Dt.em)(g,i):"";return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(ci.A,{isOpen:Boolean(e)&&!A,onClose:I,title:v("SuggestedPostConfirmTitle"),confirmHandler:L,confirmLabel:v(u?"ButtonPublish":"Next"),children:(()=>{const e=t?.suggestedPostInfo?.price,i=e?.amount,s=e?.currency||o.OUy,n=v("SuggestedPostConfirmMessage",{peer:R},{withNodes:!0,withMarkdown:!0}),d=(0,Mt.A)(n);if(!i)return d;const h=(s===o.ykW?l:r)/10,m=i/100*h,p=s===o.ykW?(0,Mi.QH)(v,(0,ca.wD)(m)):(0,Mi.Kk)(v,m),A=c,f=(0,$e.A$)(v,A,!0);if(u){const e=(0,$e.e0)(u,v,g),t=a?"SuggestedPostConfirmDetailsWithTimeAdmin":"SuggestedPostConfirmDetailsWithTimeUser";return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{children:d}),(0,ie.Y)("div",{className:xl,children:(0,Mt.A)(v(t,{amount:p,commission:h,duration:f,time:e},{withNodes:!0,withMarkdown:!0}))})]})}const b=a?"SuggestedPostConfirmDetailsAdmin":"SuggestedPostConfirmDetailsUser";return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{children:d}),(0,ie.Y)("div",{className:xl,children:(0,Mt.A)(v(b,{amount:p,commission:h,duration:f},{withNodes:!0,withMarkdown:!0}))})]})})()}),(0,ie.Y)(an,{isOpen:A,isFutureMode:!0,withTimePicker:!0,minAt:y,maxAt:S,onClose:b,onSubmit:D,onDateChange:Y,selectedAt:1e3*N,submitButtonLabel:v("ButtonPublishAtTime",{time:(0,$e.e0)(N,v,g)}),secondButtonLabel:v("PublishNow"),onSecondButtonClick:B,description:v("SuggestMessageDateTimeHint")})]})})),Vl=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],_l=[...Vl,"sendPlain"];function Ul(e){const[t,i]=(0,s.J0)({}),[n,a]=(0,s.J0)(!1),[o,r]=(0,s.J0)(!1);(0,s.vJ)(()=>{i(e||{}),a(!1),setTimeout(()=>{r(!1)},250)},[e]);const l=(0,s.hb)(s=>{const{name:n}=s.target,o=n;function r(e){return!e||void 0}const l=t;let c={...l,[o]:r(l[o]),..."sendStickers"===o&&{sendGifs:r(l[o])}};const d=()=>{const e=Vl.map(e=>c[e]);e.some(e=>!e)?c={...c,sendMedia:void 0}:e.every(Boolean)&&(c={...c,sendMedia:!0})};"sendMedia"!==o?d():c={...c,...Vl.reduce((e,t)=>Object.assign(e,{[t]:c.sendMedia}),{})},"embedLinks"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==o&&d();const h=_l.every(e=>c[e]);c={...c,sendMessages:!!h||void 0},i(c),a(!e||Object.keys(c).some(t=>{const i=t;return Boolean(e[i])!==Boolean(c[i])}))},[e,t]),c=(0,s.hb)(()=>{i(e||{}),a(!1)},[e]);return{permissions:t,isLoading:o,havePermissionChanged:n,handlePermissionChange:l,setIsLoading:r,resetPermissions:c}}const Ol=["sendPhotos","sendVideos","sendStickers","sendAudios","sendDocs","sendVoices","sendRoundvideos","embedLinks","sendPolls"],Kl=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=t?(0,c.hds)(e,t):void 0,s=i&&(0,c.AWZ)(e,i.id);return{chat:i,hasLinkedChat:Boolean(s?.linkedChatId)}})(({chat:e,isMediaDropdownOpen:t,setIsMediaDropdownOpen:i,hasLinkedChat:a,permissions:o,handlePermissionChange:r,className:c,shiftedClassName:d,dropdownClassName:h,withCheckbox:u,getControlIsDisabled:m,permissionGroup:p})=>{const{showNotification:v}=(0,n.ko)(),{isForum:g}=e||{},A=(0,Ri.A)(),f=(0,s.Kr)(()=>e&&(0,l.gA)(e),[e]),b=a||f,C=(0,s.Kr)(()=>Ol.reduce((e,t)=>(o[t]||(e+=1),e),0),[o]),S=(0,M.A)(e=>{(0,y.A)(e),i(!t)}),k=(0,M.A)(()=>{v({message:A("ChatPermissionNotAvailable")})});return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendPlain",checked:!o.sendPlain,label:A("UserRestrictionsSend"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendPlain")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendMedia",checked:!o.sendMedia,label:A("UserRestrictionsSendMedia"),labelText:`${C}/${Ol.length}`,blocking:!0,permissionGroup:p,rightIcon:t?"up":"down",onChange:r,onClickLabel:S,disabled:m&&m("sendMedia")})}),(0,ie.Y)("div",{className:h,children:(0,ie.FD)("div",{className:c,children:[(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendPhotos",checked:!o.sendPhotos,label:A("SendMediaPermissionPhotos"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendPhotos")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendVideos",checked:!o.sendVideos,label:A("SendMediaPermissionVideos"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendVideos")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendStickers",checked:!o.sendStickers&&!o.sendGifs,label:A("SendMediaPermissionStickersGifs"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendStickers")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendAudios",checked:!o.sendAudios,label:A("SendMediaPermissionAudios"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendAudios")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendDocs",checked:!o.sendDocs,label:A("SendMediaPermissionFiles"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendDocs")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendVoices",checked:!o.sendVoices,label:A("SendMediaPermissionVoices"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendVoices")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendRoundvideos",checked:!o.sendRoundvideos,label:A("SendMediaPermissionRoundVideos"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendRoundvideos")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"embedLinks",checked:!o.embedLinks,label:A("SendMediaPermissionWebPages"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("embedLinks")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"sendPolls",checked:!o.sendPolls,label:A("SendMediaPermissionPolls"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("sendPolls")})})]})}),(0,ie.FD)("div",{className:d,children:[(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"inviteUsers",checked:!o.inviteUsers,label:A("UserRestrictionsInviteUsers"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("inviteUsers")})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),onClick:b?k:void 0,children:(0,ie.Y)(Qs.A,{name:"pinMessages",checked:!o.pinMessages,label:A("UserRestrictionsPinMessages"),disabled:m?m("pinMessages"):b,blocking:!0,permissionGroup:p,onChange:r})}),(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),onClick:b?k:void 0,children:(0,ie.Y)(Qs.A,{name:"changeInfo",checked:!o.changeInfo,label:A("UserRestrictionsChangeInfo"),blocking:!0,permissionGroup:p,disabled:m?m("changeInfo"):b,onChange:r})}),g&&(0,ie.Y)("div",{className:(0,pe.A)("ListItem",u&&"with-checkbox"),children:(0,ie.Y)(Qs.A,{name:"manageTopics",checked:!o.manageTopics,label:A("UserRestrictionsCreateTopics"),blocking:!0,permissionGroup:p,onChange:r,disabled:m&&m("manageTopics")})})]})]})}));var Jl=i(77561);const Gl="yGhFKTl5",jl="goI3MITH",zl=(0,s.ph)((0,n.EK)(e=>{const{deleteMessageModal:t}=(0,c.nTw)(e),i=t?.messageIds,s=t?.chatId,{canDeleteForAll:n}=(0,c.jyG)(e,i),a=s?(0,c.hds)(e,s):void 0,o=a&&(0,c.AWZ)(e,a.id),r=o?.linkedChatId,d=Boolean(a)&&(0,l.WX)(a),h=Boolean(a)&&(0,l.Vs)(a),u=t?.isSchedule,m=t?.onConfirm,p=a&&(0,v.L8)(a.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(a))):void 0,g=Boolean(a&&!(0,l.DX)(a.id)&&(0,c.yps)(e,a.id)),A=o?.adminMembersById,f=a&&(0,l.ub)(a,"banUsers"),b=a?.isCreator,C=a?(0,c.ALW)(e,a):void 0,y=a&&(0,l.yn)(a)&&!n||C,S=a&&((0,l.Vs)(a)||d);return{chat:a,isChannel:d,isSuperGroup:h,messageIds:i,currentUserId:e.currentUserId,canDeleteForAll:!u&&n,contactName:p,willDeleteForCurrentUserOnly:y,willDeleteForAll:S,adminMembersById:A,chatBot:g,canBanUsers:f,linkedChatId:r,isSchedule:u,isCreator:b,onConfirm:m}})(({isOpen:e,chat:t,isChannel:i,isSuperGroup:a,isSchedule:o,currentUserId:r,messageIds:l,isCreator:d,canDeleteForAll:h,contactName:u,willDeleteForCurrentUserOnly:m,willDeleteForAll:p,chatBot:v,adminMembersById:g,canBanUsers:A,linkedChatId:f,onConfirm:b})=>{const{closeDeleteMessageModal:C,deleteMessages:y,reportChannelSpam:S,deleteChatMember:k,deleteScheduledMessages:N,exitMessageSelectMode:w,updateChatMemberBannedRights:I,deleteParticipantHistory:P}=(0,n.ko)(),Y=(0,U.A)(e),F=(0,T.A)(),D=(0,Ri.A)(),{permissions:B,havePermissionChanged:L,handlePermissionChange:R,resetPermissions:x}=Ul(t?.defaultBannedRights),[E,V]=(0,s.J0)([]),[_,O]=(0,s.J0)([]),[K,J]=(0,s.J0)([]),[G,j]=(0,s.J0)(!1),[z,H]=(0,s.J0)(!1),[$,q]=(0,s.J0)(!0),W=(0,s.Kr)(()=>{if(i||!l||!t)return vi.p;const e=(0,n.mS)(),s=(0,c.SpN)(e,t.id,l);return s?(0,pi.Am)(s).filter(e=>e?.id!==t?.id&&e?.id!==f&&e?.id!==t?.linkedMonoforumId):vi.p},[t,i,f,l]),X=(0,M.A)(()=>W.map(e=>({value:e.id,label:(0,Dt.F9)(D,e)||"",leftElement:(0,ie.Y)(Tt.A,{size:"small",peer:e})}))),te=(0,s.Kr)(()=>W.filter(e=>e.id!==f&&e.id!==t?.linkedMonoforumId&&e.id!==r),[W,r,f,t?.linkedMonoforumId]),se=(0,s.Kr)(()=>W.filter(e=>e.id!==r&&e.id!==f&&e.id!==t?.linkedMonoforumId),[W,r,f,t?.linkedMonoforumId]),ne=(0,s.Kr)(()=>{const e=W.some(e=>e.id===r);return!A||e||t?.isMonoforum?vi.p:W.filter(e=>{const t=g?.[e.id];return d||!t})},[W,d,r,A,g,t?.isMonoforum]),ae=(0,s.Kr)(()=>Boolean(te.length||se.length||ne.length),[te,se,ne])&&!h&&!o&&a,oe=(0,s.Kr)(()=>!W||o?{}:(0,pi.pA)(W,e=>[e.id,(0,Dt.F9)(D,e)]),[o,D,W]),re=(0,s.Kr)(()=>[{value:l&&W.length>=2?"spam":W?.[0]?.id,label:F("ReportSpamTitle"),nestedOptions:l&&W.length>=2?[...X().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,f,t?.linkedMonoforumId,r]),le=(0,s.Kr)(()=>[{value:l&&W.length>=2?"delete_all":W?.[0]?.id,label:l&&W.length>=2?F("DeleteAllFromUsers"):F("DeleteAllFrom",Object.values(oe)[0]),nestedOptions:l&&W.length>=2?[...X().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,oe,f,t?.linkedMonoforumId,r]),ce=(0,s.Kr)(()=>[{value:l&&W.length>=2?"ban":W?.[0]?.id,label:l&&W.length>=2?F(z?"DeleteRestrictUsers":"DeleteBanUsers"):z?F("KickFromSupergroup"):F("DeleteBan",Object.values(oe)[0]),nestedOptions:l&&W.length>=2?[...X()]:void 0}],[z,F,l,W,oe]),de=(0,M.A)(()=>{H(e=>!e)}),he=(0,M.A)((e,i)=>{if(!t)return vi.p;const s=(0,n.mS)();return i.filter(i=>{const n=(0,c.LM$)(s,t.id,i);return n&&e.includes(n.id)})}),ue=(0,M.A)(e=>{Object.entries(e).forEach(([e,i])=>{i.length&&S({participantId:e,chatId:t.id,messageIds:i})})}),me=(0,M.A)(e=>{y({messageIds:e,shouldDeleteForAll:!0})}),ve=(0,M.A)(e=>{t&&e.forEach(e=>{P({peerId:e,chatId:t.id})})}),ge=(0,M.A)(e=>{e.forEach(e=>{k({chatId:t.id,userId:e})})}),Ae=(0,M.A)(e=>{e.forEach(e=>{I({chatId:t.id,userId:e,bannedRights:B})})}),fe=(0,M.A)(()=>{if(t&&l){if(b?.(),o)N({messageIds:l});else if(ae){if(K?.length){const e=(0,n.mS)(),i=K.filter(e=>!Number.isNaN(Number(e))),s=l.reduce((s,n)=>{const a=(0,c.LM$)(e,t.id,n);return a&&i.includes(a.id)&&(s[a.id]||(s[a.id]=[]),s[a.id].push(Number(n))),s},{});ue(s)}if(E?.length){const e=E.filter(e=>!Number.isNaN(Number(e)));ve(e)}if(_?.length&&!L){const e=_.filter(e=>!Number.isNaN(Number(e)));ge(e);const t=he(e,l);me(t)}if(_?.length&&L){const e=_.filter(e=>!Number.isNaN(Number(e)));Ae(e)}K?.length&&E?.length&&_?.length||y({messageIds:l,shouldDeleteForAll:$})}else y({messageIds:l,shouldDeleteForAll:$});C(),w()}}),be=(0,M.A)(()=>{C()});return(0,s.vJ)(()=>{!e&&Y&&(J([]),V([]),O([]),q(!0),j(!1),H(!1),x())},[e,Y,x]),(0,ie.Y)(ee.A,{isOpen:e,onClose:be,onEnter:fe,className:"SeaF_shb",children:(0,ie.FD)("div",{className:"_YNfwDqt",children:[(0,ie.FD)("div",{className:ae&&"axa67kqo",dir:D.isRtl?"rtl":void 0,children:[ae&&(0,ie.Y)(is.A,{size:"small",peers:W}),(0,ie.Y)("h3",{className:(0,pe.A)(ae?"U4IFhV0a":"qd6OFHiG"),children:F("Chat.DeleteMessagesConfirmation",l?.length)})]}),ae&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("p",{className:Gl,children:F("DeleteAdditionalActions")}),(0,ie.FD)("div",{className:"b6847Kh3",children:[(0,ie.Y)(Jl.A,{options:re,onChange:J,selected:K,nestedCheckbox:l&&W.length>=2}),te?.length>0&&(0,ie.Y)(Jl.A,{options:le,onChange:V,selected:E,nestedCheckbox:l&&W.length>=2}),ne?.length>0&&(0,ie.Y)(Jl.A,{options:ce,onChange:O,selected:_,nestedCheckbox:l&&W.length>=2})]}),(0,ie.FD)("div",{className:(0,pe.A)("iv0u9Zw6",z&&"qCQftA04"),children:[(0,ie.Y)("h3",{className:(0,pe.A)(Gl,"t3KOsBfm"),children:F("UserRestrictionsCanDoUsers",W.length)}),(0,ie.Y)(Kl,{withCheckbox:!0,chatId:t?.id,isMediaDropdownOpen:G,setIsMediaDropdownOpen:j,handlePermissionChange:R,permissions:B,className:(0,pe.A)("czTjjKim",G&&"Ifpyv7Jp")})]}),_?.length&&A?(0,ie.FD)(ui.A,{narrow:!0,buttonClassName:jl,onClick:de,children:[F(z?"DeleteToggleBanUsers":"DeleteToggleRestrictUsers"),(0,ie.Y)(Q.A,{name:z?"up":"down",className:(0,pe.A)(jl,"ml-2")})]}):H(!1)]}),(h||v||!ae)&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("p",{children:l&&l.length>1?D("AreYouSureDeleteFewMessages"):D("AreYouSureDeleteSingleMessage")}),m&&(0,ie.Y)("p",{children:F("lng_delete_for_me_chat_hint",1,"i")}),p&&(0,ie.Y)("p",{children:F("lng_delete_for_everyone_hint",1,"i")})]}),h&&(0,ie.Y)(Qs.A,{className:"dialog-checkbox",label:u?(0,Mt.A)(F("DeleteMessagesOptionAlso",u)):F("Conversation.DeleteMessagesForEveryone"),checked:$,onCheck:q}),(0,ie.FD)("div",{className:(0,pe.A)("dialog-buttons",G?"JTT_DIRv":"L4YzeG91"),children:[(0,ie.Y)(Z.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:fe,children:ae?F("DeleteProceedBtn"):D("Delete")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:be,children:F("Cancel")})]})]})})})),Hl=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,v.L8)(t),s=(0,c.nZ4)(e,t),n=(0,c.hds)(e,t),a=Boolean(n)&&(0,l.WX)(n),o=Boolean(n)&&(0,l.yn)(n),r=Boolean(n)&&(0,l.Vs)(n);return{isPrivateChat:i,isChatWithSelf:s,isChannel:a,isGroup:o,isSuperGroup:r,canPinForAll:i&&!s||r||o,contactName:n&&(0,v.L8)(n.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(n))):void 0}})(({isOpen:e,chatId:t,messageId:i,isChannel:a,isGroup:o,isSuperGroup:r,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:h}=(0,n.ko)(),[u,m]=(0,s.J0)(!0),p=(0,M.A)(()=>{h({chatId:t,messageId:i,isUnpin:!1,isOneSide:!u,isSilent:!u}),d()}),v=(0,T.A)();return(0,ie.FD)(ee.A,{isOpen:e,onClose:d,className:"pin",title:v("PinMessageAlertTitle"),children:[(0,ie.Y)("p",{children:v(a?"PinMessageAlertChannel":o||r?"PinMessageAlert":"PinMessageAlertChat")}),l&&(0,ie.Y)(Qs.A,{className:"dialog-checkbox",label:c?(0,Mt.A)(v("Conversation.PinMessagesFor",c)):v("Conversation.PinMessageAlert.PinAndNotifyMembers"),checked:u,onCheck:m}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:v("DialogPin")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:v("Cancel")})]})]})})),$l=(0,s.ph)(({isOpen:e,pinnedMessagesCount:t=0,onClose:i,onUnpin:s})=>{const n=(0,T.A)();return(0,ie.FD)(ee.A,{isOpen:e,onClose:i,className:"unpin-all",title:n("Chat.PanelUnpinAllMessages"),children:[(0,ie.Y)("p",{children:n("Chat.UnpinAllMessagesConfirmation",t,"i")}),(0,ie.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:s,children:n("DialogUnpin")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:i,children:n("Cancel")})]})]})});var ql=i(2178);const Wl=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{shouldWarnAboutFiles:i}=(0,un.l)(e),s=(0,c.meB)(e),{type:n,chatId:a}=(0,c.Xf0)(e)||{},o="scheduled"===n,{canDelete:r}=(0,c.jyG)(e),l=Boolean(!o&&(0,c.mDG)(e)),d=(0,c.ori)(e),{messageIds:h}=t.selectedMessages||{},u=!!a&&(0,c.o45)(e,a,h),m=!(o||!a)&&(0,c.Y8y)(e,a,h),p=!(!h||!a)&&(0,c.h5w)(e,a,h),v=t.isShareMessageModalShown,g=Boolean(v||t.requestedDraft||t.requestedAttachBotInChat||t.requestedAttachBotInstall||t.reportModal||t.deleteMessageModal);return{chat:s,isSchedule:o,selectedMessagesCount:(0,c.ZZ2)(e),canDeleteMessages:r,canReportMessages:l,canDownloadMessages:d,canForwardMessages:m,selectedMessageIds:h,hasProtectedMessage:u,isAnyModalOpen:g,shouldWarnAboutFiles:i,hasIpRevealingMedia:p}})(({chat:e,canPost:t,isActive:i,messageListType:a,isSchedule:o,selectedMessagesCount:r,canDeleteMessages:l,canReportMessages:c,canDownloadMessages:d,canForwardMessages:h,hasProtectedMessage:u,isAnyModalOpen:m,selectedMessageIds:p,shouldWarnAboutFiles:v,hasIpRevealingMedia:g})=>{const{exitMessageSelectMode:A,openForwardMenuForSelectedMessages:f,downloadSelectedMessages:b,copySelectedMessages:C,showNotification:y,reportMessages:S,openDeleteMessageModal:k,setSharedSettingOption:N}=(0,n.ko)(),w=(0,T.A)();(e=>{function t(e){e.preventDefault(),(0,n.ko)().copySelectedMessages()}(0,ql.v)((0,s.Kr)(()=>e?{"Mod+C":t}:void 0,[e]))})(i);const[I,P,Y]=(0,F.A)(),[D,B]=(0,s.J0)(!1),L=(0,M.A)(()=>{A()}),R=(0,M.A)(()=>{p&&e&&k({chatId:e.id,messageIds:p,isSchedule:o})});(0,s.vJ)(()=>i&&!m?(0,Fi.A)({onBackspace:l?R:void 0,onDelete:l?R:void 0,onEsc:L}):void 0,[i,R,L,m,l]);const x=(0,M.A)(()=>{C(),y({message:w("Share.Link.Copied")}),A()}),E=(0,M.A)(()=>{b(),A()}),V=(0,M.A)(()=>{v&&g?P():E()}),_=(0,M.A)(()=>{N({shouldWarnAboutFiles:!D}),Y(),E()}),O=(0,U.A)(r||void 0,!0),K=w("VoiceOver.Chat.MessagesSelected",i?r:O,"i"),J=(0,M.A)(()=>{p&&e&&(S({chatId:e.id,messageIds:p}),A())}),G=(0,pe.A)("MessageSelectToolbar",t&&"with-composer",i&&"shown"),j=(e,t,i,s)=>(0,ie.Y)("div",{role:"button",tabIndex:0,className:(0,pe.A)("div-button","item",s&&"destructive"),onClick:i,title:t,"aria-label":t,children:(0,ie.Y)(Q.A,{name:e})});return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:G,children:(0,ie.FD)("div",{className:"MessageSelectToolbar-inner",children:[(0,ie.Y)(Z.A,{color:"translucent",round:!0,onClick:L,ariaLabel:"Exit select mode",children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("span",{className:"MessageSelectToolbar-count",title:K,children:K}),Boolean(r)&&(0,ie.FD)("div",{className:"MessageSelectToolbar-actions",children:["scheduled"!==a&&h&&j("forward",w("Chat.ForwardActionHeader"),f),c&&j("flag",w("Conversation.ReportMessages"),J),d&&!u&&j("download",w("lng_media_download"),V),!u&&j("copy",w("lng_context_copy_selected_items"),x),l&&j("delete",w("EditAdminGroupDeleteMessages"),R,!0)]})]})}),(0,ie.FD)(ci.A,{isOpen:I,onClose:Y,confirmHandler:_,children:[w("lng_launch_svg_warning"),(0,ie.Y)(Qs.A,{className:"dialog-checkbox",checked:D,label:w("lng_launch_exe_dont_ask"),onCheck:B})]})]})})),Ql=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).seenByModal||{};return t&&i?{seenByDates:(0,c.O5q)(e,t,i)?.seenByDates}:{seenByDates:void 0}})(function({isOpen:e,seenByDates:t}){const{openChat:i,closeSeenByModal:a}=(0,n.ko)(),o=(0,T.A)(),r=(0,Yi.A)(t,!0),l=(0,s.Kr)(()=>{if(!r)return;const e=Object.keys(r);return e.sort((e,t)=>r[t]-r[e]),e},[r]),c=(0,M.A)(e=>{a(),setTimeout(()=>{i({id:e})},100)}),d=(0,M.A)(()=>{a()});return(0,ie.FD)(ee.A,{isOpen:e,onClose:a,className:(0,pe.A)("slqA9gR2","narrow"),title:`Seen by ${l?.length} users`,children:[(0,ie.Y)("div",{dir:o.isRtl?"rtl":void 0,children:l&&l.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>c(e),children:(0,ie.Y)(bs.A,{userId:e,noStatusOrTyping:!0,status:(0,$e.U)(o,1e3*r[e]),statusIcon:"message-read"})},e))}),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:o("Close")})})]})}));var Zl=i(32581);const Xl="MQxuEIRA",ec="AEAN1Au4",tc="F7owtTHj",ic=ee.U+o.xB5,sc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,isReadDate:i}=(0,c.nTw)(e).privacySettingsNoticeModal||{};return{user:t?(0,c.mBe)(e,t):void 0,isReadDate:i}})(({isOpen:e,isReadDate:t,user:i})=>{const{updateGlobalPrivacySettings:s,openPremiumModal:a,closePrivacySettingsNoticeModal:o,showNotification:r,setPrivacyVisibility:c,loadUser:d}=(0,n.ko)(),h=(0,T.A)(),u=(0,Ri.A)(),m=(0,l.u0)(i),p=(0,M.A)(()=>{s({shouldHideReadMarks:!1}),o(),setTimeout(()=>{r({message:h("PremiumReadSet")})},ic)}),v=(0,M.A)(()=>{c({privacyKey:"lastSeen",visibility:"everybody",onSuccess:()=>d({userId:i.id})}),o(),setTimeout(()=>{r({message:h("PremiumLastSeenSet")})},ic)}),g=(0,M.A)(()=>{o(),setTimeout(()=>{a({initialSection:"last_seen"})},ic)}),A=(0,M.A)(()=>{o()});return(0,ie.Y)(ee.A,{isSlim:!0,isOpen:e,onClose:A,children:(0,ie.FD)("div",{className:"tauadiDm",dir:u.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{className:"i6iFv9YE",color:"translucent",round:!0,size:"smaller",onClick:A,ariaLabel:"Close",children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)(Cr.A,{tgsUrl:t?br.w.ReadTime:br.w.LastSeen,size:84,className:"i4wZg_0J",nonInteractive:!0,noLoop:!0}),(0,ie.Y)("h2",{className:Xl,children:h(t?"PremiumReadHeader1":"PremiumLastSeenHeader1")}),(0,ie.Y)("p",{className:ec,children:(0,Mt.A)(h(t?"PremiumReadText1":"PremiumLastSeenText1Locked",m),["simple_markdown"])}),(0,ie.Y)(Z.A,{onClick:t?p:v,className:tc,children:h(t?"PremiumReadButton1":"PremiumLastSeenButton1")}),(0,ie.Y)(Zl.A,{className:"sXXb5yOS",children:h("PremiumOr")}),(0,ie.Y)("h2",{className:Xl,children:h("PremiumReadHeader2")}),(0,ie.Y)("p",{className:ec,children:(0,Mt.A)(h(t?"PremiumReadText2":"PremiumLastSeenText2",m),["simple_markdown"])}),(0,ie.Y)(Z.A,{withPremiumGradient:!0,onClick:g,className:tc,children:h("PremiumLastSeenButton2")})]})})}));var nc=i(97822),ac=i(24956),oc=i(31722);const rc="ItemPickerItem",lc=(0,s.ph)(({className:e,isSearchable:t,searchInputId:i,items:n,filterValue:a,notFoundText:o,isLoading:l,noScrollRestore:c,filterPlaceholder:d,isViewOnly:h,itemInputType:u,itemClassName:m,withDefaultPadding:p,forceRenderAllItems:v,onFilterChange:g,onDisabledClick:A,onLoadMore:f,...b})=>{const C=(0,T.A)(),y=(0,s.li)(),S=b.allowMultiple,k=S?b.lockedSelectedValues:void 0,N=S?b.lockedUnselectedValues:void 0;(0,s.vJ)(()=>{t&&(0,r.YS)(()=>{(0,nc.A)(y.current)})},[t]);const w=(0,s.Kr)(()=>S?b.selectedValues:b.selectedValue?[b.selectedValue]:vi.p,[S,b.selectedValue,b.selectedValues]),I=(0,s.Kr)(()=>new Set(k),[k]),P=(0,s.Kr)(()=>new Set(N),[N]),Y=(0,s.Kr)(()=>{if(a)return n.map(e=>e.value);const e=[],t=[],i=[];return n.forEach(s=>{I.has(s.value)?e.push(s):P.has(s.value)?i.push(s):t.push(s)}),e.concat(t,i).map(e=>e.value)},[a,n,I,P]),F=(0,M.A)(e=>{if(S){const t=w.slice(),i=t.indexOf(e);return i>=0?t.splice(i,1):t.push(e),void b.onSelectedValuesChange?.(t)}b.onSelectedValueChange?.(e)}),[D,B]=(0,Ys.A)(f,Y,Boolean(v||a)),L=(0,M.A)(e=>{const{value:t}=e.currentTarget;g?.(t)}),R=(0,s.hb)(e=>{const t=n.find(t=>t.value===e);if(!t)return;const{label:i,subLabel:s,isLoading:a}=t,o=P.has(e),r=I.has(e),l=o||r,c=w.includes(e);return(0,ie.Y)(Ls.A,{className:(0,pe.A)(rc,m),title:i,subtitle:s,disabled:l,inactive:h,ripple:!0,inputElement:l?(0,ie.Y)(Q.A,{name:"lock-badge"}):"radio"===u?(0,ie.Y)(ac.A,{checked:c,disabled:l,isLoading:a,onlyInput:!0}):"checkbox"===u?(0,ie.Y)(Qs.A,{checked:c,disabled:l,isLoading:a,onlyInput:!0}):void 0,onClick:()=>F(e),onDisabledClick:A&&(()=>A(e,r))},e)},[n,P,I,w,h,A,u,m]);return(0,ie.FD)("div",{className:(0,pe.A)(oc.A.container,e),children:[t&&(0,ie.Y)("div",{className:(0,pe.A)(oc.A.header,"custom-scroll"),dir:C.isRtl?"rtl":void 0,children:(0,ie.Y)(X.A,{id:i,ref:y,value:a,onChange:L,placeholder:d||C("Search")})}),D?.length?(0,ie.Y)(vs.A,{className:(0,pe.A)(oc.A.pickerList,p&&oc.A.padded,"custom-scroll"),items:D,itemSelector:`.${rc}`,onLoadMore:B,noScrollRestore:c,children:D.map(e=>R(e))}):l||!D||D.length?(0,ie.Y)(Ms.A,{}):(0,ie.Y)("p",{className:oc.A.noResults,children:o||C("SearchEmptyViewTitle")})]})}),cc={root:"wzzA3MFh",pickerSelector:"xhujrq9i",pickerTitle:"YuRK4e7S",picker:"YF9nLkCK",footer:"ATCZ2Q5G"},dc=(0,s.ph)(({isOpen:e,onClose:t,onSubmit:i,countryList:a,selectionLimit:o})=>{const{showNotification:r}=(0,n.ko)(),l=(0,T.A)(),[c,d]=(0,s.J0)([]),h=(0,U.A)(c)===c,u=(0,s.Kr)(()=>a?a.filter(e=>!e.isHidden&&"FT"!==e.iso2).map(({iso2:e,defaultName:t})=>({value:e,label:t})):[],[a]),m=(0,M.A)(e=>{o&&e.length>o?r({message:l("BoostingSelectUpToWarningCountries",o)}):d(e)}),p=(0,M.A)(()=>{i(c),t()});return(0,ie.FD)(ee.A,{className:cc.root,isOpen:e,onClose:t,onEnter:p,children:[(0,ie.Y)("div",{className:cc.container,children:(0,ie.FD)("div",{className:cc.pickerSelector,children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:t,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("h4",{className:cc.pickerTitle,children:l("BoostingSelectCountry")})]})}),(0,ie.Y)("div",{className:(0,pe.A)(cc.main,"custom-scroll"),children:(0,ie.Y)(lc,{className:cc.picker,items:u,selectedValues:c,onSelectedValuesChange:m,noScrollRestore:h,allowMultiple:!0,itemInputType:"checkbox"})}),(0,ie.Y)("div",{className:cc.footer,children:(0,ie.Y)(Z.A,{onClick:p,children:l("SelectCountries.OK")})})]})}),hc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).reactorModal||{},s=t&&i?(0,c.O5q)(e,t,i):void 0;return{chatId:t,messageId:i,reactions:s?.reactions,reactors:s?.reactors,seenByDates:s?.seenByDates,availableReactions:e.reactions.availableReactions}})(({isOpen:e,reactors:t,reactions:i,chatId:o,messageId:r,seenByDates:c,availableReactions:d})=>{const{loadReactors:h,closeReactorListModal:u,openChat:m}=(0,n.ko)(),p=(0,n.mS)().chats.byId,v=(0,n.mS)().users.byId,g=(0,T.A)(),A=(0,Ri.A)(),[f,b,C]=(0,F.A)(!1),[y,S]=(0,s.J0)(void 0),k=t&&i&&t.count>=10&&i.results.length>1,N=(0,s.li)();(0,s.vJ)(()=>{e&&!f&&(N.current=void 0),f&&!e&&(C(),S(void 0))},[f,e,C]);const w=(0,M.A)(()=>{N.current&&m({id:N.current}),u()}),I=(0,M.A)(()=>{b()}),P=(0,M.A)(e=>{N.current=e,I()}),Y=(0,M.A)(()=>{h({chatId:o,messageId:r})}),D=(0,s.Kr)(()=>{const e=[];return t?.reactions?.forEach(({reaction:t})=>{e.some(e=>(0,l.a0)(e,t))||e.push(t)}),e},[t]),B=(0,s.Kr)(()=>{if(y)return t?.reactions.filter(({reaction:e})=>(0,l.a0)(e,y)).map(({peerId:e})=>e);const e=Object.keys(c||{});return(0,pi.Am)(t?.reactions.map(({peerId:e})=>e).concat(e||[])||[])},[y,t,c]),[L,R]=(0,Ys.A)(Y,B,t&&void 0===t.nextOffset);return(0,s.vJ)(()=>{R?.({direction:a.TN.Backwards})},[R]),(0,ie.FD)(ee.A,{isOpen:e&&!f,onClose:I,className:"ReactorListModal narrow",title:g("Reactions"),onCloseAnimationEnd:w,children:[k&&(0,ie.FD)("div",{className:"Reactions",dir:A.isRtl?"rtl":void 0,children:[(0,ie.FD)(Z.A,{className:(0,pe.A)(!y&&"chosen"),size:"tiny",ripple:!0,onClick:()=>S(void 0),children:[(0,ie.Y)(Q.A,{name:"heart"}),Boolean(t?.count)&&(0,kn.Vw)(A,t.count)]}),D.map(e=>{const t=i?.results.find(t=>(0,l.a0)(t.reaction,e))?.count;return(0,ie.FD)(Z.A,{className:(0,pe.A)((0,l.a0)(y,e)&&"chosen"),size:"tiny",ripple:!0,onClick:()=>S(e),children:[(0,ie.Y)(Cs.A,{reaction:e,className:"reaction-filter-emoji",availableReactions:d}),Boolean(t)&&(0,kn.Vw)(A,t)]},(0,l.Jj)(e))})]}),(0,ie.Y)("div",{dir:A.isRtl?"rtl":void 0,className:"reactor-list-wrapper",children:L?.length?(0,ie.Y)(vs.A,{className:"reactor-list custom-scroll",items:L,onLoadMore:R,children:L?.flatMap(e=>{const i=v[e]||p[e],s=t?.reactions.filter(t=>t.peerId===e),n=[],a=c?.[e];return s?.forEach(t=>{y&&!(0,l.a0)(t.reaction,y)||n.push((0,ie.FD)(ui.A,{className:"chat-item-clickable reactors-list-item",onClick:()=>P(e),children:[(0,ie.Y)(Tt.A,{peer:i,size:"medium"}),(0,ie.FD)("div",{className:"info",children:[(0,ie.Y)(Ts.A,{peer:i,withEmojiStatus:!0}),(0,ie.FD)("span",{className:"status",dir:"auto",children:[(0,ie.Y)(Q.A,{name:"heart-outline",className:"status-icon"}),(0,$e.U)(g,1e3*t.addedDate)]})]}),t.reaction&&(0,ie.Y)(Cs.A,{className:"reactors-list-emoji",reaction:t.reaction,availableReactions:d})]},`${e}-${(0,l.Jj)(t.reaction)}`))}),y||s?.length||n.push((0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P(e),children:(0,ie.Y)(bs.A,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:a?(0,$e.U)(g,1e3*a):void 0,statusIcon:"message-read"})},`${e}-seen-by`)),n})}):(0,ie.Y)(Ms.A,{})}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:I,children:g("Close")})]})})),uc=(0,s.ph)((0,n.EK)((e,{activeEmojiInteraction:t})=>{const i=void 0!==t.animatedEffect&&(0,c.Nr8)(e,t.animatedEffect);return{effectAnimationId:i?i.id:void 0}})(({effectAnimationId:e,activeEmojiInteraction:t})=>{const{stopActiveEmojiInteraction:i}=(0,n.ko)(),[a,o]=(0,F.A)(!1),[r,l]=(0,F.A)(!1),c=(0,s.li)(),d=(0,M.A)(()=>{o(),c.current&&clearTimeout(c.current),setTimeout(()=>{i({id:t.id})},250)}),h=(0,M.A)(e=>{e.target?.closest(".AnimatedEmoji")||d()});(0,s.vJ)(()=>(document.addEventListener("touchstart",h),document.addEventListener("touchmove",h),document.addEventListener("mousedown",h),document.addEventListener("wheel",h),()=>{document.removeEventListener("touchstart",h),document.removeEventListener("touchmove",h),document.removeEventListener("mousedown",h),document.removeEventListener("wheel",h)}),[h]),(0,s.Nf)(()=>{const e=(0,s.VK)();c.current=setTimeout(()=>{d(),e()},3e3)},[d]);const m=e&&`sticker${e}`,p=(0,H.A)(m,!e);if(!t.startSize)return;const v=(t.startSize||0)/309;return(0,ie.Y)("div",{className:(0,pe.A)("EmojiInteractionAnimation",a&&"hiding",r&&"playing",t.isReversed&&"reversed"),style:`--scale: ${v}; --start-x: ${t.x}px; --start-y: ${t.y}px;`,children:(0,ie.Y)(Ia.A,{size:309,tgsUrl:p,play:!0,quality:u.Ni?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:l},`effect_${e}`)})})),mc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).chatLanguageModal||{},s=(0,c.wmb)(e);return{chatId:t,messageId:i,activeTranslationLanguage:t?i?(0,c.Rny)(e,t,i):(0,c.qZq)(e,t):void 0,currentLanguageCode:s}})(({isOpen:e,chatId:t,messageId:i,activeTranslationLanguage:a,currentLanguageCode:r})=>{const{requestMessageTranslation:l,closeChatLanguageModal:c,setSettingOption:d,requestChatTranslation:h}=(0,n.ko)(),[u,m]=(0,s.J0)(""),p=(0,T.A)(),v=(0,M.A)(e=>{t&&(i?l({chatId:t,id:i,toLanguageCode:e}):(d({translationLanguage:e}),h({chatId:t,toLanguageCode:e})),c())}),g=(0,M.A)(e=>{m(e.target.value)}),A=(0,s.Kr)(()=>o.N89.map(e=>({langCode:e,translatedName:new Intl.DisplayNames([r],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})),[r]);(0,s.vJ)(()=>{e||m("")},[e]);const f=(0,s.Kr)(()=>u.trim()?A.filter(({langCode:e,translatedName:t,originalName:i})=>t.toLowerCase().includes(u.toLowerCase())||i.toLowerCase().includes(u.toLowerCase())||e.toLowerCase().includes(u.toLowerCase())):A,[A,u]);return(0,ie.FD)(ee.A,{className:"aMjNU9gm",isSlim:!0,isOpen:e,hasCloseButton:!0,title:p("Language"),onClose:c,children:[(0,ie.Y)(X.A,{value:u,onChange:g,placeholder:p("Search"),teactExperimentControlled:!0},"search"),(0,ie.Y)("div",{className:(0,pe.A)("r3YNWDQr","custom-scroll"),children:f.map(({langCode:e,originalName:t,translatedName:i})=>(0,ie.FD)(ui.A,{className:(0,pe.A)("T3An6Hoz","no-icon"),secondaryIcon:a===e?"check":void 0,disabled:a===e,multiline:!0,narrow:!0,onClick:()=>v(e),children:[(0,ie.Y)("span",{className:(0,pe.A)("title","dQ9wwFu1"),children:(0,Mt.A)(t,["highlight"],{highlight:u})}),(0,ie.Y)("span",{className:(0,pe.A)("subtitle","m_J41YYl"),children:(0,Mt.A)(i,["highlight"],{highlight:u})})]},e))})]})}));var pc=i(85982),vc=i(24899);const gc={content:"WEJIbFQj",closeButton:"_vwPuDEM",icon:"BUiGM8qZ",title:"Q3NhXpNI",description:"frZbGQ0G"},Ac=(0,s.ph)((0,n.EK)(e=>{const{countryList:t}=e;return{phoneCodeList:t.phoneCodes}})(({modal:e,phoneCodeList:t})=>{const{closeCollectibleInfoModal:i,openChat:a,openUrl:o,showNotification:r}=(0,n.ko)(),l=(0,T.A)(),c="username"===e?.type,d=(0,M.A)(()=>{i()}),h=(0,M.A)(()=>{a({id:e.peerId}),d()}),u=(0,M.A)(()=>{o({url:e.url}),d()}),m=(0,M.A)(()=>{const i=c?(0,vc.A)(e.collectible):(0,rn.Ox)(t,e.collectible);(0,pc.eM)(i),r({message:l(c?"UsernameCopied":"PhoneCopied")}),d()}),p=(0,s.Kr)(()=>{if(!e)return;const i=c?"FragmentUsernameTitle":"FragmentPhoneTitle",s=c?(0,vc.A)(e.collectible):(0,rn.Ox)(t,e.collectible);return l(i,s)},[e,c,t,l]),v=(0,s.Kr)(()=>{if(!e)return;const t=c?"FragmentUsernameMessage":"FragmentPhoneMessage",i=(0,$e.U)(l,1e3*e.purchaseDate),s=(0,ca.Ad)(e.amount,e.currency,l.code),n=(0,ca.Ad)(e.cryptoAmount,e.cryptoCurrency,l.code);return l(t,[i,`${n} (${s})`])},[e,c,l]);return(0,ie.FD)(ee.A,{isOpen:Boolean(e),isSlim:!0,contentClassName:gc.content,onClose:i,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",className:gc.closeButton,ariaLabel:l("Close"),onClick:d,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:gc.icon,children:(0,ie.Y)(Cr.A,{tgsUrl:c?br.w.Mention:br.w.Fragment,size:60})}),(0,ie.Y)("h3",{className:gc.title,children:p&&(0,Mt.A)(p,["simple_markdown"])}),(0,ie.Y)(Er.A,{className:gc.chip,peerId:e?.peerId,forceShowSelf:!0,clickArg:e?.peerId,onClick:h}),(0,ie.Y)("p",{className:gc.description,children:v&&(0,Mt.A)(v,["simple_markdown"])}),(0,ie.FD)("div",{className:"dialog-buttons dialog-buttons-centered",children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",onClick:u,children:l("FragmentUsernameOpen")}),(0,ie.Y)(Z.A,{isText:!0,className:"confirm-dialog-button",onClick:m,children:l(c?"FragmentUsernameCopy":"FragmentPhoneCopy")})]})]})}));var fc=i(31460),bc=i(24680),Cc=i(57309);function yc(e){return(t,i)=>{const s=(0,c.nTw)(t),{byId:n}=t.chats,{byId:a}=t.users,{fetchingStatus:o,resultsByType:r,chatId:l}=s.globalSearch,{shouldWarnAboutFiles:d}=(0,un.l)(t),h="audio"!==e?e:i?.isVoice?"voice":"audio",{byChatId:u}=t.messages,m=r?.[h]?.foundIds,p=s.activeDownloads;return{theme:(0,c.SJA)(t),isLoading:void 0===m||!!o&&Boolean(o.chats||o.messages),chatsById:n,usersById:a,globalMessagesByChatId:u,foundIds:m,searchChatId:l,activeDownloads:p,isChatProtected:l?(0,c.hds)(t,l)?.isProtected:void 0,shouldWarnAboutFiles:d}}}var Sc=i(55429),kc=i(65240),Nc=i(42827);const wc=(0,Ae.nF)(e=>e(),500,!0),Ic=(0,s.ph)((0,n.EK)(yc("audio"))(({theme:e,isVoice:t,searchQuery:i,isLoading:r,chatsById:c,usersById:d,globalMessagesByChatId:h,foundIds:u,activeDownloads:m})=>{const{searchMessagesGlobal:p,focusMessage:v,openAudioPlayer:g}=(0,n.ko)(),A=(0,T.A)(),f=t?"voice":"audio",b=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&wc(()=>{p({type:f})})},[f,p,i]),C=(0,s.Kr)(()=>u&&h?u.map(e=>{const[t,i]=(0,Cc.a)(e);return h[t]?.byId[i]}).filter(Boolean):vi.p,[h,u]),y=(0,s.hb)(e=>{v({chatId:e.chatId,messageId:e.id})},[v]),S=(0,s.hb)((e,t)=>{g({chatId:t,messageId:e})},[g]),k=(0,ir.A)([i],o.jhd)&&!r;return(0,ie.Y)(ae.Ay,{slideClassName:"LeftSearch--content",name:"fade",activeKey:k?1:0,shouldCleanup:!0,children:(0,ie.FD)(vs.A,{className:"search-content documents-list custom-scroll",items:k?C:void 0,onLoadMore:b,noFastList:!0,children:[!k&&(0,ie.Y)(Ms.A,{}),k&&(!u||0===u.length)&&(0,ie.Y)(Nc.A,{withSticker:!0,text:A("ChatList.Search.NoResults"),description:A("ChatList.Search.NoResultsDescription")}),k&&u&&u.length>0&&C.map((t,i)=>{const s=(0,n.mS)(),o=0===i||(0,$e.$$)(t.date)!==(0,$e.$$)(C[i-1].date),r=(0,Te.iS)(s,t);return(0,ie.FD)(ie.FK,{children:[o&&(0,ie.Y)("p",{className:"section-heading",dir:A.isRtl?"rtl":void 0,children:(0,$e.i6)(A,new Date(1e3*t.date))},t.date),(0,ie.Y)("div",{className:"ListItem small-icon",children:(0,ie.Y)(kc.Ay,{theme:e,message:t,origin:a.d9.Search,senderTitle:(0,Sc.N)(A,t,c,d),date:t.date,className:"scroll-item",onPlay:S,onDateClick:y,canDownload:!c[t.chatId]?.isProtected&&!t.isProtected,isDownloading:(0,l.$r)(m,r)},t.id)},t.id)]})})]})})}));var Pc=i(27109),Yc=i(75956),Fc=i(47067);const Dc=e=>{const t=(0,s.li)(),i=(0,M.A)(i=>{"Enter"===i.key&&t.current===document.activeElement&&e()});return(0,s.vJ)(()=>(window.addEventListener("keydown",i,!1),()=>window.removeEventListener("keydown",i,!1)),[]),t};var Mc=i(97967),Tc=i(97046);const Bc=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,user:(0,c.mBe)(e,t),isPinned:(0,c.D3D)(e,t),isMuted:i&&(0,Pc.If)(i,(0,c.K52)(e),(0,c.P5N)(e,i.id)),canChangeFolder:Boolean(e.chatFolders.orderedIds?.length)}})(({chatId:e,withUsername:t,chat:i,user:r,isPinned:l,isMuted:c,canChangeFolder:d,withOpenAppButton:h,onClick:u})=>{const{requestMainWebView:m,updateChatMutedState:p,openQuickPreview:g}=(0,n.ko)(),A=(0,Ri.A)(),[f,b,C]=(0,F.A)(),[y,S,k]=(0,F.A)(),[N,w,I]=(0,F.A)(),[P,Y,D]=(0,F.A)(),T=(0,s.hb)(()=>{w(),S()},[w,S]),B=(0,s.hb)(()=>{Y(),b()},[Y,b]),L=(0,M.A)(()=>{p({chatId:e,mutedUntil:o.Os5})}),R=(0,Fc.A)({chat:i,user:r,isPinned:l,isMuted:c,canChangeFolder:d,handleMute:B,handleUnmute:L,handleChatFolderChange:T},!0),x=(0,M.A)(t=>{if(t.altKey&&i&&!i.isForum)return t.preventDefault(),void g({id:e});u(e)}),E=(0,M.A)(t=>{t.stopPropagation();const i=(0,Nn.A)();m({botId:e,peerId:e,theme:i})}),V=(0,M.A)(t=>{t.preventDefault(),(0,Yc.W)(()=>{u(e)},!0)}),_=Dc(()=>{u(e)});return(0,ie.FD)(ui.A,{className:"chat-item-clickable search-result",contextActions:R,buttonRef:_,onClick:x,onDragEnter:V,onDragLeave:Yc.d,children:[(0,v.L8)(e)?(0,ie.Y)(bs.A,{userId:e,withUsername:t,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,ie.Y)(fs.A,{chatId:e,withUsername:t,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),h&&r?.hasMainMiniApp&&(0,ie.Y)(Z.A,{className:"search-result-miniapp-button",pill:!0,fluid:!0,size:"tiny",onClick:E,children:A("BotChatMiniAppOpen")}),P&&(0,ie.Y)(Tc.A,{isOpen:f,onClose:C,onCloseAnimationEnd:D,chatId:e}),N&&(0,ie.Y)(Mc.A,{isOpen:y,onClose:k,onCloseAnimationEnd:I,chatId:e})]})})),Lc=(0,Ae.nF)(e=>e(),500,!0),Rc=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(({searchQuery:e,isLoading:t,foundIds:i,recentBotIds:r})=>{const{searchPopularBotApps:l,openChatWithInfo:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,T.A)(),[u,m]=(0,s.J0)(!1),p=(0,s.Kr)(()=>{if(!i)return[];const t=new Set(r),s=i.filter(e=>!t.has(e));return(0,Dt.PU)({ids:s,query:e,type:"user"})},[i,r,e]),v=(0,M.A)(e=>{c({id:e,shouldReplaceHistory:!0})}),g=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Lc(()=>{l()})},[]),A=(0,M.A)(()=>{m(e=>!e)}),f=(0,ir.A)([e],o.jhd)&&!t;return(0,ie.Y)(ae.Ay,{ref:d,slideClassName:"LeftSearch--content",name:"fade",activeKey:f?1:0,shouldCleanup:!0,children:(0,ie.FD)(vs.A,{className:"search-content custom-scroll",items:f?p:void 0,onLoadMore:g,noFastList:!0,children:[!f&&(0,ie.Y)(Ms.A,{}),f&&!p?.length&&(0,ie.Y)(Nc.A,{withSticker:!0,text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),f&&!e&&Boolean(r?.length)&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.FD)("h3",{className:"section-heading",children:[r.length>5&&(0,ie.Y)(No.A,{className:"Link",onClick:A,children:h(u?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),h("SearchAppsMine")]}),r.map((e,t)=>{if(u||!(t>=5))return(0,ie.Y)(Bc,{chatId:e,onClick:v,withOpenAppButton:!0})})]}),f&&Boolean(p?.length)&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.Y)("h3",{className:"section-heading",children:h("SearchAppsPopular")}),p.map(e=>(0,ie.Y)(Bc,{chatId:e,onClick:v,withOpenAppButton:!0}))]})]})})}));var xc=i(35749),Ec=i(2338);function Vc(e,t,i,s,n){if(!i)return(0,A.C)(e,t,void 0,s);const a=(0,l.y2)(t);return(0,ie.FD)("span",{className:"media-preview",children:[(0,ie.Y)("img",{src:i,alt:"",className:(0,pe.A)("media-preview--image",n&&"round",a&&"media-preview-spoiler"),draggable:!1}),(0,l.zX)(t)&&(0,ie.Y)(Q.A,{name:"play"}),(0,A.C)(e,t,!0,s)]})}const _c=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);if(!i)return{};const s=(0,l.e7)(i);return{chat:i,privateChatUser:s?(0,c.mBe)(e,s):void 0}})(({message:e,searchQuery:t,chatId:i,chat:s,privateChatUser:a})=>{const{focusMessage:o}=(0,n.ko)(),{isMobile:r}=(0,Y.Ay)(),c=(0,Ec.A)(e),d=(0,l.fP)(e)?void 0:c,h=(0,xc.A)(e,"micro"),u=(0,H.A)(h),m=Boolean((0,l.lk)(e)),p=(0,M.A)(()=>{o({chatId:i,messageId:e.id,shouldReplaceHistory:!0})}),v=(0,Ri.A)(),g=(0,T.A)(),A=Dc(p);if(!s)return;const f=a||s;return(0,ie.FD)(ui.A,{className:"ChatMessage chat-item-clickable",ripple:!r,onClick:p,buttonRef:A,children:[(0,ie.Y)(Tt.A,{peer:f,isSavedMessages:a?.isSelf}),(0,ie.FD)("div",{className:"info",children:[(0,ie.FD)("div",{className:"info-row",children:[(0,ie.Y)(Ts.A,{peer:f,withEmojiStatus:!0,isSavedMessages:i===a?.id&&a?.isSelf}),(0,ie.Y)("div",{className:"message-date",children:(0,ie.Y)(No.A,{className:"date",children:(0,$e.be)(g,1e3*e.date)})})]}),(0,ie.Y)("div",{className:"subtitle",children:(0,ie.Y)("div",{className:"message",dir:"auto",children:Vc(v,e,u||d,t,m)})})]})]})})),Uc=(0,s.ph)(({searchDate:e,onSelect:t})=>{const i=(0,s.Kr)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,$e.A)(t)}]}const t=[],i=new Date,s=i.getFullYear(),n=i.getTime()>new Date(`${s}-${e}`).getTime()?s:s-1;for(let i=0;i<8;i++){const s=new Date(`${n-i}-${e}`);t.push({date:s,text:(0,$e.A)(s)})}return t}(e),[e]);return(0,ie.Y)("section",{className:"DateSuggest custom-scroll custom-scroll-x",children:i.map(({date:e,text:i})=>(0,ie.FD)("div",{onClick:()=>t(e),className:"date-item",children:[(0,ie.Y)(Q.A,{name:"calendar"}),(0,ie.Y)("span",{children:i})]},i))})}),Oc=2*g.$,Kc=(0,s.ph)((0,n.EK)((e,{chatId:t,topicId:i})=>({topic:(0,c.S0q)(e,t,i)}))(({chatId:e,topicId:t,topic:i,onClick:a})=>{const{openQuickPreview:o}=(0,n.ko)(),r=(0,s.hb)(i=>{if(i.altKey)return i.preventDefault(),void o({id:e,threadId:t});a(t)},[e,t,a,o]),l=Dc(()=>a(t));if(i)return(0,ie.FD)(ui.A,{className:"chat-item-clickable search-result",onClick:r,buttonClassName:"topic-item",buttonRef:l,children:[(0,ie.Y)(Bs.A,{size:Oc,topic:i,className:"topic-icon",letterClassName:"topic-icon-letter"}),(0,ie.Y)("div",{dir:"auto",className:"fullName",children:(0,Mt.A)(i.title)})]})})),Jc=(0,Ae.nF)(e=>e(),500,!0),Gc=(0,s.ph)((0,n.EK)(e=>{const{byId:t}=e.chats,{currentUserId:i,messages:{byChatId:s}}=e,{fetchingStatus:n,resultsByType:a,foundTopicIds:o,chatId:r}=(0,c.nTw)(e).globalSearch,{foundIds:l}=a?.text||{};return{currentUserId:i,foundIds:l,globalMessagesByChatId:s,chatsById:t,fetchingStatus:n,foundTopicIds:o,searchChatId:r}})(({searchQuery:e,dateSearchQuery:t,foundIds:i,globalMessagesByChatId:o,chatsById:r,fetchingStatus:l,foundTopicIds:c,searchChatId:d,onSearchDateSelect:h,onReset:u})=>{const{searchMessagesGlobal:m,openThread:p}=(0,n.ko)(),v=(0,Ri.A)(),{isMobile:g}=(0,Y.Ay)(),f=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Jc(()=>{m({type:"text"})})},[e]),b=(0,s.hb)(e=>{d&&(p({chatId:d,threadId:e,shouldReplaceHistory:!0}),g||u())},[d,g,u]),C=(0,s.Kr)(()=>i&&0!==i.length?i.map(e=>{const[t,i]=(0,Cc.a)(e);return o?.[t]?.byId[i]}).filter(Boolean).sort((e,t)=>t.date-e.date):vi.p,[i,o]),y=l&&!l.chats&&!l.messages&&!C.length&&!c?.length;return(0,ie.Y)("div",{className:"LeftSearch--content",children:(0,ie.FD)(vs.A,{className:"search-content custom-scroll chat-list",items:C,onLoadMore:f,noFastList:!0,children:[t&&(0,ie.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ie.Y)(Uc,{searchDate:t,onSelect:h})}),y&&(0,ie.Y)(Nc.A,{withSticker:!0,text:v("ChatListSearchNoResults"),description:v("ChatListSearchNoResultsDescription")}),Boolean(c?.length)&&(0,ie.FD)("div",{className:"pb-2",children:[(0,ie.Y)("h3",{className:"section-heading topic-search-heading",dir:v.isRtl?"auto":void 0,children:v("SearchResultTopics")}),c.map(e=>(0,ie.Y)(Kc,{chatId:d,topicId:e,onClick:b}))]}),Boolean(C.length)&&(0,ie.FD)("div",{className:"pb-2",children:[(0,ie.Y)("h3",{className:"section-heading topic-search-heading",dir:v.isRtl?"auto":void 0,children:v("SearchMessages")}),C.map(function(t){const i=(0,A.C)(v,t),s=r[t.chatId];if(i&&s)return(0,ie.Y)(_c,{chatId:t.chatId,message:t,searchQuery:e})})]})]})})}));var jc=i(49763),zc=i(81949);const Hc=(0,s.ph)(({sponsoredPeer:e,observeIntersection:t})=>{const i=(0,s.li)(),{clickSponsored:o,viewSponsored:r,openChat:l}=(0,n.ko)(),c=(0,Ri.A)(),{peerId:d,randomId:h,additionalInfo:u,sponsorInfo:m}=e;(0,nr.mv)(i,t,e=>{1===e.intersectionRatio&&r({randomId:h})});const p=(0,M.A)(()=>{o({randomId:h}),l({id:d})}),{isContextMenuOpen:g,contextMenuAnchor:A,handleBeforeContextMenu:f,handleContextMenu:b,handleContextMenuClose:C,handleContextMenuHide:y}=(0,vn.A)(i),{handleClick:S,handleMouseDown:k}=(0,qi.Q)(e=>{e.stopPropagation(),b(e)}),N=Dc(p);return(0,ie.FD)(ui.A,{ref:i,className:"chat-item-clickable search-result",onClick:p,onMouseDown:f,onContextMenu:b,buttonRef:N,children:[(0,v.L8)(d)?(0,ie.Y)(bs.A,{userId:d,withUsername:!0,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,ie.Y)(fs.A,{chatId:d,withUsername:!0,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),(0,ie.FD)(zc.A,{className:"search-sponsored-badge",onMouseDown:k,onClick:S,children:[c("SponsoredPeerBadge"),(0,ie.Y)(Q.A,{name:"more"})]}),A&&(0,ie.Y)(dl.A,{isOpen:g,anchor:A,triggerRef:i,randomId:h,additionalInfo:u,canReport:!0,sponsorInfo:m,onClose:C,onCloseAnimationEnd:y})]})}),$c=(0,Ae.nF)(e=>e(),6e4,!0),qc=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.topPeers,i=e.users.byId,{recentlyFoundChatIds:s}=e;return{topUserIds:t,usersById:i,recentlyFoundChatIds:s}})(({topUserIds:e,usersById:t,recentlyFoundChatIds:i,onReset:a})=>{const{loadTopUsers:o,openChat:r,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,n.ko)(),h=(0,s.li)();(0,s.vJ)(()=>{$c(()=>{o()})},[o]),(0,yn.A)(h,!e);const u=(0,s.hb)(e=>{r({id:e,shouldReplaceHistory:!0}),a(),setTimeout(()=>{c({id:e})},250)},[r,c,a]),m=(0,s.hb)(()=>{d()},[d]),p=(0,T.A)();return(0,ie.FD)("div",{className:"RecentContacts custom-scroll",children:[e&&(0,ie.Y)("div",{className:"top-peers-section",dir:p.isRtl?"rtl":void 0,children:(0,ie.Y)("div",{ref:h,className:"top-peers",children:e.map(e=>(0,ie.FD)("div",{className:"top-peer-item",onClick:()=>u(e),dir:p.isRtl?"rtl":void 0,children:[(0,ie.Y)(Tt.A,{peer:t[e]}),(0,ie.Y)("div",{className:"top-peer-name",children:(0,Mt.A)((0,l.u0)(t[e])||" ")})]},e))})}),i&&(0,ie.FD)("div",{className:"search-section pt-1",children:[(0,ie.FD)("h3",{className:(0,pe.A)("section-heading mt-0 recent-chats-header",!e&&"without-border"),dir:p.isRtl?"rtl":void 0,children:[p("Recent"),(0,ie.Y)(Z.A,{className:"clear-recent-chats",round:!0,size:"smaller",color:"translucent",ariaLabel:p("Clear"),onClick:m,isRtl:p.isRtl,children:(0,ie.Y)(Q.A,{name:"close"})})]}),i.map(e=>(0,ie.Y)(Bc,{chatId:e,withOpenAppButton:!0,onClick:u}))]})]})})),Wc=(0,Ae.nF)(e=>e(),500,!1),Qc=(0,s.ph)((0,n.EK)((e,{isChannelList:t})=>{const{userIds:i}=e.contactList||{},{currentUserId:s,messages:n}=e;if(!i)return{};const{fetchingStatus:a,globalResults:r,localResults:l,resultsByType:d,sponsoredPeer:h}=(0,c.nTw)(e).globalSearch,{peerIds:u}=r||{},{peerIds:m}=l||{},{byChatId:p}=n,v=d?.[t?"channels":"text"]?.foundIds,{similarChannelIds:g}=(0,c.dg4)(e,o.rBM)||{};return{currentUserId:s,contactIds:i,accountPeerIds:m,globalPeerIds:u,foundIds:v,globalMessagesByChatId:p,fetchingStatus:a,sponsoredPeer:h,suggestedChannelIds:g}})(({isChannelList:e,searchQuery:t,searchDate:i,dateSearchQuery:r,currentUserId:c,contactIds:d,accountPeerIds:h,globalPeerIds:u,foundIds:m,globalMessagesByChatId:p,fetchingStatus:v,suggestedChannelIds:g,sponsoredPeer:f,onReset:b,onSearchDateSelect:C})=>{const{openChat:y,addRecentlyFoundChatId:S,searchMessagesGlobal:k,setGlobalSearchChatId:N,loadChannelRecommendations:w}=(0,n.ko)(),I=(0,s.li)(),P=(0,s.li)(),F=(0,Ri.A)(),{isMobile:D}=(0,Y.Ay)(),[T,B]=(0,s.J0)(!1),[L,R]=(0,s.J0)(!1),[x,E]=(0,s.J0)("all"),V=(0,s.li)();(0,Se.A)(()=>{e&&w({})});const _=(0,s.hb)(({direction:t})=>{t===a.TN.Backwards&&Wc(()=>{k({type:e?"channels":"text",context:x})})},[t,x]),U=(0,s.hb)(e=>{y({id:e,shouldReplaceHistory:!0}),e!==c&&S({id:e}),D||b()},[y,c,D,S,b]),O=(0,s.hb)(e=>{N({id:e})},[N]);function K(e){return F("users"===e?"PrivateChatsSearchContext":"groups"===e?"GroupChatsSearchContext":"channels"===e?"ChannelsSearchContext":"AllChatsSearchContext")}const{isContextMenuOpen:J,contextMenuAnchor:G,handleContextMenu:j,handleContextMenuClose:z,handleContextMenuHide:H}=(0,vn.A)(V),$=(0,M.A)(()=>V.current),q=(0,M.A)(()=>V.current.querySelector(".chatResultsContextMenu .bubble")),W=(0,M.A)(()=>V.current.querySelector(".menuTrigger")),Z=(0,M.A)(e=>{j(e)}),X=(0,pe.A)("icon","iconPlaceholder"),ee=(0,s.Kr)(()=>{if(!e&&(!t||t.startsWith("@")&&t.length<2))return vi.p;const i=(0,n.mS)().chats.byId,s=((0,jc.YA)(o.DSF)??[]).filter(t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)}),a=(0,Dt.PU)({ids:s,query:t,type:"chat"});if(e)return a;const r=[...c?[c]:[],...d||[]],u=[...(0,Dt.PU)({ids:r,query:t,type:"user"}),...a];return(0,pi.Am)([...(0,Is.A)(u,void 0,c?[c]:void 0),...(0,Is.A)(h||[])])},[t,c,d,h,e]);(0,yn.A)(P,!ee.length||e,!0);const te=(0,s.Kr)(()=>{if(!t||t.length<4||!u)return vi.p;const i=(0,n.mS)().chats.byId,s=u.filter(t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)});return(0,Is.A)(s,!0)},[u,e,t]),se=(0,s.Kr)(()=>{if(!t&&!i||!m||0===m.length)return vi.p;const s=(0,n.mS)().chats.byId;return m.map(t=>{const[i,n]=(0,Cc.a)(t),a=s[i];if(a&&(!e||(0,l.WX)(a)))return p?.[i]?.byId[n]}).filter(Boolean)},[t,i,m,e,p]);(0,s.vJ)(()=>{t&&k({type:e?"channels":"text",context:x,shouldResetResultsByType:!0,shouldCheckFetchingMessagesStatus:!0})},[x]);const ne=(0,s.hb)(()=>{B(!T)},[T]),oe=(0,s.hb)(()=>{R(!L)},[L]),re=se,le="all"===x&&v&&!v.chats&&!v.messages&&!ee.length&&!te.length&&!re.length,ce=v?.messages,de=!t&&!i&&!e,{observe:ue}=(0,nr.BL)({rootRef:I,throttleMs:200,isDisabled:!de});if(de)return(0,ie.Y)(qc,{onReset:b});const me="all"!==x||Boolean(re.length);return(0,ie.FD)(vs.A,{ref:I,className:"LeftSearch--content custom-scroll",items:re,onLoadMore:_,noScrollRestoreOnTop:!0,noFastList:!0,children:[r&&(0,ie.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ie.Y)(Uc,{searchDate:r,onSelect:C})}),le&&(0,ie.Y)(Nc.A,{withSticker:!0,text:F("ChatListSearchNoResults"),description:F("ChatListSearchNoResultsDescription")}),Boolean(ee.length)&&!e&&(0,ie.Y)("div",{className:"chat-selection no-scrollbar",dir:F.isRtl?"rtl":void 0,ref:P,children:ee.map(e=>(0,ie.Y)(Er.A,{peerId:e,className:"left-search-local-suggestion",onClick:O,clickArg:e}))}),Boolean(ee.length)&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[ee.length>5&&(0,ie.Y)(No.A,{className:"Link",onClick:ne,children:F(T?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F(e?"SearchResultMyChannels":"DialogListSearchSectionDialogs")]}),ee.map((e,t)=>{if(T||!(t>=5))return(0,ie.Y)(Bc,{withOpenAppButton:!0,chatId:e,onClick:U})})]}),Boolean(te.length)&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[te.length>5&&(0,ie.Y)(No.A,{className:"Link",onClick:oe,children:F(L?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F("DialogListSearchSectionGlobal")]}),f&&(0,ie.Y)(Hc,{sponsoredPeer:f,observeIntersection:ue}),te.map((e,t)=>{if(L||!(t>=5))return(0,ie.Y)(Bc,{chatId:e,withUsername:!0,onClick:U})})]}),Boolean(g?.length)&&!t&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.Y)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:F("SearchResultRecommendedChannels")}),g.map(e=>(0,ie.Y)(Bc,{chatId:e,withUsername:!0,onClick:U}))]}),(0,ie.FD)("div",{className:"menuOwner",ref:V,children:[(0,ie.Y)(We.A,{isOpen:J,anchor:G,getTriggerElement:W,getRootElement:$,getMenuElement:q,className:"chatResultsContextMenu",onClose:z,onCloseAnimationEnd:H,autoClose:!0,children:(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(he.A,{icon:"all"===x?"check":void 0,customIcon:"all"!==x?(0,ie.Y)("i",{className:X}):void 0,onClick:()=>E("all"),children:K("all")}),(0,ie.Y)(he.A,{icon:"users"===x?"check":void 0,customIcon:"users"!==x?(0,ie.Y)("i",{className:X}):void 0,onClick:()=>E("users"),children:K("users")}),(0,ie.Y)(he.A,{icon:"groups"===x?"check":void 0,customIcon:"groups"!==x?(0,ie.Y)("i",{className:X}):void 0,onClick:()=>E("groups"),children:K("groups")}),(0,ie.Y)(he.A,{icon:"channels"===x?"check":void 0,customIcon:"channels"!==x?(0,ie.Y)("i",{className:X}):void 0,onClick:()=>E("channels"),children:K("channels")})]})}),me&&(0,ie.FD)("div",{className:"search-section",children:[(0,ie.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[!e&&(0,ie.FD)(No.A,{className:"Link menuTrigger dropDownLink",onClick:Z,children:[F("SearchContextCaption",{type:K(x)},{withNodes:!0}),(0,ie.FD)(ae.Ay,{name:"fade",shouldCleanup:!0,activeKey:Number(ce),className:"iconContainer",slideClassName:"iconContainerSlide",children:[ce&&(0,ie.Y)(Ms.A,{}),!ce&&(0,ie.Y)(Q.A,{name:"down"})]})]}),F("SearchMessages")]}),re.map(function(e){const i=(0,n.mS)().chats.byId,s=(0,A.C)(F,e),a=i[e.chatId];if(s&&a)return(0,ie.Y)(_c,{chatId:e.chatId,message:e,searchQuery:t})})]})]})]})}));var Zc=i(55723);const Xc="documents",ed=(0,Ae.nF)(e=>e(),500,!0),td=(0,s.ph)((0,n.EK)(yc(Xc))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:c,foundIds:d,activeDownloads:h,shouldWarnAboutFiles:u})=>{const{searchMessagesGlobal:m,focusMessage:p}=(0,n.ko)(),v=(0,s.li)(),g=(0,T.A)(),{observe:A}=(0,nr.BL)({rootRef:v,throttleMs:500}),f=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&ed(()=>{m({type:Xc})})},[e]),b=(0,s.Kr)(()=>d&&c?d.map(e=>{const[t,i]=(0,Cc.a)(e),s=c[t]?.byId[i];return s&&(0,l.zC)(s)?s:void 0}).filter(Boolean):vi.p,[c,d]),C=(0,s.hb)(e=>{p({chatId:e.chatId,messageId:e.id})},[p]),y=(0,ir.A)([e],o.jhd)&&!t;return(0,ie.Y)(ae.Ay,{ref:v,slideClassName:"LeftSearch--content",name:"fade",activeKey:y?1:0,shouldCleanup:!0,children:(0,ie.FD)(vs.A,{className:"search-content documents-list custom-scroll",items:y?b:void 0,onLoadMore:f,noFastList:!0,children:[!y&&(0,ie.Y)(Ms.A,{}),y&&(!d||0===d.length)&&(0,ie.Y)(Nc.A,{withSticker:!0,text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),y&&d&&d.length>0&&b.map((e,t)=>{const s=0===t||(0,$e.$$)(e.date)!==(0,$e.$$)(b[t-1].date);return(0,ie.FD)(ie.FK,{children:[s&&(0,ie.Y)("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0,children:(0,$e.i6)(g,new Date(1e3*e.date))},e.date),(0,ie.Y)("div",{className:"ListItem small-icon",children:(0,ie.Y)(Zc.A,{document:(0,l.zC)(e),message:e,datetime:e.date,smaller:!0,sender:(0,Sc.N)(g,e,i,r),className:"scroll-item",isDownloading:(0,l.$r)(h,e.content.document),shouldWarnAboutFiles:u,observeIntersection:A,onDateClick:C})},e.id)]})})]})})}));var id=i(37378);const sd="links",nd=(0,Ae.nF)(e=>e(),500,!0),ad=(0,s.ph)((0,n.EK)(yc(sd))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:l,foundIds:c,isChatProtected:d})=>{const{searchMessagesGlobal:h,focusMessage:u}=(0,n.ko)(),m=(0,s.li)(),p=(0,T.A)(),{observe:v}=(0,nr.BL)({rootRef:m,throttleMs:500}),g=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&nd(()=>{h({type:sd})})},[e]),A=(0,s.Kr)(()=>c&&l?c.map(e=>{const[t,i]=(0,Cc.a)(e);return l[t]?.byId[i]}).filter(Boolean):vi.p,[l,c]),f=(0,s.hb)(e=>{u({chatId:e.chatId,messageId:e.id})},[u]),b=(0,ir.A)([e],o.jhd)&&!t;return(0,ie.Y)(ae.Ay,{ref:m,slideClassName:"LeftSearch--content",name:"fade",activeKey:b?1:0,shouldCleanup:!0,children:(0,ie.FD)(vs.A,{className:"search-content documents-list custom-scroll",items:b?A:void 0,onLoadMore:g,noFastList:!0,children:[!b&&(0,ie.Y)(Ms.A,{}),b&&(!c||0===c.length)&&(0,ie.Y)(Nc.A,{withSticker:!0,text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),b&&c&&c.length>0&&A.map((e,t)=>{const s=0===t||(0,$e.$$)(e.date)!==(0,$e.$$)(A[t-1].date);return(0,ie.FD)(ie.FK,{children:[s&&(0,ie.Y)("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0,children:(0,$e.i6)(p,new Date(1e3*e.date))},e.date),(0,ie.Y)("div",{className:"ListItem small-icon",dir:p.isRtl?"rtl":void 0,children:(0,ie.Y)(id.A,{message:e,senderTitle:(0,Sc.N)(p,e,i,r),isProtected:d||e.isProtected,observeIntersection:v,onMessageClick:f},e.id)},e.id)]})})]})})}));var od=i(81524);const rd="media",ld=(0,Ae.nF)(e=>e(),500,!0),cd=(0,s.ph)((0,n.EK)(yc(rd))(({searchQuery:e,isLoading:t,globalMessagesByChatId:i,foundIds:r,isChatProtected:l})=>{const{searchMessagesGlobal:c,openMediaViewer:d}=(0,n.ko)(),h=(0,s.li)(),u=(0,T.A)(),{observe:m}=(0,nr.BL)({rootRef:h,throttleMs:500}),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&ld(()=>{c({type:rd})})},[c,e]),v=(0,s.Kr)(()=>r&&i?r.map(e=>{const[t,s]=(0,Cc.a)(e);return i[t]?.byId[s]}).filter(Boolean):vi.p,[i,r]),g=(0,s.hb)((e,t)=>{d({chatId:t,messageId:e,origin:a.TQ.SearchResult})},[d]),A=(0,ir.A)([e],o.jhd)&&!t,f=A&&r&&r.length>0&&!e,b=A&&r&&r.length>0&&e,C=(0,pe.A)("search-content custom-scroll",b&&"chat-list");return(0,ie.Y)(ae.Ay,{ref:h,slideClassName:"LeftSearch--content LeftSearch--media",name:"fade",activeKey:A?1:0,shouldCleanup:!0,children:(0,ie.FD)(vs.A,{className:C,items:A?v:void 0,itemSelector:e?".ListItem":".Media",onLoadMore:p,noFastList:!0,children:[!A&&(0,ie.Y)(Ms.A,{}),A&&(!r||0===r.length)&&(0,ie.Y)(Nc.A,{withSticker:!0,text:u("ChatList.Search.NoResults"),description:u("ChatList.Search.NoResultsDescription")}),f&&(0,ie.Y)("div",{className:"media-list",dir:u.isRtl?"rtl":void 0,children:v.map(e=>(0,ie.Y)(od.A,{idPrefix:"search-media",message:e,isProtected:l||e.isProtected,observeIntersection:m,onClick:g},`${e.chatId}-${e.id}`))}),b&&v.map(e=>(0,ie.Y)(_c,{chatId:e.chatId,message:e},e.id))]})})}));var dd=i(537),hd=i(61361);const ud={container:"fHc6WtIe",content:"N8GlyYo0",loadingScreen:"l7JTscdP",searchButtonContent:"dqfofU9e",sticker:"bhaEA7Az",title:"HkiOz0kI",description:"B5FR0TSV",searchButton:"Ii0w2ObZ",remainingSearches:"fYxU7PVl",searchIcon:"NMdA935k",searchIconWithNext:"NqAG2PXY",searchQuery:"eRsI0lkH",limitTitle:"uAggPEqN",limitDescription:"oirV9yqd",paidSearchButton:"LMu5PMXS",freeSearchUnlock:"IdgXsecy",premiumTitle:"SBmNHjsL",premiumDescription:"KoW3G8Sv",subscribePremiumButton:"tGWjYFeK",premiumSubtitle:"o2V6uF3Y"},md=(0,Ae.nF)(e=>e(),500,!1),pd=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),starsBalance:e.stars?.balance?.amount||0}))(({searchQuery:e,searchFlood:t,onSearch:i,isLoading:a,isCurrentUserPremium:r,starsBalance:l})=>{const{checkSearchPostsFlood:c,openPremiumModal:d,openStarsBalanceModal:h}=(0,n.ko)(),u=(0,Ri.A)(),m=t?.queryIsFree,p=t?.query,v=(0,dd.A)([e?.slice(0,18).trimEnd()]),g=(0,M.A)(()=>{i()});(0,s.vJ)(()=>{m&&e&&p===e&&i()},[m,e,p,i]);const A=(0,M.A)(()=>{const e=t?.starsAmount||0;l<e?h({topup:{balanceNeeded:e}}):i()});(0,s.vJ)(()=>{e&&p!==e&&md(()=>{c({query:e})})},[e,p]);const f=(0,M.A)(()=>{c({})}),b=(0,M.A)(()=>{d()}),C=(0,Ti.Fm)(),y=0===t?.remains||t?.waitTill&&t.waitTill>C;return(0,ie.Y)(ae.Ay,{name:"fade",activeKey:r?a?2:y?0:1:3,children:r?a?(0,ie.Y)("div",{className:ud.container,children:(0,ie.Y)("div",{className:(0,pe.A)(ud.content,ud.loadingScreen),children:(0,ie.Y)(Ms.A,{})})}):y?(()=>{const i=t?.waitTill,s=t?.starsAmount||o._tP,n=t?.totalDaily||o.M3$;return(0,ie.Y)("div",{className:ud.container,children:(0,ie.FD)("div",{className:ud.content,children:[(0,ie.Y)(Cr.A,{className:ud.sticker,size:120,tgsUrl:br.w.Search,previewUrl:br.d.Search,nonInteractive:!0,noLoop:!1}),(0,ie.Y)("div",{className:ud.limitTitle,children:u("PublicPostsLimitReached")}),(0,ie.Y)("div",{className:ud.limitDescription,children:u("HintPublicPostsSearchQuota",{count:n},{pluralValue:n})}),(0,ie.Y)(Z.A,{className:ud.paidSearchButton,color:"primary",disabled:!e,noForcedUpperCase:!0,onClick:A,children:u("PublicPostsSearchForStars",{stars:(0,Mi.U2)(u,s,{asFont:!0})},{withNodes:!0})}),Boolean(i)&&(0,ie.Y)("div",{className:ud.freeSearchUnlock,children:u("UnlockTimerPublicPostsSearch",{time:(0,ie.Y)(hd.A,{endsAt:i+2,onEnd:f})},{withNodes:!0})})]})})})():(()=>{const i=t?.remains||0;return(0,ie.Y)("div",{className:ud.container,children:(0,ie.FD)("div",{className:ud.content,children:[(0,ie.Y)(Cr.A,{className:ud.sticker,size:120,tgsUrl:br.w.Search,previewUrl:br.d.Search,nonInteractive:!0,noLoop:!1}),(0,ie.Y)("div",{className:ud.title,children:u("GlobalSearch")}),(0,ie.Y)("div",{className:ud.description,children:u("DescriptionPublicPostsSearch")}),(0,ie.Y)(Z.A,{className:ud.searchButton,color:"primary",noForcedUpperCase:!0,disabled:!e,onClick:g,children:(0,ie.Y)(ae.Ay,{name:"fade",activeKey:v,children:(0,ie.FD)("div",{className:ud.searchButtonContent,children:[(0,ie.Y)(Q.A,{name:"search",className:(0,pe.A)(ud.searchIcon,e&&ud.searchIconWithNext)}),u("ButtonSearchPublicPosts",{query:e?(0,ie.Y)("span",{className:ud.searchQuery,children:e}):""},{withNodes:!0}),e&&(0,ie.Y)(Q.A,{name:"next",className:ud.nextIcon})]})})}),(0,ie.Y)("div",{className:ud.remainingSearches,children:u("RemainingPublicPostsSearch",{count:i},{pluralValue:i})})]})})})():(0,ie.Y)("div",{className:ud.container,children:(0,ie.FD)("div",{className:ud.content,children:[(0,ie.Y)("div",{className:ud.premiumTitle,children:u("GlobalSearch")}),(0,ie.Y)("div",{className:ud.premiumDescription,children:u("PublicPostsPremiumFeatureDescription")}),(0,ie.Y)(Z.A,{className:ud.subscribePremiumButton,color:"primary",noForcedUpperCase:!0,onClick:b,children:u("PublicPostsSubscribeToPremium")}),(0,ie.Y)("div",{className:ud.premiumSubtitle,children:u("PublicPostsPremiumFeatureSubtitle")})]})})})})),vd=(0,Ae.nF)(e=>e(),500,!0),gd=(0,s.ph)((0,n.EK)(e=>{const{messages:{byChatId:t}}=e,{resultsByType:i,searchFlood:s,fetchingStatus:n}=(0,c.nTw)(e).globalSearch,a=i?.publicPosts,{foundIds:o}=a||{},r=Boolean(n?.publicPosts&&!a),l=!a&&!r,d=a&&!o?.length,{animationLevel:h}=(0,un.l)(e);return{foundIds:o,globalMessagesByChatId:t,searchFlood:s,shouldShowSearchLauncher:l,isNothingFound:d,isLoading:r,animationLevel:h}})(({searchQuery:e,foundIds:t,globalMessagesByChatId:i,searchFlood:o,shouldShowSearchLauncher:r,isNothingFound:l,isLoading:c,animationLevel:d})=>{const{searchMessagesGlobal:h}=(0,n.ko)(),u=(0,Ri.A)(),m=(0,M.A)(()=>{e&&h({type:"publicPosts",shouldResetResultsByType:!0})}),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&vd(()=>{h({type:"publicPosts"})})},[]),v=(0,s.Kr)(()=>t&&0!==t.length?t.map(e=>{const[t,s]=(0,Cc.a)(e);return i?.[t]?.byId[s]}).filter(Boolean):vi.p,[t,i]);return(0,ie.Y)(ae.Ay,{name:(0,fc.P)("slideOptimized",d,void 0,u.isRtl),activeKey:r||c?0:1,children:r||c?(0,ie.Y)(pd,{searchQuery:e,searchFlood:o,onSearch:m,isLoading:c}):(0,ie.Y)("div",{className:"LeftSearch--content",children:(0,ie.FD)(vs.A,{className:"search-content custom-scroll chat-list",items:v,onLoadMore:p,noFastList:!0,children:[l&&(0,ie.Y)(Nc.A,{text:u("ChatListSearchNoResults"),description:u("ChatListSearchNoResultsDescription"),withSticker:!0}),Boolean(v.length)&&(0,ie.FD)("div",{className:"pb-2",children:[(0,ie.Y)("h3",{className:"section-heading",dir:u.isRtl?"auto":void 0,children:u("PublicPosts")}),v.map(function(t){const i=(0,n.mS)().chats.byId,s=(0,A.C)(u,t),a=i[t.chatId];if(s&&a)return(0,ie.Y)(_c,{chatId:t.chatId,message:t,searchQuery:e},`${t.chatId}-${t.id}`)})]})]},e)})})})),Ad=[{type:a.$C.ChatList,key:"SearchTabChats"},{type:a.$C.ChannelList,key:"SearchTabChannels"},{type:a.$C.BotApps,key:"SearchTabApps"},{type:a.$C.PublicPosts,key:"SearchTabPublicPosts"},{type:a.$C.Media,key:"SearchTabMedia"},{type:a.$C.Links,key:"SearchTabLinks"},{type:a.$C.Files,key:"SearchTabFiles"},{type:a.$C.Music,key:"SearchTabMusic"},{type:a.$C.Voice,key:"SearchTabVoice"}],fd=[{type:a.$C.ChatList,key:"SearchTabMessages"},...Ad.slice(3)],bd=(0,s.ph)((0,n.EK)(e=>{const{currentContent:t,chatId:i}=(0,c.nTw)(e).globalSearch,{animationLevel:s}=(0,un.l)(e);return{currentContent:t,chatId:i,animationLevel:s}})(({searchQuery:e,searchDate:t,isActive:i,currentContent:o=a.$C.ChatList,chatId:r,animationLevel:l,onReset:c})=>{const{setGlobalSearchContent:d,setGlobalSearchDate:h,checkSearchPostsFlood:u}=(0,n.ko)(),m=(0,Ri.A)(),[p,v]=(0,s.J0)(o),g=(0,s.Kr)(()=>(0,$e.Rm)(e),[e]);(0,s.vJ)(()=>{i&&u({})},[i]);const A=(0,s.Kr)(()=>(r?fd:Ad).map(e=>({...e,title:m(e.key)})),[r,m]),f=(0,M.A)(e=>{const t=A[e];d({content:t.type}),v(e)}),b=(0,M.A)(e=>{h({date:e.getTime()/1e3})});(0,ye.A)({isActive:i,onBack:c});const C=(0,s.li)(),y=(0,Ds.A)(C,i,void 0,".ListItem-button",!0);return(0,ie.FD)("div",{className:"LeftSearch",ref:C,onKeyDown:y,children:[(0,ie.Y)(bc.A,{activeTab:p,tabs:A,onSwitchTab:f}),(0,ie.Y)(ae.Ay,{name:(0,fc.P)("slideOptimized",l,void 0,m.isRtl),renderCount:A.length,activeKey:o,children:(()=>{switch(o){case a.$C.ChatList:case a.$C.ChannelList:return r?(0,ie.Y)(Gc,{searchQuery:e,dateSearchQuery:g,onReset:c,onSearchDateSelect:b}):(0,ie.Y)(Qc,{isChannelList:o===a.$C.ChannelList,searchQuery:e,searchDate:t,dateSearchQuery:g,onReset:c,onSearchDateSelect:b});case a.$C.Media:return(0,ie.Y)(cd,{searchQuery:e});case a.$C.Links:return(0,ie.Y)(ad,{searchQuery:e});case a.$C.Files:return(0,ie.Y)(td,{searchQuery:e});case a.$C.Music:return(0,ie.Y)(Ic,{searchQuery:e},"audio");case a.$C.Voice:return(0,ie.Y)(Ic,{isVoice:!0,searchQuery:e},"voice");case a.$C.BotApps:return(0,ie.Y)(Rc,{searchQuery:e},"botApps");case a.$C.PublicPosts:return(0,ie.Y)(gd,{searchQuery:e},"publicPosts");default:return}})()})]})}));var Cd=i(42215);const yd={currentPassword:"",password:"",hint:"",email:""},Sd=(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 yd;default:return e}};var kd=i(60406),Nd=i(31880),wd=i(58968),Id=i(74984);const Pd=(0,s.ph)((0,n.EK)(e=>({maxChats:(0,la.d)(e,"dialogFiltersChats")}))(({mode:e,state:t,dispatch:i,isActive:a,onReset:r,onSaveFilter:l,maxChats:c})=>{const d=(0,T.A)(),{openLimitReachedModal:h}=(0,n.ko)(),{chatFilter:u}=t,{selectedChatIds:m,selectedChatTypes:p}=(0,s.Kr)(()=>(0,Nd.a)(t,e,!0),[e,t]),v="included"===e?wd.V2:wd.LS,[g,A]=(0,s.J0)(!1),f=(0,Id.Rh)(o.DSF),b=(0,Id.Rh)(o._E9),C=t.folder.isChatList;(0,s.vJ)(()=>{a||A(!1)},[a]);const y=(0,s.Kr)(()=>{const e=[...f||[],...b||[]];return(0,pi.Am)([...(0,Dt.PU)({ids:e,query:u,type:"chat"})])},[f,b,u]),S=(0,M.A)(e=>{i({type:"setChatFilter",payload:e}),A(!0)}),k=(0,M.A)(s=>{if("included"===e){if(s.length>=c)return void h({limit:"dialogFiltersChats"});i({type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:s}})}else i({type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:s}});A(!0)}),N=(0,M.A)(t=>{const s={};t.forEach(e=>{s[e]=!0}),i("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:m,...s}}:{type:"setExcludeFilters",payload:{excludedChatIds:m,...s}}),A(!0)});return(0,ye.A)({isActive:a,onBack:r}),y?(0,ie.FD)("div",{className:"Picker settings-folders-chat-list",children:[(0,ie.Y)(gi.A,{categories:C?void 0:v,itemIds:y,selectedIds:m,selectedCategories:p,filterValue:u,filterPlaceholder:d("Search"),categoryPlaceholderKey:"FilterChatTypes",searchInputId:"new-group-picker-search",isSearchable:!0,withDefaultPadding:!0,withPeerTypes:!0,allowMultiple:!0,itemInputType:"checkbox",onSelectedIdsChange:k,onSelectedCategoriesChange:N,onFilterChange:S}),(0,ie.Y)(bi.A,{isShown:g,onClick:l,ariaLabel:d("Save"),iconName:"check"})]}):(0,ie.Y)(Ms.A,{})}));var Yd=i(72167),Fd=i(98021);const Dd=(0,s.ph)(({isOpen:e,onEmojiSelect:t,onClose:i})=>{const n=(0,s.hb)(e=>{t(e),i()},[i,t]);return(0,ie.Y)(We.A,{isOpen:e,positionX:"left",onClose:i,withPortal:!0,className:"settings-folders-icon-picker-menu SymbolMenu",children:(0,ie.FD)("div",{className:"SymbolMenu-main",children:[(0,ie.Y)("div",{className:"settings-folders-icon-picker-menu-folders",children:Object.keys(Fd.E6).map(e=>(0,ie.Y)("div",{className:"EmojiButton",onClick:()=>n(e),children:(0,ie.Y)(Q.A,{name:Fd.E6[e]})}))}),(0,ie.Y)(Lr,{idPrefix:"folder-emoji-set-",loadAndPlay:e,isHidden:!e,onCustomEmojiSelect:e=>n(e),onContextMenuClick:i,onContextMenuClose:i})]})})}),Md=[0,1,2,3,4,5,6],Td="Please provide a title for this folder.",Bd="ChatList.Filter.Error.Empty",Ld=(0,s.ph)((0,n.EK)((e,{state:t})=>{const{listIds:i}=e.chats,{byId:s,invites:n}=e.chatFolders,a=Object.values(s).reduce((e,t)=>e+(t.isChatList?1:0),0),o=(0,c.g29)(e);return{loadedActiveChatIds:i.active,loadedArchivedChatIds:i.archived,invites:t.folderId?n[t.folderId]||vi.p:void 0,isRemoved:void 0!==t.folderId&&!s[t.folderId],maxInviteLinks:(0,la.d)(e,"chatlistInvites"),maxChatLists:(0,la.d)(e,"chatlistJoined"),chatListCount:a,isCurrentUserPremium:o}})(({state:e,dispatch:t,onAddIncludedChats:i,onAddExcludedChats:a,onShareFolder:r,onOpenInvite:l,isActive:d,onReset:h,isRemoved:u,onBack:m,loadedActiveChatIds:p,isOnlyInvites:g,loadedArchivedChatIds:A,invites:f,maxInviteLinks:b,maxChatLists:C,chatListCount:y,onSaveFolder:S,isCurrentUserPremium:k,isMobile:N})=>{const{loadChatlistInvites:w,openLimitReachedModal:I,showNotification:P,openPremiumModal:Y}=(0,n.ko)(),F="create"===e.mode,D=e.folder.isChatList,[B,L]=(0,s.J0)(!1),[R,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)(!1);(0,s.vJ)(()=>{u&&h()},[u,h]),(0,s.vJ)(()=>{d&&e.folderId&&e.folder.isChatList&&w({folderId:e.folderId})},[d,e.folder.isChatList,e.folderId]);const{selectedChatIds:_,selectedChatTypes:U}=(0,s.Kr)(()=>(0,Nd.a)(e,"included"),[e]),{selectedChatIds:O,selectedChatTypes:J}=(0,s.Kr)(()=>(0,Nd.a)(e,"excluded"),[e]);(0,s.vJ)(()=>{L(!1),x(!1)},[e.folderId]);const[G,j]=(0,s.Kr)(()=>{const e=new Set([...p||[],...A||[]]),t=(0,pi.$h)(_,e),i=(0,pi.$h)(O,e);return[B?t:t.slice(0,5-U.length),R?i:i.slice(0,5-J.length)]},[O,_,U,J,R,B,p,A]),z=(0,T.A)();(0,ye.A)({isActive:d,onBack:m});const H=(0,s.Kr)(()=>e.folder.title.entities?.find(e=>e.type===K.C7.CustomEmoji&&0===e.offset),[e.folder.title]),$=(0,s.Kr)(()=>o.kGl-(H?H.length:0),[H]),q=(0,s.hb)(i=>{let s=e.folder.title.text;const n=[];let a="🗂";if(H){const{offset:e,length:t}=H;s=s.replace(s.substring(e,e+t),"")}if("string"==typeof i)a=i;else{const{id:e,emoji:t}=i;n.push({type:K.C7.CustomEmoji,documentId:e,offset:0,length:t?.length||2}),t&&(s=`${t}${s}`,a=t,s.length>$&&(s=s.slice(0,$)))}t({type:"setEmoticon",payload:a}),t({type:"setTitle",payload:{text:s,entities:n}})},[t,H,e.folder.title,$]),W=(0,s.hb)(e=>{const{currentTarget:i}=e;let s=i.value;if(H){const{emoji:e}=(0,c.O8F)((0,n.mS)(),H.documentId);s=`${e}${s}`}t({type:"setTitle",payload:{text:s,entities:H?[H]:[]}})},[t,H]),Z=(0,s.hb)(()=>{t({type:"setIsLoading",payload:!0}),S(()=>{setTimeout(()=>{h()},500)})},[t,S,h]),ee=(0,s.hb)(()=>{f?(0,c.w5O)((0,n.mS)(),e.folderId)?y>=C&&!e.folder.isChatList?I({limit:"chatlistJoined"}):f.length<b?e.isTouched?S(r):r():I({limit:"chatlistInvites"}):P({message:z("ChatList.Filter.InviteLink.IncludeExcludeError")}):F&&S(r)},[f,e.folderId,e.isTouched,y,b,F,S,r,z,C,e.folder.isChatList]),te=(0,s.hb)((t,i)=>{e.isTouched?S(()=>l(i)):l(i)},[S,l,e.isTouched]);function se(e){const t="included"===e?U:J,i="included"===e?G:j,s="included"===e?B:R,n=("included"===e?_:O).length-i.length,a="included"===e?()=>L(!0):()=>x(!0);return(0,ie.FD)(ie.FK,{children:[t.map(t=>function(e,t){const i="included"===t?wd.V2.find(({type:t})=>t===e):wd.LS.find(({type:t})=>t===e);if(i)return(0,ie.Y)(ui.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,ie.Y)(bs.A,{avatarSize:"small",customPeer:i})},i.type)}(t,e)),i.map(e=>(0,ie.Y)(ui.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,v.L8)(e)?(0,ie.Y)(bs.A,{avatarSize:"small",userId:e}):(0,ie.Y)(fs.A,{avatarSize:"small",chatId:e})})),!s&&n>0&&(0,ie.Y)(ui.A,{className:"settings-folders-list-item",narrow:!0,onClick:a,icon:"down",children:z("FilterShowMoreChats",n,"i")},"load-more")]})}const ne=(0,M.A)(e=>{q(e)}),ae=(0,M.A)(()=>{V(!1)}),oe=(0,M.A)(()=>{V(!0)}),re=(0,s.Kr)(()=>{let t=e.folder.title.text;if(H){const{offset:e,length:i}=H;t=t.substring(e+i,t.length)}return t},[e.folder.title.text,H]);return(0,ie.FD)("div",{className:"settings-fab-wrapper",children:[(0,ie.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header",children:[(0,ie.Y)(Cr.A,{size:o.fwn,tgsUrl:br.w.FoldersNew,play:String(e.folderId),className:"settings-content-icon"}),F&&(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterIncludeInfo")}),(0,ie.FD)("div",{className:"settings-folders-input-container",children:[(0,ie.Y)(X.A,{className:(0,pe.A)("mb-0",!N&&"settings-folders-input-with-icon"),label:z("FilterNameHint"),value:re,maxLength:$,onChange:W,error:e.error&&e.error===Td?Td:void 0}),!N&&(0,ie.FD)("div",{className:"settings-folders-icon-picker",dir:z.isRtl?"rtl":void 0,children:[(0,ie.Y)("div",{className:"settings-folders-icon-picker-button",onClick:oe,children:(0,ie.Y)(Yd.A,{emoji:e.folder.emoticon,customEmojiId:H?.documentId,shouldAnimate:e.folder.noTitleAnimations})}),(0,ie.Y)(Dd,{isOpen:E,onEmojiSelect:ne,onClose:ae})]})]})]}),!g&&(0,ie.FD)("div",{className:"settings-item",children:[e.error&&e.error===Bd&&(0,ie.Y)("p",{className:"settings-item-description color-danger mb-2",dir:z.isRtl?"rtl":void 0,children:z(e.error)}),(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterInclude")}),(0,ie.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:i,children:z("FilterAddChats")}),se("included")]}),!g&&!D&&(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterExclude")}),(0,ie.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:a,children:z("FilterAddChats")}),se("excluded")]}),(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.FD)("h4",{className:"settings-item-header mb-3 color-picker-header",dir:z.isRtl?"rtl":void 0,children:[(0,ie.Y)("span",{className:"color-picker-title-text",children:z("FilterColorTitle")}),(0,ie.Y)("div",{className:(0,pe.A)("color-picker-title","color-picker-selected-color",k&&void 0!==e.folder.color&&-1!==e.folder.color?(0,Wi.yp)(e.folder.color):"color-picker-item-disabled"),children:(0,$i.fd)({text:e.folder.title.text,entities:e.folder.title.entities,noCustomEmojiPlayback:e.folder.noTitleAnimations})})]}),(0,ie.FD)("div",{className:"color-picker custom-scroll-x",children:[Md.map(i=>(0,ie.Y)("button",{type:"button",onClick:()=>{k?t({type:"setColor",payload:i}):Y()},className:(0,pe.A)("color-picker-item",(0,Wi.yp)(i),!k&&"color-picker-item-hover-disabled",i===e.folder.color&&k&&"color-picker-item-active")},i)),(0,ie.Y)("button",{type:"button",onClick:()=>{k?t({type:"setColor",payload:void 0}):Y()},className:(0,pe.A)("color-picker-item","color-picker-item-none",(void 0===e.folder.color||-1===e.folder.color||!k)&&"color-picker-item-active"),children:k?(0,ie.Y)(Q.A,{name:"close",className:"color-picker-item-none-icon"}):(0,ie.Y)(Q.A,{name:"lock-badge",className:"color-picker-item-none-icon"})})]}),(0,ie.Y)("p",{className:"settings-item-description mb-0 mt-3",dir:z.isRtl?"rtl":void 0,children:z("FilterColorHint")})]}),(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FolderLinkScreen.Title")}),(0,ie.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:ee,children:z("ChatListFilter.CreateLinkNew")}),f?.map(e=>(0,ie.FD)(ui.A,{className:"settings-folders-list-item",icon:"link",narrow:!0,multiline:!0,onClick:te,clickArg:e.url,children:[(0,ie.Y)("span",{className:"title",dir:"auto",children:e.title||e.url}),(0,ie.Y)("span",{className:"subtitle",children:z("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i")})]}))]})]}),(0,ie.Y)(bi.A,{isShown:Boolean(e.isTouched),disabled:e.isLoading,onClick:Z,ariaLabel:"edit"===e.mode?"Save changes":"Create folder",iconName:"check",isLoading:e.isLoading})]})}));var Rd=i(80401);const xd=(0,Ae.nF)(e=>e(),6e4,!0),Ed=(0,s.ph)((0,n.EK)(e=>{const{orderedIds:t,byId:i,recommended:s,areTagsEnabled:n}=e.chatFolders;return{folderIds:t,foldersById:i,isPremium:(0,c.g29)(e),recommendedChatFolders:s,maxFolders:(0,la.d)(e,"dialogFilters"),areTagsEnabled:n,tabsPosition:e.sharedState.settings.tabsPosition}})(({isActive:e,onCreateFolder:t,onEditFolder:i,onReset:a,folderIds:r,foldersById:c,isPremium:d,recommendedChatFolders:h,maxFolders:u,areTagsEnabled:m,tabsPosition:p,isMobile:v})=>{const{loadRecommendedChatFolders:g,addChatFolder:A,openLimitReachedModal:f,openDeleteChatFolderModal:b,sortChatFolders:C,toggleDialogFilterTags:y,openPremiumModal:S,setSharedSettingOption:k}=(0,n.ko)(),[N,w]=(0,s.J0)({orderedFolderIds:r,dragOrderIds:r,draggedIndex:void 0}),I=(0,U.A)(r);(0,s.vJ)(()=>{I!==r&&w({orderedFolderIds:r,dragOrderIds:r,draggedIndex:void 0})},[I,r,N.orderedFolderIds?.length]),(0,s.vJ)(()=>{xd(()=>{g()})},[g]);const P=(0,s.hb)(()=>{Object.keys(c).length>=u-1?f({limit:"dialogFilters"}):t()},[c,u,t,f]),Y=(0,Ri.A)();(0,ye.A)({isActive:e,onBack:a});const F=(0,Id.g5)(),D=(0,s.Kr)(()=>{if(r)return r.length<=1?vi.p:r.map(e=>{const t=c[e];return e===o.DSF?{id:e,title:{text:Y("FilterAllChats"),entities:[]}}:{id:t.id,title:t.title,subtitle:(0,l.A5)(Y,t,F[t.id]),isChatList:t.isChatList,color:t.color,noTitleAnimations:t.noTitleAnimations}})},[r,c,Y,F]),T=(0,s.hb)(e=>{Object.keys(c).length>=u-1?f({limit:"dialogFilters"}):A({folder:e})},[c,u,A,f]),B=(0,s.hb)(()=>{d&&y({isEnabled:!m})},[m,d,y]),L=(0,s.hb)((e,t)=>{const i=Math.round(e.y/56),s=N.orderedFolderIds?.indexOf(t)||0,n=N.orderedFolderIds?.filter(e=>e!==t);n&&(0,ge.Bt)(s+i,0,r?.length||0)&&(n.splice(s+i+(d?0:1),0,t),w(e=>({...e,draggedIndex:s,dragOrderIds:n})))},[r?.length,d,N.orderedFolderIds]),R=(0,s.hb)(()=>{w(e=>(C({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0}))},[C]),x=(0,M.A)(e=>{k({tabsPosition:e})}),E=(0,s.Kr)(()=>!d||Object.keys(c).length<u-1,[c,d,u]);return(0,ie.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header",children:[(0,ie.Y)(Cr.A,{size:o.fwn,tgsUrl:br.w.FoldersAll,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:Y("CreateNewFilterInfo")}),E&&(0,ie.FD)(Z.A,{className:"settings-button with-icon",color:"primary",pill:!0,fluid:!0,onClick:P,isRtl:Y.isRtl,children:[(0,ie.Y)(Q.A,{name:"add"}),Y("CreateNewFilter")]})]}),(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("Filters")}),(0,ie.Y)("div",{className:"settings-sortable-container",style:`height: ${56*(r?.length||0)}px`,children:D?.length?D.map((t,s)=>{const n=s>u-1,a=N.draggedIndex===s,r=56*(N.orderedFolderIds?.indexOf(t.id)??0),l=56*(N.dragOrderIds?.indexOf(t.id)??0),h=void 0!==t?.color&&-1!==t.color&&m;return t.id===o.DSF?(0,ie.Y)(Rd.A,{id:t.id,onDrag:L,onDragEnd:R,style:`top: ${a?r:l}px;`,knobStyle:(Y.isRtl?"left":"right")+": 0.375rem;",isDisabled:!d||!e,children:(0,ie.FD)(ui.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0,allowSelection:!0,children:[(0,ie.Y)("span",{className:"title",children:(0,$i.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})}),(0,ie.Y)("span",{className:"subtitle",children:Y("FoldersAllChatsDesc")})]},t.id)},t.id):(0,ie.Y)(Rd.A,{id:t.id,onDrag:L,onDragEnd:R,style:`top: ${a?r:l}px;`,knobStyle:`${Y.isRtl?"left":"right"}: ${h?"4rem":"2.5rem"};`,isDisabled:n||!e,children:(0,ie.FD)(ui.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{b({folderId:t.id})},destructive:!0,title:Y("Delete"),icon:"delete"}],onClick:()=>{n?f({limit:"dialogFilters"}):i(c[t.id])},children:[(0,ie.FD)("span",{className:"title",children:[(0,$i.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}),n&&(0,ie.Y)(Q.A,{name:"lock-badge",className:"settings-folders-blocked-icon"})]}),(0,ie.FD)("span",{className:"subtitle",children:[t.isChatList&&(0,ie.Y)(Q.A,{name:"link",className:"mr-1"}),t.subtitle]}),h&&(0,ie.Y)("div",{className:(0,pe.A)("settings-folders-color-circle",void 0!==t.color&&-1!==t.color&&(0,Wi.yp)(t.color))})]})},t.id)}):D&&!D.length?(0,ie.Y)("p",{className:"settings-item-description my-4",dir:"auto",children:Y("SettingsFoldersEmpty")}):(0,ie.Y)(Ms.A,{})})]}),h&&Boolean(h.length)&&(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("FilterRecommended")}),h.map(e=>(0,ie.Y)(ui.A,{narrow:!0,onClick:()=>T(e),children:(0,ie.FD)("div",{className:"settings-folders-recommended-item",children:[(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:(0,$i.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,ie.Y)("span",{className:"subtitle",children:e.description})]}),(0,ie.Y)(Z.A,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:Y.isRtl,children:Y("Add")})]})}))]}),(0,ie.Y)("div",{className:"settings-item pt-3",children:(0,ie.FD)("div",{className:"settings-item-relative",children:[(0,ie.Y)(Qs.A,{label:Y("ShowFolderTags"),subLabel:Y("ShowFolderTagsHint"),checked:d&&m,onChange:B,onClickLabel:e=>{d||(e.preventDefault(),S())}}),!d&&(0,ie.Y)(Q.A,{name:"lock-badge",className:"settings-folders-lock-icon"})]})}),!v&&(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("TabsPosition")}),(0,ie.Y)(te.A,{name:"tabsPosition",options:[{label:Y("TabsPositionLeft"),value:"left"},{label:Y("TabsPositionTop"),value:"top"}],selected:p,onChange:x})]})]})}));var Vd=i(4438);const _d=(0,s.ph)((0,n.EK)(e=>{const{folderId:t,url:i,isLoading:s}=(0,c.nTw)(e).shareFolderScreen||{},n=t?(0,c.$aQ)(e,t):void 0,a=t?e.chatFolders.invites[t]?.find(e=>e.url===i):void 0;return{folderId:t,folder:n,url:i,isLoading:s,peerIds:a?.peerIds}})(({isActive:e,onReset:t,folderId:i,folder:a,peerIds:r,url:d,isLoading:h})=>{const{createChatlistInvite:u,deleteChatlistInvite:m,editChatlistInvite:p,showNotification:v}=(0,n.ko)(),g=(0,Ri.A)(),A=(0,T.A)(),[f,b]=(0,s.J0)(!1);(0,ye.A)({isActive:e,onBack:t}),(0,s.vJ)(()=>{h||b(!1)},[h]),(0,s.vJ)(()=>{!d&&i&&e&&u({folderId:i})},[i,e,d]);const C=(0,M.A)(()=>{d&&i&&(m({folderId:i,url:d}),t())}),y=(0,s.Kr)(()=>(a?.includedChatIds||[]).concat(a?.pinnedChatIds||[]),[a?.includedChatIds,a?.pinnedChatIds]),[S,k]=(0,s.Kr)(()=>{const e=(0,n.mS)();return(0,pi.jB)(y,t=>(0,c.hXb)(e,t))},[y]),[N,w]=(0,s.J0)(r||[]),I=(0,s.li)(!0);(0,fi.A)(([e])=>{e!==d&&(I.current=!0),I.current&&(I.current=!1,d?r&&w(r):w(S))},[d,S,r]);const P=(0,M.A)(e=>{const t=(0,n.mS)(),i=(0,c.mBe)(t,e),s=(0,c.hds)(t,e);i&&(0,l.tv)(i)?v({message:A("FolderLinkScreen.AlertTextUnavailableBot")}):i?v({message:A("FolderLinkScreen.AlertTextUnavailableUser")}):s&&(0,l.WX)(s)?v({message:A("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):v({message:A("FolderLinkScreen.AlertTextUnavailablePublicGroup")})}),Y=(0,M.A)(e=>{w(e),b(!0)}),F=(0,M.A)(()=>{i&&d&&f&&p({folderId:i,peerIds:N,url:d})}),D=N.length,B=!D||h;return(0,ie.FD)("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker",children:[(0,ie.FD)("div",{className:"settings-content-header",children:[(0,ie.Y)(Vd.A,{size:o.fwn,tgsUrl:br.w.FoldersShare,className:"settings-content-icon"}),a&&(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:g("FolderLinkTitleDescription",{folder:(0,$i.fd)({text:a.title.text,entities:a.title.entities,noCustomEmojiPlayback:a.noTitleAnimations}),chats:g("FolderLinkTitleDescriptionChats",{count:D},{pluralValue:D})},{withMarkdown:!0,withNodes:!0})})]}),(0,ie.Y)(jr.A,{className:"settings-item",link:d||A("Loading"),withShare:!0,onRevoke:C,isDisabled:!D||f}),(0,ie.Y)("div",{className:"settings-item settings-item-picker",children:(0,ie.Y)(gi.A,{itemIds:y,lockedUnselectedIds:k,onSelectedIdsChange:Y,selectedIds:N,onDisabledClick:P,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})}),(0,ie.Y)(bi.A,{isShown:h||f,disabled:B,onClick:F,ariaLabel:"Save changes",iconName:"check",isLoading:h})]})})),Ud=(0,s.ph)(({currentScreen:e,shownScreen:t,state:i,dispatch:o,isActive:r,onReset:l})=>{const{isMobile:c}=(0,Y.Ay)(),{openShareChatFolderModal:d,editChatFolder:h,addChatFolder:u,openSettingsScreen:m}=(0,n.ko)(),p=(0,s.hb)(()=>{e!==a.VS.FoldersCreateFolder&&e!==a.VS.FoldersEditFolder&&e!==a.VS.FoldersEditFolderFromChatList&&e!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{o({type:"reset"})},200),e!==a.VS.FoldersIncludedChats&&e!==a.VS.FoldersExcludedChats?l():"create"===i.mode?m({screen:a.VS.FoldersCreateFolder}):m({screen:a.VS.FoldersEditFolder})},[i.mode,o,e,l]),v="create"===i.mode,g=(0,s.hb)(e=>{const{title:{text:t}}=e.folder;if(!t)return o({type:"setError",payload:Td}),!1;const{selectedChatIds:i,selectedChatTypes:s}=(0,Nd.a)(e,"included");return i.length||Object.keys(s).length?(v?u({folder:e.folder}):h({id:e.folderId,folderUpdate:e.folder}),o({type:"setError",payload:void 0}),o({type:"setIsTouched",payload:!1}),!0):(o({type:"setError",payload:Bd}),!1)},[o,v]),A=(0,s.hb)(e=>{g(i)&&e?.()},[g,i]),f=(0,s.hb)(()=>{o({type:"saveFilters"}),p()},[o,p]),b=(0,s.hb)(()=>{o({type:"reset"}),m({screen:a.VS.FoldersCreateFolder})},[o]),C=(0,s.hb)(e=>{o({type:"editFolder",payload:e}),m({screen:a.VS.FoldersEditFolder})},[o]),y=(0,s.hb)(()=>{o({type:"editIncludeFilters"}),m({screen:e===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersIncludedChatsFromChatList:a.VS.FoldersIncludedChats})},[e,o]),S=(0,s.hb)(()=>{o({type:"editExcludeFilters"}),m({screen:e===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersExcludedChatsFromChatList:a.VS.FoldersExcludedChats})},[e,o]),k=(0,s.hb)(()=>{d({folderId:i.folderId,noRequestNextScreen:!0}),o({type:"setIsChatlist",payload:!0}),m({screen:a.VS.FoldersShare})},[o,i.folderId]),N=(0,s.hb)(e=>{d({folderId:i.folderId,url:e,noRequestNextScreen:!0}),m({screen:a.VS.FoldersShare})},[i.folderId]);switch(e){case a.VS.Folders:return(0,ie.Y)(Ed,{onCreateFolder:b,onEditFolder:C,isActive:r||[a.VS.FoldersCreateFolder,a.VS.FoldersEditFolder,a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(t),onReset:l,isMobile:c});case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,ie.Y)(Ld,{state:i,dispatch:o,onAddIncludedChats:y,onAddExcludedChats:S,onShareFolder:k,onOpenInvite:N,onReset:p,isActive:r||[a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(t),isOnlyInvites:e===a.VS.FoldersEditFolderInvites,onBack:l,onSaveFolder:A,isMobile:c});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:return(0,ie.Y)(Pd,{mode:"included",state:i,dispatch:o,onReset:p,onSaveFilter:f,isActive:r});case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,ie.Y)(Pd,{mode:"excluded",state:i,dispatch:o,onReset:p,onSaveFilter:f,isActive:r});case a.VS.FoldersShare:return(0,ie.Y)(_d,{isActive:r,onReset:p});default:return}});var Od=i(70934),Kd=i(3178);const Jd=(0,s.ph)(({isActive:e,error:t,isLoading:i,shouldDisablePasswordManager:n,expectedPassword:a,placeholder:o,hint:r,submitLabel:l,onSubmit:c,onClearError:d,onReset:h})=>{const[u,m]=(0,s.J0)(""),[p,v]=(0,s.J0)(!1),g=(0,Ri.A)(),A=(0,s.hb)(e=>{a&&e!==a?m(g("SettingsPasswordEqual")):c(e)},[c,a,g]),f=(0,s.hb)(()=>{d&&d(),m("")},[d]);return(0,ye.A)({isActive:e,onBack:h}),(0,ie.FD)("div",{className:"settings-content password-form custom-scroll",children:[(0,ie.Y)("div",{className:"settings-content-header no-border",children:(0,ie.Y)(Kd.A,{isBig:!0,isPasswordVisible:p})}),(0,ie.Y)("div",{className:"settings-item settings-group",children:(0,ie.Y)(Al.A,{error:u||t,hint:r,placeholder:o||g("CurrentPasswordPlaceholder"),shouldDisablePasswordManager:n,submitLabel:l,onClearError:f,isLoading:i,isPasswordVisible:p,shouldResetValue:e,onChangePasswordVisibility:v,onSubmit:A})})]})}),Gd=(0,s.ph)(({isActive:e,onReset:t})=>{const i=(0,T.A)(),n=(0,s.hb)(()=>{t(!0)},[t]);return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Vd.A,{size:o.BYH,tgsUrl:br.w.Congratulations,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Congratulations!"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Now you can lock the app with a passcode so that others can't open it."})]}),(0,ie.Y)("div",{className:"settings-item settings-group",children:(0,ie.Y)(Z.A,{onClick:n,children:i("Back")})})]})});var jd=i(89704);const zd=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,T.A)();return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Lock,previewUrl:jd,size:160,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Local passcode is enabled."})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{icon:"edit",onClick:()=>i({screen:a.VS.PasscodeChangePasscodeCurrent}),children:s("Passcode.Change")}),(0,ie.Y)(ui.A,{icon:"password-off",onClick:()=>i({screen:a.VS.PasscodeTurnOff}),children:s("Passcode.TurnOff")})]})]})}),Hd=(0,s.ph)(({isActive:e,onReset:t,onStart:i})=>{const s=(0,Ri.A)();return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Lock,previewUrl:jd,size:o.BYH,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description",dir:"auto",children:s("SettingsPasscodeStart1",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("SettingsPasscodeStart2",void 0,{withNodes:!0,renderTextFilters:["br"]})})]}),(0,ie.Y)("div",{className:"settings-item settings-group",children:(0,ie.Y)(Z.A,{onClick:i,children:s("EnablePasscode")})})]})}),$d=(0,s.ph)((0,n.EK)(e=>({...e.passcode}))(({passcode:e,currentScreen:t,shownScreen:i,error:o,isActive:r,isLoading:l,onSetPasscode:c,onReset:d})=>{const{setPasscode:h,clearPasscode:u,setPasscodeError:m,clearPasscodeError:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,T.A)(),A=(0,s.hb)(()=>{c(""),v({screen:a.VS.PasscodeNewPasscode})},[c]),f=(0,s.hb)(e=>{c(e),v({screen:a.VS.PasscodeNewPasscodeConfirm})},[c]),b=(0,s.hb)(()=>{h({passcode:e}),c(""),v({screen:a.VS.PasscodeCongratulations})},[c,e]),C=(0,s.hb)(e=>{c(""),(0,Od.UQ)(e).then(()=>{v({screen:a.VS.PasscodeChangePasscodeNew})},()=>{m({error:g("PasscodeController.Error.Current")})})},[g,c]),y=(0,s.hb)(e=>{c(e),v({screen:a.VS.PasscodeChangePasscodeConfirm})},[c]),S=(0,s.hb)(e=>{(0,Od.UQ)(e).then(()=>{u(),v({screen:a.VS.Privacy})},()=>{m({error:g("PasscodeController.Error.Current")})})},[g]);switch(t){case a.VS.PasscodeDisabled:return(0,ie.Y)(Hd,{onStart:A,isActive:r||[a.VS.PasscodeNewPasscode,a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeNewPasscode:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,placeholder:g("EnterNewPasscode"),submitLabel:g("Continue"),onSubmit:f,isActive:r||[a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeNewPasscodeConfirm:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("ReEnterYourPasscode"),submitLabel:g("Continue"),isLoading:l,onSubmit:b,isActive:r||[a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeCongratulations:return(0,ie.Y)(Gd,{isActive:r,onReset:d});case a.VS.PasscodeEnabled:return(0,ie.Y)(zd,{isActive:r||[a.VS.PasscodeChangePasscodeCurrent,a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations,a.VS.PasscodeTurnOff].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeCurrent:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,error:o,onClearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:C,isActive:r||[a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeNew:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,placeholder:g("PleaseEnterNewFirstPassword"),onSubmit:y,isActive:r||[a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeConfirm:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:l,onSubmit:b,isActive:r||[a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeTurnOff:return(0,ie.Y)(Jd,{shouldDisablePasswordManager:!0,error:o?g(o):void 0,onClearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:S,isActive:r,onReset:d});default:return}})),qd=[50,100,500,1e3,2e3,5e3,1e4];function Wd(e,t){const i=e.findIndex(e=>t<=e),s=e[i-1]||1,n=e[i]||e[e.length-1];return i+(t-s)/(n-s)}function Qd(e,t){const i=Math.floor(t),s=e[i-1]||1,n=s+((e[i]||e[e.length-1])-s)*(t-i);return n<100?Math.round(n):10*Math.round(n/10)}const Zd=(0,s.ph)(({min:e=0,max:t,value:i,disabled:n,readOnly:a,bold:o,className:r,defaultValue:l,onChange:c,canChangeChargeForMessages:d})=>{const h=(0,Ri.A)(),u=(0,s.Kr)(()=>{const e=[];for(let i=0;i<qd.length;i++)if(qd[i]<t&&e.push(qd[i]),qd[i]>=t){e.push(t);break}return e},[t]),m=(0,M.A)(e=>{const t=Number(e.currentTarget.value);c(Qd(u,t))}),p=(0,pe.A)(r,"RangeSlider",n&&"disabled",a&&"readOnly",o&&"bold");return(0,ie.FD)("div",{className:p,children:[(0,ie.FD)("div",{className:"slider-top-row",dir:h.isRtl?"rtl":void 0,children:[(0,ie.Y)("span",{className:"value-min",dir:"auto",children:h.number(e)}),(0,ie.FD)("span",{className:"settings-range-value",children:[!d&&(0,ie.Y)(Q.A,{name:"lock-badge"}),(0,Mi.Kk)(h,Qd(u,Wd(u,i)))]}),(0,ie.Y)("span",{className:"value-max",dir:"auto",children:h.number(t)})]}),(0,ie.FD)("div",{className:"slider-main",children:[(0,ie.Y)("div",{className:"slider-fill-track",style:`width: ${Wd(u,i)/u.length*100}%`}),(0,ie.Y)("input",{min:0,max:u.length,defaultValue:Wd(u,l),step:"any",type:"range",className:"RangeSlider__input",onChange:m})]})]})}),Xd=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.starsUsdWithdrawRateX1000,i=t?t/1e3:1,s=e.appConfig.starsPaidMessageCommissionPermille;return{starsPaidMessageCommissionPermille:s?s/1e3:100,starsUsdWithdrawRate:i,starsPaidMessageAmountMax:e.appConfig.starsPaidMessageAmountMax||o.$$v}})(function({starsUsdWithdrawRate:e,starsPaidMessageAmountMax:t,starsPaidMessageCommissionPermille:i,canChangeChargeForMessages:s,isGroupChat:a,chargeForMessages:r,onChange:l}){const{openPremiumModal:c}=(0,n.ko)(),d=(0,Ri.A)(),h=(0,M.A)(e=>{l?.(e)}),u=(0,M.A)(()=>{c({initialSection:"message_privacy"})});return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("SectionTitleStarsForForMessages")}),(0,ie.Y)(Zd,{defaultValue:r,min:o.BSg,max:t,value:r,onChange:h,canChangeChargeForMessages:s,readOnly:!s}),!s&&(0,ie.Y)(Z.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:u,children:(0,ie.FD)("span",{className:"settings-unlock-button-title",children:[d("UnlockButtonTitle"),(0,ie.Y)(Q.A,{name:"lock-badge",className:"settings-unlock-button-icon"})]})}),s&&(0,ie.Y)("p",{className:"settings-item-description-larger",dir:d.isRtl?"rtl":void 0,children:d(a?"SetPriceGroupDescription":"SectionDescriptionStarsForForMessages",{percent:(0,kn.l9)(100*i),amount:(0,ca.Ad)(r*e*i,"USD",d.code)},{withNodes:!0})})]})}));var eh=i(9267);const th=(0,s.ph)(function({premiumSection:e}){const{openPremiumModal:t}=(0,n.ko)(),i=(0,T.A)(),s=(0,M.A)(()=>t({initialSection:e}));return(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{leftElement:(0,ie.Y)(eh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:s,children:i("PrivacyLastSeenPremium")}),(0,ie.Y)("p",{className:"settings-item-description-larger premium-info",dir:i.isRtl?"rtl":void 0,children:i("lng_messages_privacy_premium_about")})]})}),ih=(0,s.ph)(function({label:e,isChecked:t}){const i=(0,T.A)(),{showNotification:s}=(0,n.ko)();return(0,ie.FD)("div",{className:(0,pe.A)("sBptmiga",t&&"U_6O1ebL"),onClick:()=>s({message:i("OptionPremiumRequiredMessage")}),children:[(0,ie.Y)("span",{children:e}),(0,ie.Y)(Q.A,{name:"lock-badge",className:"jWxrRbkh"})]})}),sh=(0,s.ph)((0,n.EK)(e=>{const{settings:{privacy:t}}=e,i=(0,c.Iv$)(e),s=e.settings.privacy.noPaidMessages?.allowUserIds.length||0;return{shouldNewNonContactPeersRequirePremium:(0,c.BSN)(e),shouldChargeForMessages:Boolean(i),nonContactPeersPaidStars:i||o.wZe,isCurrentUserPremium:(0,c.g29)(e),canLimitNewMessagesWithoutPremium:e.appConfig.canLimitNewMessagesWithoutPremium,canChargeForMessages:e.appConfig.starsPaidMessagesAvailable,noPaidReactionsForUsersCount:s,privacy:t}})(function({isActive:e,canLimitNewMessagesWithoutPremium:t,canChargeForMessages:i,shouldNewNonContactPeersRequirePremium:o,shouldChargeForMessages:r,nonContactPeersPaidStars:l,isCurrentUserPremium:c,noPaidReactionsForUsersCount:d,onReset:h,privacy:u}){const{updateGlobalPrivacySettings:m,openSettingsScreen:p,showNotification:v}=(0,n.ko)(),g=(0,T.A)(),A=(0,Ri.A)(),f=c||t,b=c&&i,[C,y]=(0,s.J0)(l),[S,k]=(0,s.J0)(!1),N=(0,s.Kr)(()=>r?"charge_for_messages":o?"contacts_and_premium":"everybody",[r,o]);(0,fi.A)(([e])=>{S||void 0===e||"everybody"===N||N===e||("everybody"===u.chatInvite?.visibility&&v({message:A("CheckPrivacyInviteText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyGroupChats}},actionText:{key:"Review"},duration:8e3}),"everybody"===u.phoneCall?.visibility&&v({message:A("CheckPrivacyCallsText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyPhoneCall}},actionText:{key:"Review"},duration:8e3}),k(!0))},[N,r,u,A,S]);const w=(0,s.Kr)(()=>[{value:"everybody",label:g("P2PEverybody")},{value:"contacts_and_premium",label:f?g("PrivacyMessagesContactsAndPremium"):(0,ie.Y)(ih,{label:g("PrivacyMessagesContactsAndPremium"),isChecked:"contacts_and_premium"===N}),hidden:!f,isCanCheckedInDisabled:!0},{value:"charge_for_messages",label:b?A("PrivacyChargeForMessages"):(0,ie.Y)(ih,{label:A("PrivacyChargeForMessages"),isChecked:"charge_for_messages"===N}),hidden:!b,isCanCheckedInDisabled:!0}],[g,A,f,b,N]),I=(0,M.A)(e=>{m({shouldNewNonContactPeersRequirePremium:"contacts_and_premium"===e,nonContactPeersPaidStars:"charge_for_messages"===e?C:null})}),P=(0,be.A)(e=>{m({nonContactPeersPaidStars:e})},[m],300,!0),Y=(0,s.hb)(e=>{y(e),P(e)},[y,P]);(0,ye.A)({isActive:e,onBack:h});const F=(0,s.Kr)(()=>A(r?"PrivacyDescriptionChargeForMessages":"PrivacyDescriptionMessagesContactsAndPremium"),[r,A]);return(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:g("PrivacyMessagesTitle")}),(0,ie.Y)(te.A,{name:"privacy-messages",options:w,onChange:I,selected:N}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:A.isRtl?"rtl":void 0,children:F})]}),"charge_for_messages"===N&&(0,ie.Y)("div",{className:"settings-item fluid-container",children:(0,ie.Y)(Xd,{canChangeChargeForMessages:b,chargeForMessages:C,onChange:Y})}),b&&"charge_for_messages"===N&&function(){const e=d?g("Users",d,"i"):A("SubtitlePrivacyAddUsers");return(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:A("RemoveFeeTitle")}),(0,ie.Y)(ui.A,{narrow:!0,icon:"delete-user",onClick:()=>{p({screen:a.VS.PrivacyNoPaidMessages})},children:(0,ie.FD)("div",{className:"multiline-item full-size",children:[(0,ie.Y)("span",{className:"title",children:A("ExceptionTitlePrivacyChargeForMessages")}),(0,ie.Y)("span",{className:"subtitle",children:e})]})})]})}(),!c&&"charge_for_messages"!==N&&(0,ie.Y)(th,{premiumSection:"message_privacy"})]})}));function nh(e){const t=e.platform.toLowerCase(),i=e.deviceModel.toLowerCase(),s=e.systemVersion.toLowerCase();return i.includes("xbox")?"xbox":i.includes("chrome")&&!i.includes("chromebook")?"chrome":i.includes("brave")?"brave":i.includes("vivaldi")?"vivaldi":i.includes("safari")?"safari":i.includes("firefox")?"firefox":i.includes("opera")?"opera":i.includes("samsungbrowser")?"samsung":t.includes("android")?"android":i.includes("iphone")||i.includes("ipad")||t.includes("ios")||t.includes("macos")||s.includes("macos")?"apple":t.includes("ubuntu")||s.includes("ubuntu")?"ubuntu":t.includes("linux")||s.includes("linux")?"linux":t.includes("windows")||s.includes("windows")?"windows":"unknown"}const ah={SettingsActiveSession:"M84mrPgu",settingsActiveSession:"M84mrPgu",iconDevice:"Add8P_K4",iconDevice__android:"onkXVGY4",iconDeviceAndroid:"onkXVGY4",iconDevice__apple:"xw13aT8u",iconDeviceApple:"xw13aT8u",iconDevice__brave:"HESrGUdv",iconDeviceBrave:"HESrGUdv",iconDevice__chrome:"Vpej7wm7",iconDeviceChrome:"Vpej7wm7",iconDevice__edge:"ueWE77x9",iconDeviceEdge:"ueWE77x9",iconDevice__firefox:"_lMTmvya",iconDeviceFirefox:"_lMTmvya",iconDevice__linux:"cDVfvyG_",iconDeviceLinux:"cDVfvyG_",iconDevice__opera:"nWqlTxZt",iconDeviceOpera:"nWqlTxZt",iconDevice__safari:"ldFLp1Gf",iconDeviceSafari:"ldFLp1Gf",iconDevice__samsung:"VHNORBGL",iconDeviceSamsung:"VHNORBGL",iconDevice__ubuntu:"QBVivtdu",iconDeviceUbuntu:"QBVivtdu",iconDevice__unknown:"GbjIgrwU",iconDeviceUnknown:"GbjIgrwU",iconDevice__vivaldi:"yieVnjoI",iconDeviceVivaldi:"yieVnjoI",iconDevice__windows:"_0dnTFOE",iconDeviceWindows:"_0dnTFOE",iconDevice__xbox:"fbCjjDpU",iconDeviceXbox:"fbCjjDpU",title:"c6edjhlh",note:"lRqTZAYn",date:"oLnN6crs",box:"wVEXuPlZ",actionHeader:"olQS2T1n",actionName:"KuX1APpO",headerButton:"VT8pZfMu"};function oh(e){return[e.region,e.country].filter(Boolean).join(", ")}const rh=(0,s.ph)((0,n.EK)((e,{hash:t})=>({session:t?e.activeSessions.byHash[t]:void 0}))(({isOpen:e,session:t,onClose:i})=>{const{changeSessionSettings:a,terminateAuthorization:o}=(0,n.ko)(),r=(0,Ri.A)(),l=(0,Yi.A)(t,!0),c=(0,s.hb)(()=>{a({hash:t.hash,areSecretChatsEnabled:!t.areSecretChatsEnabled})},[a,t]),d=(0,s.hb)(()=>{a({hash:t.hash,areCallsEnabled:!t.areCallsEnabled})},[a,t]),h=(0,s.hb)(()=>{o({hash:t.hash}),i()},[i,t,o]);if(l)return(0,ie.FD)(ee.A,{header:(0,ie.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:i,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:r("SessionPreviewTitle")}),(0,ie.Y)(Z.A,{color:"danger",onClick:h,className:(0,pe.A)("modal-action-button",ah.headerButton),children:r("SessionPreviewTerminateSession")})]}),isOpen:e,hasCloseButton:!0,onClose:i,className:ah.SettingsActiveSession,children:[(0,ie.Y)("div",{className:(0,pe.A)(ah.iconDevice,l&&ah[`iconDevice__${nh(l)}`])}),(0,ie.Y)("h3",{className:ah.title,dir:"auto",children:l?.deviceModel}),(0,ie.Y)("div",{className:ah.date,"aria-label":r("PrivacySettingsLastSeen"),children:(0,$e.L2)(1e3*l.dateActive,r.code)}),(0,ie.FD)("dl",{className:ah.box,children:[(0,ie.Y)("dt",{children:r("SessionPreviewApp")}),(0,ie.FD)("dd",{children:[l?.appName," ",l?.appVersion,","," ",l?.platform," ",l?.systemVersion]}),l?.ip&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("dt",{children:r("SessionPreviewIp")}),(0,ie.Y)("dd",{children:l.ip})]}),(0,ie.Y)("dt",{children:r("SessionPreviewLocation")}),(0,ie.Y)("dd",{children:l&&oh(l)})]}),(0,ie.Y)("p",{className:ah.note,children:r("SessionPreviewIpDesc")}),(0,ie.Y)("h4",{className:ah.actionHeader,children:r("AuthSessionsViewAcceptTitle")}),(0,ie.FD)(ui.A,{onClick:c,children:[(0,ie.Y)("span",{className:ah.actionName,children:r("SessionPreviewAcceptSecret")}),(0,ie.Y)(mi.A,{id:"accept_secrets",label:"On",checked:l.areSecretChatsEnabled})]}),(0,ie.FD)(ui.A,{onClick:d,children:[(0,ie.Y)("span",{className:ah.actionName,children:r("SessionPreviewAcceptCalls")}),(0,ie.Y)(mi.A,{id:"accept_calls",label:"On",checked:l.areCallsEnabled})]})]})}));function lh(e){return[e.region,e.country].filter(Boolean).join(", ")}const ch=(0,s.ph)((0,n.EK)(e=>e.activeSessions)(({isActive:e,onReset:t,byHash:i,orderedHashes:a,ttlDays:o})=>{const{terminateAuthorization:r,terminateAllAuthorizations:l,changeSessionTtl:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,Ri.A)(),[u,m,p]=(0,F.A)(),[v,g]=(0,s.J0)(),[A,f,b]=(0,F.A)(),C=(0,s.Kr)(()=>{if(void 0!==o)return o<=7?"7":o<=30?"30":o<=93?"90":o<=183?"183":o>183?"365":void 0},[o]),y=(0,s.Kr)(()=>{const e=[{label:h("Weeks",{count:1},{pluralValue:1}),value:"7"},{label:h("Months",{count:1},{pluralValue:1}),value:"30"},{label:h("Months",{count:3},{pluralValue:3}),value:"90"},{label:h("Months",{count:6},{pluralValue:6}),value:"183"}];return o&&o>=365&&e.push({label:h("Years",{count:1},{pluralValue:1}),value:"365"}),e},[h,o]),S=(0,s.hb)(e=>{r({hash:e})},[r]),k=(0,s.hb)(()=>{p(),l()},[p,l]),N=(0,s.hb)(e=>{g(e),f()},[f]),w=(0,s.hb)(()=>{g(void 0),b()},[b]),I=(0,s.hb)(e=>{c({days:Number(e)})},[c]),P=(0,s.Kr)(()=>{const e=a.find(e=>i[e].isCurrent);return e?i[e]:void 0},[i,a]),Y=(0,s.Kr)(()=>a.filter(e=>!i[e].isCurrent),[i,a]),D=Boolean(Y.length);return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content custom-scroll SettingsActiveSessions",children:[P&&(B=P,(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("AuthSessionsCurrentSession")}),(0,ie.Y)(ui.A,{narrow:!0,inactive:!0,icon:`device-${nh(B)}`,iconClassName:"icon-device",children:(0,ie.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ie.Y)("span",{className:"title",dir:"auto",children:B.deviceModel}),(0,ie.FD)("span",{className:"subtitle black tight",children:[B.appName," ",B.appVersion,","," ",B.platform," ",B.systemVersion]}),(0,ie.FD)("span",{className:"subtitle",children:[B.ip," ","-"," ",lh(B)]})]})}),D&&(0,ie.Y)(ui.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:m,children:h("TerminateAllSessions")})]})),D&&(M=Y,(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("OtherSessions")}),M.map(function(e){const t=i[e];return(0,ie.Y)(ui.A,{ripple:!0,narrow:!0,contextActions:[{title:h("SessionTerminate"),icon:"stop",destructive:!0,handler:()=>{S(t.hash)}}],icon:`device-${nh(t)}`,iconClassName:"icon-device",onClick:()=>{N(t.hash)},children:(0,ie.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ie.Y)("span",{className:"date",children:(0,$e.be)(d,1e3*t.dateActive)}),(0,ie.Y)("span",{className:"title",children:t.deviceModel}),(0,ie.FD)("span",{className:"subtitle black tight",children:[t.appName," ",t.appVersion,","," ",t.platform," ",t.systemVersion]}),(0,ie.FD)("span",{className:"subtitle",children:[t.ip," ",lh(t)]})]})},t.hash)})]})),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("TerminateOldSessionHeader")}),(0,ie.Y)("p",{className:"settings-item-description-larger",children:h("IfInactiveFor")}),(0,ie.Y)(te.A,{name:"session_ttl",options:y,selected:C,onChange:I})]}),D&&(0,ie.Y)(ci.A,{isOpen:u,onClose:p,text:h("AreYouSureSessions"),confirmLabel:h("TerminateAllSessions"),confirmHandler:k,confirmIsDestructive:!0,areButtonsInColumn:!0}),(0,ie.Y)(rh,{isOpen:A,hash:v,onClose:w})]});var M,B})),dh="YRYk96ki",hh=(0,s.ph)((0,n.EK)((e,{hash:t})=>{const i=t?e.activeWebSessions.byHash[t]:void 0;return{session:i,bot:i?e.users.byId[i.botId]:void 0}})(({isOpen:e,session:t,bot:i,onClose:a})=>{const{terminateWebAuthorization:o}=(0,n.ko)(),r=(0,T.A)(),l=(0,Yi.A)(t,!0),c=(0,Yi.A)(i,!0),d=(0,s.hb)(()=>{o({hash:t.hash}),a()},[a,t,o]);if(l)return(0,ie.FD)(ee.A,{header:(0,ie.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:a,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:r("WebSessionsTitle")}),(0,ie.Y)(Z.A,{color:"danger",onClick:d,className:(0,pe.A)("modal-action-button","lUf0RJ2h"),children:r("AuthSessions.LogOut")})]}),isOpen:e,hasCloseButton:!0,onClose:a,className:"Wd0fmiSY",children:[(0,ie.Y)(Tt.A,{className:"OhZHdRsP",peer:c,size:"large"}),c&&(0,ie.Y)(Ts.A,{className:"EQ7__xGn",peer:c}),(0,ie.Y)("div",{className:dh,children:l?.domain}),(0,ie.FD)("dl",{className:"kmCTIfvf",children:[(0,ie.Y)("dt",{children:r("AuthSessions.View.Browser")}),(0,ie.Y)("dd",{children:l?.browser}),(0,ie.Y)("dt",{children:r("SessionPreview.Ip")}),(0,ie.Y)("dd",{children:l?.ip}),(0,ie.Y)("dt",{children:r("SessionPreview.Location")}),(0,ie.Y)("dd",{children:l?.region})]}),(0,ie.Y)("p",{className:dh,children:r("AuthSessions.View.LocationInfo")})]})})),uh={avatar:"v0wP46TR","clear-help":"WnnxcARX",clearHelp:"WnnxcARX",subtitle:"uEUfjByC"},mh=(0,s.ph)((0,n.EK)(e=>{const{byHash:t,orderedHashes:i}=e.activeWebSessions;return{byHash:t,orderedHashes:i}})(({isActive:e,byHash:t,orderedHashes:i,onReset:a})=>{const{terminateWebAuthorization:o,terminateAllWebAuthorizations:r}=(0,n.ko)(),l=(0,T.A)(),[c,d,h]=(0,F.A)(),[u,m]=(0,s.J0)(),[p,v,g]=(0,F.A)(),A=(0,s.hb)(e=>{o({hash:e})},[o]),f=(0,s.hb)(()=>{h(),r()},[h,r]),b=(0,s.hb)(e=>{m(e),v()},[v]),C=(0,s.hb)(()=>{m(void 0),g()},[g]);var y;if((0,s.vJ)(()=>{i.length||a()},[a,i]),(0,ye.A)({isActive:e,onBack:a}),i.length)return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d,children:l("AuthSessions.LogOutApplications")}),(0,ie.Y)("p",{className:(0,pe.A)("settings-item-description",uh.clearHelp),children:l("ClearOtherWebSessionsHelp")})]}),(y=i,(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("WebSessionsTitle")}),y.map(function(e){const i=t[e],s=(0,n.mS)().users.byId[i.botId];return(0,ie.FD)(ui.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{A(i.hash)}}],onClick:()=>b(i.hash),children:[(0,ie.Y)(Tt.A,{className:uh.avatar,peer:s,size:"tiny"}),(0,ie.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ie.Y)("span",{className:"date",children:(0,$e.be)(l,1e3*i.dateActive)}),s&&(0,ie.Y)(Ts.A,{className:uh.title,peer:s}),(0,ie.FD)("span",{className:(0,pe.A)("subtitle","black","tight",uh.platform),children:[i.domain,",",i.browser,",",i.platform]}),(0,ie.FD)("span",{className:(0,pe.A)("subtitle",uh.subtitle),children:[i.ip," ",i.region]})]})]},i.hash)})]})),(0,ie.Y)(ci.A,{isOpen:c,onClose:h,title:l("AuthSessions.LogOutApplications"),text:l("AreYouSureWebSessions"),confirmHandler:f,confirmIsDestructive:!0}),(0,ie.Y)(hh,{isOpen:p,hash:u,onClose:C})]})})),ph=(0,s.ph)(({stickerSet:e,noPlay:t,className:i,observeIntersection:s,onClick:n})=>{const a=(0,T.A)(),r=e?.stickers?.[0],l=(0,M.A)(()=>{r&&n(r)});if(e?.stickers)return(0,ie.FD)(ui.A,{className:(0,pe.A)("StickerSetCard","small-icon",i),style:"height: 56px;",inactive:!r,onClick:l,children:[function(){if(e)return e.hasThumbnail||!r?(0,ie.Y)(Z.A,{ariaLabel:e.title,color:"translucent",isRtl:a.isRtl,children:(0,ie.Y)(ur,{stickerSet:e,size:o.RCH,noPlay:t,observeIntersection:s})}):(0,ie.Y)(gr,{sticker:r,size:o.RCH,title:e.title,noPlay:t,observeIntersection:s,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("div",{className:"title",children:e.title}),(0,ie.Y)("div",{className:"subtitle",children:a("StickerPack.StickerCount",e.count,"i")})]})]})}),vh=(0,s.ph)((0,n.EK)(e=>({...(0,pi.Up)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({isActive:e,customEmojiSetIds:t,stickerSetsById:i,shouldSuggestCustomEmoji:a,canPlayAnimatedEmojis:o,onReset:r})=>{const{openStickerSet:l,setSettingOption:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,s.li)(),{observe:u}=(0,nr.BL)({rootRef:h});(0,ye.A)({isActive:e,onBack:r});const m=(0,s.hb)(e=>{l({stickerSetInfo:e.stickerSetInfo})},[l]),p=(0,s.hb)(e=>{c({shouldSuggestCustomEmoji:e})},[c]),v=(0,s.Kr)(()=>t&&Object.values((0,pi.Up)(i,t)),[t,i]);return(0,ie.Y)("div",{className:"settings-content custom-scroll",children:v&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:d("SuggestAnimatedEmoji"),checked:a,onCheck:p}),(0,ie.Y)("div",{className:"mt-4",ref:h,children:v.map(e=>(0,ie.Y)(ph,{stickerSet:e,observeIntersection:u,onClick:m,noPlay:!o},e.id))}),(0,ie.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Mt.A)(d("EmojiBotInfo"),["links"])})]})})})),gh=(0,s.ph)((0,n.EK)(e=>(0,pi.Up)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"]))(({isActive:e,onReset:t,canAutoLoadPhotoFromContacts:i,canAutoLoadPhotoInPrivateChats:a,canAutoLoadPhotoInGroups:r,canAutoLoadPhotoInChannels:l,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:h,canAutoLoadVideoInChannels:u,canAutoLoadFileFromContacts:m,canAutoLoadFileInPrivateChats:p,canAutoLoadFileInGroups:v,canAutoLoadFileInChannels:g,autoLoadFileMaxSizeMb:A})=>{const{setSettingOption:f}=(0,n.ko)(),b=(0,Ri.A)();(0,ye.A)({isActive:e,onBack:t});const C=(0,s.hb)(e=>{const t=o.$gx[e];return b("AutodownloadSizeLimitUpTo",{limit:b("MediaSizeMB",{size:t},{pluralValue:t})})},[b]),y=(0,s.hb)(e=>{f({autoLoadFileMaxSizeMb:o.$gx[e]})},[f]);function S(){const e=o.$gx.indexOf(A);return(0,ie.Y)("div",{className:"pt-5",children:(0,ie.Y)(Qe.A,{label:b("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:C,onChange:y})})}function k(e,t,i,s,n,a){return(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0,children:e}),(0,ie.Y)(Qs.A,{label:b("AutoDownloadSettingsContacts"),checked:i,onCheck:e=>f({[`canAutoLoad${t}FromContacts`]:e})}),(0,ie.Y)(Qs.A,{label:b("AutoDownloadSettingsPrivateChats"),checked:s,onCheck:e=>f({[`canAutoLoad${t}InPrivateChats`]:e})}),(0,ie.Y)(Qs.A,{label:b("AutoDownloadSettingsGroupChats"),checked:n,onCheck:e=>f({[`canAutoLoad${t}InGroups`]:e})}),(0,ie.Y)(Qs.A,{label:b("AutoDownloadSettingsChannels"),checked:a,onCheck:e=>f({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&S()]})}return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[k(b("AutoDownloadPhotosTitle"),"Photo",i,a,r,l),k(b("AutoDownloadVideosTitle"),"Video",c,d,h,u),k(b("AutoDownloadFilesTitle"),"File",m,p,v,g)]})})),Ah={root:"Ys1i4ssl",item:"skaVPMTF"},fh=["af","als","am","an","ar","arz","as","ast","av","az","azb","ba","bar","bcl","be","bg","bh","bn","bo","bpy","br","bs","bxr","ca","cbk","ce","ceb","ckb","co","cs","cv","cy","da","de","diq","dsb","dty","dv","el","eml","en","eo","es","et","eu","fa","fi","fr","frr","fy","ga","gd","gl","gn","gom","gu","gv","he","hi","hif","hr","hsb","ht","hu","hy","ia","id","ie","ilo","io","is","it","ja","jbo","jv","ka","kk","km","kn","ko","krc","ku","kv","kw","ky","la","lb","lez","li","lmo","lo","lrc","lt","lv","mai","mg","mhr","min","mk","ml","mn","mr","mrj","ms","mt","mwl","my","myv","mzn","nah","nap","nds","ne","new","nl","nn","no","oc","or","os","pa","pam","pfl","pl","pms","pnb","ps","pt","qu","rm","ro","ru","rue","sa","sah","sc","scn","sco","sd","sh","si","sk","sl","so","sq","sr","su","sv","sw","ta","te","tg","th","tk","tl","tr","tt","tyv","ug","uk","ur","uz","vec","vep","vi","vls","vo","wa","war","wuu","xal","xmf","yi","yo","yue","zh"],bh=o.N89.filter(e=>fh.includes(e)),Ch=(0,s.ph)((0,n.EK)(e=>{const{doNotTranslate:t}=e.settings.byKey;return{doNotTranslate:t}})(({isActive:e,doNotTranslate:t,onReset:i})=>{const{setSettingOption:a}=(0,n.ko)(),o=(0,T.A)().code||"en",[r,l]=(0,s.J0)([]),[c,d]=(0,s.J0)(""),h=(0,s.Kr)(()=>{const e=bh.map(e=>({langCode:e,translatedName:new Intl.DisplayNames([o],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})).filter(Boolean).map(({langCode:e,translatedName:t,originalName:i})=>({label:t,subLabel:i,value:e}));if(!c.trim()){const t=e.find(e=>e.value===o),i=e.filter(e=>e.value!==o);return t?[t,...i]:e}return e?.filter(e=>e.label.toLowerCase().includes(c.toLowerCase()))},[o,c]);(0,fi.A)(([i,s])=>{if(i===e&&s?.find(e=>e===o))return;const[n]=(0,pi.jB)(h,e=>t.includes(e.value));l([...n.map(e=>e.value)])},[e,t,r.length,o,h]);const u=(0,M.A)(e=>{l(e),a({doNotTranslate:e})});return(0,ye.A)({isActive:e,onBack:i}),(0,ie.Y)("div",{className:(0,pe.A)(Ah.root,"settings-content infinite-scroll"),children:(0,ie.Y)("div",{className:(0,pe.A)(Ah.item),children:(0,ie.Y)(lc,{className:Ah.picker,items:h,selectedValues:r,onSelectedValuesChange:u,filterValue:c,onFilterChange:d,isSearchable:!0,allowMultiple:!0,withDefaultPadding:!0,itemInputType:"checkbox",searchInputId:"lang-picker-search"})})})})),yh=(0,s.ph)(({chatId:e,usernames:t,onEditUsername:i})=>{const{showNotification:a,toggleUsername:o,toggleChatUsername:r,sortUsernames:l,sortChatUsernames:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,Ri.A)(),[u,m]=(0,s.J0)(),p=(0,s.Kr)(()=>t.map(({username:e})=>e),[t]),v=(0,U.A)(p),[g,A]=(0,s.J0)({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0});(0,s.vJ)(()=>{v!==p&&A({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0})},[v,p]);const f=(0,s.hb)(e=>{(0,pc.eM)(`@${e}`),a({message:d("UsernameCopied")})},[d,a]),b=(0,s.hb)(e=>{e.isEditable?i(e.username):m(e)},[i]),C=(0,s.hb)(()=>{m(void 0)},[]),y=(0,s.hb)(()=>{u&&(e?r({chatId:e,username:u.username,isActive:!u.isActive}):o({username:u.username,isActive:!u.isActive}),C())},[e,C,r,o,u]),S=(0,s.hb)((e,t)=>{const i=Math.round(e.y/56),s=g.orderedUsernames?.indexOf(t)||0,n=g.orderedUsernames?.filter(e=>e!==t);n&&(0,ge.Bt)(s+i,0,p.length)&&(n.splice(s+i,0,t),A(e=>({...e,draggedIndex:s,dragOrderUsernames:n})))},[g.orderedUsernames,p.length]),k=(0,s.hb)(()=>{A(t=>(e?c({chatId:e,usernames:t.dragOrderUsernames}):l({usernames:t.dragOrderUsernames}),{...t,orderedUsernames:t.dragOrderUsernames,draggedIndex:void 0}))},[e,c,l]);return(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"PaO1MMi5",children:[(0,ie.Y)("h4",{className:"wSswdVkR",dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_subtitle")}),(0,ie.Y)("div",{className:"lAeeBh9K",style:`height: ${56*t.length}px`,children:t.map((e,t)=>{const i=g.draggedIndex===t,s=56*(g.orderedUsernames?.indexOf(e.username)??0),n=56*(g.dragOrderUsernames?.indexOf(e.username)??0),a=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return(0,ie.Y)(Rd.A,{id:e.username,onDrag:S,onDragEnd:k,style:`top: ${i?s:n}px;`,knobStyle:"inset-inline-end: 3rem;",isDisabled:!e.isActive,children:(0,ie.FD)(ui.A,{className:(0,pe.A)("drag-item no-icon","l04OwRBg"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{f(e.username)},title:d("Copy"),icon:"copy"}],onClick:()=>{b(e)},children:[(0,ie.FD)("span",{className:"title",children:["@",e.username]}),(0,ie.Y)("span",{className:"subtitle",children:d(a)})]},e.username)},e.username)})}),(0,ie.Y)("p",{className:"oiJc22Aj",dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_description")})]}),(0,ie.Y)(ci.A,{isOpen:Boolean(u),onClose:C,title:d(u?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:d(u?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:d(u?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:y,confirmIsDestructive:!u?.isActive})]})});var Sh=i(11116);const kh=/https:\/\/t\.me\/?/i,Nh=(0,Ae.sg)(e=>e(),250,!1),wh=(0,s.ph)(({currentUsername:e,asLink:t,isLoading:i,isUsernameAvailable:a,checkedUsername:r,onChange:l})=>{const{checkUsername:c,checkPublicLink:d}=(0,n.ko)(),[h,u]=(0,s.J0)(e||""),m=(0,T.A)(),p=t?"SetUrl":"Username",v=m(t?"SetUrlPlaceholder":"Username"),g=(0,U.A)(a),A=e!==h?a??g:void 0,f=h&&e!==h&&r!==h,[b,C]=(0,s.Kr)(()=>h.length?h.length<Sh.tX?[void 0,m(`${p}InvalidShort`)]:h.length>Sh.Tk?[void 0,m(`${p}InvalidLong`)]:Sh.Ny.test(h)?void 0===A||f?[]:[A?m(`${p}Available`,v):void 0,!1===A?m(`${p}InUse`):void 0]:[void 0,m(`${p}Invalid`)]:[],[h,A,f,m,p,v]);(0,s.vJ)(()=>{u(e||"")},[t,e]);const y=(0,s.hb)(i=>{const s=i.target.value.trim();if(t&&!s.match(kh))return void(s.length||(u(""),l?.("")));const n=s.replace(kh,"");u(n),(""===n||(0,Sh.BU)(n,!0))&&(l?.(n),Nh(()=>{n!==e&&(t?d:c)({username:n})}))},[t,d,c,e,l]);return(0,ie.Y)(X.A,{value:`${t?o.jsp:""}${h}`,onChange:y,label:f?m("Checking"):v,error:C,success:b,readOnly:i,teactExperimentControlled:!0})});var Ih=i(43434);const Ph=(0,Ae.nF)(e=>e(),6e4,!0),Yh="Please provide your first name",Fh=(0,s.ph)((0,n.EK)(e=>{const{currentUserId:t}=e,{progress:i,isUsernameAvailable:s,checkedUsername:n,error:a}=(0,c.nTw)(e).profileEdit||{},o=t?(0,c.mBe)(e,t):void 0,r=(0,la.d)(e,"aboutLength"),{firstName:d,lastName:h,usernames:u}=o||{},m=t?(0,c.vGo)(e,t):void 0;return{currentAvatarHash:o&&(0,l.cP)(o),currentFirstName:d,currentLastName:h,currentBio:m?.bio,progress:i,isUsernameAvailable:s,checkedUsername:n,editUsernameError:a,maxBioLength:r,usernames:u}})(({isActive:e,currentAvatarHash:t,currentFirstName:i,currentLastName:r,currentBio:l,progress:c,checkedUsername:d,editUsernameError:h,isUsernameAvailable:u,maxBioLength:m,usernames:p,onReset:v})=>{const{loadCurrentUser:g,updateProfile:A}=(0,n.ko)(),f=(0,T.A)(),b=(0,s.Kr)(()=>p?.find(({isEditable:e})=>e),[p]),C=b?.username||"",[y,S]=(0,s.J0)(!1),[k,N]=(0,s.J0)(!1),[w,I]=(0,s.J0)(),[P,Y]=(0,s.J0)(),[F,D]=(0,s.J0)(i||""),[M,B]=(0,s.J0)(r||""),[L,R]=(0,s.J0)(l||""),[x,E]=(0,s.J0)(C),V=(0,H.A)(t,!1,K.qZ.BlobUrl),_=c===a.DV.InProgress,O=!1===x,J=(0,U.A)(u),G=u??J,j=p&&p.length>1,z=(0,s.Kr)(()=>!O&&(Boolean(P)||k||y&&!0===G),[O,P,k,y,G]);(0,ye.A)({isActive:e,onBack:v}),(0,s.vJ)(()=>{Ph(()=>{g()})},[g]),(0,s.vJ)(()=>{Y(void 0)},[V]),(0,s.vJ)(()=>{D(i||""),B(r||""),R(l||"")},[i,r,l]),(0,s.vJ)(()=>{E(C||"")},[C]),(0,s.vJ)(()=>{c===a.DV.Complete&&(N(!1),S(!1),I(void 0))},[c]);const $=(0,s.hb)(e=>{Y(e)},[]),q=(0,s.hb)(e=>{D(e.target.value),N(!0)},[]),W=(0,s.hb)(e=>{B(e.target.value),N(!0)},[]),Q=(0,s.hb)(e=>{R(e.target.value),N(!0)},[]),Z=(0,s.hb)(e=>{E(e),S(C!==e)},[C]),ee=(0,s.hb)(()=>{const e=F.trim(),t=M.trim(),i=L.trim();x&&(e.length?A({photo:P,...k&&{firstName:e,lastName:t,bio:i},...y&&{username:x}}):I(Yh))},[P,F,M,L,k,x,y,A]);return(0,ie.FD)("div",{className:"settings-fab-wrapper",children:[(0,ie.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.FD)("div",{className:"settings-input",children:[(0,ie.Y)(Ih.A,{currentAvatarBlobUrl:V,onChange:$,title:"Edit your profile photo",disabled:_}),(0,ie.Y)(X.A,{value:F,onChange:q,label:f("FirstName"),disabled:_,error:w===Yh?w:void 0}),(0,ie.Y)(X.A,{value:M,onChange:W,label:f("LastName"),disabled:_}),(0,ie.Y)(cn.A,{value:L,onChange:Q,label:f("UserBio"),disabled:_,maxLength:m,maxLengthIndicator:m?(m-L.length).toString():void 0})]}),(0,ie.Y)("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0,children:(0,Mt.A)(f("lng_settings_about_bio"),["br","simple_markdown"])})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0,children:f("Username")}),(0,ie.Y)("div",{className:"settings-input",children:(0,ie.Y)(wh,{currentUsername:C,isLoading:_,isUsernameAvailable:u,checkedUsername:d,onChange:Z})}),h===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,ie.Y)("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0,children:f("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,ie.Y)(cl.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,ie.Y)("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0,children:(0,Mt.A)(f("UsernameHelp"),["br","simple_markdown"])}),x&&(0,ie.FD)("p",{className:"settings-item-description",dir:f.isRtl?"rtl":void 0,children:[f("lng_username_link"),(0,ie.Y)("br",{}),(0,ie.FD)("span",{className:"username-link",children:[o.jsp,x]})]})]}),j&&(0,ie.Y)(yh,{usernames:p,onEditUsername:E})]}),(0,ie.Y)(bi.A,{isShown:z,onClick:ee,disabled:_,ariaLabel:f("Save"),iconName:"check",isLoading:_})]})}));var Dh=i(61182),Mh=i(4350),Th=i(93855),Bh=i(15006);const Lh=(0,s.ph)((0,n.EK)(e=>{const{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}=(0,un.l)(e);return{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}})(({isActive:e,shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:a,shouldDebugExportedSenders:r,onReset:l})=>{const{requestConfetti:c,setSharedSettingOption:d,requestWave:h}=(0,n.ko)(),m=(0,s.li)(),[p,v]=(0,s.J0)(!1),g=(0,T.A)(),A=(0,Th.A)();(0,ye.A)({isActive:e,onBack:l});const f=(0,M.A)(()=>{const e=new File([(0,Dh.F8)()],o.lFE,{type:"text/plain"}),t=URL.createObjectURL(e);(0,Di.A)(t,o.lFE)}),b=(0,M.A)(e=>{h({startX:e.clientX,startY:e.clientY})}),C=(0,M.A)(()=>{c({withStars:!0})}),y=(0,M.A)(()=>{const e=m.current;e&&(0,Bh.U)(e)&&(v(!0),setTimeout(()=>{v(!1)},1500))}),S=(0,s.Kr)(()=>{if(!Object.values(A).length)return;let e=1;for(;A[e];)e+=1;return(0,Mh.Nv)(e,!0,!0)},[A]);return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),(0,ie.Y)("p",{className:"settings-item-description pt-3",dir:"auto",children:g("lng_settings_experimental_about")})]}),(0,ie.Y)("div",{className:"settings-item",children:(0,ie.Y)(ui.A,{href:S,icon:"add-user",children:(0,ie.Y)("div",{className:"title",children:"Login on Test Server"})})}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{onClick:C,icon:"animations",children:(0,ie.Y)("div",{className:"title",children:"Launch some confetti!"})}),(0,ie.Y)(ui.A,{onClick:b,icon:"story-expired",disabled:!u.J6,children:(0,ie.Y)("div",{className:"title",children:"Start wave"})}),(0,ie.Y)(ui.A,{ref:m,onClick:y,icon:"spoiler",disabled:!u.bW,style:p?"visibility: hidden":"",children:(0,ie.Y)("div",{className:"title",children:"Vaporize this button"})})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:"Allow HTTP Transport",checked:Boolean(i),onCheck:()=>d({shouldAllowHttpTransport:!i})}),(0,ie.Y)(Qs.A,{label:"Force HTTP Transport",disabled:!i,checked:Boolean(t),onCheck:()=>d({shouldForceHttpTransport:!t})})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:g("DebugMenuEnableLogs"),checked:Boolean(a),onCheck:()=>d({shouldCollectDebugLogs:!a})}),(0,ie.Y)(Qs.A,{label:"Enable exported senders debug",checked:Boolean(r),onCheck:()=>d({shouldDebugExportedSenders:!r})}),(0,ie.Y)(ui.A,{onClick:f,icon:"bug",children:(0,ie.Y)("div",{className:"title",children:"Download log"})})]})]})}));var Rh=i(6e4),xh=i(84382);const Eh=(0,s.ph)((0,n.EK)(e=>{const{theme:t,shouldUseSystemTheme:i,messageSendKeyCombo:s,messageTextSize:n,timeFormat:a}=(0,un.l)(e);return{messageSendKeyCombo:s,messageTextSize:n,timeFormat:a,theme:t,shouldUseSystemTheme:i}})(({isActive:e,messageTextSize:t,messageSendKeyCombo:i,timeFormat:o,theme:r,shouldUseSystemTheme:l,onReset:c})=>{const{setSharedSettingOption:d,openSettingsScreen:h}=(0,n.ko)(),m=(0,Ri.A)(),{isMobile:p}=(0,Y.Ay)(),v=p&&(u.pz||u.Ni),g=[{label:m("SettingsTimeFormat12"),value:"12h"},{label:m("SettingsTimeFormat24"),value:"24h"}],A=[{label:m("EmptyChatAppearanceLight"),value:"light"},{label:m("EmptyChatAppearanceDark"),value:"dark"},{label:m("EmptyChatAppearanceSystem"),value:"auto"}],f=v?void 0:[{value:"enter",label:m("SettingsSendEnter"),subLabel:m("SettingsSendEnterDescription")},{value:"ctrl-enter",label:m(u.MP||u.pz?"SettingsSendCmdenter":"SettingsSendCtrlenter"),subLabel:m("SettingsSendPlusEnterDescription")}],b=(0,s.hb)(e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,u.pz?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()),d({messageTextSize:e})},[]),C=(0,s.hb)(e=>{const t="auto"===e?(0,xh.V)():e;d({theme:t}),d({shouldUseSystemTheme:"auto"===e})},[]),y=(0,s.hb)(e=>{d({timeFormat:e}),d({wasTimeFormatSetManually:!0}),(0,Rh.bV)(e)},[]),S=(0,s.hb)(e=>{d({messageSendKeyCombo:e})},[]);return(0,ye.A)({isActive:e,onBack:c}),(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("Settings")}),(0,ie.Y)(Qe.A,{label:m("TextSize"),min:12,max:20,value:t,onChange:b}),(0,ie.Y)(ui.A,{icon:"photo",narrow:!0,onClick:()=>h({screen:a.VS.GeneralChatBackground}),children:m("ChatBackground")})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("Theme")}),(0,ie.Y)(te.A,{name:"theme",options:A,selected:l?"auto":r,onChange:C})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("SettingsTimeFormat")}),(0,ie.Y)(te.A,{name:"timeformat",options:g,selected:o,onChange:y})]}),f&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("SettingsKeyboard")}),(0,ie.Y)(te.A,{name:"keyboard-send-settings",options:f,onChange:S,selected:i})]})]})}));var Vh=i(52844),_h=i(74824);const Uh=(0,s.ph)(({wallpaper:e,theme:t,isSelected:i,onClick:n})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,h=(0,H.A)(`${c}?size=m`),u=(0,Li.A)(l.thumbnail?.dataUri,Boolean(h),!0),{transitionClassNames:m}=(0,Je.A)(Boolean(h||d),void 0,void 0,"slow"),p=(0,s.li)(!1),[v,g]=(0,s.J0)(!1),{mediaData:A,loadProgress:f}=(0,$.A)(c,!v),b=!1===(0,U.A)(v),{shouldRender:C,transitionClassNames:y}=(0,Je.A)(v&&!A||r===a.Vw,void 0,b,"slow"),S=(0,s.li)();S.current=t;const k=(0,s.hb)(()=>{(async()=>{const e=await(0,G.sZ)(A);await _h.save(o.nfi,S.current,e),n(r)})()},[A,n,r]);(0,s.vJ)(()=>{A&&p.current&&(k(),p.current=!1)},[A,k]);const N=(0,s.hb)(()=>{A?k():(p.current=!0,g(e=>!e))},[A,k]),w=(0,pe.A)("WallpaperTile",i&&"selected");return(0,ie.Y)("div",{className:w,onClick:N,children:(0,ie.FD)("div",{className:"media-inner",children:[(0,ie.Y)("canvas",{ref:u,className:"thumbnail"}),(0,ie.Y)("img",{src:h||d,className:(0,pe.A)("full-media",m),alt:"",draggable:!1}),C&&(0,ie.Y)("div",{className:(0,pe.A)("spinner-container",y),children:(0,ie.Y)(ue.A,{progress:f,onClick:N})})]})})}),Oh=(0,Ae.nF)(e=>e(),6e4,!0),Kh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{background:i,isBlurred:s}=(0,c.Gyz)(e,t)||{},{loadedWallpapers:n}=e.settings;return{background:i,isBlurred:s,loadedWallpapers:n,theme:t}})(({isActive:e,onReset:t,background:i,isBlurred:r,loadedWallpapers:l,theme:c})=>{const{loadWallpapers:d,uploadWallpaper:h,setThemeSettings:u,openSettingsScreen:m}=(0,n.ko)(),p=(0,s.li)();p.current=c,(0,s.vJ)(()=>{Oh(()=>{d()})},[d]);const v=(0,s.hb)(e=>{const{files:t}=e.target,i=(0,G.kc)(t);i?.length&&h(i[0])},[h]),g=(0,s.hb)(()=>{(0,Vh.p)("image/jpeg",v,!0)},[v]),A=(0,s.hb)(()=>{m({screen:a.VS.GeneralChatBackgroundColor})},[]),f=(0,s.hb)(()=>{u({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?o.MkD:o.be8})},[u,c]),b=(0,s.hb)(e=>{u({theme:p.current,background:e});const t=l&&l.find(t=>t.slug===e);t?.document.thumbnail&&(0,mn.rX)(t.document.thumbnail.dataUri).then(e=>{u({theme:p.current,backgroundColor:(0,mn.v2)(e),patternColor:(0,mn.Yi)(e)})})},[l,u]),C=(0,s.hb)(e=>{u({theme:p.current,isBlurred:e.target.checked})},[u]),y=(0,T.A)();(0,ye.A)({isActive:e,onBack:t});const S=l?.[0]&&l[0].slug===a.Vw;return(0,ie.FD)("div",{className:"SettingsGeneralBackground settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{icon:"camera-add",className:"mb-0",disabled:S,onClick:g,children:y("UploadImage")}),(0,ie.Y)(ui.A,{icon:"colorize",className:"mb-0",onClick:A,children:y("SetColor")}),(0,ie.Y)(ui.A,{icon:"favorite",onClick:f,children:y("ThemeResetToDefaults")}),(0,ie.Y)(Qs.A,{label:y("BackgroundBlurred"),checked:Boolean(r),onChange:C})]}),l?(0,ie.Y)("div",{className:"settings-wallpapers",children:l.map(e=>(0,ie.Y)(Uh,{wallpaper:e,theme:c,isSelected:i===e.slug,onClick:b},e.slug))}):(0,ie.Y)(Ms.A,{})]})})),Jh=(0,mn.bi)((0,mn.xp)("e6ebee")),Gh=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function jh(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 zh({colorPosition:e,huePosition:t},i){return[t/(i.hueRect.width-1),e[0]/(i.colorRect.width-1),1-e[1]/(i.colorRect.height-1)]}const Hh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{backgroundColor:i}=(0,c.Gyz)(e,t)||{};return{backgroundColor:i,theme:t}})(({isActive:e,onReset:t,theme:i,backgroundColor:a})=>{const{setThemeSettings:o}=(0,n.ko)(),r=(0,s.li)();r.current=i;const l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(!0),[u,m]=(0,s.J0)(()=>function(e){return e?.startsWith("#")?(0,mn.bi)((0,mn.xp)(e)):Jh}(a)),p=(0,s.li)(u);(0,s.vJ)(()=>{p.current=u},[u]);const[v,g,A]=(0,F.A)(),[f,b]=(0,s.J0)(""),[C,y]=(0,s.J0)(""),S=(0,s.li)(),k=(0,s.li)();(0,s.vJ)(()=>{const e={offsetLeft:c.current.offsetLeft,...(0,pi.Up)(c.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:d.current.offsetLeft,...(0,pi.Up)(d.current.getBoundingClientRect(),["width"])};function i(t){const i=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+l.current.scrollTop),e.height-1)],{huePosition:s}=jh(p.current,S.current);return m(zh({colorPosition:i,huePosition:s},S.current)),g(),!0}function s(e){const{colorPosition:i}=jh(p.current,S.current),s=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return m(zh({colorPosition:i,huePosition:s},S.current)),g(),!0}S.current={colorRect:e,hueRect:t},(0,ve.wJ)(c.current,{onCapture:i,onDrag:i,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,ve.wJ)(d.current,{onCapture:s,onDrag:s,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})},[g,A]);const{colorPosition:N=[0,0],huePosition:w=0}=S.current?jh(u,S.current):{},I=(0,mn.v2)((0,mn.hT)(u)),P=u[0],Y=(0,mn.v2)((0,mn.hT)([P,1,1]));(0,s.vJ)(()=>{const e=(0,mn.hT)(u),t=(0,mn.v2)(e);if(b(e.join(", ")),y(t),!h.current){const i=(0,mn.Yi)(e);o({theme:r.current,background:void 0,backgroundColor:t,patternColor:i})}h.current=!1},[u,o]),(0,s.vJ)(()=>{!function(e,t,i,s){let n,a,o;i.current&&s.current?(n=s.current.colorRect.width,a=s.current.colorRect.height,o=i.current):(n=e.offsetWidth,a=e.offsetHeight,o=e.getContext("2d"),e.width=n,e.height=a,i.current=o);const r=o.createImageData(n,a),l=r.data,c=(0,mn.hT)([t,1,1]);let d=0;for(let e=0;e<a;e++){const t=1-e/(a-1),i=[255*t,255*t,255*t],s=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<n;e++){const t=e/(n-1);l[d++]=i[0]+(s[0]-i[0])*t,l[d++]=i[1]+(s[1]-i[1])*t,l[d++]=i[2]+(s[2]-i[2])*t,l[d++]=255}}o.putImageData(r,0,0)}(c.current.firstChild,P,k,S)},[P]),(0,s.vJ)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const i=e.getContext("2d"),s=i.createImageData(t,1),n=s.data;let a=0;for(let e=0;e<t;e++){const i=e/(t-1),s=(0,mn.hT)([i,1,1]);n[a++]=s[0],n[a++]=s[1],n[a++]=s[2],n[a++]=255}i.putImageData(s,0,0)}(d.current.firstChild)},[]);const D=(0,s.hb)(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()));m((0,mn.bi)(e))}e.currentTarget.value=t},[]),M=(0,s.hb)(e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&m((0,mn.bi)((0,mn.xp)(t))),e.currentTarget.value=t},[]),T=(0,s.hb)(e=>{m((0,mn.bi)((0,mn.xp)(e.currentTarget.dataset.color)))},[]),B=(0,pe.A)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{ref:l,className:B,children:[(0,ie.FD)("div",{className:"settings-item pt-3",children:[(0,ie.FD)("div",{ref:c,className:"color-picker",children:[(0,ie.Y)("canvas",{}),(0,ie.Y)("div",{className:"handle",style:`transform: translate(${N[0]}px, ${N[1]}px); background-color: ${I};`})]}),(0,ie.FD)("div",{ref:d,className:"hue-picker",children:[(0,ie.Y)("canvas",{}),(0,ie.Y)("div",{className:"handle",style:`transform: translateX(${w}px); background-color: ${Y};`})]}),(0,ie.FD)("div",{className:"tools",children:[(0,ie.Y)(X.A,{value:C,label:"HEX",onChange:M}),(0,ie.Y)(X.A,{value:f,label:"RGB",onChange:D})]})]}),(0,ie.Y)("div",{className:"predefined-colors",children:Gh.map(e=>(0,ie.Y)("div",{className:(0,pe.A)("predefined-color",e===I?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:T}))})]})})),$h=(0,s.ph)(({currentScreen:e,editedFolderId:t,onReset:i})=>{const{signOut:o,openDeleteChatFolderModal:r,openSettingsScreen:l}=(0,n.ko)(),{isMobile:c}=(0,Y.Ay)(),[d,h]=(0,s.J0)(!1),u=function(e,t){const i=(0,s.li)(0),n=(0,s.li)();return(0,s.hb)(()=>{if(i.current++,5===i.current)return i.current=0,void t();n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current=0},300)},[5,t])}(0,()=>{l({screen:a.VS.Experimental})}),m=(0,s.hb)(()=>{h(!0)},[]),p=(0,s.hb)(()=>{h(!1)},[]),v=(0,s.hb)(()=>{t&&r({folderId:t})},[t,r]),g=(0,s.hb)(()=>{p(),o({forceInitApi:!0})},[p,o]),A=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ie.Y)(Q.A,{name:"more"})}),[c]),f=(0,T.A)(),b=(0,Ri.A)();return(0,ie.FD)("div",{className:"left-header",children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:f("AccDescrGoBack"),children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),function(){switch(e){case a.VS.EditProfile:return(0,ie.Y)("h3",{children:f("lng_settings_information")});case a.VS.General:return(0,ie.Y)("h3",{children:f("General")});case a.VS.QuickReaction:return(0,ie.Y)("h3",{children:f("DoubleTapSetting")});case a.VS.CustomEmoji:return(0,ie.Y)("h3",{children:f("Emoji")});case a.VS.Notifications:return(0,ie.Y)("h3",{children:f("Notifications")});case a.VS.DataStorage:return(0,ie.Y)("h3",{children:f("DataSettings")});case a.VS.Privacy:return(0,ie.Y)("h3",{children:f("PrivacySettings")});case a.VS.Language:return(0,ie.Y)("h3",{children:f("Language")});case a.VS.DoNotTranslate:return(0,ie.Y)("h3",{children:f("DoNotTranslate")});case a.VS.Stickers:return(0,ie.Y)("h3",{children:f("StickersName")});case a.VS.Experimental:return(0,ie.Y)("h3",{children:f("lng_settings_experimental")});case a.VS.GeneralChatBackground:return(0,ie.Y)("h3",{children:f("ChatBackground")});case a.VS.GeneralChatBackgroundColor:return(0,ie.Y)("h3",{children:f("SetColor")});case a.VS.PrivacyPhoneNumber:return(0,ie.Y)("h3",{children:f("PrivacyPhone")});case a.VS.PrivacyLastSeen:return(0,ie.Y)("h3",{children:f("PrivacyLastSeen")});case a.VS.PrivacyProfilePhoto:return(0,ie.Y)("h3",{children:f("Privacy.ProfilePhoto")});case a.VS.PrivacyBio:return(0,ie.Y)("h3",{children:f("PrivacyBio")});case a.VS.PrivacyBirthday:return(0,ie.Y)("h3",{children:f("PrivacyBirthday")});case a.VS.PrivacyGifts:return(0,ie.Y)("h3",{children:b("PrivacyGifts")});case a.VS.PrivacyForwarding:return(0,ie.Y)("h3",{children:f("PrivacyForwards")});case a.VS.PrivacyVoiceMessages:return(0,ie.Y)("h3",{children:f("PrivacyVoiceMessages")});case a.VS.PrivacyMessages:return(0,ie.Y)("h3",{children:f("PrivacyMessages")});case a.VS.PrivacyGroupChats:return(0,ie.Y)("h3",{children:f("AutodownloadGroupChats")});case a.VS.PrivacyPhoneCall:return(0,ie.Y)("h3",{children:f("Calls")});case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:return(0,ie.Y)("h3",{children:f("AlwaysShareWith")});case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,ie.Y)("h3",{children:f("NeverShareWith")});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:return(0,ie.Y)("h3",{children:f("AlwaysAllow")});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return(0,ie.Y)("h3",{children:f("NeverAllow")});case a.VS.PrivacyNoPaidMessages:return(0,ie.Y)("h3",{children:b("RemoveFeeTitle")});case a.VS.Performance:return(0,ie.Y)("h3",{children:b("MenuAnimations")});case a.VS.ActiveSessions:return(0,ie.Y)("h3",{children:f("SessionsTitle")});case a.VS.ActiveWebsites:return(0,ie.Y)("h3",{children:f("OtherWebSessions")});case a.VS.PrivacyBlockedUsers:return(0,ie.Y)("h3",{children:f("BlockedUsers")});case a.VS.TwoFaDisabled:case a.VS.TwoFaEnabled:return(0,ie.Y)("h3",{children:f("TwoStepVerification")});case a.VS.TwoFaNewPassword:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:return(0,ie.Y)("h3",{children:f("PleaseEnterCurrentPassword")});case a.VS.TwoFaNewPasswordConfirm:return(0,ie.Y)("h3",{children:f("PleaseReEnterPassword")});case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaChangePasswordHint:return(0,ie.Y)("h3",{children:f("PasswordHint")});case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaRecoveryEmail:return(0,ie.Y)("h3",{children:f("RecoveryEmailTitle")});case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaRecoveryEmailCode:return(0,ie.Y)("h3",{children:"Recovery Email Code"});case a.VS.TwoFaCongratulations:return(0,ie.Y)("h3",{children:f("TwoStepVerificationPasswordSet")});case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ie.Y)("h3",{children:f("PleaseEnterCurrentPassword")});case a.VS.PasscodeDisabled:case a.VS.PasscodeEnabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeCongratulations:return(0,ie.Y)("h3",{children:f("Passcode")});case a.VS.PasscodeTurnOff:return(0,ie.Y)("h3",{children:f("PasscodeController.Disable.Title")});case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:return(0,ie.Y)("h3",{children:f("PasscodeController.Change.Title")});case a.VS.PasscodeChangePasscodeConfirm:return(0,ie.Y)("h3",{children:f("PasscodeController.ReEnterPasscode.Placeholder")});case a.VS.Folders:return(0,ie.Y)("h3",{children:f("Filters")});case a.VS.FoldersCreateFolder:return(0,ie.Y)("h3",{children:f("FilterNew")});case a.VS.FoldersShare:return(0,ie.Y)("h3",{children:f("FolderLinkScreen.Title")});case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,ie.FD)("div",{className:"settings-main-header",children:[(0,ie.Y)("h3",{children:f("FilterEdit")}),Boolean(t)&&(0,ie.Y)(de.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,ie.Y)(he.A,{icon:"delete",destructive:!0,onClick:v,children:f("Delete")})})]});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,ie.Y)("h3",{children:f(e===a.VS.FoldersIncludedChats||e===a.VS.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude")});default:return(0,ie.FD)("div",{className:"settings-main-header",children:[(0,ie.Y)("h3",{onClick:u,children:f("SETTINGS")}),(0,ie.Y)(Z.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",onClick:()=>l({screen:a.VS.EditProfile}),ariaLabel:f("lng_settings_information"),children:(0,ie.Y)(Q.A,{name:"edit"})}),(0,ie.Y)(de.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,ie.Y)(he.A,{icon:"logout",onClick:m,children:f("LogOutTitle")})})]})}}(),(0,ie.Y)(ci.A,{isOpen:d,onClose:p,text:f("lng_sure_logout"),confirmLabel:f("AccountSettings.Logout"),confirmHandler:g,confirmIsDestructive:!0})]})}),qh=(0,s.ph)((0,n.EK)(e=>{const{canTranslate:t,canTranslateChats:i,doNotTranslate:s}=e.settings.byKey,{language:n,languages:a}=(0,un.l)(e);return{isCurrentUserPremium:(0,c.g29)(e),languages:a,language:n,canTranslate:t,canTranslateChats:i,doNotTranslate:s}})(({isActive:e,isCurrentUserPremium:t,languages:i,language:o,canTranslate:r,canTranslateChats:l,doNotTranslate:c,onReset:d})=>{const{loadLanguages:h,setSettingOption:m,setSharedSettingOption:p,openPremiumModal:v,openSettingsScreen:g}=(0,n.ko)(),[A,f]=(0,s.J0)(o),[b,C,y]=(0,F.A)(),S=t&&l,k=(0,T.A)();(0,s.vJ)(()=>{i?.length||h()},[i]);const N=(0,M.A)(e=>{f(e),C(),(0,Rh.wT)(e,()=>{y(),p({language:e})})}),w=(0,s.Kr)(()=>{if(!i)return;const e=(window.navigator.language||"en").toLowerCase(),t=e.substr(0,2);return i.map(({langCode:e,nativeName:t,name:i})=>({value:e,label:t,subLabel:i,isLoading:e===A&&b})).sort(i=>!e||i.value!==e&&i.value!==t?0:-1)},[b,i,A]),I=(0,M.A)(e=>{m({canTranslate:e})}),P=(0,M.A)(e=>{m({canTranslateChats:e})}),Y=(0,M.A)(()=>{t||v({initialSection:"translations"})}),D=(0,s.Kr)(()=>{if(u.CM&&c.length)return 1===c.length?new Intl.DisplayNames([o],{type:"language"}).of(c[0]):k("Languages",c.length)},[c,k,o]),B=(0,M.A)(()=>{g({screen:a.VS.DoNotTranslate})});return(0,ye.A)({isActive:e,onBack:d}),(0,ie.FD)("div",{className:"settings-content settings-language custom-scroll",children:[u.CM&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:k("ShowTranslateButton"),checked:r,onCheck:I}),(0,ie.Y)(Qs.A,{label:k("ShowTranslateChatButton"),checked:S,disabled:!t,rightIcon:t?void 0:"lock",onClickLabel:Y,onCheck:P}),(r||S)&&(0,ie.FD)(ui.A,{narrow:!0,onClick:B,children:[k("DoNotTranslate"),(0,ie.Y)("span",{className:"settings-item__current-value",children:D})]}),(0,ie.Y)("p",{className:"settings-item-description mb-0 mt-1",children:k("lng_translate_settings_about")})]}),(0,ie.FD)("div",{className:"settings-item settings-item-picker",children:[(0,ie.Y)("h4",{className:"settings-item-header",children:k("Localization.InterfaceLanguage")}),w?(0,ie.Y)(lc,{items:w,selectedValue:A,forceRenderAllItems:!0,onSelectedValueChange:N,itemInputType:"radio",className:"settings-picker"}):(0,ie.Y)(Ms.A,{})]})]})}));var Wh=i(86046),Qh=i(44784),Zh=i(87970);const Xh=(0,s.ph)((0,n.EK)(e=>{const{currentUserId:t}=e,i=(0,c.hc)(e),s=e.stars?.balance,n=e.ton?.balance;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,c.n_C)(e),isGiveawayAvailable:i,starsBalance:s,tonBalance:n}})(({isActive:e,currentUserId:t,sessionCount:i,canBuyPremium:r,isGiveawayAvailable:l,starsBalance:c,tonBalance:d,onReset:h})=>{const{loadMoreProfilePhotos:u,openPremiumModal:m,openSupportChat:p,openUrl:v,openGiftRecipientPicker:g,openStarsBalanceModal:A,openSettingsScreen:f}=(0,n.ko)(),[b,C,y]=(0,F.A)(!1),S=(0,Ri.A)();(0,s.vJ)(()=>{t&&u({peerId:t,isPreload:!0})},[t]),(0,ye.A)({isActive:e,onBack:h});const k=(0,M.A)(()=>{p(),y()});return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-main-menu self-profile",children:[t&&(0,ie.Y)(Zh.A,{peerId:t,canPlayVideo:Boolean(e),isForSettings:!0}),t&&(0,ie.Y)(Qh.A,{chatOrUserId:t,isInSettings:!0})]}),(0,ie.FD)("div",{className:"settings-main-menu",children:[(0,ie.Y)(ui.A,{icon:"settings",narrow:!0,onClick:()=>f({screen:a.VS.General}),children:S("TelegramGeneralSettingsViewController")}),(0,ie.Y)(ui.A,{icon:"animations",narrow:!0,onClick:()=>f({screen:a.VS.Performance}),children:S("MenuAnimations")}),(0,ie.Y)(ui.A,{icon:"unmute",narrow:!0,onClick:()=>f({screen:a.VS.Notifications}),children:S("Notifications")}),(0,ie.Y)(ui.A,{icon:"data",narrow:!0,onClick:()=>f({screen:a.VS.DataStorage}),children:S("DataSettings")}),(0,ie.Y)(ui.A,{icon:"lock",narrow:!0,onClick:()=>f({screen:a.VS.Privacy}),children:S("PrivacySettings")}),(0,ie.Y)(ui.A,{icon:"folder",narrow:!0,onClick:()=>f({screen:a.VS.Folders}),children:S("Filters")}),(0,ie.FD)(ui.A,{icon:"active-sessions",narrow:!0,onClick:()=>f({screen:a.VS.ActiveSessions}),children:[S("SessionsTitle"),i>0&&(0,ie.Y)("span",{className:"settings-item__current-value",children:i})]}),(0,ie.FD)(ui.A,{icon:"language",narrow:!0,onClick:()=>f({screen:a.VS.Language}),children:[S("Language"),(0,ie.Y)("span",{className:"settings-item__current-value",children:S.languageInfo.nativeName})]}),(0,ie.Y)(ui.A,{icon:"stickers",narrow:!0,onClick:()=>f({screen:a.VS.Stickers}),children:S("MenuStickers")})]}),(0,ie.FD)("div",{className:"settings-main-menu",children:[r&&(0,ie.Y)(ui.A,{leftElement:(0,ie.Y)(eh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),narrow:!0,onClick:()=>m(),children:S("TelegramPremium")}),(0,ie.FD)(ui.A,{leftElement:(0,ie.Y)(eh.A,{className:"icon ListItem-main-icon",type:"gold",size:"big"}),narrow:!0,onClick:()=>A({}),children:[S("MenuStars"),Boolean(c)&&(0,ie.Y)("span",{className:"settings-item__current-value",children:(0,Wh.ZF)(S,c)})]}),(0,ie.FD)(ui.A,{leftElement:(0,ie.Y)(Q.A,{className:"icon ListItem-main-icon",name:"toncoin"}),narrow:!0,onClick:()=>A({currency:o.ykW}),children:[S("MenuTon"),Boolean(d)&&(0,ie.Y)("span",{className:"settings-item__current-value",children:(0,ca.UL)(d.amount,d.currency)})]}),l&&(0,ie.Y)(ui.A,{icon:"gift",narrow:!0,onClick:()=>g(),children:S("MenuSendGift")})]}),(0,ie.FD)("div",{className:"settings-main-menu",children:[(0,ie.Y)(ui.A,{icon:"ask-support",narrow:!0,onClick:C,children:S("AskAQuestion")}),(0,ie.Y)(ui.A,{icon:"help",narrow:!0,onClick:()=>v({url:o.r9K}),children:S("MenuTelegramFaq")}),(0,ie.Y)(ui.A,{icon:"privacy-policy",narrow:!0,onClick:()=>v({url:o.pkx}),children:S("MenuPrivacyPolicy")})]}),(0,ie.Y)(ci.A,{isOpen:b,confirmLabel:S("OK"),title:S("AskAQuestion"),textParts:S("MenuAskText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:k,onClose:y})]})}));var eu=i(5560),tu=i(56133);const iu=(0,s.ph)((0,n.EK)(e=>({hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume,notifyDefaults:e.settings.notifyDefaults}))(({isActive:e,onReset:t,notifyDefaults:i,hasContactJoinedNotifications:a,hasPushNotifications:o,hasWebNotifications:r,notificationSoundVolume:l})=>{const{loadNotificationSettings:c,updateContactSignUpNotification:d,updateNotificationSettings:h,updateWebNotificationSettings:u}=(0,n.ko)();(0,s.vJ)(()=>{c()},[c]);const m=(0,tu.A)(500,!0),p=(0,eu.M2)(),v=p&&!(0,eu.Ac)(),g=Boolean(i?.channels?.mutedUntil),A=Boolean(i?.groups?.mutedUntil),f=Boolean(i?.users?.mutedUntil),b=(0,s.hb)((e,t,s)=>{const n=Boolean(i?.[t]?.mutedUntil),a=Boolean(i?.[t]?.shouldShowPreviews);h({peerType:t,isMuted:"mute"===s?!e.target.checked:n,shouldShowPreviews:"showPreviews"===s?e.target.checked:a})},[i]),C=(0,s.hb)(e=>{const t=e.target.checked;u({hasWebNotifications:t,...!t&&{hasPushNotifications:!1}})},[u]),y=(0,s.hb)(e=>{u({hasPushNotifications:e.target.checked})},[u]),S=(0,s.hb)(e=>{b(e,"users","mute")},[b]),k=(0,s.hb)(e=>{b(e,"users","showPreviews")},[b]),N=(0,s.hb)(e=>{b(e,"groups","mute")},[b]),w=(0,s.hb)(e=>{b(e,"groups","showPreviews")},[b]),I=(0,s.hb)(e=>{b(e,"channels","mute")},[b]),P=(0,s.hb)(e=>{b(e,"channels","showPreviews")},[b]),Y=(0,s.hb)(e=>{d({isSilent:!e.target.checked})},[d]),F=(0,s.hb)(e=>{u({notificationSoundVolume:e}),m(()=>(0,eu.BA)(void 0,e))},[m,u]),D=(0,Ri.A)();return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("NotificationsWeb")}),(0,ie.Y)(Qs.A,{label:D("NotificationsWeb"),subLabel:D(r?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:r,disabled:!p,onChange:C}),(0,ie.Y)(Qs.A,{label:D("NotificationsOffline"),disabled:!r||!v,subLabel:D(v?o?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled":"SettingsOfflineNotificationUnsupported"),checked:o,onChange:y}),(0,ie.Y)("div",{className:"settings-item-slider",children:(0,ie.Y)(Qe.A,{label:D("NotificationsSound"),min:0,max:10,disabled:!p,value:l,onChange:F})})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("AutodownloadPrivateChats")}),(0,ie.Y)(Qs.A,{label:D("NotificationsForPrivateChats"),subLabel:D(f?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!f,onChange:S}),(0,ie.Y)(Qs.A,{label:D("MessagePreview"),disabled:f,subLabel:D(i?.users?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.users?.shouldShowPreviews),onChange:k})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("FilterGroups")}),(0,ie.Y)(Qs.A,{label:D("NotificationsForGroups"),subLabel:D(A?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!A,onChange:N}),(0,ie.Y)(Qs.A,{label:D("MessagePreview"),disabled:A,subLabel:D(i?.groups?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.groups?.shouldShowPreviews),onChange:w})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("FilterChannels")}),(0,ie.Y)(Qs.A,{label:D("NotificationsForChannels"),subLabel:D(g?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!g,onChange:I}),(0,ie.Y)(Qs.A,{label:D("MessagePreview"),disabled:g,subLabel:D(i?.channels?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.channels?.shouldShowPreviews),onChange:P})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("PhoneOther")}),(0,ie.Y)(Qs.A,{label:D("ContactJoined"),checked:a,onChange:Y})]})]})}));var su=i(20714),nu=i(22986);const au=["SettingsPerformanceSliderLow","SettingsPerformanceSliderMedium","SettingsPerformanceSliderHigh"],ou=["SettingsPerformanceSliderLow","SettingsPerformanceSliderCustom","SettingsPerformanceSliderHigh"],ru=[["SettingsPerformanceInterfaceAnimations",[{key:"pageTransitions",label:"SettingsPerformancePageTransitions"},{key:"messageSendingAnimations",label:"SettingsPerformanceSending"},{key:"mediaViewerAnimations",label:"SettingsPerformanceMediaViewer"},{key:"messageComposerAnimations",label:"SettingsPerformanceComposer"},{key:"contextMenuAnimations",label:"SettingsPerformanceContextAnimation"},{key:"contextMenuBlur",label:"SettingsPerformanceContextBlur",disabled:!u.Fy},{key:"rightColumnAnimations",label:"SettingsPerformanceRightColumn"},{key:"snapEffect",label:"SettingsPerformanceThanos"}]],["SettingsPerformanceStickers",[{key:"animatedEmoji",label:"SettingsPerformanceAnimatedEmoji"},{key:"loopAnimatedStickers",label:"SettingsPerformanceLoopStickers"},{key:"reactionEffects",label:"SettingsPerformanceReactionEffects"},{key:"stickerEffects",label:"SettingsPerformanceStickerEffects"}]],["SettingsPerformanceMediaAutoplay",[{key:"autoplayGifs",label:"SettingsPerformanceAutoplayGif"},{key:"autoplayVideos",label:"SettingsPerformanceAutoplayVideo"}]]],lu=(0,s.ph)((0,n.EK)(e=>({performanceSettings:(0,c.Cw0)(e)}))(function({isActive:e,performanceSettings:t,onReset:i}){const{setSharedSettingOption:a,updatePerformanceSettings:r}=(0,n.ko)();(0,ye.A)({isActive:e,onBack:i});const l=(0,Ri.A)(),[c,d]=(0,s.J0)({}),h=(0,s.Kr)(()=>ru.reduce((e,[,i],s)=>(e[s]=i.every(({key:e})=>t[e]),e),{}),[t]),m=(0,s.Kr)(()=>(0,nu.T)(t,su.LH)?o.zP3:(0,nu.T)(t,su.PI)?o.dnp:(0,nu.T)(t,su.tS)?o.zHL:o.M8B,[t]),p=(0,s.Kr)(()=>(m===o.M8B?ou:au).map(e=>l(e)),[m,l]),v=(0,s.hb)((e,t)=>{e.preventDefault();const i=Number(t);d(e=>({...e,[i]:!e[i]}))},[]),g=(0,s.hb)(e=>{const t=e===o.dnp?su.PI:e===o.zHL?su.tS:su.LH;a({animationLevel:e,wasAnimationLevelSetManually:!0}),r(t)},[]),A=(0,s.hb)(e=>{const{name:t,checked:i}=e.target,s=ru.find(([e])=>e===t);if(!s)return;const n=s[1].reduce((e,{key:t})=>(e[t]=i,e),{});r(n)},[]),f=(0,s.hb)(e=>{const{name:t,checked:i}=e.target;r({[t]:i})},[]);return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderTitle")}),(0,ie.Y)("p",{className:"settings-item-description",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderSubtitle")}),(0,ie.Y)(Qe.A,{options:p,value:m===o.M8B?o.zHL:m,onChange:g})]}),(0,ie.FD)("div",{className:"settings-item-simple settings-item__with-shifted-dropdown",children:[(0,ie.Y)("h3",{className:"settings-item-header",dir:"auto",children:l("SettingsPerformanceGranularTitle")}),ru.map(([e,i],s)=>(0,ie.FD)("div",{className:"settings-dropdown-section",children:[(0,ie.Y)("div",{className:"ListItem with-checkbox",children:(0,ie.Y)(Qs.A,{name:e,value:s.toString(),checked:h[s],label:l(e),rightIcon:c[s]?"up":"down",onChange:A,onClickLabel:v})}),Boolean(c[s])&&(0,ie.Y)("div",{className:"DropdownList DropdownList--open",children:i.map(({key:e,label:i,disabled:s})=>{if("snapEffect"!==e||u.bW)return(0,ie.Y)(Qs.A,{name:e,checked:t[e],label:l(i),disabled:s,onChange:f},e)})})]},e))]})]})})),cu=(0,s.ph)((0,n.EK)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:i,canChangeSensitive:s,shouldArchiveAndMuteNewNonContact:n,shouldNewNonContactPeersRequirePremium:a,nonContactPeersPaidStars:o},privacy:r,accountDaysTtl:l},blocked:d,passcode:{hasPasscode:h},appConfig:u}=e,{canDisplayChatInTitle:m}=(0,un.l)(e),p=Boolean(o),v=(0,c.trm)(e),g=(0,c.g29)(e);return{isCurrentUserPremium:g,hasPassword:t,hasPasscode:Boolean(h),blockedCount:d.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:i,canDisplayAutoarchiveSetting:u.canDisplayAutoarchiveSetting||g,shouldArchiveAndMuteNewNonContact:n,canChangeSensitive:s,shouldNewNonContactPeersRequirePremium:a,shouldChargeForMessages:p,needAgeVideoVerification:Boolean(u.needAgeVideoVerification),privacy:r,canDisplayChatInTitle:m,canSetPasscode:(0,c.Ntz)(e),isCurrentUserFrozen:v,accountDaysTtl:l}})(({isActive:e,isCurrentUserPremium:t,hasPassword:i,hasPasscode:r,blockedCount:l,webAuthCount:c,isSensitiveEnabled:d,canChangeSensitive:h,canDisplayAutoarchiveSetting:u,shouldArchiveAndMuteNewNonContact:m,shouldNewNonContactPeersRequirePremium:p,shouldChargeForMessages:v,canDisplayChatInTitle:g,canSetPasscode:A,needAgeVideoVerification:f,privacy:b,onReset:C,isCurrentUserFrozen:y,accountDaysTtl:S})=>{const{openDeleteAccountModal:k,loadPrivacySettings:N,loadBlockedUsers:w,updateContentSettings:I,loadGlobalPrivacySettings:P,updateGlobalPrivacySettings:Y,loadWebAuthorizations:F,setSharedSettingOption:D,openSettingsScreen:B,loadAccountDaysTtl:L,openAgeVerificationModal:R}=(0,n.ko)();(0,s.vJ)(()=>{y||(w(),N(),F())},[y]),(0,s.vJ)(()=>{e&&!y&&(P(),L())},[e,y,P]);const x=(0,T.A)(),E=(0,Ri.A)();(0,ye.A)({isActive:e,onBack:C});const V=(0,s.hb)(e=>{Y({shouldArchiveAndMuteNewNonContact:e})},[Y]),_=(0,s.hb)(e=>{D({canDisplayChatInTitle:e})},[]),U=(0,s.hb)(e=>{I({isSensitiveEnabled:e})},[I]),O=(0,s.hb)(()=>{R()},[R]),K=(0,M.A)(()=>{S&&k({days:S})}),J=(0,s.Kr)(()=>{if(S)return qr(o.WF4,S/30).toString()},[S]);function G(e){if(!e)return x("Loading");const{visibility:t,shouldAllowPremium:i,botsPrivacy:s}=e,n="everybody"===t,a="allow"===s&&!n,o=e.blockChatIds.length+e.blockUserIds.length,r=e.allowChatIds.length+e.allowUserIds.length,l=[];o&&l.push(`-${o}`),r&&!n&&l.push(`+${r}`);const c=[a?E("PrivacyValueBots"):"",E.conjunction(l)].filter(Boolean).join(" ");if(a&&!n)return c;if(i)return x(c?"ContactsAndPremium":"PrivacyPremium");switch(t){case"everybody":return`${x("P2PEverybody")} ${c}`;case"contacts":return`${x("P2PContacts")} ${c}`;case"nobody":return`${x("P2PNobody")} ${c}`}}return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.FD)(ui.A,{icon:"delete-user",narrow:!0,onClick:()=>B({screen:a.VS.PrivacyBlockedUsers}),children:[x("BlockedUsers"),(0,ie.Y)("span",{className:"settings-item__current-value",children:l||""})]}),A&&(0,ie.Y)(ui.A,{icon:"key",narrow:!0,onClick:()=>B({screen:r?a.VS.PasscodeEnabled:a.VS.PasscodeDisabled}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("Passcode")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:x(r?"PasswordOn":"PasswordOff")})]})}),(0,ie.Y)(ui.A,{icon:"lock",narrow:!0,onClick:()=>B({screen:i?a.VS.TwoFaEnabled:a.VS.TwoFaDisabled}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("TwoStepVerification")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:x(i?"PasswordOn":"PasswordOff")})]})}),c>0&&(0,ie.FD)(ui.A,{icon:"web",narrow:!0,onClick:()=>B({screen:a.VS.ActiveWebsites}),children:[x("PrivacySettings.WebSessions"),(0,ie.Y)("span",{className:"settings-item__current-value",children:c})]})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:x("PrivacyTitle")}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyPhoneNumber}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyPhoneTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.phoneNumber)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyLastSeen}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("LastSeenTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.lastSeen)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyProfilePhoto}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyProfilePhotoTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.profilePhoto)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyBio}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyBio")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.bio)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyBirthday}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyBirthday")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.birthday)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyGifts}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:E("PrivacyGifts")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.gifts)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyForwarding}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyForwardsTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.forwards)})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyPhoneCall}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("WhoCanCallMe")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.phoneCall)})]})}),(0,ie.Y)(ui.A,{narrow:!0,allowDisabledClick:!0,rightElement:t&&(0,ie.Y)(eh.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyVoiceMessages}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyVoiceMessagesTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.voiceMessages)})]})}),(0,ie.Y)(ui.A,{narrow:!0,rightElement:t&&(0,ie.Y)(eh.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyMessages}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("PrivacyMessagesTitle")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:v?E("PrivacyPaidMessagesValue"):x(p?"PrivacyMessagesContactsAndPremium":"P2PEverybody")})]})}),(0,ie.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:a.VS.PrivacyGroupChats}),children:(0,ie.FD)("div",{className:"multiline-item",children:[(0,ie.Y)("span",{className:"title",children:x("WhoCanAddMe")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:G(b.chatInvite)})]})})]}),h&&(0,ie.FD)("div",{className:"settings-item fluid-container",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:x("lng_settings_sensitive_title")}),(0,ie.Y)(Qs.A,{label:x("lng_settings_sensitive_disable_filtering"),subLabel:x("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!h||!d&&f,onCheck:U}),!d&&f&&(0,ie.Y)(Z.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:O,children:(0,ie.Y)("span",{className:"settings-unlock-button-title",children:E("ButtonAgeVerification")})})]}),u&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:x("NewChatsFromNonContacts")}),(0,ie.Y)(Qs.A,{label:x("ArchiveAndMute"),subLabel:x("ArchiveAndMuteInfo"),checked:Boolean(m),onCheck:V})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:x("lng_settings_window_system")}),(0,ie.Y)(Qs.A,{label:x("lng_settings_title_chat_name"),checked:Boolean(g),onCheck:_})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:E("DeleteMyAccount")}),(0,ie.FD)(ui.A,{narrow:!0,onClick:K,children:[E("DeleteAccountIfAwayFor"),(0,ie.Y)("span",{className:"settings-item__current-value",children:E("Months",{count:J},{pluralValue:1})})]})]})]})})),du=(0,s.ph)((0,n.EK)(e=>{const{users:{byId:t},blocked:{ids:i},contactList:s,currentUserId:n}=e;return{usersById:t,blockedIds:i,contactIds:s?.userIds,localContactIds:(0,c.nTw)(e).userSearch.localUserIds,currentUserId:n}})(({usersById:e,blockedIds:t,contactIds:i,localContactIds:a,currentUserId:o,isOpen:r,onClose:c})=>{const{setUserSearchQuery:d,blockUser:h}=(0,n.ko)(),u=(0,T.A)(),[m,p]=(0,s.J0)("");(0,s.vJ)(()=>{d({query:m})},[m,d]);const v=(0,s.Kr)(()=>{const s=(0,pi.Am)([...i||[],...a||[]].filter(e=>e!==o&&!t.includes(e)));return(0,Dt.PU)({ids:s,query:m,type:"user"}).sort((t,i)=>{const s=(0,l.Yg)(e[t])||"",n=(0,l.Yg)(e[i])||"";return s.localeCompare(n)})},[t,i,o,m,a,e]),g=(0,s.hb)(e=>{h({userId:e}),c()},[c]);return(0,ie.Y)(Es,{isOpen:r,chatOrUserIds:v,searchPlaceholder:u("BlockedUsers.BlockUser"),search:m,onSearchChange:p,onSelectChatOrUser:g,onClose:c})})),hu=(0,s.ph)((0,n.EK)(e=>{const{chats:{byId:t},users:{byId:i},blocked:{ids:s},countryList:{phoneCodes:n}}=e;return{chatsByIds:t,usersByIds:i,blockedIds:s,phoneCodeList:n}})(({isActive:e,onReset:t,chatsByIds:i,usersByIds:a,blockedIds:r,phoneCodeList:c})=>{const{unblockUser:d}=(0,n.ko)(),h=(0,T.A)(),[u,m,p]=(0,F.A)(),g=(0,s.hb)(e=>{d({userId:e})},[d]);(0,ye.A)({isActive:e,onBack:t});const A=(0,s.Kr)(()=>r.reduce((e,t)=>{const i=(0,v.L8)(t)?a[t]:void 0,s=i&&!i.phoneNumber&&(0,l.Kl)(i);return s&&(e[t]=s),e},{}),[r,a]);return(0,ie.FD)("div",{className:"settings-fab-wrapper",children:[(0,ie.FD)("div",{className:"settings-content infinite-scroll",children:[(0,ie.Y)("div",{className:"settings-item no-border",children:(0,ie.Y)("p",{className:"settings-item-description-larger mt-0 mb-2",dir:h.isRtl?"rtl":void 0,children:h("BlockedUsersInfo")})}),(0,ie.Y)("div",{className:"chat-list custom-scroll",children:r?.length?(0,ie.Y)("div",{className:"scroll-container settings-item",children:r.map((e,t)=>function(e,t){const s=(0,v.L8)(e),n=a[e],r=i[e],l=n||r,d=(0,pe.A)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group"),h=A[e];return(0,ie.FD)(ui.A,{className:d,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{g(e)}}],style:`top: ${(0+t)*o.yq1}px;`,children:[(0,ie.Y)(Tt.A,{size:"medium",peer:l}),(0,ie.FD)("div",{className:"contact-info",dir:"auto",children:[l&&(0,ie.Y)(Ts.A,{peer:l}),n?.phoneNumber&&(0,ie.Y)("div",{className:"contact-phone",dir:"auto",children:(0,rn.Ox)(c,n.phoneNumber)}),h&&(0,ie.FD)("div",{className:"contact-username",dir:"auto",children:["@",h]})]})]},`blocked_${e}`)}(e,t))}):r&&!r.length?(0,ie.Y)("div",{className:"no-results",dir:"auto",children:h("NoBlocked")}):(0,ie.Y)(Ms.A,{},"loading")})]}),(0,ie.Y)(bi.A,{isShown:!0,className:"block-user-button",onClick:m,ariaLabel:h("BlockContact"),iconName:"add"}),(0,ie.Y)(du,{isOpen:u,onClose:p})]})}));function uu(e){switch(e){case a.VS.PrivacyPhoneNumber:case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case a.VS.PrivacyLastSeen:case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyLastSeenDeniedContacts:return"lastSeen";case a.VS.PrivacyProfilePhoto:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case a.VS.PrivacyBio:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBioDeniedContacts:return"bio";case a.VS.PrivacyBirthday:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyBirthdayDeniedContacts:return"birthday";case a.VS.PrivacyGifts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyGiftsDeniedContacts:return"gifts";case a.VS.PrivacyForwarding:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyForwardingDeniedContacts:return"forwards";case a.VS.PrivacyVoiceMessages:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case a.VS.PrivacyGroupChats:case a.VS.PrivacyGroupChatsAllowedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return"chatInvite";case a.VS.PrivacyPhoneCall:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:return"phoneCall";case a.VS.PrivacyPhoneP2P:case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return"phoneP2P";case a.VS.PrivacyAddByPhone:return"addByPhone";case a.VS.PrivacyNoPaidMessages:return"noPaidMessages"}}const mu=(0,s.ph)((0,n.EK)(e=>{const{settings:{byKey:{disallowedGifts:t}}}=e;return{disallowedGifts:t,isCurrentUserPremium:(0,c.g29)(e)}})(({disallowedGifts:e,isCurrentUserPremium:t})=>{const{showNotification:i,updateGlobalPrivacySettings:s}=(0,n.ko)(),a=(0,Ri.A)(),o=(0,M.A)(()=>{i({message:a("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),r=(0,M.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowLimitedStarGifts:!e?.shouldDisallowLimitedStarGifts||void 0}}):o()}),l=(0,M.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowUnlimitedStarGifts:!e?.shouldDisallowUnlimitedStarGifts||void 0}}):o()}),c=(0,M.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowUniqueStarGifts:!e?.shouldDisallowUniqueStarGifts||void 0}}):o()}),d=(0,M.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowPremiumGifts:!e?.shouldDisallowPremiumGifts||void 0}}):o()});return(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:a.isRtl?"rtl":void 0,children:a("PrivacyAcceptedGiftTitle")}),(0,ie.FD)(ui.A,{onClick:r,children:[(0,ie.Y)("span",{children:a("PrivacyGiftLimitedEdition")}),(0,ie.Y)(mi.A,{id:"limited_edition",label:a(e?.shouldDisallowLimitedStarGifts?"PrivacyDisableLimitedEditionStarGifts":"PrivacyEnableLimitedEditionStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowLimitedStarGifts})]}),(0,ie.FD)(ui.A,{onClick:l,children:[(0,ie.Y)("span",{children:a("PrivacyGiftUnlimited")}),(0,ie.Y)(mi.A,{id:"unlimited",label:a(e?.shouldDisallowUnlimitedStarGifts?"PrivacyDisableUnlimitedStarGifts":"PrivacyEnableUnlimitedStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUnlimitedStarGifts})]}),(0,ie.FD)(ui.A,{onClick:c,children:[(0,ie.Y)("span",{children:a("PrivacyGiftUnique")}),(0,ie.Y)(mi.A,{id:"unique",label:a(e?.shouldDisallowUniqueStarGifts?"PrivacyDisableUniqueStarGifts":"PrivacyEnableUniqueStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUniqueStarGifts})]}),(0,ie.FD)(ui.A,{onClick:d,children:[(0,ie.Y)("span",{children:a("PrivacyGiftPremiumSubscription")}),(0,ie.Y)(mi.A,{id:"premium_subscription",label:a(e?.shouldDisallowPremiumGifts?"PrivacyDisablePremiumGifts":"PrivacyEnablePremiumGifts"),disabled:!t,checked:!t||!e?.shouldDisallowPremiumGifts})]}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:a.isRtl?"rtl":void 0,children:a("PrivacyAcceptedGiftInfo")})]})})),pu=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),shouldHideReadMarks:Boolean((0,c.KIM)(e))}))(({isCurrentUserPremium:e,shouldHideReadMarks:t,visibility:i})=>{const{updateGlobalPrivacySettings:s,openPremiumModal:a}=(0,n.ko)(),o=(0,T.A)(),r="nobody"===i||"contacts"===i,l=(0,M.A)(e=>s({shouldHideReadMarks:e})),c=(0,M.A)(()=>{a({initialSection:"last_seen"})});return(0,ie.FD)(ie.FK,{children:[r&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:o("HideReadTime"),checked:t,onCheck:l}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:o.isRtl?"rtl":void 0,children:(0,Mt.A)(o("HideReadTimeInfo"),["br"])})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{leftElement:(0,ie.Y)(eh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:c,children:o(e?"PrivacyLastSeenPremiumForPremium":"PrivacyLastSeenPremium")}),(0,ie.Y)("p",{className:"settings-item-description-larger premium-info",dir:o.isRtl?"rtl":void 0,children:o(e?"PrivacyLastSeenPremiumInfoForPremium":"PrivacyLastSeenPremiumInfo")})]})]})}));var vu=i(91356);const gu=(0,s.ph)(({currentUserId:e,hasCurrentUserFullInfo:t,currentUserFallbackPhoto:i})=>{const{loadFullUser:a,uploadProfilePhoto:o,deleteProfilePhoto:r,showNotification:l}=(0,n.ko)(),c=(0,T.A)(),[d,h,u]=(0,F.A)(!1),m=(0,s.li)();(0,s.vJ)(()=>{t||a({userId:e})},[t,e,a]);const p=(0,s.hb)(e=>{o({file:e,isFallback:!0}),l({message:c("Privacy.ProfilePhoto.PublicPhotoSuccess")})},[c,l,o]),v=(0,s.hb)(()=>{u(),r({photo:i})},[u,r,i]),g=(0,s.hb)(()=>{m.current?.click()},[]);return(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.FD)(ui.A,{narrow:!0,icon:"camera-add",onClick:g,children:[(0,ie.Y)(vu.A,{onChange:p,inputRef:m}),c(i?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")]}),i&&(0,ie.FD)(ui.A,{narrow:!0,leftElement:(0,ie.Y)(Tt.A,{photo:i,size:"mini",className:"Qvhl9Jjv"}),onClick:h,destructive:!0,children:[c(i.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),(0,ie.Y)(ci.A,{isOpen:d,onClose:u,text:c("Privacy.ResetPhoto.Confirm"),confirmLabel:c("Delete"),confirmHandler:v,confirmIsDestructive:!0})]}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:c("Privacy.ProfilePhoto.PublicPhotoInfo")})]})});function Au({screen:e,privacy:t,isPremiumRequired:i}){const{setPrivacyVisibility:o,openSettingsScreen:r}=(0,n.ko)(),l=(0,T.A)(),c=(0,Ri.A)(),d=(0,s.Kr)(()=>{const t=e!==a.VS.PrivacyAddByPhone,s=[{value:"everybody",label:l("P2PEverybody")},{value:"contacts",label:i?(0,ie.Y)(ih,{label:l("P2PContacts")}):l("P2PContacts"),hidden:i}];return t&&s.push({value:"nobody",label:i?(0,ie.Y)(ih,{label:l("P2PNobody")}):l("P2PNobody"),hidden:i}),s},[l,e,i]),h=(0,s.Kr)(()=>e===a.VS.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==t?.visibility,shouldShowAllowed:"everybody"!==t?.visibility},[t,e]),u=uu(e),m=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyGifts:return c("PrivacyGiftsInfo");case a.VS.PrivacyLastSeen:return l("CustomHelp");case a.VS.PrivacyAddByPhone:return l("everybody"===t?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");case a.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesInfo");default:return}},[l,c,e,t]),p=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return l("PrivacyPhoneTitle");case a.VS.PrivacyAddByPhone:return l("PrivacyPhoneTitle2");case a.VS.PrivacyLastSeen:return l("LastSeenTitle");case a.VS.PrivacyProfilePhoto:return l("PrivacyProfilePhotoTitle");case a.VS.PrivacyBio:return l("PrivacyBioTitle");case a.VS.PrivacyBirthday:return l("PrivacyBirthdayTitle");case a.VS.PrivacyGifts:return c("PrivacyGiftsTitle");case a.VS.PrivacyForwarding:return l("PrivacyForwardsTitle");case a.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesTitle");case a.VS.PrivacyGroupChats:return l("WhoCanAddMe");case a.VS.PrivacyPhoneCall:return l("WhoCanCallMe");case a.VS.PrivacyPhoneP2P:return l("PrivacyP2P");default:return}},[l,c,e]),v=(0,M.A)((e,t,i,s)=>{const n=e?.length||0,a=t?.length||0,o="allow"===s;if(!n&&!a&&!o)return l(i?"PrivacyPremium":"EditAdminAddUsers");if(i)return l("ContactsAndPremium");const r=n>0?l("Users",n):void 0,d=a>0?l("Chats",a):void 0;return[o?c("PrivacyValueBots"):"",c.conjunction([r,d].filter(Boolean))].filter(Boolean).join(" ")}),g=(0,s.Kr)(()=>v(t?.allowUserIds,t?.allowChatIds,t?.shouldAllowPremium,t?.botsPrivacy),[t]),A=(0,s.Kr)(()=>v(t?.blockUserIds,t?.blockChatIds),[t]),f=(0,s.hb)(e=>{o({privacyKey:u,visibility:e})},[u]),b=(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberAllowedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenAllowedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoAllowedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioAllowedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayAllowedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsAllowedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingAllowedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallAllowedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PAllowedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesAllowedContacts;default:return a.VS.PrivacyGroupChatsAllowedContacts}})(),C=(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberDeniedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenDeniedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoDeniedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioDeniedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayDeniedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsDeniedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingDeniedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallDeniedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PDeniedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesDeniedContacts;default:return a.VS.PrivacyGroupChatsDeniedContacts}})();return(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:p}),(0,ie.Y)(te.A,{name:`visibility-${u}`,options:d,onChange:f,selected:t?.visibility}),m&&(0,ie.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:m})]}),!i&&(h.shouldShowAllowed||h.shouldShowDenied)&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:l("PrivacyExceptions")}),h.shouldShowAllowed&&(0,ie.Y)(ui.A,{narrow:!0,icon:"add-user",onClick:()=>{r({screen:b})},children:(0,ie.FD)("div",{className:"multiline-item full-size",children:[(0,ie.Y)("span",{className:"title",children:l("AlwaysAllow")}),(0,ie.Y)("span",{className:"subtitle",children:g})]})}),h.shouldShowDenied&&(0,ie.Y)(ui.A,{narrow:!0,icon:"delete-user",onClick:()=>{r({screen:C})},children:(0,ie.FD)("div",{className:"multiline-item full-size",children:[(0,ie.Y)("span",{className:"title",children:l("NeverAllow")}),(0,ie.Y)("span",{className:"subtitle",children:A})]})})]}),i&&(0,ie.Y)(th,{})]})}const fu=(0,s.ph)((0,n.EK)((e,{screen:t})=>{let i,s;const{currentUserId:n,settings:{privacy:o,byKey:{shouldDisplayGiftsButton:r}}}=e,l=(0,c.vGo)(e,n);switch(t){case a.VS.PrivacyPhoneNumber:i=o.phoneNumber,s=o.addByPhone;break;case a.VS.PrivacyLastSeen:i=o.lastSeen;break;case a.VS.PrivacyProfilePhoto:i=o.profilePhoto;break;case a.VS.PrivacyBio:i=o.bio;break;case a.VS.PrivacyBirthday:i=o.birthday;break;case a.VS.PrivacyGifts:i=o.gifts;break;case a.VS.PrivacyPhoneP2P:case a.VS.PrivacyPhoneCall:i=o.phoneCall,s=o.phoneP2P;break;case a.VS.PrivacyForwarding:i=o.forwards;break;case a.VS.PrivacyVoiceMessages:i=o.voiceMessages;break;case a.VS.PrivacyGroupChats:i=o.chatInvite}return i?{primaryPrivacy:i,secondaryPrivacy:s,currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto,isPremiumRequired:t===a.VS.PrivacyVoiceMessages&&!(0,c.g29)(e),shouldDisplayGiftsButton:r,isCurrentUserPremium:(0,c.g29)(e)}:{currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto}})(({screen:e,isActive:t,primaryPrivacy:i,secondaryPrivacy:o,currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c,isPremiumRequired:d,onReset:h,shouldDisplayGiftsButton:u,isCurrentUserPremium:m})=>{const{updateGlobalPrivacySettings:p,showNotification:v}=(0,n.ko)(),g=(0,Ri.A)();(0,ye.A)({isActive:t,onBack:h});const A=(0,M.A)(()=>{m?p({shouldDisplayGiftsButton:!u}):v({message:g("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),f=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneP2P;case a.VS.PrivacyPhoneNumber:return"nobody"===i?.visibility?a.VS.PrivacyAddByPhone:void 0;default:return}},[i,e]);return(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[e===a.VS.PrivacyGifts&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.FD)(ui.A,{onClick:A,children:[(0,ie.Y)("span",{children:g("PrivacyDisplayGiftsButton")}),(0,ie.Y)(mi.A,{id:"gift",disabled:!m,label:g(u?"HideGiftsButton":"DisplayGiftsButton"),checked:u})]}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:g.isRtl?"rtl":void 0,children:g("PrivacyDisplayGiftIconInChats",{icon:(0,ie.Y)(Q.A,{name:"gift",className:"gift-icon"}),gift:g("PrivacyDisplayGift")},{withNodes:!0})})]}),(0,ie.Y)(Au,{screen:e,privacy:i,isPremiumRequired:d}),e===a.VS.PrivacyProfilePhoto&&"everybody"!==i?.visibility&&(0,ie.Y)(gu,{currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c}),e===a.VS.PrivacyLastSeen&&(0,ie.Y)(pu,{visibility:i?.visibility}),e===a.VS.PrivacyGifts&&(0,ie.Y)(mu,{}),Boolean(f)&&(0,ie.Y)(Au,{screen:f,privacy:o})]})})),bu=[wd.lw];function Cu(e,t){const{privacy:i}=e.settings;switch(t){case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyPhoneNumberDeniedContacts:return i.phoneNumber;case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyLastSeenDeniedContacts:return i.lastSeen;case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:return i.profilePhoto;case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBioDeniedContacts:return i.bio;case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyBirthdayDeniedContacts:return i.birthday;case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyGiftsDeniedContacts:return i.gifts;case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:return i.phoneCall;case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return i.phoneP2P;case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyForwardingDeniedContacts:return i.forwards;case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:return i.voiceMessages;case a.VS.PrivacyGroupChatsDeniedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:return i.chatInvite;case a.VS.PrivacyNoPaidMessages:return i.noPaidMessages}}const yu=(0,s.ph)((0,n.EK)((e,{screen:t})=>({currentUserId:e.currentUserId,settings:Cu(e,t)}))(({isAllowList:e,withPremiumCategory:t,withMiniAppsCategory:i,screen:a,isActive:r,currentUserId:c,settings:d,usersOnly:h=!1,onReset:u})=>{const{setPrivacySettings:m}=(0,n.ko)(),p=(0,T.A)(),v=(0,Ri.A)(),g=(0,s.Kr)(()=>({isCustomPeer:!0,type:"bots",title:v("PrivacyValueBots"),avatarIcon:"bots",isAvatarSquare:!0,peerColorId:6}),[v]),A=(0,s.Kr)(()=>[g],[g]),f=(0,s.Kr)(()=>d?e?[...d.allowUserIds,...d.allowChatIds]:[...d.blockUserIds,...d.blockChatIds]:[],[e,d]),b=(0,s.Kr)(()=>d?d.shouldAllowPremium?[wd.lw.type]:"allow"===d.botsPrivacy&&e?[g.type]:[]:[],[d,e,g]),[C,y]=(0,s.J0)(""),[S,k]=(0,s.J0)(!1),[N,w]=(0,s.J0)(f),[I,P]=(0,s.J0)(b);(0,s.vJ)(()=>{r||(w(f),P(b))},[r,b,f]);const Y=(0,Id.Rh)(o.DSF),F=(0,Id.Rh)(o._E9),D=(0,s.Kr)(()=>{const e=(0,n.mS)().chats.byId,t=(0,n.mS)().users.byId,i=(0,pi.Am)([...Y||[],...F||[]]).filter(i=>{const s=e[i],n=t[i],a=n&&(0,l.PL)(n),r=s&&(0,l.WX)(s);return(!h||n)&&i!==c&&i!==o.zv8&&!r&&!a}),s=(0,Dt.PU)({ids:i,query:C});return C?s:(0,pi.Am)([...f,...i])},[Y,F,f,C,c,h]),M=(0,s.hb)(e=>{P(e),k(!0)},[]),B=(0,s.hb)(e=>{w(e),k(!0)},[]),L=(0,s.hb)(()=>{m({privacyKey:uu(a),isAllowList:Boolean(e),updatedIds:N,isPremiumAllowed:I.includes(wd.lw.type)||void 0,botsPrivacy:i?I.includes(g.type)?"allow":"disallow":"none"}),u()},[e,i,I,N,u,a,g]);return(0,ye.A)({isActive:r,onBack:u}),(0,ie.FD)("div",{className:"NewChat-inner step-1",children:[(0,ie.Y)(gi.A,{categories:t?bu:i&&e?A:void 0,itemIds:D||[],selectedIds:N,selectedCategories:I,filterValue:C,filterPlaceholder:p(e?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),categoryPlaceholderKey:"PrivacyUserTypes",searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:B,onSelectedCategoriesChange:M,onFilterChange:y,allowMultiple:!0,itemInputType:"checkbox",withDefaultPadding:!0,withStatus:!0}),(0,ie.Y)(bi.A,{isShown:S,onClick:L,ariaLabel:p(e?"AlwaysAllow":"NeverAllow"),iconName:"check"})]})})),Su=(0,s.ph)((0,n.EK)(e=>{const{config:t,reactions:i}=e;return{availableReactions:i.availableReactions,selectedReaction:t?.defaultReaction}})(({isActive:e,availableReactions:t,selectedReaction:i,onReset:a})=>{const{setDefaultReaction:o}=(0,n.ko)();(0,ye.A)({isActive:e,onBack:a});const r=(0,s.Kr)(()=>(t||[]).filter(e=>!e.isInactive).map(e=>({label:(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(Cs.A,{reaction:e.reaction,availableReactions:t}),e.title]}),value:e.reaction.emoticon})),[t]),l=(0,s.hb)(e=>{o({reaction:{type:"emoji",emoticon:e}})},[o]);return(0,ie.Y)("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction",children:(0,ie.Y)(te.A,{name:"quick-reaction-settings",options:r,selected:"emoji"===i?.type?i.emoticon:void 0,onChange:l,withIcon:!0})})})),ku=1.5*g.$,Nu=(0,s.ph)((0,n.EK)(e=>({...(0,pi.Up)(e.settings.byKey,["shouldSuggestStickers","shouldUpdateStickerSetOrder"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:e.config?.defaultReaction,availableReactions:e.reactions.availableReactions,canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({isActive:e,addedSetIds:t,customEmojiSetIds:i,stickerSetsById:o,defaultReaction:r,shouldSuggestStickers:l,shouldUpdateStickerSetOrder:c,availableReactions:d,canPlayAnimatedEmojis:h,onReset:u})=>{const{setSettingOption:m,openStickerSet:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,T.A)(),A=(0,s.li)(),{observe:f}=(0,nr.BL)({rootRef:A}),b=(0,s.hb)(e=>{p({stickerSetInfo:e.stickerSetInfo})},[p]),C=(0,s.hb)(e=>{m({shouldUpdateStickerSetOrder:e})},[m]),y=(0,s.hb)(e=>{m({shouldSuggestStickers:e})},[m]),S=(0,s.Kr)(()=>t&&Object.values((0,pi.Up)(o,t)),[t,o]);return(0,ye.A)({isActive:e,onBack:u}),(0,ie.FD)("div",{className:"settings-content custom-scroll",children:[(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(Qs.A,{label:g("SuggestStickers"),checked:l,onCheck:y}),(0,ie.FD)(ui.A,{narrow:!0,onClick:()=>v({screen:a.VS.CustomEmoji}),icon:"smile",children:[g("StickersList.EmojiItem"),i&&(0,ie.Y)("span",{className:"settings-item__current-value",children:i.length})]}),r&&(0,ie.FD)(ui.A,{className:"SettingsDefaultReaction",narrow:!0,onClick:()=>v({screen:a.VS.QuickReaction}),children:[(0,ie.Y)(Cs.A,{reaction:r,className:"current-default-reaction",size:ku,availableReactions:d}),(0,ie.Y)("div",{className:"title",children:g("DoubleTapSetting")})]})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("InstalledStickers.DynamicPackOrder")}),(0,ie.Y)(Qs.A,{label:g("InstalledStickers.DynamicPackOrder"),checked:c,onCheck:C}),(0,ie.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:g("InstalledStickers.DynamicPackOrderInfo")})]}),S&&(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("ChooseStickerMyStickerSets")}),(0,ie.Y)("div",{ref:A,children:S.map(e=>(0,ie.Y)(ph,{stickerSet:e,observeIntersection:f,onClick:b,noPlay:!h},e.id))}),(0,ie.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Mt.A)(g("StickersBotInfo"),["links"])})]})]})})),wu=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,T.A)(),r=(0,M.A)(()=>{i({screen:a.VS.Privacy})});return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Vd.A,{size:o.r2x,tgsUrl:br.w.Congratulations,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("TwoStepVerificationPasswordSetInfo")})]}),(0,ie.Y)("div",{className:"settings-item settings-group",children:(0,ie.Y)(Z.A,{onClick:r,children:s("TwoStepVerificationPasswordReturnSettings")})})]})});var Iu=i(79577);const Pu=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).recoveryEmail;return{animatedEmoji:(0,c.oei)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength,recoveryEmail:t}})(({animatedEmoji:e,codeLength:t,isLoading:i,error:n,clearError:a,onSubmit:o,isActive:r,onReset:l,recoveryEmail:c})=>{const d=(0,s.li)(),{isMobile:h}=(0,Y.Ay)(),m=h?550:400,[p,v]=(0,s.J0)("");(0,s.vJ)(()=>{u.TF||setTimeout(()=>{d.current.focus()},m)},[m]);const g=(0,T.A)();(0,ye.A)({isActive:r,onBack:l});const A=(0,s.hb)(e=>{n&&a&&a();const i=e.target.value.slice(0,t);i.length===t&&o(i),v(i),e.target.value=i},[a,t,n,o]);return(0,ie.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Iu.A,{sticker:e,size:160,className:"settings-content-icon"}),c&&(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:g("TwoStepAuth.ConfirmEmailDescription",c)})]}),(0,ie.FD)("div",{className:"settings-item settings-group",children:[(0,ie.Y)(X.A,{value:p,ref:d,inputMode:"decimal",label:g("YourEmailCode"),error:n,onChange:A}),i&&(0,ie.Y)(Ms.A,{})]})]})})),Yu=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,T.A)();return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Lock,previewUrl:jd,size:160,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:(0,Mt.A)(s("EnabledPasswordText"),["br"])})]}),(0,ie.FD)("div",{className:"settings-item",children:[(0,ie.Y)(ui.A,{icon:"edit",onClick:()=>i({screen:a.VS.TwoFaChangePasswordCurrent}),children:s("ChangePassword")}),(0,ie.Y)(ui.A,{icon:"password-off",onClick:()=>i({screen:a.VS.TwoFaTurnOff}),children:s("TurnPasswordOff")}),(0,ie.Y)(ui.A,{icon:"email",onClick:()=>i({screen:a.VS.TwoFaRecoveryEmailCurrentPassword}),children:s("SetRecoveryEmail")})]})]})}),Fu=(0,s.ph)((0,n.EK)((e,{icon:t})=>({animatedEmoji:(0,c.oei)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:i,error:n,placeholder:a,shouldConfirm:o,clearError:r,onSubmit:l,isActive:c,onReset:d})=>{const h=(0,s.li)(),{isMobile:m}=(0,Y.Ay)(),p=m?550:400,[v,g]=(0,s.J0)(""),[A,f,b]=(0,F.A)(!1);(0,s.vJ)(()=>{u.TF||setTimeout(()=>{h.current.focus()},p)},[p]);const C=(0,s.hb)(e=>{n&&r&&r(),g(e.target.value)},[r,n]),y=(0,s.hb)(()=>{l()},[l]),S=(0,s.hb)(()=>{b(),l()},[l,b]),k=(0,T.A)();return(0,ye.A)({isActive:c,onBack:d}),(0,ie.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Iu.A,{sticker:e,size:160,className:"settings-content-icon"}),"email"===t&&(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:k("RecoveryEmailSubtitle")})]}),(0,ie.FD)("div",{className:"settings-item settings-group",children:[(0,ie.FD)("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&l(v)},children:[(0,ie.Y)(X.A,{ref:h,value:v,inputMode:t,label:a,error:n,onChange:C}),v?(0,ie.Y)(Z.A,{type:"submit",isLoading:i,ripple:!0,children:k("Continue")}):(0,ie.Y)(Z.A,{isText:!0,isLoading:i,ripple:!0,onClick:o?f:y,children:k("YourEmailSkip")})]}),o&&(0,ie.FD)(ee.A,{className:"narrow",isOpen:A,title:k("YourEmailSkipWarning"),onClose:b,children:[(0,Mt.A)(k("YourEmailSkipWarningText"),["br","simple_markdown"]),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:S,children:k("YourEmailSkip")}),(0,ie.Y)(Z.A,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:b,children:k("Cancel")})]})]})]})]})})),Du=(0,s.ph)(({isActive:e,onReset:t,onStart:i})=>{const s=(0,T.A)();return(0,ye.A)({isActive:e,onBack:t}),(0,ie.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ie.FD)("div",{className:"settings-content-header no-border",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Lock,previewUrl:jd,size:160,className:"settings-content-icon"}),(0,ie.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("SetAdditionalPasswordInfo")})]}),(0,ie.Y)("div",{className:"settings-item settings-group",children:(0,ie.Y)(Z.A,{onClick:i,children:s("EditAdminTransferSetPassword")})})]})}),Mu=(0,s.ph)((0,n.EK)(e=>({...e.twoFaSettings}))(({currentScreen:e,shownScreen:t,state:i,hint:o,isLoading:r,errorKey:l,waitingEmailCodeLength:c,dispatch:d,isActive:h,onReset:u})=>{const{updatePassword:m,checkPassword:p,clearTwoFaError:v,updateRecoveryEmail:g,provideTwoFaEmailCode:A,clearPassword:f,openSettingsScreen:b}=(0,n.ko)(),C=(0,Ri.A)(),y=(0,T.A)();(0,s.vJ)(()=>{c&&(e===a.VS.TwoFaNewPasswordEmail?b({screen:a.VS.TwoFaNewPasswordEmailCode}):e===a.VS.TwoFaRecoveryEmail&&b({screen:a.VS.TwoFaRecoveryEmailCode}))},[e,c,b]);const S=(0,s.hb)(()=>{d({type:"reset"}),b({screen:a.VS.TwoFaNewPassword})},[d,b]),k=(0,s.hb)(e=>{d({type:"setPassword",payload:e}),b({screen:a.VS.TwoFaNewPasswordConfirm})},[d,b]),N=(0,s.hb)(()=>{b({screen:a.VS.TwoFaNewPasswordHint})},[b]),w=(0,s.hb)(e=>{d({type:"setHint",payload:e}),b({screen:a.VS.TwoFaNewPasswordEmail})},[d,b]),I=(0,s.hb)(e=>{d({type:"setEmail",payload:e}),m({...i,email:e,onSuccess:()=>{b({screen:a.VS.TwoFaCongratulations})}})},[d,i,m,b]),P=(0,s.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{b({screen:a.VS.TwoFaChangePasswordNew})}})},[p,d,b]),Y=(0,s.hb)(e=>{d({type:"setPassword",payload:e}),b({screen:a.VS.TwoFaChangePasswordConfirm})},[d,b]),F=(0,s.hb)(()=>{b({screen:a.VS.TwoFaChangePasswordHint})},[b]),D=(0,s.hb)(e=>{d({type:"setHint",payload:e}),m({...i,hint:e,onSuccess:()=>{b({screen:a.VS.TwoFaCongratulations})}})},[d,i,m,b]),M=(0,s.hb)(e=>{f({currentPassword:e,onSuccess:()=>{b({screen:a.VS.Privacy})}})},[f,b]),B=(0,s.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{b({screen:a.VS.TwoFaRecoveryEmail})}})},[p,d,b]),L=(0,s.hb)(e=>{d({type:"setEmail",payload:e}),g({...i,email:e,onSuccess:()=>{b({screen:a.VS.TwoFaCongratulations})}})},[d,i,g,b]),R=(0,s.hb)(e=>{A({code:e})},[A]);switch(e){case a.VS.TwoFaDisabled:return(0,ie.Y)(Du,{onStart:S,isActive:h||[a.VS.TwoFaNewPassword,a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaNewPassword:return(0,ie.Y)(Jd,{placeholder:y("PleaseEnterPassword"),submitLabel:y("Continue"),onSubmit:k,isActive:h||[a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaNewPasswordConfirm:return(0,ie.Y)(Jd,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),submitLabel:y("Continue"),onSubmit:N,isActive:h||[a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaNewPasswordHint:return(0,ie.Y)(Fu,{icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:w,isActive:h||[a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaNewPasswordEmail:return(0,ie.Y)(Fu,{icon:"email",type:"email",isLoading:r,error:l&&C.withRegular(l),clearError:v,placeholder:y("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,isActive:h||[a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaNewPasswordEmailCode:return(0,ie.Y)(Pu,{isLoading:r,error:l&&C.withRegular(l),clearError:v,onSubmit:R,isActive:h||t===a.VS.TwoFaCongratulations,onReset:u});case a.VS.TwoFaCongratulations:return(0,ie.Y)(wu,{isActive:h,onReset:u});case a.VS.TwoFaEnabled:return(0,ie.Y)(Yu,{isActive:h||[a.VS.TwoFaChangePasswordCurrent,a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaTurnOff,a.VS.TwoFaRecoveryEmailCurrentPassword,a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaChangePasswordCurrent:return(0,ie.Y)(Jd,{isLoading:r,error:l&&C.withRegular(l),onClearError:v,hint:o,onSubmit:P,isActive:h||[a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaChangePasswordNew:return(0,ie.Y)(Jd,{placeholder:y("PleaseEnterNewFirstPassword"),onSubmit:Y,isActive:h||[a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaChangePasswordConfirm:return(0,ie.Y)(Jd,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),onSubmit:F,isActive:h||[a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaChangePasswordHint:return(0,ie.Y)(Fu,{isLoading:r,error:l&&C.withRegular(l),clearError:v,icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:D,isActive:h||t===a.VS.TwoFaCongratulations,onReset:u});case a.VS.TwoFaTurnOff:return(0,ie.Y)(Jd,{isLoading:r,error:l&&C.withRegular(l),onClearError:v,hint:o,onSubmit:M,isActive:h,onReset:u});case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ie.Y)(Jd,{isLoading:r,error:l&&C.withRegular(l),onClearError:v,hint:o,onSubmit:B,isActive:h||[a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaRecoveryEmail:return(0,ie.Y)(Fu,{icon:"email",type:"email",placeholder:y("RecoveryEmailTitle"),onSubmit:L,isActive:h||[a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:u});case a.VS.TwoFaRecoveryEmailCode:return(0,ie.Y)(Pu,{isLoading:r,error:l&&C.withRegular(l),clearError:v,onSubmit:R,isActive:h||t===a.VS.TwoFaCongratulations,onReset:u});default:return}})),Tu=Object.keys(a.VS).length/2,Bu=[a.VS.TwoFaDisabled,a.VS.TwoFaNewPassword,a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations,a.VS.TwoFaEnabled,a.VS.TwoFaChangePasswordCurrent,a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaTurnOff,a.VS.TwoFaRecoveryEmailCurrentPassword,a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode],Lu=[a.VS.PasscodeDisabled,a.VS.PasscodeEnabled],Ru=[a.VS.Folders,a.VS.FoldersCreateFolder,a.VS.FoldersEditFolder,a.VS.FoldersEditFolderFromChatList,a.VS.FoldersEditFolderInvites,a.VS.FoldersIncludedChats,a.VS.FoldersIncludedChatsFromChatList,a.VS.FoldersExcludedChats,a.VS.FoldersExcludedChatsFromChatList,a.VS.FoldersShare],xu=[a.VS.PrivacyBlockedUsers,a.VS.ActiveWebsites],Eu=[a.VS.PrivacyPhoneNumberAllowedContacts,a.VS.PrivacyPhoneNumberDeniedContacts],Vu=[a.VS.PrivacyLastSeenAllowedContacts,a.VS.PrivacyLastSeenDeniedContacts],_u=[a.VS.PrivacyProfilePhotoAllowedContacts,a.VS.PrivacyProfilePhotoDeniedContacts],Uu=[a.VS.PrivacyBioAllowedContacts,a.VS.PrivacyBioDeniedContacts],Ou=[a.VS.PrivacyBirthdayAllowedContacts,a.VS.PrivacyBirthdayDeniedContacts],Ku=[a.VS.PrivacyGiftsAllowedContacts,a.VS.PrivacyGiftsDeniedContacts],Ju=[a.VS.PrivacyPhoneCallAllowedContacts,a.VS.PrivacyPhoneCallDeniedContacts],Gu=[a.VS.PrivacyPhoneP2PAllowedContacts,a.VS.PrivacyPhoneP2PDeniedContacts],ju=[a.VS.PrivacyForwardingAllowedContacts,a.VS.PrivacyForwardingDeniedContacts],zu=[a.VS.PrivacyVoiceMessagesAllowedContacts,a.VS.PrivacyVoiceMessagesDeniedContacts],Hu=[a.VS.PrivacyGroupChatsAllowedContacts,a.VS.PrivacyGroupChatsDeniedContacts],$u=[a.VS.PrivacyNoPaidMessages],qu=(0,s.ph)(({isActive:e,currentScreen:t,foldersState:i,foldersDispatch:o,onReset:r,animationLevel:l,shouldSkipTransition:d})=>{const{closeShareChatFolderModal:h,openSettingsScreen:u}=(0,n.ko)(),m=(0,s.li)(),[p,v]=(0,Cd.A)(Sd,yd),[g,A]=(0,s.J0)("");(0,kd.A)({containerRef:m,selector:".settings-content"},[t]);const f=(0,M.A)(e=>{const s=(0,c.nTw)((0,n.mS)()).shareFolderScreen?.isFromSettings;t===a.VS.FoldersShare&&h(),!0===e||void 0!==s&&!s?r(!0):(t!==a.VS.FoldersCreateFolder&&t!==a.VS.FoldersEditFolder&&t!==a.VS.FoldersEditFolderFromChatList&&t!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{o({type:"reset"})},200),t!==a.VS.FoldersIncludedChats&&t!==a.VS.FoldersExcludedChats?r():"create"===i.mode?u({screen:a.VS.FoldersCreateFolder}):u({screen:a.VS.FoldersEditFolder}))});function b(s,n){const r={[a.VS.PrivacyPhoneNumber]:Eu.includes(n),[a.VS.PrivacyLastSeen]:Vu.includes(n),[a.VS.PrivacyProfilePhoto]:_u.includes(n),[a.VS.PrivacyBio]:Uu.includes(n),[a.VS.PrivacyBirthday]:Ou.includes(n),[a.VS.PrivacyGifts]:Ku.includes(n),[a.VS.PrivacyPhoneCall]:Ju.includes(n),[a.VS.PrivacyPhoneP2P]:Gu.includes(n),[a.VS.PrivacyForwarding]:ju.includes(n),[a.VS.PrivacyVoiceMessages]:zu.includes(n),[a.VS.PrivacyGroupChats]:Hu.includes(n),[a.VS.PrivacyMessages]:$u.includes(n)},l=Bu.includes(n),c=Lu.includes(n),d=Ru.includes(n),h=xu.includes(n)||l||c||Object.keys(r).map(Number).includes(n)||Object.values(r).includes(!0);switch(t){case a.VS.Main:return(0,ie.Y)(Xh,{isActive:e,onReset:f});case a.VS.EditProfile:return(0,ie.Y)(Fh,{isActive:e&&s,onReset:f});case a.VS.General:return(0,ie.Y)(Eh,{isActive:s||n===a.VS.GeneralChatBackgroundColor||n===a.VS.GeneralChatBackground||n===a.VS.QuickReaction||n===a.VS.CustomEmoji||h||d,onReset:f});case a.VS.QuickReaction:return(0,ie.Y)(Su,{isActive:s,onReset:f});case a.VS.CustomEmoji:return(0,ie.Y)(vh,{isActive:s,onReset:f});case a.VS.Notifications:return(0,ie.Y)(iu,{isActive:s,onReset:f});case a.VS.DataStorage:return(0,ie.Y)(gh,{isActive:s,onReset:f});case a.VS.Privacy:return(0,ie.Y)(cu,{isActive:s||h,onReset:f});case a.VS.Language:return(0,ie.Y)(qh,{isActive:s||n===a.VS.DoNotTranslate,onReset:f});case a.VS.DoNotTranslate:return(0,ie.Y)(Ch,{isActive:s,onReset:f});case a.VS.Stickers:return(0,ie.Y)(Nu,{isActive:s,onReset:f});case a.VS.Experimental:return(0,ie.Y)(Lh,{isActive:s,onReset:f});case a.VS.GeneralChatBackground:return(0,ie.Y)(Kh,{isActive:s||n===a.VS.GeneralChatBackgroundColor,onReset:f});case a.VS.GeneralChatBackgroundColor:return(0,ie.Y)(Hh,{isActive:s,onReset:f});case a.VS.ActiveSessions:return(0,ie.Y)(ch,{isActive:s,onReset:f});case a.VS.ActiveWebsites:return(0,ie.Y)(mh,{isActive:s,onReset:f});case a.VS.PrivacyBlockedUsers:return(0,ie.Y)(hu,{isActive:s,onReset:f});case a.VS.PrivacyPhoneNumber:case a.VS.PrivacyLastSeen:case a.VS.PrivacyProfilePhoto:case a.VS.PrivacyBio:case a.VS.PrivacyBirthday:case a.VS.PrivacyGifts:case a.VS.PrivacyPhoneCall:case a.VS.PrivacyForwarding:case a.VS.PrivacyVoiceMessages:case a.VS.PrivacyGroupChats:return(0,ie.Y)(fu,{screen:t,isActive:s||r[t],onReset:f});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:case a.VS.PrivacyNoPaidMessages:return(0,ie.Y)(yu,{isAllowList:!0,usersOnly:t===a.VS.PrivacyNoPaidMessages,withPremiumCategory:t===a.VS.PrivacyGroupChatsAllowedContacts,withMiniAppsCategory:t===a.VS.PrivacyGiftsAllowedContacts,screen:t,isActive:s||r[t],onReset:f});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,ie.Y)(yu,{screen:t,isActive:s,onReset:f});case a.VS.PrivacyMessages:return(0,ie.Y)(sh,{isActive:s,onReset:f});case a.VS.Folders:case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:case a.VS.FoldersShare:return(0,ie.Y)(Ud,{currentScreen:t,shownScreen:n,state:i,dispatch:o,isActive:s,onReset:f});case a.VS.TwoFaDisabled:case a.VS.TwoFaNewPassword:case a.VS.TwoFaNewPasswordConfirm:case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaCongratulations:case a.VS.TwoFaEnabled:case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:case a.VS.TwoFaChangePasswordHint:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:case a.VS.TwoFaRecoveryEmail:case a.VS.TwoFaRecoveryEmailCode:return(0,ie.Y)(Mu,{currentScreen:t,state:p,dispatch:v,shownScreen:n,isActive:s,onReset:f});case a.VS.PasscodeDisabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:case a.VS.PasscodeChangePasscodeConfirm:case a.VS.PasscodeCongratulations:case a.VS.PasscodeEnabled:case a.VS.PasscodeTurnOff:return(0,ie.Y)($d,{currentScreen:t,passcode:g,onSetPasscode:A,shownScreen:n,isActive:s,onReset:f});case a.VS.Performance:return(0,ie.Y)(lu,{isActive:s,onReset:f});default:return}}return(0,ie.Y)(ae.Ay,{ref:m,id:"Settings",name:(0,fc.P)("layers",l,d),activeKey:t,renderCount:Tu,shouldWrap:!0,withSwipeControl:!0,children:function(e,s,n,a){return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)($h,{currentScreen:t,onReset:f,editedFolderId:i.folderId}),b(e,a)]})}})}),Wu=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{byId:i,statusesById:s}=e.users;return{usersById:i,userStatusesById:s,contactIds:t}})(({isActive:e,filter:t,usersById:i,userStatusesById:o,contactIds:r,onReset:c})=>{const{openChat:d,openNewContactDialog:h}=(0,n.ko)(),u=(0,T.A)(),{isMobile:m}=(0,Y.Ay)();(0,ye.A)({isActive:e,onBack:c});const p=(0,s.hb)(e=>{d({id:e,shouldReplaceHistory:!0})},[d]),v=(0,s.Kr)(()=>{if(!r)return;const e=(0,Dt.PU)({ids:r,query:t,type:"user"});return(0,l.UB)(e,i,o)},[r,t,i,o]),[g,A]=(0,Ys.A)(void 0,v,Boolean(t));return(0,ie.FD)(vs.A,{items:g,onLoadMore:A,className:"chat-list custom-scroll",children:[g?.length?g.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable contact-list-item",onClick:()=>p(e),children:(0,ie.Y)(bs.A,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:a.G9.ChatList,ripple:!m})},e)):g&&!g.length?(0,ie.Y)("p",{className:"no-results",dir:"auto",children:t.length?"No contacts matched your search.":"Contact list is empty."},"no-results"):(0,ie.Y)(Ms.A,{},"loading"),(0,ie.Y)(bi.A,{isShown:!0,onClick:h,ariaLabel:u("CreateNewContact"),iconName:"add-user-filled"},"create-new-contact")]})})),Qu=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{query:i,fetchingStatus:s,globalResults:n,localResults:a}=(0,c.nTw)(e).globalSearch,{peerIds:o}=n||{},{peerIds:r}=a||{};return{localContactIds:t,searchQuery:i,isSearching:s?.chats,globalPeerIds:o,localPeerIds:r}})(({isChannel:e,isActive:t,selectedMemberIds:i,localContactIds:a,searchQuery:o,isSearching:r,localPeerIds:c,globalPeerIds:d,onSelectedMemberIdsChange:h,onNextStep:u,onReset:m})=>{const{setGlobalSearchQuery:p}=(0,n.ko)(),v=(0,T.A)();(0,ye.A)({isActive:t,onBack:m});const g=(0,s.hb)(e=>{p({query:e})},[]),A=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=a?(0,Dt.PU)({ids:a,query:o,type:"user"}):[];return(0,Is.A)((0,pi.Am)([...t,...c||[],...d||[]]).filter(t=>{const i=e[t];return i&&!i.isSelf&&(i.canBeInvitedToGroup||!(0,l.tv)(i))}),!1,i)},[a,o,c,d,i]),f=(0,s.hb)(()=>{p({query:""}),u()},[u]);return(0,ie.FD)("div",{className:"NewChat step-1",children:[(0,ie.FD)("div",{className:"left-header",children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:m,ariaLabel:"Return to Chat List",children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),(0,ie.Y)("h3",{children:v("GroupAddMembers")})]}),(0,ie.FD)("div",{className:"NewChat-inner step-1",children:[(0,ie.Y)(gi.A,{itemIds:A,selectedIds:i,filterValue:o,filterPlaceholder:v("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:r,isSearchable:!0,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox",withDefaultPadding:!0,onSelectedIdsChange:h,onFilterChange:g}),(0,ie.Y)(bi.A,{isShown:!0,onClick:f,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info",iconName:"arrow-right"})]})]})})),Zu=(0,s.ph)((0,n.EK)(e=>{const{progress:t,error:i}=(0,c.nTw)(e).chatCreation||{};return{creationProgress:t,creationError:i,maxGroupSize:e.config?.maxGroupSize}})(({isChannel:e,isActive:t,memberIds:i,maxGroupSize:o,creationProgress:r,creationError:c,onReset:d})=>{const{createGroupChat:h,createChannel:u}=(0,n.ko)(),m=(0,T.A)();(0,ye.A)({isActive:t,onBack:d});const[p,v]=(0,s.J0)(""),[g,A]=(0,s.J0)(""),[f,b]=(0,s.J0)(),[C,y]=(0,s.J0)(),S="Chat title can't be empty",k="Channel title can't be empty",N=r===a.n7.InProgress;(0,s.vJ)(()=>{if(e)return;if(!i.length||i.length>4)return void v("");const t=(0,n.mS)(),s=t.users.byId,a=[t.currentUserId,...i].map(e=>(0,l.u0)(s[e])).filter(Boolean),o=a.slice(0,-1).join(", ")+m("CreateGroup.PeersTitleLastDelimeter")+a[a.length-1];v(o)},[e,i,m]);const w=(0,s.hb)(e=>{const{value:t}=e.currentTarget,i=t.replace(/^\s+/,"");v(i),i!==t&&(e.currentTarget.value=i)},[]),I=(0,s.hb)(e=>{A(e.currentTarget.value)},[]),P=(0,s.hb)(()=>{p.length?o&&i.length>=o?y("Sorry, creating supergroups is not yet supported"):h({title:p,photo:f,memberIds:i}):y(S)},[p,i,o,h,f]),Y=(0,s.hb)(()=>{p.length?u({title:p,about:g,photo:f,memberIds:i,isChannel:!0}):y(k)},[p,u,g,f,i,k]);(0,s.vJ)(()=>{r===a.n7.Complete&&d(!0)},[r,d]);const F=c&&m(c)||(C!==S&&C!==k?C:void 0);return(0,ie.FD)("div",{className:"NewChat",children:[(0,ie.FD)("div",{className:"left-header",children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection",children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),(0,ie.Y)("h3",{children:m(e?"NewChannel":"NewGroup")})]}),(0,ie.FD)("div",{className:"NewChat-inner step-2",children:[(0,ie.Y)(Ih.A,{onChange:b,title:m("AddPhoto")}),(0,ie.Y)(X.A,{value:p,onChange:w,label:m(e?"EnterChannelName":"GroupName"),error:C===S||C===k?C:void 0}),e&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(X.A,{value:g,onChange:I,label:m("DescriptionOptionalPlaceholder")}),(0,ie.Y)("p",{className:"note",children:m("DescriptionInfo")})]}),F&&(0,ie.Y)("p",{className:"error",children:F}),i.length>0&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:"chat-members-heading",children:m("GroupInfo.ParticipantCount",i.length,"i")}),(0,ie.Y)("div",{className:"chat-members-list custom-scroll",children:i.map(e=>(0,ie.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ie.Y)(bs.A,{userId:e})}))})]})]}),(0,ie.Y)(bi.A,{isShown:0!==p.length,onClick:e?Y:P,disabled:N,ariaLabel:e?m("ChannelIntro.CreateChannel"):"Create Group",iconName:"arrow-right",isLoading:N})]})})),Xu=Object.keys(a.Bn).length/2,em=(0,s.ph)(({isActive:e,isChannel:t=!1,content:i,animationLevel:o,onReset:r})=>{const{openLeftColumnContent:l,setGlobalSearchQuery:c}=(0,n.ko)(),[d,h]=(0,s.J0)([]),u=(0,s.hb)(()=>{l({contentKey:t?a.Bn.NewChannelStep2:a.Bn.NewGroupStep2})},[t]),m=(0,M.A)(e=>{const t=e.length>d.length;h(e),t&&c({query:""})});return(0,ie.Y)(ae.Ay,{id:"NewChat",name:(0,fc.P)("layers",o),renderCount:Xu,activeKey:i,children:s=>{switch(i){case a.Bn.NewChannelStep1:case a.Bn.NewGroupStep1:return(0,ie.Y)(Qu,{isChannel:t,isActive:e,selectedMemberIds:d,onSelectedMemberIdsChange:m,onNextStep:u,onReset:r});case a.Bn.NewChannelStep2:case a.Bn.NewGroupStep2:return(0,ie.Y)(Zu,{isChannel:t,isActive:s&&e,memberIds:d,onReset:r});default:return}}})});var tm=i(34458),im=i(11462),sm=i(24920),nm=i(75343),am=i(40175),om=i(51067),rm=i(77018);const lm=(0,s.ph)(({isActive:e,isForumPanelOpen:t,archiveSettings:i,isStoryRibbonShown:s,onReset:a,onTopicSearch:r,foldersDispatch:l})=>{const{updateArchiveSettings:c}=(0,n.ko)(),d=(0,T.A)();(0,ye.A)({isActive:e,onBack:a});const h=(0,M.A)(()=>{c({isHidden:!1})}),{shouldDisableDropdownMenuTransitionRef:u,handleDropdownMenuTransitionEnd:m}=(0,sm.A)(t),{shouldRender:p,transitionClassNames:v}=(0,Je.A)(!t,void 0,void 0,!1),{shouldRenderForumPanel:g,handleForumPanelAnimationEnd:A,handleForumPanelAnimationStart:f,isAnimationStarted:b}=(0,im.A)(t),C=t&&b,{shouldRender:y,transitionClassNames:S,isClosing:k}=(0,Je.A)(s,void 0,void 0,"",!1,tm.UG+o.xB5);return(0,ie.FD)("div",{className:"ArchivedChats",children:[(0,ie.FD)("div",{className:(0,pe.A)("left-header",!y&&"left-header-shadow"),children:[d.isRtl&&(0,ie.Y)("div",{className:"DropdownMenuFiller"}),(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:"Return to chat list",className:(0,pe.A)(d.isRtl&&"rtl",C&&d.isRtl&&"right-aligned",u.current&&d.isRtl&&"disable-transition"),onTransitionEnd:m,children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),p&&(0,ie.Y)("h3",{className:v,children:d("ArchivedChats")}),(0,ie.Y)("div",{className:"story-toggler-wrapper",children:(0,ie.Y)(am.A,{canShow:!0,isArchived:!0})}),i.isHidden&&(0,ie.Y)(de.A,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:d.isRtl?m:void 0,children:(0,ie.Y)(he.A,{icon:"archive-from-main",onClick:h,children:d("lng_context_archive_to_list")})})]}),(0,ie.FD)("div",{className:(0,pe.A)("chat-list-wrapper",y&&"with-story-ribbon",S),children:[y&&(0,ie.Y)(nm.A,{isArchived:!0,className:"left-header-shadow",isClosing:k}),(0,ie.Y)(om.A,{folderType:"archived",isActive:e,isForumPanelOpen:C,isMainList:!0,foldersDispatch:l,archiveSettings:i,isStoryRibbonShown:s})]}),g&&(0,ie.Y)(rm.A,{isOpen:t,onTopicSearch:r,onOpenAnimationStart:f,onCloseAnimationEnd:A})]})}),cm=(0,s.ph)((0,n.EK)(e=>{const{byId:t,orderedIds:i}=e.chatFolders;return{foldersById:t,folderOrderedIds:i}})(({isOpen:e,chatId:t,foldersById:i,folderOrderedIds:a,onClose:r,onCloseAnimationEnd:l})=>{const{editChatFolders:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,s.Kr)(()=>i?Object.keys(i).reduce((e,s)=>{const{includedChatIds:n,pinnedChatIds:a}=i[Number(s)];return(n.includes(t)||a?.includes(t))&&e.push(s),e},[]):[],[t,i]),[u,m]=(0,s.J0)(h),p=(0,s.Kr)(()=>a?.filter(e=>e!==o.DSF).map(e=>{const t=i?i[e]:void 0;return{label:t?(0,$i.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}):"",value:String(e)}})||[],[a,i]),v=(0,s.hb)(()=>{const e=h.filter(e=>!u.includes(e)).map(Number),i=u.filter(e=>!h.includes(e)).map(Number);c({chatId:t,idsToRemove:e,idsToAdd:i}),r()},[t,c,h,r,u]);if(i&&a)return(0,ie.FD)(ee.A,{isOpen:e,onClose:r,onCloseAnimationEnd:l,onEnter:v,className:(0,pe.A)("_fJBBCCE","delete"),contentClassName:"EG5lPWY1",title:d("FilterAddTo"),children:[(0,ie.Y)("div",{className:(0,pe.A)("heYMHiUt","custom-scroll"),children:(0,ie.Y)(Jl.A,{options:p,selected:u,onChange:m})}),(0,ie.Y)("div",{className:"_jtqAaUU",children:(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v,children:d("FilterAddTo")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:r,children:d("Cancel")})]})})]})}));var dm=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(dm||{});const hm=(0,s.ph)(({isOpen:e,chatId:t,topicId:i,onClose:a,onCloseAnimationEnd:r})=>{const[l,c]=(0,s.J0)(dm.Forever),{updateChatMutedState:d,updateTopicMutedState:h}=(0,n.ko)(),u=(0,T.A)(),m=(0,s.Kr)(()=>[{label:u("MuteFor.Hours",1),value:dm.OneHour},{label:u("MuteFor.Hours",4),value:dm.FourHours},{label:u("MuteFor.Hours",8),value:dm.EightHours},{label:u("MuteFor.Days",1),value:dm.OneDay},{label:u("MuteFor.Days",3),value:dm.ThreeDays},{label:u("MuteFor.Forever"),value:dm.Forever}],[u]),p=(0,s.hb)(()=>{let e;e=l===dm.Forever?o.xEh:Math.floor(Date.now()/1e3)+Number(l),i?h({chatId:t,topicId:i,mutedUntil:e}):d({chatId:t,mutedUntil:e}),a()},[t,l,a,i]);return(0,ie.FD)(ee.A,{isOpen:e,onClose:a,onCloseAnimationEnd:r,onEnter:p,className:"delete",title:u("Notifications"),children:[(0,ie.Y)(te.A,{className:"dialog-checkbox-group",name:"muteFor",options:m,selected:l,onChange:c}),(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(Z.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:p,children:u("Common.Done")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:u("Cancel")})]})]})});var um=i(99515),mm=i(24531);const pm=(0,s.ph)((0,n.EK)((e,{fromSticker:t,stickerSetShortName:i})=>{const s=(0,c.Xf0)(e),{chatId:n,threadId:a}=s||{},o=n&&(0,c.hds)(e,n),r=n?(0,c.AWZ)(e,n):void 0,d=n&&(0,c.yps)(e,n),h=n?(0,c.nZ4)(e,n):void 0,u=o?(0,l.Q_)(o,r,Boolean(d),h):void 0,m=n&&a?(0,c.Vw0)(e,n,a):void 0,p=Boolean(!m?.isCommentsInfo&&m?.fromChannelId),v=n&&a?(0,c.S0q)(e,n,a):void 0,g=Boolean(o&&a&&(0,l.__)(o,v,p,r)&&u?.canSendStickers),A=t?t.stickerSetInfo:i?{shortName:i}:void 0,f=A?(0,c.ycM)(e,A):void 0,b=n?(0,c.WA9)(e,n):void 0;return{canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),canSendStickers:g,isSavedMessages:h,shouldSchedule:!b&&(0,c.PIP)(e),stickerSet:f,isCurrentUserPremium:(0,c.g29)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:s}})(({isOpen:e,fromSticker:t,stickerSetShortName:i,stickerSet:a,canSendStickers:r,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isCurrentUserPremium:h,shouldUpdateStickerSetOrder:u,currentMessageList:m,onClose:p})=>{const{loadStickers:v,toggleStickerSet:g,sendMessage:A,showNotification:f}=(0,n.ko)(),b=(0,s.li)(),C=(0,s.li)(),y=(0,T.A)(),{isMobile:S}=(0,Y.Ay)(),k=(0,U.A)(a),N=a||k,w=Boolean(!N?.isArchived&&N?.installedDate),I=N?.isEmoji,[P,F]=(0,mm.A)(l),{handleScroll:D,isAtBeginning:M}=(0,ps.A)(),{observe:B}=(0,nr.BL)({rootRef:b,throttleMs:200,isDisabled:!e});(0,s.vJ)(()=>{e&&!N?.stickers&&v({stickerSetInfo:t?t.stickerSetInfo:{shortName:i}})},[e,t,v,i,N]);const L=(0,s.hb)((e,t,i)=>{m&&(e={...e,isPreloadedGlobally:!0},c||i?P(i=>{A({messageList:m,sticker:e,isSilent:t,scheduledAt:i}),p()}):(A({messageList:m,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:u&&w}),p()))},[m,c,P,p,u,w]),R=(0,s.hb)(()=>{N&&(g({stickerSetId:N.id}),p())},[p,N,g]),x=(0,s.hb)(()=>{if(!N)return;const{shortName:e}=N,t=I?"addemoji":"addstickers",i=`${o.jsp}${t}/${e}`;(0,pc.eM)(i),f({message:y("LinkCopied")})},[I,y,N,f]),E=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{round:!0,ripple:!S,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ie.Y)(Q.A,{name:"more"})}),[S]);return(0,ie.FD)(ee.A,{className:(0,pe.A)("StickerSetModal",I&&"custom-emoji"),isOpen:e,onClose:p,header:function(){const e=(0,pe.A)("modal-header",!M&&"with-top-border");return(0,ie.FD)("div",{className:e,dir:y.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:y("Close"),onClick:p,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:N?(0,Mt.A)(N.title,["emoji","links"]):y("AccDescrStickerSet")}),(0,ie.Y)(de.A,{className:"stickers-more-menu with-menu-transitions",trigger:E,positionX:"right",children:(0,ie.Y)(he.A,{icon:"copy",onClick:x,children:y("StickersCopy")})})]})}(),children:[N?.stickers?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{ref:b,className:"stickers custom-scroll",onScroll:D,children:(0,ie.FD)("div",{className:"shared-canvas-container stickers-grid",children:[(0,ie.Y)("canvas",{ref:C,className:"shared-canvas"}),N.stickers.map(e=>(0,ie.Y)(gr,{sticker:e,size:I?o.$nk:o.GhT,observeIntersection:B,onClick:r&&!I?L:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h,sharedCanvasRef:C}))]})}),(0,ie.Y)("div",{className:"button-wrapper",children:(0,ie.Y)(Z.A,{fluid:!0,color:w?"danger":"primary",onClick:R,children:(()=>{if(!N)return y("Loading");const e=I?"Emoji":"Sticker";return y(w?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,N.count,"i")})()})})]}):(0,ie.Y)(Ms.A,{}),F]})})),vm={root:"nZYT4vJ3",sets:"JzkmXjFF"},gm=(0,s.ph)((0,n.EK)(e=>({canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({customEmojiSetIds:e,canPlayAnimatedEmojis:t,onClose:i})=>{const{openStickerSet:a}=(0,n.ko)(),o=(0,T.A)(),r=(0,s.Kr)(()=>e?.map(e=>(0,n.mS)().stickers.setsById[e]),[e]),l=(0,s.li)(),{observe:c}=(0,nr.BL)({rootRef:l,isDisabled:!r}),d=(0,U.A)(r),h=r||d,u=(0,M.A)(e=>{a({stickerSetInfo:e.stickerSetInfo})});return(0,ie.Y)(ee.A,{isOpen:Boolean(r),className:vm.root,onClose:i,hasCloseButton:!0,title:o("lng_custom_emoji_used_sets"),children:(0,ie.Y)("div",{className:(0,pe.A)(vm.sets,"custom-scroll"),ref:l,teactFastList:!0,children:h?.map(e=>(0,ie.Y)(ph,{className:vm.setCard,stickerSet:e,onClick:u,observeIntersection:c,noPlay:!t},e.id))})})}));var Am=i(54314),fm=i(60859);const bm={settings:{icon:"bots",label:"BotSettings"},help:{icon:"help",label:"BotHelp"}},Cm=(0,s.ph)((0,n.EK)((e,{chatId:t,threadId:i})=>{const s=(0,c.hds)(e,t),n=(0,c._ls)(e,t);if(!s||n)return{};const a=(0,v.L8)(s.id),o=a?(0,c.mBe)(e,t):void 0,r=o&&(0,l.Gh)(o),d=i===K.l3,h=(0,c.nZ4)(e,t),{chatId:u,threadId:m}=(0,c.Xf0)(e)||{},p=d&&!o&&((0,l.WX)(s)||(0,l.YE)(s))&&!(0,l.SJ)(s),g=(0,l.DX)(t)?void 0:(0,c.yps)(e,t),A=a?(0,c.vGo)(e,t):void 0,f=a?void 0:(0,c.AWZ)(e,t),b=A||f,C=(0,c.X2D)(e,t),y=(0,c.S0q)(e,t,i),S=s.isForum&&!s.isBotForum&&(s.isCreator||!(0,l.Sq)(s,"manageTopics")||(0,l.ub)(s,"manageTopics")),k=y&&(0,l.l1)(s,y),N=(0,c.e5V)(e,t),w=(0,c.jGY)(e,t)&&b?.isTranslationDisabled,I=(0,l.cG)(t,i,e.currentUserId)?(0,c.hds)(e,String(i)):void 0,P=(0,c.trm)(e),Y=(0,c.nTw)(e).chatInfo;return{chat:s,isMuted:(0,Pc.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),isPrivate:a,isTopic:s?.isForum&&!d,isForum:s?.isForum,isForumAsMessages:s?.isForumAsMessages,canAddContact:r,canDeleteChat:(0,l.IC)(s),canReportChat:p,canGift:C,hasLinkedChat:Boolean(f?.linkedChatId),botCommands:g?A?.botInfo?.commands:void 0,botPrivacyPolicyUrl:g?A?.botInfo?.privacyPolicyUrl:void 0,isChatInfoShown:Y.isOpen&&u===t&&m===i,canCreateTopic:S,canEditTopic:k,canManage:N,isRightColumnShown:(0,c.gjV)(e),canTranslate:w,isBlocked:A?.isBlocked,isBot:Boolean(g),isChatWithSelf:h,savedDialog:I,disallowedGifts:A?.disallowedGifts,isAccountFrozen:P}})(({chatId:e,threadId:t,isOpen:i,withExtraActions:a,anchor:r,isChannel:l,botCommands:c,botPrivacyPolicyUrl:d,withForumActions:h,isTopic:u,isForum:m,isForumAsMessages:p,isChatInfoShown:v,canStartBot:g,canSubscribe:A,canReportChat:f,canSearch:b,canCall:C,canMute:y,canViewStatistics:S,canViewMonetization:k,canViewBoosts:N,pendingJoinRequests:w,canLeave:I,canEnterVoiceChat:P,canCreateVoiceChat:D,chat:B,isPrivate:L,isMuted:R,canDeleteChat:x,canGift:E,hasLinkedChat:V,canAddContact:_,canCreateTopic:U,canEditTopic:O,canManage:K,isRightColumnShown:J,canTranslate:G,isBlocked:j,isBot:z,isChatWithSelf:H,savedDialog:$,canShowBoostModal:q,disallowedGifts:W,isAccountFrozen:Q,channelMonoforumId:Z,onJoinRequestsClick:X,onSubscribeChannel:ee,onSearchClick:te,onAsMessagesClick:se,onClose:ne,onCloseAnimationEnd:ae})=>{const{updateChatMutedState:oe,enterMessageSelectMode:re,sendBotCommand:le,restartBot:ce,requestMasterAndJoinGroupCall:de,createGroupCall:ue,openLinkedChat:me,openAddContactDialog:pe,openFrozenAccountModal:ve,requestMasterAndRequestCall:ge,toggleStatistics:Ae,openMonetizationStatistics:fe,openBoostStatistics:be,openGiftModal:Ce,openThreadWithInfo:ye,openCreateTopicPanel:Se,openEditTopicPanel:ke,openChat:Ne,openUrl:we,toggleManagement:Ie,togglePeerTranslations:Pe,blockUser:Ye,unblockUser:Fe,setViewForumAsMessages:De,openBoostModal:Me,reportMessages:Te,showNotification:Be}=(0,n.ko)(),Le=(0,T.A)(),Re=(0,Ri.A)(),{isMobile:xe}=(0,Y.Ay)(),[Ee,Ve]=(0,s.J0)(!0),[_e,Ue]=(0,s.J0)(!1),[Oe,Ke]=(0,s.J0)(!1),[Ge,je]=(0,s.J0)(!1),[ze,He,$e]=(0,F.A)(),{x:qe,y:Qe}=r;(0,Je.A)(i,ae,void 0,!1);const Ze=(0,Hi.A)(!(v||!m)||void 0,200),Xe=(0,s.Kr)(()=>{if(W)return Object.values(W).every(Boolean)},[W]),et=(0,M.A)(()=>{je(!1),ne()}),tt=(0,M.A)(()=>{Q?ve():(Ve(!1),Te({chatId:e,messageIds:[]})),ne()}),it=(0,M.A)(()=>{Q?(ve(),ne()):Ke(!0),Ve(!1)}),st=(0,M.A)(()=>{Ve(!1),ne()}),nt=(0,M.A)(()=>{ye({chatId:e,threadId:t}),Ue(!J),st()}),at=(0,M.A)(()=>{Ke(!1),ne()}),ot=(0,M.A)(()=>{Q?ve():le({command:"/start"})}),rt=(0,M.A)(()=>{Q?ve():ce({chatId:e})}),lt=(0,M.A)(()=>{Q?ve():oe({chatId:e,mutedUntil:o.Os5}),st()}),ct=(0,M.A)(()=>{Q?(ve(),st()):(He(),je(!0)),Ve(!1)}),dt=(0,M.A)(()=>{Q?ve():(Se({chatId:e}),Ue(!J)),st()}),ht=(0,M.A)(()=>{Q?ve():(Ie({force:!0}),Ue(!J)),st()}),ut=(0,M.A)(()=>{Q?ve():(ke({chatId:e,topicId:Number(t)}),Ue(!J)),st()}),mt=(0,M.A)(()=>{Ne({id:void 0}),De({chatId:e,isEnabled:!1}),st()}),pt=(0,M.A)(()=>{Q?ve():D?ue({chatId:e}):de({chatId:e}),st()}),vt=(0,M.A)(()=>{me({id:e}),st()}),gt=(0,M.A)(()=>{Xe&&B?Be({message:Re("SendDisallowError")}):(Ce({forUserId:e}),Q?ve():Ce({forUserId:e}),st())}),At=(0,M.A)(()=>{Q?ve():pe({userId:e}),st()}),ft=(0,M.A)(()=>{Q?ve():ee(),st()}),bt=(0,M.A)(()=>{Q?ve():ge({userId:e,isVideo:!0}),st()}),Ct=(0,M.A)(()=>{Q?ve():ge({userId:e}),st()}),yt=(0,M.A)(()=>{te(),st()}),St=(0,M.A)(()=>{Ae(),Ue(!J),st()}),kt=(0,M.A)(()=>{fe({chatId:e}),Ue(!J),st()}),Nt=(0,M.A)(()=>{Q?ve():N?(be({chatId:e}),Ue(!J)):Me({chatId:e}),st()}),wt=(0,M.A)(()=>{Pe({chatId:e,isEnabled:!0}),st()}),It=(0,M.A)(()=>{Q?ve():re(),st()}),Pt=(0,M.A)(()=>{se(),st()}),Yt=(0,M.A)(()=>{Q?ve():Ye({userId:e}),st()}),Ft=(0,M.A)(()=>{Q?ve():Fe({userId:e}),st()}),Dt=(0,M.A)(()=>{Ne({id:Z}),st()});(0,s.vJ)(Pi.M6,[]);const Mt=(0,s.Kr)(()=>{const e=c?.map(({command:e})=>{const t=bm[e];if(t)return(0,ie.Y)(he.A,{icon:t.icon,onClick:()=>{le({command:`/${e}`}),st()},children:Le(t.label)},e)}),t=c?.some(({command:e})=>"privacy"===e);return[...e||[],z&&(0,ie.Y)(he.A,{icon:"privacy-policy",onClick:()=>{t&&!d?le({command:"/privacy"}):we({url:d||Le("BotDefaultPrivacyPolicy")}),st()},children:Le("BotPrivacyPolicy")})].filter(Boolean)},[c,Le,d,z]),Tt=(0,s.Kr)(()=>{if(B)return Le($?"Delete":L?"DeleteChatUser":x?"GroupInfo.DeleteAndExit":l?"LeaveChannel":"Group.LeaveGroup")},[x,B,l,L,$,Le]);return(0,ie.Y)(Rr.A,{children:(0,ie.FD)("div",{className:"HeaderMenuContainer",children:[(0,ie.FD)(We.A,{isOpen:Ee,positionX:"right",style:`left: ${qe}px;top: ${Qe}px;`,onClose:st,shouldCloseFast:_e,children:[xe&&b&&(0,ie.Y)(he.A,{icon:"search",onClick:yt,children:Le("Search")}),h&&U&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(he.A,{icon:"comments",onClick:dt,children:Le("lng_forum_create_topic")}),(0,ie.Y)(fm.A,{})]}),Z&&(0,ie.Y)(he.A,{icon:"message",onClick:Dt,children:Re("ChannelSendMessage")}),Ze&&(0,ie.Y)(he.A,{icon:"info",onClick:nt,children:Le(u?"lng_context_view_topic":"lng_context_view_group")}),K&&!O&&(0,ie.Y)(he.A,{icon:"edit",onClick:ht,children:Le("Edit")}),O&&(0,ie.Y)(he.A,{icon:"edit",onClick:ut,children:Le("lng_forum_topic_edit")}),xe&&!h&&m&&!u&&(0,ie.Y)(he.A,{icon:"forums",onClick:mt,children:Le("Chat.ContextViewAsTopics")}),h&&Boolean(w)&&(0,ie.FD)(he.A,{icon:"user",onClick:X,children:[Le(l?"SubscribeRequests":"MemberRequests"),(0,ie.Y)("div",{className:"right-badge",children:w})]}),h&&!u&&!p&&(0,ie.Y)(he.A,{icon:"message",onClick:Pt,children:Le("lng_forum_view_as_messages")}),a&&g&&(0,ie.Y)(he.A,{icon:"bots",onClick:ot,children:Le("BotStart")}),a&&A&&(0,ie.Y)(he.A,{icon:l?"channel":"group",onClick:ft,children:Le(l?"ProfileJoinChannel":"ProfileJoinGroup")}),q&&!N&&(0,ie.Y)(he.A,{icon:"boost-outline",onClick:Nt,children:Le(l?"BoostingBoostChannelMenu":"BoostingBoostGroupMenu")}),_&&(0,ie.Y)(he.A,{icon:"add-user",onClick:At,children:Le("AddContact")}),xe&&C&&(0,ie.Y)(he.A,{icon:"phone",onClick:Ct,children:Le("Call")}),C&&(0,ie.Y)(he.A,{icon:"video-outlined",onClick:bt,children:Le("VideoCall")}),y&&(R?(0,ie.Y)(he.A,{icon:"unmute",onClick:lt,children:Le("ChatsUnmute")}):(0,ie.FD)(he.A,{icon:"mute",onClick:ct,children:[Le("ChatsMute"),"..."]})),(P||D)&&(0,ie.Y)(he.A,{icon:"voice-chat",onClick:pt,children:Le(D?"StartVoipChat":"VoipGroupJoinCall")}),V&&(0,ie.Y)(he.A,{icon:l?"comments":"channel",onClick:vt,children:Le(l?"ViewDiscussion":"lng_profile_view_channel")}),!h&&(0,ie.Y)(he.A,{icon:"select",onClick:It,children:Le("ReportSelectMessages")}),N&&(0,ie.Y)(he.A,{icon:"boost-outline",onClick:Nt,children:Le("Boosts")}),S&&(0,ie.Y)(he.A,{icon:"stats",onClick:St,children:Le("Statistics")}),l&&k&&(0,ie.Y)(he.A,{icon:"cash-circle",onClick:kt,children:Le("lng_channel_earn_title")}),G&&(0,ie.Y)(he.A,{icon:"language",onClick:wt,children:Le("lng_context_translate")}),f&&(0,ie.Y)(he.A,{icon:"flag",onClick:tt,children:Le("ReportPeer.Report")}),Mt,E&&(0,ie.Y)(he.A,{icon:"gift",onClick:gt,children:Le("ProfileSendAGift")}),z&&(0,ie.Y)(he.A,{icon:j?"bots":"hand-stop",onClick:j?rt:Yt,children:Le(j?"BotRestart":"Bot.Stop")}),L&&!H&&!z&&(0,ie.Y)(he.A,{icon:j?"user":"hand-stop",onClick:j?Ft:Yt,children:Le(j?"Unblock":"BlockUser")}),I&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(fm.A,{}),(0,ie.Y)(he.A,{destructive:!0,icon:"delete",onClick:it,children:Tt})]})]}),B&&(0,ie.Y)(Am.A,{isOpen:Oe,onClose:at,chat:$||B,isSavedDialog:Boolean($)}),y&&ze&&B?.id&&(0,ie.Y)(Tc.A,{isOpen:Ge,onClose:et,onCloseAnimationEnd:$e,chatId:B.id})]})})}));var ym=i(92915),Sm=i(81642),km=i(18653);const Nm={root:"vv5ppXel",active:"FVgqrSSK",info:"DboxqiZd",topRow:"Ymu2m1PR",meta:"A2rsvUBm",subtitle:"qUzmwaIn"},wm=(0,s.ph)(({isActive:e,message:t,senderPeer:i,messageChat:s,shouldShowChat:n,query:a,className:o,onClick:r})=>{const l=(0,Ri.A)(),c=t.forwardInfo?.hiddenUserName,d=n?s:i,h=n&&i?(0,Dt.Q5)(l,t.chatId,i):void 0,u=(0,M.A)(()=>{r(t)});return(0,ie.FD)("div",{role:"button",tabIndex:0,className:(0,pe.A)(Nm.root,e&&Nm.active,o),onClick:u,children:[(0,ie.Y)(Tt.A,{className:Nm.avatar,peer:d,text:c,size:"medium"}),(0,ie.FD)("div",{className:Nm.info,children:[(0,ie.FD)("div",{className:Nm.topRow,children:[d&&(0,ie.Y)(Ts.A,{peer:d,withEmojiStatus:!0})||c,(0,ie.Y)(Sm.A,{className:Nm.meta,message:t})]}),(0,ie.FD)("div",{className:Nm.subtitle,dir:"auto",children:[h&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("span",{className:"sender-name",children:(0,Mt.A)(h)}),(0,ie.Y)("span",{className:"colon",children:":"})]}),(0,ie.Y)(km.A,{message:t,highlight:a,truncateLength:200})]})]})]})}),Im={root:"FTMljUuX",header:"OvmjSMwA",active:"DEIUzXQd",avatar:"mp1PmoMq",input:"z2K8Q7ib",mobile:"u0fb78AA",focused:"dqF8dYNx",withDropdown:"AqhBggrp",adaptSearchBorders:"Q9RZQaTu",dropdown:"MFGvbICO",dropdownHidden:"Alee0CKy",results:"RtfTOE72",placeholder:"O1HoZFge",separator:"_Yy43QLl",savedTags:"BcvAfv1E",wrap:"JkESCST6",searchTags:"rO3pH3LI",savedSearchTag:"qA4gov4D",hash:"q5NOmUAM",searchTypes:"rVYZG__K",searchType:"nE1Xwoo7",selectedType:"i29dP8iT",footer:"jyS1l9yn","keyboard-visible":"ao05jKHW",keyboardVisible:"ao05jKHW",counter:"NmmL_cO3",mobileNavigation:"dLO1hlHU",navigationButton:"Z4vLAlsu",navigationDisabled:"IqA7R2xO",jumpIn:"n9kXbTu6"},Pm={isCustomPeer:!0,avatarIcon:"channel-filled",titleKey:"SearchPublicPosts"},Ym="MiddleSearchResult",Fm=(0,Ae.sg)(e=>e(),200,!1),Dm=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.Xf0)(e);if(!t)return{};const{chatId:i,threadId:s}=t,n=(0,c.hds)(e,i);if(!n)return{};const{requestedQuery:a,savedTag:o,results:r,fetchingQuery:d,isHashtag:h,type:u}=(0,c.TCk)(e)||{},{totalCount:m,foundIds:p,query:v}=r||{},g=e.currentUserId,A=(0,c.nZ4)(e,i),f=(0,l.cG)(i,s,g),b=A&&!f?e.savedReactionTags?.byKey:void 0;return{chat:n,monoforumChat:(0,c.k2W)(e,i),requestedQuery:a,totalCount:m,threadId:s,foundIds:p,isHistoryCalendarOpen:Boolean((0,c.nTw)(e).historyCalendarSelectedAt),savedTags:b,savedTag:o,isCurrentUserPremium:(0,c.g29)(e),isSavedMessages:A,fetchingQuery:d,isHashtagQuery:h,currentUserId:g,searchType:u,lastSearchQuery:v}})(({isActive:e,chat:t,monoforumChat:i,threadId:a,requestedQuery:d,savedTags:h,savedTag:p,totalCount:v,lastSearchQuery:g,foundIds:A,isHistoryCalendarOpen:f,isCurrentUserPremium:b,isSavedMessages:C,fetchingQuery:y,isHashtagQuery:S,searchType:k="chat",currentUserId:N})=>{const{updateMiddleSearch:w,resetMiddleSearch:I,performMiddleSearch:P,focusMessage:D,closeMiddleSearch:B,openHistoryCalendar:L,openPremiumModal:R,loadSavedReactionTags:x}=(0,n.ko)(),E=(0,s.li)(),V=(0,s.li)(),_=(0,s.li)(),U=(0,s.li)(!1),{isMobile:O}=(0,Y.Ay)(),K=(0,T.A)(),J=(0,Ri.A)(),[G,j]=(0,s.J0)(d||""),[z,H]=(0,s.J0)(0),$=A&&z>0,q=A&&z<A.length-1,[W,X]=(0,s.J0)(!e),ee=(0,s.li)(),te=(0,s.li)(!0),[se,ne,ae]=(0,F.A)(),[oe,re]=(0,s.J0)(!0),[le,ce]=(0,s.J0)(!1);!function(e,t){const i=(0,M.A)(i=>{e.every(e=>e.current&&!e.current.contains(i.target))&&t(i)});(0,s.vJ)(()=>(document.addEventListener("click",i),()=>{document.removeEventListener("click",i)}),[i])}([E],(0,M.A)(e=>{te.current||e.target.closest(".Modal")||ae()}));const de=Boolean(G&&A||S),he=S&&!G,ue=Boolean(G&&A&&!A.length&&!le&&!he),me=e&&(oe||!O)&&(se||"myChats"===k||"channels"===k)&&Boolean(de||ue||he||h),ve=Boolean(G&&!he||p),ge="chat"===k&&Boolean(A?.length),fe=(0,M.A)(()=>{B()}),be=(0,M.A)(()=>{(0,r.YS)(()=>{(0,nc.A)(V.current)})}),Ce=(0,M.A)(()=>{V.current?.blur()});(0,s.vJ)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),i=()=>{const{activeElement:i}=document;if(i&&i===V.current){const{pageTop:i,height:s}=e;(0,r.RK)(()=>{t.style.transform=`translateY(${i}px)`,t.style.height=`${s}px`,document.documentElement.scrollTop=i})}else(0,r.RK)(()=>{t.style.transform="",t.style.height=""})};return e.addEventListener("resize",i),()=>{e.removeEventListener("resize",i)}},[]),(0,s.vJ)(()=>{H(-1)},[g]),(0,s.Nf)(()=>{u.pz&&Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==V.current)})},[e]),(0,s.vJ)(()=>{e?(X(!1),clearTimeout(ee.current)):(V.current.blur(),re(!0),H(0),j(""),ee.current=window.setTimeout(()=>X(!0),200))},[e]),(0,s.vJ)(()=>{d&&t?.id&&(j(d),w({chatId:t.id,threadId:a,update:{requestedQuery:void 0}}),ce(!0),(0,r.Uz)(()=>{const e=V.current;e&&((0,Ii.A)(e,!0,!0),ne())}))},[t?.id,d,a]),(0,fi.A)(([t])=>{e!==t&&!G&&g&&j(g)},[e,g,G]),(0,fi.A)(([t])=>{e&&t!==f&&(f?(Ce(),ae()):be())},[f,e]);const Se=(0,M.A)(()=>{G?.length||p?(j(""),ce(!1),I(),be()):fe()});(0,s.vJ)(()=>e?(0,m.A)(Se):void 0,[e,fe]);const ke=(0,s.Kr)(()=>{if(h)return Object.values(h)},[h]),Ne=Boolean(ke?.length),we=Ne&&!b;(0,s.vJ)(()=>{C&&e&&x()},[C,e]);const Ie=(0,M.A)(()=>{const e=t?.id;e&&Fm(()=>{U.current||P({chatId:e,threadId:a,query:G})})}),Pe=(0,M.A)(e=>{if(U.current=!1,e.startsWith("#")&&!S)return w({chatId:t.id,threadId:a,update:{isHashtag:!0}}),j(e.slice(1)),void Ie();j(e),e||(ce(!1),I(),U.current=!0)});(0,s.vJ)(()=>{G&&Ie()},[G]),(0,s.vJ)(()=>{ce(Boolean(y))},[y]),(0,s.vJ)(()=>{A?.length&&A.length-z<5&&Ie()},[z,A?.length]),(0,s.vJ)(()=>{if(e)return te.current=!0,window.addEventListener("touchend",t),window.addEventListener("mouseup",t),window.addEventListener("touchstart",i),window.addEventListener("mousedown",i),()=>{i(),window.removeEventListener("touchstart",i),window.removeEventListener("mousedown",i)};function t(){V.current?.focus(),ne(),(0,Ae.IJ)(()=>{te.current=!1})}function i(){window.removeEventListener("touchend",t),window.removeEventListener("mouseup",t),(0,Ae.IJ)(()=>{te.current=!1})}},[e]),(0,ye.A)({isActive:e,onBack:fe});const[Ye,Fe,De=0]=(0,Ys.A)(Ie,A),Me=(0,s.Kr)(()=>{if(!G&&!p||!Ye?.length)return vi.p;const e=(0,n.mS)();return Ye.map(t=>{const[i,s]=(0,Cc.a)(t),n=(0,c.O5q)(e,i,s);if(!n)return;const a=C||(0,l.DX)(i)||i===o.Ckz?(0,c.Szq)(e,n):void 0,r=(0,c.Y7C)(e,n);return{searchResultKey:t,message:n,messageChat:(0,c.hds)(e,n.chatId),senderPeer:a||r}}).filter(Boolean)},[G,p,Ye,C]),Te=(0,M.A)(e=>{const t=(0,Cc.D)(e),i=A?.indexOf(t)||0;H(i+De),"chat"===k&&re(!1),D({chatId:e.chatId,messageId:e.id,threadId:S?void 0:a}),ae()}),Be=(0,M.A)(()=>{re(e=>!e),ne()}),Le=(0,Ds.A)(_,de,e=>{const t=Me?.[-1===e?0:e];t&&(Te(t.message),H(e+De))},`.${Ym}`,!0),Re=(0,M.A)(e=>{w({chatId:t.id,threadId:a,update:e}),Ie()}),xe=(0,M.A)(e=>{we?R({initialSection:"saved_tags"}):Re({savedTag:e})}),Ee=(0,M.A)(()=>{Re({savedTag:void 0})}),Ve=(0,M.A)(()=>{S?Re({isHashtag:!1}):p&&Ee()}),_e=(0,M.A)(e=>{Re({type:e}),re(!0)}),Ue=(0,M.A)(()=>{if("chat"===k&&(ae(),Ce(),A)){const e=z+1,[t,i]=(0,Cc.a)(A[e]);D({chatId:t,messageId:i,threadId:a}),H(e)}}),Oe=(0,M.A)(()=>{if("chat"===k&&(ae(),Ce(),A)){const e=z-1,[t,i]=(0,Cc.a)(A[e]);D({chatId:t,messageId:i,threadId:a}),H(e)}});function Ke(e,i){const s=!i&&k===e;switch(e){case"chat":return(0,ie.Y)(Er.A,{className:(0,pe.A)(Im.searchType,s&&Im.selectedType),peerId:t?.id,title:K("SearchThisChat"),clickArg:"chat",onClick:i?Ve:_e});case"myChats":return(0,ie.Y)(Er.A,{className:(0,pe.A)(Im.searchType,s&&Im.selectedType),peerId:N,forceShowSelf:!0,title:K("SearchMyMessages"),clickArg:"myChats",onClick:i?Ve:_e});case"channels":return(0,ie.Y)(Er.A,{className:(0,pe.A)(Im.searchType,s&&Im.selectedType),customPeer:Pm,title:K("SearchPublicPosts"),clickArg:"channels",onClick:i?Ve:_e})}}function Je(){return(0,ie.FD)("div",{className:(0,pe.A)(Im.dropdown,!me&&Im.dropdownHidden),children:[!O&&(0,ie.Y)("div",{className:Im.separator}),Ne&&!S&&(0,ie.Y)("div",{className:(0,pe.A)(Im.savedTags,!O&&Im.wrap,"no-scrollbar"),children:ke.map(e=>{const t=(0,l.a0)(e.reaction,p);return(0,ie.Y)(ym.A,{containerId:"local-search",reaction:e.reaction,tag:e,withCount:!0,isDisabled:we,isChosen:t,onClick:t?Ee:xe},(0,l.Jj)(e.reaction))})}),S&&(0,ie.FD)("div",{className:(0,pe.A)(Im.searchTypes,"no-scrollbar"),children:[Ke("chat"),Ke("myChats"),Ke("channels")]}),de&&(0,ie.FD)(vs.A,{ref:_,className:(0,pe.A)(Im.results,"custom-scroll"),items:Me,itemSelector:`.${Ym}`,preloadBackwards:0,onLoadMore:Fe,onKeyDown:Le,children:[ue&&(0,ie.Y)("span",{className:Im.placeholder,children:K("NoResultFoundFor",G)},"nothing"),he&&(0,ie.Y)("span",{className:Im.placeholder,children:K("HashtagSearchPlaceholder")},"enterhash"),Me?.map(({message:e,senderPeer:t,messageChat:i,searchResultKey:s},n)=>(0,ie.Y)(wm,{teactOrderKey:-e.date,className:Ym,query:G,message:e,senderPeer:t,messageChat:i,shouldShowChat:S,isActive:z-De===n,onClick:Te},s))]})]})}return(0,ie.FD)("div",{id:"MiddleSearch",className:(0,pe.A)(Im.root,e&&Im.active,!e&&W&&"visually-hidden",se&&Im.focused,O&&Im.mobile),ref:E,children:[(0,ie.FD)("div",{className:Im.header,children:[!O&&(0,ie.Y)(Tt.A,{className:Im.avatar,peer:i||t,size:"medium",isSavedMessages:C}),(0,ie.FD)(As.A,{ref:V,value:G,className:(0,pe.A)(Im.input,me&&Im.withDropdown,me&&!O&&Im.adaptSearchBorders),canClose:!O,isLoading:le,resultsItemSelector:`.${Im.results} .${Ym}`,hasUpButton:ge&&!O,hasDownButton:ge&&!O,placeholder:K(S?"SearchHashtagsHint":"Search"),teactExperimentControlled:!0,onChange:Pe,onStartBackspace:Ve,onReset:Se,withBackIcon:O,onFocus:ne,focused:se,onUpClick:q?Ue:void 0,onDownClick:$?Oe:void 0,children:[(0,ie.FD)("div",{className:Im.searchTags,children:[p&&(0,ie.Y)(ym.A,{containerId:"local-search-tags",className:Im.savedSearchTag,reaction:p,tag:h[(0,l.Jj)(p)],onClick:Ee}),S&&(0,ie.Y)("div",{className:Im.hash,children:"#"})]}),!O&&Je()]}),!O&&(0,ie.Y)("div",{className:Im.icons,children:(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>L({selectedAt:(0,$e.CS)(Date.now())}),ariaLabel:K("JumpToDate"),children:(0,ie.Y)(Q.A,{name:"calendar"})})})]}),O&&Je(),O&&(0,ie.FD)("div",{className:Im.footer,children:[(0,ie.Y)(Z.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>L({selectedAt:(0,$e.CS)(Date.now())}),ariaLabel:K("JumpToDate"),children:(0,ie.Y)(Q.A,{name:"calendar"})}),(0,ie.Y)("div",{className:Im.counter,children:ve&&(A?.length?K("Of",[Math.max(z+1,1),v]):A&&!A.length&&K("NoResult"))}),"chat"===k&&Boolean(A?.length)&&(0,ie.Y)(Z.A,{className:Im.viewStyle,size:"smaller",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:Be,children:K(oe?"SearchAsChat":"SearchAsList")}),ge&&!me&&(0,ie.FD)("div",{className:Im.mobileNavigation,children:[(0,ie.Y)(Z.A,{className:(0,pe.A)(Im.navigationButton,!q&&Im.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Ue,nonInteractive:!q,ariaLabel:J("AriaSearchOlderResult"),children:(0,ie.Y)(Q.A,{name:"up"})}),(0,ie.Y)(Z.A,{className:(0,pe.A)(Im.navigationButton,!$&&Im.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Oe,nonInteractive:!$,ariaLabel:J("AriaSearchNewerResult"),children:(0,ie.Y)(Q.A,{name:"down"})})]})]})]})}));var Mm=i(80539),Tm=i(58734),Bm=i(73172);const Lm=2.5*g.$,Rm=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{setsById:i,added:s,recent:n,favorite:a,effect:o}=e.stickers,r=(0,c.nZ4)(e,t),l=(0,c.hds)(e,t),d=(0,v.L8)(t)?void 0:(0,c.AWZ)(e,t)?.stickerSet?.id;return{chat:l,effectStickers:o?.stickers,effectEmojis:o?.emojis,recentStickers:n.stickers,favoriteStickers:a.stickers,stickerSetsById:i,addedSetIds:s.setIds,canAnimate:(0,c.ML4)(e),isSavedMessages:r,isCurrentUserPremium:(0,c.g29)(e),chatStickerSetId:d}})(({chat:e,threadId:t,className:i,isHidden:a,isTranslucent:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:h,effectStickers:m,effectEmojis:p,addedSetIds:v,stickerSetsById:g,chatStickerSetId:A,canAnimate:f,isSavedMessages:b,isCurrentUserPremium:C,noContextMenus:y,idPrefix:S,onStickerSelect:k,isForEffects:N})=>{const{loadRecentStickers:w,addRecentSticker:I,unfaveSticker:P,faveSticker:Y,removeRecentSticker:F}=(0,n.ko)(),D=(0,s.li)(),B=(0,s.li)(),L=(0,s.li)(),{handleScroll:R,isAtBeginning:x}=(0,ps.A)(),E=(0,Bm.A)(e?.id,t),V=`${S}-sticker-set`,{activeSetIndex:_,observeIntersectionForSet:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,observeIntersectionForCovers:J,selectStickerSet:G}=rr(D,B,V,a),j=(0,T.A)(),z=Boolean(v),H=(0,s.Kr)(()=>{if(N&&m){const e=[];return p?.length&&e.push({id:o.hfH,accessHash:"0",title:"",stickers:p,count:p.length,isEmoji:!0}),m?.length&&e.push({id:o.Kp3,accessHash:"0",title:j("StickerEffects"),stickers:m,count:m.length}),e}if(!v)return vi.p;const e=[];h.length&&e.push({id:o.tRH,accessHash:"0",title:j("FavoriteStickers"),stickers:h,count:h.length}),d.length&&e.push({id:o.sR2,accessHash:"0",title:j("RecentStickers"),stickers:d,count:d.length});const t=[...v||[]];A&&t.unshift(A);const i=Object.values((0,pi._E)(g,t));return[...e,...i]},[v,g,h,d,A,j,m,N,p]),$=(0,s.Kr)(()=>z&&0===H.filter(e=>e.stickers?.length).length,[H,z]);(0,s.vJ)(()=>{l&&(w(),c&&E({type:"chooseSticker"}))},[c,l,w,E]);const q=(0,ir.A)([],o.jhd),W=z&&q&&!$&&(c||N);(0,yn.A)(B,!W||!B.current),(0,s.vJ)(()=>{if(!z)return;const e=B.current;if(!e)return;const t=_*Lm-(e.offsetWidth/2-Lm/2);(0,ga.A)(e,t)},[z,_]);const X=(0,M.A)((e,t,i)=>{k(e,t,i,!0),I({sticker:e})}),ee=(0,M.A)(e=>{P({sticker:e})}),te=(0,M.A)(e=>{Y({sticker:e})}),se=(0,M.A)(()=>{c&&E({type:"chooseSticker"})}),ne=(0,M.A)(e=>{F({sticker:e})});if(!e)return;const oe=(0,pe.A)("lq8BD6Hc",i),re=(0,pe.A)(Pr,"no-scrollbar",!x&&Yr),le=!W&&(c||N)&&!$;return(0,ie.Y)(ae.Ay,{className:oe,activeKey:le?0:1,name:"fade",shouldCleanup:!0,children:W?(0,ie.FD)(ie.FK,{children:[!N&&(0,ie.Y)("div",{ref:B,className:re,children:(0,ie.FD)("div",{className:"shared-canvas-container",children:[(0,ie.Y)("canvas",{ref:L,className:"shared-canvas"}),H.map(function(t,i){const s=t.stickers?.[0],n=(0,pe.A)(Fr,i===_&&"y02WwQk6"),a=i<o.j41;return t.id===o.sR2||t.id===o.tRH||t.id===o.eKB||t.hasThumbnail||!s?(0,ie.Y)(Z.A,{className:n,ariaLabel:t.title,round:!0,faded:t.id===o.sR2||t.id===o.tRH,color:"translucent",onClick:()=>G(i),children:t.id===o.sR2?(0,ie.Y)(Q.A,{name:"recent"}):t.id===o.tRH?(0,ie.Y)(Q.A,{name:"favorite"}):t.id===o.eKB?(0,ie.Y)(Tt.A,{peer:e,size:"small"}):(0,ie.Y)(ur,{stickerSet:t,noPlay:!f||!l,observeIntersection:J,sharedCanvasRef:a?L:void 0,forcePlayback:!0})},t.id):(0,ie.Y)(gr,{sticker:s,size:o.TBj,title:t.title,className:n,noPlay:!f||!l,observeIntersection:J,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?L:void 0,withTranslucentThumb:r,onClick:G,clickArg:i,forcePlayback:!0},t.id)})]})}),(0,ie.Y)("div",{ref:D,onMouseMove:se,onScroll:R,className:(0,pe.A)(wr,u.TF?"no-scrollbar":"custom-scroll",!N&&Ir),children:H.map((e,t)=>(0,ie.Y)(kr,{stickerSet:e,loadAndPlay:Boolean(f&&l),noContextMenus:y,index:t,idPrefix:V,observeIntersection:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,isNearActive:_>=t-1&&_<=t+1,favoriteStickers:h,isSavedMessages:b,isCurrentUserPremium:C,isTranslucent:r,isChatStickerSet:e.id===A,onStickerSelect:X,onStickerUnfave:ee,onStickerFave:te,onStickerRemoveRecent:ne,forcePlayback:!0,shouldHideHeader:e.id===o.hfH},e.id))})]}):c||N?$?(0,ie.Y)("div",{className:Dr,children:j("NoStickers")}):(0,ie.Y)(Ms.A,{}):(0,ie.Y)("div",{className:Dr,children:j("ErrorSendRestrictedStickersAll")})})})),xm=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{availableReactions:i,topReactions:s}=e.reactions,{maxUniqueReactions:n}=e.appConfig,{enabledReactions:a,isPaidReactionAvailable:o}=(0,c.AWZ)(e,t)||{};return{enabledReactions:a,availableReactions:i,topReactions:s,reactionsLimit:n,isWithPaidReaction:o}})(({loadAndPlay:e,enabledReactions:t,availableReactions:i,topReactions:n,selectedReactionIds:a,isWithPaidReaction:o,message:r,reactionsLimit:c,onReactionSelect:d,onReactionContext:h})=>{const u=(0,s.li)(),m=(0,s.li)(),{width:p}=(0,we.A)(),{isTouchScreen:v}=(0,Y.Ay)(),A=r?.reactions?.results,f=c&&A&&A.length>=c,b=(0,s.Kr)(()=>{if(f){const e=A.map(({reaction:e})=>e);return o&&e.unshift({type:"paid"}),e}if(!t)return[];if("all"===t.type){const e=(i||[]).map(({reaction:e})=>e);return o&&e.unshift({type:"paid"}),(0,l.fu)(e,n)}const e=t.allowed.slice();return o&&e.unshift({type:"paid"}),(0,l.fu)(e,n)},[i,t,n,f,A,o]),C=(0,s.Kr)(()=>{const e=Math.min(26.25*g.$,p),t=(p>600?.625:.5)*g.$,i=e-.5*g.$,s=Math.floor((i+t)/(36+t)),n=Math.ceil(b.length/s),a=36*n+(n-1)*t+.5*g.$*2;return Math.min(18*g.$,a)},[b.length,p]);return(0,ie.Y)("div",{className:"MhpiTAwi",style:`height: ${C}px`,children:(0,ie.Y)("div",{className:(0,pe.A)("NIaqmosK",v?"no-scrollbar":"custom-scroll"),children:(0,ie.FD)("div",{className:"symbol-set-container shared-canvas-container",children:[(0,ie.Y)("canvas",{ref:u,className:"shared-canvas"}),(0,ie.Y)("canvas",{ref:m,className:"shared-canvas"}),b.map(t=>{const s=(0,l.Jj)(t),n=s?a?.includes(s):void 0;return(0,ie.Y)(yr,{reaction:t,isSelected:n,loadAndPlay:e,availableReactions:i,onClick:d,onContextMenu:h,sharedCanvasRef:u,sharedCanvasHqRef:m},s)})]})})})})),Em=16.375*g.$,Vm=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),i=e.availableEffectById,{chatId:s,messageId:n,storyPeerId:a,storyId:o,position:r,sendAsMessage:l,isForEffects:d}=t.reactionPicker||{},h=a&&o?(0,c.Msb)(e,a,o):void 0,u=s?(0,c.hds)(e,s):void 0,m=s?(0,c.AWZ)(e,s):void 0,p=s&&n?(0,c.O5q)(e,s,n):void 0,g=(0,v.L8)(s||a||""),A="some"===m?.enabledReactions?.type,{maxUniqueReactions:f}=e.appConfig,b="all"===m?.enabledReactions?.type&&m?.enabledReactions?.areCustomAllowed,C=p?.reactions?.results,y=Boolean(f&&C&&C.length>=f);return{message:p,story:h,position:r,shouldUseFullPicker:!(u?.isForbidden||A||y)&&(b||g),isTranslucent:(0,c.cwE)(e),isCurrentUserPremium:(0,c.g29)(e),sendAsMessage:l,isForEffects:d,chatId:s,availableEffectById:i}})(({isOpen:e,message:t,story:i,position:a,isTranslucent:o,isCurrentUserPremium:r,shouldUseFullPicker:c,sendAsMessage:d,chatId:h,isForEffects:u,availableEffectById:m})=>{const{toggleReaction:p,closeReactionPicker:v,sendMessage:g,showNotification:A,sendStoryReaction:f,saveEffectInDraft:b,requestEffectInComposer:C,addLocalPaidReaction:y,openPaidReactionModal:S}=(0,n.ko)(),k=(0,T.A)(),N=(0,Yi.A)(t?.id,!0),w=(0,Yi.A)(t?.chatId,!0),I=(0,Yi.A)(i?.peerId,!0),P=(0,Yi.A)(i?.id),F=(0,Yi.A)(a,!0),D=(0,s.li)(),B=(0,s.Kr)(()=>{if(F)return P?F:{x:F.x+(c?-23:-21),y:F.y+(c?-64:-10)}},[P,F,c]),L=(0,M.A)(()=>D.current),R=(0,M.A)(()=>({withPortal:!0,isDense:!I,deltaX:!(0,Y.Ny)()&&D.current?-(D.current.offsetWidth-Em)/2- -11.5:0})),x=(0,M.A)(e=>{if(!w||!N)return;const t=e.isCustomEmoji?{type:"custom",documentId:e.id}:{type:"emoji",emoticon:e.emoji};p({chatId:w,messageId:N,reaction:t,shouldAddToRecent:!0}),v()}),E=(0,M.A)(e=>{w&&N&&("paid"===e.type?y({chatId:w,messageId:N,count:1}):p({chatId:w,messageId:N,reaction:e,shouldAddToRecent:!0}),v())}),V=(0,M.A)(e=>{"paid"===e.type&&(S({chatId:w,messageId:N}),v())}),_=(0,M.A)(e=>{if("type"in e&&"paid"===e.type)return;const t="id"in e?{type:"custom",documentId:e.id}:e,i="type"in e&&"custom"===e.type?(0,n.mS)().customEmojis.byId[e.documentId]:"id"in e?e:void 0;if(i&&!i.isFree&&!r)return A({message:k("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:k("PremiumMore")}),void v();if(!d)return f({peerId:I,storyId:P,containerId:(0,l.$_)(I,P),reaction:t,shouldAddToRecent:!0}),void v();let s,a;if("type"in e&&"emoji"===e.type)s=e.emoticon;else{const e=(0,Mm.Ay)((0,Tm.hB)(i));s=e.text,a=e.entities}g({text:s,entities:a,isReaction:!0}),v()}),U=(0,M.A)(e=>{const t=Object.values(m),i=t.find(t=>t.effectStickerId===e.id)?.id;h&&b({chatId:h,threadId:K.l3,effectId:i}),i&&C({}),v()}),O=(0,s.Kr)(()=>(t?.reactions?.results||[]).reduce((e,{chosenOrder:t,reaction:i})=>(void 0!==t&&e.push((0,l.Jj)(i)),e),[]),[t?.reactions?.results]);return(0,ie.Y)(We.A,{isOpen:e,ref:D,className:(0,pe.A)("gBh4WvBC","ReactionPicker"),bubbleClassName:(0,pe.A)("qSfKwMzX",!c&&!P&&"dRNSqkOC",P&&"srpBMrqr"),withPortal:!0,noCompact:!0,anchor:B,positionY:i&&"bottom",getTriggerElement:_m,getRootElement:Um,getMenuElement:L,getLayout:R,backdropExcludedSelector:".Modal.confirm",onClose:v,children:u&&h?(0,ie.Y)(Rm,{className:"",isHidden:!e,loadAndPlay:Boolean(e&&c),idPrefix:"message-effect",canSendStickers:!1,noContextMenus:!1,chatId:h,isTranslucent:o,onStickerSelect:U,isForEffects:u}):(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(Lr,{chatId:w,idPrefix:"message-emoji-set-",isHidden:!e||!(c||P),loadAndPlay:Boolean(e&&c),isReactionPicker:!0,className:c||P?void 0:"KVwgF6DG",selectedReactionIds:O,isTranslucent:o,onCustomEmojiSelect:P?_:x,onReactionSelect:P?_:E,onReactionContext:V}),!c&&Boolean(w)&&(0,ie.Y)(xm,{chatId:w,loadAndPlay:e,onReactionSelect:P?_:E,onReactionContext:V,selectedReactionIds:O,message:t})]})})}));function _m(){return document.querySelector("body")}function Um(){return document.querySelector("body")}var Om=i(39074),Km=i(45761);const Jm=document.createElement("div");var Gm=i(41316),jm=i(3225),zm=i(25498),Hm=i(9442),$m=i(91525),qm=i(52988),Wm=i(27860);const Qm="SHoF85Vw",Zm="Zo7u5epf",Xm=15*g.$,ep=(0,s.ph)(({attachment:e,className:t,isSingle:i,shouldDisplayCompressed:n,shouldDisplayGrouped:a,index:r,onDelete:l,onToggleSpoiler:c})=>{const d=function(e,t){if(t&&e.quick){if(o.gex.has(e.mimeType))return"photo";if(o.fNs.has(e.mimeType))return"video"}return"file"}(e,n),h=(0,M.A)(()=>{c?.(r)}),u=(0,s.Kr)(()=>{switch(d){case"photo":return(0,ie.Y)("img",{className:Qm,src:e.blobUrl,alt:"",draggable:!1});case"video":return(0,ie.FD)(ie.FK,{children:[Boolean(e.quick?.duration)&&(0,ie.Y)("div",{className:"nI2M1SBH",children:(0,$e.QO)(e.quick.duration)}),(0,ie.Y)("video",{className:Qm,src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})]});default:return(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(qm.A,{className:"B6f6GcvN",name:e.filename,extension:(0,$m.QC)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}),l&&(0,ie.Y)(Q.A,{name:"delete",className:(0,pe.A)(Zm,"CYJwy9T_"),onClick:()=>l(r)})]})}},[e,d,r,l]),m="file"===d||!a,p=Boolean("file"!==d&&e.shouldSendAsSpoiler),v="file"!==d,g=(0,pe.A)(t,"QucaiGVU",i&&"FjrnqGba",m&&"g0cTsM9d");return(0,ie.FD)("div",{className:g,children:[u,(0,ie.Y)(Wm.A,{isVisible:p,thumbDataUri:e.previewBlobUrl||e.blobUrl,width:Xm,height:Xm}),v&&(0,ie.FD)("div",{className:"bX7LdgxW",children:[(0,ie.Y)(Q.A,{name:e.shouldSendAsSpoiler?"spoiler-disable":"spoiler",className:Zm,onClick:h}),l&&(0,ie.Y)(Q.A,{name:"delete",className:Zm,onClick:()=>l(r)})]})]})});var tp=i(25897),ip=i(6070),sp=i(49068);function np(e,t,i=!1){const s=e[i?"scrollLeft":"scrollTop"],n=s+e[i?"offsetWidth":"offsetHeight"],a=t[i?"offsetLeft":"offsetTop"],o=a+t[i?"offsetWidth":"offsetHeight"];return a>s&&o<n}function ap(e,t,i=0,s=!1,n=!1,a=!1){const o=e[a?"scrollLeft":"scrollTop"],r=o+e[a?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let h=!1;for(let e=0;e<c;e++){const t=l[e],c=t[a?"offsetLeft":"offsetTop"],u=c+t[a?"offsetWidth":"offsetHeight"];if(n?u>=o-i&&u<=r+i:c<=r+i&&u>=o-i)d.push(e),h=!0;else if(h&&!s)break}return{allElements:l,visibleIndexes:d}}function op(e,t,i){const s=i.current;if(!s||t<0)return;const{visibleIndexes:n,allElements:a}=ap(s,e,8,!0,!0);if(!a.length||!a[t])return;const o=n[0];if(!n.includes(t)||t===o&&!np(s,a[o])){const e=t>n[n.length-1]?"start":"end";(0,sr.Ay)({container:s,element:a[t],position:e,margin:10})}}function rp({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:i,shouldRemoveSelectionOnReset:n,noArrowNavigation:a,items:o,shouldSelectOnTab:r,onSelect:l,onClose:c}){const[d,h]=(0,s.J0)(-1),u=(0,M.A)(e=>o?(0,wa.A)(o.length,e):-1),m=(0,M.A)((e,t)=>{t.preventDefault(),h(t=>u(t+e))}),p=(0,M.A)(t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return!1;if(!e)return!1;if(o&&o.length&&d>-1){const e=o[d];if(e){if(!1===l(e))return!1;t.preventDefault()}}return!0});(0,s.vJ)(()=>{e||h(n?-1:0)},[e,n]);const v=!o||d>o.length-1;return(0,s.vJ)(()=>{i&&!v||h(n?-1:0)},[v,n,i]),(0,s.vJ)(()=>e?(0,Fi.A)({onEsc:c,onUp:a||t?void 0:e=>m(-1,e),onDown:a||t?void 0:e=>m(1,e),onLeft:a||!t?void 0:e=>m(-1,e),onRight:a||!t?void 0:e=>m(1,e),onTab:r?p:void 0,onEnter:p}):void 0,[a,m,p,e,t,c,r]),d}const lp=(0,s.ph)(({isOpen:e,onClose:t,onInsertUserName:i,filteredUsers:a})=>{const o=(0,s.li)(),{shouldRender:r,transitionClassNames:l}=(0,Je.A)(e,void 0,void 0,!1),c=(0,M.A)((e,t=!1)=>{const s=(0,n.mS)().users.byId[e];s&&i(s,t)}),d=(0,M.A)((e,t)=>{e.preventDefault(),c(t)}),h=(0,M.A)(e=>{c(e.id,!0)}),u=rp({isActive:e,items:a,onSelect:h,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,s.vJ)(()=>{op(".chat-item-clickable",u,o)},[u]),(0,s.vJ)(()=>{a&&!a.length&&t()},[a,t]);const m=(0,U.A)(a?.length?a:void 0,r),p=a&&!a.length?m:a;if(!r||p&&!p.length)return;const v=(0,pe.A)("MentionTooltip composer-tooltip custom-scroll",l);return(0,ie.Y)("div",{className:v,ref:o,children:p?.map(({id:e},t)=>(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item smaller-icon",onClick:d,clickArg:e,focus:u===t,children:(0,ie.Y)(bs.A,{userId:e,avatarSize:"small",withUsername:!0})},e))})});var cp=i(78407),dp=i(26440);const hp="AT_d9l0W",up="AnO3BgVv",mp="caption-input-text",pp=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{currentUserId:i,recentEmojis:s,customEmojis:n,attachmentSettings:a}=e,{shouldSaveAttachmentsCompression:r}=(0,c.nTw)(e),l=(0,c.AWZ)(e,t),d=(0,c.nZ4)(e,t),{shouldSuggestCustomEmoji:h}=e.settings.byKey,{language:u}=(0,un.l)(e),m=e.emojiKeywords[o.cUY],p=u!==o.cUY?e.emojiKeywords[u]:void 0;return{isChatWithSelf:d,currentUserId:i,groupChatMembers:l?.members,recentEmojis:s,baseEmojiKeywords:m?.keywords,emojiKeywords:p?.keywords,shouldSuggestCustomEmoji:h,customEmojiForEmoji:n.forEmoji.stickers,captionLimit:(0,la.d)(e,"captionLength"),attachmentSettings:a,shouldSaveAttachmentsCompression:r}})(({chatId:e,threadId:t,attachments:i,getHtml:a,editingMessage:c,canShowCustomSendMenu:d,captionLimit:h,isReady:u,isChatWithSelf:p,currentUserId:v,groupChatMembers:g,recentEmojis:A,baseEmojiKeywords:f,emojiKeywords:b,isForMessage:C,shouldSchedule:y,shouldSuggestCustomEmoji:S,customEmojiForEmoji:k,attachmentSettings:N,shouldSaveAttachmentsCompression:w,shouldForceCompression:I,shouldForceAsFile:P,isForCurrentMessageList:D,forceDarkTheme:B,onAttachmentsUpdate:L,onCaptionUpdate:R,onSend:x,onFileAppend:E,onClear:V,onSendSilent:_,onSendScheduled:O,onCustomEmojiSelect:K,onRemoveSymbol:J,onEmojiSelect:j,canScheduleUntilOnline:z,canSchedule:H,onSendWhenOnline:$,paidMessagesStars:q})=>{const W=(0,s.li)(),X=(0,s.li)(),{addRecentCustomEmoji:te,addRecentEmoji:se,updateAttachmentSettings:ne}=(0,n.ko)(),ae=(0,T.A)(),oe=(0,Ri.A)(),re=(0,s.li)(),le=(0,s.li)(),ce=(0,s.li)(),ue=(0,U.A)(i),me=i.length?i:ue,{isMobile:ve}=(0,Y.Ay)(),ge=c&&Boolean(c),Ae=c&&c?.groupedId,fe="file"!==(ge&&i?.length&&(0,l.ES)(i[0])),[be,ye,ke]=(0,F.A)(),Ne=N.shouldCompress,we=Boolean((Ne||I||Ae)&&!P),[Ie,Pe]=(0,s.J0)(N.shouldSendGrouped),Ye=N.isInvertedMedia,[Fe,De]=(0,s.J0)(N.shouldSendInHighQuality),[Me,Te]=(0,s.J0)(Fe),{handleScroll:Be,isAtBeginning:Le,isAtEnd:Re}=(0,ps.A)(),{handleScroll:xe,isAtBeginning:Ee}=(0,ps.A)(),Ve=Boolean(i.length),_e=Boolean(me?.length),[Ue,Oe,Ke]=(0,F.A)(),Je=(0,s.li)();(0,s.vJ)(()=>{Ve||(ke(),ne({isInvertedMedia:void 0}))},[ke,Ve]);const[Ge,je]=(0,s.Kr)(()=>Boolean(me?.every(e=>e.quick||e.audio))?[!0,!0]:[Boolean(me?.some(e=>e.quick||e.audio)),!1],[me]),[ze,He]=(0,s.Kr)(()=>Boolean(me?.every(e=>e.shouldSendAsSpoiler))?[!0,!0]:[Boolean(me?.some(e=>e.shouldSendAsSpoiler)),!1],[me]),$e=(0,Gm.A)(`#${o.e0F}`),{isEmojiTooltipOpen:qe,filteredEmojis:We,filteredCustomEmojis:Qe,insertEmoji:Ze,closeEmojiTooltip:Xe}=(0,zm.A)(Boolean(u&&(D||!C)&&_e),a,R,o.e0F,A,f,b),{isCustomEmojiTooltipOpen:et,insertCustomEmoji:tt,closeCustomEmojiTooltip:it}=(0,jm.A)(Boolean(u&&(D||!C)&&_e&&S),a,R,$e,le,k),{isMentionTooltipOpen:st,closeMentionTooltip:nt,insertMention:at,mentionFilteredUsers:ot}=(0,Hm.A)(Boolean(u&&D&&_e),a,R,$e,le,g,void 0,v);function rt(e){ne({isInvertedMedia:e})}(0,s.vJ)(()=>Ve?(0,m.A)(V):void 0,[Ve,V]),(0,s.vJ)(()=>{Ve&&(Pe(N.shouldSendGrouped),De(N.shouldSendInHighQuality))},[N,Ve]),(0,s.vJ)(()=>{Ve||ne({isInvertedMedia:void 0})},[ne,Ve]),(0,s.vJ)(()=>{Ve&&ve&&(0,Om.DY)()},[ve,Ve]);const{isContextMenuOpen:lt,handleContextMenu:ct,handleContextMenuClose:dt,handleContextMenuHide:ht}=(0,vn.A)(re,!d||!Ve),ut=(0,M.A)((e,t)=>{Ve&&(((y||t)&&C&&!c?O:e?_:x)(we,Ie,Ye),ne({...w&&{defaultAttachmentCompression:N.shouldCompress?"compress":"original"},shouldSendGrouped:Ie,isInvertedMedia:Ye,shouldSendInHighQuality:Fe}))}),mt=(0,M.A)(()=>{ut(!0)}),pt=(0,M.A)(()=>{ut()}),vt=(0,M.A)(()=>{ut(!1,!0)}),gt=(0,M.A)(async e=>{e.preventDefault(),Ke();const{dataTransfer:t}=e,i=await(0,Km.A)(t.items);i?.length&&E(i,He)}),At=(0,M.A)(e=>{const{files:t}=e.target,i=(0,G.kc)(t);i?.length&&E(i,He)}),ft=(0,M.A)(()=>{(0,Vh.p)("*",e=>At(e))}),bt=(0,M.A)(e=>{L(i.filter((t,i)=>i!==e))}),Ct=(0,M.A)(()=>{L(i.map(e=>({...e,shouldSendAsSpoiler:!0})))}),yt=(0,M.A)(()=>{ne({shouldCompress:!Ne})}),St=(0,M.A)(()=>{const e=!Fe;De(e),ne({shouldSendInHighQuality:e})}),kt=(0,M.A)(()=>{L(i.map(e=>({...e,shouldSendAsSpoiler:void 0})))}),Nt=(0,M.A)(e=>{L(i.map((t,i)=>i===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t))}),wt=(0,M.A)(()=>{const e=X.current;if(!e)return;const{width:t,height:i}=e.getBoundingClientRect();e.viewBox.baseVal.width=t,e.viewBox.baseVal.height=i});(0,Ar.A)(W,wt),(0,Se.A)(wt),(0,s.vJ)(()=>{const e=re.current,t=document.getElementById(mp);if(!e||!t)return;const{width:i}=e.getBoundingClientRect();(0,r.RK)(()=>{t.style.setProperty("--margin-for-scrollbar",`${i}px`)})},[ae,Ve]);const It=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ie.Y)(Z.A,{round:!0,ripple:!ve,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ie.Y)(Q.A,{name:"more"})}),[ve]),Pt=(0,Ce.A)(()=>{if(!_e)return;const e=h-(t=a(),Jm.innerHTML=t,(0,Mm.g4)(Jm),Jm.querySelectorAll("br").forEach(e=>{e.replaceWith("\n")}),Jm.textContent?.trim().length||0);var t;return e<=100?e:void 0},[h,a,_e]),Yt=we&&je,[Ft,Dt,Mt,Tt]=(0,s.Kr)(()=>Yt&&me?[me.every(e=>o.gex.has(e.mimeType)),me.every(e=>o.fNs.has(e.mimeType)),me.every(e=>o.IH3.has(e.mimeType)),me.some(e=>o.gex.has(e.mimeType))]:[!1,!1,!1],[me,Yt]),Bt=(0,s.Kr)(()=>!!me&&me.some(e=>!o.IH3.has(e.mimeType)),[me]);if((0,s.vJ)(()=>{if(Fe!==Me)return Je.current&&clearTimeout(Je.current),Je.current=window.setTimeout(()=>{Te(Fe)},200),()=>{Je.current&&(clearTimeout(Je.current),Je.current=void 0)}},[Fe,Me]),!me)return;const Lt=me.length>1,Rt=!(ge||!Ge||!(P||I||we)||Lt&&Ie);let xt="";const Et=me.length;xt=ae(Ft?ge?"EditMessageReplacePhoto":"PreviewSender.SendPhoto":Dt?ge?"EditMessageReplaceVideo":"PreviewSender.SendVideo":Mt?ge?"EditMessageReplaceAudio":"PreviewSender.SendAudio":ge?"EditMessageReplaceFile":"PreviewSender.SendFile",Et,"i");const Vt=!Re||!Ee,_t=q?(0,Mi.U2)(oe,Et*q,{className:"C1OOt81o",asFont:!0}):ae("Send");return(0,ie.Y)(ee.A,{isOpen:Ve,header:function(){if(me)return(0,ie.FD)("div",{className:"modal-header-condensed",dir:oe.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:V,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:xt}),fe&&!Ae&&(0,ie.FD)(de.A,{className:"with-menu-transitions",trigger:It,positionX:"right",children:[Boolean(!c)&&(0,ie.Y)(he.A,{icon:"add",onClick:ft,children:ae("Add")}),Ge&&(0,ie.FD)(ie.FK,{children:[Rt&&(Ye?(0,ie.Y)(he.A,{icon:"move-caption-down",onClick:()=>rt(void 0),children:oe("ContextMoveTextDown")}):(0,ie.Y)(he.A,{icon:"move-caption-up",onClick:()=>rt(!0),children:oe("ContextMoveTextUp")})),!P&&!I&&(we?(0,ie.Y)(he.A,{icon:"document",onClick:yt,children:ae(Lt?"Attachment.SendAsFiles":"Attachment.SendAsFile")}):(0,ie.Y)(he.A,{icon:"photo",onClick:yt,children:Lt?"Send All as Media":"Send as Media"})),we&&!c&&Tt&&(0,ie.Y)(he.A,{icon:Me?"sd-photo":"hd-photo",onClick:St,children:oe(Me?"SendInStandardQuality":"SendInHighQuality")}),we&&Bt&&Boolean(!c)&&(ze?(0,ie.Y)(he.A,{icon:"spoiler-disable",onClick:kt,children:ae("Attachment.DisableSpoiler")}):(0,ie.Y)(he.A,{icon:"spoiler",onClick:Ct,children:ae("Attachment.EnableSpoiler")}))]}),Lt&&(Ie?(0,ie.Y)(he.A,{icon:"grouped-disable",onClick:()=>Pe(!1),children:"Ungroup All Media"}):(0,ie.Y)(he.A,{icon:"grouped",onClick:()=>Pe(!0),children:"Group All Media"}))]})]})}(),className:(0,pe.A)("a27O2Qlr",Ue&&up,!Le&&"Pc1k8G8s",ve&&"khvUZbGZ",be&&"ir5kkMy1",B&&"component-theme-dark"),hasAbsoluteCloseButton:Boolean(me),noBackdropClose:!0,isLowStackPriority:!0,onClose:V,children:(0,ie.FD)("div",{className:hp,onDragEnter:Oe,onDrop:gt,onDragOver:function(e){e.preventDefault(),ce.current&&(window.clearTimeout(ce.current),ce.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:i}=e;i.matches(`.${hp}`)&&!t&&(ce.current=window.setTimeout(Ke,150)),i&&i.closest(`.${up}`)||(t&&e.stopPropagation(),Ke())},onClick:Ke,"data-attach-description":ae("Preview.Dragging.AddItems",10),"data-dropzone":!0,children:[(0,ie.Y)("svg",{className:"d9O65j_I",children:(0,ie.Y)("rect",{className:"jzCBDWMw",x:"0",y:"0",width:"100%",height:"100%",rx:"8"})}),(0,ie.Y)("div",{className:(0,pe.A)("_bxSIFgj","custom-scroll",Vt&&"RPVunBe2"),onScroll:Be,children:me.map((e,t)=>(0,ie.Y)(ep,{attachment:e,shouldDisplayCompressed:we,shouldDisplayGrouped:Ie,isSingle:1===me.length,index:t,onDelete:bt,onToggleSpoiler:Nt},e.uniqueId||t))}),(0,ie.FD)("div",{className:(0,pe.A)("EtmiUn2k",Vt&&"FjjSKMYe"),children:[(0,ie.Y)(lp,{isOpen:st,filteredUsers:ot,onInsertUserName:at,onClose:nt}),(0,ie.Y)(sp.A,{isOpen:qe,emojis:We,customEmojis:Qe,addRecentEmoji:se,addRecentCustomEmoji:te,onEmojiSelect:Ze,onCustomEmojiSelect:Ze,onClose:Xe}),(0,ie.Y)(tp.A,{chatId:e,isOpen:et,addRecentCustomEmoji:te,onCustomEmojiSelect:tt,onClose:it}),(0,ie.FD)("div",{className:"Te7lIfpB",children:[(0,ie.Y)(dp.A,{chatId:e,threadId:t,isMobile:ve,isReady:u,isSymbolMenuOpen:be,openSymbolMenu:ye,closeSymbolMenu:ke,onCustomEmojiSelect:K,onRemoveSymbol:J,onEmojiSelect:j,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:B}),(0,ie.Y)(cp.A,{ref:le,id:mp,chatId:e,threadId:t,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:u,isActive:Ve,getHtml:a,editableInputId:o.e0F,placeholder:ae("AddCaption"),onUpdate:R,onSend:pt,onScroll:xe,canAutoFocus:Boolean(u&&D&&i.length),captionLimit:Pt,shouldSuppressFocus:ve&&be,onSuppressedFocus:ke}),(0,ie.FD)("div",{className:"wDqWK9MD",children:[(0,ie.Y)(Z.A,{ref:re,className:"kNlWmBJI",size:"smaller",onClick:pt,onContextMenu:d?ct:void 0,children:y&&!c?ae("Next"):c?ae("Save"):_t}),d&&(0,ie.Y)(ip.A,{isOpen:lt,canSchedule:H&&C,onSendSilent:p?void 0:mt,onSendSchedule:vt,onClose:dt,onCloseAnimationEnd:ht,isSavedMessages:p,onSendWhenOnline:$,canScheduleUntilOnline:z})]})]})]})]})})})),vp=(0,s.ph)(({isOpen:e,isQuiz:t,shouldBeAnonymous:i,maxOptionsCount:n=12,onSend:a,onClear:o})=>{const l=(0,s.li)(),c=(0,s.li)(),[d,h]=(0,s.J0)(""),[u,p]=(0,s.J0)([""]),[v,g]=(0,s.J0)(!0),[A,f]=(0,s.J0)(!1),[b,C]=(0,s.J0)(t||!1),[y,S]=(0,s.J0)(""),[k,N]=(0,s.J0)(),[w,I]=(0,s.J0)(!1),P=(0,T.A)(),Y=(0,M.A)(e=>{S(e.target.value)}),F=(0,M.A)(t=>{e&&t.current&&t.current.focus()});(0,s.vJ)(()=>e?(0,m.A)(o):void 0,[e,o]),(0,s.vJ)(()=>{e||(h(""),p([""]),g(!0),f(!1),C(t||!1),S(""),N(void 0),I(!1))},[t,e]),(0,s.vJ)(()=>F(l),[F,e]);const D=(0,M.A)((e=[])=>{p([...e,""]),(0,r.Uz)(()=>{const e=c.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),B=(0,M.A)(()=>{if(I(!1),!e)return;const t=b&&(void 0===k||!u[k].trim()),i=u.map((e,t)=>{if(e=e.trim())return{text:{text:e},option:String(t),...t===k&&{correct:!0}}}).filter(Boolean),s=d.trim().substring(0,255);if(!s||i.length<2){if(h(s),i.length){const e=u.map(e=>e.trim().substring(0,100)).filter(Boolean);e.length<2?D(e):p(e)}else D();return void I(!0)}if(t)return void I(!0);const n={summary:{question:{text:s},answers:i,...!v&&{isPublic:!0},...A&&{multipleChoice:!0},...b&&{quiz:!0}}};if(b){const{text:e,entities:t}=y&&(0,Mm.Ay)(y.substring(0,200))||{};n.quiz={correctAnswers:[String(k)],...e&&{solution:e},...t&&{solutionEntities:t}}}a(n)}),L=(0,M.A)((e,t)=>{const i=[...u];i[e]=t,i[i.length-1].trim().length&&i.length<n?D(i):p(i)}),R=(0,M.A)(e=>{const t=[...u];t.splice(e,1),p(t),void 0!==k&&(k===e?N(void 0):e<k&&N(k-1)),(0,r.Uz)(()=>{c.current&&c.current.classList.toggle("overflown",c.current.scrollHeight>320)})}),x=(0,M.A)(e=>{N(Number(e))}),E=(0,M.A)(e=>{g(e.target.checked)}),V=(0,M.A)(e=>{f(e.target.checked)}),_=(0,M.A)(e=>{C(e.target.checked)}),U=(0,M.A)(e=>{13===e.keyCode&&B()}),O=(0,M.A)(e=>{h(e.target.value)}),K=(0,M.A)(()=>{if(w&&!d.trim().length)return P("lng_polls_choose_question")}),J=(0,M.A)(e=>{const t=u.map(e=>e.trim()).filter(e=>e.length);if(w&&t.length<2&&!u[e].trim().length)return P("lng_polls_choose_answers")});function G(){return u.map((e,t)=>(0,ie.FD)("div",{className:"option-wrapper",children:[(0,ie.Y)(X.A,{maxLength:100,label:t!==u.length-1||u.length===n?P("OptionHint"):P("CreatePoll.AddOption"),error:J(t),value:e,onChange:e=>L(t,e.currentTarget.value),onKeyPress:U}),t!==u.length-1&&(0,ie.Y)(Z.A,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:P("Delete"),onClick:()=>R(t),children:(0,ie.Y)(Q.A,{name:"close"})})]}))}return(0,ie.FD)(ee.A,{isOpen:e,onClose:o,header:(0,ie.FD)("div",{className:"modal-header-condensed",children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:o,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:P("NewPoll")}),(0,ie.Y)(Z.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:B,children:P("Create")})]}),className:"PollModal",children:[(0,ie.Y)(X.A,{ref:l,label:P("AskAQuestion"),value:d,error:K(),onChange:O,onKeyPress:U}),(0,ie.Y)("div",{className:"options-divider"}),(0,ie.FD)("div",{className:"options-list custom-scroll",ref:c,children:[(0,ie.Y)("h3",{className:"options-header",children:P("PollOptions")}),w&&function(){const e=u.map(e=>e.trim()).filter(e=>e.length);return b&&(void 0===k||!e[k])&&(0,ie.Y)("p",{className:"poll-error",children:P("lng_polls_choose_correct")})}(),b?(0,ie.Y)(te.A,{name:"correctOption",options:G().map((e,t)=>({value:String(t),label:e,hidden:!u[t].trim()})),selected:String(k),onChange:x}):G()]}),(0,ie.Y)("div",{className:"options-divider"}),(0,ie.FD)("div",{className:"quiz-mode",children:[(0,ie.FD)("div",{className:"dialog-checkbox-group",children:[!i&&(0,ie.Y)(Qs.A,{label:P("PollAnonymous"),checked:v,onChange:E}),(0,ie.Y)(Qs.A,{label:P("PollMultiple"),checked:A,disabled:b,onChange:V}),(0,ie.Y)(Qs.A,{label:P("PollQuiz"),checked:b,disabled:A||void 0!==t,onChange:_})]}),b&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:"options-header",children:P("lng_polls_solution_title")}),(0,ie.Y)(cn.A,{value:y,onChange:Y,noReplaceNewlines:!0}),(0,ie.Y)("div",{className:"note",children:P("CreatePoll.ExplanationInfo")})]})]})]})});var gp=i(14235);const Ap=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{appConfig:i}=e;return{editingMessage:t?.messageId?(0,c.O5q)(e,t.chatId,t.messageId):void 0,maxItemsCount:i.todoItemsMax,maxTitleLength:i.todoTitleLengthMax,maxItemLength:i.todoItemLengthMax}})(({modal:e,maxItemsCount:t,maxTitleLength:i,maxItemLength:a,editingMessage:o,onSend:l,onClear:c})=>{const{editTodo:d,closeTodoListModal:h,appendTodoList:u}=(0,n.ko)(),p=(0,s.li)(),v=(0,s.li)(),[g,A]=(0,s.J0)(""),[f,b]=(0,s.J0)(()=>[{id:(0,gp.t)(),text:""}]),[C,y]=(0,s.J0)(!0),[S,k]=(0,s.J0)(!0),[N,w]=(0,s.J0)(!1),I=(0,Ri.A)(),P=Boolean(e),Y=(0,Yi.A)(e),F=Y?.forNewTask&&!o?.isOutgoing,D=o?.content.todo?.todo,T=(0,s.Kr)(()=>F&&D?D.items.map(e=>({id:e.id,text:e.title.text,isDisabled:!0})):vi.p,[F,D]),B=(0,M.A)(e=>{P&&e.current&&e.current.focus()});(0,s.Nf)(()=>{if(D&&(A(D.title.text),y(D.othersCanAppend??!1),k(D.othersCanComplete??!1),!F)){const e=D.items.map(e=>({id:e.id,text:e.title.text}));e.length<t&&e.push({id:(0,gp.t)(),text:""}),b(e)}},[D,F,t]),(0,s.vJ)(()=>P?(0,m.A)(c):void 0,[P,c]),(0,s.vJ)(()=>{P||(A(""),b([{id:(0,gp.t)(),text:""}]),y(!0),k(!0),w(!1))},[P]),(0,s.vJ)(()=>{P&&(0,r.YS)(()=>{if(Y?.forNewTask){const e=v.current?.querySelectorAll("input"),t=e?.[e.length-1];t?.focus()}else B(p)})},[B,P,Y?.forNewTask]);const L=(0,M.A)(e=>{const t=(0,gp.t)();b([...e,{id:t,text:""}]),(0,r.Uz)(()=>{const e=v.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),R=(0,M.A)(()=>{if(w(!1),!P)return;const e=f.map(e=>{const t=e.text.trim();if(t)return{id:e.id,title:{text:t.substring(0,a)}}}).filter(Boolean),t=g.trim().substring(0,i);if(!t||0===e.length){if(A(t),e.length){const e=f.map(e=>({...e,text:e.text.trim().substring(0,a)})).filter(e=>e.text.length);0===e.length?L([]):b([...e,{id:(0,gp.t)(),text:""}])}else L([]);return void w(!0)}if(F&&o)return u({chatId:o.chatId,messageId:o.id,items:e}),void h();const s={todo:{title:{text:t},items:e,othersCanAppend:C,othersCanComplete:S}};o?d({chatId:o.chatId,todo:s,messageId:o.id}):l(s),h()}),x=(0,M.A)((e,i)=>{const s=[...f];s[e]={...s[e],text:i},s[s.length-1].text.trim().length&&s.length<t?L(s):b(s)}),E=(0,M.A)(e=>{const t=[...f];t.splice(e,1),b(t),(0,r.Uz)(()=>{v.current&&v.current.classList.toggle("overflown",v.current.scrollHeight>320)})}),V=(0,M.A)(e=>{y(e.target.checked)}),_=(0,M.A)(e=>{k(e.target.checked)}),U=(0,M.A)(e=>{"Enter"===e.key&&R()}),O=(0,M.A)(e=>{A(e.target.value)}),K=(0,M.A)(()=>{if(N&&!g.trim().length)return I("ToDoListErrorChooseTitle")}),J=(0,M.A)(e=>{const t=f.map(e=>e.text.trim()).filter(e=>e.length);if(N&&t.length<1&&!f[e].text.trim().length)return I("ToDoListErrorChooseTasks")}),G=t-f.length-(F&&D?D.items.length:0);return(0,ie.FD)(ee.A,{isOpen:P,onClose:c,header:function(){const e=F?"TitleAppendToDoList":o?"TitleEditToDoList":"TitleNewToDoList";return(0,ie.FD)("div",{className:"modal-header-condensed",children:[(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:I("AriaToDoCancel"),onClick:c,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:I(e)}),(0,ie.Y)(Z.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:R,children:I(F?"Add":o?"Save":"Create")})]})}(),className:"ToDoListModal",children:[!F&&(0,ie.Y)(X.A,{ref:p,label:I("InputTitle"),value:g,error:K(),onChange:O,onKeyPress:U}),F&&(0,ie.Y)("div",{className:"readonly-title",children:g}),(0,ie.Y)("div",{className:"options-divider"}),(0,ie.FD)("div",{className:"options-list custom-scroll",ref:v,children:[(0,ie.Y)("h3",{className:"items-header",children:I("TitleToDoList")}),function(){const e=[...T,...f];return e.map((i,s)=>{const n=s-T.length;return(0,ie.FD)("div",{className:"item-wrapper",children:[(0,ie.Y)(X.A,{maxLength:100,label:s!==e.length-1||e.length===t?I("TitleTask"):I("TitleAddTask"),error:J(n),value:i.text,disabled:i.isDisabled,onChange:e=>x(n,e.currentTarget.value),onKeyPress:U}),s!==e.length-1&&!i.isDisabled&&(0,ie.Y)(Z.A,{className:"item-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:I("Delete"),onClick:()=>E(n),children:(0,ie.Y)(Q.A,{name:"close"})})]})})}()]}),(0,ie.Y)("div",{className:"items-count-hint",children:I("HintTodoListTasksCount2",{count:G},{pluralValue:G})}),(0,ie.Y)("div",{className:"options-divider"}),!F&&(0,ie.Y)("div",{className:"options-footer",children:(0,ie.FD)("div",{className:"dialog-checkbox-group",children:[(0,ie.Y)(Qs.A,{label:I("AllowOthersAddTasks"),checked:C,onChange:V}),(0,ie.Y)(Qs.A,{label:I("AllowOthersMarkAsDone"),checked:S,onChange:_})]})})]})}));var fp=i(36680),bp=i(52491);const Cp=(0,s.ph)(({emoji:e,focus:t,onClick:i})=>{const s=(0,M.A)(t=>{t.preventDefault(),i(e.native,e.id)}),n=(0,pe.A)("EmojiButton",t&&"focus"),a=`./img-apple-64/${e.image}.png`,o=bp.On.has(a);return(0,ie.Y)("div",{className:n,onMouseDown:s,title:`:${e.names[0]}:`,children:u.TL?e.native:(0,ie.Y)("img",{src:a,className:o?void 0:"opacity-transition shown",alt:e.native,loading:"lazy","data-path":a,onLoad:o?void 0:bp.P_,draggable:!1})})}),yp=.625*g.$,Sp=.25*g.$,kp=.5*g.$,Np=.5*g.$,wp=(0,s.ph)(({category:e,index:t,allEmojis:i,observeIntersection:n,shouldRender:a,onEmojiSelect:r})=>{const l=(0,s.li)();(0,nr.mv)(l,n);const c=(0,Ei.A)(a),d=(0,T.A)(),{isMobile:h}=(0,Y.Ay)(),u=h?Math.floor((N.A.get().width-Np+yp)/(o.g0Q+yp)):8,m=Math.ceil(e.emojis.length/u)*(o.g0Q+(h?kp:Sp));return(0,ie.FD)("div",{ref:l,id:`emoji-category-${t}`,className:"symbol-set",children:[(0,ie.Y)("div",{className:"symbol-set-header",children:(0,ie.Y)("p",{className:"symbol-set-name",dir:"auto",children:d(e.id===o.sR2?"RecentStickers":`Emoji${t}`)})}),(0,ie.Y)("div",{className:(0,pe.A)("symbol-set-container",c),style:`height: ${m}px;`,dir:d.isRtl?"rtl":void 0,children:a&&e.emojis.map(e=>{const t=i[e];if(!t)return;const s="id"in t?t:t[1];return(0,ie.Y)(Cp,{emoji:s,onClick:r},s.id)})})]},e.id)}),Ip={recent:"recent",people:"smile",nature:"animals",foods:"eats",activity:"sport",places:"car",objects:"lamp",symbols:"language",flags:"flag"},Pp=3.25*g.$,Yp=2.625*g.$,Fp=[];let Dp,Mp,Tp;const Bp=(0,s.ph)((0,n.EK)(e=>(0,pi.Up)(e,["recentEmojis"]))(({className:e,recentEmojis:t,onEmojiSelect:n})=>{const a=(0,s.li)(),r=(0,s.li)(),[l,c]=(0,s.J0)(),[d,h]=(0,s.J0)(),[m,p]=(0,s.J0)(0),{isMobile:v}=(0,Y.Ay)(),{handleScroll:g,isAtBeginning:A}=(0,ps.A)(),{observe:f}=(0,nr.BL)({rootRef:a,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const i=Number(t.replace("emoji-category-",""));Fp[i]=e.isIntersecting});const t=Fp.reduce((e,t,i)=>t&&i<e?i:e,1/0);t!==1/0&&p(t)}),b=(0,ir.A)([],o.vVF),C=d&&b;(0,yn.A)(r,!(v&&C)),(0,s.vJ)(()=>{if(!l)return;const e=r.current;if(!e)return;const t=m*Yp-e.offsetWidth/2+Yp/2;(0,ga.A)(e,t)},[l,m]);const y=(0,T.A)(),S=(0,s.Kr)(()=>{if(!l)return vi.p;const e=[...l];return t?.length&&e.unshift({id:o.sR2,name:y("RecentStickers"),emojis:t}),e},[l,y,t]);(0,s.vJ)(()=>{setTimeout(()=>{const e=()=>{c(Tp.categories),h(Tp.emojis)};Tp?e():async function(){return Dp||(Dp=i.e(996).then(i.t.bind(i,20996,19)),Mp=(await Dp).default,Tp=(0,bp.cp)(Mp)),Dp}().then(e)},200)},[]);const k=(0,M.A)(e=>{p(e);const t=a.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,sr.Ay)({container:a.current,element:t,position:"start",margin:Pp,maxDistance:100})}),N=(0,M.A)((e,t)=>{n(e,t)}),w=(0,pe.A)("EmojiPicker",e),I=(0,pe.A)("EmojiPicker-header",!A&&"with-top-border");return(0,ie.Y)(ae.Ay,{className:w,activeKey:C?1:0,name:"fade",shouldCleanup:!0,children:C?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{ref:r,className:I,dir:y.isRtl?"rtl":void 0,children:S.map(function(e,t){const i=Ip[e.id];return i&&(0,ie.Y)(Z.A,{className:"symbol-set-button "+(t===m?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>k(t),ariaLabel:e.name,children:(0,ie.Y)(Q.A,{name:i})})})}),(0,ie.Y)("div",{ref:a,onScroll:g,className:(0,pe.A)("EmojiPicker-main",u.TF?"no-scrollbar":"custom-scroll"),children:S.map((e,t)=>(0,ie.Y)(wp,{category:e,index:t,allEmojis:d,observeIntersection:f,shouldRender:m>=t-1&&m<=t+1,onEmojiSelect:N}))})]}):(0,ie.Y)(Ms.A,{})})})),Lp=(0,s.ph)(({gif:e,isDisabled:t,className:i,observeIntersection:n,onClick:a,onUnsaveClick:o,isSavedMessages:r})=>{const c=(0,s.li)(),d=(0,T.A)(),h=(0,nr.Vz)(c,n)&&!t,m=!e.hasVideoPreview&&e.thumbnail&&(0,l.sC)(e,"pictogram"),p=(0,H.A)(m,!h),[v]=(0,s.J0)(e.thumbnail?.dataUri&&!p),g=(0,Li.A)(e.thumbnail?.dataUri,!v),A=(0,l.Ct)(e)||(0,l.sC)(e,"full"),f=(0,H.A)(A,!h),b=Boolean(h&&f),{isBuffered:C,bufferingHandlers:y}=(0,Ke.A)(!0),S=h&&!C,k=h&&C,{isContextMenuOpen:N,contextMenuAnchor:w,handleBeforeContextMenu:I,handleContextMenu:P,handleContextMenuClose:Y,handleContextMenuHide:F}=(0,vn.A)(c),D=(0,M.A)(()=>c.current),B=(0,M.A)(()=>c.current.closest(".custom-scroll, .no-scrollbar")),L=(0,M.A)(()=>c.current.querySelector(".gif-context-menu .bubble")),R=(0,M.A)(()=>{!N&&a&&a({...e,blobUrl:f})}),x=(0,M.A)(t=>{t.stopPropagation(),t.preventDefault(),o(e)}),E=(0,M.A)(()=>{o?.(e)}),V=(0,M.A)(()=>{a({...e,blobUrl:f},!0)}),_=(0,M.A)(()=>{a({...e,blobUrl:f},void 0,!0)}),U=(0,M.A)(e=>{(0,mr.u)(e),I(e)});(0,s.vJ)(()=>{t&&Y()},[Y,t]);const O=(0,pe.A)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",a&&"interactive",i);return(0,ie.FD)("div",{ref:c,className:O,onMouseDown:U,onClick:R,onContextMenu:P,children:[!u.TF&&o&&(0,ie.Y)(Z.A,{className:"gif-unsave-button",color:"dark",pill:!0,noFastClick:!0,onClick:x,children:(0,ie.Y)(Q.A,{name:"close",className:"gif-unsave-button-icon"})}),v&&(0,ie.Y)("canvas",{ref:g,className:"thumbnail"}),p&&!k&&(0,ie.Y)("img",{src:p,alt:"",className:"preview",draggable:!1}),b&&(0,ie.Y)(Ki.A,{canPlay:!0,src:f,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none",...y}),S&&(0,ie.Y)(Ve.A,{color:p||v?"white":"black"}),a&&void 0!==w&&(0,ie.FD)(We.A,{isOpen:N,anchor:w,getTriggerElement:D,getRootElement:B,getMenuElement:L,className:"gif-context-menu",autoClose:!0,onClose:Y,onCloseAnimationEnd:F,children:[!r&&(0,ie.Y)(he.A,{onClick:V,icon:"mute",children:d("SendWithoutSound")}),(0,ie.Y)(he.A,{onClick:_,icon:"calendar",children:d(r?"SetReminder":"ScheduleMessage")}),o&&(0,ie.Y)(he.A,{destructive:!0,icon:"delete",onClick:E,children:d("Delete")})]})]})}),Rp=(0,s.ph)((0,n.EK)(e=>{const{chatId:t}=(0,c.Xf0)(e)||{},i=Boolean(t)&&(0,c.nZ4)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:i}})(({className:e,loadAndPlay:t,canSendGifs:i,savedGifs:a,isSavedMessages:r,onGifSelect:l})=>{const{loadSavedGifs:c,saveGif:d}=(0,n.ko)(),h=(0,s.li)(),{observe:m}=(0,nr.BL)({rootRef:h,debounceMs:300});(0,s.vJ)(()=>{t&&c()},[t,c]);const p=(0,M.A)(e=>{d({gif:e,shouldUnsave:!0})}),v=(0,ir.A)([],o.jhd),g=i&&(!v||!a);return(0,ie.Y)(ae.Ay,{ref:h,className:(0,pe.A)("GifPicker",e,u.TF?"no-scrollbar":"custom-scroll"),slideClassName:"GifPickerGrid",activeKey:g?0:1,name:"fade",shouldCleanup:!0,children:i?v&&a&&a.length?a.map(e=>(0,ie.Y)(Lp,{gif:e,observeIntersection:m,isDisabled:!t,onClick:i?l:void 0,onUnsaveClick:p,isSavedMessages:r},e.id)):v&&a?(0,ie.Y)("div",{className:"picker-disabled",children:"No saved GIFs."}):(0,ie.Y)(Ms.A,{color:"yellow"}):(0,ie.Y)("div",{className:"picker-disabled",children:"Sending GIFs is not allowed in this chat."})})}));let xp=function(e){return e[e.Emoji=0]="Emoji",e[e.CustomEmoji=1]="CustomEmoji",e[e.Stickers=2]="Stickers",e[e.GIFs=3]="GIFs",e}({});const Ep={[xp.Emoji]:"Emoji",[xp.CustomEmoji]:"StickersList.EmojiItem",[xp.Stickers]:"AccDescrStickers",[xp.GIFs]:"GifsTab"},Vp={[xp.Emoji]:"icon-smile",[xp.CustomEmoji]:"icon-favorite",[xp.Stickers]:"icon-stickers",[xp.GIFs]:"icon-gifs"},_p=(0,s.ph)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:i,onSearchOpen:s,isAttachmentModal:n,canSendPlainText:a,canSearch:o})=>{const r=(0,T.A)();function l(i){return(0,ie.Y)(Z.A,{className:"symbol-tab-button "+(e===i?"activated":""),onClick:()=>t(i),ariaLabel:r(Ep[i]),round:!0,faded:!0,color:"translucent",children:(0,ie.Y)("i",{className:(0,pe.A)("icon",Vp[i])})})}const c=(0,M.A)(()=>{s(e===xp.Stickers?"stickers":"gifs")});return(0,ie.FD)("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0,children:[e!==xp.Emoji&&e!==xp.CustomEmoji&&o&&(0,ie.Y)(Z.A,{className:"symbol-search-button",ariaLabel:e===xp.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:c,children:(0,ie.Y)(Q.A,{name:"search"})}),a&&l(xp.Emoji),a&&l(xp.CustomEmoji),!n&&l(xp.Stickers),!n&&l(xp.GIFs),(e===xp.Emoji||e===xp.CustomEmoji)&&(0,ie.Y)(Z.A,{className:"symbol-delete-button",onClick:i,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent",children:(0,ie.Y)(Q.A,{name:"delete-left"})})]})});let Up=!1;const Op=(0,s.ph)((0,n.EK)(e=>({isLeftColumnShown:(0,c.nTw)(e).isLeftColumnShown,isBackgroundTranslucent:(0,c.cwE)(e),animationLevel:(0,un.l)(e).animationLevel}))(({chatId:e,threadId:t,isOpen:i,canSendStickers:n,canSendGifs:a,isMessageComposer:o,idPrefix:l,isAttachmentModal:c,canSendPlainText:d,className:h,onLoad:m,onClose:p,onEmojiSelect:v,onCustomEmojiSelect:g,onStickerSelect:A,onGifSelect:f,onRemoveSymbol:b,onSearchOpen:C,addRecentEmoji:y,addRecentCustomEmoji:S,isLeftColumnShown:k,isBackgroundTranslucent:N,animationLevel:w,...I})=>{const[P,F]=(0,s.J0)(xp.Emoji),[D,B]=(0,s.J0)([]),[L,R]=(0,s.J0)([]),{isMobile:x}=(0,Y.Ay)(),[E,V]=(0,fp.A)(i,p,void 0,x),{shouldRender:_,transitionClassNames:U}=(0,Je.A)(i,p,!1,!1),O=(0,T.A)();!Up&&i&&(Up=!0),(0,s.vJ)(()=>{m()},[m]),(0,s.vJ)(()=>{d||F(xp.Stickers)},[d]),(0,s.Nf)(()=>{if(x&&i&&!c)return document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open"),()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{(0,r.RK)(()=>{document.body.classList.remove("enable-symbol-menu-transforms")})},350)}},[c,x,i]);const K=(0,s.li)(D);K.current=D,(0,s.vJ)(()=>{K.current.length&&!i&&(K.current.forEach(e=>{y({emoji:e})}),B([]))},[i,y]);const J=(0,M.A)((e,t)=>{B(e=>[...e,t]),v(e)}),G=(0,s.li)(L);G.current=L,(0,s.vJ)(()=>{G.current.length&&!i&&(G.current.forEach(e=>{S({documentId:e})}),R([]))},[i,S]);const j=(0,M.A)(e=>{R(t=>[...t,e.id]),g(e)}),z=(0,M.A)(e=>{p(),C(e)}),H=(0,M.A)((e,t,i,s)=>{A?.(e,t,i,!0,s)}),$=(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()},children:Up&&(0,ie.Y)(ae.Ay,{name:(0,fc.P)("slide",w),activeKey:P,renderCount:Object.values(Ep).length,children:function(s,r){switch(P){case xp.Emoji:return(0,ie.Y)(Bp,{className:"picker-tab",onEmojiSelect:J});case xp.CustomEmoji:return(0,ie.Y)(Lr,{className:"picker-tab",isHidden:!i||!s,idPrefix:l,loadAndPlay:i&&(s||r),chatId:e,isTranslucent:!x&&N,onCustomEmojiSelect:j});case xp.Stickers:return(0,ie.Y)(Rm,{className:"picker-tab",isHidden:!i||!s,loadAndPlay:!!n&&i&&(s||r),idPrefix:l,canSendStickers:n,noContextMenus:!o,chatId:e,threadId:t,isTranslucent:!x&&N,onStickerSelect:H});case xp.GIFs:return(0,ie.Y)(Rp,{className:"picker-tab",loadAndPlay:!!a&&i&&(s||r),canSendGifs:a,onGifSelect:f})}}})}),x&&(0,ie.Y)(Z.A,{round:!0,faded:!0,color:"translucent",ariaLabel:O("Close"),className:"symbol-close-button",size:"tiny",onClick:p,children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)(_p,{activeTab:P,onSwitchTab:F,onRemoveSymbol:b,canSearch:o,onSearchOpen:z,isAttachmentModal:c,canSendPlainText:d})]});if(x){if(!_)return;const e=(0,pe.A)("SymbolMenu mobile-menu",U,k&&"left-column-open",c&&"in-attachment-modal",o&&"in-middle-column");return c?(0,ie.Y)("div",{className:e,children:$}):(0,ie.Y)(Rr.A,{children:(0,ie.Y)("div",{className:e,children:$})})}return(0,ie.Y)(We.A,{isOpen:i,onClose:p,withPortal:c,className:(0,pe.A)("SymbolMenu",h),onCloseAnimationEnd:p,onMouseEnter:u.TF?void 0:E,onMouseLeave:u.TF?void 0:V,noCloseOnBackdrop:!u.TF,noCompact:!0,...c?I:{positionX:"left",positionY:"bottom"},children:$})}));var Kp=i(91034);const Jp=(0,s.ph)(({withAvatar:e,focus:t,command:i,description:s,peer:n,clickArg:a,onClick:o})=>{const r=(0,M.A)(()=>{o(a)});return(0,ie.FD)(ui.A,{className:(0,pe.A)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:r,focus:t,children:[e&&(0,ie.Y)(Tt.A,{size:"small",peer:n}),(0,ie.FD)("div",{className:"content-inner",children:[(0,ie.FD)("span",{className:"title",children:["/",i]}),(0,ie.Y)("span",{className:"subtitle",children:(0,Mt.A)(s)})]})]},i)}),Gp=(0,s.ph)((0,Kp.A)(({isOpen:e,chatId:t,withUsername:i,botCommands:a,quickReplies:o,quickReplyMessages:r,self:c,getHtml:d,onClick:h,onClose:u})=>{const{sendBotCommand:m,sendQuickReply:p}=(0,n.ko)(),v=(0,s.li)(),{shouldRender:g,transitionClassNames:A}=(0,Je.A)(e,void 0,void 0,!1),f=(0,M.A)(({botId:e,command:t})=>{const s=(0,n.mS)().users.byId[e];m({command:`/${t}${i&&s?`@${(0,l.Kl)(s)}`:""}`}),h()}),b=(0,M.A)(e=>{p({chatId:t,quickReplyId:e}),h()}),C=(0,s.Kr)(()=>{if(o?.length&&r)return o.map(e=>{const t=r[e.topMessageId];return{id:e.id,command:e.shortcut,description:t?.content.text?.text||""}})},[o,r]),y=(0,M.A)(e=>!!e.command.startsWith(d().slice(1))&&("id"in e?b(e.id):f(e),!0)),S=rp({isActive:e,items:(0,s.Kr)(()=>{if(a||C)return[].concat(C||[],a||[])},[a,C]),onSelect:y,onClose:u}),k=a&&!a.length||o&&!o.length;if((0,s.vJ)(()=>{k&&u()},[k,u]),(0,s.vJ)(()=>{op(".chat-item-clickable",S,v)},[S]),!g||k)return;const N=(0,pe.A)("iaTB59vy","composer-tooltip custom-scroll",A);return(0,ie.FD)("div",{className:N,ref:v,children:[C?.map((e,t)=>(0,ie.Y)(Jp,{command:e.command,description:e.description,peer:c,withAvatar:!0,clickArg:e.id,onClick:b,focus:S===t},`quickReply_${e.id}`)),a?.map((e,t)=>(0,ie.Y)(Jp,{command:e.command,description:e.description,peer:(0,n.mS)().users.byId[e.botId],withAvatar:!0,clickArg:e,onClick:f,focus:S+(C?.length||0)===t},`${e.botId}_${e.command}`))]})})),jp=(0,s.ph)(({isOpen:e,botCommands:t,onClose:i})=>{const{sendBotCommand:s}=(0,n.ko)(),{isMobile:a}=(0,Y.Ay)(),[o,r]=(0,fp.A)(e,i,void 0,a),l=(0,M.A)(e=>{s({command:`/${e}`}),i()});return(0,ie.Y)(We.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:i,className:"BotCommandMenu",onCloseAnimationEnd:i,onMouseEnter:u.TF?void 0:o,onMouseLeave:u.TF?void 0:r,noCloseOnBackdrop:!u.TF,noCompact:!0,children:t.map(e=>(0,ie.Y)(Jp,{command:e.command,description:e.description,clickArg:e.command,onClick:l},e.command))})}),zp=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{stickers:i}=e.stickers.forEmoji;return{stickers:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}})(({chatId:e,threadId:t,isOpen:i,onStickerSelect:n,onClose:a,stickers:r,isSavedMessages:l,isCurrentUserPremium:c})=>{const d=(0,s.li)(),{shouldRender:h,transitionClassNames:u}=(0,Je.A)(i,void 0,void 0,!1),p=(0,U.A)(r,!0),v=r||p,g=(0,Bm.A)(e,t),{observe:A}=(0,nr.BL)({rootRef:d,throttleMs:200});(0,s.vJ)(()=>i?(0,m.A)(a):void 0,[i,a]);const f=(0,pe.A)("StickerTooltip composer-tooltip custom-scroll",u,!v?.length&&"hidden");return(0,ie.Y)("div",{ref:d,className:f,onMouseMove:()=>{g({type:"chooseSticker"})},children:h&&v?v.map(e=>(0,ie.Y)(gr,{sticker:e,size:o.bkT,observeIntersection:A,onClick:i?n:void 0,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c},e.id)):h?(0,ie.Y)(Ms.A,{}):void 0})})),Hp={root:"_8sFuAomM",emojiButton:"crWzZ2jr"},$p=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{stickers:i}=e.customEmojis.forEmoji;return{customEmoji:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}})(({isOpen:e,addRecentCustomEmoji:t,onCustomEmojiSelect:i,onClose:a,customEmoji:r,isSavedMessages:l,isCurrentUserPremium:c,noPlay:d})=>{const{clearCustomEmojiForEmoji:h}=(0,n.ko)(),u=(0,s.li)(),{shouldRender:p,transitionClassNames:v}=(0,Je.A)(e,void 0,void 0,!1),g=(0,U.A)(r,!0),A=r||g;(0,yn.A)(u);const{observe:f}=(0,nr.BL)({rootRef:u,throttleMs:200,isDisabled:!e});(0,s.vJ)(()=>e?(0,m.A)(a):void 0,[e,a]);const b=(0,M.A)(s=>{e&&(i(s),t({documentId:s.id}),h())}),C=(0,pe.A)(Hp.root,"composer-tooltip no-scrollbar",v,!A?.length&&Hp.hidden);return(0,ie.Y)("div",{ref:u,className:C,children:p&&A?A.map(e=>(0,ie.Y)(gr,{sticker:e,className:Hp.emojiButton,size:o.x6_,observeIntersection:f,onClick:b,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c,noPlay:d},e.id)):p?(0,ie.Y)(Ms.A,{}):void 0})}));var qp=i(76283);const Wp=(0,s.ph)(({isOpen:e,isOpenToBottom:t=!1,isSavedMessages:i,canSchedule:a,canScheduleUntilOnline:o,onSendSilent:r,onSendSchedule:l,onSendWhenOnline:c,onRemoveEffect:d,onClose:h,onCloseAnimationEnd:m,chatId:p,withEffects:v,hasCurrentEffect:g,effectReactions:A,allAvailableReactions:f,onToggleReaction:b,canBuyPremium:C,isCurrentUserPremium:y,isInSavedMessages:S,isInStoryViewer:k,canPlayAnimatedEmojis:N})=>{const{openEffectPicker:w}=(0,n.ko)(),[I,P]=(0,fp.A)(e,h),[Y,D]=(0,s.J0)(!1),B=(0,T.A)(),L=(0,Ri.A)(),[R,x,E]=(0,F.A)();(0,fi.A)(([t])=>{e&&!t&&(E(),D(Boolean(o)))},[e,o]);const[V,_,U]=(0,F.A)(),O=(0,M.A)(e=>{x(),p&&w({chatId:p,position:e})});return(0,s.vJ)(()=>{e?setTimeout(()=>{_()},200):U()},[e,_,U]),(0,ie.FD)(We.A,{isOpen:e,autoClose:!0,positionX:"right",positionY:t?"top":"bottom",className:(0,pe.A)("CustomSendMenu","fluid","with-menu-transitions",v&&"with-effects"),onClose:h,onCloseAnimationEnd:m,onMouseEnter:u.TF?void 0:I,onMouseLeave:u.TF?void 0:P,noCloseOnBackdrop:!u.TF,children:[v&&!k&&(0,ie.Y)(qp.A,{allAvailableReactions:f,effectReactions:A,currentReactions:void 0,onToggleReaction:b,isPrivate:!0,isReady:V,canBuyPremium:C,isCurrentUserPremium:y,isInSavedMessages:S,isForEffects:!0,canPlayAnimatedEmojis:N,onShowMore:O,onClose:h,className:(0,pe.A)(R&&"ReactionSelector-hidden")}),(0,ie.FD)("div",{className:(0,pe.A)("CustomSendMenu_items",R&&"CustomSendMenu_items-hidden"),dir:L.isRtl?"rtl":void 0,children:[r&&(0,ie.Y)(he.A,{icon:"mute",onClick:r,children:B("SendWithoutSound")}),a&&l&&(0,ie.Y)(he.A,{icon:"schedule",onClick:l,children:B(i?"SetReminder":"ScheduleMessage")}),a&&l&&Y&&(0,ie.Y)(he.A,{icon:"user-online",onClick:c,children:B("SendWhenOnline")}),v&&g&&(0,ie.Y)(he.A,{icon:"delete",onClick:d,children:L("RemoveEffect")})]})]})});var Qp=i(41510),Zp=i(22802);const Xp={B:"bold",STRONG:"bold",I:"italic",EM:"italic",U:"underline",DEL:"strikethrough",CODE:"monospace",SPAN:"spoiler"},ev=document.createElement("div"),tv=(0,s.ph)(({isOpen:e,anchorPosition:t,selectedRange:i,setSelectedRange:n,onClose:a})=>{const r=(0,s.li)(),l=(0,s.li)(),{shouldRender:c,transitionClassNames:d}=(0,Je.A)(e),[u,p,v]=(0,F.A)(),[g,A]=(0,s.J0)(""),[f,b]=(0,s.J0)(!1),[C,S]=(0,s.J0)(),[k,N]=(0,s.J0)({}),w=(0,Ri.A)();(0,s.vJ)(()=>e?(0,m.A)(a):void 0,[e,a]),(0,Zp.A)(e,r,a,!0),(0,s.vJ)(()=>{u?l.current.focus():(A(""),b(!1))},[u]),(0,s.vJ)(()=>{c||(v(),N({}),S(void 0))},[v,c]),(0,s.vJ)(()=>{if(!e||!i)return;const t={};let{parentElement:s}=i.commonAncestorContainer;for(;s&&s.id!==o.CfG;){const e=Xp[s.tagName];e&&(t[e]=!0),s=s.parentElement}N(t)},[e,i,p]);const I=(0,M.A)(()=>{if(!i)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(i))}),P=(0,M.A)(()=>{const e=window.getSelection();e&&n(e.getRangeAt(0))}),Y=(0,M.A)(e=>{if(i)return ev.replaceChildren(i.cloneContents()),e&&ev.querySelectorAll(Tm._p).forEach(e=>{e.replaceWith(e.getAttribute("alt"))}),ev.innerHTML}),D=(0,M.A)(()=>{if(i)return i.commonAncestorContainer.parentElement});function T(){const e=l.current;if(!e)return;const{offsetWidth:t,scrollWidth:i,scrollLeft:s}=e;if(i<=t)return void S(void 0);let n="";s<i-t&&(n="mask-right"),s>0&&(n+=" mask-left"),S(n)}function B(e){if(k[e])return"active";if("monospace"===e||"strikethrough"===e){if(Object.keys(k).some(t=>t!==e&&Boolean(k[t])))return"disabled"}else if(k.monospace||k.strikethrough)return"disabled"}const L=(0,M.A)(()=>{if(k.spoiler){const e=D();if(!i||!e||e.dataset.entityType!==K.C7.Spoiler||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,spoiler:!1}))}const e=Y();document.execCommand("insertHTML",!1,`<span class="spoiler" data-entity-type="${K.C7.Spoiler}">${e}</span>`),a()}),R=(0,M.A)(()=>{N(e=>(document.execCommand(e.bold?"removeFormat":"bold"),Object.keys(e).forEach(t=>{"italic"!==t&&"underline"!==t||!Boolean(e[t])||document.execCommand(t)}),P(),{...e,bold:!e.bold}))}),x=(0,M.A)(()=>{document.execCommand("italic"),P(),N(e=>({...e,italic:!e.italic}))}),E=(0,M.A)(()=>{document.execCommand("underline"),P(),N(e=>({...e,underline:!e.underline}))}),V=(0,M.A)(()=>{if(k.strikethrough){const e=D();if(!i||!e||"DEL"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,strikethrough:!1}))}const e=Y();document.execCommand("insertHTML",!1,`<del>${e}</del>`),a()}),_=(0,M.A)(()=>{if(k.monospace){const e=D();if(!i||!e||"CODE"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,monospace:!1}))}const e=Y(!0);document.execCommand("insertHTML",!1,`<code class="text-entity-code" dir="auto">${e}</code>`),a()}),U=(0,M.A)(()=>{const e=((0,Hs.Tc)(g)||"").split("%").map(encodeURI).join("%");if(f){const t=D();if(!t||"A"!==t.tagName)return;return t.href=e,void a()}const t=Y(!0);I(),document.execCommand("insertHTML",!1,`<a href="${e}" class="text-entity-link" dir="auto">${t}</a>`),a()}),O=(0,M.A)(e=>{const t={k:p,b:R,u:E,i:x,m:_,s:V,p:L}[function(e){const t=e.key||e.code;return t.startsWith("Key")?t.slice(3).toLowerCase():t}(e)];!e.altKey&&(e.ctrlKey||e.metaKey)&&t&&(e.preventDefault(),e.stopPropagation(),t())});if((0,s.vJ)(()=>(e&&document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)),[e,O]),!c)return;const J=(0,pe.A)("TextFormatter",d,u&&"link-control-shown"),G=(0,pe.A)("TextFormatter-link-url-confirm",Boolean(g.length)&&"shown"),j=t?`left: ${t.x}px; top: ${t.y}px;--text-formatter-left: ${t.x}px;`:"";return(0,ie.FD)("div",{ref:r,className:J,style:j,onKeyDown:function(e){if("Enter"===e.key&&u){if(!g.trim())return;U(),e.preventDefault()}},onMouseDown:y.A,children:[(0,ie.FD)("div",{className:"TextFormatter-buttons",children:[(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingSpoilerAria"),className:B("spoiler"),onClick:L,children:(0,ie.Y)(Q.A,{name:"eye-crossed"})}),(0,ie.Y)("div",{className:"TextFormatter-divider"}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingBoldAria"),className:B("bold"),onClick:R,children:(0,ie.Y)(Q.A,{name:"bold"})}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingItalicAria"),className:B("italic"),onClick:x,children:(0,ie.Y)(Q.A,{name:"italic"})}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingUnderlineAria"),className:B("underline"),onClick:E,children:(0,ie.Y)(Q.A,{name:"underlined"})}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingStrikethroughAria"),className:B("strikethrough"),onClick:V,children:(0,ie.Y)(Q.A,{name:"strikethrough"})}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingMonospaceAria"),className:B("monospace"),onClick:_,children:(0,ie.Y)(Q.A,{name:"monospace"})}),(0,ie.Y)("div",{className:"TextFormatter-divider"}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("FormattingAddLinkAria"),onClick:p,children:(0,ie.Y)(Q.A,{name:"link"})})]}),(0,ie.Y)("div",{className:"TextFormatter-link-control",children:(0,ie.FD)("div",{className:"TextFormatter-buttons",children:[(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("Cancel"),onClick:v,children:(0,ie.Y)(Q.A,{name:"arrow-left"})}),(0,ie.Y)("div",{className:"TextFormatter-divider"}),(0,ie.Y)("div",{className:(0,pe.A)("TextFormatter-link-url-input-wrapper",C),children:(0,ie.Y)("input",{ref:l,className:"TextFormatter-link-url-input",type:"text",value:g,placeholder:w("FormattingEnterUrl"),autoComplete:"off",spellCheck:!h.Vq&&void 0,inputMode:"url",dir:"auto",onChange:function(e){A(e.target.value),T()},onScroll:T})}),(0,ie.FD)("div",{className:G,children:[(0,ie.Y)("div",{className:"TextFormatter-divider"}),(0,ie.Y)(Z.A,{color:"translucent",ariaLabel:w("Save"),className:"color-primary",onClick:U,children:(0,ie.Y)(Q.A,{name:"check"})})]})]})})]})}),iv=(0,s.ph)(({emoji:e,focus:t,onClick:i,observeIntersection:s})=>{const n=(0,M.A)(t=>{t.preventDefault(),i?.(e)}),a=(0,pe.A)("EmojiButton",t&&"focus");return(0,ie.Y)("div",{className:a,onMouseDown:n,title:e.emoji,children:(0,ie.Y)(ha.A,{documentId:e.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:s})})}),sv=(0,s.ph)(({isOpen:e,emojis:t,customEmojis:i,onClose:n,onEmojiSelect:a,onCustomEmojiSelect:o,addRecentEmoji:r,addRecentCustomEmoji:l})=>{const c=(0,s.li)(),{shouldRender:d,transitionClassNames:h}=(0,Je.A)(e,void 0,void 0,!1),u=(0,Hi.A)(t.length?[...t,...i]:void 0,350)||[];(0,yn.A)(c);const{observe:m}=(0,nr.BL)({rootRef:c,throttleMs:200,isDisabled:!e}),p=(0,M.A)(e=>{a(e.native),r({emoji:e.id})}),v=(0,M.A)(e=>{o(e),l({documentId:e.id})}),g=(0,M.A)(e=>{"native"in e?p(e):v(e)}),A=(0,M.A)((e,t)=>{a(e),r({emoji:t})}),f=(0,M.A)(e=>{o(e),l({documentId:e.id})}),b=rp({isActive:e,isHorizontal:!0,items:u,shouldRemoveSelectionOnReset:!0,onSelect:g,onClose:n});(0,fi.A)(([e])=>{void 0!==e&&-1!==e&&function(e,t){const i=t.current;if(!i)return;const{visibleIndexes:s,allElements:n}=ap(i,".EmojiButton",8,!0,!0,!0);if(!n.length||!n[e])return;const a=s[0];if(!s.includes(e)||e===a&&!np(i,n[a],!0)){const t="start"==(e>s[s.length-1]?"start":"end")?44*e:0;(0,ga.A)(i,t)}}(b,c)},[b]);const C=(0,pe.A)("EmojiTooltip composer-tooltip no-scrollbar",h);return(0,ie.Y)("div",{ref:c,className:C,children:d&&u?u.map((e,t)=>"native"in e?(0,ie.Y)(Cp,{emoji:e,focus:b===t,onClick:A},e.id):(0,ie.Y)(iv,{emoji:e,focus:b===t,onClick:f,observeIntersection:m},e.id)):d?(0,ie.Y)(Ms.A,{}):void 0})}),nv=(0,s.ph)(({title:e,description:t,thumbnail:i,thumbUrl:s,focus:n,transitionClassNames:a="",onClick:o})=>{let r;const c=(0,H.A)(i?(0,l.cy)(i):void 0);return(s=s||c)?r=(0,ie.Y)("img",{src:s,className:a,alt:"",decoding:"async",draggable:!1}):e&&(r=(0,kn.Qh)(e,1)),(0,ie.FD)(ui.A,{focus:n,className:(0,pe.A)("BaseResult chat-item-clickable","string"==typeof r&&"with-text"),onMouseDown:mr.u,onClick:o,children:[(0,ie.Y)("span",{className:"thumb",children:"string"==typeof r?(0,Mt.A)(r):r}),(0,ie.FD)("div",{className:"content-inner",children:[e&&(0,ie.Y)("div",{className:"title",children:e}),t&&(0,ie.Y)("div",{className:"description",children:t})]})]})}),av=(0,s.ph)(({focus:e,inlineResult:t,onClick:i})=>{const{title:s,description:n}=t,a="url"in t?t.url:void 0,o="webThumbnail"in t?t.webThumbnail:void 0,r=(0,M.A)(()=>{i(t)});return(0,ie.Y)(nv,{focus:e,thumbnail:o,title:s||a,description:n,onClick:r})}),ov=(0,s.ph)(({inlineResult:e,isSavedMessages:t,canSendGifs:i,observeIntersection:s,onClick:n})=>{const{gif:a}=e,o=(0,M.A)((t,i,s)=>{n(e,i,s)});if(a)return(0,ie.Y)(Lp,{gif:a,observeIntersection:s,className:"chat-item-clickable",onClick:i?o:void 0,isSavedMessages:t})}),rv=(0,s.ph)(({focus:e,isForGallery:t,inlineResult:i,onClick:s})=>{let n,a,o;"photo"in i&&(n=i.photo),"thumbnail"in i&&(a=i.thumbnail),"webThumbnail"in i&&(o=i.webThumbnail);const r=(0,H.A)((0,l.cy)(o)),c=(0,H.A)(n&&(0,l.rI)(n,"pictogram")),d=(0,Ei.A)(c||r),h=(0,M.A)(()=>{s(i)});if(t)return(0,ie.FD)("div",{className:"MediaResult chat-item-clickable",onClick:h,children:[(0,ie.Y)("img",{src:n?.thumbnail?.dataUri||r,alt:"",draggable:!1}),(0,ie.Y)("img",{src:c,className:(0,pe.A)("full-media",d),alt:"",draggable:!1})]});const{title:u,description:m}=i;return(0,ie.Y)(nv,{focus:e,thumbnail:o,thumbUrl:c||a?.dataUri,transitionClassNames:d,title:u,description:m,onClick:h})}),lv=(0,s.ph)(({inlineResult:e,isSavedMessages:t,observeIntersection:i,onClick:s,isCurrentUserPremium:n})=>{const{sticker:a}=e;if(a)return(0,ie.Y)(gr,{sticker:a,size:o.mD0,observeIntersection:i,title:a.emoji,className:"chat-item-clickable",onClick:s,clickArg:e,isSavedMessages:t,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:n})}),cv=(0,Ae.nF)(e=>e(),500,!0),dv=(0,s.ph)(({isOpen:e,botId:t,isGallery:i,inlineBotResults:o,switchPm:r,switchWebview:l,isSavedMessages:c,canSendGifs:d,loadMore:h,onClose:m,onSelectResult:p,isCurrentUserPremium:v})=>{const{openChat:g,startBot:A,requestSimpleWebView:f}=(0,n.ko)(),b=(0,s.li)(),{shouldRender:C,transitionClassNames:y}=(0,Je.A)(e,void 0,void 0,!1),S=(0,Yi.A)(i,C),{observe:k}=(0,nr.BL)({rootRef:b,debounceMs:200,isDisabled:!e}),N=(0,M.A)(({direction:e})=>{e===a.TN.Backwards&&cv(h)}),w=rp({isActive:e,shouldRemoveSelectionOnReset:S,noArrowNavigation:S,items:o,onSelect:p,onClose:m});(0,s.vJ)(()=>{op(".chat-item-clickable",w,b)},[w]);const I=(0,M.A)(()=>{g({id:t}),A({botId:t,param:r.startParam})}),P=(0,M.A)(()=>{const e=(0,Nn.A)();f({botId:t,url:l.url,buttonText:l.text,theme:e,isFromSwitchWebView:!0})}),Y=(0,U.A)(o?.length?o:void 0,C),F=o?.length?o:Y;if(!C||!(F?.length||r||l))return;const D=(0,pe.A)("InlineBotTooltip composer-tooltip",u.TF?"no-scrollbar":"custom-scroll",S&&"gallery",y);return(0,ie.FD)(vs.A,{ref:b,className:D,items:F,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:N,sensitiveArea:160,children:[r&&(0,ie.Y)(ui.A,{ripple:!0,className:"switch-pm scroll-item",onClick:I,children:(0,ie.Y)("span",{className:"title",children:r.text})}),l&&(0,ie.Y)(ui.A,{ripple:!0,className:"switch-pm scroll-item",onClick:P,children:(0,ie.Y)("span",{className:"title",children:l.text})}),Boolean(F?.length)&&F.map((e,t)=>{switch(e.type){case"gif":return(0,ie.Y)(ov,{inlineResult:e,observeIntersection:k,onClick:p,isSavedMessages:c,canSendGifs:d},e.id);case"photo":return(0,ie.Y)(rv,{isForGallery:S,inlineResult:e,onClick:p},e.id);case"sticker":return(0,ie.Y)(lv,{inlineResult:e,observeIntersection:k,onClick:p,isSavedMessages:c,isCurrentUserPremium:v},e.id);case"video":case"file":case"game":return(0,ie.Y)(rv,{focus:w===t,inlineResult:e,onClick:p},e.id);case"article":case"audio":case"voice":return(0,ie.Y)(av,{focus:w===t,inlineResult:e,onClick:p},e.id);default:return}})]})}),hv=(0,s.ph)(({isOpen:e,chatId:t,selectedSendAsId:i,sendAsPeerIds:a,isCurrentUserPremium:o,onClose:r})=>{const{saveDefaultSendAs:l,showNotification:c}=(0,n.ko)(),d=(0,n.mS)().users.byId,h=(0,n.mS)().chats.byId,m=(0,T.A)(),p=(0,s.li)(),[v,g,A]=(0,fp.A)(e,r,void 0);(0,s.vJ)(()=>{e&&A()},[e,A]);const f=(0,M.A)(e=>{r(),l({chatId:t,sendAsId:e})}),b=rp({isActive:e,items:a,onSelect:f,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:r});return(0,s.vJ)(()=>{op(".chat-item-clickable",b,p)},[b]),(0,s.vJ)(()=>{a&&!a.length&&r()},[a,r]),(0,ie.FD)(We.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SendAsMenu",onCloseAnimationEnd:r,onMouseEnter:u.TF?void 0:v,onMouseLeave:u.TF?void 0:g,noCloseOnBackdrop:!u.TF,noCompact:!0,children:[(0,ie.Y)("div",{className:"send-as-title",dir:"auto",children:m("SendMessageAsTitle")}),d&&h&&a?.map(({id:e,isPremium:t},s)=>{const n=d[e],a=h[e],r=n||a,l=(0,pe.A)(i===e&&"selected");return(0,ie.FD)(ui.A,{className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!t||o?f(e):c({message:m("SelectSendAsPeerPremiumHint"),actionText:m("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:b===s,rightElement:!o&&t&&(0,ie.Y)(Q.A,{name:"lock-badge",className:"send-as-icon-locked"}),children:[(0,ie.Y)(Tt.A,{size:"small",peer:r,className:l}),(0,ie.FD)("div",{className:"info",children:[r&&(0,ie.Y)(Ts.A,{peer:r,noFake:!0}),(0,ie.Y)("span",{className:"subtitle",children:n?m("VoipGroupPersonalAccount"):m("Subscribers",a?.membersCount,"i")})]})]},e)})]})}),uv=(0,s.ph)((0,n.EK)((e,{stickerSetId:t})=>({set:(0,c.ycM)(e,t),shouldPlay:(0,c.ML4)(e),isCurrentUserPremium:(0,c.g29)(e)}))(({stickerSetId:e,observeIntersection:t,set:i,shouldPlay:a,isModalOpen:r,isCurrentUserPremium:l})=>{const{loadStickers:c,toggleStickerSet:d,openStickerSet:h}=(0,n.ko)(),u=(0,s.li)(),m=(0,T.A)(),p=i&&!i.isArchived&&Boolean(i.installedDate),v=Boolean(i?.stickers),g=(0,s.Kr)(()=>{if(!i)return[];const e=(i.stickers?.filter(({hasEffect:e})=>e)??[]).slice(0,3),t=(i.covers||[]).map(({id:e})=>e),s=i.stickers?i.stickers.filter(({id:e})=>!t.includes(e)):[];return[...e,...i.covers||[],...s].slice(0,5)},[i]);(0,s.vJ)(()=>{!v&&g.length<5&&i&&c({stickerSetInfo:{shortName:i.shortName}})},[v,g.length,c,i,e]);const A=(0,s.hb)(()=>{d({stickerSetId:e})},[d,e]),f=(0,s.hb)(e=>{h({stickerSetInfo:e.stickerSetInfo})},[h]);if(!i)return;const b=g.length>0;return(0,ie.FD)("div",{className:"sticker-set",dir:m.isRtl?"rtl":void 0,children:[(0,ie.FD)("div",{className:"sticker-set-header",children:[(0,ie.FD)("div",{className:"title-wrapper",children:[(0,ie.Y)("h3",{className:"title",dir:"auto",children:i.title}),(0,ie.Y)("p",{className:"count",dir:"auto",children:m("Stickers",i.count,"i")})]}),(0,ie.Y)(Z.A,{className:p?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:A,children:m(p?"Stickers.Installed":"Stickers.Install")})]}),(0,ie.FD)("div",{className:"sticker-set-main shared-canvas-container",children:[(0,ie.Y)("canvas",{ref:u,className:"shared-canvas"}),!b&&(0,ie.Y)(Ve.A,{}),b&&g.map(e=>(0,ie.Y)(gr,{sticker:e,size:o.Rqe,observeIntersection:t,noPlay:!a||r,clickArg:e,onClick:f,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:u}))]})]},i.id)})),mv=(0,Ae.nF)(e=>e(),6e4,!0),pv=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.BmE)(e),{query:i,resultIds:s}=t||{},{featured:n}=e.stickers;return{query:i,featuredIds:n.setIds,resultIds:s,isModalOpen:Boolean((0,c.nTw)(e).openedStickerSetShortName)}})(({isActive:e,query:t,featuredIds:i,resultIds:a,isModalOpen:o,onClose:r})=>{const{loadFeaturedStickers:l}=(0,n.ko)(),c=(0,s.li)(),d=(0,T.A)(),{observe:h}=(0,nr.BL)({rootRef:c,throttleMs:200});return(0,s.vJ)(()=>{mv(()=>{l()})}),(0,ye.A)({isActive:e,onBack:r}),(0,ie.Y)("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0,children:function(){if(void 0!==t)return!t&&i?i.map(e=>(0,ie.Y)(uv,{stickerSetId:e,observeIntersection:h,isModalOpen:o},e)):a?a.length?a.map(e=>(0,ie.Y)(uv,{stickerSetId:e,observeIntersection:h,isModalOpen:o},e)):(0,ie.Y)("p",{className:"helper-text",dir:"auto",children:"Nothing found."}):(0,ie.Y)(Ms.A,{})}()})})),vv=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.Wy7)(e),{query:i,results:s}=t||{},{chatId:n,threadId:a}=(0,c.Xf0)(e)||{},o=n?(0,c.hds)(e,n):void 0,r=n?(0,c.AWZ)(e,n):void 0,d=o?(0,c.ALW)(e,o):void 0,h=Boolean(n)&&(0,c.nZ4)(e,n),u=n&&a?(0,c.Vw0)(e,n,a):void 0,m=Boolean(!u?.isCommentsInfo&&u?.fromChannelId),p=n&&a?(0,c.S0q)(e,n,a):void 0;return{query:i,results:s,chat:o,chatFullInfo:r,isChatWithBot:d,isSavedMessages:h,canPostInChat:Boolean(o)&&Boolean(a)&&(0,l.__)(o,p,m,r),canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),currentMessageList:(0,c.Xf0)(e)}})(({isActive:e,query:t,results:i,chat:a,chatFullInfo:o,isChatWithBot:r,canScheduleUntilOnline:c,isSavedMessages:d,canPostInChat:h,currentMessageList:m,onClose:p})=>{const{searchMoreGifs:v,sendMessage:g,setGifSearchQuery:A}=(0,n.ko)(),f=(0,s.li)(),[b,C]=(0,mm.A)(c),{observe:y}=(0,nr.BL)({rootRef:f,debounceMs:300}),S=h&&(0,l.Q_)(a,o,r,d).canSendGifs,k=(0,s.hb)((e,t,i)=>{if(S){if(!m)return;i?b(i=>{g({messageList:m,gif:e,scheduledAt:i,isSilent:t})}):g({messageList:m,gif:e,isSilent:t})}u.TF&&A({query:void 0})},[S,m,b]),N=(0,s.hb)(()=>{v()},[v]),w=(0,T.A)();(0,ye.A)({isActive:e,onBack:p});const I=Boolean(void 0!==t&&i&&i.length);return(0,ie.FD)("div",{className:"GifSearch",dir:w.isRtl?"rtl":void 0,children:[(0,ie.Y)(vs.A,{ref:f,className:(0,pe.A)("gif-container custom-scroll",I&&"grid"),items:i,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:N,children:function(){if(void 0!==t)return i?i.length?i.map(e=>(0,ie.Y)(Lp,{gif:e,observeIntersection:y,onClick:S?k:void 0,isSavedMessages:d},e.id)):(0,ie.Y)("p",{className:"helper-text",dir:"auto",children:w("NoGIFsFound")}):(0,ie.Y)(Ms.A,{})}()}),C]})}));var gv=i(75319),Av=i(71950);const fv="OAKzmAva",bv="BQ6HUOqN",Cv="U96CW2I7",yv="vXi2JQlj",Sv="bi3fL59p",kv="GUK4ajPK",Nv="YH6jeZIh",wv="q1LnuIUn",Iv="PJZzyVLK",Pv="C7NpG5Y9",Yv=(0,s.ph)(function({postStatistic:e}){const t=(0,T.A)(),i=(0,Ri.A)();return(0,ie.FD)("div",{className:Nv,children:[e.reactionsCount>0&&(0,ie.FD)("span",{className:wv,children:[(0,ie.Y)(Q.A,{name:"heart-outline",className:Iv}),(0,kn.Vw)(i,e.reactionsCount)]}),e.forwardsCount>0&&(0,ie.FD)("span",{className:wv,children:[(0,ie.Y)(Q.A,{name:"forward",className:Iv}),(0,kn.Vw)(i,e.forwardsCount)]}),!e.forwardsCount&&!e.reactionsCount&&t("ChannelStats.SharesCount_ZeroValueHolder")]})});function Fv(e,t,i,s){return i?(0,ie.FD)("span",{children:[(0,ie.Y)("img",{src:i,alt:"",draggable:!1,className:(0,pe.A)(Cv,s&&"yxjDeIct")}),(0,l.zX)(t)&&(0,ie.Y)(Q.A,{name:"play"}),(0,A.C)(e,t,!0)]}):(0,A.C)(e,t)}const Dv=(0,s.ph)(({postStatistic:e,message:t})=>{const i=(0,Ri.A)(),{toggleMessageStatistics:a}=(0,n.ko)(),o=(0,Ec.A)(t),r=(0,xc.A)(t,"micro"),c=(0,H.A)(r),d=Boolean((0,l.lk)(t)),h=(0,s.hb)(()=>{a({messageId:t.id})},[a,t.id]);return(0,ie.FD)("div",{className:(0,pe.A)(fv,Boolean(c||o)&&bv),onClick:h,children:[(0,ie.FD)("div",{className:Sv,children:[(0,ie.Y)("div",{className:yv,children:Fv(i,t,c||o,d)}),(0,ie.Y)("div",{className:Nv,children:i("ChannelStatsViewsCount",{count:e.viewsCount},{pluralValue:e.viewsCount})})]}),(0,ie.FD)("div",{className:kv,children:[(0,ie.Y)("div",{className:Pv,children:(0,$e.L2)(1e3*t.date,i.code)}),(0,ie.Y)(Yv,{postStatistic:e})]})]})});function Mv(e,t,i){return(0,ie.FD)("span",{children:[i?(0,ie.Y)("span",{className:"TmJvv2A6",children:(0,ie.Y)("img",{src:i,alt:"",draggable:!1,className:(0,pe.A)(Cv,"cdfiLmXo","BOfHPv20")})}):(0,ie.Y)(Tt.A,{peer:t,size:"small",className:Cv,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story")]})}const Tv=(0,s.ph)(function({chat:e,story:t,postStatistic:i}){const s=(0,T.A)(),{toggleStoryStatistics:a}=(0,n.ko)(),o=t&&"content"in t,r=o?t.content.video:void 0,c=o?(0,l.EN)(t):void 0,d=(0,H.A)(c),h=d||r?.thumbnail?.dataUri,u=(0,M.A)(()=>{a({storyId:i.storyId})});return(0,ie.FD)("div",{className:(0,pe.A)(fv,bv),onClick:u,children:[(0,ie.FD)("div",{className:Sv,children:[(0,ie.Y)("div",{className:yv,children:Mv(s,e,d||h)}),(0,ie.Y)("div",{className:Nv,children:s("ChannelStats.ViewsCount",i.viewsCount,"i")})]}),(0,ie.FD)("div",{className:kv,children:[(0,ie.Y)("div",{className:Pv,children:o&&Boolean(t.date)&&(0,$e.L2)(1e3*t.date,s.code)}),(0,ie.Y)(Yv,{postStatistic:i})]})]})}),Bv="T1l_4J8z",Lv="S1x1ovkC",Rv="WxL3i5PM",xv="aUrozL5_",Ev="QQHwjG88",Vv="QGctP1Nk";let _v,Uv;const Ov={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",reactionsByEmotionGraph:"ChannelStats.Graph.Reactions",storyInteractionsGraph:"ChannelStats.Graph.Stories",storyReactionsByEmotionGraph:"ChannelStats.Graph.StoriesReactions"},Kv=Object.keys(Ov),Jv={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Gv=Object.keys(Jv),jv=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.gqw)(e,t),s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t)?.statisticsDcId,a="chatTypeSuperGroup"===s?.type,o=(0,c.zeq)(e,t),r=(0,c._bp)(e,t)?.byId;return{statistics:i,dcId:n,isGroup:a,chat:s,messagesById:o,storiesById:r}})(({chatId:e,chat:t,statistics:a,dcId:o,isGroup:r,messagesById:l,storiesById:c})=>{const d=(0,T.A)(),h=(0,s.li)(),[u,m]=(0,s.J0)(!1),p=(0,s.li)(new Set),v=(0,s.li)(new Set),{loadStatistics:g,loadStatisticsAsyncGraph:A}=(0,n.ko)(),f=(0,D.A)();(0,s.vJ)(()=>{g({chatId:e,isGroup:r})},[e,g,r]);const b=(0,s.Kr)(()=>r?Gv:Kv,[r]),C=(0,s.Kr)(()=>r?Jv:Ov,[r]);return(0,s.vJ)(()=>{a&&b.forEach(t=>{const i=a[t];(0,gv.R)(i)&&"async"===i.graphType&&A({name:t,chatId:e,token:i.token,isPercentage:"languagesGraph"===t})})},[b,e,a,A]),(0,s.vJ)(()=>{(async()=>{await async function(){return _v||(_v=i.e(4810).then(i.bind(i,24810)),Uv=await _v),_v}(),u?a&&h.current&&(b.forEach((e,t)=>{const i=a[e];if(!(0,gv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||p.current.has(e))return;if(n)return p.current.add(e),void v.current.add(e);const{zoomToken:r}=i;Uv.create(h.current.children[t],{title:d(C[e]),...r?{onZoom:e=>(0,Xe.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:o}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e),h.current.children[t].classList.remove(Vv)}),f()):m(!0)})()},[b,C,u,a,d,e,A,o,f]),(0,ie.FD)("div",{className:(0,pe.A)(Bv,"panel-content custom-scroll",u&&xv),children:[a&&(0,ie.Y)(Av.A,{statistics:a,type:r?"group":"channel",title:d("StatisticOverview")}),!p.current.size&&(0,ie.Y)(Ms.A,{}),(0,ie.Y)("div",{ref:h,children:b.map(e=>{const t=p.current.has(e)&&!v.current.has(e);return(0,ie.Y)("div",{className:(0,pe.A)(Ev,!t&&Vv)})})}),Boolean(a?.recentPosts?.length)&&(0,ie.FD)("div",{className:"suY9dEIz",children:[(0,ie.Y)("h2",{className:"evQIkAqx",children:d("ChannelStats.Recent.Header")}),a.recentPosts.map(e=>{if("msgId"in e){const t=l[e.msgId];if(!t||!("content"in t))return;return(0,ie.Y)(Dv,{message:t,postStatistic:e},`statistic_message_${e.msgId}`)}if("storyId"in e&&t){const i=c?.[e.storyId];return(0,ie.Y)(Tv,{chat:t,story:i,postStatistic:e},`statistic_story_${e.storyId}`)}})]})]})})),zv="oXLpD4Y4",Hv="paQ2VBe_",$v="WvFuOAIf",qv=(0,s.ph)(({data:e})=>{const t=(0,T.A)(),{openChatByUsername:i}=(0,n.ko)(),a=(0,s.Kr)(()=>e.chat?(0,l.Kl)(e.chat):void 0,[e.chat]),o=(0,s.hb)(()=>{i({username:a,messageId:e.messageId})},[e.messageId,i,a]);return(0,ie.FD)("div",{className:(0,pe.A)(zv,"statistic-public-forward"),onClick:o,children:[(0,ie.Y)(Tt.A,{size:"medium",peer:e.chat}),(0,ie.FD)("div",{children:[(0,ie.Y)("div",{className:Hv,children:e.title}),(0,ie.Y)("div",{className:$v,children:t("ChannelStats.ViewsCount",e.views,"i")})]})]})});let Wv,Qv;const Zv={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Xv=Object.keys(Zv),eg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e);return{statistics:s.statistics.currentMessage,dcId:i,messageId:s.statistics.currentMessageId}})(function({chatId:e,isActive:t,statistics:o,dcId:r,messageId:l}){const c=(0,T.A)(),d=(0,s.li)(),[h,u]=(0,s.J0)(!1),m=(0,s.li)(new Set),p=(0,s.li)(new Set),{loadMessageStatistics:v,loadMessagePublicForwards:g,loadStatisticsAsyncGraph:A}=(0,n.ko)(),f=(0,D.A)();(0,s.vJ)(()=>{l&&v({chatId:e,messageId:l})},[e,v,l]),(0,s.vJ)(()=>{t&&!l||(m.current.clear(),p.current.clear(),u(!1))},[t,l]),(0,s.vJ)(()=>{o&&Xv.forEach(t=>{const i=o[t];(0,gv.R)(i)&&"async"===i.graphType&&A({name:t,chatId:e,token:i.token})})},[e,o,A]),(0,s.vJ)(()=>{(async()=>{await async function(){return Wv||(Wv=i.e(4810).then(i.bind(i,24810)),Qv=await Wv),Wv}(),h?o&&d.current&&(Xv.forEach((e,t)=>{const i=o[e];if(!(0,gv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||m.current.has(e))return;if(n)return m.current.add(e),void p.current.add(e);const{zoomToken:a}=i;Qv.create(d.current.children[t],{title:c(Zv[e]),...a?{onZoom:e=>(0,Xe.px)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...i}),m.current.add(e)}),f()):u(!0)})()},[h,o,c,e,l,A,r,f]);const b=(0,M.A)(({direction:t})=>{t===a.TN.Backwards&&l&&g({chatId:e,messageId:l})});return h&&o&&l?(0,ie.FD)("div",{className:(0,pe.A)(Bv,"custom-scroll",h&&xv),children:[(0,ie.Y)(Av.A,{statistics:o,type:"message",title:c("StatisticOverview")}),(!m.current.size||!o.publicForwardsData)&&(0,ie.Y)(Ms.A,{}),(0,ie.Y)("div",{ref:d,children:Xv.map(e=>{const t=m.current.has(e)&&!p.current.has(e);return(0,ie.Y)("div",{className:(0,pe.A)(Ev,!t&&Vv)})})}),Boolean(o.publicForwards)&&(0,ie.FD)("div",{className:Lv,children:[(0,ie.Y)("h2",{className:Rv,children:c("Stats.Message.PublicShares")}),(0,ie.Y)(vs.A,{items:o.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:b,noFastList:!0,children:o.publicForwardsData.map(e=>(0,ie.Y)(qv,{data:e},e.messageId))})]})]},`${e}-${l}`):(0,ie.Y)(Ms.A,{})})),tg=(0,s.ph)(function({data:e,chatsById:t,usersById:i}){const s=(0,T.A)(),{openChat:a}=(0,n.ko)(),o=i[e.peerId],r=t[e.peerId],c=(0,M.A)(()=>{a({id:o.id})});return(0,ie.FD)("div",{className:(0,pe.A)(zv,"statistic-public-forward"),onClick:c,children:[(0,ie.Y)(Tt.A,{size:"medium",peer:o||r,withStorySolid:!0,forceUnreadStorySolid:!0}),(0,ie.FD)("div",{children:[(0,ie.Y)("div",{className:Hv,children:o?(0,l.Yg)(o):(0,l.Js)(s,r)}),(0,ie.Y)("div",{className:$v,children:e.viewsCount?s("ChannelStats.ViewsCount",e.viewsCount,"i"):s("NoViews")})]})]})});let ig,sg;const ng={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},ag=Object.keys(ng),og=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e),n=s.statistics.currentStory,a=s.statistics.currentStoryId,{byId:o}=e.users,{byId:r}=e.chats;return{statistics:n,dcId:i,storyId:a,usersById:o,chatsById:r}})(function({chatId:e,isActive:t,statistics:a,dcId:o,storyId:r,chatsById:l,usersById:c}){const d=(0,T.A)(),h=(0,s.li)(),[u,m]=(0,s.J0)(!1),p=(0,s.li)(new Set),v=(0,s.li)(new Set),{loadStoryStatistics:g,loadStoryPublicForwards:A,loadStatisticsAsyncGraph:f}=(0,n.ko)(),b=(0,D.A)();(0,s.vJ)(()=>{r&&g({chatId:e,storyId:r})},[e,r]),(0,s.vJ)(()=>{t&&!r||(p.current.clear(),v.current.clear(),m(!1))},[t,r]),(0,s.vJ)(()=>{a&&ag.forEach(t=>{const i=a[t];(0,gv.R)(i)&&"async"===i.graphType&&f({name:t,chatId:e,token:i.token})})},[e,a,f]),(0,s.vJ)(()=>{(async()=>{await async function(){return ig||(ig=i.e(4810).then(i.bind(i,24810)),sg=await ig),ig}(),u?a&&h.current&&(ag.forEach((e,t)=>{const i=a[e];if(!(0,gv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||p.current.has(e))return;if(n)return p.current.add(e),void v.current.add(e);const{zoomToken:r}=i;sg.create(h.current.children[t],{title:d(ng[e]),...r?{onZoom:e=>(0,Xe.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:o}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e)}),b()):m(!0)})()},[u,a,d,e,r,f,o,b]);const C=(0,M.A)(()=>{r&&A({chatId:e,storyId:r})});return u&&a&&r?(0,ie.FD)("div",{className:(0,pe.A)(Bv,"custom-scroll",u&&xv),children:[(0,ie.Y)(Av.A,{statistics:a,type:"story",title:d("StatisticOverview")}),!p.current.size&&(0,ie.Y)(Ms.A,{}),(0,ie.Y)("div",{ref:h,children:ag.map(e=>{const t=p.current.has(e)&&!v.current.has(e);return(0,ie.Y)("div",{className:(0,pe.A)(Ev,!t&&Vv)})})}),Boolean(a.publicForwards)&&(0,ie.FD)("div",{className:Lv,children:[(0,ie.Y)("h2",{className:Rv,children:d("Stats.Message.PublicShares")}),(0,ie.Y)(vs.A,{items:a.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:C,noFastList:!0,children:a.publicForwardsData.map(e=>"messageId"in e?(0,ie.Y)(qv,{data:e},`message_${e.messageId}`):(0,ie.Y)(tg,{data:e,chatsById:l,usersById:c},`story_${e.storyId}`))})]})]},`${e}-${r}`):(0,ie.Y)(Ms.A,{})}));var rg=i(55573);const lg=(0,s.ph)((0,n.EK)((e,{answer:t})=>{const{voters:i,offsets:s}=(0,c.nTw)(e).pollResults;return{voters:i?.[t.option],offset:s?.[t.option]||""}})(({chat:e,message:t,answer:i,answerVote:a,totalVoters:o,voters:r,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:h}=(0,n.ko)(),u=(0,U.A)(a.votersCount),[m,p]=(0,s.J0)(!0),g=Boolean(r),{option:A,text:f}=i,b=(0,T.A)();(0,s.vJ)(()=>{g&&u===a.votersCount||c({chat:e,messageId:t.id,option:A,offset:l,limit:4,shouldResetVoters:!0})},[a.votersCount,g]);const C=(0,s.hb)(()=>{p(!0),c({chat:e,messageId:t.id,option:A,offset:l,limit:50})},[e,c,t.id,l,A]);(0,s.vJ)(()=>{p(!1)},[r]);const y=(0,s.hb)(e=>{d({id:e}),h()},[h,d]);return(0,ie.FD)("div",{className:"PollAnswerResults",children:[(0,ie.FD)("div",{className:"poll-voters",children:[r?r.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable",onClick:()=>y(e),children:(0,v.L8)(e)?(0,ie.Y)(bs.A,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):(0,ie.Y)(fs.A,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0})},e)):(0,ie.Y)(Ms.A,{}),r&&function(){const e=a.votersCount-r.length;return a.votersCount>4&&e>0&&(0,ie.Y)(rg.A,{count:e,itemName:"voter",isLoading:m,onClick:C})}()]}),(0,ie.FD)("div",{className:"answer-head",dir:b.isRtl?"rtl":void 0,children:[(0,ie.Y)("span",{className:"answer-title",dir:"auto",children:(0,$i.fd)({text:f.text,entities:f.entities})}),(0,ie.FD)("span",{className:"answer-percent",dir:b.isRtl?"auto":void 0,children:[(S=a.votersCount,k=o,k>0?(S/k*100).toFixed():0),"%"]})]})]});var S,k})),cg=(0,s.ph)((0,n.EK)(e=>{const{pollResults:{chatId:t,messageId:i}}=(0,c.nTw)(e),s=t?(0,c.hds)(e,t):void 0,n=t&&i?(0,c.O5q)(e,t,i):void 0;return{chat:s,message:n,poll:n&&(0,c.zcZ)(e,n)}})(({isActive:e,chat:t,message:i,poll:s,onClose:n})=>{const a=(0,T.A)();if((0,ye.A)({isActive:e,onBack:n}),!i||!s||!t)return(0,ie.Y)(Ms.A,{});const{summary:o,results:r}=s;if(!r.results)return;const l=(0,pi.dU)(r.results,"option");return(0,ie.FD)("div",{className:"PollResults",dir:a.isRtl?"rtl":void 0,children:[(0,ie.Y)("h3",{className:"poll-question",dir:"auto",children:(0,$i.fd)({text:o.question.text,entities:o.question.entities})}),(0,ie.Y)("div",{className:"poll-results-list custom-scroll",children:o.answers.map(e=>(0,ie.Y)(lg,{chat:t,message:i,answer:e,answerVote:l[e.option],totalVoters:r.totalVoters},`${s.id}-${e.option}`))})]})}));var dg=i(90603);const hg="xrnUE4e6",ug="z7kF7tij",mg="T6wFpdQO",pg="CWsWIKQ1",vg="KBl0ycLl",gg="iJ1U9kDD",Ag="Rk6PT_yc",fg="qlo3vSEw",bg="r06zwL42",Cg=5*g.$,yg=(0,s.ph)((0,n.EK)(e=>{const{createTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,createTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(({isActive:e,chat:t,createTopicPanel:i,isCurrentUserPremium:a,onClose:r})=>{const{createTopic:l,openPremiumModal:c}=(0,n.ko)(),[d,h]=(0,s.J0)(""),[u,m]=(0,s.J0)(0),[p,v]=(0,s.J0)(void 0),g=(0,T.A)(),A=Boolean(d),f=Boolean(i?.isLoading);(0,ye.A)({isActive:e,onBack:r}),(0,s.vJ)(()=>{e||(h(""),v(void 0))},[e]);const b=(0,s.hb)(e=>{h(e.target.value)},[]),C=(0,s.hb)(()=>{m(e=>(0,wa.A)((0,dg.e$)().length,e+1))},[]),y=(0,s.hb)(()=>{l({chatId:t.id,title:d,iconColor:(0,dg.e$)()[u],iconEmojiId:p})},[t,l,u,p,d]),S=(0,s.hb)(e=>{e.isFree||a||e.id===o.MyF?e.id!==o.MyF?v(e.id):v(void 0):c({initialSection:"animated_emoji"})},[a,c]),k=(0,s.Kr)(()=>({id:0,title:d,iconColor:(0,dg.e$)()[u],iconEmojiId:p}),[u,p,d]);if(t?.isForum)return(0,ie.FD)("div",{className:hg,children:[(0,ie.FD)("div",{className:(0,pe.A)(ug,"custom-scroll"),children:[(0,ie.FD)("div",{className:(0,pe.A)(mg,pg),children:[(0,ie.Y)("span",{className:fg,children:g("CreateTopicTitle")}),(0,ie.Y)(ae.Ay,{name:"zoomFade",activeKey:Number(k.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:gg,children:(0,ie.Y)(Bs.A,{topic:k,className:(0,pe.A)(Ag,"K1CTKtBS"),onClick:C,size:Cg,noLoopLimit:!0})}),(0,ie.Y)(X.A,{value:d,onChange:b,label:g("lng_forum_topic_title"),disabled:f,teactExperimentControlled:!0})]}),(0,ie.Y)("div",{className:(0,pe.A)(mg,vg),children:(0,ie.Y)(Lr,{idPrefix:"create-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:S,className:bg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]}),(0,ie.Y)(bi.A,{isShown:A,disabled:f,onClick:y,ariaLabel:g("Save"),iconName:"check",isLoading:f})]})})),Sg=5*g.$,kg=(0,s.ph)((0,n.EK)(e=>{const{editTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,topic:t?.chatId&&t?.topicId?(0,c.S0q)(e,t.chatId,t.topicId):void 0,editTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(({isActive:e,chat:t,topic:i,editTopicPanel:a,isCurrentUserPremium:r,onClose:l})=>{const{editTopic:c,openPremiumModal:d}=(0,n.ko)(),[h,u]=(0,s.J0)(""),[m,p]=(0,s.J0)(void 0),v=(0,T.A)(),g=Boolean(a?.isLoading),A=i?.id===o.HxB;(0,ye.A)({isActive:e,onBack:l}),(0,s.vJ)(()=>{e||(u(""),p(void 0))},[e]),(0,s.vJ)(()=>{(i?.title||i?.iconEmojiId)&&(u(i.title),p(i.iconEmojiId))},[i]);const f=(0,s.Kr)(()=>h!==i?.title||m!==i?.iconEmojiId,[m,h,i?.iconEmojiId,i?.title]),b=(0,s.hb)(e=>{const t=e.target.value;u(t)},[]),C=(0,s.hb)(()=>{c({chatId:t.id,title:h,topicId:i.id,iconEmojiId:m})},[t,c,m,h,i]),y=(0,s.hb)(e=>{e.isFree||r||e.id===o.MyF?e.id!==o.MyF?p(e.id):p("0"):d({initialSection:"animated_emoji"})},[r,d]),S=(0,s.Kr)(()=>({...i,title:h,iconEmojiId:m}),[m,h,i]);if(t?.isForum)return(0,ie.FD)("div",{className:hg,children:[(0,ie.FD)("div",{className:(0,pe.A)(ug,"custom-scroll"),children:[!i&&(0,ie.Y)(Ms.A,{}),i&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:(0,pe.A)(mg,pg,A&&"YftUWqqw"),children:[(0,ie.Y)("span",{className:fg,children:v(A?"CreateGeneralTopicTitle":"CreateTopicTitle")}),(0,ie.Y)(ae.Ay,{name:"zoomFade",activeKey:Number(S.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:gg,children:(0,ie.Y)(Bs.A,{topic:S,className:Ag,size:Sg,noLoopLimit:!0})}),(0,ie.Y)(X.A,{value:h,onChange:b,label:v("lng_forum_topic_title"),disabled:g,teactExperimentControlled:!0})]}),!A&&(0,ie.Y)("div",{className:(0,pe.A)(mg,vg),children:(0,ie.Y)(Lr,{idPrefix:"edit-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:y,className:bg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]})]}),(0,ie.Y)(bi.A,{isShown:f,disabled:g,onClick:C,ariaLabel:v("Save"),iconName:"check",isLoading:g})]})})),Ng="Please provide name",wg=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=(0,c.yps)(e,t),s=(0,c.vGo)(e,t),{progress:n}=(0,c.nTw)(e).management,a=(0,la.d)(e,"aboutLength");return{userId:t,user:i,progress:n,currentBio:s?.bio,maxBioLength:a}})(({userId:e,user:t,progress:i,currentBio:o,isActive:r,maxBioLength:c,onClose:d})=>{const{setBotInfo:h,uploadProfilePhoto:u,uploadContactProfilePhoto:m,startBotFatherConversation:p}=(0,n.ko)(),[v,g,A]=(0,F.A)(!1),[f,b,C]=(0,F.A)(!1),[y,S]=(0,s.J0)(),k=(0,T.A)(),N=(0,s.Kr)(()=>t?(0,l.Kl)(t):void 0,[t]);(0,ye.A)({isActive:r,onBack:d});const w=t?(0,l.u0)(t):"",[I,P]=(0,s.J0)(),[Y,D]=(0,s.J0)(w||""),[B,L]=(0,s.J0)(o||""),R=t&&(0,l.cP)(t),x=(0,H.A)(R,!1,K.qZ.BlobUrl);(0,s.vJ)(()=>{A(),C()},[e]),(0,s.vJ)(()=>{D(w||""),L(o||"")},[w,o,t]),(0,s.vJ)(()=>{P(void 0)},[x]),(0,s.vJ)(()=>{i===a.TD.Complete&&(A(),C(),S(void 0))},[i]);const E=(0,M.A)(e=>{D(e.target.value),g(),y===Ng&&S(void 0)}),V=(0,M.A)(e=>{L(e.target.value),g()}),_=(0,M.A)(e=>{P(e),b()}),U=(0,M.A)(()=>{const e=Y.trim(),i=B.trim();e.length?(h({...v&&{bot:t,name:e,description:i}}),I&&u({file:I,...f&&{bot:t}})):S(Ng)}),O=(0,M.A)(()=>{p({param:`${N}-intro`})}),J=(0,M.A)(()=>{p({param:`${N}-commands`})}),G=(0,M.A)(()=>{p({param:N})}),j=(0,s.li)(),z=(0,s.li)(!1),$=(0,M.A)(t=>{b(),m({userId:e,file:t,isSuggest:z.current})});if(!t)return;const q=i===a.TD.InProgress;return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Ih.A,{currentAvatarBlobUrl:x,onChange:_,title:k("ChatSetPhotoOrVideo"),disabled:q}),(0,ie.Y)(X.A,{id:"user-name",label:k("PaymentCheckoutName"),onChange:E,value:Y,error:y===Ng?y:void 0,teactExperimentControlled:!0}),(0,ie.Y)(cn.A,{value:B,onChange:V,label:k("DescriptionPlaceholder"),disabled:q,maxLength:c,maxLengthIndicator:c?(c-B.length).toString():void 0})]}),(0,ie.Y)("div",{className:"section",children:(0,ie.FD)("div",{className:"dialog-buttons",children:[(0,ie.Y)(ui.A,{icon:"bot-commands-filled",ripple:!0,onClick:O,children:(0,ie.Y)("span",{children:k("BotEditIntro")})}),(0,ie.Y)(ui.A,{icon:"bot-command",ripple:!0,onClick:J,children:(0,ie.Y)("span",{children:k("BotEditCommands")})}),(0,ie.Y)(ui.A,{icon:"bots",ripple:!0,onClick:G,children:(0,ie.Y)("span",{children:k("BotChangeSettings")})}),(0,ie.Y)("div",{className:"section-info section-info_push",children:(0,Mt.A)(k("BotManageInfo"),["links"])})]})})]}),(0,ie.Y)(bi.A,{isShown:v||f,onClick:U,disabled:q,ariaLabel:k("Save"),iconName:"check",isLoading:q}),(0,ie.Y)(vu.A,{onChange:$,inputRef:j})]})})),Ig="Channel title can't be empty",Pg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{management:s}=(0,c.nTw)(e),{progress:n}=s,{invites:a}=s.byChatId[t]||{},o=e.appConfig.channelAutoTranslationLevelMin,r=i?.hasAutoTranslation,d=i?.level,h=!(!d||!o)&&d>=o;return{chat:i,chatFullInfo:(0,c.AWZ)(e,t),progress:n,canChangeInfo:(0,l.ub)(i,"changeInfo"),canInvite:(0,l.ub)(i,"inviteUsers"),exportedInvites:a,availableReactions:e.reactions.availableReactions,hasAutoTranslation:r,canToggleAutoTranslation:h}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:o,canChangeInfo:r,canInvite:d,exportedInvites:h,isActive:u,availableReactions:m,onScreenSelect:p,onClose:v,hasAutoTranslation:g,canToggleAutoTranslation:A})=>{const{updateChat:f,closeManagement:b,leaveChannel:C,deleteChannel:y,openChat:S,loadExportedChatInvites:k,loadChatJoinRequests:N,toggleAutoTranslation:w}=(0,n.ko)(),I=t?.title||"",P=i?.about||"",Y=Boolean(i?.linkedChatId),[D,B,L]=(0,F.A)(),[R,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)(I),[_,U]=(0,s.J0)(P),[O,J]=(0,s.J0)(),[G,j]=(0,s.J0)(),z=t&&(0,l.cP)(t),$=(0,H.A)(z,!1,K.qZ.BlobUrl),q=(0,T.A)(),W=t&&(0,l.WX)(t),Q=(0,M.A)(()=>{w({chatId:e,isEnabled:!g})});(0,ye.A)({isActive:u,onBack:v}),(0,s.vJ)(()=>{d&&(k({chatId:e}),k({chatId:e,isRevoked:!0}),N({chatId:e}))},[e,d]),(0,s.vJ)(()=>{o===a.TD.Complete&&(x(!1),j(void 0))},[o]);const Z=(0,s.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),ee=i?.kickedMembers?.length||0,te=(0,M.A)(()=>{p(a.je.ChatPrivacyType)}),se=(0,M.A)(()=>{p(a.je.Discussion)}),ne=(0,M.A)(()=>{p(a.je.Reactions)}),ae=(0,M.A)(()=>{p(a.je.ChatAdministrators)}),oe=(0,M.A)(()=>{p(a.je.Invites)}),re=(0,M.A)(()=>{p(a.je.JoinRequests)}),le=(0,M.A)(e=>{J(e),x(!0)}),ce=(0,M.A)(e=>{V(e.target.value),x(!0)}),de=(0,M.A)(e=>{U(e.target.value),x(!0)}),he=(0,M.A)(()=>{const t=E.trim(),i=_.trim();t.length?f({chatId:e,title:t,about:i,photo:O}):j(Ig)}),ue=(0,M.A)(()=>{p(a.je.ChannelSubscribers)}),me=(0,M.A)(()=>{p(a.je.ChannelRemovedUsers)}),pe=(0,M.A)(()=>{t.isCreator?y({chatId:t.id}):C({chatId:t.id}),L(),b(),S({id:void 0})}),ve=(0,s.Kr)(()=>{if(!i?.enabledReactions)return q("ReactionsOff");if("all"===i.enabledReactions.type)return q("ReactionsAll");const e=i.enabledReactions.allowed.length,t=m?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[m,i?.enabledReactions,q]),ge=(0,s.Kr)(()=>(0,l.gA)(t),[t]);if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const Ae=o===a.TD.InProgress;return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Ih.A,{currentAvatarBlobUrl:$,onChange:le,disabled:!r}),(0,ie.FD)("div",{className:"settings-edit",children:[(0,ie.Y)(X.A,{id:"channel-title",label:q("EnterChannelName"),onChange:ce,value:E,error:G===Ig?G:void 0,disabled:!r}),(0,ie.Y)(cn.A,{id:"channel-about",label:q("DescriptionPlaceholder"),onChange:de,value:_,maxLength:255,maxLengthIndicator:(255-_.length).toString(),disabled:!r,noReplaceNewlines:!0})]}),t.isCreator&&(0,ie.FD)(ui.A,{icon:"lock",multiline:!0,onClick:te,children:[(0,ie.Y)("span",{className:"title",children:q("ChannelType")}),(0,ie.Y)("span",{className:"subtitle",children:q(ge?"TypePublic":"TypePrivate")})]}),(0,ie.FD)(ui.A,{icon:"message",multiline:!0,onClick:se,disabled:!r,children:[(0,ie.Y)("span",{className:"title",children:q("Discussion")}),(0,ie.Y)("span",{className:"subtitle",children:q(Y?"DiscussionUnlink":"Add")})]}),d&&(0,ie.FD)(ui.A,{icon:"link",onClick:oe,multiline:!0,disabled:!h,children:[(0,ie.Y)("span",{className:"title",children:q("GroupInfo.InviteLinks")}),(0,ie.Y)("span",{className:"subtitle",children:h?(0,kn.Sm)(h.length):q("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ie.FD)(ui.A,{icon:"add-user-filled",onClick:re,multiline:!0,children:[(0,ie.Y)("span",{className:"title",children:q("SubscribeRequests")}),(0,ie.Y)("span",{className:"subtitle",children:(0,kn.Sm)(t.joinRequests.length)})]}),(0,ie.FD)(ui.A,{icon:"heart-outline",multiline:!0,onClick:ne,disabled:!r,children:[(0,ie.Y)("span",{className:"title",children:q("Reactions")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:ve})]}),W&&(0,ie.FD)(ui.A,{icon:"language",narrow:!0,ripple:!0,disabled:!A,onClick:Q,children:[(0,ie.Y)("span",{children:q("AutomaticTranslation")}),(0,ie.Y)(mi.A,{id:"auto-translation",label:q("AutomaticTranslation"),checked:g})]})]}),(0,ie.FD)("div",{className:"section",children:[(0,ie.FD)(ui.A,{icon:"admin",multiline:!0,onClick:ae,children:[(0,ie.Y)("span",{className:"title",children:q("ChannelAdministrators")}),(0,ie.Y)("span",{className:"subtitle",children:Z})]}),(0,ie.FD)(ui.A,{icon:"group",multiline:!0,onClick:ue,children:[(0,ie.Y)("span",{className:"title",dir:"auto",children:q("ChannelSubscribers")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:(0,kn.Sm)(t.membersCount)})]}),(0,ie.FD)(ui.A,{icon:"delete-user",multiline:!0,onClick:me,children:[(0,ie.Y)("span",{className:"title",children:q("ChannelBlockedUsers")}),(0,ie.Y)("span",{className:"subtitle",children:ee})]})]}),(0,ie.Y)("div",{className:"section",children:(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:B,children:t.isCreator?q("ChannelDelete"):q("LeaveChannel")})})]}),(0,ie.Y)(bi.A,{isShown:R,onClick:he,disabled:Ae,ariaLabel:q("Save"),iconName:"check",isLoading:Ae}),(0,ie.Y)(ci.A,{isOpen:D,onClose:L,text:t.isCreator?q("ChannelDeleteAlert"):q("ChannelLeaveAlert"),confirmLabel:t.isCreator?q("ChannelDelete"):q("LeaveChannel"),confirmHandler:pe,confirmIsDestructive:!0})]})})),Yg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,currentUserId:e.currentUserId,isChannel:i&&(0,l.WX)(i),adminMembersById:(0,c.AWZ)(e,t)?.adminMembersById}})(({isActive:e,chat:t,isChannel:i,currentUserId:o,adminMembersById:r,onScreenSelect:c,onChatMemberSelect:d,onClose:h})=>{const{toggleSignatures:u}=(0,n.ko)(),m=(0,T.A)();(0,ye.A)({isActive:e,onBack:h});const p=Boolean(t?.areSignaturesShown),v=Boolean(t?.areProfilesShown),g=Boolean(t?.isCreator||t&&(0,l.ub)(t,"addAdmins")),A=i&&(0,l.ub)(t,"postMessages"),f=(0,s.Kr)(()=>{if(!r)return[];const[e,t]=(0,pi.jB)(Object.values(r),e=>e.isOwner);return[...e,...t]},[r]),b=(0,M.A)(e=>{d(e.userId,e.promotedByUserId===o),c(a.je.ChatAdminRights)}),C=(0,M.A)(()=>{u({chatId:t.id,areProfilesEnabled:v,areSignaturesEnabled:!p})}),y=(0,M.A)(()=>{u({chatId:t.id,areProfilesEnabled:!v,areSignaturesEnabled:p})}),S=(0,M.A)(()=>{c(a.je.GroupAddAdmins)}),k=(0,M.A)(e=>{if(e.isOwner)return m("ChannelCreator");const t=(0,n.mS)().users.byId,i=e.promotedByUserId?t[e.promotedByUserId]:void 0;return i?m("EditAdminPromotedBy",(0,l.Yg)(i)):m("ChannelAdmin")});return(0,ie.Y)("div",{className:"Management",children:(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.Y)("div",{className:"section",children:(0,ie.FD)(ui.A,{icon:"recent",multiline:!0,disabled:!0,children:[(0,ie.Y)("span",{className:"title",children:m("EventLog")}),(0,ie.Y)("span",{className:"subtitle",children:m(i?"EventLogInfoDetailChannel":"EventLogInfoDetail")})]})}),(0,ie.FD)("div",{className:"section",dir:m.isRtl?"rtl":void 0,children:[(0,ie.Y)("p",{className:"section-help",dir:"auto",children:m(i?"Channel.Management.AddModeratorHelp":"Group.Management.AddModeratorHelp")}),f.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable",onClick:()=>b(e),children:(0,ie.Y)(bs.A,{userId:e.userId,status:k(e),forceShowSelf:!0})},e.userId)),(0,ie.Y)(bi.A,{isShown:g,onClick:S,ariaLabel:m("Channel.Management.AddModerator"),iconName:"add-user-filled"})]}),A&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("div",{className:"ListItem narrow",children:(0,ie.Y)(Qs.A,{checked:p,label:m("ChannelSignMessages"),onChange:C})}),p&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("div",{className:"ListItem narrow",children:(0,ie.Y)(Qs.A,{checked:v,label:m("ChannelSignMessagesWithProfile"),onChange:y})}),(0,ie.Y)("p",{className:"section-info section-info_push",children:m("ChannelSignProfilesInfo")})]})]})]})})})),Fg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{isUsernameAvailable:s,checkedUsername:n,error:a}=(0,c.YK)(e,t);return{chat:i,isChannel:(0,l.WX)(i),progress:(0,c.nTw)(e).management.progress,error:a,isUsernameAvailable:s,checkedUsername:n,isProtected:i?.isProtected,maxPublicLinks:(0,la.d)(e,"channelsPublic"),privateInviteLink:(0,c.AWZ)(e,t)?.inviteLink}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)&&(0,c.YK)(e,t)))(({chat:e,isActive:t,isChannel:i,progress:r,isUsernameAvailable:c,checkedUsername:d,error:h,isProtected:u,maxPublicLinks:m,privateInviteLink:p,onClose:v})=>{const{updatePublicLink:g,updatePrivateLink:A,toggleIsProtected:f,openLimitReachedModal:b,resetManagementError:C}=(0,n.ko)(),y=(0,s.Kr)(()=>e.usernames?.find(({isEditable:e})=>e),[e.usernames]),S=y?.username||"",k=(0,s.Kr)(()=>(0,l.gA)(e),[e]),[N,w]=(0,s.J0)(!1),[I,P]=(0,s.J0)(k?"public":"private"),[Y,D]=(0,s.J0)(),[M,B,L]=(0,F.A)(),[R,x,E]=(0,F.A)(),V=(0,U.A)(c),_=N&&Boolean("public"===I&&(Y||S&&""===Y)&&(c??V)||"private"===I&&k);(0,ye.A)({isActive:t,onBack:v}),(0,s.vJ)(()=>{w(!1)},[S]),(0,s.vJ)(()=>{I&&!p&&A()},[I,p,A]);const O=(0,s.hb)(t=>{D(t),w(!0),h&&C({chatId:e.id})},[e.id,h]),K=(0,s.hb)((e,t)=>{if(Object.values((0,n.mS)().chats.byId).filter(({isCreator:e,usernames:t})=>e&&t?.some(e=>e.isActive)).length>=m&&"public"===e){b({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}P(e),w(!0)},[m,b]),J=(0,s.hb)(t=>{f({chatId:e.id,isProtected:"protected"===t})},[e.id,f]),G=(0,s.hb)(()=>{k&&"private"===I?x():g({username:"public"===I&&Y||""})},[k,x,I,g,Y]),j=(0,s.hb)(()=>{g({username:"",shouldDisableUsernames:!0}),E()},[E,g]),z=(0,s.hb)(()=>{L(),A()},[L,A]),H=(0,T.A)(),$=i?"Channel":"Mega",q=i?"Channel":"Group",W=[{value:"private",label:H(`${$}Private`),subLabel:H(`${$}PrivateInfo`)},{value:"public",label:H(`${$}Public`),subLabel:H(`${$}PublicInfo`)}],Q=[{value:"allowed",label:H("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:H("ChannelVisibility.Forwarding.Disabled")}],Z=r===a.TD.InProgress,X="public"===I&&e.usernames&&e.usernames.length>0;return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,ie.Y)("h3",{className:"section-heading",children:H(`${q}Type`)}),(0,ie.Y)(te.A,{selected:I,name:"channel-type",options:W,onChange:K})]}),"private"===I?(0,ie.Y)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:p?(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(jr.A,{link:p,className:"invite-link"}),(0,ie.Y)("p",{className:"section-info",dir:H.isRtl?"rtl":void 0,children:H(`${$}PrivateLinkHelp`)}),(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:B,children:H("RevokeLink")}),(0,ie.Y)(ci.A,{isOpen:M,onClose:L,text:H("RevokeAlert"),confirmLabel:H("RevokeButton"),confirmHandler:z,confirmIsDestructive:!0})]}):(0,ie.Y)(Ms.A,{})}):(0,ie.FD)("div",{className:"section no-border",children:[(0,ie.Y)("div",{className:"settings-input",children:(0,ie.Y)(wh,{asLink:!0,currentUsername:S,isLoading:Z,isUsernameAvailable:c,checkedUsername:d,onChange:O})}),h===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,ie.Y)("p",{className:"section-info",dir:"auto",children:H("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,ie.Y)(cl.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,ie.Y)("p",{className:"section-info",dir:"auto",children:H(`${q}.Username.CreatePublicLinkHelp`)})]}),X&&(0,ie.Y)(yh,{chatId:e.id,usernames:e.usernames,onEditUsername:O}),(0,ie.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,ie.Y)("h3",{className:"section-heading",children:H(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")}),(0,ie.Y)(te.A,{selected:u?"protected":"allowed",name:"forwarding-type",options:Q,onChange:J}),(0,ie.Y)("p",{className:"section-info section-info_push",children:H(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")})]})]}),(0,ie.Y)(bi.A,{isShown:_,disabled:Z,ariaLabel:H("Save"),onClick:G,iconName:"check",isLoading:Z}),(0,ie.Y)(ci.A,{isOpen:R,onClose:E,text:H("ChannelVisibility.Confirm.MakePrivate.Channel",S),confirmHandler:j,confirmIsDestructive:!0})]})})),Dg=(0,s.ph)((0,n.EK)((e,{chat:t})=>{const{currentUserId:i}=e;return{currentUserId:i,chatMembers:(0,c.AWZ)(e,t.id)?.members}})(({chat:e,currentUserId:t,chatMembers:i,isOpen:a,onClose:o})=>{const{loadMoreMembers:r,deleteChatMember:l}=(0,n.ko)(),c=(0,T.A)(),[d,h]=(0,s.J0)(""),u=(0,s.Kr)(()=>{const e=(i||[]).reduce((e,i)=>(i.isAdmin||i.isOwner||i.userId===t||e.push(i.userId),e),[]);return(0,Dt.PU)({ids:e,query:d,type:"user"})},[i,t,d]),m=(0,M.A)(()=>{r({chatId:e.id})}),p=(0,M.A)(t=>{l({chatId:e.id,userId:t}),o()});return(0,ie.Y)(Es,{isOpen:a,chatOrUserIds:u,searchPlaceholder:c("ChannelBlockUser"),search:d,onSearchChange:h,loadMore:m,onSelectChatOrUser:p,onClose:o})})),Mg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s}=e.users;return{chat:i,usersById:s,canDeleteMembers:i&&((0,l.ub)(i,"banUsers")||i.isCreator),removedMembers:(0,c.AWZ)(e,t)?.kickedMembers||vi.p,isChannel:i&&(0,l.WX)(i)}})(({chat:e,usersById:t,canDeleteMembers:i,removedMembers:a,isChannel:o,onClose:r,isActive:c})=>{const{updateChatMemberBannedRights:d}=(0,n.ko)(),h=(0,T.A)(),[u,m,p]=(0,F.A)();(0,ye.A)({isActive:c,onBack:r});const v=(0,s.hb)(e=>{if(!e.kickedByUserId)return;const i=t[e.kickedByUserId];return i?h("UserRemovedBy",(0,l.Yg)(i)):void 0},[h,t]),g=(0,s.hb)(t=>{if(e)return[{title:h("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[h,e,d]);return(0,ie.Y)("div",{className:"Management",children:(0,ie.Y)("div",{className:"panel-content custom-scroll",children:(0,ie.FD)("div",{className:"section",dir:h.isRtl?"rtl":void 0,children:[(0,ie.Y)("p",{className:"section-help",children:h(o?"NoBlockedChannel2":"NoBlockedGroup2")}),a.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable",ripple:!0,contextActions:g(e),children:(0,ie.Y)(bs.A,{userId:e.userId,status:v(e),forceShowSelf:!0})},e.userId)),i&&(0,ie.Y)(bi.A,{isShown:!0,onClick:m,ariaLabel:h("Channel.EditAdmin.Permission.BanUsers"),iconName:"add-user-filled"}),e&&i&&(0,ie.Y)(Dg,{chat:e,isOpen:u,onClose:p})]})})})})),Tg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{linkedChatId:s}=(0,c.AWZ)(e,t)||{},{forDiscussionIds:n,byId:a}=e.chats;return{chat:i,chatsByIds:a,forDiscussionIds:n,linkedChat:s?(0,c.hds)(e,s):void 0,isChannel:i&&(0,l.WX)(i)}})(({chat:e,onClose:t,isActive:i,chatId:r,chatsByIds:c,linkedChat:d,forDiscussionIds:h,isChannel:u,onScreenSelect:m})=>{const{loadGroupsForDiscussion:p,linkDiscussionGroup:v,unlinkDiscussionGroup:g,toggleJoinRequest:A,toggleJoinToSend:f}=(0,n.ko)(),[b,C]=(0,s.J0)(),[y,S,k]=(0,F.A)(),[N,w,I]=(0,F.A)(),[P,Y]=(0,s.J0)(Boolean(d?.isJoinToSend)),[D,B]=(0,s.J0)(Boolean(d?.isJoinRequest)),L=(0,T.A)(),R=d?.id;(0,ye.A)({isActive:i,onBack:t}),(0,s.vJ)(()=>{p()},[p]),(0,s.vJ)(()=>{i&&(Y(d?.isJoinToSend||!1),B(d?.isJoinRequest||!1))},[d,i]);const x=(0,s.hb)(()=>{k(),g({channelId:u?r:R}),u||m(a.je.Initial)},[k,g,u,r,R,m]),E=(0,s.hb)(()=>{I(),v({channelId:r,chatId:b})},[I,v,r,b]),V=(0,s.hb)(e=>{Y(e),f({chatId:R,isEnabled:e}),e||B(!1)},[R,f]),_=(0,s.hb)(e=>{B(e),A({chatId:R,isEnabled:e})},[R,A]);const U=(0,M.A)(()=>{m(a.je.NewDiscussionGroup)});return(0,ie.Y)("div",{className:"Management",children:(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.DiscussionGroups,size:o.Uyp,className:"section-icon"}),d&&(0,ie.FD)("div",{children:[d&&(0,ie.Y)(ui.A,{className:"chat-item-clickable",inactive:!0,children:(0,ie.Y)(fs.A,{chatId:d.id})}),(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")}),(0,ie.Y)(ci.A,{isOpen:y,onClose:k,header:(0,ie.FD)("div",{className:"modal-header",children:[(0,ie.Y)(Tt.A,{size:"tiny",peer:d}),(0,ie.Y)("div",{className:"modal-title",children:L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")})]}),textParts:(0,Mt.A)(L(u?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",d?.title),["br","simple_markdown"]),confirmLabel:L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:x,confirmIsDestructive:!0})]}),!d&&(0,ie.FD)("div",{children:[(0,ie.Y)("p",{className:"section-help",dir:"auto",children:L("DiscussionChannelHelp")}),(0,ie.FD)("div",{teactFastList:!0,children:[(0,ie.Y)(ui.A,{icon:"group",ripple:!0,className:"create-item",withPrimaryColor:!0,teactOrderKey:0,onClick:U,children:L("DiscussionCreateGroup")},"create-group"),h?h.map((e,t)=>(0,ie.Y)(ui.A,{teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{C(e),w()},children:(0,ie.Y)(fs.A,{chatId:e})},e)):(0,ie.Y)(Nc.A,{teactOrderKey:0,text:"No discussion groups found"},"nothing-found")]}),(0,ie.Y)("p",{className:"mt-4 mb-0 section-help",dir:"auto",children:L("DiscussionChannelHelp2")}),(0,ie.Y)(ci.A,{isOpen:N,onClose:I,header:function(){if(!b)return;const e=c[b];return e?(0,ie.FD)("div",{className:"modal-header",children:[(0,ie.Y)(Tt.A,{size:"tiny",peer:e}),(0,ie.Y)("div",{className:"modal-title",children:L("Channel.DiscussionGroup.LinkGroup")})]}):void 0}(),textParts:function(){if(!b)return;const t=c[b];return t?(0,l.gA)(t)?(0,Mt.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?`,["br","simple_markdown"]):(0,Mt.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"]):void 0}(),confirmLabel:L("DiscussionLinkGroup"),confirmHandler:E})]})]}),d&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("h3",{className:"section-heading",children:L("ChannelSettingsJoinTitle")}),(0,ie.Y)("div",{className:"ListItem narrow",children:(0,ie.Y)(Qs.A,{checked:P,onCheck:V,label:L("ChannelSettingsJoinToSend")})}),P&&(0,ie.Y)("div",{className:"ListItem narrow",children:(0,ie.Y)(Qs.A,{checked:D,onCheck:_,label:L("ChannelSettingsJoinRequest")})}),(0,ie.Y)("p",{className:"section-info section-info_push",children:L(P?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")})]})]})})})),Bg="Group title can't be empty",Lg=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],Rg=Lg.length+1,xg=(0,Ae.sg)(e=>e(),500,!1),Eg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{management:n,limitReachedModal:a}=(0,c.nTw)(e),{progress:o}=n,r=Boolean(s?.linkedChatId),d=(0,l.yn)(i),{invites:h}=n.byChatId[t]||{},u=!r&&((0,l.ub)(i,"changeInfo")||i.isCreator);return{chat:i,chatFullInfo:s,progress:o,isBasicGroup:d,hasLinkedChannel:r,canChangeInfo:i.isCreator||(0,l.ub)(i,"changeInfo"),canBanUsers:i.isCreator||(0,l.ub)(i,"banUsers"),canInvite:i.isCreator||(0,l.ub)(i,"inviteUsers"),exportedInvites:h,isChannelsPremiumLimitReached:"channels"===a?.limit,availableReactions:e.reactions.availableReactions,canEditForum:u}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:o,isBasicGroup:r,hasLinkedChannel:d,canChangeInfo:h,canBanUsers:u,canInvite:m,canEditForum:p,isActive:v,exportedInvites:g,isChannelsPremiumLimitReached:A,availableReactions:f,onScreenSelect:b,onClose:C})=>{const{togglePreHistoryHidden:y,updateChat:S,deleteChat:k,leaveChannel:N,deleteChannel:w,closeManagement:I,openChat:P,loadExportedChatInvites:Y,loadChatJoinRequests:D,toggleForum:B}=(0,n.ko)(),[L,R,x]=(0,F.A)(),E=t.title,V=i?.about||"",[_,U]=(0,s.J0)(!1),[O,J]=(0,s.J0)(E),[G,j]=(0,s.J0)(V),[z,$]=(0,s.J0)(),[q,W]=(0,s.J0)(),[Q,Z]=(0,s.J0)(t.isForum),ee=(0,l.cP)(t),te=(0,H.A)(ee,!1,K.qZ.BlobUrl),se=(0,s.Kr)(()=>(0,l.gA)(t),[t]),ne=(0,T.A)(),ae=(0,s.li)();(0,ye.A)({isActive:v,onBack:C}),(0,s.vJ)(()=>{m&&(Y({chatId:e}),Y({chatId:e,isRevoked:!0}),D({chatId:e}))},[e,m]),(0,s.vJ)(()=>{Z(Boolean(t.isForum))},[t.isForum]),(0,s.vJ)(()=>{o===a.TD.Complete&&(U(!1),W(void 0))},[o]);const oe=(0,M.A)(()=>{b(a.je.ChatPrivacyType)}),re=(0,M.A)(()=>{b(a.je.Discussion)}),le=(0,M.A)(()=>{b(a.je.Reactions)}),ce=(0,M.A)(()=>{b(a.je.GroupPermissions)}),de=(0,M.A)(()=>{b(a.je.ChatAdministrators)}),he=(0,M.A)(()=>{b(a.je.Invites)}),ue=(0,M.A)(()=>{b(a.je.JoinRequests)}),me=(0,M.A)(e=>{$(e),U(!0)}),pe=(0,M.A)(e=>{J(e.target.value),U(!0)}),ve=(0,M.A)(e=>{j(e.target.value),U(!0)}),ge=(0,M.A)(()=>{const t=O.trim(),i=G.trim();t.length?S({chatId:e,title:t,about:i,photo:z}):W(Bg)}),Ae=(0,M.A)(()=>{b(a.je.GroupMembers)}),fe=(0,M.A)(()=>{if(!i)return;const{isPreHistoryHidden:e}=i;y({chatId:t.id,isEnabled:!e})}),be=(0,M.A)(()=>{Z(t=>{const i=!t;return xg(()=>{B({chatId:e,isEnabled:i})}),i})});(0,s.vJ)(()=>{if(!A)return;const e=ae.current?.querySelector("input");e.checked=!i?.isPreHistoryHidden},[A,i?.isPreHistoryHidden]);const Ce=(0,s.Kr)(()=>{if(!i?.enabledReactions)return ne("ReactionsOff");if("all"===i.enabledReactions.type)return ne("ReactionsAll");const e=i.enabledReactions.allowed.length,t=f?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[f,i?.enabledReactions,ne]),Se=(0,s.Kr)(()=>{if(!t.defaultBannedRights)return 0;let e=Lg.filter(e=>!("manageTopics"===e&&!Q||t.defaultBannedRights[e])).length;const{sendStickers:i,sendGifs:s}=t.defaultBannedRights;return i||s||(e+=1),e},[t.defaultBannedRights,Q]),ke=(0,s.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),Ne=(0,M.A)(()=>{r?k({chatId:t.id}):t.isCreator?w({chatId:t.id}):N({chatId:t.id}),x(),I(),P({id:void 0})});if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const we=o===a.TD.InProgress;return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Ih.A,{isForForum:Q,currentAvatarBlobUrl:te,onChange:me,disabled:!h}),(0,ie.FD)("div",{className:"settings-edit",children:[(0,ie.Y)(X.A,{id:"group-title",label:ne("GroupName"),onChange:pe,value:O,error:q===Bg?q:void 0,disabled:!h}),(0,ie.Y)(cn.A,{id:"group-about",label:ne("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-G.length).toString(),onChange:ve,value:G,disabled:!h,noReplaceNewlines:!0})]}),t.isCreator&&(0,ie.FD)(ui.A,{icon:"lock",multiline:!0,onClick:oe,children:[(0,ie.Y)("span",{className:"title",children:ne("GroupType")}),(0,ie.Y)("span",{className:"subtitle",children:ne(se?"TypePublic":"TypePrivate")})]}),d&&(0,ie.FD)(ui.A,{icon:"message",multiline:!0,onClick:re,children:[(0,ie.Y)("span",{className:"title",children:ne("LinkedChannel")}),(0,ie.Y)("span",{className:"subtitle",children:ne("DiscussionUnlink")})]}),(0,ie.FD)(ui.A,{icon:"permissions",multiline:!0,onClick:ce,disabled:!u,children:[(0,ie.Y)("span",{className:"title",children:ne("ChannelPermissions")}),(0,ie.FD)("span",{className:"subtitle",dir:"auto",children:[Se,"/",Rg-(Q?0:1)]})]}),(0,ie.FD)(ui.A,{icon:"heart-outline",multiline:!0,onClick:le,disabled:!h,children:[(0,ie.Y)("span",{className:"title",children:ne("Reactions")}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:Ce})]}),(0,ie.FD)(ui.A,{icon:"admin",multiline:!0,onClick:de,children:[(0,ie.Y)("span",{className:"title",children:ne("ChannelAdministrators")}),(0,ie.Y)("span",{className:"subtitle",children:(0,kn.Sm)(ke)})]}),m&&(0,ie.FD)(ui.A,{icon:"link",onClick:he,multiline:!0,disabled:!g,children:[(0,ie.Y)("span",{className:"title",children:ne("GroupInfo.InviteLinks")}),(0,ie.Y)("span",{className:"subtitle",children:g?(0,kn.Sm)(g.length):ne("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ie.FD)(ui.A,{icon:"add-user-filled",onClick:ue,multiline:!0,children:[(0,ie.Y)("span",{className:"title",children:ne("MemberRequests")}),(0,ie.Y)("span",{className:"subtitle",children:(0,kn.Sm)(t.joinRequests.length)})]}),p&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)(ui.A,{icon:"forums",ripple:!0,onClick:be,children:[(0,ie.Y)("span",{children:ne("ChannelTopics")}),(0,ie.Y)(mi.A,{id:"group-notifications",label:ne("ChannelTopics"),checked:Q,inactive:!0})]}),(0,ie.Y)("div",{className:"section-info section-info_push",children:ne("ForumToggleDescription")})]})]}),(0,ie.FD)("div",{className:"section",children:[(0,ie.FD)(ui.A,{icon:"group",multiline:!0,onClick:Ae,children:[(0,ie.Y)("span",{className:"title",children:ne("GroupMembers")}),(0,ie.Y)("span",{className:"subtitle",children:(0,kn.Sm)(t.membersCount??0)})]}),!se&&!d&&Boolean(i)&&(0,ie.Y)("div",{className:"ListItem narrow",ref:ae,children:(0,ie.Y)(Qs.A,{className:"align-checkbox-with-list-buttons",checked:!i.isPreHistoryHidden,label:ne("ChatHistory"),onChange:fe,subLabel:i.isPreHistoryHidden?ne("ChatHistoryHiddenInfo2"):ne("ChatHistoryVisibleInfo"),disabled:!u})})]}),(0,ie.Y)("div",{className:"section",children:(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:R,children:ne("DeleteMega")})})]}),(0,ie.Y)(bi.A,{isShown:_,onClick:ge,disabled:we,ariaLabel:ne("Save"),iconName:"check",isLoading:we}),(0,ie.Y)(ci.A,{isOpen:L,onClose:x,textParts:(0,Mt.A)(r||!t.isCreator?ne("AreYouSureDeleteAndExit"):ne("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:r||!t.isCreator?ne("DeleteMega"):ne("DeleteGroupForAll"),confirmHandler:Ne,confirmIsDestructive:!0})]})})),Vg=(0,s.ph)((0,n.EK)((e,{chatId:t,isPromotedByCurrentUser:i})=>{const s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t),{byId:a}=e.users,{currentUserId:o}=e,r=(0,l.WX)(s),d=!(s.isCreator||i);return{chat:s,usersById:a,currentUserId:o,isChannel:r,isForum:s.isForum,isFormFullyDisabled:d,defaultRights:s.adminRights,hasFullInfo:Boolean(n),adminMembersById:n?.adminMembersById}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({isActive:e,isNewAdmin:t,selectedUserId:i,defaultRights:o,chat:r,usersById:c,currentUserId:d,adminMembersById:h,hasFullInfo:u,isChannel:m,isForum:p,isFormFullyDisabled:v,onClose:g,onScreenSelect:A})=>{const{updateChatAdmin:f}=(0,n.ko)(),[b,C]=(0,s.J0)({}),[y,S]=(0,s.J0)(Boolean(t)),[k,N]=(0,s.J0)(!1),[w,I,P]=(0,F.A)(),[Y,D]=(0,s.J0)(""),M=(0,T.A)();(0,ye.A)({isActive:e,onBack:g});const B=(0,s.Kr)(()=>{const e=i?h?.[i]:void 0;if(!t||!e&&i){if(t){const e=(0,n.mS)().users.byId[i];return e?{userId:e.id,adminRights:o,customTitle:M("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return e}},[h,o,t,M,i]);(0,s.vJ)(()=>{u&&i&&!B&&A(a.je.ChatAdministrators)},[r,u,A,B,i]),(0,s.vJ)(()=>{C(B?.adminRights||{}),D((B?.customTitle||"").substr(0,16)),S(Boolean(t)),N(!1)},[o,t,B]);const L=(0,s.hb)(e=>{const{name:t}=e.target;C(e=>{return{...e,[t]:(i=e[t],!i||void 0)};var i}),S(!0)},[]),R=(0,s.hb)(()=>{i&&(N(!0),f({chatId:r.id,userId:i,adminRights:b,customTitle:Y}))},[i,f,r.id,b,Y]),x=(0,s.hb)(()=>{i&&(f({chatId:r.id,userId:i,adminRights:{}}),P())},[r.id,P,i,f]),E=(0,s.hb)(e=>!((0,l.yn)(r)||!v&&r.adminRights&&(r.isCreator||r.adminRights[e])),[r,v]),V=(0,s.Kr)(()=>{if(t||!B)return;if(B.isOwner)return M("ChannelCreator");const e=B.promotedByUserId?c[B.promotedByUserId]:void 0;return e?M("EditAdminPromotedBy",(0,l.Yg)(e)):M("ChannelAdmin")},[t,B,c,M]),_=(0,s.hb)(e=>{const{value:t}=e.target;D(t),S(!0)},[]);if(B)return(0,ie.FD)("div",{className:"Management",children:[(0,ie.Y)("div",{className:"panel-content custom-scroll",children:(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ie.Y)(bs.A,{userId:B.userId,status:V,forceShowSelf:!0})}),(0,ie.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:M("EditAdminWhatCanDo")}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"changeInfo",checked:Boolean(b.changeInfo),label:M(m?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:E("changeInfo"),onChange:L})}),m&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"postMessages",checked:Boolean(b.postMessages),label:M("EditAdminPostMessages"),blocking:!0,disabled:E("postMessages"),onChange:L})}),m&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"editMessages",checked:Boolean(b.editMessages),label:M("EditAdminEditMessages"),blocking:!0,disabled:E("editMessages"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"deleteMessages",checked:Boolean(b.deleteMessages),label:M(m?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:E("deleteMessages"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"postStories",checked:Boolean(b.postStories),label:M("EditAdminPostStories"),blocking:!0,disabled:E("postStories"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"editStories",checked:Boolean(b.editStories),label:M("EditAdminEditStories"),blocking:!0,disabled:E("editStories"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"deleteStories",checked:Boolean(b.deleteStories),label:M("EditAdminDeleteStories"),blocking:!0,disabled:E("deleteStories"),onChange:L})}),!m&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"banUsers",checked:Boolean(b.banUsers),label:M("EditAdminBanUsers"),blocking:!0,disabled:E("banUsers"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"inviteUsers",checked:Boolean(b.inviteUsers),label:M("EditAdminAddUsers"),blocking:!0,disabled:E("inviteUsers"),onChange:L})}),!m&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"pinMessages",checked:Boolean(b.pinMessages),label:M("EditAdminPinMessages"),blocking:!0,disabled:E("pinMessages"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"addAdmins",checked:Boolean(b.addAdmins),label:M("EditAdminAddAdmins"),blocking:!0,disabled:E("addAdmins"),onChange:L})}),(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"manageCall",checked:Boolean(b.manageCall),label:M("StartVoipChatPermission"),blocking:!0,disabled:E("manageCall"),onChange:L})}),p&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"manageTopics",checked:Boolean(b.manageTopics),label:M("ManageTopicsPermission"),blocking:!0,disabled:E("manageTopics"),onChange:L})}),!m&&(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:"anonymous",checked:Boolean(b.anonymous),label:M("EditAdminSendAnonymously"),blocking:!0,disabled:E("anonymous"),onChange:L})}),v&&(0,ie.Y)("p",{className:"section-info mb-4",dir:"auto",children:M("Channel.EditAdmin.CannotEdit")}),!m&&(0,ie.Y)(X.A,{id:"admin-title",label:M("EditAdminRank"),onChange:_,value:Y,disabled:v,maxLength:16}),d!==i&&!v&&!t&&(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:I,children:M("EditAdminRemoveAdmin")})]})}),(0,ie.Y)(bi.A,{isShown:y,onClick:R,ariaLabel:M("Save"),disabled:k,iconName:"check",isLoading:k}),!t&&(0,ie.Y)(ci.A,{isOpen:w,onClose:P,text:"Are you sure you want to dismiss this admin?",confirmLabel:M("Channel.Admin.Dismiss"),confirmHandler:x,confirmIsDestructive:!0})]})}));var _g=i(23459),Ug=i(285);const Og=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{statusesById:s}=e.users,{members:n,adminMembersById:a,areParticipantsHidden:o}=(0,c.AWZ)(e,t)||{},r=i&&(0,l.WX)(i),{userIds:d}=e.contactList||{},h=e.appConfig.hiddenMembersMinCount,u=i&&(i.isCreator||(0,l.ub)(i,"banUsers")),m=u&&!(0,l.yn)(i)&&void 0!==i.membersCount&&void 0!==h&&i.membersCount>=h,p=i&&((0,l.ub)(i,"inviteUsers")||!r&&!(0,l.Sq)(i,"inviteUsers")||i.isCreator),{query:v,fetchingStatus:g,globalUserIds:A,localUserIds:f}=(0,c.nTw)(e).userSearch;return{areParticipantsHidden:Boolean(i&&o),members:n,canAddMembers:p,adminMembersById:a,userStatusesById:s,isChannel:r,localContactIds:d,searchQuery:v,isSearching:g,globalUserIds:A,localUserIds:f,canDeleteMembers:u,currentUserId:e.currentUserId,canHideParticipants:m}})(({chatId:e,noAdmins:t,members:i,canAddMembers:o,adminMembersById:r,userStatusesById:c,isChannel:d,isActive:h,globalUserIds:u,localContactIds:m,localUserIds:p,isSearching:v,searchQuery:g,currentUserId:A,canDeleteMembers:f,areParticipantsHidden:b,canHideParticipants:C,onClose:y,onScreenSelect:S,onChatMemberSelect:k})=>{const{openChat:N,setUserSearchQuery:w,closeManagement:I,toggleParticipantsHidden:P,setNewChatMembersDialogState:Y,toggleManagement:F}=(0,n.ko)(),D=(0,T.A)(),B=(0,s.li)(),L=(0,s.li)(),[R,x]=(0,s.J0)(),E=(0,s.Kr)(()=>t&&r?Object.keys(r):[],[r,t]),V=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;if(!i||!e)return[];const s=(0,l.UB)(i.map(({userId:e})=>e),e,c);return t?s.filter(e=>!E.includes(e)):s},[i,c,t,E]);(0,_g.A)(V);const _=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,i=Boolean(g),s=i?m?(0,Dt.PU)({ids:m,query:g,type:"user"}):[]:V;return(0,Is.A)((0,pi.Am)([...s,...i&&p||[],...i&&u||[]]).filter(i=>{const s=e[i];return!s||(d||s.canBeInvitedToGroup||!(0,l.tv)(s))&&(!t||!E.includes(i))}),!0)},[V,m,g,p,u,d,t,E]),[U,O]=(0,Ys.A)(void 0,_,Boolean(g)),K=(0,M.A)(e=>{t?(k(e,!0),S(a.je.ChatNewAdminRights)):(I(),N({id:e}))}),J=(0,M.A)(e=>{w({query:e.target.value})}),G=(0,Ds.A)(L,h,e=>{U&&U.length>0&&K(U[-1===e?0:e])},".ListItem-button",!0),j=(0,M.A)(()=>{x(void 0)}),z=(0,M.A)(()=>{P({chatId:e,isEnabled:!b})}),H=(0,M.A)(()=>{F(),Y({newChatMembersProgress:a.D7.InProgress})});return(0,ye.A)({isActive:h,onBack:y}),(0,ie.FD)("div",{className:"Management",children:[t&&(0,ie.Y)("div",{className:"Management__filter",dir:D.isRtl?"rtl":void 0,children:(0,ie.Y)(X.A,{ref:B,value:g,onChange:J,placeholder:D("Search")})}),(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[C&&!d&&(0,ie.FD)("div",{className:"section",children:[(0,ie.FD)(ui.A,{icon:"group",ripple:!0,onClick:z,children:[(0,ie.Y)("span",{children:D("ChannelHideMembers")}),(0,ie.Y)(mi.A,{label:D("ChannelHideMembers"),checked:b})]}),(0,ie.Y)("p",{className:"section-info",children:D(b?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff")})]}),(0,ie.Y)("div",{className:"section",children:U?.length?(0,ie.Y)(vs.A,{className:"picker-list custom-scroll",items:_,onLoadMore:O,noScrollRestore:Boolean(g),ref:L,onKeyDown:G,children:U.map(e=>{return(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item",onClick:()=>K(e),contextActions:(t=e,t!==A&&f?[{title:D("lng_context_remove_from_group"),icon:"stop",handler:()=>{x(t)}}]:void 0),withPortalForMenu:!0,children:(0,ie.Y)(bs.A,{userId:e,forceShowSelf:!0,withStory:!0})},e);var t})}):v||!U||U.length?(0,ie.Y)(Ms.A,{}):(0,ie.Y)(Nc.A,{teactOrderKey:0,text:d?"No subscribers found":"No members found"},"nothing-found")})]}),o&&(0,ie.Y)(bi.A,{isShown:!0,onClick:H,ariaLabel:D("lng_channel_add_users"),iconName:"add-user-filled"}),f&&(0,ie.Y)(Ug.A,{isOpen:Boolean(R),userId:R,onClose:j})]})})),Kg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{progress:n}=(0,c.nTw)(e).management,a=i?.paidMessagesStars,r=e.appConfig.starsPaidMessageCommissionPermille;return{chat:i,progress:n,currentUserId:e.currentUserId,removedUsersCount:s?.kickedMembers?.length||0,members:s?.members,arePaidMessagesAvailable:Boolean(s?.arePaidMessagesAvailable&&r),canChargeForMessages:Boolean(a&&r),groupPeersPaidStars:a||o.wZe}})(({onScreenSelect:e,onChatMemberSelect:t,chat:i,progress:o,currentUserId:r,removedUsersCount:l,members:c,onClose:d,isActive:h,arePaidMessagesAvailable:u,canChargeForMessages:m,groupPeersPaidStars:p})=>{const{updateChatDefaultBannedRights:v,updatePaidMessagesPrice:g}=(0,n.ko)(),{permissions:A,havePermissionChanged:f,isLoading:b,handlePermissionChange:C,setIsLoading:y}=Ul(i?.defaultBannedRights),S=(0,T.A)(),k=(0,Ri.A)();(0,ye.A)({isActive:h,onBack:d});const N=(0,s.hb)(()=>{e(a.je.GroupRemovedUsers)},[e]),w=(0,s.hb)(()=>{e(a.je.GroupUserPermissionsCreate)},[e]),I=(0,s.hb)(i=>{t(i.userId,i.promotedByUserId===r),e(a.je.GroupUserPermissions)},[r,t,e]),[P,Y]=(0,s.J0)(!1),[D,B,L]=(0,F.A)(),[R,x]=(0,s.J0)(m),[E,V]=(0,s.J0)(p);(0,s.vJ)(()=>{o===a.TD.Complete&&L()},[o]);const _=(0,M.A)(()=>{i&&(y(!0),v({chatId:i.id,bannedRights:A}))}),U=(0,M.A)(()=>{i&&g({chatId:i?.id,paidMessagesStars:R?E:0})}),O=(0,M.A)(()=>{D&&U(),f&&_()}),K=(0,s.Kr)(()=>c?c.filter(({bannedRights:e})=>Boolean(e)):[],[c]),J=(0,s.hb)(e=>{const{bannedRights:t}=e;if(!t||!i)return;const{defaultBannedRights:s}=i;return Object.keys(t).reduce((e,i)=>{const n=i;if(!t[n]||s?.[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)return e;const a=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";case"manageTopics":return"GroupPermission.NoManageTopics";case"sendPlain":return"UserRestrictionsNoSendText";case"sendDocs":return"UserRestrictionsNoSendDocs";case"sendRoundvideos":return"UserRestrictionsNoSendRound";case"sendVoices":return"UserRestrictionsNoSendVoice";case"sendAudios":return"UserRestrictionsNoSendMusic";case"sendVideos":return"UserRestrictionsNoSendVideos";case"sendPhotos":return"UserRestrictionsNoSendPhotos";default:return}}(n);if(!a)return e;const o=S(a);return`${e}${e.length?`, ${o}`:o}`},"")},[i,S]),G=(0,M.A)(()=>{x(!R),B()}),j=(0,M.A)(e=>{V(e),B()}),z=D||f,H=o===a.TD.InProgress||b;return(0,ie.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 432px;--before-shift-height: 96px;",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section without-bottom-shadow",children:[(0,ie.Y)("h3",{className:"section-heading",dir:"auto",children:k("ChannelPermissionsHeader")}),(0,ie.Y)(Kl,{chatId:i?.id,isMediaDropdownOpen:P,setIsMediaDropdownOpen:Y,handlePermissionChange:C,permissions:A,dropdownClassName:"DropdownListTrap",className:(0,pe.A)("DropdownList",P&&"DropdownList--open"),shiftedClassName:(0,pe.A)("part",P&&"shifted")})]}),u&&(0,ie.FD)("div",{className:(0,pe.A)("section",P&&"shifted"),children:[(0,ie.FD)(ui.A,{onClick:G,children:[(0,ie.Y)("span",{children:k("GroupMessagesChargePrice")}),(0,ie.Y)(mi.A,{id:"charge_for_messages",label:k("GroupMessagesChargePrice"),checked:R})]}),(0,ie.Y)("p",{className:"settings-item-description-larger",dir:k.isRtl?"rtl":void 0,children:k("RightsChargeStarsAbout")})]}),R&&(0,ie.Y)("div",{className:(0,pe.A)("section",P&&"shifted"),children:(0,ie.Y)(Xd,{canChangeChargeForMessages:!0,isGroupChat:!0,chargeForMessages:E,onChange:j})}),(0,ie.Y)("div",{className:(0,pe.A)("section",P&&"shifted"),children:(0,ie.FD)(ui.A,{icon:"delete-user",multiline:!0,narrow:!0,onClick:N,children:[(0,ie.Y)("span",{className:"title",children:k("ChannelBlockedUsers")}),(0,ie.Y)("span",{className:"subtitle",children:l})]})}),(0,ie.FD)("div",{className:(0,pe.A)("section",P&&"shifted"),children:[(0,ie.Y)("h3",{className:"section-heading",dir:"auto",children:k("PrivacyExceptions")}),(0,ie.Y)(ui.A,{icon:"add-user",onClick:w,children:k("ChannelAddException")}),K.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable exceptions-member",onClick:()=>I(e),children:(0,ie.Y)(bs.A,{userId:e.userId,status:J(e),forceShowSelf:!0})},e.userId))]})]}),(0,ie.Y)(bi.A,{isShown:z,onClick:O,ariaLabel:k("Save"),disabled:H,iconName:"check",isLoading:H})]})})),Jg=(0,s.ph)((0,n.EK)((e,{chatId:t,isPromotedByCurrentUser:i})=>{const s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t);return{chat:s,isFormFullyDisabled:!(s.isCreator||i),hasFullInfo:Boolean(n),members:n?.members}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chat:e,selectedChatMemberId:t,hasFullInfo:i,members:o,onScreenSelect:r,isFormFullyDisabled:l,onClose:c,isActive:d})=>{const{updateChatMemberBannedRights:h}=(0,n.ko)(),u=(0,s.Kr)(()=>{if(o)return o.find(({userId:e})=>e===t)},[o,t]),{permissions:m,havePermissionChanged:p,isLoading:v,handlePermissionChange:g,setIsLoading:A}=Ul(u?.bannedRights||e?.defaultBannedRights),[f,b,C]=(0,F.A)(),y=(0,Ri.A)(),S=(0,T.A)();(0,ye.A)({isActive:d,onBack:c}),(0,s.vJ)(()=>{i&&t&&!u&&r(a.je.GroupPermissions)},[e,i,r,u,t]);const k=(0,s.hb)(()=>{e&&t&&(A(!0),h({chatId:e.id,userId:t,bannedRights:m}))},[e,t,A,h,m]),N=(0,s.hb)(()=>{e&&t&&h({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,h]),w=(0,s.hb)(t=>!!l||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,l]),[I,P]=(0,s.J0)(!1);if(u)return(0,ie.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 431px;--before-shift-height: 192px;",children:[(0,ie.FD)("div",{className:"custom-scroll",children:[(0,ie.FD)("div",{className:"section without-bottom-shadow",children:[(0,ie.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ie.Y)(bs.A,{userId:u.userId,forceShowSelf:!0})}),(0,ie.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:S("UserRestrictionsCanDo")}),(0,ie.Y)(Kl,{chatId:e?.id,isMediaDropdownOpen:I,setIsMediaDropdownOpen:P,handlePermissionChange:g,permissions:m,className:(0,pe.A)("DropdownList",I&&"DropdownList--open"),dropdownClassName:"DropdownListTrap",shiftedClassName:(0,pe.A)("part",I&&"shifted"),getControlIsDisabled:w})]}),!l&&(0,ie.Y)("div",{className:(0,pe.A)("section",I&&"shifted"),children:(0,ie.Y)(ui.A,{icon:"delete-user",ripple:!0,destructive:!0,onClick:b,children:S("UserRestrictionsBlock")})})]}),(0,ie.Y)(bi.A,{isShown:p,onClick:k,ariaLabel:S("Save"),disabled:v,iconName:"check",isLoading:v}),(0,ie.Y)(ci.A,{isOpen:f,onClose:C,text:y("GroupManagementBanUserConfirm"),confirmLabel:"Remove",confirmHandler:N,confirmIsDestructive:!0})]})})),Gg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s,statusesById:n}=e.users,a=(0,c.AWZ)(e,t)?.members;return{members:a,usersById:s,userStatusesById:n,isChannel:i&&(0,l.WX)(i)}})(({usersById:e,userStatusesById:t,members:i,isChannel:n,onScreenSelect:o,onChatMemberSelect:r,onClose:c,isActive:d})=>{(0,ye.A)({isActive:d,onBack:c});const h=(0,s.Kr)(()=>{if(i&&e)return(0,l.UB)(i.filter(e=>!e.isOwner).map(({userId:e})=>e),e,t)},[i,e,t]),u=(0,s.hb)(e=>{r(e),o(a.je.GroupUserPermissions)},[r,o]);return(0,ie.Y)("div",{className:"Management",children:(0,ie.Y)("div",{className:"custom-scroll",children:(0,ie.Y)("div",{className:"section",teactFastList:!0,children:h?h.map((e,t)=>(0,ie.Y)(ui.A,{teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>u(e),children:(0,ie.Y)(bs.A,{userId:e,forceShowSelf:!0})},e)):(0,ie.Y)(Nc.A,{teactOrderKey:0,text:n?"No subscribers found":"No members found"},"nothing-found")})})})})),jg=[1,10,100],zg={hour:36e5,day:864e5,week:6048e5},Hg=zg.hour,$g=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{editingInvite:i}=(0,c.nTw)(e).management.byChatId[t]||{};return{editingInvite:i}})(({chatId:e,editingInvite:t,isActive:i,onClose:o,onScreenSelect:r})=>{const{editExportedChatInvite:l,exportChatInvite:c}=(0,n.ko)(),d=(0,T.A)(),[h,u,m]=(0,F.A)(),[p,v]=(0,s.J0)(!1),[g,A]=(0,s.J0)(""),[f,b]=(0,s.J0)(()=>Date.now()+Hg),[C,y]=(0,s.J0)("unlimited"),[S,k]=(0,s.J0)(10),[N,w]=(0,s.J0)("0"),[I,P]=(0,s.J0)(!1);(0,ye.A)({isActive:i,onBack:o}),(0,z.A)(([e])=>{if(e!==t)if(t){const{title:e,usageLimit:i,expireDate:s,isRequestNeeded:n}=t;if(e&&A(e),i&&(w(jg.includes(i)?i.toString():"custom"),k(i)),s){const e=(0,Ti.Fm)()+Hg;y("custom"),b(1e3*Math.max(s,e))}n&&v(!0)}else A(""),y("unlimited"),w("0"),b(1e3*(0,Ti.Fm)()+Hg),k(10),v(!1)},[t]);const Y=(0,s.hb)(e=>{v(e.target.checked)},[]),D=(0,s.hb)(e=>{A(e.target.value)},[]),M=(0,s.hb)(e=>{k(Number.parseInt(e.target.value,10))},[]),B=(0,s.hb)(e=>{b(e.getTime()),m()},[m]),L=(0,s.hb)(()=>{P(!0);const i="custom"===N?S:Number(N);let s;switch(C){case"custom":s=(0,Ti.Fm)()+(f-Date.now())/1e3;break;case"hour":case"day":case"week":s=(0,Ti.Fm)()+zg[C]/1e3;break;case"unlimited":s=0;break;default:s=void 0}t?l({link:t.link,chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}):c({chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}),r(a.je.Invites)},[e,f,S,l,t,c,p,C,N,g,r]);return(0,ie.FD)("div",{className:"Management ManageInvite",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.Y)("div",{className:"section",children:(0,ie.Y)(Qs.A,{label:d("ApproveNewMembers"),subLabel:d("ApproveNewMembersDescription"),checked:p,onChange:Y})}),(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(X.A,{className:"link-name",placeholder:d("LinkNameHint"),value:g,onChange:D}),(0,ie.Y)("p",{className:"section-help hint",children:d("LinkNameHelp")})]}),(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("div",{className:"section-heading",children:d("LimitByPeriod")}),(0,ie.Y)(te.A,{name:"expireOptions",options:[{value:"hour",label:d("Hours",1)},{value:"day",label:d("Days",1)},{value:"week",label:d("Weeks",1)},{value:"unlimited",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_expire_custom")}],onChange:y,selected:C}),"custom"===C&&(0,ie.FD)(Z.A,{className:"expire-limit",isText:!0,onClick:u,children:[(0,$e.Lu)(d,f)," ",(0,$e.fU)(d,f)]}),(0,ie.Y)("p",{className:"section-help hint",children:d("TimeLimitHelp")})]}),!p&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("div",{className:"section-heading",children:d("LimitNumberOfUses")}),(0,ie.Y)(te.A,{name:"usageOptions",options:[...jg.map(e=>({value:e.toString(),label:e})),{value:"0",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_usage_custom")}],onChange:w,selected:N}),"custom"===N&&(0,ie.Y)("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:M}),(0,ie.Y)("p",{className:"section-help hint",children:d("UsesLimitHelp")})]}),(0,ie.Y)(bi.A,{isShown:!0,onClick:L,disabled:I,ariaLabel:d(t?"SaveLink":"CreateLink"),iconName:"check"})]}),(0,ie.Y)(an,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:m,onSubmit:B,selectedAt:f,submitButtonLabel:d("Save")})]})})),qg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{inviteInfo:i}=(0,c.nTw)(e).management.byChatId[t]||{},{invite:s,importers:n,requesters:a}=i||{},o=(0,c.hds)(e,t);return{invite:s,importers:n,requesters:a,isChannel:o&&(0,l.WX)(o)}})(({chatId:e,invite:t,importers:i,requesters:a,isChannel:o,isActive:r,onClose:l})=>{const{loadChatInviteImporters:c,loadChatInviteRequesters:d,openChat:h}=(0,n.ko)(),u=(0,T.A)(),{usage:m=0,usageLimit:p,link:v,adminId:g}=t||{},A=t?.expireDate&&1e3*(t.expireDate-(0,Ti.Fm)())+Date.now(),f=(t?.expireDate||0)-(0,Ti.Fm)()<0;return(0,s.vJ)(()=>{v&&(c({chatId:e,link:v}),d({chatId:e,link:v}))},[e,v,c,d]),(0,ye.A)({isActive:r,onBack:l}),(0,ie.Y)("div",{className:"Management ManageInviteInfo",children:(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[!t&&(0,ie.Y)("p",{className:"section-help",children:u("Loading")}),t&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(jr.A,{title:t.title,link:t.link,className:"invite-link"}),Boolean(A)&&(0,ie.Y)("p",{className:"section-help",children:f?u("ExpiredLink"):u("LinkExpiresIn",`${(0,$e.Lu)(u,A)} ${(0,$e.fU)(u,A)}`)})]}),g&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("p",{className:"section-heading",children:u("LinkCreatedeBy")}),(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:g}),children:(0,ie.Y)(bs.A,{userId:g,status:(0,$e.fS)(u,1e3*t.date,!0),forceShowSelf:!0})})]}),(()=>{if(i?.length||!a?.length)return i?(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("p",{className:"section-heading",children:i.length?u("PeopleJoined",m):u("NoOneJoined")}),(0,ie.FD)("p",{className:"section-help",children:[!i.length&&(p?u("PeopleCanJoinViaLinkCount",p-m):u("NoOneJoinedYet")),i.map(e=>{const t=(0,$e.fS)(u,1e3*e.date,!0),i=e.isFromChatList?`${t}${u("JoinedViaFolder")}`:t;return(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ie.Y)(bs.A,{userId:e.userId,status:i,forceShowSelf:!0})})})]})]}):(0,ie.Y)(Ve.A,{})})(),(()=>{if(!t?.isRevoked){if(!a&&i)return(0,ie.Y)(Ve.A,{});if(a?.length)return(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("p",{className:"section-heading",children:u(o?"SubscribeRequests":"MemberRequests")}),(0,ie.Y)("p",{className:"section-help",children:a.map(e=>(0,ie.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ie.Y)(bs.A,{userId:e.userId,status:(0,$e.fS)(u,1e3*e.date,!0),forceShowSelf:!0})}))})]})}})()]})]})})})),Wg="•";function Qg(e,t){const{isPermanent:i,usage:s=0,date:n}=e,{isPermanent:a,usage:o=0,date:r}=t;return i||a?Number(i)-Number(a):s||o?o-s:r-n}const Zg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{invites:i,revokedInvites:s}=(0,c.nTw)(e).management.byChatId[t]||{},n=(0,c.hds)(e,t);return{exportedInvites:i,revokedExportedInvites:s,chat:n,isChannel:n&&(0,l.WX)(n)}})(({chatId:e,chat:t,exportedInvites:i,revokedExportedInvites:r,isActive:c,isChannel:d,onClose:h,onScreenSelect:u})=>{const{setEditingExportedInvite:m,showNotification:p,editExportedChatInvite:v,deleteExportedChatInvite:g,deleteRevokedExportedChatInvites:A,setOpenedInviteInfo:f}=(0,n.ko)(),b=(0,Ri.A)(),C=(0,T.A)(),[y,S,k]=(0,F.A)(),[N,w,I]=(0,F.A)(),[P,Y]=(0,s.J0)(),[M,B,L]=(0,F.A)(),[R,x]=(0,s.J0)();(0,ye.A)({isActive:c,onBack:h});const E=(0,s.Kr)(()=>{if(i)return i.some(({expireDate:e})=>e&&e-(0,Ti.Fm)()<$e.il/1e3)},[i]),V=(0,D.A)();(0,pn.A)(V,E?1e3:void 0);const _=(0,s.Kr)(()=>t&&(0,l.Kl)(t),[t]),U=i?.find(({isPermanent:e})=>e),O=_?`${o.jsp}${_}`:U?.link,K=(0,s.Kr)(()=>{const e=t?.hasUsername?i:i?.filter(({isPermanent:e})=>!e);return e?.sort(Qg)},[t?.hasUsername,i]),J=(0,s.hb)(t=>{const{link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o}=t;v({chatId:e,link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o,isRevoked:!0})},[e,v]),G=(0,s.hb)(e=>{Y(e),w()},[w]),j=(0,s.hb)(()=>{P&&(J(P),Y(void 0),I())},[I,J,P]),z=(0,s.hb)(()=>{u(a.je.EditInvite)},[u]),H=(0,s.hb)(()=>{U&&G(U)},[G,U]),$=(0,s.hb)(()=>{A({chatId:e}),k()},[e,k,A]),q=(0,s.hb)(t=>{f({chatId:e,invite:t}),u(a.je.InviteInfo)},[e,u,f]),W=(0,s.hb)(t=>{g({chatId:e,link:t.link})},[e,g]),Z=(0,s.hb)(e=>{x(e),B()},[B]),X=(0,s.hb)(()=>{R&&(W(R),x(void 0),L())},[L,W,R]),ee=(0,s.hb)(e=>{(0,pc.eM)(e),p({message:C("LinkCopied")})},[C,p]),te=e=>{const{usage:t=0,usageLimit:i,expireDate:s,isPermanent:n,requested:a,isRevoked:o}=e;let r="";if(r=!o&&i&&t<i?C("CanJoin",i-t):t?C("PeopleJoined",t):C("NoOneJoined"),o)return r+=` ${Wg} ${C("Revoked")}`,r;if(a&&(r+=` ${Wg} ${C("JoinRequests",a)}`),void 0!==i&&t===i)r+=` ${Wg} ${C("LinkLimitReached")}`;else if(s){const e=s-(0,Ti.Fm)();r+=` ${Wg} `,r+=e>0?C("InviteLink.ExpiresIn",(0,$e.zt)(b,e)):C("InviteLink.Expired")}else n&&(r+=` ${Wg} ${C("Permanent")}`);return r},se=e=>{const{usage:t=0,usageLimit:i,isRevoked:s,expireDate:n}=e;return s?"link-status-icon-gray":i&&t<i?"link-status-icon-green":n&&1e3*(n-(0,Ti.Fm)())<=0?"link-status-icon-red":"link-status-icon-blue"},ne=t=>{const i=[];return i.push({title:C("Copy"),icon:"copy",handler:()=>ee(t.link)}),t.isPermanent||t.isRevoked||i.push({title:C("Edit"),icon:"edit",handler:()=>(t=>{m({chatId:e,invite:t}),u(a.je.EditInvite)})(t)}),t.isRevoked?i.push({title:C("DeleteLink"),icon:"delete",handler:()=>Z(t),destructive:!0}):i.push({title:C("RevokeButton"),icon:"delete",handler:()=>G(t),destructive:!0}),i};return(0,ie.FD)("div",{className:"Management ManageInvites",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.Invite,size:o.xMZ,className:"section-icon"}),(0,ie.Y)("p",{className:"section-help",children:C(d?"PrimaryLinkHelpChannel":"PrimaryLinkHelp")})]}),O&&(0,ie.Y)("div",{className:"section",children:(0,ie.Y)(jr.A,{className:"settings-input",link:O,withShare:!0,onRevoke:t?.usernames?void 0:H,title:C(t?.usernames?"PublicLink":"lng_create_permanent_link_title")})}),(0,ie.FD)("div",{className:"section",teactFastList:!0,children:[(0,ie.Y)(ui.A,{icon:"add",withPrimaryColor:!0,className:"create-item",onClick:z,children:C("CreateNewLink")},"create"),(!K||!K.length)&&(0,ie.Y)(Nc.A,{text:"No links found"},"nothing"),K?.map(e=>(0,ie.FD)(ui.A,{leftElement:(0,ie.Y)(Q.A,{name:"link",className:`link-status-icon ${se(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ne(e),children:[(0,ie.Y)("span",{className:"title invite-title",children:e.title||e.link}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:te(e)})]},e.link)),(0,ie.Y)("p",{className:"section-help hint",children:C("ManageLinksInfoHelp")},"links-hint")]}),r&&Boolean(r.length)&&(0,ie.FD)("div",{className:"section",teactFastList:!0,children:[(0,ie.Y)("p",{className:"section-help",children:C("RevokedLinks")},"title"),(0,ie.Y)(ui.A,{icon:"delete",destructive:!0,onClick:S,children:(0,ie.Y)("span",{className:"title",children:C("DeleteAllRevokedLinks")})},"delete"),r?.map(e=>(0,ie.FD)(ui.A,{leftElement:(0,ie.Y)(Q.A,{name:"link",className:`link-status-icon ${se(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ne(e),children:[(0,ie.Y)("span",{className:"title",children:e.title||e.link}),(0,ie.Y)("span",{className:"subtitle",dir:"auto",children:te(e)})]},e.link))]})]}),(0,ie.Y)(ci.A,{isOpen:y,onClose:k,title:C("DeleteAllRevokedLinks"),text:C("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:C("DeleteAll"),confirmHandler:$}),(0,ie.Y)(ci.A,{isOpen:N,onClose:I,title:C("RevokeLink"),text:C("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:C("RevokeButton"),confirmHandler:j}),(0,ie.Y)(ci.A,{isOpen:M,onClose:L,title:C("DeleteLink"),text:C("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:C("Delete"),confirmHandler:X})]})})),Xg=(0,s.ph)((0,n.EK)((e,{userId:t})=>({user:(0,c.mBe)(e,t)}))(({userId:e,chatId:t,about:i,date:a,isChannel:o,user:r})=>{const{openChat:c,hideChatJoinRequest:d}=(0,n.ko)(),h=(0,pe.x)("JoinRequest"),u=(0,T.A)(),m=(0,l.Yg)(r),p=1e3*(a-(0,Ti.Fm)())+Date.now(),v=(0,$e.cK)(new Date(p))?(0,$e.fU)(u,p):(0,$e.F5)(u,p,!0,!1,!0),g=(0,s.hb)(()=>{d({chatId:t,userId:e,isApproved:!0})},[t,d,e]),A=(0,s.hb)(()=>{d({chatId:t,userId:e,isApproved:!1})},[t,d,e]);return(0,ie.FD)("div",{className:h("&"),children:[(0,ie.FD)("div",{className:h("top"),children:[(0,ie.FD)("div",{className:h("user"),onClick:()=>{c({id:e})},children:[(0,ie.Y)(Tt.A,{size:"medium",peer:r},e),(0,ie.FD)("div",{className:h("user-info"),children:[(0,ie.Y)("div",{className:h("user-name"),children:m}),(0,ie.Y)("div",{className:h("user-subtitle"),children:i})]})]}),(0,ie.Y)("div",{className:h("date"),children:v})]}),(0,ie.FD)("div",{className:h("buttons"),children:[(0,ie.Y)(Z.A,{className:h("button"),onClick:g,children:u(o?"ChannelAddToChannel":"ChannelAddToGroup")}),(0,ie.Y)(Z.A,{className:h("button"),isText:!0,onClick:A,children:u("DismissRequest")})]})]})})),eA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,isChannel:i&&(0,l.WX)(i)}})(({chat:e,chatId:t,isActive:i,isChannel:a,onClose:r})=>{const{hideAllChatJoinRequests:l,loadChatJoinRequests:c}=(0,n.ko)(),[d,h,u]=(0,F.A)(),[m,p,g]=(0,F.A)(),A=(0,T.A)();(0,ye.A)({isActive:i,onBack:r}),(0,s.vJ)(()=>{e?.joinRequests||(0,v.L8)(t)||c({chatId:t})},[e,t,c]);const f=(0,s.hb)(()=>{l({chatId:t,isApproved:!0}),u()},[l,t,u]),b=(0,s.hb)(()=>{l({chatId:t,isApproved:!1}),g()},[l,t,g]);return(0,ie.FD)("div",{className:"Management ManageJoinRequests",children:[(0,ie.FD)("div",{className:"custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(Cr.A,{tgsUrl:br.w.JoinRequest,size:o.OMf,className:"section-icon"}),Boolean(e?.joinRequests?.length)&&(0,ie.FD)("div",{className:"bulk-actions",children:[(0,ie.Y)(Z.A,{className:"bulk-action-button",onClick:h,children:"Accept all"}),(0,ie.Y)(Z.A,{className:"bulk-action-button",onClick:p,isText:!0,children:"Dismiss all"})]})]}),(0,ie.FD)("div",{className:"section",teactFastList:!0,children:[(0,ie.Y)("p",{children:e?.joinRequests?e.joinRequests.length?A("JoinRequests",e.joinRequests.length):A("NoMemberRequests"):A("Loading")},"title"),!e?.joinRequests&&(0,ie.Y)(Ve.A,{},"loading"),0===e?.joinRequests?.length&&(0,ie.Y)("p",{className:"section-help",children:A(a?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")},"empty"),e?.joinRequests?.map(({userId:e,about:i,date:s})=>(0,ie.Y)(Xg,{userId:e,about:i,date:s,isChannel:a,chatId:t},e))]})]}),(0,ie.Y)(ci.A,{isOpen:d,onClose:u,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:f}),(0,ie.Y)(ci.A,{isOpen:m,onClose:g,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:b})]})})),tA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{maxUniqueReactions:s}=e.appConfig,n=(0,c.AWZ)(e,t),a=n?.reactionsLimit||s,o=(0,l.WX)(i);return{enabledReactions:n?.enabledReactions,availableReactions:e.reactions.availableReactions,chat:i,maxUniqueReactions:s,reactionsLimit:a,isChannel:o}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({availableReactions:e,enabledReactions:t,chat:i,isActive:a,onClose:o,maxUniqueReactions:r,reactionsLimit:c,isChannel:d})=>{const{setChatEnabledReactions:h}=(0,n.ko)(),u=(0,T.A)(),[m,p]=(0,s.J0)(!1),[v,g]=(0,s.J0)(!1),[A,f]=(0,s.J0)(t),[b,C]=(0,s.J0)(c);(0,ye.A)({isActive:a,onBack:o});const y=(0,s.Kr)(()=>[{value:"all",label:u("AllReactions")},{value:"some",label:u("SomeReactions")},{value:"none",label:u("NoReactions")}],[u]),S=(0,s.hb)(()=>{i&&(g(!0),h({chatId:i.id,enabledReactions:A,reactionsLimit:b}))},[i,A,h,b]);(0,s.vJ)(()=>{g(!1),p(!1),f(t),C(c)},[t,c]);const k=(0,s.Kr)(()=>e?.filter(({isInactive:e})=>!e),[e]);(0,s.vJ)(()=>{if(void 0===b||b===c){if("some"===A?.type&&"all"!==t?.type&&"some"!==t?.type&&0===A.allowed.length)return void p(!1);if(A?.type===t?.type){if("some"===A?.type&&"some"===t?.type){const e=A.allowed,i=t?.allowed;if(e.length!==i.length||e.reverse().some(e=>!i.find(t=>(0,l.a0)(e,t))))return void p(!0)}p(!1)}else p(!0)}else p(!0)},[b,c,A,t]);const N=(0,s.hb)(e=>{"all"===e?(f({type:"all"}),C(c)):"some"===e?(f({type:"some",allowed:"some"===t?.type?t.allowed:[]}),C(c)):(f(void 0),C(void 0))},[t,c]),w=(0,s.hb)(e=>{if(!i||!k)return;const{name:t,checked:s}=e.currentTarget;if("some"===A?.type){const e={emoticon:t};f(s?{type:"some",allowed:[...A.allowed,e]}:{type:"some",allowed:A.allowed.filter(t=>!(0,l.a0)(t,e))})}},[k,i,A]),I=(0,s.hb)(e=>{C(e)},[]),P=(0,s.hb)(e=>u("PeerInfo.AllowedReactions.MaxCountValue",e),[u]),Y=d&&("all"===A?.type||"some"===A?.type);return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"panel-content custom-scroll",children:[Boolean(b&&Y)&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("h3",{className:"section-heading",children:u("MaximumReactionsHeader")}),(0,ie.Y)(Qe.A,{min:1,max:r,value:b,onChange:I,renderValue:P,isCenteredLayout:!0}),(0,ie.Y)("p",{className:"section-info section-info_push",children:u("ChannelReactions.MaxCount.Info")})]}),(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)("h3",{className:"section-heading",children:u("AvailableReactions")}),(0,ie.Y)(te.A,{selected:A?.type||"none",name:"reactions",options:y,onChange:N}),(0,ie.FD)("p",{className:"section-info section-info_push",children:["all"===A?.type&&u("EnableAllReactionsInfo"),"some"===A?.type&&u("EnableSomeReactionsInfo"),!A&&u("DisableReactionsInfo")]})]}),"some"===A?.type&&(0,ie.FD)("div",{className:"section section-with-fab",children:[(0,ie.Y)("h3",{className:"section-heading",children:u("OnlyAllowThisReactions")}),k?.map(({reaction:t,title:i})=>(0,ie.Y)("div",{className:"ListItem",children:(0,ie.Y)(Qs.A,{name:t.emoticon,checked:A?.allowed.some(e=>(0,l.a0)(t,e)),label:(0,ie.FD)("div",{className:"Reaction",children:[(0,ie.Y)(Cs.A,{reaction:t,availableReactions:e}),i]}),withIcon:!0,onChange:w})}))]})]}),(0,ie.Y)(bi.A,{isShown:m,onClick:S,ariaLabel:u("Save"),disabled:v,iconName:"check",isLoading:v})]})})),iA="Please provide first name",sA=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=(0,c.mBe)(e,t),s=(0,c.hds)(e,t),n=(0,c.vGo)(e,t),{progress:a}=(0,c.nTw)(e).management,o=s&&(0,Pc.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),r=n?.personalPhoto,l=n?.profilePhoto||n?.fallbackPhoto,d=n?.note?.text;return{user:i,progress:a,isMuted:o,personalPhoto:r,notPersonalPhoto:l,noteText:d,contactNoteLimit:e.appConfig?.contactNoteLimit||ln.tI}})(({userId:e,user:t,progress:i,isMuted:r,onClose:c,isActive:d,personalPhoto:h,notPersonalPhoto:u,noteText:m,contactNoteLimit:p})=>{const{updateContact:v,updateContactNote:g,deleteContact:A,closeManagement:f,uploadContactProfilePhoto:b,updateChatMutedState:C}=(0,n.ko)(),[y,S,k]=(0,F.A)(),[N,w,I]=(0,F.A)(),[P,Y,D]=(0,F.A)(),[M,B]=(0,s.J0)(),[L,R,x]=(0,F.A)(),E=(0,T.A)(),V=(0,Ri.A)();(0,ye.A)({isActive:d,onBack:c});const _=t&&t.firstName||"",U=t&&t.lastName||"",O=m||"",[K,J]=(0,s.J0)(_),[G,j]=(0,s.J0)(U),[z,H]=(0,s.J0)(O),[$,q]=(0,s.J0)(!r);(0,s.vJ)(()=>{q(!r)},[r]),(0,s.vJ)(()=>{D(),x(),k()},[k,e]),(0,s.vJ)(()=>{J(_),j(U),H(O)},[_,U,O]),(0,s.vJ)(()=>{i===a.TD.Complete&&(D(),B(void 0),k())},[k,i]);const W=(0,s.hb)(e=>{J(e.target.value),Y(),M===iA&&B(void 0)},[M]),Q=(0,s.hb)(e=>{j(e.target.value),Y()},[]),Z=(0,s.hb)(e=>{H(e.target.value),Y()},[]),ee=(0,s.hb)(e=>{q(e.target.checked),R(),Y()},[]),te=(0,s.hb)(()=>{const t=K.trim(),i=G.trim(),s=z.trim();t.length?(ne.current?.blur(),ae.current?.blur(),oe.current?.blur(),v({userId:e,firstName:t,lastName:i}),s!==O&&g({userId:e,note:{text:s,entities:[]}}),L&&C({chatId:e,mutedUntil:$?o.Os5:o.xEh})):B(iA)},[O,K,$,L,G,z,e]),se=(0,s.hb)(()=>{A({userId:e}),k(),f()},[k,f,A,e]),ne=(0,s.li)(),ae=(0,s.li)(),oe=(0,s.li)(),re=(0,s.li)(),le=(0,s.li)(!1),ce=(0,s.hb)(()=>{re.current?.click(),le.current=!0},[]),de=(0,s.hb)(()=>{re.current?.click(),le.current=!1},[]),he=(0,s.hb)(()=>{I(),Y(),b({userId:e})},[I,b,e]),ue=(0,s.hb)(t=>{Y(),b({userId:e,file:t,isSuggest:le.current})},[b,e]);if(!t)return;const me=!(0,l.tv)(t)&&t.id!==o.zv8,pe=i===a.TD.InProgress,ve=p-z.length;return(0,ie.FD)("div",{className:"Management",children:[(0,ie.FD)("div",{className:"custom-scroll",children:[(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(bs.A,{userId:t.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),(0,ie.FD)("div",{className:"settings-edit",children:[(0,ie.Y)(X.A,{ref:ne,id:"user-first-name",label:E("UserInfo.FirstNamePlaceholder"),onChange:W,value:K,error:M===iA?M:void 0}),(0,ie.Y)(X.A,{ref:ae,id:"user-last-name",label:E("UserInfo.LastNamePlaceholder"),onChange:Q,value:G}),(0,ie.Y)(cn.A,{ref:oe,id:"user-note",label:V("UserNoteTitle"),onChange:Z,value:z,maxLength:p,maxLengthIndicator:ve.toString(),noReplaceNewlines:!0})]}),(0,ie.Y)("p",{className:"section-edit-info",dir:"auto",children:V("EditUserNoteHint")}),(0,ie.Y)("div",{className:"ListItem narrow",children:(0,ie.Y)(Qs.A,{checked:$,label:E("Notifications"),subLabel:E($?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:ee})})]}),me&&(0,ie.FD)("div",{className:"section",children:[(0,ie.Y)(ui.A,{icon:"camera-add",ripple:!0,onClick:ce,children:(0,ie.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SuggestPhoto",t.firstName)})}),(0,ie.Y)(ui.A,{icon:"camera-add",ripple:!0,onClick:de,children:(0,ie.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SetCustomPhoto",t.firstName)})}),h&&(0,ie.Y)(ui.A,{leftElement:(0,ie.Y)(Tt.A,{photo:u,noPersonalPhoto:!0,peer:t,size:"mini",className:"personal-photo"}),ripple:!0,onClick:w,children:E("UserInfo.ResetCustomPhoto")}),(0,ie.Y)("p",{className:"section-help",dir:"auto",children:E("UserInfo.CustomPhotoInfo",t.firstName)})]}),(0,ie.Y)("div",{className:"section",children:(0,ie.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:E("DeleteContact")})})]}),(0,ie.Y)(bi.A,{isShown:P,onClick:te,disabled:pe,ariaLabel:E("Save"),iconName:"check",isLoading:pe}),(0,ie.Y)(ci.A,{isOpen:y,onClose:k,text:E("AreYouSureDeleteContact"),confirmLabel:E("DeleteContact"),confirmHandler:se,confirmIsDestructive:!0}),(0,ie.Y)(ci.A,{isOpen:N,onClose:I,text:E("UserInfo.ResetToOriginalAlertText",t.firstName),confirmLabel:E("Reset"),confirmHandler:he,confirmIsDestructive:!0}),(0,ie.Y)(vu.A,{onChange:ue,inputRef:re})]})})),nA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{progress:i,error:s}=(0,c.nTw)(e).chatCreation||{};return{chat:(0,c.hds)(e,t),creationProgress:i,creationError:s}})(({chat:e,onClose:t,isActive:i,creationProgress:o,creationError:r})=>{const{createChannel:l}=(0,n.ko)(),c=(0,Ri.A)();(0,ye.A)({isActive:i,onBack:t});const[d,h]=(0,s.J0)(()=>c("NewDiscussionChatTitle",{name:e?.title})),[u,m]=(0,s.J0)(),[p,v]=(0,s.J0)(),g=o===a.n7.InProgress,A=(0,M.A)(e=>{const{value:t}=e.currentTarget,i=t.trimStart();h(i),i!==t&&(e.currentTarget.value=i)}),f=r&&c("NewChatTitleEmptyError")||(p!==c("NewChatTitleEmptyError")&&p!==c("NewChannelTitleEmptyError")?p:void 0),b=(0,M.A)(()=>{d.length?e&&l({discussionChannelId:e.id,title:d,photo:u,isSuperGroup:!0}):v(c("NewChatTitleEmptyError"))});return(0,ie.Y)("div",{className:"Management",children:(0,ie.Y)("div",{className:"panel-content custom-scroll",children:(0,ie.FD)("div",{className:"NewChat",children:[(0,ie.FD)("div",{className:"NewChat-inner step-2",children:[(0,ie.Y)(Ih.A,{onChange:m,title:c("AddPhoto")}),(0,ie.Y)(X.A,{value:d,onChange:A,label:c("GroupName"),error:p===c("NewChatTitleEmptyError")||p===c("NewChannelTitleEmptyError")?p:void 0}),f&&(0,ie.Y)("p",{className:"error",children:f})]}),(0,ie.Y)(bi.A,{isShown:0!==d.length,onClick:b,disabled:g,ariaLabel:c("DiscussionCreateGroup"),iconName:"arrow-right",isLoading:g})]})})})})),aA=(0,s.ph)((0,n.EK)(e=>({managementType:(0,c.vn8)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,onChatMemberSelect:o,onClose:r,isActive:l,managementType:c})=>{switch(t){case a.je.Initial:switch(c){case"bot":return(0,ie.Y)(wg,{userId:e,onClose:r,isActive:l},e);case"user":return(0,ie.Y)(sA,{userId:e,onClose:r,isActive:l},e);case"group":return(0,ie.Y)(Eg,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[a.je.ChatPrivacyType,a.je.Discussion,a.je.GroupPermissions,a.je.ChatAdministrators,a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t)},e);case"channel":return(0,ie.Y)(Pg,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[a.je.ChannelSubscribers,a.je.ChatAdministrators,a.je.ChannelRemovedUsers,a.je.Discussion,a.je.ChatPrivacyType,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t)},e)}break;case a.je.ChatPrivacyType:return(0,ie.Y)(Fg,{chatId:e,isActive:l,onClose:r});case a.je.Discussion:return(0,ie.Y)(Tg,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case a.je.GroupPermissions:return(0,ie.Y)(Kg,{chatId:e,onScreenSelect:n,onChatMemberSelect:o,isActive:l||[a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions].includes(t),onClose:r});case a.je.ChannelRemovedUsers:case a.je.GroupRemovedUsers:return(0,ie.Y)(Mg,{chatId:e,isActive:l,onClose:r});case a.je.GroupUserPermissionsCreate:return(0,ie.Y)(Gg,{chatId:e,onChatMemberSelect:o,onScreenSelect:n,isActive:l||[a.je.GroupUserPermissions].includes(t),onClose:r});case a.je.GroupUserPermissions:return(0,ie.Y)(Jg,{chatId:e,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChatAdministrators:return(0,ie.Y)(Yg,{chatId:e,onScreenSelect:n,onChatMemberSelect:o,isActive:l||[a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t),onClose:r});case a.je.NewDiscussionGroup:return(0,ie.Y)(nA,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChatNewAdminRights:case a.je.ChatAdminRights:return(0,ie.Y)(Vg,{chatId:e,isNewAdmin:t===a.je.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChannelSubscribers:case a.je.GroupMembers:return(0,ie.Y)(Og,{chatId:e,isActive:l,onClose:r});case a.je.Invites:return(0,ie.Y)(Zg,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case a.je.EditInvite:return(0,ie.Y)($g,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case a.je.GroupAddAdmins:return(0,ie.Y)(Og,{chatId:e,noAdmins:!0,isActive:l,onClose:r,onScreenSelect:n,onChatMemberSelect:o});case a.je.Reactions:return(0,ie.Y)(tA,{chatId:e,isActive:l,onClose:r});case a.je.InviteInfo:return(0,ie.Y)(qg,{chatId:e,isActive:l,onClose:r});case a.je.JoinRequests:return(0,ie.Y)(eA,{chatId:e,isActive:l,onClose:r})}})),oA=/^4\d/,rA=/^5[1-5]/,lA=/^2[2-7]\d{2}/,cA=/^220[0-4]/;let dA=function(e){return e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard",e[e.Mir=3]="Mir",e}({});const hA={[dA.Default]:"",[dA.Visa]:"visa",[dA.Mastercard]:"mastercard",[dA.Mir]:"mir"};function uA(e){return e=e.replace(/\s/g,""),oA.test(e)?dA.Visa:cA.test(e)?dA.Mir:rA.test(e)||lA.test(e)?dA.Mastercard:dA.Default}const mA={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},pA=(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{...mA};default:return e}};var vA=i(37960);const gA={root:"maC_9u6e",description:"zQ6lEVJ2","checkout-picture":"JgWvLdK2",checkoutPicture:"JgWvLdK2",text:"T2pYH395","checkout-title":"HadolzeF",checkoutTitle:"HadolzeF","checkout-description":"oZW7mUNP",checkoutDescription:"oZW7mUNP","price-info":"P618Q3yr",priceInfo:"P618Q3yr","price-info-item":"XNNG_ajy",priceInfoItem:"XNNG_ajy","price-info-item-main":"D9gYNLVk",priceInfoItemMain:"D9gYNLVk","price-info-item-title":"NtY5Aah7",priceInfoItemTitle:"NtY5Aah7",tipsList:"WHO341eB",tipsItem:"ksLlzBxw",tipsItem_active:"J4yem62L",tipsItemActive:"J4yem62L","invoice-info":"U2IBOLP1",invoiceInfo:"U2IBOLP1",provider:"kqWcdro1",stripe:"xKztZrna",smartglocal:"X_Ge1o4u","checkout-info-item-info-title":"ysWuPklS",checkoutInfoItemInfoTitle:"ysWuPklS","checkout-info-item-info-data":"MpC_P8_c",checkoutInfoItemInfoData:"MpC_P8_c","tos-checkbox":"OrRb0xG7",tosCheckbox:"OrRb0xG7",list:"l_wfiFG0"},AA=(0,s.ph)(({title:e,description:t,photo:i,invoice:o,shippingPrices:r,checkoutInfo:c,totalPrice:d,isTosAccepted:h,dispatch:u,onAcceptTos:m,tipAmount:p,needAddress:v,hasShippingOptions:g,savedCredentials:A,isPaymentFormUrl:f,botName:b})=>{const{setPaymentStep:C}=(0,n.ko)(),y=(0,T.A)(),S=(0,Ri.A)(),k=Boolean(u),{termsUrl:N,suggestedTipAmounts:w,maxTipAmount:I}=o||{},{paymentMethod:P,paymentProvider:Y,shippingAddress:F,name:D,phone:M,shippingMethod:B}=c||{},L=(0,H.A)((0,l.cy)(i)),{ref:R}=(0,vA.A)({hasMediaData:Boolean(L)}),x=(0,s.hb)(e=>{u({type:"setTipAmount",payload:I?Math.min(e,I):e})},[u,I]),E=(0,s.hb)(()=>{C({step:A?.length?a.tn.SavedPayments:a.tn.PaymentInfo})},[A?.length,C]),V=(0,s.hb)(()=>{C({step:a.tn.ShippingInfo})},[C]),_=(0,s.hb)(()=>{C({step:a.tn.Shipping})},[C]);return(0,ie.FD)("div",{className:gA.root,children:[(0,ie.FD)("div",{className:gA.description,children:[L&&(0,ie.Y)("img",{ref:R,className:gA.checkoutPicture,src:L,draggable:!1,width:i.dimensions?.width,height:i.dimensions?.height,alt:""}),!L&&i&&(0,ie.Y)(Ji.A,{width:i.dimensions?.width,height:i.dimensions?.height,className:gA.checkoutPicture,forceAspectRatio:!0}),(0,ie.FD)("div",{className:gA.text,children:[(0,ie.Y)("h5",{className:gA.checkoutTitle,children:e}),t&&(0,ie.Y)("div",{className:gA.checkoutDescription,children:(0,Mt.A)(t,["br","links","emoji"])})]})]}),(0,ie.FD)("div",{className:gA.priceInfo,children:[o.prices.map(e=>fA(S,e.label,e.amount,o.currency)),r&&r.map(e=>fA(S,e.label,e.amount,o.currency)),w&&w.length>0&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:gA.priceInfoItem,children:[(0,ie.Y)("div",{className:gA.priceInfoItemTitle,children:e}),(0,ie.Y)("div",{children:(0,ca.vv)(S,p,o.currency)})]}),(0,ie.Y)("div",{className:gA.tipsList,children:w.map(e=>(0,ie.Y)("div",{className:(0,pe.A)(gA.tipsItem,e===p&&gA.tipsItem_active),onClick:u?()=>x(e===p?0:e):void 0,children:(0,ca.vv)(S,e,o.currency,{shouldOmitFractions:!0})},e))})]}),void 0!==d&&fA(S,y("Checkout.TotalAmount"),d,o.currency,!0)]}),(0,ie.FD)("div",{className:gA.invoiceInfo,children:[!f&&bA({title:P||A?.[0].title,label:y("PaymentCheckoutMethod"),icon:"card",onClick:k?E:void 0}),Y&&bA({title:Y,label:y("PaymentCheckoutProvider"),customIcon:(0,pe.A)(gA.provider,gA[Y.toLowerCase()])}),(v||!k&&F)&&bA({title:F,label:y("PaymentShippingAddress"),icon:"location",onClick:k?V:void 0}),D&&bA({title:D,label:y("PaymentCheckoutName"),icon:"user"}),M&&bA({title:M,label:y("PaymentCheckoutPhoneNumber"),icon:"phone"}),(g||!k&&B)&&bA({title:B,label:y("PaymentCheckoutShippingMethod"),icon:"truck",onClick:k?_:void 0}),N&&(U=N,(0,ie.Y)(Qs.A,{label:function(e,t){const i=y("PaymentCheckoutAcceptRecurrent",b).split("*");return(0,ie.FD)(ie.FK,{children:[i[0],(0,ie.Y)(cl.A,{url:e,text:i[1],isRtl:t}),i.slice(2)]})}(U,S.isRtl),name:"checkout_tos",checked:Boolean(h),className:gA.tosCheckbox,tabIndex:0,onCheck:m}))]})]});var U});function fA(e,t,i,s,n=!1){return(0,ie.FD)("div",{className:(0,pe.A)(gA.priceInfoItem,n&&gA.priceInfoItemMain),children:[(0,ie.Y)("div",{className:gA.priceInfoItemTitle,children:t}),(0,ie.Y)("div",{children:(0,ca.vv)(e,i,s)})]})}function bA({title:e,label:t,icon:i,customIcon:s,onClick:n}){const a=Boolean(e&&t!==e);return(0,ie.FD)(ui.A,{className:gA.list,narrow:!0,multiline:a,icon:i,inactive:!n,onClick:n,leftElement:s&&(0,ie.Y)("i",{className:(0,pe.A)("icon",s)}),children:[(0,ie.Y)("div",{className:gA.checkoutInfoItemInfoTitle,children:e||t}),e&&t!==e&&(0,ie.Y)("p",{className:gA.checkoutInfoItemInfoData,children:t})]})}const CA=(0,s.ph)(({url:e,noRedirect:t,onClose:i,onPaymentFormSubmit:a})=>{const{openTelegramLink:r}=(0,n.ko)(),l=(0,T.A)(),c=(0,s.hb)(e=>{try{const s=JSON.parse(e.data),{eventType:n,eventData:l}=s;switch(n){case"web_app_open_tg_link":if(!t){const e=o.jsp+l.path_full;r({url:e})}i();break;case"payment_form_submit":a&&a(l);break;default:i()}}catch(e){}},[i,t,r,a]);return(0,s.vJ)(()=>(window.addEventListener("message",c),()=>window.removeEventListener("message",c)),[c]),(0,ie.Y)("div",{className:"ConfirmPayment",children:(0,ie.Y)("iframe",{src:e,title:l("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"})})}),yA=(0,s.ph)((0,n.EK)(e=>{const{payment:t}=(0,c.nTw)(e);return{errorKey:t.error?.messageKey,passwordHint:e.twoFaSettings.hint,savedCredentials:"regular"===t.form?.type?t.form.savedCredentials:void 0}})(({isActive:e,errorKey:t,state:i,savedCredentials:a,passwordHint:o,onPasswordChange:r})=>{const{clearPaymentError:l}=(0,n.ko)(),c=(0,T.A)(),d=(0,Ri.A)(),[h,u]=(0,s.J0)(!1),m=(0,s.Kr)(()=>a?.length&&i.savedCredentialId?a.find(({id:e})=>e===i.savedCredentialId)?.title:void 0,[a,i.savedCredentialId]);return(0,ie.FD)("div",{className:"PaymentInfo",children:[(0,ie.Y)(Kd.A,{isBig:!0,isPasswordVisible:h}),(0,ie.Y)(Al.A,{error:t&&d.withRegular(t),hint:o,description:c("PaymentConfirmationMessage",m),placeholder:c("Password"),onClearError:l,shouldShowSubmit:!1,shouldResetValue:e,isPasswordVisible:h,onChangePasswordVisibility:u,onInputChange:r})]})}));var SA=i(63173);const kA=i.p+"mastercard.790db81f7978635f77d8.svg",NA=i.p+"mir.e3a390b90e2e3e292621.svg",wA=i.p+"visa.fb39984c9532c0336be9.svg",IA=(0,s.ph)(({value:e,error:t,onChange:i,isActive:n})=>{const a=(0,T.A)(),o=(0,s.li)();(0,s.vJ)(()=>{n&&!u.TF&&(0,r.YS)(()=>{(0,nc.A)(o.current)})},[n]);const[l,c]=(0,s.J0)(dA.Default);(0,s.vJ)(()=>{const t=uA(e);c(t)},[]);const d=(0,s.hb)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),s=uA(e.target.value);c(s),i(t)},[i]),h=function(e){switch(e){case dA.Mastercard:return(0,ie.Y)("img",{src:kA,draggable:!1,alt:""});case dA.Visa:return(0,ie.Y)("img",{src:wA,draggable:!1,alt:""});case dA.Mir:return(0,ie.Y)("img",{src:NA,draggable:!1,alt:""});default:return}}(l);return(0,ie.FD)("div",{className:"CardInput",children:[(0,ie.Y)(X.A,{ref:o,label:a("PaymentCardNumber"),onChange:d,value:e,inputMode:"numeric",className:l?"has-right-addon":"",error:t,tabIndex:0,maxLength:19,teactExperimentControlled:!0}),(0,ie.Y)("span",{className:"right-addon",children:h})]})}),PA=(0,s.ph)(({value:e,error:t,onChange:i})=>{const n=(0,T.A)(),a=(0,s.hb)(t=>{const s=t.target.value;e.endsWith("/")&&e.length>s.length?i(s):i(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("/"):""}(t.target.value))},[i,e]);return(0,ie.Y)(X.A,{label:n("PaymentCardExpireDate"),onChange:a,value:e,error:t,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})}),YA=(0,s.ph)(({state:e,canSaveCredentials:t,needCardholderName:i,needCountry:n,needZip:a,countryList:o,dispatch:r,isActive:l})=>{const c=(0,s.li)();(0,s.vJ)(()=>{c.current&&c.current.value!==e.billingCountry&&(c.current.value=e.billingCountry)},[e.billingCountry]);const d=(0,s.hb)(e=>{r({type:"changeCardNumber",payload:e})},[r]),h=(0,s.hb)(e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[r]),u=(0,s.hb)(e=>{r({type:"changeExpiryDate",payload:e})},[r]),m=(0,s.hb)(e=>{const t=e.target.value.replace(/[^0-9]/g,"");r({type:"changeCvvCode",payload:t})},[r]),p=(0,s.hb)(e=>{r({type:"changeBillingCountry",payload:e.target.value})},[r]),v=(0,s.hb)(e=>{r({type:"changeBillingZip",payload:e.target.value})},[r]),g=(0,s.hb)(e=>{r({type:"changeSaveCredentials",payload:e.target.value})},[r]),A=(0,T.A)(),f=(0,Ri.A)(),{formErrors:b={}}=e;return(0,ie.Y)("div",{className:"PaymentInfo",children:(0,ie.FD)("form",{children:[(0,ie.Y)("h5",{children:A("PaymentCardTitle")}),(0,ie.Y)(IA,{onChange:d,value:e.cardNumber,error:b.cardNumber&&f.withRegular(b.cardNumber),isActive:l}),i&&(0,ie.Y)(X.A,{label:A("Checkout.NewCard.CardholderNamePlaceholder"),onChange:h,value:e.cardholder,inputMode:"text",tabIndex:0,error:b.cardholder&&f.withRegular(b.cardholder)}),(0,ie.FD)("section",{className:"inline-inputs",children:[(0,ie.Y)(PA,{value:e.expiry,onChange:u,error:b.expiry&&f.withRegular(b.expiry)}),(0,ie.Y)(X.A,{label:A("lng_payments_card_cvc"),onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:b.cvv&&f.withRegular(b.cvv),teactExperimentControlled:!0})]}),n||a?(0,ie.Y)("h5",{children:A("PaymentBillingAddress")}):void 0,(0,ie.FD)("section",{className:"inline-inputs",children:[n&&(0,ie.Y)(SA.A,{label:A("PaymentShippingCountry"),onChange:p,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:b.billingCountry&&f.withRegular(b.billingCountry),tabIndex:0,ref:c,children:o.map(({defaultName:t,name:i})=>(0,ie.Y)("option",{value:t,className:"county-item",selected:t===e.billingCountry,children:t||i}))}),a&&(0,ie.Y)(X.A,{label:A("PaymentShippingZipPlaceholder"),onChange:v,value:e.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:b.billingZip&&f.withRegular(b.billingZip)})]}),(0,ie.Y)("div",{className:"checkbox",children:(0,ie.Y)(Qs.A,{label:A("PaymentCardSavePaymentInformation"),checked:!!t&&e.saveCredentials,tabIndex:0,subLabel:A(t?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"),onChange:g,disabled:!t})})]})})}),FA=(0,s.ph)(({state:e,savedCredentials:t,dispatch:i,onNewCardClick:n})=>{const a=(0,T.A)(),o=(0,s.Kr)(()=>t?.length?t.map(({id:e,title:t})=>({label:t,value:e})):vi.p,[t]),r=(0,s.hb)(e=>{i({type:"changeSavedCredentialId",payload:e})},[i]);return(0,ie.Y)("div",{className:"PaymentInfo",children:(0,ie.FD)("form",{children:[(0,ie.Y)("h5",{children:a("PaymentCardTitle")}),(0,ie.Y)(te.A,{name:"saved-credentials",options:o,selected:e.savedCredentialId,onChange:r}),(0,ie.Y)(Z.A,{isText:!0,onClick:n,children:a("PaymentCheckoutMethodNewCard")})]})})}),DA=(0,s.ph)(({state:e,shippingOptions:t,currency:i,dispatch:n})=>{const a=(0,T.A)(),o=(0,Ri.A)();(0,s.vJ)(()=>{t&&t.length&&!e.shipping&&n({type:"changeShipping",payload:t[0].id})},[t,e.shipping,n]);const r=(0,s.hb)(e=>{n({type:"changeShipping",payload:e})},[n]),l=(0,s.Kr)(()=>t.map(({id:e,title:t,amount:s})=>({label:t,subLabel:(0,ca.vv)(o,s,i),value:e})),[t,i,o]);return(0,ie.Y)("div",{className:"Shipping",children:(0,ie.FD)("form",{children:[(0,ie.Y)("p",{children:a("PaymentShippingMethod")}),(0,ie.Y)(te.A,{name:"shipping-options",options:l,onChange:r,selected:e.shipping})]})})}),MA=(0,s.ph)(({state:e,needEmail:t,needPhone:i,needName:n,needAddress:a,countryList:o,dispatch:l})=>{const c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)();(0,s.vJ)(()=>{h.current&&h.current.value!==e.countryIso2&&(h.current.value=e.countryIso2)},[e.countryIso2]);const m=(0,T.A)(),p=(0,Ri.A)();(0,s.vJ)(()=>{u.TF||(0,r.YS)(()=>{(0,nc.A)(c.current)})},[c]);const v=(0,s.hb)(e=>{l({type:"changeAddress1",payload:e.target.value})},[l]),g=(0,s.hb)(e=>{l({type:"changeAddress2",payload:e.target.value})},[l]),A=(0,s.hb)(e=>{l({type:"changeCity",payload:e.target.value})},[l]),f=(0,s.hb)(e=>{l({type:"changeState",payload:e.target.value})},[l]),b=(0,s.hb)(e=>{l({type:"changeCountry",payload:o.find(t=>t.iso2===e.target.value)})},[o,l]),C=(0,s.hb)(e=>{l({type:"changePostCode",payload:e.target.value})},[l]),y=(0,s.hb)(e=>{l({type:"changeFullName",payload:e.target.value})},[l]),S=(0,s.hb)(e=>{l({type:"changeEmail",payload:e.target.value})},[l]),k=(0,s.hb)(e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,d.current&&(d.current.value=t),l({type:"changePhone",payload:t})},[l]),N=(0,s.hb)(e=>{l({type:"changeSaveInfo",payload:e.target.value})},[l]),{formErrors:w}=e;return(0,ie.Y)("div",{className:"ShippingInfo",children:(0,ie.FD)("form",{children:[a?(0,ie.FD)("div",{children:[(0,ie.Y)("h5",{children:m("PaymentShippingAddress")}),(0,ie.Y)(X.A,{ref:c,label:m("PaymentShippingAddress1Placeholder"),onChange:v,value:e.streetLine1,inputMode:"text",tabIndex:0,error:w.streetLine1&&p.withRegular(w.streetLine1)}),(0,ie.Y)(X.A,{label:m("PaymentShippingAddress2Placeholder"),onChange:g,value:e.streetLine2,inputMode:"text",tabIndex:0,error:w.streetLine2&&p.withRegular(w.streetLine2)}),(0,ie.Y)(X.A,{label:m("PaymentShippingCityPlaceholder"),onChange:A,value:e.city,inputMode:"text",tabIndex:0,error:w.city&&p.withRegular(w.city)}),(0,ie.Y)(X.A,{label:m("PaymentShippingStatePlaceholder"),onChange:f,value:e.state,inputMode:"text",error:w.state&&p.withRegular(w.state)}),(0,ie.Y)(SA.A,{label:m("PaymentShippingCountry"),onChange:b,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:w.countryIso2&&p.withRegular(w.countryIso2),ref:h,tabIndex:0,children:o.map(({defaultName:t,name:i,iso2:s})=>(0,ie.Y)("option",{value:s,className:"county-item",selected:s===e.countryIso2,children:t||i}))}),(0,ie.Y)(X.A,{label:m("PaymentShippingZipPlaceholder"),onChange:C,value:e.postCode,inputMode:"text",tabIndex:0,error:w.postCode&&p.withRegular(w.postCode)})]}):void 0,n||t||i?(0,ie.Y)("h5",{children:m("PaymentShippingReceiver")}):void 0,n&&(0,ie.Y)(X.A,{label:m("PaymentShippingName"),onChange:y,value:e.fullName,inputMode:"text",tabIndex:0,error:w.fullName&&p.withRegular(w.fullName)}),t&&(0,ie.Y)(X.A,{label:m("PaymentShippingEmailPlaceholder"),onChange:S,value:e.email,inputMode:"email",tabIndex:0,error:w.email&&p.withRegular(w.email)}),i&&(0,ie.Y)(X.A,{label:m("PaymentShippingPhoneNumber"),onChange:k,value:e.phone,inputMode:"tel",tabIndex:0,error:w.phone&&p.withRegular(w.phone),ref:d}),(0,ie.Y)(Qs.A,{label:m("PaymentShippingSave"),subLabel:m("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),tabIndex:0,onChange:N})]})})}),TA="stripe",BA="smartglocal",LA=new Set([TA,BA]),RA=(0,s.ph)((0,n.EK)(e=>{const{form:t,step:i,shippingOptions:s,error:n,confirmPaymentUrl:a,inputInvoice:o,requestId:r,stripeCredentials:d,smartGlocalCredentials:h,temporaryPassword:u,isExtendedMedia:m,url:p}=(0,c.nTw)(e).payment,{invoice:v,nativeParams:g,nativeProvider:A}=t||{},f=e.countryList.general;let b=t?.nativeProvider;!b&&p&&(b=p.startsWith("https://payment.smart-glocal.com")?BA:void 0);const C=o&&"chatId"in o?(0,c.hds)(e,o.chatId):void 0,y=Boolean(v&&(!b||!LA.has(b))),{needCardholderName:S,needCountry:k,needZip:N}=g||{},w=t?.botId?(0,c.mBe)(e,t.botId):void 0,I=(0,l.Yg)(w);return{step:i,chat:C,shippingOptions:s,nativeProvider:b,isProviderError:y,form:t,invoice:v,needCardholderName:S,needCountry:k,needZip:N,error:n,confirmPaymentUrl:a??p,isPaymentFormUrl:Boolean(!A&&p),countryList:f,requestId:r,hasShippingOptions:Boolean(s?.length),smartGlocalToken:h?.token,stripeId:d?.id,passwordValidUntil:u?.validUntil,isExtendedMedia:m,botName:I}})(({isOpen:e,onClose:t,step:i,shippingOptions:o,form:r,isProviderError:l,invoice:c,nativeProvider:d,needCardholderName:h,needCountry:u,needZip:m,confirmPaymentUrl:p,error:v,countryList:g,hasShippingOptions:A,requestId:f,smartGlocalToken:b,stripeId:C,passwordValidUntil:y,isExtendedMedia:S,isPaymentFormUrl:k,botName:N})=>{const{loadPasswordInfo:w,validateRequestedInfo:I,sendPaymentForm:P,setPaymentStep:Y,sendCredentialsInfo:D,clearPaymentError:B,validatePaymentPassword:L,setSmartGlocalCardInfo:R}=(0,n.ko)(),x=(0,T.A)(),E=(0,Ri.A)(),[V,_,O]=(0,F.A)(),[K,J]=(0,Cd.A)(pA,mA),[G,j]=(0,s.J0)(!1),[z,H]=(0,s.J0)(!1),[$,q]=(0,s.J0)(""),W=(0,U.A)(i,!0),X=(0,U.A)(f),te=i!==a.tn.ConfirmPayment,se=(0,s.hb)(e=>{Y({step:e})},[Y]);(0,s.vJ)(()=>{e&&(q(""),w(),_())},[e,w,_]),(0,s.vJ)(()=>{!e&&V&&O()},[O,V,e]),(0,s.vJ)(()=>{(void 0!==i||v)&&j(!1)},[i,v,f]),(0,s.vJ)(()=>{i!==a.tn.Checkout||i!==W||f===X||K.savedCredentialId||K.cardNumber||se(a.tn.PaymentInfo)},[K.cardNumber,K.savedCredentialId,X,W,f,se,i]),(0,s.vJ)(()=>{v?.field&&J({type:"setFormErrors",payload:{[v.field]:v.messageKey}})},[v,J]),(0,s.vJ)(()=>{if(r?.savedInfo){const{name:e,phone:t,email:i,shippingAddress:s}=r.savedInfo,{countryIso2:n,...a}=s||{},o=n&&g.find(({iso2:e})=>e===n).defaultName;J({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:i,...o&&{country:o,countryIso2:n,...a}}})}},[r,J,g]),(0,s.vJ)(()=>{r?.savedCredentials?.length&&J({type:"changeSavedCredentialId",payload:r.savedCredentials[0].id})},[J,r?.savedCredentials]);const ne=(0,s.hb)(()=>{B()},[B]),oe=(0,s.Kr)(()=>i!==a.tn.Checkout?0:function(e=[],t,i,s){const n=t?EA(t,i):[];let a=s;return a=e.concat(n||[]).reduce((e,t)=>e+t.amount,a),a}(c?.prices,o,K.shipping,K.tipAmount),[i,c?.prices,o,K.shipping,K.tipAmount]),re=(0,s.Kr)(()=>{if(i===a.tn.Checkout)return function(e,t,i){const s=function(e){const t=uA(e);return hA[t]||""}(e.cardNumber),n=s&&e.cardNumber?`${s} *${e.cardNumber.slice(-4)}`:void 0,a=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:o,fullName:r}=e,l=t?xA(t,e.shipping):void 0,c=l?.title;return{paymentMethod:n,paymentProvider:i,shippingAddress:a,name:r,phone:o,shippingMethod:c}}(K,o,d||"")},[i,K,o,d]),le=(0,s.hb)(()=>{se(a.tn.PaymentInfo)},[se]),ce=(0,s.hb)(()=>{B()},[B]),de=(0,s.hb)(()=>{P({shippingOptionId:K.shipping,saveCredentials:K.saveCredentials,savedCredentialId:K.savedCredentialId,tipAmount:K.tipAmount})},[P,K]),he=(0,s.hb)(e=>{const{credentials:t}=e;R(t),de()},[de]);function ue(e,t){switch(e){case a.tn.Checkout:return(0,ie.Y)(AA,{title:r.title,description:r.description,photo:r.photo,dispatch:J,shippingPrices:K.shipping&&o?EA(o,K.shipping):void 0,totalPrice:oe,invoice:c,checkoutInfo:re,isPaymentFormUrl:k,hasShippingOptions:A,tipAmount:K.tipAmount,needAddress:Boolean(c?.isShippingAddressRequested),savedCredentials:r.savedCredentials,isTosAccepted:z,onAcceptTos:H,botName:N});case a.tn.SavedPayments:return(0,ie.Y)(FA,{state:K,savedCredentials:r.savedCredentials,dispatch:J,onNewCardClick:le});case a.tn.ConfirmPassword:return(0,ie.Y)(yA,{state:K,savedCredentials:r.savedCredentials,onPasswordChange:q,isActive:e===i});case a.tn.PaymentInfo:return(0,ie.Y)(YA,{state:K,dispatch:J,canSaveCredentials:Boolean(!r.isPasswordMissing&&r.canSaveCredentials),needCardholderName:h,needCountry:u,needZip:m,countryList:g,isActive:t});case a.tn.ShippingInfo:return(0,ie.Y)(MA,{state:K,dispatch:J,needAddress:Boolean(c?.isShippingAddressRequested),needEmail:Boolean(c?.isEmailRequested||c?.isEmailSentToProvider),needPhone:Boolean(c?.isPhoneRequested||c?.isPhoneSentToProvider),needName:Boolean(c?.isNameRequested),countryList:g});case a.tn.Shipping:return(0,ie.Y)(DA,{state:K,dispatch:J,shippingOptions:o||[],currency:c.currency});case a.tn.ConfirmPayment:return(0,ie.Y)(CA,{url:p,noRedirect:S,onPaymentFormSubmit:he,onClose:O});default:return}}const me=(0,s.hb)(()=>{const{saveInfo:e}=K,t=function(e){const{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:a,postCode:o,fullName:r,phone:l,email:c}=e;return{name:r,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:a,postCode:o}}}(K);I({requestInfo:t,saveInfo:e})},[I,K]),ve=(0,s.hb)(()=>{const e=function(e){const{cardNumber:t,cardholder:i,expiry:s,cvv:n,billingCountry:a,billingZip:o}=e,[r,l]=s.split("/");return{data:{cardNumber:t,cardholder:i,expiryMonth:r,expiryYear:l,cvv:n,country:a,zip:o}}}(K);D({credentials:e})},[D,K]),ge=(0,M.A)(()=>{switch(i){case a.tn.ShippingInfo:j(!0),me();break;case a.tn.Shipping:se(a.tn.Checkout);break;case a.tn.SavedPayments:se(a.tn.ConfirmPassword);break;case a.tn.ConfirmPassword:if(""===$)return;j(!0),L({password:$});break;case a.tn.PaymentInfo:j(!0),ve(),J({type:"changeSavedCredentialId",payload:""});break;case a.tn.Checkout:{if(k)return j(!0),void se(a.tn.ConfirmPayment);if(r?.savedInfo&&!f&&!K.shipping)return j(!0),void me();if(K.savedCredentialId&&(!y||y<=Date.now()/1e3-3))return void se(a.tn.ConfirmPassword);if(!K.savedCredentialId&&(d===TA&&!C||d===BA&&!b))return void se(a.tn.PaymentInfo);const{phone:e,email:t,fullName:i}=K,s=c?.isEmailRequested&&!t||c?.isPhoneRequested&&!e||c?.isNameRequested&&!i;if(c?.isShippingAddressRequested&&!f||s)return void se(a.tn.ShippingInfo);if(c?.isShippingAddressRequested&&!K.shipping&&o?.length)return void se(a.tn.Shipping);j(!0),de();break}}});(0,s.vJ)(()=>i===a.tn.ConfirmPassword?(0,Fi.A)({onEnter:ge}):void 0,[ge,i]);const Ae=(0,s.hb)(()=>{J({type:"resetState"}),H(!1),t()},[t,J]),fe=(0,s.hb)(()=>{se(i===a.tn.ConfirmPassword?a.tn.SavedPayments:a.tn.Checkout)},[se,i]),be=(0,s.Kr)(()=>{switch(i){case a.tn.Checkout:return x("PaymentCheckout");case a.tn.ShippingInfo:return x("PaymentShippingInfo");case a.tn.Shipping:return x("PaymentShippingMethod");case a.tn.SavedPayments:return x("PaymentCheckoutMethod");case a.tn.ConfirmPassword:return x("Checkout.PasswordEntry.Title");case a.tn.PaymentInfo:return x("PaymentCardInfo");case a.tn.ConfirmPayment:return x("Checkout.WebConfirmation.Title");default:return""}},[i,x]),Ce=i===a.tn.Checkout?x("Checkout.PayPrice",(0,ca.Ad)(oe,c.currency,x.code)):E("PaymentInfoDone");if(l)return(0,ie.FD)(ee.A,{className:"error",isOpen:V,onClose:O,onCloseAnimationEnd:Ae,children:[(0,ie.Y)("p",{children:E("PaymentsProvidesNotSupported",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{isText:!0,onClick:O,children:x("OK")})})]});const ye=function(){if(G)return!0;switch(i){case a.tn.Checkout:return Boolean(c?.termsUrl)&&!z;case a.tn.PaymentInfo:return Boolean(""===K.cardNumber||h&&""===K.cardholder||""===K.cvv||""===K.expiry);default:return!1}}();return(0,ie.FD)(ee.A,{className:(0,pe.A)("PaymentModal",c?.isRecurring&&"recurring"),isOpen:V,onClose:O,onCloseAnimationEnd:Ae,children:[(0,ie.FD)("div",{className:"header",dir:E.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:i===a.tn.Checkout?O:fe,ariaLabel:E("Close"),children:(0,ie.Y)(Q.A,{name:i===a.tn.Checkout?"close":"arrow-left"})}),(0,ie.Y)("h3",{children:be})]}),void 0!==i?(0,ie.Y)(ae.Ay,{name:"slide",activeKey:i,shouldCleanup:!0,cleanupOnlyKey:a.tn.ConfirmPayment,children:e=>(0,ie.Y)("div",{className:"content custom-scroll",children:ue(i,e)})}):(0,ie.Y)("div",{className:"empty-content",children:(0,ie.Y)(Ve.A,{color:"gray"})}),te&&(0,ie.Y)("div",{className:"footer",children:(0,ie.Y)(Z.A,{className:"button-text",type:"submit",onClick:ge,disabled:ye,isLoading:G,children:Ce})}),v&&!v.field&&function(){if(v)return(0,ie.FD)(ee.A,{className:"error",isOpen:Boolean(v),onClose:ne,children:[(0,ie.Y)("h4",{children:v.descriptionKey?E.withRegular(v.descriptionKey):E("ErrorUnspecified")}),(0,ie.Y)("div",{className:"dialog-buttons mt-2",children:(0,ie.Y)(Z.A,{isText:!0,onClick:ce,children:E("OK")})})]})}()]})}));function xA(e,t){return e.find(({id:e})=>e===t)}function EA(e,t){const i=xA(e,t);return i?.prices}const VA=(0,s.ph)((0,n.EK)(e=>{const{receipt:t}=(0,c.nTw)(e).payment;return{receipt:t}})(({isOpen:e,onClose:t,receipt:i})=>{const n=(0,Ri.A)(),[a,o,r]=(0,F.A)();(0,s.vJ)(()=>{e&&o()},[e,o]);const l=(0,ol.A)(i),c=i||l,d=(0,s.Kr)(()=>{if(c)return function(e,t,i){if(!t)return{paymentMethod:e};const{shippingAddress:s}=t,n=s?.streetLine1?`${s.streetLine1}, ${s.city}, ${s.countryIso2}`:void 0,{phone:a,name:o}=t;return{paymentMethod:e,shippingAddress:n,name:o,phone:a,shippingMethod:i}}(c.credentialsTitle,c.info,c.shippingMethod)},[c]);return(0,ie.Y)(ee.A,{className:"PaymentModal PaymentModal-receipt",isOpen:a,onClose:r,onCloseAnimationEnd:t,children:c&&(0,ie.FD)(ie.FK,{children:[(0,ie.FD)("div",{className:"header",dir:n.isRtl?"rtl":void 0,children:[(0,ie.Y)(Z.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:r,ariaLabel:"Close",children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.FD)("h3",{children:[" ",n("PaymentReceipt")," "]})]}),(0,ie.Y)("div",{className:"receipt-content custom-scroll",children:(0,ie.Y)(AA,{shippingPrices:c.shippingPrices,totalPrice:c.totalAmount,tipAmount:c.tipAmount,invoice:c.invoice,checkoutInfo:d,title:c.title,description:c.description,photo:c.photo})})]})})})),_A="Qo4PtFZI",UA="wtfpombl",OA=(0,s.ph)((0,n.EK)((e,{modal:t})=>({chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0}))(({modal:e,chat:t})=>{const{sendInviteMessages:i,closeInviteViaLinkModal:a,openPremiumModal:o}=(0,n.ko)(),{missingUsers:r}=e||{},d=(0,Ri.A)(),[h,u]=(0,s.J0)([]),m=(0,s.Kr)(()=>r?.map(e=>e.id)||vi.p,[r]),[p,v]=(0,s.Kr)(()=>{if(!r?.length)return[[],[]];const[e,t]=(0,pi.jB)(r,e=>e.isRequiringPremiumToMessage);return[e.map(e=>e.id),t.map(e=>e.id)]},[r]),g=(0,s.Kr)(()=>{const e=(0,n.mS)();return r?.filter(e=>e.isRequiringPremiumToInvite||e.isRequiringPremiumToMessage).map(t=>(0,c.mBe)(e,t.id)).filter(Boolean)},[r]);(0,s.vJ)(()=>{u(v)},[v]);const A=(0,M.A)(()=>a()),f=(0,M.A)(()=>{i({chatId:t.id,userIds:h}),a()}),b=(0,M.A)(()=>{o()}),C=(0,s.Kr)(()=>{if(t)return Boolean(t?.isCreator||t?.adminRights?.inviteUsers)},[t]),y=(0,s.Kr)(()=>C?d(1===r?.length?"InviteBlockedOneMessage":"InviteBlockedManyMessage"):d("InviteRestrictedUsers",{count:r?.length},{pluralValue:r?.length||0,withMarkdown:!0,withNodes:!0}),[C,d,r?.length]),S=(0,s.Kr)(()=>{if(g?.length){if(1===g.length)return d("InviteRestrictedPremiumReasonSingle",{user:(0,l.Yg)(g[0])},{withMarkdown:!0,withNodes:!0});if(g.length<=3){const e=d.conjunction(g.map(e=>(0,l.Yg)(e)).filter(Boolean));return d("InviteRestrictedPremiumReasonMultiple",{list:e},{withMarkdown:!0,withNodes:!0})}if(g.length>3){const e=g.length-2,t=g.slice(0,2),i=d.conjunction(t.map(e=>(0,l.Yg)(e)).filter(Boolean));return d("InviteRestrictedPremiumReasonMultipleMore",{list:i,count:e},{pluralValue:e,withMarkdown:!0,withNodes:!0})}}},[g,d]),k=Boolean(g?.length),N=Boolean(v?.length);return(0,ie.FD)(ee.A,{isOpen:Boolean(m&&t),contentClassName:"n8eENbaR",hasAbsoluteCloseButton:!0,onClose:A,isSlim:!0,children:[k&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)(is.A,{className:"Nc3SOtKd",peers:g,size:"large"}),(0,ie.Y)("h3",{className:UA,children:d(C?"InviteBlockedPremiumTitle":"InviteBlockedNoLinkTitle")}),(0,ie.Y)("p",{className:_A,children:S}),(0,ie.Y)(Z.A,{withPremiumGradient:!0,isShiny:!0,onClick:b,children:d("InviteBlockedPremiumButton")})]}),k&&N&&(0,ie.Y)(Zl.A,{className:"UoMeVIyC",children:d("InviteBlockedOr")}),N&&(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:UA,children:d("InviteBlockedTitle")}),(0,ie.Y)("p",{className:_A,children:y}),(0,ie.Y)(gi.A,{className:"nEYyTS_m",itemIds:m,selectedIds:h,lockedUnselectedIds:p,lockedUnselectedSubtitle:d("InviteRestrictedPremiumReason"),onSelectedIdsChange:u,isViewOnly:!C,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),C&&(0,ie.Y)(Z.A,{className:"Ttkq3nqt",onClick:f,disabled:!h.length,children:d("InviteViaLinkButton")})]})]})}));var KA=i(84555);const JA=(0,s.ph)(({modal:e})=>{const{closeOneTimeMediaModal:t}=(0,n.ko)(),i=(0,T.A)(),s=(0,Yi.A)(e?.message,!0),{shouldRender:o,transitionClassNames:r}=(0,Je.A)(Boolean(e)),d=(0,M.A)(()=>{}),h=(0,M.A)(()=>{t()});if(!o||!s)return;const u=(0,l.Ie)(s),m=(0,c.SJA)((0,n.mS)()),p=i(u?"Chat.Voice.Single.Close":"Chat.Voice.Single.DeleteAndClose");return(0,ie.FD)("div",{className:(0,pe.A)("c3xMWwzW",r),children:[function(){if(!s?.content)return;const{voice:e,video:t}=s.content;return e?(0,ie.Y)(kc.Ay,{className:"VLiJWMs0",theme:m,message:s,origin:a.d9.OneTimeModal,autoPlay:!0,onPlay:d,onPause:h}):t?.isRound?(0,ie.Y)(KA.A,{className:"ML2YEpGq",message:s,origin:"oneTimeModal",onStop:h}):void 0}(),(0,ie.Y)("div",{className:"VWy1qXJL",children:(0,ie.Y)(Z.A,{faded:!0,onClick:h,pill:!0,size:"smaller",color:"dark"===m?"dark":"secondary",className:"FfMrCmD9",children:p})})]})}),GA=(0,s.ph)(({isOpen:e})=>{const t=(0,T.A)(),i=(0,Ri.A)(),{closeWebAppsCloseConfirmationModal:a,closeWebAppModal:o}=(0,n.ko)(),[r,l]=(0,s.J0)(!1),c=(0,s.li)(),d=(0,s.hb)(()=>{a({shouldSkipInFuture:r})},[r]),h=(0,s.hb)(()=>{o({shouldSkipConfirmation:!0}),a({shouldSkipInFuture:r})},[r]),u=(0,s.hb)(e=>{-1===e&&h()},[h]),m=(0,Ds.A)(c,e,u,".Button");return(0,ie.FD)(ee.A,{className:(0,pe.A)("confirm"),title:i("CloseMiniApps"),isOpen:e,onClose:d,children:[(0,ie.Y)("p",{children:i("AreYouSureCloseMiniApps")}),(0,ie.Y)(Qs.A,{className:"dialog-checkbox",label:i("DoNotAskAgain"),checked:r,onCheck:l}),(0,ie.FD)("div",{className:"dialog-buttons mt-2",ref:c,onKeyDown:m,children:[(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:h,color:"danger",children:t("Confirm")}),(0,ie.Y)(Z.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:t("Cancel")})]})]})}),jA=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.freezeUntilDate,i=e.appConfig.freezeAppealUrl,s=e.botFreezeAppealId?(0,c.mBe)(e,e.botFreezeAppealId):void 0;return{freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:s&&(0,l.Kl)(s)}})(({modal:e,freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:a})=>{const{closeFrozenAccountModal:o,openUrl:r}=(0,n.ko)(),l=(0,Ri.A)(),c=Boolean(e),d=(0,M.A)(()=>{o()}),h=(0,M.A)(()=>{o(),i&&r({url:i})}),u=(0,s.Kr)(()=>(0,ie.FD)("div",{className:"cW2rtp6M",children:[(0,ie.Y)(Cr.A,{size:160,tgsUrl:br.w.BannedDuck,noLoop:!0}),(0,ie.Y)("div",{className:"qLSm0uyC",children:l("FrozenAccountModalTitle")})]}),[l]),m=(0,s.Kr)(()=>{if(c)return(0,ie.FD)("div",{className:"Vj3QQ_JQ",children:[(0,ie.Y)(Z.A,{className:"anvg3JaY",onClick:h,noForcedUpperCase:!0,children:l("ButtonAppeal")}),(0,ie.Y)(Z.A,{isText:!0,onClick:d,noForcedUpperCase:!0,children:l("ButtonUnderstood")})]})},[l,c]),p=(0,s.Kr)(()=>{if(!t||!a)return;const e=new Date(1e3*t),i=(0,ie.Y)(No.A,{onClick:h,isPrimary:!0,children:(0,vc.A)(a)});return[["hand-stop",l("FrozenAccountViolationTitle"),l("FrozenAccountViolationSubtitle")],["lock",l("FrozenAccountReadOnlyTitle"),l("FrozenAccountReadOnlySubtitle")],["frozen-time",l("FrozenAccountAppealTitle"),l("FrozenAccountAppealSubtitle",{botLink:i,date:(0,$e.A)(e,l.code)},{withNodes:!0})]]},[l,a,t]);if(p)return(0,ie.Y)(hl.A,{isOpen:c,header:u,listItemData:p,footer:m,hasBackdrop:!0,onClose:d})})),zA="OvdHupR0",HA=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=e.currentUserId,s=t?.userId?(0,c.mBe)(e,t.userId):void 0,n=t?.userId?(0,c.vGo)(e,t.userId):void 0,a=n?.starsRating,o=n?.starsMyPendingRating,r=n?.starsMyPendingRatingDate;return{user:s,currentUserId:i,starsRating:a,pendingRating:o,pendingRatingDate:r}})(({modal:e,user:t,currentUserId:i,starsRating:a,pendingRating:o,pendingRatingDate:r})=>{const{closeProfileRatingModal:l}=(0,n.ko)(),c=(0,Ri.A)(),d=Boolean(e),[h,u]=(0,s.J0)(!1),m=(0,M.A)(()=>{l()});(0,s.vJ)(()=>{d||u(!1)},[d]);const p=(0,M.A)(()=>{u(!0)}),v=(0,M.A)(()=>{u(!1)}),g=e=>{const t="added"===e,i=c(t?"RatingBadgeAdded":"RatingBadgeDeducted"),s=t?"Lr6JUU14":"OxZxdqcn";return(0,ie.Y)("span",{className:(0,pe.A)("JdeFDQBI",s),children:i})},A=(0,s.Kr)(()=>{if(!(e&&t&&a&&d))return;const s=h&&o?o:a,n=s.stars,l=s.currentLevelStars,u=s.nextLevelStars,m=s.level,g=m+1,A=m<0,f=!h&&o?o.level:a.level;let b=0;b=u&&u>l?Math.max(.03,(n-l)/(u-l)):1;const C=A?.5:Math.max(0,Math.min(1,b)),y=r?r-Math.floor(Date.now()/1e3):0,S=o?o.stars-a.stars:0,k=o&&r;let N="none";m>=0&&f>=0&&m!==f&&(N=m>f?"forward":"backward"),m<0&&f<0&&m!==f&&(N=m<f?"backward":"forward");const w=c("ActionFallbackUser");return(0,ie.FD)("div",{className:"ChJT6ggP",children:[(0,ie.Y)(Or.A,{leftText:A?void 0:c("RatingLevel",{level:m}),rightText:A?c("RatingNegativeLevel"):c("RatingLevel",{level:g}),floatingBadgeIcon:A?"warning":"crown-wear",floatingBadgeText:A?m.toString():`${c.number(n)} / ${c.number(u||n)}`,progress:C,isPrimary:m>=0,isNegative:m<0,animationDirection:N,className:(0,pe.A)("XYpzs7CQ",k&&"UgviXkNW")}),(()=>{if(k)return(0,ie.Y)(ae.Ay,{name:"fade",className:(0,pe.A)("_K5HhOM0",A&&"X6iX4F56"),activeKey:h?1:0,shouldCleanup:!0,shouldRestoreHeight:!0,children:h?(0,ie.Y)("p",{children:c("DescriptionFutureRating",{time:(0,$e.A$)(c,y),points:Math.abs(S),link:(0,ie.Y)("span",{className:"dcNVNCXo",onClick:v,children:c("LinkDescriptionRatingBack")})},{pluralValue:Math.abs(S),withNodes:!0})}):(0,ie.Y)("p",{children:c("DescriptionPendingRating",{time:(0,$e.A$)(c,y),points:Math.abs(S),link:(0,ie.Y)("span",{className:"yY4hj8r_",onClick:p,children:c("LinkDescriptionRatingPreview")})},{pluralValue:Math.abs(S),withNodes:!0})})})})(),(0,ie.Y)("div",{className:"IvsV0tkW",children:c("TitleRating")}),(0,ie.Y)("p",{className:"ravQhVQQ",children:t?.id===i?c("RatingYourReflectsActivity"):c("RatingReflectsActivity",{name:(0,Dt.F9)(c,t)||w},{withMarkdown:!0,withNodes:!0})})]})},[e,t,i,a,o,r,h,c,p,v,d]),f=[["closed-gift",c("RatingGiftsFromTelegram"),(0,ie.FD)("span",{className:zA,children:[g("added"),c("RatingGiftsFromTelegramDesc")]})],["user-stars",c("RatingGiftsAndPostsFromUsers"),(0,ie.FD)("span",{className:zA,children:[g("added"),c("RatingGiftsAndPostsFromUsersDesc")]})],["stars-refund",c("RatingRefundsAndConversions"),(0,ie.FD)("span",{className:zA,children:[g("deducted"),c("RatingRefundsAndConversionsDesc")]})]],b=(0,s.Kr)(()=>{if(d)return(0,ie.Y)("div",{className:"XtZPIDLP",children:(0,ie.FD)(Z.A,{onClick:m,children:[(0,ie.Y)(Q.A,{name:"understood",className:"Lwz8rpdL"}),c("ButtonUnderstood")]})})},[c,d,m]);return(0,ie.Y)(hl.A,{contentClassName:"ndqkeHwR",isOpen:d,header:A,listItemData:f,footer:b,onClose:m})}));var $A=i(46442),qA=i(76786);const WA=(0,s.ph)((0,n.EK)((e,{chatId:t,threadId:i})=>{const s=(0,c.hds)(e,t),n=(0,c.C5H)(e,t,i||K.l3,"typingStatus"),a=(0,l.cG)(t,i||K.l3,e.currentUserId),o=s?.isForum&&i?(0,c.S0q)(e,t,i)?.unreadCount:s?.unreadCount;return{chat:s,connectionState:e.connectionState,isSyncing:e.isSyncing,isFetchingDifference:e.isFetchingDifference,typingStatus:n,isSavedDialog:a,unreadCount:o,hasUnreadMark:s?.hasUnreadMark}})(({chatId:e,threadId:t,chat:i,connectionState:s,isSyncing:a,isFetchingDifference:o,typingStatus:r,isSavedDialog:l,unreadCount:c,hasUnreadMark:d,onClose:h})=>{const u=(0,Ri.A)(),m=(0,T.A)(),{markChatMessagesRead:p}=(0,n.ko)(),{connectionStatusText:g}=(0,qA.A)(m,s,a||o,!0),A=(0,M.A)(()=>{p({id:e})}),f=l?u("SavedMessages"):void 0,b=l?String(K.l3):e,C=i?.isMonoforum?i.linkedMonoforumId:b;return(0,ie.FD)("div",{className:"LyrhszzE",children:[Boolean(c||d)&&(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:u("ChatListContextMaskAsRead"),onClick:A,className:"Bp8eDIso",children:(0,ie.Y)(Q.A,{name:"readchats"})}),(0,ie.Y)(Z.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:u("Close"),onClick:h,className:"jHVcj192",children:(0,ie.Y)(Q.A,{name:"close"})}),(0,ie.Y)("div",{className:"modal-title",children:(0,ie.Y)("div",{className:"FsTceiGs",children:(0,v.L8)(C)?(0,ie.Y)(bs.A,{userId:C,typingStatus:r,status:g||f,withDots:Boolean(g),withFullInfo:!1,withMediaViewer:!1,withStory:!1,withUpdatingStatus:!0,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},C):(0,ie.Y)(fs.A,{chatId:C,threadId:l?void 0:t,typingStatus:r,withMonoforumStatus:i?.isMonoforum,status:g||f,withDots:Boolean(g),withMediaViewer:!1,withFullInfo:!1,withUpdatingStatus:!0,withStory:!1,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},C)})})]})}));var QA=i(38353);const ZA=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:s,background:n,backgroundColor:a,patternColor:o}=(0,c.Gyz)(e,i)||{};return{theme:i,customBackground:n,backgroundColor:a,patternColor:o,isBackgroundBlurred:s}})(({modal:e,theme:t,customBackground:i,backgroundColor:a,patternColor:o,isBackgroundBlurred:r})=>{const{closeQuickPreview:l,openChat:c,openThread:d}=(0,n.ko)(),h=e?.chatId,u=e?.threadId,p=Boolean(h),v=(0,Pl.A)(t,i),g=(0,M.A)(()=>{l()}),A=(0,M.A)(()=>{h&&(u?d({chatId:h,threadId:u,shouldReplaceHistory:!0}):c({id:h,shouldReplaceHistory:!0}),l())});(0,s.vJ)(()=>p?(0,m.A)(g):void 0,[p,g]),(0,ye.A)({isActive:p,onBack:g});const{chatId:f,threadId:b}=(0,Yi.A)(e,!0)||{},C=(0,pe.A)(QA.A.background,i&&QA.A.customBgImage,a&&QA.A.customBgColor,i&&r&&QA.A.blurred);if(f)return(0,ie.Y)(ee.A,{isOpen:p,onClose:g,header:(0,ie.Y)(WA,{chatId:f,threadId:b,onClose:g}),className:"hJTLQd8O",contentClassName:"zUonvDbp",children:(0,ie.FD)("div",{className:"NYlix6SL",style:(0,wi.A)(`--pattern-color: ${o}`,a&&`--theme-background-color: ${a}`),onClick:A,children:[(0,ie.Y)("div",{className:C,style:v?`--custom-background: ${v}`:void 0}),(0,ie.Y)("div",{className:"IJ0EBwJk",children:(0,ie.Y)($A.A,{chatId:f,threadId:b||K.l3,type:"thread",canPost:!1,isReady:!0,withDefaultBg:Boolean(!i&&!a),isQuickPreview:!0})})]})})})),XA=(0,s.ph)((0,n.EK)(e=>({isStoryViewerOpen:(0,c.gd2)(e),stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,c.g29)(e)}))(({modal:e,isStoryViewerOpen:t,stealthMode:i,isCurrentUserPremium:a})=>{const{closeStealthModal:o,activateStealthMode:r,showNotification:l,openPremiumModal:c,openStoryViewer:d}=(0,n.ko)(),h=(0,Ri.A)(),u=(0,D.A)(),m=Boolean(i?.cooldownUntil&&i.cooldownUntil>(0,Ti.Fm)()),p=Boolean(e),v=(0,Yi.A)(e),{targetPeerId:g}=v||{},A=(0,M.A)(()=>{u()}),f=(0,M.A)(()=>{o()}),b=(0,M.A)(()=>{if(!a)return c({initialSection:"stories"}),void f();r(),l({title:{key:"StealthModeOnTitle"},message:{key:"StealthModeOnHintEnabled"}}),g&&d({peerId:g}),f()}),C=(0,s.Kr)(()=>(0,ie.FD)(ie.FK,{children:[(0,ie.Y)("h3",{className:"WJuiuEDm",children:h("StealthModeTitle")}),(0,ie.Y)("div",{className:"G9N9Bt0G",children:h(a?"StealthModeDescription":"StealthModeDescriptionPremium")})]}),[h,a]),y=(0,s.Kr)(()=>[["stealth-past",h("StealthModeHideRecentTitle"),h("StealthModeHideRecentDescription")],["stealth-future",h("StealthModeHideFutureTitle"),h("StealthModeHideFutureDescription")]],[h]),S=(0,s.Kr)(()=>a?m?h("StealthModeButtonRecharge",{timer:(0,ie.Y)(hd.A,{endsAt:i.cooldownUntil,onEnd:A})},{withNodes:!0}):h(g?"StealthModeButtonToStory":"StealthModeButton"):h("StealthModeButtonPremium"),[a,m,h,i,g]);return(0,ie.Y)(hl.A,{isOpen:p,className:(0,pe.A)(t&&"component-theme-dark"),header:C,headerIconName:"eye-crossed-outline",listItemData:y,buttonText:S,onButtonClick:b,onClose:f})}))}}]);
//# sourceMappingURL=9451.e652ee1b913babd03763.js.map