2 lines
759 KiB
JavaScript
2 lines
759 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[9451],{88430(e,t,i){i.r(t),i.d(t,{AboutAdsModal:()=>Bl,AboutMonetizationModal:()=>xl,AgeVerificationModal:()=>ul,AiMessageEditorModal:()=>lg,AiToneEmojiPickerModal:()=>cg,AiTonePreviewModal:()=>ug,ArchivedChats:()=>Dm,AttachBotInstallModal:()=>ko,AttachBotRecipientPicker:()=>ss,AttachmentModal:()=>Og,BirthdaySetupModal:()=>Fl,BoostModal:()=>sl,BotCommandMenu:()=>Tv,BotTrustModal:()=>So,CalendarModal:()=>ks,ChatCommandTooltip:()=>Mv,ChatFolderModal:()=>Mm,ChatInviteModal:()=>yl,ChatLanguageModal:()=>Bc,ChatlistModal:()=>Cl,CocoonModal:()=>rb,CollectibleInfoModal:()=>Ec,ContactList:()=>fm,ContextMenuContainer:()=>Lm.A,CountryPickerModal:()=>Yc,CreateTopic:()=>df,CustomEmojiSetsModal:()=>Vm,CustomEmojiTooltip:()=>xv,CustomSendMenu:()=>Ev,DeleteAccountModal:()=>dl,DeleteFolderDialog:()=>No,DeleteMessageModal:()=>dc,Dialogs:()=>os.A,DisableSharingAboutModal:()=>_C,DraftRecipientPicker:()=>ns,DropArea:()=>Vv.A,EditRankModal:()=>zC,EditTopic:()=>uf,EmojiInteractionAnimation:()=>Tc,EmojiStatusAccessModal:()=>Ul,EmojiTooltip:()=>Hv,ForwardRecipientPicker:()=>is,FrozenAccountModal:()=>xC,GifSearch:()=>sA,GiftCodeModal:()=>ll,GiveawayModal:()=>ur,HeaderMenuContainer:()=>Km,HistoryCalendar:()=>Ns,InlineBotTooltip:()=>Xv,InviteViaLinkModal:()=>MC,LeaveGroupModal:()=>sb,LeftSearch:()=>Vd,LocationAccessModal:()=>Ol,Management:()=>qf,MapModal:()=>cs,MediaViewer:()=>xt,MentionTooltip:()=>xg,MessageSelectToolbar:()=>pc,MessageStatistics:()=>JA,MiddleSearch:()=>Xm,MinimizedWebAppModal:()=>Rs,MuteChatModal:()=>Bm,NewChat:()=>Sm,NewContactModal:()=>Ps,OneTimeMediaModal:()=>BC,PasskeyModal:()=>kl,PaymentModal:()=>wC,PinMessageModal:()=>hc,PollModal:()=>sv,PollResults:()=>ZA,PremiumLimitReachedModal:()=>fr,PremiumMainModal:()=>Ra,PreparedMessageModal:()=>$l,PrivacySettingsNoticeModal:()=>yc,ProfileRatingModal:()=>EC,QuickChatPickerModal:()=>ab,QuickPreviewModal:()=>tb,RankModal:()=>QC,ReactionPicker:()=>rp,ReactorListModal:()=>Mc,ReceiptModal:()=>YC,ReportAdModal:()=>Jl,ReportModal:()=>Gl,SafeLinkModal:()=>rs,SeenByModal:()=>gc,SendAsMenu:()=>eA,Settings:()=>Am,SharePreparedMessageModal:()=>Ql,SponsoredContextMenuContainer:()=>Dl.A,Statistics:()=>LA,StatusPickerMenu:()=>Qr,StealthModeModal:()=>ib,StickerSearch:()=>nA,StickerSetModal:()=>Rm,StickerTooltip:()=>Bv,StoryStatistics:()=>qA,StoryViewer:()=>kn,SuggestMessageModal:()=>Xl,SuggestedPostApprovalModal:()=>tc,SuggestedStatusModal:()=>Xr,SymbolMenu:()=>Fv,TextFormatter:()=>Jv,ToDoListModal:()=>ov,TwoFaCheckModal:()=>ob,UnpinAllMessagesModal:()=>uc,UrlAuthModal:()=>gs,VerificationMonetizationModal:()=>Vl,WebAppModal:()=>yo,WebAppsCloseConfirmationModal:()=>LC});var n=i(84051),s=i(13439),o=i(89925),a=i(31481),r=i(66644),l=i(90709),c=i(11597),d=i(53827),h=i(63495),u=i(96454),m=i(11778),p=i(14680),g=i(48899),v=i(76023),A=i(49086);function f({message:e,avatarOwner:t,profilePhotos:i,standaloneMedia:n,mediaIndex:s,sponsoredMessage:o}){return t&&i?{type:"avatar",avatarOwner:t,profilePhotos:i,mediaIndex:s}:n?{type:"standalone",media:n,mediaIndex:s}:e?{type:"message",message:e,mediaIndex:s}:o?{type:"sponsoredMessage",message:o,mediaIndex:s}:void 0}function C(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:n,document:s,photo:o,video:a,paidMedia:r}=(0,l.r_)(i.message);if("chatEditPhoto"===n?.type||"suggestProfilePhoto"===n?.type)return{media:n.photo,isSingle:!0};if(s&&((0,l.Ml)(s)||(0,l.hr)(s)))return{media:s};const d=(0,c.Pn$)(e,i.message);if("full"===d?.webpageType){const{photo:e,video:t,document:i}=d,n=i&&((0,l.Ml)(i)||(0,l.hr)(i)),s=t||(n?i:void 0)||e;if(s)return{media:s,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=a||o;return h?{media:h}:void 0}var b=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 n=new Image;if(n.draggable=!1,n.oncontextmenu=y.A,"string"==typeof e?n.src=e:e instanceof HTMLCanvasElement?n.src=e.toDataURL():e instanceof HTMLVideoElement?n.src=e.poster:n.src=e.src,i.appendChild(n),t===o.TQ.ProfileAvatar||t===o.TQ.SettingsAvatar){i.classList.add("ProfileInfo"),t===o.TQ.SettingsAvatar&&i.classList.add("self");const e=document.querySelector(t===o.TQ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&i.appendChild(e.cloneNode(!0))}return i}function I(e,t,i){let n,s;switch(e){case o.TQ.Album:case o.TQ.ScheduledAlbum:n=`.Transition_slide-active > .MessageList #album-media-${(0,l.GZ)(t.id,i)}`,s=".full-media";break;case o.TQ.PreviewMedia:n=`#preview-media${i}`,s="img";break;case o.TQ.PollPreview:n=`#poll-media${(0,l.GZ)(t.id,i)}`,s="img.full-media, video.full-media, img.thumbnail:not(.blurred-bg), img, video";break;case o.TQ.SharedMedia:n=`#shared-media${(0,l.GZ)(t.id,i)}`,s="img";break;case o.TQ.SearchResult:n=`#search-media${(0,l.GZ)(t.id,i)}`,s="img";break;case o.TQ.MiddleHeaderAvatar:n=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",s=".avatar-media";break;case o.TQ.SettingsAvatar:n="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",s=".avatar-media";break;case o.TQ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",s=".avatar-media";break;case o.TQ.ChannelAvatar:case o.TQ.SuggestedAvatar:n=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,s=".Avatar img";break;case o.TQ.StarsTransaction:n=".transaction-media-preview",s=0===i?`.stars-transaction-media-${i} :is(img, video)`:void 0;break;case o.TQ.SponsoredMessage:n=".Transition_slide-active > .MessageList .sponsored-media-preview",s=`${a.KFG} img.full-media,${a.KFG} video.full-media,${a.KFG} img.thumbnail:not(.blurred-bg)`;break;case o.TQ.ScheduledInline:case o.TQ.Inline:default:n=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,s=`${a.KFG} img.full-media,${a.KFG} video.full-media,${a.KFG} img.thumbnail:not(.blurred-bg)`}const r=document.querySelector(n),c=s?r?.querySelectorAll(s):void 0;return{container:r,mediaEl:c?.[0]}}function P(e,t){switch(t){case o.TQ.Album:case o.TQ.ScheduledAlbum:case o.TQ.Inline:case o.TQ.ScheduledInline:case o.TQ.StarsTransaction:case o.TQ.PreviewMedia:case o.TQ.PollPreview:e.classList.add("rounded-corners");break;case o.TQ.SharedMedia:case o.TQ.SettingsAvatar:case o.TQ.ProfileAvatar:case o.TQ.SearchResult:e.firstChild.style.objectFit="cover";break;case o.TQ.MiddleHeaderAvatar:case o.TQ.SuggestedAvatar:case o.TQ.ChannelAvatar:e.classList.add("circle")}}var Y=i(43874),F=i(82117),D=i(37661),M=i(30857),T=i(17712),B=i(59030),L=i(41733),x=i(22237);const R=(0,x.n5)(!1),E=R[1],V=R;function _(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function U(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){a.Oig&&console.log("[MV] PictureInPicture Error",e)}}var O=i(29886),K=i(73767),J=i(34780),j=i(23174),G=i(32587),H=i(87679);const z=new Map;var $=i(35297);var q=i(62587),W=i(69419);const Q=v.cf,Z=({media:e,isAvatar:t,origin:i,delay:s})=>{const a=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===o.TQ.SharedMedia,p=i===o.TQ.SearchResult,g=e&&(0,l.JU)(e),A=(0,n.Kr)(()=>t=>{if(e)return!a&&!r||t?r&&t?(0,l.Pg)(e):(0,l.VO)(e,t?"full":"preview"):(0,l.mU)(e)},[r,a,e]),f=(0,q.A)(e&&(m||p||c)&&(0,l.VO)(e,"pictogram"),void 0,j.qZ.BlobUrl,s),C=A(),b=(0,q.A)(C,void 0,j.qZ.BlobUrl,s),{mediaData:y,loadProgress:S}=(0,W.A)(A(!0),void 0,e&&(0,l.Cz)(e,"full"),s),k=e&&"blobUrl"in e?e.blobUrl:void 0;let N=!d&&(k||y)||b||f;const w=function(e){const t=(0,n.li)();let i=!1;(0,$.A)(()=>{if(i=!0,t.current=void 0,!e)return;const n=new Image;if(n.src=e,!n.width)return;const s=(0,H.PR)(n);(0,G.A)(s.getContext("2d"),0,0,s.width,s.height,2,2),t.current=s.toDataURL()},[e]);const s=function(e,t=!1,i){const s=(0,n.li)(e?z.get(e):void 0),o=(0,n.li)(),a=(0,M.A)();return o.current&&t&&(clearTimeout(o.current),o.current=void 0),(0,n.vJ)(()=>{if(!e||s.current||t)return;const n=new Image;n.onload=()=>{const t=(0,H.PR)(n);(0,G.A)(t.getContext("2d"),0,0,t.width,t.height,2,2);const i=t.toDataURL();s.current=i,a(),z.size>=1e3&&z.clear(),z.set(e,i)},i?o.current=window.setTimeout(()=>{n.src=e},i):n.src=e},[e,i,a,t]),s.current}(e||void 0,Boolean(t.current));return t.current||!i&&s||e||void 0}(!N&&e&&(0,l.VD)(e));N||i===o.TQ.SearchResult||(N=w),r&&b&&(N=b);const I=k||y||(r||d?void 0:b||f||N),P=e&&(0,l.si)(e),Y=(0,n.Kr)(()=>t?r?v._e:v.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:Y,contentType:g,isVideoAvatar:r,loadProgress:S,mediaSize:P}};var X=i(64493),ee=i(40664),te=i(22337),ie=i(1087),ne=i(20021);const se=(0,n.ph)(({isOpen:e,peerId:t,photo:i,onClose:o,onCloseAnimationEnd:a})=>{const{reportProfilePhoto:r}=(0,s.ko)(),[l,c]=(0,n.J0)("spam"),[d,h]=(0,n.J0)(""),u=(0,T.A)(()=>{r({chatId:t,photo:i,reason:l,description:d}),o()}),m=(0,T.A)(e=>{c(e)}),p=(0,T.A)(e=>{h(e.target.value)}),g=(0,B.A)(),v=(0,n.Kr)(()=>[{value:"spam",label:g("lng_report_reason_spam")},{value:"violence",label:g("lng_report_reason_violence")},{value:"pornography",label:g("lng_report_reason_pornography")},{value:"childAbuse",label:g("lng_report_reason_child_abuse")},{value:"copyright",label:g("ReportPeer.ReasonCopyright")},{value:"illegalDrugs",label:"Illegal Drugs"},{value:"personalDetails",label:"Personal Details"},{value:"other",label:g("lng_report_reason_other")}],[g]);if(!t||!i)return;const A=g("ReportPeer.Report");return(0,ne.FD)(te.A,{isOpen:e,onClose:o,onEnter:e?u:void 0,onCloseAnimationEnd:a,className:"narrow",title:A,children:[(0,ne.Y)(ie.A,{className:"dialog-checkbox-group",name:"report-message",options:v,onChange:m,selected:l}),(0,ne.Y)(ee.A,{label:g("lng_report_reason_description"),value:d,onChange:p}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u,children:g("lng_report_button")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:g("Cancel")})]})]})});var oe=i(26607),ae=i(41036);const[re,le]=(0,x.n5)(1);function ce(){return(0,n._W)(()=>{le(1)}),[re,le]}const de=(0,n.ph)(({isOpen:e,photo:t,profileId:i,onClose:o,onConfirm:a})=>{const{deleteProfilePhoto:r,deleteChatPhoto:l}=(0,s.ko)(),c=(0,n.hb)(()=>{a?.(),(0,g.L8)(i)?r({photo:t}):l({photo:t,chatId:i}),o()},[a,i,o,r,t,l]),d=(0,B.A)();return(0,ne.Y)(te.A,{isOpen:e,onClose:o,onEnter:c,className:"delete dialog-buttons-column",title:d("AreYouSure"),children:(0,ne.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:c,children:d("Preview.DeletePhoto")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:d("Cancel")})]})})});var he=i(18276),ue=i(22699),me=i(24433),pe=i(35913);const ge=(0,n.ph)((0,s.EK)((e,{item:t,canUpdateMedia:i})=>{const n=(0,c.nTw)(e),{origin:s}=n.mediaViewer,o="message"===t?.type?t.message:void 0,a="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,o),m=(0,c.yuw)(e),p=o&&(0,c.ryq)(e,o?.chatId),{canDelete:g}=h&&o&&(0,c.WAX)(e,o,h)||{},v=r&&r.id===a?.avatarPhotoId,A=i&&Boolean(r),f=g||A,b=i&&Boolean(r)&&!v,y=d?.type;return{activeDownloads:m,isProtected:u,chat:l,isChatProtected:p,canDelete:f,canUpdate:b,messageListType:y,origin:s,viewableMedia:C(e,0,t)}})(({item:e,mediaData:t,isVideo:i,chat:o,isChatProtected:a,isProtected:r,canReportAvatar:c,canDelete:d,canUpdate:h,messageListType:u,activeDownloads:m,origin:p,viewableMedia:v,onReportAvatar:A,onCloseMediaViewer:f,onBeforeDelete:C,onForward:b})=>{const[y,S,k]=(0,D.A)(!1),[N,w]=ce(),{isMobile:I}=(0,Y.Ay)(),{downloadMedia:P,cancelMediaDownload:F,updateProfilePhoto:M,updateChatPhoto:L,openMediaViewer:x,openDeleteMessageModal:R}=(0,s.ko)(),E="message"===e?.type,{media:V}=v||{},_=V&&(0,l.sd)(V),U=V&&(0,l.$r)(m,V),{loadProgress:O}=(0,W.A)(V&&(0,l.VO)(V,"download"),!U,V&&(0,l.Cz)(V,"download")),K=(0,T.A)(()=>{if(V)if(U)F({media:V});else{const t="message"===e?.type?e.message:void 0;P({media:V,originMessage:t})}}),J=(0,T.A)(()=>{const e=N();w((e<0?e:0)-1)}),j=(0,T.A)(()=>{const e=N();w((e>0?e:0)+1)}),G=(0,T.A)(()=>{if("avatar"!==e?.type)return;const{avatarOwner:t,profilePhotos:i,mediaIndex:n}=e,s=i?.photos[n];(0,g.L8)(t.id)?M({photo:s}):L({chatId:t.id,photo:s}),x({origin:p,chatId:t.id,mediaIndex:0,isAvatarView:!0},{forceOnHeavyAnimation:!0})}),H=(0,B.A)(),z=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions",iconName:"more"}),[]);function $(){return"avatar"===e?.type?(0,ne.Y)(de,{isOpen:y,onClose:k,onConfirm:C,profileId:e.avatarOwner.id,photo:e.profilePhotos.photos[e.mediaIndex]}):void 0}const q=(0,T.A)(()=>{"message"===e?.type&&o?R({chatId:o?.id,messageIds:[e.message.id],isSchedule:"scheduled"===u,onConfirm:C}):S()});if(I){const n=[];if(E&&e.message.isForwardingAllowed&&!e.message.content.action&&!a&&n.push({icon:"forward",onClick:b,children:H("Forward")}),r||(i?n.push({icon:U?"close":"download",onClick:K,children:U?`${Math.round(100*O)}% Downloading...`:"Download"}):n.push({icon:"download",href:t,download:_,children:H("AccActionDownload")})),c&&n.push({icon:"flag",onClick:A,children:H("ReportPeer.Report")}),h&&n.push({icon:"copy-media",onClick:G,children:H("ProfilePhoto.SetMainPhoto")}),d&&n.push({icon:"delete",onClick:q,children:H("Delete"),destructive:!0}),0===n.length)return;return(0,ne.FD)("div",{className:"MediaViewerActions-mobile",children:[(0,ne.Y)(ue.A,{trigger:z,positionX:"right",children:n.map(({icon:e,onClick:t,href:i,download:n,children:s,destructive:o})=>(0,ne.Y)(me.A,{icon:e,href:i,download:n,onClick:t,destructive:o,children:s},e))}),U&&(0,ne.Y)(pe.A,{progress:O,size:"s",noCross:!0}),d&&$()]})}return(0,ne.FD)("div",{className:"MediaViewerActions",children:[E&&e.message.isForwardingAllowed&&!a&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Forward"),onClick:b,iconName:"forward"}),function(){if(!r&&"standalone"!==e?.type)return"sponsoredMessage"!==e?.type&&(i?(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("AccActionDownload"),onClick:K,children:U?(0,ne.Y)(pe.A,{progress:O,size:"s",onClick:K}):(0,ne.Y)(he.A,{name:"download"})}):(0,ne.Y)(X.A,{href:t,download:_,round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("AccActionDownload"),iconName:"download"}))}(),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("MediaZoomOut"),onClick:J,iconName:"zoom-out"}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("MediaZoomIn"),onClick:j,iconName:"zoom-in"}),c&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H(i?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:A,iconName:"flag"}),h&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("ProfilePhoto.SetMainPhoto"),onClick:G,iconName:"copy-media"}),d&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Delete"),onClick:q,iconName:"delete"}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Close"),onClick:f,iconName:"close"}),d&&$()]})}));var ve=i(87357),Ae=i(50442),fe=i(43336),Ce=i(37836),be=i(14737),ye=i(16581),Se=i(19129),ke=i(26072),Ne=i(15283);function we(e){const t=(0,n.li)(e());return(0,Ne.A)(()=>e.subscribe(()=>{t.current=e()})),t}var Ie=i(90423),Pe=i(39751),Ye=i(83414);const[Fe,De]=(0,x.n5)(!1),[Me,Te]=(0,x.n5)(!1);let Be,Le;const xe=(e,t)=>{(!e||t||function(){if(u.TF)return!0;if(!Be||!Le)return!1;const e=Le();if(!e)return!0;const t=Be.getBoundingClientRect();return e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom}())&&De(e)};function Re(e,t){Be=e,Le=t}function Ee(){return[(0,Ye.A)(()=>Fe()&&!Me(),[Fe,Me]),xe,Te]}var Ve=i(56494);const[_e,Ue]=(0,x.n5)(0);function Oe(){return(0,n._W)(()=>{Ue(0)}),[_e,Ue]}var Ke=i(5718),Je=i(672),je=i(97422);const Ge=({text:e="",buttonText:t,isForVideo:i,onClick:s,handleSponsoredClick:o,isProtected:a,isForceMobileVersion:r})=>{const[l,c]=(0,n.J0)(!1),{isMobile:d}=(0,Y.Ay)(),[h]=Ee(),m=(0,Se.A)(()=>!!u.TF&&!h(),[h]);(0,n.vJ)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;c(t>2*v.$)};t();const i=(0,Ce.nF)(t,500,!0);return window.addEventListener("resize",i,!1),()=>{window.removeEventListener("resize",i,!1)}},[]);const p=(0,T.A)(()=>{o()}),g=(0,ve.A)("MediaViewerFooter",i&&"is-for-video",m&&"is-hidden",a&&"is-protected",r&&"mobile");return(0,ne.FD)("div",{className:g,onClick:function(t){e&&t.stopPropagation()},children:[Boolean(e)&&(0,ne.Y)("div",{className:"media-viewer-footer-content",onClick:d?void 0:s,children:(0,ne.Y)("p",{className:"media-text custom-scroll allow-selection "+(l?"multiline":""),dir:"auto",children:e})}),Boolean(t)&&(0,ne.Y)(X.A,{className:(0,ve.A)("media-viewer-footer-content","media-viewer-button"),size:"default",color:"primary",isRectangular:!0,onClick:p,children:t})]})};var He=i(15640),ze=i(84313),$e=i(71533),qe=i(50680),We=i(73622);const[Qe,Ze]=(0,x.n5)(!1);function Xe(){return(0,n._W)(()=>{Ze(!1)}),[Qe,Ze]}var et=i(58744),tt=i(70832),it=i(71429),nt=i(82497),st=i(61433),ot=i(95807);class at{constructor(e){const[t,i,n,...s]=e.split("\n"),o=Number.parseFloat(i.split("=")[1]),a=Number.parseFloat(n.split("=")[1]);if(Number.isNaN(o)||Number.isNaN(a))throw new Error("Invalid storyboard map frame size");if(this.frames=s.map(e=>{if(!e.trim().length)return;const[t,i,n]=e.split(","),s={time:Number.parseFloat(t),left:Number.parseInt(i,10),top:Number.parseInt(n,10),width:o,height:a};if(Number.isNaN(s.time)||Number.isNaN(s.left)||Number.isNaN(s.top))throw new Error("Invalid storyboard map data");return s}).filter(Boolean),0===this.frames.length)throw new Error("Missing frames in storyboard map data")}getNearestPreview(e){let t=0,i=this.frames.length-1;for(;t<=i;){const n=Math.floor((t+i)/2);this.frames[n].time<=e?t=n+1:i=n-1}return this.frames[Math.max(0,t-1)]}}var rt=i(63988);const lt="Od9ZSc1U";let ct;const dt=(0,n.ph)(({storyboardInfo:e,duration:t,bufferedRanges:i,isReady:s,playbackRate:o,isActive:c,isPlaying:d,onSeek:h,onSeekStart:m})=>{const p=(0,n.li)(),[g]=Oe(),[v]=Xe(),A=(0,rt.aG)(g,250),[f,C]=(0,n.Ul)(A()),[y,S]=(0,n.Ul)(0),[k,N]=(0,n.Ul)(0),w=(0,n.li)(!1),[I,P]=(0,n.J0)(!1),[Y,F]=(0,n.J0)(!1),D=(0,n.li)(),M=(0,n.li)(),B=(0,n.li)(),L=(0,n.li)(),x=(0,n.li)(),R=e&&(0,l.mr)(e.storyboardFile,"full"),E=e&&(0,l.mr)(e.storyboardMapFile,"full"),V=(0,q.A)(R,!s),_=(0,q.A)(E,!s,j.qZ.Text);(0,n.vJ)(()=>{P(!1)},[c]),(0,n.vJ)(()=>{if(_)try{x.current=new at(_)}catch(e){a.Oig&&console.error("Error parsing storyboard map data",e,_)}},[_]);const U=(0,T.A)(e=>{const t=D.current;if(!x.current||!t)return;const i=x.current.getNearestPreview(e);N(Math.floor(i.time)),(0,r.RK)(()=>{(0,st.Tv)(t,{backgroundPosition:`${-i.left}px ${-i.top}px`})})});return(0,n.vJ)(()=>{if(ct&&ct(),ct=void 0,!w.current&&!Y){const e=A(),i=t-e;ct=(0,b.Hd)({from:e,to:t,duration:1e3*i/o,onUpdate:C})}},[A,Y,C,o,t]),(0,n.vJ)(()=>{d&&!v()||(ct&&ct(),ct=void 0)},[d,f,v]),(0,n.vJ)(()=>{if(d){ct&&ct(),ct=void 0;const e=A(),i=t-e;ct=(0,b.Hd)({from:e,to:t,duration:1e3*i/o,onUpdate:C})}},[d,o,t]),(0,n.Nf)(()=>{if(!B.current)return;const e=(0,fe.LI)(f()/t*100,2);B.current.style.width=`${e}%`},[f,t]),(0,n.Nf)(()=>{M.current&&(M.current.style.left=`${y()}px`)},[y]),(0,n.Nf)(()=>{L.current&&(L.current.innerText=(0,et.QO)(k()))},[k]),(0,n.vJ)(()=>{if(!p.current||!c)return;const i=p.current;let n=i.getBoundingClientRect(),s=0,o=0;const a=s=>{const o=(0,He.A)(s).x,a=(0,fe.qE)(t*((o-n.left)/n.width),0,t);if(!e)return[a,0];n.width||(n=i.getBoundingClientRect());const r=M.current;return[a,(0,fe.qE)(o-n.left-r.clientWidth/2,-4,n.width-r.clientWidth+4)]},r=()=>{ct&&ct(),ct=void 0},l=()=>{r(),w.current=!0,P(!1),F(!1),C(s),h(s),setTimeout(()=>{w.current=!1},250)},d=(0,Ae.wJ)(i,{onCapture:()=>{r(),P(!0),F(!0),m()},onRelease:l,onClick:l,onDrag:e=>{r(),P(!0),[s,o]=a(e),U(s),S(o),C(s)}});if(u.TF)return d;const g=e=>{P(!0),[s,o]=a(e),S(o),U(s)},v=()=>{P(!1)};return i.addEventListener("mousemove",g),i.addEventListener("mouseenter",g),i.addEventListener("mouseleave",v),()=>{d(),i.removeEventListener("mousemove",g),i.removeEventListener("mouseenter",g),i.removeEventListener("mouseleave",v)}},[t,U,c,h,m,S,C,F,I,o,e]),(0,ne.FD)("div",{className:"ingarEvU",ref:p,children:[e&&(0,ne.FD)(oe.A,{isOpen:!0,isHidden:!I,className:"TqpEWfl3",style:`width: ${e.frameSize.width}px; height: ${e.frameSize.height}px`,ref:M,children:[(0,ne.Y)("div",{ref:D,style:(0,ot.A)(`background-image: url(${V});`),className:"k3Ytd13f"}),(0,ne.Y)("div",{className:"bGiNvx5D",children:(0,ne.Y)("span",{className:"mnkqvOMR",ref:L})})]}),(0,ne.Y)("div",{className:lt,children:i.map(({start:e,end:t})=>(0,ne.Y)("div",{className:"ANe2DKfp",style:`left: ${100*e}%; right: ${100-100*t}%`},`${e}-${t}`))}),(0,ne.Y)("div",{className:lt,children:(0,ne.Y)("div",{ref:B,className:(0,ve.A)("igaGLblf",Y&&"beUP6SqY")})})]})}),ht=e=>{e.stopPropagation()},ut=[.5,1,1.5,2];function mt(e,t){return(0,ne.Y)("div",{className:"player-time",children:`${(0,et.QO)(e)} / ${(0,et.QO)(t)}`})}const pt=(0,n.ph)(({storyboardInfo:e,bufferedRanges:t,bufferedProgress:i,duration:s,isReady:o,fileSize:a,isForceMobileVersion:r,isPlaying:l,isFullscreenSupported:c,isFullscreen:d,isBuffered:h,volume:m,isMuted:p,playbackRate:g,isPictureInPictureSupported:v,onChangeFullscreen:A,onVolumeClick:f,onVolumeChange:C,onPlaybackRateChange:b,onPictureInPictureChange:y,onPlayPause:S,onSeek:k,onSeekingChange:N})=>{const[w,I,P]=(0,D.A)(),[F]=Oe(),M=(0,Se.A)(()=>Math.trunc(F()),[F]),[L,x]=(0,n.Ul)(!1),R=(0,n.li)(),{isMobile:E}=(0,Y.Ay)(),[V,_]=Ee(),U=(0,Se.A)(V);(0,n.vJ)(()=>{if(u.TF||r){if(U&&l&&!w&&!L())return R.current=window.setTimeout(()=>{_(!1)},3e3),()=>{R.current&&window.clearTimeout(R.current)};R.current&&window.clearTimeout(R.current)}},[l,U,_,w,L,r]),(0,n.Nf)(()=>(U?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[U]),(0,n.vJ)(()=>{U||P()},[P,U]);const O=(0,B.A)(),K=(0,T.A)(e=>{x(!1),k(e),N(!1)}),J=(0,T.A)(()=>{x(!0),N(!0)}),j=(0,n.Kr)(()=>0===m||p?"muted":m<.3?"volume-1":m<.6?"volume-2":"volume-3",[m,p]);return(0,ne.FD)("div",{className:(0,ve.A)("VideoPlayerControls",r&&"mobile",U&&"active"),onClick:ht,children:[(0,ne.Y)(dt,{storyboardInfo:e,duration:s,isReady:o,isPlaying:l,bufferedRanges:t,playbackRate:g,onSeek:K,onSeekStart:J,isActive:U}),(0,ne.FD)("div",{className:"buttons",children:[(0,ne.Y)(X.A,{ariaLabel:O("AccActionPlay"),size:"tiny",ripple:!E,color:"translucent-white",className:"play",round:!0,onClick:S,iconName:l?"pause":"play"}),(0,ne.Y)(X.A,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:f,iconName:j}),!u.pz&&(0,ne.Y)(nt.A,{bold:!0,className:"volume-slider",value:p?0:100*m,onChange:C}),mt(M,s),!h&&(0,ne.Y)("div",{className:"player-file-size",children:(0,ne.Y)(tt.A,{size:a,progress:i})}),(0,ne.Y)("div",{className:"spacer"}),(0,ne.Y)(X.A,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:I,children:`${g}x`}),v&&(0,ne.Y)(X.A,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:y,iconName:"pip"}),c&&(0,ne.Y)(X.A,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:A,iconName:d?"smallscreen":"fullscreen"})]}),(0,ne.Y)(it.A,{isOpen:w,className:(0,ve.A)("playback-rate-menu",!c&&"no-fullscreen",!v&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:P,children:ut.map(e=>(0,ne.Y)(me.A,{disabled:g===e,onClick:()=>b(e),children:`${e}x`}))})]})}),gt=(0,n.ph)(({url:e,storyboardInfo:t,isGif:i,posterData:o,posterSize:r,loadProgress:l,fileSize:c,isMediaViewerOpen:d,noPlay:h,volume:m,isMuted:p,playbackRate:g,isForceMobileVersion:v,shouldCloseOnClick:A,isProtected:f,isClickDisabled:C,isSponsoredMessage:b,timestamp:S,handleSponsoredClick:k,onClose:N})=>{const{setMediaViewerVolume:w,setMediaViewerMuted:I,setMediaViewerPlaybackRate:P,setMediaViewerHidden:F}=(0,s.ko)(),D=(0,n.li)(),[M,B]=(0,n.J0)(!u.TF||!u.pz),[x,R,V]=(0,Ie.Ay)(D,B),{isMobile:O}=(0,Y.Ay)(),K=D.current?.duration||0,J=i||K<=30,j=(0,T.A)(()=>{u.Nd||F({isHidden:!0})}),G=(0,T.A)(()=>{u.Nd||F({isHidden:!1})}),[H,z,$]=function(e,t,i){const[s,o]=(0,n.J0)(!1),[r,l]=(0,n.J0)(!1);(0,n.Nf)(()=>{if(u.pz&&u._7||!e.current)return;const n=e.current,s=_(n);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===s)return;n.autoPictureInPicture=!0,o(!0);const a=()=>{t(),l(!0),E(!0)},r=()=>{E(!1),l(!1),i()};return n.addEventListener("enterpictureinpicture",a),n.addEventListener("leavepictureinpicture",r),()=>{n.removeEventListener("enterpictureinpicture",a),n.removeEventListener("leavepictureinpicture",r)}},[e,t,i]);const c=(0,n.hb)(()=>{if(!e.current)return;const t=_(e.current);t?t("inline"):U()},[e]),d=(0,n.hb)(()=>{if(!e.current)return;c();const t=e.current,i=(0,L.e)(t),n=_(t);n?n("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){a.Oig&&console.log("[MV] PictureInPicture Error",e)}}(t),i&&(0,L.A)(t)},[e,c]);return s?[s,d,r]:[!1]}(D,j,G),[,q,W]=Ee(),[Q,Z]=(0,n.Ul)(!1),ee=(0,n.li)();(0,n.vJ)(()=>{const e=e=>{ee.current=(0,He.A)(e)};return window.addEventListener("mousemove",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}},[]),(0,n.vJ)(()=>(Re(D.current,()=>ee.current),()=>Re(void 0)),[]);const te=(0,T.A)((e,t)=>{const i=D.current?.getBoundingClientRect();i&&(e<=i.left||e>=i.right||t<=i.top||t>=i.bottom)&&(Q()||q(!1))}),ie=(0,T.A)(()=>{q(!0)}),se=(0,T.A)(e=>{te(e.clientX,e.clientY)}),oe=(0,T.A)(e=>{if(Z(e),!e&&ee.current){const{x:e,y:t}=ee.current;te(e,t)}}),{isReady:ae,isBuffered:re,bufferedRanges:le,bufferingHandlers:ce,bufferedProgress:de}=(0,$e.A)(),he=(0,ze.A)(D,void 0,!e),{shouldRender:ue,transitionClassNames:me}=(0,qe.A)(!re&&!he,void 0,void 0,"slow"),{shouldRender:ge,transitionClassNames:ve}=(0,qe.A)(u.pz&&!M&&!ue&&!he,void 0,void 0,"slow"),[,Ae]=Oe(),[,Ce]=Xe();(0,n.vJ)(()=>{W(ue)},[W,ue]),(0,n.vJ)(()=>{h||!d||he?D.current.pause():e&&!u.TF&&(0,L.A)(D.current)},[h,d,e,I,he]),(0,n.vJ)(()=>{D.current.volume=m},[m]),(0,n.vJ)(()=>{D.current.playbackRate=g},[g]),(0,n.vJ)(()=>{S&&(D.current.currentTime=S,Ae(S))},[Ae,S]);const be=(0,T.A)(e=>{e.stopPropagation(),M?(D.current.pause(),B(!1)):((0,L.A)(D.current),B(!0))}),ye=(0,T.A)(e=>{b&&(k?.(!0),N(e)),C||(A?N(e):be(e))});(0,We.A)(D,ce);const Se=(0,T.A)(e=>{const t=e.currentTarget;t.readyState>=4&&(Ce(!1),Ae(t.currentTime)),J||t.currentTime!==t.duration||(Ae(0),B(!1))}),ke=(0,T.A)(()=>{J||(Ae(0),B(!1),q(!0,!0))}),Ne=(0,T.A)(()=>{x&&V?V():!x&&R&&R()}),we=(0,T.A)(e=>{D.current.currentTime=e}),Pe=(0,T.A)(e=>{w({volume:e/100})}),Ye=(0,T.A)(()=>{D.current.muted=!D.current.muted,I({isMuted:!p})}),Fe=(0,T.A)(e=>{P({playbackRate:e})});(0,n.vJ)(()=>{if(!d)return;const e=e=>{if(!x)return;const t=D.current,i=(0,fe.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(),be(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)}},[be,d,x,$]);const De=r&&`width: ${r.width}px; height: ${r.height}px`,Me=`background-image: url(${o})`,Te=!u.TF&&!v;return(0,ne.FD)("div",{className:"VideoPlayer",onMouseMove:Te?ie:void 0,onMouseLeave:Te?se:void 0,children:[(0,ne.FD)("div",{style:De,children:[f&&(0,ne.Y)("div",{onContextMenu:y.A,onDoubleClick:u.TF?void 0:Ne,onClick:O?void 0:be,className:"protector"}),(0,ne.Y)("video",{ref:D,autoPlay:u.TF,controlsList:"nodownload",playsInline:!0,loop:J,muted:i||p,id:"media-viewer-video",style:Me,onWaiting:()=>Ce(!0),onPlay:()=>B(!0),onEnded:ke,onClick:O||x?void 0:ye,onDoubleClick:u.TF?void 0:Ne,...ce,onPause:e=>{B(!1),ce.onPause(e)},onTimeUpdate:Se,src:e})]}),ge&&(0,ne.Y)(X.A,{round:!0,className:`play-button ${ve}`,onClick:be,iconName:"play"}),ue&&(0,ne.FD)("div",{className:["spinner-container",me].join(" "),children:[!re&&(0,ne.Y)("div",{className:"buffering",children:"Buffering..."}),(0,ne.Y)(pe.A,{size:"xl",progress:re?1:l,onClick:N})]}),!i&&!b&&!he&&(0,ne.Y)(pt,{storyboardInfo:t,isPlaying:M,bufferedRanges:le,bufferedProgress:de,isBuffered:re,isFullscreenSupported:Boolean(R),isPictureInPictureSupported:H,isFullscreen:x,fileSize:c,duration:K,isReady:ae,isForceMobileVersion:v,onSeek:we,onChangeFullscreen:Ne,onPictureInPictureChange:z,onPlayPause:be,volume:m,playbackRate:g,isMuted:p,onVolumeClick:Ye,onVolumeChange:Pe,onPlaybackRateChange:Fe,onSeekingChange:oe})]})}),vt=(0,n.ph)((0,s.EK)((e,{item:t})=>{const{volume:i,isMuted:n,playbackRate:s,isHidden:o,origin:a,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=C(e,0,t),p=d&&(0,Ve.me)(e,d,!0);return{origin:a,textMessage:u,isProtected:d&&(0,c.ynf)(e,d),volume:i,isMuted:n,isHidden:o,playbackRate:s,threadId:l,timestamp:r,maxTimestamp:p,viewableMedia:m}})(({item:e,viewableMedia:t,isActive:i,textMessage:n,origin:o,withAnimation:r,isProtected:l,volume:c,playbackRate:d,isMuted:h,isHidden:m,isMoving:p,threadId:g,timestamp:f,maxTimestamp:C,onClose:b,onFooterClick:y,handleSponsoredClick:S})=>{const{updateLastPlaybackTimestamp:k}=(0,s.ko)(),N=(0,B.A)(),w="avatar"===e.type,I="sponsoredMessage"===e.type,{media:P}=t||{},{isVideo:F,isPhoto:D,bestImageData:M,bestData:L,dimensions:x,isGif:R,isVideoAvatar:E,mediaSize:V,loadProgress:_}=Z({media:P,isAvatar:w,origin:o,delay:!!r&&350}),[,U]=Ee(),[O]=Oe(),K=Boolean(P),{isMobile:J}=(0,Y.Ay)(),j=(0,T.A)(()=>{U(!0)}),G=(0,Je.A)(()=>{if(!i||!n||"video"!==P?.mediaType)return;if(P.duration<a.u4b)return;const e="id"in n?n:void 0,t=O();if(!t||!e||e.isInAlbum)return;const s=P.duration-t>1?t:void 0;k({chatId:e.chatId,messageId:e.id,timestamp:s})},[O,i,P,n],1e3);if((0,Ke.R)(G,[O]),!P)return;if("avatar"===e.type)return E?(0,ne.Y)("div",{className:"MediaViewerContent",children:(0,ne.Y)(gt,{url:L,isGif:!0,posterData:M,posterSize:(0,v.sk)(x,!1,!0),loadProgress:_,fileSize:V,isMediaViewerOpen:K&&i,isProtected:l,noPlay:!i,onClose:b,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:p,playbackRate:1,isSponsoredMessage:I,handleSponsoredClick:S},P.id)},P.id):(0,ne.Y)("div",{className:"MediaViewerContent",children:At(L,(0,v.sk)(x,!1),!J&&!l,l)},P.id);const H=n&&(n.content.action?"suggestProfilePhoto"===n.content.action.type?N("Conversation.SuggestedPhotoTitle"):void 0:(0,A.V)({message:n,maxTimestamp:C,threadId:g,forcePlayback:!0,isForMediaViewer:!0})),z=n&&"buttonText"in n?n.buttonText:void 0,$=Boolean(H),q=(0,v.sk)(x,$,F),W=J||function(e){return!!e&&e.width<350}(q);return(0,ne.FD)("div",{className:(0,ve.A)("MediaViewerContent",$&&"has-footer"),onMouseMove:W&&!u.TF?j:void 0,children:[D&&At(L,q,!J&&!l,l),F&&(i?(0,ne.Y)(gt,{url:L,storyboardInfo:"storyboardInfo"in P?P.storyboardInfo:void 0,isGif:R,posterData:M,posterSize:q,loadProgress:_,fileSize:V,isMediaViewerOpen:K&&i,noPlay:!i,onClose:b,isMuted:h,isHidden:m,isForceMobileVersion:W,isProtected:l,volume:c,isClickDisabled:p,playbackRate:d,isSponsoredMessage:I,handleSponsoredClick:S,timestamp:f},P.id):ft(M,q,!J&&!l,l)),H&&(0,ne.Y)(Ge,{text:H,buttonText:z,onClick:y,isProtected:l,isForceMobileVersion:W,isForVideo:F&&!R,handleSponsoredClick:S})]})}));function At(e,t,i,n){return e?(0,ne.FD)("div",{style:"position: relative;",children:[n&&(0,ne.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,ne.Y)("img",{src:e,alt:"",className:(0,ve.A)(n&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(i)})]}):(0,ne.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ne.Y)(je.A,{color:"white"})})}function ft(e,t,i,n){const s=t&&`width: ${t.width}px; height: ${t.height}px`,o=`background-image: url(${e})`;return e?(0,ne.FD)("div",{className:"VideoPlayer",children:[n&&(0,ne.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,ne.Y)("div",{style:s,children:(0,ne.Y)("video",{style:o,className:(0,ve.A)(n&&"is-protected"),draggable:Boolean(i)})})]}):(0,ne.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ne.Y)(je.A,{color:"white"})})}const{easeOutCubic:Ct,easeOutQuart:bt}=b.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,n.ph)(({item:e,isVideo:t,isGif:i,isOpen:s,withAnimation:o,isHidden:a,isLoadingMoreMedia:r,isSynced:l,loadMoreItemsIfNeeded:c,getNextItem:d,selectItem:h,onClose:m,onFooterClick:p,handleSponsoredClick:g})=>{const v=(0,n.li)(),A=(0,n.li)(),f=(0,n.li)(),C=(0,n.li)(),y=(0,n.li)({x:0,y:0,scale:1}),S=(0,n.li)(void 0),k=(0,n.li)(void 0),N=(0,n.li)(!1),[w,I]=(0,n.J0)(!0),[P]=ce(),Y=(0,n.li)(P()),F=(0,Ie.zk)(),[D,M]=(0,n.J0)(!1),[L,x]=(0,n.Ul)({x:0,y:0,scale:1}),R=we(L),[E,V]=(0,n.Ul)(e),_=we(E),U=(0,Se.A)(()=>1!==L().scale,[L]),O=(0,Se.A)(E),{height:K,width:J,isResizing:j}=(0,Pe.A)(),[G,H,z]=Ee(),$=(0,B.A)();(0,ke.A)({isActive:s,onBack:m,shouldBeReplaced:!0});const q=(0,ye.A)(h,[h],350,!0),W=(0,ye.A)(()=>{S.current=void 0},[],500,!0),Q=(0,ye.A)(e=>I(e),[],800,!0),Z=Boolean(i&&!u.pz),X=u.TF?40:J/10,ee=(0,T.A)(e=>{if(!u.TF)return;const t=K-e.pageY<80;!t&&e.pageX<X||!t&&e.pageX>J-X||H(!G())});(0,be.A)(()=>H(!0),St),(0,n.vJ)(()=>{const{scale:t,x:i,y:n}=R.current;0===i&&0===n&&1===t&&V(e)},[e,V,R]),(0,n.vJ)(()=>{l&&O&&!r&&c(O)},[O,c,l,r]),(0,n.Nf)(()=>{const{x:e,y:t,scale:i}=L();z(1!==i),f.current&&(f.current.style.transform=Pt(-J+e-yt)),A.current&&(A.current.style.transform=Pt(e,t,i)),C.current&&(C.current.style.transform=Pt(J+e+yt))},[L,z,J]),(0,n.vJ)(()=>{if(!v.current||void 0===_.current||a||F)return;let e=y.current;const t={x:0,y:0},i={x:0,y:0},n={x:0,y:0};let s,r=Date.now();const l=(0,Ce.sg)(()=>{r=Date.now()},500,!1,!0),c=t=>{const i=_.current;if(void 0===i)return!1;const n=d(i,t);if(void 0!==n){const i=(J+yt)*t,s=R.current.x+i;return I(!1),V(n),q(n),Q(!0),e={x:0,y:0,scale:1},o?(kt=(0,b.Hd)({from:s,to:0,duration:St,timing:Ct,onUpdate:e=>x({y:0,x:e,scale:1})}),!0):(x(e),!0)}return!1},h=e=>{const{scale:t}=R.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}=R.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},g=({x:e,y:t,scale:i},n=0)=>{const s=k.current;if(!s)return[{x:e,y:t,scale:i},!0,!0];const o=(J-J*i)/2,a=(K-K*i)/2,r=Math.max(-s.left*i,o),l=J-s.right*i,c=(0,fe.Bt)(e,l,r);e=(0,fe.qE)(e,l,r);const d=Math.max(-s.top*i+n,a),h=K-s.bottom*i,u=(0,fe.Bt)(t,h,d);return[{x:e,y:t=(0,fe.qE)(t,h,d),scale:i},c,u]},f=s=>{if(N.current)return void(N.current=!1);"mouseup"===s.type&&M(!1);const o=R.current,{y:a,scale:l}=o;let c=o.x;const h=Math.abs(c),u=Math.abs(a);if(W(),Q(!0),l<1)return e={x:0,y:0,scale:1},void(kt=(0,b.Hd)({from:[c,a,l],to:[0,0,1],duration:St,timing:Ct,onUpdate:e=>x({x:e[0],y:e[1],scale:e[2]})}));if(l>1){const o=Math.min(l,4),d=o/l;let h=c*d+(i.x-d*i.x),u=a*d+(i.y-d*i.y);const m=.15;if("wheel"!==s.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*n.x,u-=Math.abs(t.y)*i*m*n.y}return[e]=g({x:h,y:u,scale:o},60),void(kt=(0,b.Hd)({from:[c,a,l],to:[e.x,e.y,e.scale],duration:St,timing:Ct,onUpdate:e=>x({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:c,y:a,scale:l},u>=50)return void m();if(u>0)return void(kt=(0,b.Hd)({from:a,to:0,duration:St,timing:Ct,onUpdate:e=>x({x:0,y:e,scale:l})}));const p=c<0?1:-1,v=_.current,A=v&&d(v,c<0?1:-1),f=n.x<0?-1:1;void 0!==A&&h>=50&&p===f&&(c+=(J+yt)*p,V(A),q(A)),kt=(0,b.Hd)({from:c,to:0,duration:St,timing:Ct,onUpdate:e=>x({y:0,x:e,scale:l??1})})},C=(0,Ae.wJ)(v.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:n}=R.current;if("mousedown"!==e.type||(M(!0),1===n)){if(r=Date.now(),0===t&&0===i&&1===n){if(!A.current)return;if(s=A.current.querySelector("img, video"),!s)return;k.current=s.getBoundingClientRect()}}else e.preventDefault()},onDrag:(i,s,{dragOffsetX:o,dragOffsetY:a},r)=>{if(N.current||Ft(i))return;if(u.pz&&"touchstart"===s.type){const{pageX:e}=s.touches[0];if(e<=Ae.h6||e>=J-Ae.h6)return}kt&&(kt(),kt=void 0),n.x=t.x-o,n.y=t.y-a,t.x=o,t.y=a;const c=Math.abs(o),d=Math.abs(a),{x:h,y:m,scale:p}=R.current;if(l(),1!==p){const t=e.x+o,n=e.y+a;if(["wheel","mousemove"].includes(i.type)){const[e,i,s]=g({x:t,y:n,scale:p},60);return r&&r(!i,!s),void x(e)}return void("touches"in i&&1===i.touches.length&&x({x:t,y:n,scale:p}))}if("mousemove"!==i.type){if(S.current!==wt.Vertical&&(S.current===wt.Horizontal||Math.abs(h)>Ae.no||c/d>Ae.fG)){S.current=wt.Horizontal,I(!1);const e=J+yt,t=(0,fe.qE)(o,-e,e);return x({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)>Ae.no||d/c>Ae.fG){S.current=wt.Vertical;const e=K,t=(0,fe.qE)(a,-e,e);x({x:0,y:t,scale:p}),"wheel"===i.type&&Math.abs(t)>100&&(f(i),N.current=!0)}}},onZoom:(t,{zoom:n,zoomFactor:s,initialCenterX:o,initialCenterY:a,dragOffsetX:r,dragOffsetY:l,currentCenterX:c,currentCenterY:d})=>{kt&&kt(),o=o||J/2,a=a||K/2,c=c||J/2,d=d||K/2;const h=n??(0,fe.qE)(e.scale*s,.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 v=m+o,A=p+a,f=v-u*v,C=A-u*A,[b]=g({x:e.x+f+r,y:e.y+C+l,scale:h});x(b)},onClick(t){M(!1);const[i,n]=h(t);if(i){if(t.preventDefault(),t.stopPropagation(),u.TF)return;n||m()}else 1!==e.scale||u.TF||!Z&&Yt(t.target,".VideoPlayer")||m()},onDoubleClick(t,{centerX:i,centerY:n}){const[s]=h(t);if(s)return t.preventDefault(),void t.stopPropagation();if(!u.TF&&"wheel"!==t.type)return;const{x:o,y:a,scale:r}=R.current;if(1===r){if(0!==o||0!==a)return;e=g({x:i-3*i,y:n-3*n,scale:3})[0]}else e={x:0,y:0,scale:1};kt=(0,b.Hd)({from:[o,a,r],to:[e.x,e.y,e.scale],duration:St,timing:Ct,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};x(t)}})},onRelease:f});return document.addEventListener("keydown",p,!1),()=>{C(),document.removeEventListener("keydown",p,!1)}},[_,W,X,d,F,a,m,q,V,Q,x,Z,R,K,J,o]),(0,n.vJ)(()=>{const e=P(),t=void 0!==Y.current&&Y.current!==e;if(!v.current||!t||a||F)return;Y.current=e;const{scale:i}=R.current,n=e>0?-1:1;let s=100,o=0;i<=.6&&n>0||i>=12&&n<0||(1===i&&n>0&&(s=20),Nt&&Nt(),Nt=(0,b.Hd)({from:n,to:n*s,duration:St,timing:bt,onUpdate:e=>{if(!v.current)return;const t=(0,fe.LI)(e-o,2);o=e;const i=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});v.current.dispatchEvent(i)}}))},[P,a,F,R]);const[te,ie]=(0,n.Kr)(()=>void 0===O?[void 0,void 0]:[d(O,-1),d(O,1)],[O,d]);if(void 0===O)return;const se=void 0!==te,oe=void 0!==ie,ae=D&&U;return(0,ne.FD)("div",{className:"MediaViewerSlides",ref:v,children:[(0,ne.Y)("div",{className:"MediaViewerSlide",ref:f,children:se&&!U&&!j&&(0,ne.Y)(vt,{withAnimation:o,isMoving:ae,item:te,onClose:m,onFooterClick:p,handleSponsoredClick:g})}),(0,ne.Y)("div",{className:(0,ve.A)("MediaViewerSlide","MediaViewerSlide--active",ae&&"MediaViewerSlide--moving"),onClick:ee,ref:A,children:(0,ne.Y)(vt,{item:O,withAnimation:o,isActive:w,isMoving:ae,onClose:m,onFooterClick:p,handleSponsoredClick:g})}),(0,ne.Y)("div",{className:"MediaViewerSlide",ref:C,children:oe&&!U&&!j&&(0,ne.Y)(vt,{withAnimation:o,isMoving:ae,item:ie,onClose:m,onFooterClick:p,handleSponsoredClick:g})}),se&&!U&&!u.TF&&(0,ne.Y)("button",{type:"button",className:`navigation prev ${t&&!i&&"inline"}`,"aria-label":$("AccDescrPrevious"),dir:$.isRtl?"rtl":void 0}),oe&&!U&&!u.TF&&(0,ne.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,s.EK)((e,{item:t})=>{const i="message"===t?.type?t.message:void 0,n=i&&(0,c.Y7C)(e,i);return{owner:"avatar"===t?.type?t.avatarOwner:n}})(({owner:e,item:t})=>{const{closeMediaViewer:i,focusMessage:o,toggleChatInfo:a}=(0,s.ko)(),{isMobile:r}=(0,Y.Ay)(),c=(0,T.A)(()=>{if(i(),"message"!==t?.type)return;const e=t.message;r?setTimeout(()=>{a({force:!1},{forceSyncOnIOs:!0}),o({chatId:e.chatId,messageId:e.id})},350):o({chatId:e.chatId,messageId:e.id})}),d=(0,B.A)(),h=(0,n.Kr)(()=>{if(!t||"standalone"===t.type)return;const e="avatar"===t.type?t.avatarOwner:void 0,i="avatar"===t.type?t.profilePhotos:void 0,n=i?.photos[t.mediaIndex],s=n?.id===i?.fallbackPhoto?.id,o=n?.id===i?.personalPhoto?.id,a="message"===t.type?t.message.date:n?.date;if(!a)return;const r=(0,et.fS)(d,1e3*a,!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(n){const t=(0,g.L8)(e.id)?void 0:e,i=t&&(0,l.WX)(t),n=t&&(0,l.YE)(t);m.push(d(o?"lng_mediaview_profile_photo_by_you":s?"lng_mediaview_profile_public_photo":i?"lng_mediaview_channel_photo":n?"lng_mediaview_group_photo":"lng_mediaview_profile_photo"))}return!u||o||s||m.push(u),m.push(r),m.join(" • ")},[t,d]);if(!e)return;const u=(0,Dt.F9)(d,e);return(0,ne.FD)("div",{className:"SenderInfo",onClick:c,children:[(0,ne.Y)(Tt.A,{size:"medium",peer:e},e.id),(0,ne.FD)("div",{className:"meta",children:[(0,ne.Y)("div",{className:"title",dir:"auto",children:u&&(0,Mt.A)(u)}),(0,ne.Y)("div",{className:"date",dir:"auto",children:h})]})]})}),Lt=250,xt=(0,n.ph)((0,s.EK)(e=>{const{mediaViewer:t,shouldSkipHistoryAnimations:i}=(0,c.nTw)(e),{chatId:n,threadId:s,messageId:a,origin:r,isHidden:d,withDynamicLoading:h,standaloneMedia:u,mediaIndex:m,isAvatarView:p,isSponsoredMessage:v}=t,A=(0,c.xYJ)(e,"mediaViewerAnimations"),{currentUserId:b,isSynced:y}=e,S=Boolean(n)&&(0,c.nZ4)(e,n);if(p){const t=(0,c.PVB)(e,n);let o=!1;t&&(o=(0,g.L8)(t.id)?t.id===b:(0,l.SJ)(t));const p=(0,c.IVq)(e,n),v=f({avatarOwner:t,standaloneMedia:u,profilePhotos:p,mediaIndex:m}),k=C(e,0,v);return{profilePhotos:p,avatar:p?.photos[m],avatarOwner:t,isLoadingMoreMedia:p?.isLoading,isChatWithSelf:S,canUpdateMedia:o,withAnimation:A,origin:r,shouldSkipHistoryAnimations:i,isHidden:d,standaloneMedia:u,mediaIndex:m,isSynced:y,currentItem:v,viewableMedia:k,chatId:n,threadId:s,messageId:a,message:void 0,collectedMessageIds:void 0,chatMessages:void 0,sponsoredMessage:void 0,withDynamicLoading:h}}let k,N;n&&a&&(k=r&&[o.TQ.ScheduledAlbum,o.TQ.ScheduledInline].includes(r)?(0,c.Jl6)(e,n,a):(0,c.O5q)(e,n,a)),v&&n&&r===o.TQ.SponsoredMessage&&(N=(0,c.v8U)(e,n));const w=f({message:k,standaloneMedia:u,mediaIndex:m,sponsoredMessage:N}),I=C(e,0,w);let P;n&&(P=r&&[o.TQ.ScheduledAlbum,o.TQ.ScheduledInline].includes(r)?(0,c.yFI)(e,n):(0,c.zeq)(e,n));let Y=!1;const F=r===o.TQ.Inline,D=r===o.TQ.Album;let M;if(n&&s&&a)if(h&&(F||D)){const t=(0,c.CuV)(e);Y=Boolean(t?.isLoading);const{foundIds:i}=t?.currentSegment||{};M=i}else if(r===o.TQ.SharedMedia){const t=(0,c.BU_)(e),i=t?.resultsByType,n=I&&(0,l.JU)(I?.media),{foundIds:s}=n&&i?.[n]||{};M=s}else(F||D)&&(M=(0,c.Lzh)(e,n,s,a)||(0,c.gCU)(e,n,s));return{chatId:n,threadId:s,messageId:a,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:C,canUpdateMedia:y,origin:L,avatar:x,avatarOwner:R,profilePhotos:E,chatMessages:_,sponsoredMessage:j,standaloneMedia:G,mediaIndex:H,withAnimation:z,isHidden:$,shouldSkipHistoryAnimations:q,withDynamicLoading:W,isLoadingMoreMedia:Q,isSynced:ee,currentItem:te,viewableMedia:ie})=>{const{openMediaViewer:re,closeMediaViewer:le,openForwardMenu:ce,focusMessage:de,toggleChatInfo:he,searchChatMediaMessages:ue,loadMoreProfilePhotos:me,clickSponsored:pe,openUrl:ve}=(0,s.ko)(),Ae=Boolean(R||c||G||j),{isMobile:fe}=(0,Y.Ay)(),{media:Ce,isSingle:be}=ie||{},ye=(0,n.li)(),Se=c?.senderId||R?.id||c?.chatId,ke=(0,K.A)(Se),Ne=z?"slideFade":"none",we=Boolean(z&&!q),[Ie,Pe,Ye]=(0,D.A)(),{isVideo:Fe,isPhoto:De,bestImageData:Me,bestData:Te,dimensions:Be,isGif:Le,contentType:xe}=Z({media:Ce,isAvatar:Boolean(R),origin:L,delay:we&&Lt}),Re=(()=>{if(C)return!1;if("avatar"!==te?.type||!R)return!1;const e=te.profilePhotos;return Ce!==e.personalPhoto})(),Ee=(0,n.Kr)(()=>W?f:(0,l.lH)(_||{},f||[],xe||"media"),[_,f,xe,W]);!Ae||ke&&ke===Se&&void 0!==ye.current||(ye.current=be?0:i||H);const[Ve]=V;(0,n.vJ)(()=>{if(!Ae||Ve())return;(0,p.FD)();const e=(0,J.w4)();return()=>{e(),(0,p.wb)()}},[Ae,Ve]),(0,n.vJ)(()=>{$&&Ae||U()},[$,Ae]),(0,n.vJ)(()=>{fe&&(0,r.RK)(()=>{document.body.classList.toggle("is-media-viewer-open",Ae)})},[fe,Ae]);const _e=(0,M.A)();(0,n.vJ)(()=>{const e=window.matchMedia(v.wy);return e.addEventListener("change",_e),()=>{e.removeEventListener("change",_e)}},[_e]);const Ue=(0,O.A)(c),Oe=(0,O.A)(L),Ke=(0,O.A)(te),Je=(0,O.A)(Me),je="message"===te?.type?te.message:void 0,Ge=je?(0,A.V)({message:je,forcePlayback:!0,isForMediaViewer:!0}):void 0,He=Boolean(Ge);(0,F.A)(([e,t])=>{e===Ae&&t===$||(we&&Ae&&!Ke&&((0,n.VK)(Lt+a.xB5),function(e,t,i,n,s,l,c){const{mediaEl:d}=I(t,l,c);if(!d)return;const{width:h}=N.A.get(),{width:m,height:p}=(0,v.$w)(e,s),{width:g,height:A}=(0,v.ky)(m,p,n.width,n.height),f=(h-g)/2,C=function(e){const t=window.matchMedia(v.wy);let i=4.125;return e&&!u.TF&&(i+=t.matches?.875:2.125),i*v.$}(e)+(p-A)/2;let{top:y,left:S,width:k,height:Y}=d.getBoundingClientRect();if([o.TQ.SharedMedia,o.TQ.Album,o.TQ.ScheduledAlbum,o.TQ.SearchResult].includes(t)){const e=function(e,t,i,n,s,o){if(e===t){const a=Math.max(s,o)*(e/t);n-=(a-s)/2,i-=(a-o)/2,s=a,o=a}else if(e>t){const i=s;n-=((s=o*(e/t))-i)/2}else if(t>e){const n=o;i-=((o=s*(t/e))-n)/2}return{top:i,left:n,width:s,height:o}}(g,A,y,S,k,Y);y=e.top,S=e.left,k=e.width,Y=e.height}const F=S+k/2-(f+g/2),D=y+Y/2-(C+A/2),M=k/g,T=Y/A;(0,r.RK)(()=>{const e=w(i||d);(0,b.ZM)(e,{top:`${C}px`,left:`${f}px`,width:`${g}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+a.xB5)})})}(He,L,Me,Be,Fe,c,H)),we&&!Ae&&Ke&&((0,n.VK)(Lt+a.xB5),function(e,t,i,n){const{container:s,mediaEl:l}=I(e,i,n);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:g,width:v,height:A}=l.getBoundingClientRect();let f=p;if(!(0,k.Y)(s)){const{height:e}=N.A.get();f=p<d?-A:e}const C=h+u/2-(g+v/2),y=d+m/2-(f+A/2);let Y=u/v,F=m/A;const D=[o.TQ.Inline,o.TQ.ScheduledInline,o.TQ.Album,o.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);[o.TQ.SharedMedia,o.TQ.Album,o.TQ.ScheduledAlbum,o.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:n}=M.getBoundingClientRect();B={transition:"none",top:`${f}px`,left:`${g}px`,transformOrigin:"top left",transform:`translate3d(${t-g}px, ${e-f}px, 0) scale(${i/v}, ${n/A})`,width:`${v}px`,height:`${A}px`}}else B={top:`${f}px`,left:`${g}px`,width:`${v}px`,height:`${A}px`,transform:`translate3d(${C}px, ${y}px, 0) scale(${Y}, ${F})`};(0,r.RK)(()=>{(0,b.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+a.xB5)})})}(Oe,Je,Ue,Ke?.mediaIndex)))},[Ae,$,Me,Be,He,we,Fe,c,L,Je,Ke,Ue,Oe,H]);const ze=(0,T.A)(()=>le()),$e=(0,T.A)(n=>{n.target instanceof HTMLElement&&n.target.closest("a")||(ze(),e&&i&&(fe?setTimeout(()=>{he({force:!1},{forceSyncOnIOs:!0}),de({chatId:e,threadId:t,messageId:i})},Lt):de({chatId:e,threadId:t,messageId:i})))}),qe=(0,T.A)(t=>{j&&e&&(pe({isMedia:t,isFullscreen:!0,randomId:j.randomId}),ve({url:j.url}),le())}),We=(0,T.A)(()=>{ce({fromChatId:e,messageIds:[i]})});(0,n.vJ)(()=>Ae?(0,m.A)(()=>{ze()}):void 0,[ze,Ae]),(0,n.vJ)(()=>{Fe&&!Le&&(0,d._K)()},[Le,Fe]);const Qe=(0,T.A)(i=>{if(i&&!Q){if("avatar"===i.type){if(!(i.mediaIndex>=i.profilePhotos.photos.length-4))return;me({peerId:i.avatarOwner.id})}"message"===i.type&&W&&ue({chatId:e,threadId:t,currentMediaMessageId:i.message.id})}}),Ze=(0,T.A)((e,t)=>{if(0===t||be)return;if("standalone"===e.type){const{media:i,mediaIndex:n}=e,s=n+t;return s>=0&&s<i.length?{type:"standalone",media:i,mediaIndex:s}:void 0}if("avatar"===e.type){const{avatarOwner:i,profilePhotos:n,mediaIndex:s}=e,o=s+t;return o>=0&&n&&o<n.photos.length?{type:"avatar",avatarOwner:i,profilePhotos:n,mediaIndex:o}:void 0}if("sponsoredMessage"===e.type){const{message:i,mediaIndex:n}=e,s=n+t;return s>=0&&i?{type:"sponsoredMessage",message:i,mediaIndex:s}:void 0}const{message:i,mediaIndex:n}=e,s=(0,l.qG)(i);if(s){const e=n+t;if(e>=0&&e<s.extendedMedia.length)return{type:"message",message:i,mediaIndex:e}}const o=Ee?.indexOf(i.id);if(void 0===o||-1===o)return;const a=Ee[o+t],r=_?.[a];return r?{type:"message",message:r}:void 0}),Xe=(0,T.A)(e=>{if(!e)return void ze();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,n="standalone"===e.type?e.media:void 0;re({origin:L,chatId:t,messageId:i,standaloneMedia:n,mediaIndex:e.mediaIndex,isAvatarView:"avatar"===e.type,withDynamicLoading:W},{forceOnHeavyAnimation:!0})}),et=(0,T.A)(()=>{if((E?.photos.length||G?.length||Ee?.length||0)<=1||!te)return void ze();const e=Ze(te,-1);e?Xe(e):"avatar"===te.type&&(0,g.L8)(te.avatarOwner.id)||"standalone"===te.type||ze()}),tt=(0,B.A)();return(0,ne.FD)(oe.A,{id:"MediaViewer",isOpen:Ae,isHidden:$,shouldAnimateFirstRender:!0,noCloseTransition:q,children:[(0,ne.FD)("div",{className:"media-viewer-head",dir:tt.isRtl?"rtl":void 0,"data-tauri-drag-region":!(!h.Vq||!u.MP)||void 0,children:[fe&&(0,ne.Y)(X.A,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",iconName:"close",ariaLabel:tt("Close"),onClick:ze}),(0,ne.Y)(ae.Ay,{activeKey:ye.current,name:Ne,children:(0,ne.Y)(Bt,{item:te},Ce?.id)}),(0,ne.Y)(ge,{mediaData:Te,isVideo:Fe,item:te,canUpdateMedia:y,canReportAvatar:Re,onBeforeDelete:et,onReportAvatar:Pe,onCloseMediaViewer:ze,onForward:We}),(0,ne.Y)(se,{isOpen:Ie,onClose:Ye,photo:x,peerId:R?.id})]}),(0,ne.Y)(It,{item:te,loadMoreItemsIfNeeded:Qe,isLoadingMoreMedia:Q,isSynced:ee,getNextItem:Ze,chatId:e,isPhoto:De,isGif:Le,threadId:t,avatarOwnerId:R?.id,origin:L,isOpen:Ae,hasFooter:He,isVideo:Fe,withAnimation:z,onClose:ze,selectItem:Xe,isHidden:$,onFooterClick:$e,handleSponsoredClick:qe})]})}));var Rt=i(2429);const Et="W9A8SEMl",Vt="gLHHo5k8",_t="GJVwqV9e",Ut="_Yn4SWUB",Ot="hGCH03qc",Kt="ZecqXqKy",Jt="PVZ8TOWS",jt="Wi0DXPH2",Gt="Ka1CGfzq",Ht="urTtSsk9",zt="AjXOHOgE",$t="uAlXNXJN",qt="g8ypsnnC",Wt="hGTnZuar",Qt="TkphaPyQ",Zt="CvnxnCxN",Xt="nZ30pf4g",ei="MnNC7VHS",ti="G8OgmMDJ",ii=3.5*v.$,ni=.5*v.$;function si(e,t=!1,i=!1){const n=document.createElement("div");n.classList.add(i?"TYicp2_K":"fME2l_yv");const s=new Image;if(s.draggable=!1,s.oncontextmenu=y.A,s.classList.add("HjoURJRK"),t){const t=document.createElement("canvas");t.classList.add(ei),s.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:i,height:n}=s;(0,r.RK)(()=>{t.width=i,t.height=n,u.QH&&(e.filter="blur(2px)"),e.drawImage(s,-4,-4,i+8,n+8),u.QH||(0,G.A)(e,0,0,i,n,2,2)})},s.src=e,n.appendChild(t)}else s.src=e,n.appendChild(s);return n}function oi(e,t){let i;const n=`#${(0,l.kR)(t)}`;switch(e){case o.G9.StoryRibbon:i=`#LeftColumn .${Rt.A.root}`;break;case o.G9.MiddleHeaderAvatar:i=".MiddleHeader .Transition_slide-active .ChatInfo";break;case o.G9.ChatList:i="#LeftColumn .chat-list";break;case o.G9.SearchResult:i="#LeftColumn .LeftSearch--container"}const s=document.querySelector(i),a=s&&s.querySelectorAll(`${n} img`);return{container:s,mediaEl:a?.[0]}}function ai({scale:e,slideAmount:t,isActiveSlideSize:i,isMoveThroughActiveSlide:n,isBackward:s}){const o=40+(i?405:135),a=(Math.abs(t)-1)*(40+(n?405:135)),r=(0,fe.Ki)((o+a)*e);return s?-r:r}function ri(){const{width:e,height:t}=(0,Pe.A)();return(0,n.Kr)(()=>function(e,t){const i=function(e,t,i,n){const s=i/1200,o=n/800;return Math.min(s,o)}(0,0,e,t),n=(0,fe.Ki)(405*i),s=(0,fe.Ki)(135*i);return{activeSlide:{width:n,height:(0,fe.Ki)(720*i)},slide:{width:s,height:(0,fe.Ki)(240*i)},scale:i,toActiveScale:n/s,fromActiveScale:s/n}}(e,t),[e,t])}function li(e,t=!1,i=!1){const n=e&&"content"in e,s=e&&"isDeleted"in e,o=!!n&&(0,l.XR)(e),a=n&&Boolean(e.forwardInfo);let r;n&&(e.content.photo?.thumbnail&&(r=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(r=e.content.video.thumbnail.dataUri));const c=n?(0,l.EN)(e):void 0,d=(0,q.A)(c),h=Boolean(n&&e.content.video),u=n&&e.content.video?.noSound,m=n?(0,l.EN)(e,"full"):void 0,p=(0,q.A)(m,!e,h?j.qZ.Progressive:j.qZ.BlobUrl),g=h&&n?(0,l.EN)(e,"full",!0):void 0,v=(0,q.A)(g,!e,j.qZ.Progressive),A=Boolean(p||v),f=h?d:p||d,C=!d&&!A,b=t&&n&&!e.noForwards,y=n?(0,l.EN)(e,"download"):void 0;return{isLoadedStory:n,isDeletedStory:s,hasText:o,hasForwardInfo:a,thumbnail:r,previewHash:c,previewBlobUrl:d,isVideo:h,noSound:u,fullMediaHash:m,fullMediaData:p,altMediaHash:g,altMediaData:v,hasFullData:A,bestImageData:f,hasThumb:C,canDownload:b,downloadMediaData:(0,q.A)(y,!b&&!i)}}var ci=i(94189);const di=(0,n.ph)(function({isOpen:e,story:t,onClose:i}){const{deleteStory:o,openNextStory:a}=(0,s.ko)(),r=(0,B.A)(),l=(0,n.hb)(()=>{t&&(a(),o({peerId:t.peerId,storyId:t.id}),i())},[i,t]);return(0,ne.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),gi=i(79824),vi=i(54960);const Ai=(0,n.ph)(function({id:e,contactListIds:t,currentUserId:i,selectedIds:s,lockedIds:o,onSelect:a}){const r=(0,B.A)(),[l,c]=(0,n.J0)(""),d=(0,n.Kr)(()=>{const e=(t||[]).filter(e=>e!==i);return(0,pi.Am)((0,Dt.PU)({ids:[...s||[],...e],query:l,type:"user"}))},[t,i,l,s]);return(0,ne.Y)(vi.A,{itemIds:d,selectedIds:s??gi.p,lockedSelectedIds:o,filterValue:l,filterPlaceholder:r("Search"),searchInputId:`${e}-picker-search`,isSearchable:!0,withDefaultPadding:!0,forceShowSelf:!0,onSelectedIdsChange:a,onFilterChange:c,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"},e)});var fi=i(12933);const Ci=(0,n.ph)(function({isActive:e,contactListIds:t,usersById:i,currentUserId:o,onClose:a}){const{saveCloseFriends:r}=(0,s.ko)(),l=(0,B.A)(),[c,d]=(0,n.J0)(""),[h,u]=(0,n.J0)(!1),[m,p]=(0,n.J0)([]),g=(0,n.Kr)(()=>(t||[]).filter(e=>i[e]?.isCloseFriend),[t,i]),v=(0,n.Kr)(()=>{const e=(t||[]).filter(e=>e!==o);return(0,pi.Am)((0,Dt.PU)({ids:[...g,...e],query:c,type:"user"}))},[g,t,o,c]);(0,F.A)(([t])=>{!t&&e&&(u(!1),p(g))},[e,g]);const A=(0,n.hb)(e=>{p(e),u(!0)},[]),f=(0,T.A)(()=>{r({userIds:m}),a()});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(vi.A,{itemIds:v||[],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,ne.Y)("div",{className:(0,ve.A)("BDK_pgpt",h&&"N8ujSwlC"),children:(0,ne.Y)(fi.A,{isShown:h,onClick:f,ariaLabel:l("Save"),iconName:"check"})})]})}),bi={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"},yi=[{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 Si=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(Si||{});const ki=(0,n.ph)((0,s.EK)(e=>{const{storyViewer:{storyId:t,peerId:i}}=(0,c.nTw)(e),n=i&&t?(0,c.Msb)(e,i,t):void 0;return{story:n&&"content"in n?n:void 0,visibility:n&&"visibility"in n?n.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}})(function({isOpen:e,story:t,visibility:i,contactListIds:o,usersById:a,currentUserId:r,onClose:c}){const{editStoryPrivacy:d,toggleStoryInProfile:h}=(0,s.ko)(),u=(0,B.A)(),[m,p,g]=(0,D.A)(!1),[v,A]=(0,n.J0)(i),[f,C]=(0,n.J0)(t?.isInProfile),[b,S]=(0,n.J0)(Si.privacy),[k,N]=(0,n.J0)("everybody"),w=b!==Si.privacy,I=(0,n.Kr)(()=>(o||[]).filter(e=>a[e]?.isCloseFriend),[o,a]),P=(0,n.Kr)(()=>{if(b===Si.allowList&&(!v?.allowUserIds?.length||v.allowUserIds[0]===r))return[r]},[b,r,v?.allowUserIds]),Y=(0,n.Kr)(()=>k!==v?.visibility?[]:v?.blockUserIds||[],[k,v?.blockUserIds,v?.visibility]),F=(0,T.A)(e=>{A({...v,allowUserIds:e?.length?e?.filter(e=>e!==r):[r]})}),M=(0,T.A)(e=>{A({...v,blockUserIds:e,visibility:k})});(0,n.vJ)(()=>{e&&(S(Si.privacy),p())},[e]),(0,n.vJ)(()=>{A(i)},[i]);const L=(0,T.A)(()=>{b!==Si.privacy?S(Si.privacy):g()}),x=(0,T.A)(()=>{C(!f)}),R=(0,T.A)(()=>{d({peerId:t.peerId,storyId:t.id,privacy:v}),t.isInProfile!==f&&h({peerId:t.peerId,storyId:t.id,isInProfile:f}),g()});return(0,ne.FD)(te.A,{isOpen:m,className:(0,ve.A)(bi.modal,"component-theme-dark"),onClose:g,noBackdrop:!0,onCloseAnimationEnd:c,children:[(0,ne.FD)("div",{className:bi.header,children:[(0,ne.Y)(X.A,{className:(0,ve.A)(bi.closeButton,"close-button"),round:!0,color:"translucent",size:"tiny",onClick:L,ariaLabel:u(w?"Common.Back":"Common.Close"),children:(0,ne.Y)("div",{className:(0,ve.A)("animated-close-icon",w&&"state-back")})}),(0,ne.Y)(ae.Ay,{name:"slideFade",activeKey:b,children:function(){switch(b){case Si.privacy:return(0,ne.Y)("h3",{className:bi.headerTitle,children:u("StoryPrivacyAlertEditTitle")});case Si.allowList:return(0,ne.Y)("h3",{className:bi.headerTitle,children:u("StoryPrivacyAlertSelectContactsTitle")});case Si.closeFriends:return(0,ne.Y)("h3",{className:bi.headerTitle,children:u("CloseFriends")});case Si.denyList:return(0,ne.Y)("h3",{className:bi.headerTitle,children:u("StoryPrivacyAlertExcludedContactsTitle")})}}()})]}),(0,ne.Y)(ae.Ay,{activeKey:b,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:bi.content,children:function(e){switch(b){case Si.privacy:return function(){const e=t?(0,hi.qZ)(t.expireDate-t.date):0;return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:bi.section,children:[(0,ne.Y)("h3",{className:bi.title,children:u("StoryPrivacyAlertSubtitleProfile")}),(0,ne.Y)("div",{className:bi.list,children:yi.map(e=>{return(0,ne.FD)("label",{className:(0,ve.A)(bi.option,e.value===v?.visibility&&bi.checked),children:[(0,ne.Y)("input",{type:"radio",name:"story_privacy",className:bi.input,value:e.value,checked:e.value===v?.visibility,onChange:()=>{return t=e.value,void A({...v,visibility:t});var t},teactExperimentControlled:!0}),(0,ne.Y)("span",{className:bi.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`,children:(0,ne.Y)(he.A,{name:e.icon})}),(0,ne.FD)("div",{className:bi.optionContent,children:[(0,ne.Y)("span",{className:(0,ve.A)(bi.option_name),children:u(e.name)}),e.actions&&(0,ne.FD)("div",{tabIndex:0,role:"button",className:bi.action,"aria-label":u("Edit"),onClick:t=>{!function(e,t){switch((0,y.A)(e),t){case"closeFriends":S(Si.closeFriends);break;case"allowUserIds":S(Si.allowList);break;case"blockUserIds":S(Si.denyList),N("everybody");break;case"blockContactUserIds":S(Si.denyList),N("contacts")}}(t,e.actions)},children:[(0,ne.Y)("span",{className:bi.actionInner,children:(t=e.actions,"closeFriends"===t?0===I.length?u("StoryPrivacyOptionCloseFriendsDetail"):1===I.length?(0,Dt.F9)(u,a[I[0]]):u("StoryPrivacyOptionPeople",I.length,"i"):"blockUserIds"===t&&"everybody"===v?.visibility||"blockContactUserIds"===t&&"contacts"===v?.visibility?v?.blockUserIds?.length?1===v.blockUserIds.length?u("StoryPrivacyOptionExcludePerson",(0,l.Yg)(a[v.blockUserIds[0]])):u("StoryPrivacyOptionExcludePeople",v.blockUserIds.length,"i"):u("StoryPrivacyOptionContactsDetail"):v?.allowUserIds&&0!==v.allowUserIds.length?1===v.allowUserIds.length?(0,l.Yg)(a[v.allowUserIds[0]]):u("StoryPrivacyOptionPeople",v.allowUserIds.length,"i"):u("StoryPrivacyOptionSelectedContactsDetail"))}),(0,ne.Y)(he.A,{name:"next"})]})]})]},e.value);var t})})]}),(0,ne.Y)("div",{className:bi.section,children:(0,ne.FD)(ui.A,{ripple:!0,onClick:x,children:[(0,ne.Y)("span",{children:u("StoryKeep")}),(0,ne.Y)(mi.A,{id:"group-notifications",label:u("StoryKeep"),checked:f,inactive:!0})]})}),(0,ne.FD)("div",{className:bi.footer,children:[(0,ne.Y)("div",{className:bi.info,children:u("StoryKeepInfo",e)}),(0,ne.Y)("div",{className:bi.submit,children:(0,ne.Y)(X.A,{onClick:R,children:u("StoryPrivacyButtonSave")})})]})]})}();case Si.closeFriends:return(0,ne.Y)(Ci,{isActive:e,contactListIds:o,currentUserId:r,usersById:a,onClose:L},"close-friends");case Si.denyList:return(0,ne.Y)(Ai,{id:"deny-list",contactListIds:o,currentUserId:r,selectedIds:Y,onSelect:M},"deny-list");case Si.allowList:return(0,ne.Y)(Ai,{id:"allow-list",contactListIds:o,lockedIds:P,currentUserId:r,selectedIds:v?.allowUserIds,onSelect:F},"allow-list")}}})]})}));var Ni=i(36353),wi=i(73104),Ii=i(14),Pi=i(52674),Yi=i(95362),Fi=i(48775),Di=i(80140),Mi=i(46051),Ti=i(45470),Bi=i(39351),Li=i(38218),xi=i(83057),Ri=i(66991),Ei=i(61157),Vi=i(92111),_i=i(17676),Ui=i(65843),Oi=i(55158),Ki=i(59816),Ji=i(91800),ji=i(23565),Gi=i(69282),Hi=i(11217),zi=i(39996),$i=i(86070),qi=i(39877);const Wi=(0,n.ph)((0,s.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:o,theme:a})=>{const{openStoryViewer:r,loadPeerStoriesByIds:l,openChat:c}=(0,s.ko)(),d=(0,n.li)(),h=(0,B.A)();(0,n.vJ)(()=>{!o&&t.fromPeerId&&t.storyId&&l({peerId:t.fromPeerId,storyIds:[t.storyId]})},[t,o]);const{className:u,style:m}=(0,zi.Ay)({peer:i,noUserColors:!0,shouldReset:!0,theme:a}),p=i?(0,Dt.F9)(h,i):t.fromName,v=(0,T.A)(()=>{const{fromPeerId:e,storyId:i}=t;e&&(!o||"isDeleted"in o&&o.isDeleted?c({id:e}):r({peerId:e,storyId:i,isSingleStory:!0}))}),{handleClick:A,handleMouseDown:f}=(0,Hi.Q)(v);return(0,ne.FD)($i.A,{ref:d,className:(0,ve.A)("EmbeddedMessage",e,u),style:m,dir:h.isRtl?"rtl":void 0,onClick:A,onMouseDown:f,children:[i?.color?.backgroundEmojiId&&(0,ne.Y)(qi.A,{emojiDocumentId:i.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),(0,ne.FD)("div",{className:"message-text",children:[function(){if(o&&"content"in o&&o.content.text)return(0,ne.Y)("p",{className:"embedded-text-wrapper",children:(0,Gi.fd)(o.content.text)})}(),(0,ne.Y)("div",{className:"message-title",children:function(){if(!i||!p)return;const e=(0,g.L8)(i.id)?"user-filled":"channel-filled";return(0,ne.FD)(ne.FK,{children:[e&&(0,ne.Y)(he.A,{name:e,className:"embedded-chat-icon"}),p&&(0,Mt.A)(p)]})}()})]})]})}));var Qi=i(45215);const Zi=(0,n.ph)(function({story:e,isExpanded:t,className:i,onExpand:s,onFold:o}){const a=(0,B.A)(),l=(0,n.li)(),c=(0,n.li)(),d=(0,n.li)(),h=(0,n.li)(),u=(0,Ii.A)(e,!0),m=u?.content.text,[p,g]=(0,n.J0)(!1),v=(0,ji.A)(t||void 0,400),A=t||v;(0,n.vJ)(()=>{(0,r.RK)(()=>{c.current&&(t?(0,st.YM)(c.current,Zt):(0,st.HW)(c.current,Zt))})},[t]);const f=p&&!A,{shouldRender:C,transitionClassNames:b}=(0,qe.A)(f,void 0,!0,"slow",!0);(0,n.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`)})})},[C,a]),(0,n.Nf)(()=>{(0,r.gm)(()=>{if(!c.current||!d.current)return;const e=c.current,t=d.current,i=t.offsetTop,{lineHeight:n,totalLines:s}=(0,Ji.A)(t),o=s>3,a=i+3*n;return()=>{o&&((0,st.YM)(e,"e1gyTmKe"),g(!0)),e.style.setProperty("--_overflow-shift",`${a}px`)}})},[m]),(0,n.vJ)(()=>{t||l.current?.scrollTo({top:0})},[t]);const y=(0,ve.A)("ilyTRZtw",A&&"HIMnUViv",C&&"Vq8pl_kQ");return(0,ne.FD)("div",{className:(0,ve.A)("RKedwa0I",i),children:[(0,ne.Y)("div",{ref:c,className:y,role:f?"button":void 0,onClick:f?s:o,children:(0,ne.FD)("div",{ref:l,className:(0,ve.A)("D_5mWNmi","allow-selection","custom-scroll"),children:[u?.forwardInfo&&(0,ne.Y)(Wi,{forwardInfo:u.forwardInfo,className:"_M8CgT7s"}),u&&m&&(0,ne.Y)("div",{ref:d,className:"hmFA5qb1",children:(0,ne.Y)(Qi.A,{messageOrStory:u,withTranslucentThumbs:!0,forcePlayback:!0})})]})}),C&&(0,ne.Y)("div",{ref:h,className:(0,ve.A)("bM5rlQtM",b),onClick:s,children:a("Story.CaptionShowMore")})]})});var Xi=i(26875),en=i(11241);const tn="YVD19vOP",nn="vJRk_UUk",sn="nIv3YAnZ",on=(0,n.ph)(({story:e,className:t})=>{const{openStoryViewModal:i,openForwardMenu:o,sendStoryReaction:r}=(0,s.ko)(),c=(0,B.A)(),{views:d,isOut:h,peerId:u,id:m,sentReaction:p}=e,{viewsCount:v,forwardsCount:A,reactionsCount:f}=d||{},C=!(0,g.L8)(u),b=p&&(0,l.a0)(p,a.tNZ),y=Boolean((h||C)&&e.isPublic&&!e.noForwards),S=(0,l.$_)(u,m),k=(0,n.Kr)(()=>{const{users:{byId:e}}=(0,s.mS)(),t=d&&"recentViewerIds"in d?d.recentViewerIds:void 0;if(t)return t.map(t=>e[t]).filter(Boolean)},[d]),N=(0,T.A)(()=>{i({storyId:m})}),w=(0,T.A)(()=>{o({fromChatId:u,storyId:m})}),I=(0,T.A)(()=>{const e=p?void 0:a.tNZ;r({peerId:u,storyId:m,containerId:S,reaction:e})});return v?(0,ne.FD)("div",{className:(0,ve.A)(tn,t),children:[(0,ne.FD)("div",{className:(0,ve.A)("cknL5COh",!C&&"pJAyeGkG"),onClick:C?void 0:N,children:[Boolean(k?.length)&&(0,ne.Y)(Xi.A,{size:"small",peers:k,className:"Vz_VtJ16"}),C?(0,ne.FD)("span",{className:sn,children:[(0,ne.Y)(he.A,{name:"channelviews",className:"WyBiNM6e"}),v]}):(0,ne.Y)("span",{className:sn,children:c("Views",v,"i")}),Boolean(f)&&!C&&(0,ne.FD)("span",{className:"sf3u_6Vh",children:[(0,ne.Y)(he.A,{name:"heart",className:"Er2XKRqi"}),f]})]}),(0,ne.Y)("div",{className:"kKoeDk3Z"}),y&&(0,ne.Y)(X.A,{color:"translucent",size:"smaller",round:!0,onClick:w,ariaLabel:c("Forward"),className:nn,iconName:"forward"}),C&&(0,ne.FD)(ne.FK,{children:[Boolean(A)&&(0,ne.FD)("div",{className:nn,children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:c("PublicShares"),iconName:"loop"}),(0,ne.Y)("span",{children:A})]}),(0,ne.FD)("div",{className:nn,children:[(0,ne.FD)(X.A,{round:!0,className:"lpDXVIuf",color:"translucent",size:"smaller",onClick:I,ariaLabel:c("AccDescrLike"),children:[p&&(0,ne.Y)(en.A,{containerId:S,reaction:p,withEffectOnly:b},(0,l.Jj)(p)),(!p||b)&&(0,ne.Y)(he.A,{name:b?"heart":"heart-outline",className:(0,ve.A)(b&&"twgMDT1y")})]}),Boolean(f)&&(0,ne.Y)("span",{children:f})]})]})]}):(0,ne.Y)("div",{className:(0,ve.A)(tn,t),children:c("NobodyViewed")})}),an=(0,n.ph)(function({isActive:e,isViewed:t,isVideo:i,duration:n=6,isPaused:s,onImageComplete:o}){const a=(0,T.A)(e=>{i||"XY98E7VM"!==e.animationName||o()}),r=(0,ve.A)("c1fbGgcx",t&&"xwOKghO2",e&&"ZuByYcIx",s&&"n9V6B7hP");return(0,ne.Y)("span",{className:r,"aria-hidden":!0,children:e&&(0,ne.Y)("i",{style:`--progress-duration: ${n}s`,className:"qyBCpJct",onAnimationEnd:a})})}),rn=u.Yw?4:3,ln=(0,n.ph)((0,s.EK)((e,{peerId:t,storyId:i,isDeleteModalOpen:n})=>{const{appConfig:s}=e,o=(0,c.mBe)(e,t),a=(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:g,safeLinkModalUrl:v,mapModal:A,reportModal:f,giftInfoModal:C,isPaymentMessageConfirmDialogOpen:b,storyStealthModal:y}=l,{isOpen:S}=g||{},k=Boolean(y),N=(0,c.Msb)(e,t,i),w=N&&"content"in N,I=Boolean(b||h||p||l.reactionPicker?.storyId||f||u||S||n||v||k||A||C),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:o||a,forwardSender:D,fromPeer:T,story:N,orderedIds:m?.storyIdsByPeerId[t],isMuted:d,isCurrentUserPremium:(0,c.g29)(e),shouldForcePause:I,storyChangelogUserId:s.storyChangelogUserId,viewersExpirePeriod:s.storyViewersExpirePeriod,isChatExist:Boolean(a),arePeerSettingsLoaded:Boolean(r?.settings),stealthMode:e.stories.stealthMode,withHeaderAnimation:M,paidMessagesStars:B,isAccountFrozen:L}})(function({peerId:e,storyId:t,peer:i,forwardSender:o,fromPeer:r,isMuted:c,isArchivedStories:d,isPrivateStories:h,story:u,orderedIds:m,isSingleStory:p,dimensions:v,shouldForcePause:A,storyChangelogUserId:f,viewersExpirePeriod:C,isChatExist:b,arePeerSettingsLoaded:y,getIsAnimating:S,isCurrentUserPremium:k,stealthMode:N,withHeaderAnimation:w,paidMessagesStars:I,isAccountFrozen:P,onDelete:M,onClose:L,onReport:x}){const{viewStory:R,setStoryViewerMuted:E,openPreviousStory:V,openNextStory:_,loadPeerSkippedStories:U,openForwardMenu:O,copyStoryLink:K,toggleStoryInProfile:J,openChat:G,showNotification:H,openStoryPrivacyEditor:z,loadPeerSettings:$,fetchChat:q,loadStoryViews:W,openStealthModal:Q}=(0,s.ko)(),Z=(0,Di.Fm)(),ee=(0,B.A)(),te=(0,Bi.A)(),{isMobile:ie}=(0,Y.Ay)(),[se,oe,re]=(0,D.A)(!1),[le,ce,de]=(0,D.A)(!1),[pe,ge,Ae]=(0,D.A)(!1),[Ce,be,ye]=(0,D.A)(!0),[Se,ke,Ne]=(0,D.A)(!1),[we,Ie]=(0,n.J0)(!1),[Pe,Ye,Fe]=(0,D.A)(!1),[De,Me,Te]=(0,D.A)(!1),Be=(0,n.li)(),{isDeletedStory:Le,hasText:xe,hasForwardInfo:Re,thumbnail:Ee,previewBlobUrl:Ve,isVideo:_e,noSound:Ue,fullMediaData:Oe,altMediaHash:Ke,altMediaData:Je,hasFullData:je,hasThumb:Ge,canDownload:He,downloadMediaData:$e}=li(u,k,De),We=u&&"content"in u,Qe=e===f,Ze=(0,g.L8)(e),Xe=!Ze,tt=Xe&&(0,l.WX)(i),it=We&&u.isOut,nt=We&&0===Object.keys(u.content).length,st=(0,Ii.A)(it?!u.isInProfile:void 0,!0),ot=(0,Ii.A)(it?u.isInProfile:void 0,!0),at=Boolean(it&&u.date+C<(0,Di.Fm)()),rt=o?(0,Dt.F9)(te,o):We&&u.forwardInfo?.fromName,lt=Boolean(We&&u.isPublic&&!Qe&&i?.hasUsername),ct=Boolean(We&&u.isPublic&&!u.noForwards&&!Qe&&!Se),dt=Boolean((je||nt)&&!A&&Ce&&!se&&!Se&&!we&&!Pe),ht=We&&u.content.video?.duration?u.content.video.duration:void 0,ut=!(it&&Ze||Qe||tt||P),mt=We&&!ut&&(it||tt),pt=ie&&w?"slideFade":"none",{shouldRender:gt,transitionClassNames:vt}=(0,qe.A)(!je&&!nt),{transitionClassNames:At}=(0,qe.A)(Boolean(Oe)&&!nt),ft=(0,Ti.A)(Ee,!Ge),Ct=(0,xi.A)(Ve),{shouldRender:bt,transitionClassNames:yt}=(0,qe.A)(ut),{shouldRender:St,transitionClassNames:kt}=(0,qe.A)(xe&&Se),{transitionClassNames:Nt}=(0,qe.A)(!0),{shouldRender:wt,transitionClassNames:It}=(0,qe.A)(xe||Re),Pt=(0,Ri.Y)(Be,Oe,Mi.G);(0,Vi.A)(e,t),(0,n.vJ)(()=>{t&&R({peerId:e,storyId:t})},[t,e]),(0,n.vJ)(()=>{U({peerId:e})},[e]),(0,n.vJ)(()=>{const t=(0,g.L8)(e);!b&&t&&q({chatId:e})},[b,e]),(0,n.vJ)(()=>{b&&!y&&$({peerId:e})},[y,b,e]);const Yt=(0,T.A)(()=>{_e&&Be.current?.pause(),Ae(),de()}),Ft=(0,T.A)(()=>{dt&&(ce(),_e||ge())}),Bt=(0,T.A)(()=>{Ye()}),Lt=(0,T.A)(()=>{Fe()}),xt=(0,T.A)(()=>{Me(),Yt()}),Rt=(0,T.A)(()=>{Te(),Ft()}),{onMouseDown:Vt,onMouseUp:_t,onMouseLeave:Ut,onTouchStart:Kt,onTouchEnd:Ht}=(0,Li.A)({onStart:Bt,onEnd:Lt}),zt=(0,ze.A)(Be,void 0,!_e||!Oe||Pt),$t=Oe&&(!Ke||Je);(0,n.vJ)(()=>{($t||zt||nt)&&Ft()},[$t,zt,nt]),(0,Ei.Ay)(ye,be),(0,n.vJ)(()=>{$t&&Be.current?.load()},[$t]),(0,n.vJ)(()=>{!We||Le||at||(it||tt)&&W({peerId:e,storyId:t})},[Le,at,We,e,t,it,tt]),(0,n.vJ)(()=>{A||!Ce||se||Se||we||Pe?Yt():Ft()},[Ft,Ce,Se,se,A,we,Pe]),(0,n.vJ)(()=>{if(!(se||A||Se))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),Ie(!we))}},[Se,se,we,A]),(0,F.A)(([e,t,i,n,s])=>{!we||Se||se||A||!Ce||Pe||t===Se&&e===se&&i===A&&n===Ce&&s===Pe||Ie(!1)},[se,Se,A,Ce,Pe,we]);const Zt=(0,T.A)(()=>{L(),G({id:e})}),ii=(0,T.A)(()=>{L(),G({id:o.id})}),ni=(0,T.A)(()=>{L(),G({id:r.id})}),si=(0,T.A)(()=>{V()}),oi=(0,T.A)(()=>{_()}),ai=(0,T.A)(e=>{const t=e.currentTarget;t.readyState>=rn?ge():Ae(),ht&&(0,fe.LI)(t.currentTime,2)>=(0,fe.LI)(ht,2)&&oi()});(0,n.vJ)(()=>S()||se?void 0:(0,Pi.A)({onRight:oi,onLeft:si}),[S,se]);const ri=(0,T.A)(()=>{K({peerId:e,storyId:t})}),ci=(0,T.A)(()=>{J({peerId:e,storyId:t,isInProfile:!0})}),di=(0,T.A)(()=>{J({peerId:e,storyId:t,isInProfile:!1})}),hi=(0,T.A)(()=>{M(u)}),ui=(0,T.A)(()=>{x()}),mi=(0,T.A)(()=>{O({fromChatId:e,storyId:t})}),pi=(0,T.A)(()=>{z()}),gi=(0,T.A)(()=>{const e=!We||u.isPublic?void 0:u.isForContacts?"contacts":u.isForCloseFriends?"closeFriends":"nobody";let t;const n=(0,Dt.F9)(te,i);switch(e){case"nobody":t=ee("StorySelectedContactsHint",n);break;case"contacts":t=ee("StoryContactsHint",n);break;case"closeFriends":t=ee("StoryCloseFriendsHint",n);break;default:return}H({message:t})}),vi=(0,T.A)(()=>{Ue?H({message:ee("Story.TooltipVideoHasNoSound")}):(Be.current.muted=!Be.current.muted,E({isMuted:!c}))}),Ai=(0,T.A)(()=>{if(N.activeUntil&&(0,Di.Fm)()<N.activeUntil){const e=N.activeUntil-(0,Di.Fm)();return void H({title:te("StealthModeOnTitle"),message:te("StealthModeOnHint",{time:(0,et.QO)(e)}),duration:4e3})}Q({})}),fi=(0,T.A)(()=>{$e&&(0,Yi.A)($e,`story-${e}-${t}.${_e?"mp4":"jpg"}`)});(0,n.vJ)(()=>{Le&&H({message:ee("StoryNotFound")})},[ee,Le]);const Ci=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{round:!0,ripple:!ie,size:"tiny",color:"translucent-white",onClick:e,className:(0,ve.A)(Qt,t&&"active"),ariaLabel:te("AriaLabelOpenMenu"),iconName:"more"}),[ie,te]);const bi=I?te("ComposerPlaceholderPaidReply",{amount:(0,Fi.U2)(te,I,{asFont:!0,className:"placeholder-star-icon"})},{withNodes:!0}):ee(Xe?"ReplyToGroupStory":"ReplyPrivately");return(0,ne.FD)("div",{className:(0,ve.A)(qt,"component-theme-dark"),onMouseDown:Vt,onMouseUp:_t,onMouseLeave:Ut,onTouchStart:Kt,onTouchEnd:Ht,children:[(0,ne.FD)("div",{className:(0,ve.A)("e7HHuS1g",Nt),children:[(0,ne.Y)("div",{className:"jGDd2sza",children:(p?[t]:m??[]).map(e=>(0,ne.Y)(an,{isActive:e===u?.id,isVideo:_e,isViewed:Boolean(u?.id&&(h||d?e>u?.id:e<u?.id)),isPaused:!pe,duration:ht,onImageComplete:oi},`progress-${e}`))}),(0,ne.FD)("div",{className:"eMYhXF_X",children:[(0,ne.Y)(ae.Ay,{activeKey:Number(e),name:pt,className:"PXnfXZur",children:(0,ne.FD)("div",{className:"WpyVfrsc",children:[(0,ne.Y)(Tt.A,{peer:i,size:"tiny",onClick:Zt}),(0,ne.FD)("div",{className:"jmKI_lhC",children:[(0,ne.Y)("span",{onClick:Zt,className:"H1uod43o",children:(0,Mt.A)((0,Dt.F9)(te,i)||"")}),(0,ne.FD)("div",{className:"zimpR8Hz",children:[rt&&(0,ne.FD)("span",{className:(0,ve.A)(Wt,"JJFtefb9",o&&"BsqMBS2I"),onClick:o?ii:void 0,children:[(0,ne.Y)(he.A,{name:"loop"}),(0,ne.Y)("span",{className:ti,children:(0,Mt.A)(rt)})]}),r&&(0,ne.FD)("span",{className:(0,ve.A)(Wt,"nJr8QgYX"),onClick:ni,children:[(0,ne.Y)(Tt.A,{peer:r,size:"micro"}),(0,ne.Y)("span",{className:ti,children:(0,Mt.A)((0,Dt.F9)(te,r)||"")})]}),u&&"date"in u&&(0,ne.Y)("span",{className:Wt,children:(0,et.jy)(ee,Z,u.date)}),We&&u.isEdited&&(0,ne.Y)("span",{className:Wt,children:ee("Story.HeaderEdited")})]})]})]})}),(0,ne.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(it){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,ne.FD)("div",{className:(0,ve.A)("prxptFFf",it&&"_MVsZpgB"),onClick:it?pi:gi,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`,children:[(0,ne.Y)(he.A,{name:e}),it&&(0,ne.Y)(he.A,{name:"next"})]})}(),_e&&(0,ne.Y)(X.A,{className:Qt,round:!0,ripple:!ie,size:"tiny",color:"translucent-white",disabled:!je,onClick:vi,ariaLabel:ee("Volume"),iconName:c||Ue?"speaker-muted-story":"speaker-story"}),(0,ne.FD)(ue.A,{className:"K0_xAdzf",trigger:Ci,positionX:"right",onOpen:xt,onClose:Rt,children:[lt&&(0,ne.Y)(me.A,{icon:"copy",onClick:ri,children:ee("CopyLink")}),st&&(0,ne.Y)(me.A,{icon:"save-story",onClick:ci,children:ee(Ze?"StorySave":"SaveToPosts")}),ot&&(0,ne.Y)(me.A,{icon:"delete",onClick:di,children:ee(Ze?"ArchiveStory":"RemoveFromPosts")}),He&&(0,ne.Y)(me.A,{icon:"download",disabled:!$e,onClick:fi,children:ee("lng_media_download")}),!it&&Ze&&(0,ne.Y)(me.A,{icon:"eye-crossed-outline",onClick:Ai,children:ee("StealthMode")}),!it&&(0,ne.Y)(me.A,{icon:"flag",onClick:ui,children:ee("lng_report_story")}),it&&(0,ne.Y)(me.A,{icon:"delete",destructive:!0,onClick:hi,children:ee("Delete")})]}),(0,ne.Y)(X.A,{className:(0,ve.A)(Qt,"WlLsjJ2Z"),round:!0,size:"tiny",color:"translucent-white",ariaLabel:ee("Close"),onClick:L,iconName:"close"})]})]})]}),(0,ne.FD)("div",{className:"YiuvOPgT",style:`width: ${v.width}px; height: ${v.height}px`,children:[(0,ne.Y)("canvas",{ref:ft,className:ei}),Ve&&(0,ne.Y)("img",{src:Ve,draggable:!1,alt:"",className:(0,ve.A)(Jt,"lQfkulvp",Ct)},`preview-${t}`),gt&&(0,ne.Y)(Oi.A,{className:(0,ve.A)(vt,Et),animation:"pulse"}),!_e&&Oe&&(0,ne.Y)("img",{src:Oe,alt:"",className:(0,ve.A)(Jt,At),draggable:!1}),_e&&Oe&&(0,ne.FD)(Ui.A,{ref:Be,className:(0,ve.A)(Jt,At),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,ne.Y)("source",{src:Oe,type:Mi.G,width:"720"}),Je&&(0,ne.Y)("source",{src:Je,type:Mi.w,width:"480"})]},`video-${t}`),nt&&(0,ne.Y)("div",{className:(0,ve.A)(Jt,"snxbMlts"),children:(0,ne.Y)("span",{children:te("StoryUnsupported")})}),!Pe&&!se&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("button",{type:"button",className:(0,ve.A)(Xt,"SXpRZiax"),onClick:si,"aria-label":ee("Previous")}),(0,ne.Y)("button",{type:"button",className:(0,ve.A)(Xt,"twOBFwUE"),onClick:oi,"aria-label":ee("Next")})]}),We&&Oe&&(0,ne.Y)(Ki.A,{story:u,isActive:!0,isStoryPlaying:De},`area-overlay-${t}-${e}`),!ie&&(0,ne.Y)("div",{className:Ot,children:(0,ne.FD)("div",{className:jt,children:[(0,ne.Y)(Tt.A,{peer:i,withStory:!0,storyViewerMode:"disabled"}),(0,ne.Y)("div",{className:Gt,children:(0,Mt.A)((0,Dt.F9)(te,i)||"")})]})})]}),mt&&(0,ne.Y)(on,{story:u,className:Nt}),St&&(0,ne.Y)("div",{tabIndex:0,role:"button",className:(0,ve.A)("Jd1DYS6Y",kt),onClick:()=>Ne(),"aria-label":ee("Close")}),xe&&(0,ne.Y)("div",{className:(0,ve.A)("sHNAfxzf",It)}),wt&&(0,ne.Y)(Zi,{story:u,isExpanded:Se,onExpand:ke,onFold:Ne,className:It},`caption-${t}-${e}`),bt&&(0,ne.Y)(_i.A,{type:"story",chatId:e,threadId:j.l3,storyId:t,isReady:!it,messageListType:"thread",isMobile:(0,Y.Ny)(),editableInputCssSelector:a.iKt,editableInputId:a.YVZ,inputId:"story-input-text",className:(0,ve.A)("FXineBYO",yt),inputPlaceholder:bi,onForward:ct?mi:void 0,onFocus:oe,onBlur:re})]})})),cn=(0,n.ph)((0,s.EK)((e,{peer:t})=>{const{storyViewer:{lastViewedByPeerId:i,origin:n,storyList:s}}=(0,c.nTw)(e);return{lastViewedId:t?.id?i?.[t.id]:void 0,origin:n,storyIdsForViewer:t?.id?s?.storyIdsByPeerId[t.id]:void 0}})(function({peer:e,peerStories:t,lastViewedId:i,storyIdsForViewer:o,origin:a}){const{openStoryViewer:r,loadPeerSkippedStories:c}=(0,s.ko)(),d=(0,B.A)(),h=(0,n.Kr)(()=>{if(!t)return;const{orderedIds:e,lastReadId:n,byId:s}=t,a=e[e.length-1]!==n,r=i&&o?.includes(i)?i??(a?n??-1:-1):-1;return s[s[r]?.id||o?.[0]||e[0]]},[i,t,o]),u=h&&"content"in h;(0,n.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,g=(0,q.A)(p)||m?.thumbnail?.dataUri;if(e&&h&&!("isDeleted"in h))return(0,ne.FD)("div",{className:qt,onClick:()=>{r({peerId:h.peerId,storyId:h.id,origin:a})},children:[g&&(0,ne.Y)("img",{src:g,alt:"",className:Jt,draggable:!1}),u&&(0,ne.Y)(Ki.A,{story:h}),(0,ne.Y)("div",{className:Ot,children:(0,ne.FD)("div",{className:jt,children:[(0,ne.Y)(Tt.A,{peer:e,withStory:!0,storyViewerMode:"disabled"}),(0,ne.Y)("div",{className:Gt,children:(0,Mt.A)((0,Dt.F9)(d,e)||"")})]})})]})}));var dn=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(dn||{});const hn=(0,n.ph)((0,s.EK)(e=>{const{storyViewer:{peerId:t,storyId:i,isSinglePeer:n,isSingleStory:s,isPrivate:o,isArchive:a,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:n,isSingleStory:s,isPrivate:o,isArchive:a}},e=>(0,c.gd2)(e))(function({peerIds:e,currentPeerId:t,currentStoryId:i,isOpen:o,isSinglePeer:d,isSingleStory:h,isPrivate:m,isArchive:p,byPeerId:g,isDeleteModalOpen:v,onDelete:A,onClose:f,onReport:C}){const{stopActiveReaction:b}=(0,s.ko)(),y=(0,n.li)(),[S,k]=(0,n.J0)(t),[N,w]=(0,n.J0)(i),I=(0,K.A)(t),P=(0,Ii.A)(p,!0),F=(0,Ii.A)(m,!0),D=(0,Ii.A)(d,!0),M=(0,Ii.A)(h,!0),B=ri(),{height:L,width:x}=(0,Pe.A)(),R=(0,n.li)(void 0),E=(0,n.li)(!1),{isMobile:V}=(0,Y.Ay)(),_=(0,n.li)({}),[U,O]=(0,n.Ul)(!1);function J(e,t){e&&(_.current[t]?_.current[t].current=e:_.current[t]={current:e})}(0,ke.A)({isActive:o,onBack:f,shouldBeReplaced:!0});const j=(0,n.Kr)(()=>{if(S&&(D||M))return[S];const t=S?e.indexOf(S):-1;if(!S||-1===t)return[];const i=Math.max(t-4,0),n=Math.min(t+5,e.length);return e.slice(i,n)},[M,D,S,e]),G=(0,n.Kr)(()=>j.length&&S?j.indexOf(S):-1,[S,j]),H=(0,n.Kr)(()=>j.length&&t?j.indexOf(t):-1,[t,j]);(0,n.vJ)(()=>{V&&k(t)},[t,V]),(0,n.vJ)(()=>{S===t&&i!==N&&w(i)},[t,i,S,N]),(0,n.vJ)(()=>{if(!V)return I&&I!==t&&O(!0),()=>{O(!1)}},[I,t,O,V]),(0,n.vJ)(()=>()=>{i&&t&&b({containerId:(0,l.$_)(t,i)})},[i,t]);const z=H-G,$=G>H,q=(0,T.A)(()=>e.reduce((i,n,s)=>{if(n===S)i[n]=ai({scale:B.scale,slideAmount:z,isBackward:$,isActiveSlideSize:$});else{let o=!1;!$&&s>0&&e[s-1]===S&&(o=!0),$&&s<e.length-1&&e[s+1]===S&&(o=!0),i[n]=ai({scale:B.scale,slideAmount:z,isBackward:$,isActiveSlideSize:t===n&&!$,isMoveThroughActiveSlide:o})}return i},{}));(0,n.vJ)(()=>{if(!y.current||!o)return;let e=0;const t=()=>S?_.current[S]?.current:void 0,i=i=>{if(E.current)return void(E.current=!1);const n=t();if(n){if(e<-50){const e=document.getElementById(a.YVZ);return void(e&&(0,r.RK)(()=>{(0,Ni.A)(e)}))}e>50?(f(),"wheel"===i.type&&((0,wi.M6)(),setTimeout(wi.v5,1500))):(0,r.RK)(()=>{n.style.setProperty("--slide-translate-y","0px")})}};return(0,Ae.wJ)(y.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(n,s,{dragOffsetX:o,dragOffsetY:a})=>{if(E.current)return;if(u.pz&&"touchstart"===s.type){const{pageX:e}=s.touches[0];if(e<=Ae.h6||e>=x-Ae.h6)return}if("mousemove"===n.type)return;const l=Math.abs(o),c=Math.abs(a),d=t();if(d&&(R.current===dn.Vertical||Math.abs(c)>Ae.no||c/l>Ae.fG)){R.current=dn.Vertical;const t=L;e=(0,fe.qE)(a,-t,t),e>0&&(0,r.RK)(()=>{d.style.setProperty("--slide-translate-y",e*(V?1:-1)+"px")}),"wheel"===n.type&&Math.abs(e)>100&&(i(n),E.current=!0)}},onRelease:i})},[o,f,x,L,V,S]),(0,n.Nf)(()=>{if(V)return;const e=q();Object.entries(_.current).forEach(([i,{current:n}])=>{if(!n)return;if(!U())return n.classList.remove(_t,Ut,Kt),n.style.setProperty("--slide-translate-x","0px"),n.style.setProperty("--slide-translate-y","0px"),n.style.setProperty("--slide-translate-scale","1"),void n.style.setProperty("--slide-content-scale",String(B.toActiveScale));let s=0;i===S&&(s=-1.75*B.fromActiveScale,n.classList.add(Kt)),i===t&&(s=1.75,n.classList.add(Ut)),n.classList.add(_t),n.style.setProperty("--slide-translate-x",`${e[i]||0}px`),n.style.setProperty("--slide-translate-y",`${s}rem`),n.style.setProperty("--slide-translate-scale",t===i?String(B.toActiveScale):i===S?String(B.fromActiveScale):"1")})},[t,U,S,B,V]);const W=(0,T.A)(e=>{const n=e.target;n&&n.classList.contains($t)&&(S!==t?(k(t),w(i)):i!==N&&w(i),O(!1))});return V?(0,ne.Y)("div",{className:Vt,ref:y,children:(0,ne.Y)("div",{className:zt,ref:e=>J(e,S),children:(0,ne.Y)(ln,{peerId:S,storyId:N,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:v,isSingleStory:h,getIsAnimating:U,onClose:f,onReport:C})})}):(0,ne.FD)("div",{className:Vt,ref:y,style:`--story-viewer-scale: ${B.scale}`,onTransitionEnd:W,children:[(0,ne.Y)("div",{className:Et,onClick:f}),j.length>1&&(0,ne.Y)("div",{className:"xe67dhtF",style:`height: ${B.slide.height}px`}),j.map((e,t)=>e===S?function(e){const t=V?void 0:(0,ot.A)(`width: ${B.activeSlide.width}px`,`--slide-media-height: ${B.activeSlide.height}px`);return(0,ne.Y)("div",{ref:t=>J(t,e),className:(0,ve.A)(Ht,$t),style:t,children:(0,ne.Y)(ln,{peerId:e,storyId:N,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:v,isSingleStory:h,getIsAnimating:U,onClose:f,onReport:C})},e)}(S):function(e,t,i){const n=(0,ot.A)(`width: ${B.slide.width}px`,`height: ${B.slide.height}px`),o=(0,ve.A)(Ht,"Sef28wEh",`slide-${i}`);return(0,ne.Y)("div",{ref:t=>J(t,e),className:o,style:n,children:(0,ne.Y)(cn,{peer:(0,c.PVB)((0,s.mS)(),e),peerStories:g?.[e]})},e)}(e,0,t-G))]})}));var un=i(47366),mn=i(46222),pn=i(283),gn=i(36393),vn=i(51083),An=i(58920),fn=i(17794);const Cn={"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"},bn=1.5*v.$,yn=(0,n.ph)((0,s.EK)((e,{storyView:t})=>({peer:(0,c.PVB)(e,t.peerId),availableReactions:e.reactions.availableReactions}))(({storyView:e,peer:t,availableReactions:i})=>{const{openChat:o,closeStoryViewer:a,unblockUser:r,blockUser:c,deleteContact:d,updateStoryView:h,focusMessage:u,openStoryViewer:m,closeStoryViewModal:p}=(0,s.ko)(),v=(0,B.A)(),A=(0,T.A)(()=>{const{type:t}=e;if("repost"===t)return p(),void m({peerId:e.peerId,storyId:e.storyId});a(),setTimeout(()=>{"user"===t?o({id:e.peerId}):"forward"===t&&u({chatId:e.peerId,messageId:e.messageId})},100)}),f=(0,n.Kr)(()=>{if(!(0,g.L8)(e.peerId))return;const{peerId:i,areStoriesBlocked:n,isUserBlocked:s}=e,o=t,{isContact:a}=o||{},u=(0,l.Yg)(o),m=[];return s||(n?m.push({handler:()=>{r({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!1})},title:v("StoryShowBackTo",u),icon:"play-story"}):m.push({handler:()=>{c({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!0})},title:v("StoryHideFrom",u),icon:"hand-stop"})),a?m.push({handler:()=>{d({userId:i})},title:v("DeleteContact"),icon:"delete-user",destructive:!0}):m.push({handler:()=>{s?(r({userId:i}),h({userId:i,isUserBlocked:!1})):(c({userId:i}),h({userId:i,isUserBlocked:!0}))},title:v(s?"Unblock":"BlockUser"),icon:s?"user":"delete-user",destructive:!s}),m},[v,e,t]),C="user"===e.type?"message-read":"forward"===e.type?"forward":"loop",b="forward"===e.type||"repost"===e.type,y=(0,n.Kr)(()=>{const t="repost"===e.type&&e.story.forwardInfo?.isModified,i=[(0,et.U)(v,1e3*e.date)];return t&&i.push(v("lng_edited")),i.join(" • ")},[v,e]);return(0,ne.Y)(ui.A,{className:(0,ve.A)("chat-item-clickable small-icon",Cn.opacityFadeIn,(e.isUserBlocked||e.areStoriesBlocked)&&Cn.blocked),onClick:A,rightElement:"user"===e.type&&e.reaction?(0,ne.Y)(fn.A,{reaction:e.reaction,className:Cn.viewReaction,size:bn,availableReactions:i,withIconHeart:!0}):void 0,contextActions:f,withPortalForMenu:!0,menuBubbleClassName:Cn.menuBubble,children:(0,g.L8)(e.peerId)?(0,ne.Y)(An.A,{className:(0,ve.A)(b&&Cn.withColoredStatus),userId:e.peerId,noStatusOrTyping:!0,status:y,statusIcon:C,withStory:!0,forceShowSelf:!0}):(0,ne.Y)(vn.A,{className:(0,ve.A)(b&&Cn.withColoredStatus),chatId:e.peerId,status:y,statusIcon:C,withStory:!0})},e.peerId)})),Sn=(0,n.ph)((0,s.EK)(e=>{const{appConfig:t}=e,{storyViewer:{viewModal:i}}=(0,c.nTw)(e),{storyId:n,views:s,nextOffset:o,isLoading:a}=i||{},r=n?(0,c.Msb)(e,e.currentUserId,n):void 0,l="story"===r?.["@type"]?r.expireDate:void 0;return{views:s,viewersExpireDate:l?l+t.storyViewersExpirePeriod:void 0,story:r&&"content"in r?r:void 0,nextOffset:o,isLoading:a,isCurrentUserPremium:(0,c.g29)(e)}})(function({story:e,viewersExpireDate:t,views:i,nextOffset:o,isLoading:r,isCurrentUserPremium:l}){const{loadStoryViewList:c,closeStoryViewModal:d,clearStoryViews:h}=(0,s.ko)(),[u,m,p]=(0,D.A)(!1),[g,v,A]=(0,D.A)(!0),[f,C]=(0,n.J0)(""),b=(0,B.A)(),y=Boolean(e),S=Boolean(t)&&t<(0,Di.Fm)(),{viewsCount:k=0,reactionsCount:N=0}=e?.views||{},w=e?.isPublic&&k>a.XQO,I=N>a.$4F,P=k>a.frj,Y=w||I||P;(0,n.vJ)(()=>{y||(C(""),p(),v())},[y]);const F=(0,ye.A)(()=>{h({isLoading:!0})},[],250,!0);(0,n.vJ)(()=>{F()},[u,g,f,F]);const M=(0,n.Kr)(()=>i?.sort(function(e){return(t,i)=>{if(e){const e="user"===t.type&&t.reaction,n="user"===i.type&&i.reaction;if(e&&!n)return-1;if(!e&&n)return 1}return i.date-t.date}}(g)),[g,i]),L=M?.length?1:Math.min(k,8),x=Boolean(M?.length)&&M.length<k&&S,R=(0,T.A)(()=>{e?.id&&void 0!==o&&c({peerId:e.peerId,storyId:e.id,offset:o,areReactionsFirst:g||void 0,areJustContacts:u||void 0,query:f})}),{handleScroll:E,isAtBeginning:V}=(0,un.A)(),_=(0,T.A)(()=>{d()}),U=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.FD)(X.A,{fluid:!0,size:"tiny",color:"translucent",className:(0,ve.A)(!t&&"active",Cn.sortButton,Cn.topButton),faded:t,onClick:e,ariaLabel:b("SortBy"),children:[(0,ne.Y)(he.A,{name:g?"heart-outline":"recent",className:Cn.iconSort}),(0,ne.Y)(he.A,{name:"down",className:Cn.iconDown})]}),[g,b]);return(0,ne.FD)(te.A,{isOpen:y,onClose:_,className:"component-theme-dark",contentClassName:Cn.viewsList,isSlim:!0,children:[Y&&(0,ne.FD)("div",{className:Cn.header,children:[w&&(0,ne.FD)("div",{className:Cn.contactFilter,children:[(0,ne.Y)(X.A,{className:(0,ve.A)(!u&&Cn.selected,Cn.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:p,children:b("AllViewers")}),(0,ne.Y)(X.A,{className:(0,ve.A)(u&&Cn.selected,Cn.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:m,children:b("Contacts")})]}),I&&(0,ne.FD)(ue.A,{className:Cn.sort,trigger:U,positionX:"right",children:[(0,ne.FD)(me.A,{icon:"heart-outline",onClick:v,children:[b("SortByReactions"),g&&(0,ne.Y)(he.A,{name:"check",className:Cn.check})]}),(0,ne.FD)(me.A,{icon:"recent",onClick:A,children:[b("SortByTime"),!g&&(0,ne.Y)(he.A,{name:"check",className:Cn.check})]})]}),P&&(0,ne.Y)(gn.A,{className:Cn.search,value:f,onChange:C})]}),(0,ne.FD)("div",{className:(0,ve.A)(Cn.content,!V&&Cn.topScrolled,"custom-scroll"),onScroll:E,children:[S&&!r&&!f&&Boolean(!M?.length)&&(0,ne.Y)("div",{className:(0,ve.A)(Cn.info,Cn.centeredInfo),children:(0,Mt.A)(b(l?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])}),!r&&Boolean(f.length)&&!M?.length&&(0,ne.Y)("div",{className:Cn.info,children:b("Story.ViewList.EmptyTextSearch")}),(0,ne.FD)(mn.A,{items:M,onLoadMore:R,children:[M?.map(e=>{const t="forward"===e.type?e.messageId:"repost"===e.type?e.storyId:"user";return(0,ne.Y)(yn,{storyView:e},`${e.peerId}-${e.date}-${t}`)}),r&&Array.from({length:L}).map((e,t)=>(0,ne.Y)(ui.A,{className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0,children:(0,ne.Y)(pn.A,{})},`placeholder-${t}`)),x&&(0,ne.Y)("div",{className:(0,ve.A)(Cn.info,Cn.bottomInfo),children:b("Story.ViewList.NotFullyRecorded")},"not-all-available")]})]}),(0,ne.Y)("div",{className:(0,ve.A)(Cn.footer,"dialog-buttons"),children:(0,ne.Y)(X.A,{className:(0,ve.A)("confirm-dialog-button",Cn.close),isText:!0,onClick:_,children:b("Close")})})]})})),kn=(0,n.ph)((0,s.EK)(e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:i,peerId:n,isPrivacyModalOpen:s,origin:o}}=(0,c.nTw)(e),a=n&&i?(0,c.Msb)(e,n,i):void 0,r=(0,c.xYJ)(e,"mediaViewerAnimations");return{isOpen:(0,c.gd2)(e),shouldSkipHistoryAnimations:t,peerId:n,storyId:i,story:a,origin:o,withAnimation:r,isPrivacyModalOpen:s}})(function({isOpen:e,peerId:t,storyId:i,story:o,origin:l,shouldSkipHistoryAnimations:c,withAnimation:d,isPrivacyModalOpen:h}){const{closeStoryViewer:u,closeStoryPrivacyEditor:g,reportStory:v}=(0,s.ko)(),A=(0,B.A)(),[f,C]=(0,n.J0)(void 0),[y,S,k]=(0,D.A)(!1),{bestImageData:w,thumbnail:I}=li(o),P=ri(),Y=(0,K.A)(e),F=(0,K.A)(w),M=(0,K.A)(t),L=(0,K.A)(l),x=Boolean(d&&!c);(0,n.vJ)(()=>{e||(C(void 0),k())},[e]),(0,n.vJ)(()=>{if(!e)return;(0,p.FD)();const t=(0,J.w4)();return()=>{(0,p.wb)(),t()}},[e]);const R=(0,n.hb)(()=>{u()},[u]),E=(0,T.A)(e=>{C(e),S()}),V=(0,T.A)(()=>{k(),C(void 0)}),_=(0,T.A)(()=>{i&&v({storyId:i,peerId:t})});return(0,n.vJ)(()=>e?(0,m.A)(()=>{R()}):void 0,[R,e]),(0,n.vJ)(()=>{x&&!Y&&e&&t&&I&&void 0!==l&&((0,n.VK)(250+a.xB5),function(e,t,i,n,s){const{mediaEl:o}=oi(t,e);if(!o)return;const{width:l,height:c}=N.A.get();let{width:d,height:h}=s;const u=l<=600;if(u){d=l-2*ni,h=c-ii-2*ni;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(h-=parseFloat(e))}const m=u?ni:(l-d)/2,p=u?ni:(c-(h+ii))/2,{top:g,left:v,width:A,height:f}=o.getBoundingClientRect(),C=v+A/2-(m+d/2),y=g+f/2-(p+h/2),S=A/d,k=f/h;(0,r.RK)(()=>{const e=si(n||i,!n);(0,b.ZM)(e,{top:`${p}px`,left:`${m}px`,width:`${d}px`,height:`${h}px`,transform:`translate3d(${C}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,b.ZM)(e,{transform:""}),setTimeout(()=>{(0,r.RK)(()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")})},200+a.xB5)})})}(t,l,I,w,P.activeSlide)),x&&Y&&!e&&M&&F&&void 0!==L&&((0,n.VK)(250+a.xB5),function(e,t,i){const{mediaEl:n}=oi(t,e),s=document.getElementById("StoryViewer").querySelector(`.${zt} .${Jt}, .${$t} .${Jt}`);if(!s||!n)return;const{top:o,left:l,width:c,height:d}=s.getBoundingClientRect(),{top:h,left:u,width:m,height:p}=n.getBoundingClientRect(),g=u+m/2-(l+c/2),v=h+p/2-(o+d/2),A=m/c,f=p/d;(0,r.RK)(()=>{const e=si(i);(0,b.ZM)(e,{top:`${o}px`,left:`${l}px`,width:`${c}px`,height:`${d}px`});const t=si(n.src,void 0,!0),s=o+d/2-c/2;(0,b.ZM)(t,{top:`${s}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,b.ZM)(e,{transform:`translate3d(${g}px, ${v}px, 0) scale(${A}, ${f})`}),(0,b.ZM)(t,{transform:`translate3d(${g}px, ${v}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+a.xB5)})})}(M,L,F))},[x,w,F,e,Y,P.activeSlide,I,t,M,l,L]),(0,ne.FD)(oe.A,{id:"StoryViewer",className:"bu_hGbaa",isOpen:e,shouldAnimateFirstRender:!0,noCloseTransition:c,children:[(0,ne.Y)("div",{className:"OFh6u50Q",onClick:R}),(0,ne.Y)(X.A,{className:"Mye8Dwxa",round:!0,size:"tiny",color:"translucent-white",ariaLabel:A("Close"),onClick:R,iconName:"close"}),(0,ne.Y)(hn,{isOpen:e,isDeleteModalOpen:y,onReport:_,onClose:R,onDelete:E}),(0,ne.Y)(di,{isOpen:y,story:f,onClose:V}),(0,ne.Y)(Sn,{}),(0,ne.Y)(ki,{isOpen:h,onClose:g})]})}));var Nn=i(1455),wn=i(68292),In=i(64520);function Pn(e,t){return{peerId:e,topicId:t}}function Yn(e,t){return e.peerId===t.peerId&&e.topicId===t.topicId}function Fn(e,t){return e.some(e=>Yn(e,t))}var Dn=i(79582),Mn=i(74984),Tn=i(8247),Bn=i(41257),Ln=i(17486),xn=i(10187),Rn=i(30708),En=i(96115),Vn=i(31460),_n=i(63527),Un=i(96374),On=i(79174),Kn=i(10328),Jn=i(52745),jn=i(34431),Gn=i(38102),Hn=i(45780);const zn=2.75*v.$,$n="ChatOrUserPicker-item";function qn({isOpen:e,viewportIds:t,maxHeight:i,viewportFooter:s,onLoadMore:o,onSelect:a,onKeyDownHandlerUpdate:r,renderItem:l}){const c=(0,Bi.A)(),d=(0,n.li)(),h=(0,Kn.A)(d,e,a,`.${$n}`,!0);return(0,n.vJ)(()=>{r(h)},[h,r]),(0,ne.Y)(ne.FK,{children:t?.length?(0,ne.FD)(mn.A,{ref:d,className:"picker-list custom-scroll",items:t,itemSelector:`.${$n}`,onLoadMore:o,withAbsolutePositioning:!0,maxHeight:i,onKeyDown:h,children:[t.map(l),Boolean(s)&&(0,ne.Y)("div",{className:"picker-list-spacer",style:`top: ${i}px`})]}):t&&!t.length?(0,ne.Y)("p",{className:"no-results",children:c("NothingFound")}):(0,ne.Y)(Jn.A,{})})}const Wn=(0,n.ph)((0,s.EK)(e=>({animationLevel:(0,Rn.Vu)(e),shouldSkipHistoryAnimations:(0,c.nTw)(e).shouldSkipHistoryAnimations}))(({isOpen:e,currentUserId:t,chatOrUserIds:i,title:o,search:r,searchPlaceholder:d,className:h,isLowStackPriority:u,subheader:m,renderSearchRow:p,footer:g,viewportFooter:v,listActiveKey:A,selectedIds:f,animationLevel:C,shouldSkipHistoryAnimations:b,loadMore:y,onSearchChange:S,onSelectChatOrUser:k,onClose:N,onCloseAnimationEnd:w})=>{const{loadTopics:I}=(0,s.ko)(),P=(0,B.A)(),Y=(0,Bi.A)(),[F,D]=(0,n.J0)(),M=(0,n.li)(),L=(0,n.li)(),x=(0,n.li)(),[R,E]=(0,Un.A)(y,i,Boolean(r)),[V,_]=(0,n.J0)(void 0),[U,O]=(0,n.J0)(""),K=V?1:0,J=i.indexOf(R[0]),j=(0,T.A)(()=>{S("")});(0,On.A)(L,e&&0===K,j),(0,On.A)(x,e&&1===K);const G=(0,n.hb)(e=>{if(V)return(0,c.xyP)(e,V)},[V]),H=(0,_n.Ay)(G),z=(0,n.hb)(e=>{if(V)return(0,pi.Tq)(H?.topicsById||{},t=>(0,En.$j)(e,V,t.id))},[V,H?.topicsById]),$=(0,_n.LV)(z),[q,W]=(0,n.Kr)(()=>{const e=(0,s.mS)(),t=e.chats.byId,i=e.chats.fullInfoById,n=t[V];if(!n||!H)return[void 0,void 0];const o=U.toLowerCase(),a=Object.values(H.topicsById).filter(e=>(0,l.__)(n,e,void 0,i[V])&&(!o||e.title.toLowerCase().includes(o))),r=$&&(0,pi.LG)($,e=>e.threadInfo);return[(0,l.CO)(a,r,H.orderedPinnedTopicIds).map(({id:e})=>e),H.topicsById]},[V,U,H,$]),Q=(0,T.A)(()=>{_(void 0),O("")}),Z=(0,T.A)(e=>{S(e.currentTarget.value)}),X=(0,T.A)(e=>{O(e.currentTarget.value)}),ee=(0,T.A)(e=>{if(R&&R.length>0){const t=(0,s.mS)().chats.byId,i=R[-1===e?0:e],n=t[i];n?.isForum?(H&&!H.isCache||I({chatId:i}),_(i)):k(i)}}),ie=(0,T.A)(e=>{D(()=>e)}),se=(0,Kn.A)(M,e,e=>{q?.length&&k(V,q[-1===e?0:e])},`.${$n}`,!0),oe=Boolean(f),re=(0,T.A)(e=>{const t=(0,s.mS)().chats.byId,i=t?.[e];i?.isForum?(H&&!H.isCache||I({chatId:e}),_(e),j()):k(e)}),le=(0,n.hb)((e,i)=>{const n=(0,s.mS)();let o=(0,c.PVB)(n,e);if(!o)return;const r=(0,c.k2W)(n,e);r&&(o=r);const d=n.chats.byId[e],h=d?.isForum,u=o&&!(0,Dt.vj)(o)?o.isSelf:void 0,m=f&&Fn(f,Pn(e)),p=h&&f?f.filter(t=>t.peerId===e&&void 0!==t.topicId).length:0,g=p>0,[v,A]=function(){if(!o)return;if(o.id===t)return[P("SavedMessagesInfo")];if((0,Dt.vj)(o))return[(0,l.sT)(Y,o)];const e=(0,c.K0y)(n,o.id);return[(0,l.CD)(P,o,e),(0,ve.A)((0,l.PF)(o,e,!0)&&"online")]}()||[],C=f?(0,ne.FD)("div",{className:(0,ve.A)("picker-checkbox",(m||g)&&"selected"),children:[(m||g)&&(0,ne.Y)(he.A,{name:"check-bold"}),g&&(0,ne.Y)("div",{className:"picker-checkbox-count",children:p})]}):void 0;return(0,ne.Y)(Hn.A,{className:$n,title:(0,ne.Y)("div",{className:"title-wrapper",children:(0,ne.Y)(jn.A,{className:"item-title",peer:o,isMonoforum:Boolean(r),isSavedMessages:u})}),avatarElement:(0,ne.FD)("div",{className:"picker-avatar-wrapper",children:[(0,ne.Y)(Tt.A,{peer:o,asMessageBubble:Boolean(r),isSavedMessages:u,size:"medium"}),h&&(0,ne.Y)(he.A,{name:"forums",className:"forum-badge"})]}),inputElement:C,inputPosition:"end",subtitle:v,subtitleClassName:A,ripple:!0,style:`top: ${(J+i)*a.xw7}px;`,onClick:()=>re(e)},e)},[t,P,Y,J,f]),ce=(0,T.A)(()=>{V?Q():N()});return(0,ne.FD)(te.A,{isOpen:e,title:o,hasCloseButton:!0,isBackButton:Boolean(V),headerClassName:"modal-header-condensed-wide",className:(0,ve.A)("ChatOrUserPicker",h),isLowStackPriority:u,onClose:ce,onCloseAnimationEnd:w,children:[(0,ne.Y)(ae.Ay,{activeKey:K,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",children:()=>1===K?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:"picker-header",dir:Y.isRtl?"rtl":void 0,children:p?p({inputRef:x,value:U,placeholder:d,onChange:X,onKeyDown:se}):(0,ne.FD)("div",{className:"search-input-wrapper",children:[(0,ne.Y)("i",{className:"icon icon-search"}),(0,ne.Y)("input",{ref:x,className:"search-input",type:"text",dir:"auto",placeholder:d,value:U,onChange:X,onKeyDown:se})]})}),q?.length?(0,ne.FD)(mn.A,{ref:M,className:"picker-list custom-scroll",items:q,withAbsolutePositioning:!0,maxHeight:56*(q?.length||0),onKeyDown:se,children:[q.map((e,t)=>{const i=Pn(V,e),n=f&&Fn(f,i),s=oe?(0,ne.Y)("div",{className:(0,ve.A)("picker-checkbox",n&&"selected"),children:n&&(0,ne.Y)(he.A,{name:"check-bold"})}):void 0;return(0,ne.Y)(Hn.A,{className:$n,onClick:()=>k(V,e),style:`top: ${56*t}px;`,avatarElement:(0,ne.Y)("div",{className:"picker-avatar-wrapper",children:(0,ne.Y)(Gn.A,{size:zn,topic:W[e],className:"topic-icon",letterClassName:"topic-icon-letter"})}),title:(0,Mt.A)(W[e].title),inputElement:s,inputPosition:"end"},`${V}_${e}`)}),Boolean(v)&&(0,ne.Y)("div",{className:"picker-list-spacer",style:`top: ${56*q.length}px`})]}):q&&!q.length?(0,ne.Y)("p",{className:"no-results",children:Y("NothingFound")}):(0,ne.Y)("div",{className:"picker-list picker-list-loading",children:(0,ne.Y)(Jn.A,{})})]}):(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:"picker-header",dir:Y.isRtl?"rtl":void 0,children:[p?p({inputRef:L,value:r,placeholder:d,onChange:Z,onKeyDown:F}):(0,ne.FD)("div",{className:"search-input-wrapper",children:[(0,ne.Y)("i",{className:"icon icon-search"}),(0,ne.Y)("input",{ref:L,className:"search-input",type:"text",dir:"auto",placeholder:d,value:r,onChange:Z,onKeyDown:F})]}),m]}),(0,ne.Y)(ae.Ay,{activeKey:A||0,name:(0,Vn.P)("slideOptimized",C,b,Y.isRtl),slideClassName:"ChatOrUserPicker_slide",children:(0,ne.Y)(qn,{isOpen:e,viewportIds:R,maxHeight:i.length*a.xw7,viewportFooter:v,onLoadMore:E,onSelect:ee,renderItem:le,onKeyDownHandlerUpdate:ie})})]})}),g]})}));var Qn=i(36838);const Zn=(0,n.ph)(({contactIds:e,currentUserId:t,selectedIds:i,className:o,onSelect:a})=>{const r=(0,Bi.A)(),l=(0,n.li)();(0,Qn.A)(l,!e.length);const d=(0,T.A)(e=>{a(e)}),h=t?[t,...e.filter(e=>e!==t)]:e;if(h.length)return(0,ne.Y)("div",{className:(0,ve.A)("nQlR0Q0W",o),dir:r.isRtl?"rtl":void 0,children:(0,ne.Y)("div",{ref:l,className:"sLQQgItu",children:h.map(e=>{const n=(0,s.mS)(),o=(0,c.PVB)(n,e);if(!o)return;const a=e===t,l=i?.includes(e),h=a?r("SavedMessagesShort"):(0,Dt.F9)(r,o);return(0,ne.FD)("div",{className:(0,ve.A)("LCuyQF4w",l&&"OlGxnpac"),onClick:()=>d(e),children:[(0,ne.FD)("div",{className:"FK8lKKJm",children:[(0,ne.Y)(Tt.A,{peer:o,isSavedMessages:a,size:48}),(0,ne.Y)("div",{className:"Z2Iz5Ghc",children:(0,ne.Y)(he.A,{name:"check-bold"})})]}),(0,ne.Y)("div",{className:"g1cuprzz",children:(0,Mt.A)(h||r("ActionFallbackSomeone"))})]},e)})})})}),Xn=(0,n.ph)((0,s.EK)(e=>{const{chatFolders:{byId:t,orderedIds:i},chats:{listIds:n,orderedPinnedIds:s},currentUserId:o}=e;return{activeListIds:n.active,archivedListIds:n.archived,pinnedIds:s.active,contactIds:e.contactList?.userIds,currentUserId:o,chatFoldersById:t,orderedFolderIds:i,maxFolders:(0,In.d)(e,"dialogFilters")}})(({isOpen:e,currentUserId:t,activeListIds:i,archivedListIds:o,pinnedIds:r,contactIds:d,filter:h=a.K_A,title:u,className:m,searchPlaceholder:p,isLowStackPriority:g,chatFoldersById:v,orderedFolderIds:A,isForwarding:f,isMultiSelect:C,maxFolders:b,withFolders:y,footer:S,viewportFooter:k,loadMore:N,onSelectRecipient:w,onSelectedIdsChange:I,onClose:P,onCloseAnimationEnd:Y})=>{const{openLimitReachedModal:F}=(0,s.ko)(),D=(0,Bi.A)(),[M,B]=(0,n.J0)(""),[L,x]=(0,n.J0)([]),[R,E]=(0,n.J0)([]),[V,_]=(0,n.J0)([]),U=(0,Bn.i)(L),O=(0,Bn.i)(R),K=(0,Bn.i)(V),[J,j]=(0,n.J0)(0),{displayedFolders:G,folderTabs:H}=(0,Tn.A)({sidebarMode:!1,orderedFolderIds:A,chatFoldersById:v,maxFolders:b,noEmoticons:!0,isReadOnly:!0}),z=y&&H&&H.length>1&&!M,$=G?.[J]?.id||a.DSF,q=(0,Mn.Rh)($),W=(0,T.A)(e=>{const t=H?.[e];t&&(t.isBlocked?F({limit:"dialogFilters"}):j(e))}),Q=(0,T.A)((e,t)=>{x(e),I?.(e),t&&(0,c.PKK)((0,s.mS)())&&(_([...K.current,t]),setTimeout(()=>{_(K.current.filter(e=>!Yn(e,t)))},200))}),Z=(0,T.A)(e=>{if(!Fn(O.current,e)){if(!(0,c.PKK)((0,s.mS)())){const t=U.current.filter(t=>!Yn(t,e));return x(t),void I?.(t)}E([...O.current,e]),setTimeout(()=>{E(O.current.filter(t=>!Yn(t,e)));const t=U.current.filter(t=>!Yn(t,e));x(t),I?.(t)},300)}}),X=(0,T.A)((e,t)=>{const i=Pn(e,t?Number(t):void 0);Fn(L,i)?Z(i):Q([...L,i],i)}),ee=(0,T.A)((e,t)=>{C?X(e,t):w(e,t)}),te=(0,n.Kr)(()=>{if(!e)return[];let n=r||[];t&&(n=(0,pi.Am)([t,...n]));const a=(0,s.mS)(),u=(z?q||[]:[...i||[],...M&&o||[]]).filter(e=>{if((0,l.DX)(e))return!1;const t=(0,c.hds)(a,e),i=(0,c.mBe)(a,e),n=t&&(0,l.ub)(t,"postMessages"),s=t&&(0,l.WX)(t);if(f&&s&&!n)return!1;if(i&&!(0,l.PL)(i))return!0;if(!t)return!1;if(t.isMonoforum&&(0,c.ODG)(a,e))return!1;const o=(0,c.AWZ)(a,e);return!o||(0,l.__)(t,void 0,void 0,o)}),m=z?u:(0,pi.Am)([...t?[t]:[],...u,...d||[]]),p=(0,Dn.A)((0,Dt.PU)({ids:m,query:M}),void 0,n,t);return(0,c.yMZ)(a,p,h)},[e,r,t,i,M,o,d,h,f,q,z]),ie=(0,Ii.A)(te,!0),se=(0,n.Kr)(()=>d?d.slice(0,15):[],[d]),oe=C&&L.length>0,ae=(0,T.A)(e=>{const{peerId:t,topicId:i}=e;if(!i)return;const n=(0,s.mS)(),o=(0,c.S0q)(n,t,i),a=(0,c.hds)(n,t);if(!o||!a)return;const r=(0,l.Js)(D,a);return`${o.title} • ${r}`}),re=(0,n.hb)(e=>oe?(0,ne.Y)("div",{className:"search-row-with-chips",children:(0,ne.FD)("div",{className:"chips-and-search-scroll no-scrollbar",children:[L.map(e=>{const{peerId:t}=e,i=ae(e),n=Fn(V,e),s=Fn(R,e),o=void 0!==(a=e).topicId?`${a.peerId}:${a.topicId}`:a.peerId;var a;return(0,ne.Y)("div",{className:(0,ve.A)("picker-chip-wrapper",n&&"picker-chip-appear",s&&"picker-chip-disappear"),children:(0,ne.Y)(xn.A,{peerId:t,title:i,size:"small",canClose:!0,className:"picker-chip",itemClassName:"picker-chip-name",clickArg:e,onClick:Z})},o)}),(0,ne.FD)("div",{className:"inline-search",children:[(0,ne.Y)("i",{className:"icon icon-search"}),(0,ne.Y)("input",{ref:e.inputRef,className:"search-input",type:"text",dir:"auto",placeholder:e.placeholder,value:e.value,onChange:e.onChange,onKeyDown:e.onKeyDown})]})]})}):(0,ne.FD)("div",{className:"search-input-wrapper",children:[(0,ne.Y)("i",{className:"icon icon-search"}),(0,ne.Y)("input",{ref:e.inputRef,className:"search-input",type:"text",dir:"auto",placeholder:e.placeholder,value:e.value,onChange:e.onChange,onKeyDown:e.onKeyDown})]}),[oe,L,V,R]),le=(0,n.Kr)(()=>L.map(e=>e.peerId),[L]),ce=(0,n.Kr)(()=>{const e=se.length>0&&!M,i=z;if(e||i)return(0,ne.FD)(ne.FK,{children:[e&&(0,ne.Y)(Zn,{contactIds:se,currentUserId:t,selectedIds:C?le:void 0,className:"jvwlI557",onSelect:ee}),Boolean(i)&&H&&(0,ne.Y)(Ln.A,{tabs:H,activeTab:J,onSwitchTab:W})]})},[se,M,z,t,ee,C,le,H,J,W]);return(0,ne.Y)(Wn,{isOpen:e,className:m,chatOrUserIds:ie,currentUserId:t,title:u,searchPlaceholder:p,search:M,renderSearchRow:re,subheader:ce,footer:S,viewportFooter:k,listActiveKey:J,selectedIds:C?L:void 0,onSearchChange:B,loadMore:N,onSelectChatOrUser:ee,onClose:P,onCloseAnimationEnd:Y,isLowStackPriority:g})}));var es=i(19806);const ts="XtlmXkE6",is=(0,n.ph)((0,s.EK)(e=>{const{messageIds:t,storyId:i,fromChatId:n}=(0,c.nTw)(e).forwardMessages,s=t&&t.length>0;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(i),isForwarding:s,fromChatId:n,forwardMessageIds:t,shouldPaidMessageAutoApprove:e.settings.byKey.shouldPaidMessageAutoApprove}})(({isOpen:e,currentUserId:t,isManyMessages:i,isStory:o,isForwarding:a,fromChatId:r,forwardMessageIds:d,shouldPaidMessageAutoApprove:h})=>{const{openChatOrTopicWithReplyInDraft:u,setForwardChatOrTopic:m,exitForwardMode:p,forwardToSavedMessages:v,forwardToMultipleChats:A,forwardStory:f,showNotification:C,copyMessageLink:b,openStarsBalanceModal:y,setPaidMessageAutoApprove:S}=(0,s.ko)(),k=(0,Bi.A)(),N=(0,B.A)(),w=(0,K.A)(o,!0),[I,P,Y]=(0,D.A)(),[F,M]=(0,n.J0)([]),[L,x]=(0,n.J0)(""),[R,E,V]=(0,D.A)(),[_,U]=(0,n.J0)(h),O=a&&!o,J=d?.length||0,j=(0,n.Kr)(()=>{if(!F.length)return{paidChatsCount:0,totalStars:0,totalMessages:0};const e=(0,s.mS)(),t=new Set;let i=0;const n=L.trim().length>0,o=J+(n?1:0);for(const{peerId:n}of F){const s=(0,c.WA9)(e,n);s&&(t.add(n),i+=s*o)}return{paidChatsCount:t.size,totalStars:i,totalMessages:o}},[F,J,L]),G=(0,n.Kr)(()=>{if(!r||1!==d?.length)return!1;const e=(0,s.mS)(),t=(0,c.zeq)(e,r);if(!t)return!1;const i=t[d[0]];return i&&(0,c.dVs)(e,i)},[r,d]);(0,n.vJ)(()=>{e&&P()},[e,P]),(0,n.vJ)(()=>{e||(M([]),x(""))},[e]);const H=(0,n.hb)((e,n)=>{const r=e===t;if(o){f({toChatId:e});const t=(0,s.mS)();if((0,g.L8)(e))C({message:r?N("Conversation.StoryForwardTooltip.SavedMessages.One"):N("StorySharedTo",(0,l.u0)((0,c.mBe)(t,e)))});else{const i=(0,c.hds)(t,e);if(!i)return;C({message:N("StorySharedTo",(0,l.Js)(N,i))})}return}if(r){const e=N(i?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");v({}),C({message:e})}else{const t=e,i=n?Number(n):void 0;a?m({chatId:t,topicId:i}):u({chatId:t,topicId:i})}},[t,i,o,N,a]),z=(0,n.hb)(()=>{p()},[p]),$=(0,T.A)(e=>{M(e)}),q=(0,T.A)(()=>{r&&d?.length&&(b({chatId:r,messageId:d[0]}),p())}),W=(0,T.A)(()=>{if(F.length){if(1===F.length){const{peerId:e,topicId:t}=F[0];return void m({chatId:e,topicId:t})}if(j.totalStars>0&&!h)E();else{if(j.totalStars>0){const e=(0,s.mS)().stars?.balance?.amount||0;if(j.totalStars>e)return void y({topup:{balanceNeeded:j.totalStars}})}Z()}}}),Q=(0,T.A)(e=>!(e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)&&(F.length?(e.preventDefault(),void W()):!!G&&(e.preventDefault(),void q())));(0,n.vJ)(()=>{if(e&&O&&!R)return(0,Pi.A)({onEnter:Q})},[e,O,R,Q]);const Z=(0,T.A)(()=>{const e=F.map(({peerId:e,topicId:t})=>({chatId:e,topicId:t}));A({targets:e,comment:L||void 0}),C({message:k("FwdMessagesToChats",{count:F.length},{pluralValue:F.length})}),p()}),ee=(0,T.A)(()=>{const{totalStars:e}=j;e>((0,s.mS)().stars?.balance?.amount||0)?y({topup:{balanceNeeded:e}}):(V(),_&&S(),Z())}),te=(0,n.Kr)(()=>(0,ne.Y)("div",{className:"picker-list-spacer"}),[]),ie=F.length,se=ie>=2,{totalStars:oe}=(0,Nn.A)({totalStars:j.totalStars},!se),re=(0,n.Kr)(()=>{if(a&&!o)return(0,ne.FD)("div",{className:"picker-footer",children:[(0,ne.Y)("div",{className:(0,ve.A)("RzrVoYN7",!se&&ts),children:(()=>{const e=0===ie,t=1===ie?j.totalStars:0;return(0,ne.Y)(X.A,{className:"picker-footer-button",color:"primary",disabled:e&&!G,onClick:e?q:W,children:(0,ne.Y)(ae.Ay,{name:"fade",activeKey:e?0:1,slideClassName:"rC4tg125",children:(0,ne.Y)("span",{children:e?G?N("CopyLink"):k("SelectChats"):t>0?k("ForwardForStars",{price:(0,Fi.U2)(k,t,{asFont:!0})},{withNodes:!0}):k("Forward")})})})})()}),(0,ne.Y)("div",{className:(0,ve.A)("UTDObnoN",se&&ts),children:(0,ne.Y)("div",{className:"picker-footer-input",children:(0,ne.FD)("div",{className:"picker-caption-wrapper",children:[(0,ne.Y)("input",{className:"picker-caption-input",type:"text",value:L,onChange:e=>x(e.currentTarget.value),placeholder:k("AttachmentCaptionPlaceholder")}),(0,ne.Y)(X.A,{className:"picker-send-button",color:"primary",onClick:W,ariaLabel:k("Forward"),children:oe>0?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(he.A,{name:"star",className:"star-icon"}),(0,ne.Y)(wn.A,{text:String(oe)})]}):(0,ne.Y)("i",{className:"icon icon-new-send"})})]})})})]})},[a,o,ie,se,L,G,oe,j,W,q,k,N]);if(!e&&!I)return;const le=j.totalStars>0?k("ForwardPaidChatsConfirmation",{chatsSelected:k("ForwardPaidChatsSelected",{paidChatsCount:j.paidChatsCount},{withNodes:!0,withMarkdown:!0,pluralValue:j.paidChatsCount}),payConfirmation:k("ForwardPaidChatsPayConfirmation",{totalAmount:(0,Fi.Kk)(k,j.totalStars),count:j.totalMessages},{withNodes:!0,withMarkdown:!0,pluralValue:j.totalMessages})},{withNodes:!0}):void 0,ce=k("PayForMessage",{count:j.totalMessages},{withNodes:!0,pluralValue:j.totalMessages});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Xn,{isOpen:e,className:w?"component-theme-dark":void 0,title:k("ShareWith"),searchPlaceholder:k("Search"),isMultiSelect:O,footer:re,viewportFooter:te,onSelectRecipient:H,onSelectedIdsChange:$,onClose:z,onCloseAnimationEnd:Y,isForwarding:a,withFolders:!0}),(0,ne.FD)(ci.A,{title:k("TitleConfirmPayment"),confirmLabel:ce,isOpen:R,onClose:V,confirmHandler:ee,children:[le,(0,ne.Y)(es.A,{label:k("DoNotAskAgain"),checked:_,onCheck:U})]})]})})),ns=(0,n.ph)(({requestedDraft:e})=>{const t=Boolean(e&&!e.chatId),{openChatWithDraft:i,resetOpenChatWithDraft:o}=(0,s.ko)(),a=(0,Bi.A)(),[r,l,c]=(0,D.A)();(0,n.vJ)(()=>{t&&l()},[t,l]);const d=(0,n.hb)((t,n)=>{i({chatId:t,threadId:n,text:e.text,files:e.files})},[i,e]),h=(0,n.hb)(()=>{o()},[o]);if(t||r)return(0,ne.Y)(Xn,{isOpen:t,title:a("ShareWith"),searchPlaceholder:a("Search"),filter:e?.filter,onSelectRecipient:d,onClose:h,onCloseAnimationEnd:c})}),ss=(0,n.ph)(({requestedAttachBotInChat:e})=>{const{cancelAttachBotInChat:t,callAttachBot:i}=(0,s.ko)(),o=(0,Bi.A)(),a=Boolean(e),[r,l,c]=(0,D.A)();(0,n.vJ)(()=>{a&&l()},[a,l]);const{bot:d,filter:h,startParam:u}=e||{},m=(0,n.hb)(e=>{i({bot:d,chatId:e,startParam:u}),t()},[d,i,t,u]);if(a||r)return(0,ne.Y)(Xn,{isOpen:a,title:o("SelectChat"),searchPlaceholder:o("Search"),filter:h,onSelectRecipient:m,onClose:t,onCloseAnimationEnd:c})});var os=i(26087),as=i(24585);const rs=(0,n.ph)(({url:e})=>{const{toggleSafeLinkModal:t}=(0,s.ko)(),i=(0,Bi.A)(),o=(0,n.hb)(()=>{e&&(window.open((0,as.Tc)(e),"_blank","noopener noreferrer"),t({url:void 0}))},[t,e]),a=(0,n.hb)(()=>{t({url:void 0})},[t]),r=(0,Ii.A)(e);return(0,ne.Y)(ci.A,{isOpen:Boolean(e),onClose:a,title:i("OpenUrlTitle"),textParts:(0,Mt.A)(i("OpenUrlText",{url:r},{withNodes:!0,withMarkdown:!0})),confirmLabel:i("OpenUrlConfirm"),confirmHandler:o})});var ls=i(47526);const cs=(0,n.ph)(({modal:e})=>{const{closeMapModal:t}=(0,s.ko)(),{point:i,zoom:o}=e||{},a=(0,Bi.A)(),r=Boolean(i),l=(0,T.A)(()=>{t()}),[c,d,h,u]=(0,n.Kr)(()=>i?[(0,ls.zS)("google",i,o),(0,ls.zS)("bing",i,o),(0,ls.zS)("apple",i,o),(0,ls.zS)("osm",i,o)]:[],[i,o]),m=(0,T.A)(e=>{t(),window.open(e,"_blank","noopener")}),p=(0,T.A)(()=>{m(c)}),g=(0,T.A)(()=>{m(d)}),v=(0,T.A)(()=>{m(h)}),A=(0,T.A)(()=>{m(u)});return(0,ne.FD)(te.A,{contentClassName:"VJDwJpsF",title:a("OpenMapWith"),isOpen:r,onClose:l,isSlim:!0,children:[(0,ne.FD)("div",{className:"aYO2C2Hx",children:[(0,ne.Y)(X.A,{noForcedUpperCase:!0,fluid:!0,size:"smaller",onClick:p,children:"Google Maps"}),(0,ne.Y)(X.A,{noForcedUpperCase:!0,fluid:!0,size:"smaller",onClick:v,children:"Apple Maps"}),(0,ne.Y)(X.A,{noForcedUpperCase:!0,fluid:!0,size:"smaller",onClick:g,children:"Bing Maps"}),(0,ne.Y)(X.A,{noForcedUpperCase:!0,fluid:!0,size:"smaller",onClick:A,children:"OpenStreetMap"})]}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:a("Cancel")})})]})});var ds=i(64713),hs=i(87412),us=i(84685);const ms={content:"jBdWsSFY",center:"AkTjFYUS",textCenter:"g__9CLCQ",title:"smVIBWXa",actions:"OdtxQhLZ",infoCard:"ya1CESP4",infoLabel:"tTy56DcP",note:"Bs7Lf3QD",allowMessages:"R_X7jC91",infoValue:"GtgpHX_Y",matchCodes:"SI3bVp__",matchCodeButton:"gMdAhAzP",footnote:"KfSLcqGx",cancelButton:"rtMLZB5Q"},ps=2*v.$,gs=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=(0,c.mBe)(e,e.currentUserId);return{bot:t?.request?.botId?(0,c.mBe)(e,t.request.botId):void 0,currentUser:i}})(({modal:e,bot:t,currentUser:i})=>{const{acceptBotUrlAuth:o,acceptLinkUrlAuth:a,checkUrlAuthMatchCode:r,declineUrlAuth:d}=(0,s.ko)(),h=(0,Bi.A)(),u=(0,Ii.A)(e,!1),m=(0,Ii.A)(t,!1),p=e?.request,g=u?.request,v=u?.matchCode,A=(0,l.Yg)(m)||m?.firstName,f=Boolean(p?.matchCodesFirst&&p.matchCodes?.length&&!e?.matchCode),C=Boolean(e?.url&&e?.request)&&!f,[b,y]=(0,n.J0)(()=>Boolean(p?.shouldRequestWriteAccess)),[S,k]=(0,n.J0)(),[N,w]=(0,n.J0)("closed"),I=v||S,P=f||"match-confirm"===N,Y="phone"===N,F=(0,n.hb)(e=>g?.matchCodes?.map(t=>(0,c.oei)(e,t)),[g?.matchCodes]),D=(0,_n.LV)(F);(0,n.vJ)(()=>{if(!p)return k(void 0),void w("closed");y(Boolean(p.shouldRequestWriteAccess)),k(void 0),w("closed")},[p]);const M=(0,T.A)(()=>{w("closed"),d()}),B=(0,T.A)((e={})=>{(u?.button?o:a)({isWriteAllowed:g?.shouldRequestWriteAccess?b:void 0,wasPhoneShared:e.wasPhoneShared,matchCode:e.matchCode??I})}),L=(0,T.A)(()=>{g&&(!g.matchCodes?.length||I?g.shouldRequestPhoneNumber?w("phone"):B():w("match-confirm"))}),x=(0,T.A)(()=>{w("closed")}),R=(0,T.A)(e=>{f?r({matchCode:e}):(k(e),w("closed"),g?.shouldRequestPhoneNumber?w("phone"):B({matchCode:e}))}),E=(0,T.A)(()=>{w("closed")}),V=(0,T.A)(e=>{w("closed"),B({wasPhoneShared:e})}),_=(0,T.A)(()=>{y(!b)});if(!g)return;const U=Boolean(g.platform||g.browser||g.ip||g.region),O=g.domain,K=g.isApp?g.verifiedAppName||h("BotAuthUnverifiedApp"):O,J=g.isApp?K:(0,ne.Y)(us.A,{url:O,text:O}),j=i?.phoneNumber?`+${(0,ds.n4)(i.phoneNumber)}`:void 0,G=h("BotAuthTitle",{url:J},{withNodes:!0}),H=h(g.isApp?"BotAuthAppSubtitle":"BotAuthSiteSubtitle",void 0,{withNodes:!0,withMarkdown:!0});return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(te.A,{isOpen:C,contentClassName:ms.content,className:"tall",onClose:M,hasAbsoluteCloseButton:!0,isSlim:!0,children:[(0,ne.Y)(Tt.A,{peer:m,size:96,className:ms.center}),(0,ne.Y)("h2",{className:(0,ve.A)(ms.center,ms.title),dir:"auto",children:G}),(0,ne.Y)("span",{className:ms.textCenter,children:H}),U&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:ms.infoCard,children:[(0,ne.Y)("span",{className:ms.infoLabel,children:h("BotAuthDevice")}),(0,ne.Y)("span",{className:ms.infoValue,children:[g.platform,g.browser].filter(Boolean).join(" · ")}),(0,ne.Y)("span",{className:ms.infoLabel,children:h("SessionPreviewIp")}),(0,ne.Y)("span",{className:ms.infoValue,children:g.ip}),(0,ne.Y)("span",{className:ms.infoLabel,children:h("SessionPreviewLocation")}),(0,ne.Y)("span",{className:ms.infoValue,children:g.region})]}),(0,ne.Y)("span",{className:ms.note,children:h("BotAuthInfo")})]}),g.shouldRequestWriteAccess&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(ui.A,{className:ms.allowMessages,onClick:_,rightElement:(0,ne.Y)(mi.A,{id:"url_auth_allow_messages",label:h("BotAuthAllowMessages"),checked:b}),children:h("BotAuthAllowMessages")}),A&&(0,ne.Y)("span",{className:ms.note,children:h("BotAuthAllowMessagesInfo",{bot:A},{withNodes:!0,withMarkdown:!0})})]}),(0,ne.FD)("div",{className:(0,ve.A)(ms.actions,ms.center),children:[(0,ne.Y)(X.A,{className:ms.actionButton,color:"gray",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:M,children:h("Cancel")}),(0,ne.Y)(X.A,{className:ms.actionButton,color:"primary",fluid:!0,noForcedUpperCase:!0,onClick:L,children:h("BotAuthLogin")})]})]}),(0,ne.FD)(te.A,{isOpen:P,title:h("BotAuthSelectEmoji"),onClose:f?M:x,className:(0,ve.A)("confirm",ms.matchDialog),children:[(0,ne.Y)("div",{className:ms.matchCodes,children:g.matchCodes?.map((e,t)=>{const i=D?.[t];return(0,ne.Y)(X.A,{fluid:!0,color:"adaptive",className:ms.matchCodeButton,onClick:()=>R(e),children:i?(0,ne.Y)(hs.A,{sticker:i,size:ps}):(0,Mt.A)(e)},e)})}),(0,ne.Y)("div",{className:ms.footnote,children:h("BotAuthTitle",{url:J},{withNodes:!0})}),(0,ne.Y)(X.A,{color:"danger",className:ms.cancelButton,isText:!0,noForcedUpperCase:!0,onClick:M,children:h("Cancel")})]}),(0,ne.FD)(te.A,{isOpen:Y,title:h("BotAuthPhoneNumber"),onClose:E,className:(0,ve.A)("confirm",ms.phoneDialog),children:[(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("p",{children:h("BotAuthPhoneNumberText",{domain:K,phone:j||h("Phone")},{withNodes:!0,withMarkdown:!0})}),(0,ne.Y)("p",{children:h("BotAuthPhoneNumberQuestion")})]}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",color:"primary",noForcedUpperCase:!0,onClick:()=>V(!0),children:h("BotAuthPhoneNumberAccept")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",color:"gray",noForcedUpperCase:!0,onClick:()=>V(!1),children:h("BotAuthPhoneNumberDeny")})]})]})]})}));var vs=i(15379),As=i(10722);const fs=1e3*a.fRl,Cs=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function bs(e,t,i,n,s){const o=new Date(e,t,i),a=n&&(0,et.pU)(n),r=s&&(0,et.pU)(s);return!!(r&&o>r)||!!(a&&o<a)}function ys(e){return String(e).padStart(2,"0")}function Ss(e,t,i){return`${e}-${t+1}-${i}`}const ks=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.g29)(e);return{isTestServer:e.config?.isTestServer,isCurrentUserPremium:t}})(({selectedAt:e,minAt:t,maxAt:i,isFutureMode:o,isPastMode:a,isOpen:r,withTimePicker:l,withRepeatMode:c,initialRepeatMode:d,submitButtonLabel:h,secondButtonLabel:u,description:m,isTestServer:p,isCurrentUserPremium:g,onClose:v,onSubmit:A,onDateChange:f,onSecondButtonClick:C})=>{const{showNotification:b}=(0,s.ko)(),y=(0,n.li)(),S=(0,n.li)(),k=(0,B.A)(),N=(0,Bi.A)(),w=new Date,{isContextMenuOpen:I,contextMenuAnchor:P,handleContextMenu:Y,handleContextMenuClose:F,handleContextMenuHide:M}=(0,As.A)(y),L=(0,T.A)(()=>S.current),x=(0,T.A)(()=>y.current.querySelector(".bubble")),R=(0,T.A)(()=>S.current.querySelector(".repeat-mode-button")),E=(0,n.Kr)(()=>o&&!t?new Date:new Date(Math.max(t||0,0)),[o,t]),V=(0,n.Kr)(()=>a&&!i?new Date:new Date(Math.min(i||fs,fs)),[a,i]),_=(0,n.Kr)(()=>e?new Date(e):new Date,[e]),U=(0,K.A)(r),[O,J]=(0,D.A)(!1),[j,G]=(0,n.J0)(_),[H,z]=(0,n.J0)(()=>new Date(j.getFullYear(),j.getMonth(),1)),[$,q]=(0,n.J0)(()=>ys(_.getHours())),[W,Q]=(0,n.J0)(()=>ys(_.getMinutes())),[Z,ee]=(0,n.J0)(d||"never"),ie=Ss(j.getFullYear(),j.getMonth(),j.getDate()),se=H.getFullYear(),oe=H.getMonth(),ae=o&&j.getTime()<E.getTime()||a&&j.getTime()>V.getTime();(0,n.vJ)(()=>{r||ee("never")},[r]),(0,n.vJ)(()=>{ee(d||"never")},[d]),(0,n.vJ)(()=>{!U&&r&&(G(_),z(new Date(_.getFullYear(),_.getMonth(),1)),l&&(q(ys(_.getHours())),Q(ys(_.getMinutes()))))},[_,r,U,l]),(0,n.vJ)(()=>{o&&!O&&j.getTime()<E.getTime()&&(G(E),q(ys(E.getHours())),Q(ys(E.getMinutes())))},[o,O,E,j]),(0,n.vJ)(()=>{a&&!O&&j.getTime()>V.getTime()&&(G(V),q(ys(V.getHours())),Q(ys(V.getMinutes())))},[o,a,O,V,E,j]),(0,n.vJ)(()=>{if(e){const t=new Date(e);G(t),q(ys(t.getHours())),Q(ys(t.getMinutes()))}},[e]);const re=a&&se>=w.getFullYear()&&oe>=w.getMonth()||V&&se>=V.getFullYear()&&oe>=V.getMonth(),le=o&&se<=w.getFullYear()&&oe<=w.getMonth(),{prevMonthGrid:ce,currentMonthGrid:de,nextMonthGrid:he}=(0,n.Kr)(()=>function(e,t){const i=[],n=[],s=[],o=new Date;o.setDate(1),o.setMonth(t),o.setFullYear(e);const a=o.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<a;e++)i.push(r-a+e+1);for(;o.getMonth()===t;){const e=o.getDate();n.push(e),o.setDate(e+1)}const l=(n.length+i.length)%7;if(l>0)for(let e=1;e<=7-l;e++)s.push(e);return{prevMonthGrid:i,currentMonthGrid:n,nextMonthGrid:s}}(se,oe),[oe,se]),ue=(0,n.Kr)(()=>h||function(e,t){const i=(0,et.A)(t,e.code);return i===(0,et.A)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,et.fU)(e,t)):e("Conversation.ScheduleMessage.SendOn",[i,(0,et.fU)(e,t)])}(k,j),[k,j,h]),pe=(0,T.A)(e=>{g?Y(e):b({message:N("MessageScheduledRepeatPremium"),action:{action:"openPremiumModal",payload:{}},actionText:N("PremiumMore")})}),ge=(0,n.hb)(()=>{A(o&&j<E?E:a&&j>V?V:j,c&&"never"!==Z?Z:void 0)},[o,a,E,V,A,j,c,Z]),Ae=(0,n.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return q(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),23)),n=new Date(j.getTime());n.setHours(i),G(n),f?.(n);const s=ys(i);q(s),e.target.value=s},[j,f]),fe=(0,n.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return Q(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),59)),n=new Date(j.getTime());n.setMinutes(i),G(n),f?.(n);const s=ys(i);Q(s),e.target.value=s},[j,f]),Ce=(0,n.hb)(e=>(0,ne.Y)(me.A,{onClick:()=>ee(e),children:(0,vs.j5)(e,N)},e),[N]),be=(0,n.Kr)(()=>vs.to.filter(e=>p||!vs.Vb.has(e)),[p]);return(0,ne.FD)(te.A,{isOpen:r,onClose:v,className:"CalendarModal",onEnter:ge,dialogRef:S,hasAbsoluteCloseButton:!0,isNativeDialog:!0,children:[(0,ne.Y)("div",{className:"container",children:(0,ne.FD)("div",{className:"month-selector",children:[(0,ne.FD)("h4",{children:[k(`lng_month${oe+1}`)," ",se]}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",iconName:"previous",disabled:le,noFastClick:!0,noPreventDefault:!0,onClick:le?void 0:function(e){z(t=>{const i=new Date(t);if(e.shiftKey){if(i.setFullYear(i.getFullYear()-1),i<E)return new Date(E.getFullYear(),E.getMonth(),1)}else i.setMonth(i.getMonth()-1);return i})}}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",iconName:"next",disabled:re,noFastClick:!0,noPreventDefault:!0,onClick:re?void 0:function(e){z(t=>{const i=new Date(t);if(e.shiftKey){if(i.setFullYear(i.getFullYear()+1),i>V)return new Date(V.getFullYear(),V.getMonth(),1)}else i.setMonth(i.getMonth()+1);return i})}})]})}),(0,ne.Y)("div",{className:"calendar-wrapper",children:(0,ne.FD)("div",{className:"calendar-grid",children:[Cs.map(e=>(0,ne.Y)("div",{className:"day-button faded weekday",children:k(e)})),ce.map(e=>(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",disabled:!0,children:e},`prev-month-${e}`)),de.map(e=>{const t=ie===Ss(se,oe,e);return(0,ne.Y)(X.A,{round:!0,autoFocus:t,ariaSelected:t,onClick:()=>{return t=e,void G(e=>{const i=new Date(e);return i.setDate(t),i.setMonth(oe),i.setFullYear(se),f?.(i),i});var t},disabled:bs(se,oe,e,E,V),noFastClick:!0,noPreventDefault:!0,nonInteractive:!e,size:"smaller",color:t?"primary":"translucent",className:(0,ve.A)("day-button div-button",t&&"selected"),children:e},`current-month-${e}`)}),he.map(e=>(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",disabled:!0,children:e},`next-month-${e}`))]})}),l&&(0,ne.FD)("div",{className:"timepicker",children:[(0,ne.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:$,onChange:Ae,onFocus:J}),":",(0,ne.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:W,onChange:fe,onFocus:J})]}),c&&r&&function(){const e=(0,ve.A)("drop-down-icon",!I&&"expanded-icon");return(0,ne.FD)("div",{className:"repeat-mode",ref:y,children:[(0,ne.Y)(X.A,{className:"repeat-mode-button",onClick:pe,noForcedUpperCase:!0,isText:!0,iconName:g?"down":"lock-badge",iconClassName:g?e:void 0,iconAlignment:"end",children:N("ScheduleRepeat",{value:(0,vs.j5)(Z,N)})}),(0,ne.Y)(it.A,{isOpen:I,className:"with-menu-transitions",anchor:P,getTriggerElement:R,getRootElement:L,getMenuElement:x,onClose:F,onCloseAnimationEnd:M,autoClose:!0,children:be.map(Ce)})]})}(),(0,ne.FD)("div",{className:"footer",children:[m&&(0,ne.Y)("div",{className:"description",children:m}),(0,ne.FD)("div",{className:"footer",children:[(0,ne.Y)(X.A,{onClick:ge,disabled:ae,children:ue}),u&&(0,ne.Y)(X.A,{onClick:C,isText:!0,children:u})]})]})]})})),Ns=(0,n.ph)((0,s.EK)(e=>({selectedAt:(0,c.nTw)(e).historyCalendarSelectedAt}))(({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:i,closeHistoryCalendar:o}=(0,s.ko)(),a=(0,n.hb)(e=>{i({timestamp:e.getTime()/1e3}),o()},[o,i]),r=(0,B.A)();return(0,ne.Y)(ks,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:o,onSubmit:a})}));var ws=i(13235),Is=i(94079);const Ps=(0,n.ph)((0,s.EK)((e,{userId:t})=>{const i=t?(0,c.mBe)(e,t):void 0,n=t?(0,c.vGo)(e,t):void 0,s=e.appConfig?.contactNoteLimit||ws.tI;return{user:i,userStatus:t?(0,c.K0y)(e,t):void 0,phoneCodeList:e.countryList.phoneCodes,contactNoteLimit:s,noteText:n?.note?.text}})(({isOpen:e,userId:t,isByPhoneNumber:i,user:o,userStatus:a,phoneCodeList:r,contactNoteLimit:c,noteText:d})=>{const{updateContact:h,importContact:m,closeNewContactDialog:p}=(0,s.ko)(),g=(0,B.A)(),v=(0,Bi.A)(),A=(0,Ii.A)(o),f=(0,Ii.A)(i),C=(0,n.li)(),[b,y,S]=(0,D.A)(),[k,N]=(0,n.J0)(A?.firstName??""),[w,I]=(0,n.J0)(A?.lastName??""),[P,Y]=(0,n.J0)(A?.phoneNumber??""),[F,M]=(0,n.J0)(""),[T,L]=(0,n.J0)(!0),x=Boolean(k&&(!i||P)),R=c-F.length,E=(0,n.li)();(0,n.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,n.vJ)(()=>{!u.TF&&b&&C.current?.focus()},[b]);const V=(0,n.hb)(e=>{N(e.target.value)},[]),_=(0,n.hb)(e=>{Y((0,ds.Ox)(r,e.target.value))},[r]),U=(0,n.hb)(e=>{I(e.target.value)},[]),O=(0,n.hb)(e=>{M(e.target.value)},[]),K=(0,n.hb)(()=>{p(),N(""),I(""),Y(""),M("")},[p]),J=(0,n.hb)(()=>{const e=F.trim()?{text:F,entities:[]}:void 0;i||!t?m({firstName:k,lastName:w,phoneNumber:P}):h({userId:t,firstName:k,lastName:w,shouldSharePhoneNumber:T,note:e})},[k,m,i,w,F,P,T,h,t]);if(e||b)return(0,ne.FD)(te.A,{className:"NewContactModal",title:g("NewContact"),isOpen:e,onClose:K,onCloseAnimationEnd:S,children:[A&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:"NewContactModal__profile",dir:v.isRtl?"rtl":void 0,children:[(0,ne.Y)(Tt.A,{size:"jumbo",peer:A,text:`${k} ${w}`}),(0,ne.FD)("div",{className:"NewContactModal__profile-info",children:[(0,ne.Y)("p",{className:"NewContactModal__phone-number",children:A?.phoneNumber?(0,ds.Ox)(r,A.phoneNumber):g("MobileHidden")}),(0,ne.Y)("span",{className:"NewContactModal__user-status",dir:"auto",children:(0,l.CD)(g,A,a)})]})]}),(0,ne.Y)(ee.A,{ref:C,value:k,label:g("FirstName"),tabIndex:0,onChange:V}),(0,ne.Y)(ee.A,{value:w,label:g("LastName"),tabIndex:0,onChange:U}),(0,ne.Y)(Is.A,{ref:E,id:"user-note",label:v("UserNoteTitle"),onChange:O,value:F,maxLength:c,maxLengthIndicator:R.toString(),noReplaceNewlines:!0}),(0,ne.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__edit",children:v("EditUserNoteHint")}),(0,ne.Y)("p",{className:"NewContactModal__help-text",children:(0,Mt.A)(g("NewContact.Phone.Hidden.Text",A?.firstName||""),["emoji","simple_markdown"])}),(0,ne.Y)(es.A,{className:"dialog-checkbox",checked:T,tabIndex:0,onCheck:L,label:g("lng_new_contact_share")}),(0,ne.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__negative",children:(0,Mt.A)(g("AddContact.SharedContactExceptionInfo",A?.firstName))})]}),f&&(0,ne.FD)("div",{className:"NewContactModal__new-contact",dir:v.isRtl?"rtl":void 0,children:[(0,ne.Y)(Tt.A,{size:"jumbo",text:`${k} ${w}`}),(0,ne.FD)("div",{className:"NewContactModal__new-contact-fieldset",children:[(0,ne.Y)(ee.A,{ref:C,value:P,inputMode:"tel",label:g("lng_contact_phone"),tabIndex:0,onChange:_}),(0,ne.Y)(ee.A,{value:k,label:g("FirstName"),tabIndex:0,onChange:V}),(0,ne.Y)(ee.A,{value:w,label:g("LastName"),tabIndex:0,onChange:U})]})]}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",disabled:!x,onClick:J,children:g("Done")}),(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:K,children:g("Cancel")})]})]})}));var Ys=i(20179),Fs=i(48894),Ds=i(32625);let Ms=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 Ts={top:Ms.Top,bottom:Ms.Bottom,left:Ms.Left,right:Ms.Right,topLeft:Ms.TopLeft,topRight:Ms.TopRight,bottomLeft:Ms.BottomLeft,bottomRight:Ms.BottomRight},Bs=Object.keys(Ts);let Ls;const xs={x:0,y:0};const Rs=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.nTw)(e).webApps,{botId:i}=(0,c.ES7)(e)||{},{modalState:n,openedWebApps:s}=t||{},o="minimized"===n;return{activeTabBot:i?(0,c.mBe)(e,i):void 0,isMinimizedState:o,openedWebApps:s}})(({activeTabBot:e,isMinimizedState:t,openedWebApps:i})=>{const{changeWebAppModalState:o,closeWebAppModal:a}=(0,s.ko)(),r=(0,B.A)(),l=(0,Bi.A)(),d=(0,n.li)(),h=(0,n.Kr)(()=>i&&Object.values(i),[i]),u=h?.length,m=(0,n.Kr)(()=>{if(!u)return[];const t=(0,s.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,T.A)(()=>{a()}),g=(0,T.A)(()=>{o({state:"maximized"})});if(t)return(0,ne.FD)("div",{ref:d,className:(0,ve.A)("kUZmBlnN"),children:[(0,ne.Y)(X.A,{className:"SMRJmUuE",round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:"P0P4gW6a",ariaLabel:r("Close"),onClick:p}),(0,ne.Y)(Xi.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,ne.Y)("div",{className:"TZFjRaG4",children:t})}(),(0,ne.Y)(X.A,{className:(0,ve.A)("Rax9j_TK","no-drag"),round:!0,color:"translucent",size:"tiny",iconName:"expand-modal",iconClassName:"sdbTXCxq",onClick:g})]})}));var Es=i(14242),Vs=i(59852),_s=i(84991);const Us={container:"RFg0Ey2I","user-count-badge":"UZtJ6ZXb",userCountBadge:"UZtJ6ZXb","user-badge-icon":"pTiZFhsG",userBadgeIcon:"pTiZFhsG",name:"TzA5nqCC"},Os=(0,n.ph)((0,s.EK)((e,{chatId:t})=>({user:(0,c.mBe)(e,t)}))(function({user:e,isPopularApp:t}){const{requestMainWebView:i}=(0,s.ko)(),n=(0,Bi.A)(),o=(0,T.A)(()=>{if(!e)return;const t=e?.id;if(!t)return;const n=(0,Vs.A)();i({botId:t,peerId:t,theme:n})});if(!e)return;const a=e?.firstName,r=e?.botActiveUsers,l=r&&t?(0,Es.Vw)(n,r):void 0;return(0,ne.Y)("div",{className:Us.container,onClick:o,children:(0,ne.Y)(_s.A,{className:(0,ve.A)(Us.avatarContainer,t&&"PopularAppGridItem"),textClassName:Us.name,badgeClassName:Us.userCountBadge,badgeIconClassName:Us.userBadgeIcon,peer:e,text:a,badgeText:l,badgeIcon:"user-filled"})})})),Ks={root:"BJV09FsC",search:"bdi8G7GR","section-title":"ex3kxgWX",sectionTitle:"ex3kxgWX","section-content":"uIZzLhEh",sectionContent:"uIZzLhEh",showMoreLink:"h_Zs9ypA"},Js=(0,Ce.nF)(e=>e(),500,!0),js=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topPeerCategories.botsApp?.peerIds}})(({foundIds:e,recentBotIds:t})=>{const i=(0,B.A)(),a=(0,Bi.A)(),[r,l]=(0,n.J0)(!1),{searchPopularBotApps:c}=(0,s.ko)(),d=(0,T.A)(()=>{l(e=>!e)}),[h,u]=(0,n.J0)(""),m=(0,n.Kr)(()=>e?(0,Dt.PU)({ids:e,query:h,type:"user"}):[],[e,h]),p=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&Js(()=>{c()})},[]),g=(0,n.hb)(()=>{u("")},[]);return(0,ne.FD)(mn.A,{className:(0,ve.A)(Ks.root,"custom-scroll"),items:m,onLoadMore:p,itemSelector:".PopularAppGridItem",noFastList:!0,preloadBackwards:30,children:[(0,ne.Y)(gn.A,{className:Ks.search,value:h,onChange:u,onReset:g,placeholder:a("SearchApps")}),t&&!h&&(0,ne.FD)("div",{className:Ks.section,children:[(0,ne.FD)("div",{className:Ks.sectionTitle,children:[(0,ne.Y)("span",{children:i("SearchAppsMine")}),(0,ne.Y)("span",{className:Ks.showMoreLink,onClick:d,children:i(r?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")})]}),(0,ne.Y)("div",{className:Ks.sectionContent,children:t.map((e,t)=>{if(r||!(t>=5))return(0,ne.Y)(Os,{chatId:e})})})]}),(0,ne.FD)("div",{className:Ks.section,children:[(0,ne.Y)("div",{className:Ks.sectionTitle,children:a(h?"Apps":"PopularApps")}),(0,ne.Y)("div",{className:Ks.sectionContent,children:m&&m.map(e=>(0,ne.Y)(Os,{chatId:e,isPopularApp:!h}))})]})]})}));var Gs=i(4875),Hs=i(85679);const zs=3.675*v.$,$s="jEAibDyh",qs="ablUg8HU",Ws="Wrl63uWL",Qs="vOFiAq3l",Zs="KwI4XdkC",Xs="oq6HKJur",eo="a0AI_he5",to="MvCwTbk_",io=250,no=["allow-scripts","allow-popups","allow-forms","allow-modals","allow-same-origin","allow-storage-access-by-user-activation"].join(" "),so={ok:"OK",cancel:"Cancel",close:"Close"},oo=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:n}=i||{},s=t?.modalState,{verifyAgeMin:o,verifyAgeBotUsername:a}=e.appConfig,r=n?e.attachMenu.bots[n]:void 0,l=n?(0,c.mBe)(e,n):void 0,d=n?(0,c.vGo)(e,n):void 0,h=d?.botInfo?.appSettings,u=e.currentUserId?(0,c.mBe)(e,e.currentUserId):void 0,m=(0,c.SJA)(e),{isPaymentModalOpen:p,status:g}=(0,c.nTw)(e).payment,{status:v,inputInvoice:A}=(0,c.nTw)(e).starsPayment,f=l?(0,c.XOs)(e,l.id):void 0,C=v||g;return{attachBot:r,bot:l,currentUser:u,theme:m,isPaymentModalOpen:p||Boolean(A),paymentStatus:C,modalState:s,botAppPermissions:f,botAppSettings:h,verifyAgeMin:o,verifyAgeBotUsername:a}})(({modal:e,webApp:t,bot:i,theme:o,isPaymentModalOpen:r,paymentStatus:c,isTransforming:d,modalState:h,isMultiTabSupported:m,botAppPermissions:p,botAppSettings:g,modalHeight:A,verifyAgeMin:f=a.lYi,verifyAgeBotUsername:C,registerSendEventCallback:b,registerReloadFrameCallback:y,onContextMenuButtonClick:S})=>{const{closeActiveWebApp:k,sendWebViewData:N,toggleAttachBot:w,openTelegramLink:I,setWebAppPaymentSlug:P,switchBotInline:M,sharePhoneWithBot:L,updateWebApp:x,resetPaymentStatus:R,openChatWithInfo:E,showNotification:V,openEmojiStatusAccessModal:_,openLocationAccessModal:U,changeWebAppModalState:O,closeWebAppModal:K,openPreparedInlineMessageModal:J,updateContentSettings:j}=(0,s.ko)(),[G,H]=(0,n.J0)(),[z,q]=(0,n.J0)(),[W,Q,Z]=(0,D.A)(!1),[ee,ie]=(0,n.J0)(),se=(0,Ii.A)(ee),[oe,re]=(0,n.J0)(!1),[le,ce]=(0,n.J0)(!1),[de,ue]=(0,n.J0)(),[me,pe]=(0,n.J0)(),[ge,Ae]=(0,n.J0)(),{unlockPopupsAt:fe,handlePopupOpened:Ce,handlePopupClosed:be}=function(){const[e,t]=(0,n.J0)(0),i=(0,n.li)(0),s=(0,n.li)(0),o=(0,T.A)(()=>{const e=Date.now();e-s.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&t(e+2e3)}),a=(0,T.A)(()=>{e<Date.now()&&(s.current=Date.now())});return{unlockPopupsAt:e,handlePopupOpened:o,handlePopupClosed:a}}(),ye=(0,n.li)(),Se=(0,n.li)(),ke=(0,n.li)(),Ne="fullScreen"===h,we="minimized"===h,Ye=(0,T.A)(()=>{setTimeout(()=>{O({state:"maximized"})},350)}),Fe=(0,n.li)();(0,n.vJ)(()=>{Fe.current=document.querySelector("#portals")},[]);const[,De,Me]=(0,Ie.Ay)(Fe,Ye),Te=e?.activeWebAppKey?e.openedWebApps[e.activeWebAppKey]:void 0,{appName:Be,backgroundColor:Le}=Te||{},{url:xe,buttonText:Re,isBackButtonVisible:Ee}=t||{},{placeholderPath:Ve}=g||{},_e=Boolean(t?.isCloseModalOpen),Ue=Boolean(t?.isRemoveModalOpen),Oe=t&&(0,Ys.rp)(t),Ke=Te&&(0,Ys.rp)(Te),Je=Te&&t&&Ke===Oe,Ge=u.H$,He=void 0!==p?.geolocation,ze=Boolean(p?.geolocation),$e=(0,T.A)(e=>{Oe&&x({key:Oe,update:e})}),qe=(0,n.Kr)(()=>(0,Vs.A)(),[o]);(0,n.vJ)(()=>{Ae(qe.secondary_bg_color)},[qe]);const We=qe.bg_color,[Qe,Ze]=(0,n.J0)(),Xe="light"===o?g?.backgroundColor:g?.backgroundDarkColor;(0,n.vJ)(()=>{$e({backgroundColor:Qe||Xe||We})},[We,Qe,Xe]);const et=qe.bg_color,[tt,it]=(0,n.J0)(),nt="light"===o?g?.headerColor:g?.headerDarkColor;(0,n.vJ)(()=>{$e({headerColor:tt||nt||et})},[et,tt,nt]);const st=(0,n.li)(),at=(0,B.A)(),rt=(0,Bi.A)(),lt=e?.isModalOpen||!1,ct=Boolean(Re),{reloadFrame:dt,sendEvent:ht,sendFullScreenChanged:ut,sendViewport:mt,sendSafeArea:pt,sendTheme:gt}=((e,t,i,o,a,r,c)=>{const{showNotification:d,setWebAppPaymentSlug:h,openInvoice:u,closeWebApp:m,openSuggestedStatusModal:p,updateWebApp:g}=(0,s.ko)(),v=(0,n.li)(!1),A=(0,n.li)(),f=(0,n.li)(!1),C=(0,n.li)(),b=(0,Pe.A)();(0,n.vJ)(()=>{if(!e.current||!t)return;const i=()=>{c?.()},n=e.current;return n.addEventListener("load",i),()=>{n.removeEventListener("load",i)}},[c,e,t]);const y=(0,n.hb)(t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")},[e]),S=(0,n.hb)(e=>{y({eventType:"fullscreen_changed",eventData:{is_fullscreen:e}})},[y]),k=(0,T.A)(t=>{if(!e.current)return;const i=e.current;i.src="about:blank",i.addEventListener("load",()=>{i.src=t},{once:!0})}),N=(0,n.hb)(e=>{if(v.current)return y({eventType:"reload_iframe"}),void(A.current=setTimeout(()=>{k(e)},500));k(e)},[y]),w=(0,n.hb)(t=>{if(!e.current)return;const{width:i,height:n}=e.current.getBoundingClientRect();y({eventType:"viewport_changed",eventData:{width:i,height:n,is_expanded:!0,is_state_stable:!t}})},[y,e]),I=(0,n.hb)(()=>{e.current&&(y({eventType:"safe_area_changed",eventData:{left:0,right:0,top:0,bottom:0}}),y({eventType:"content_safe_area_changed",eventData:{left:0,right:0,top:i?zs:0,bottom:0}}))},[y,i,e]),P=(0,n.hb)(()=>{y({eventType:"theme_changed",eventData:{theme_params:(0,Vs.A)()}})},[y]),Y=(0,n.hb)(e=>{y({eventType:"set_custom_style",eventData:e})},[y]),F=(0,n.hb)(t=>{if(!f.current&&(0,Hs.S)(t,e.current))try{const e=JSON.parse(t.data),{eventType:i,eventData:n}=e;if("web_app_ready"===i&&c?.(),"web_app_close"===i&&r){const e=(0,l.rp)(r);m({key:e,skipClosingConfirmation:!0})}if("web_app_request_viewport"===i&&w(b.isResizing),"web_app_request_safe_area"===i&&I(),"web_app_request_content_safe_area"===i&&I(),"web_app_request_theme"===i&&P(),"iframe_ready"===i){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");Y("* {\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)),v.current=Boolean(n.reload_supported)}if("iframe_will_reload"===i&&clearTimeout(A.current),"web_app_data_send"===i){if(!o)return;f.current=!0}if("web_app_open_scan_qr_popup"===i&&d({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===i&&(h({slug:n.slug}),u({type:"slug",slug:n.slug})),"web_app_open_link"===i){if(!(0,as.v5)(n.url,(0,s.mS)().appConfig.webAppAllowedProtocols))return;window.open(n.url,"_blank","noopener,noreferrer")}if("web_app_biometry_get_info"===i&&y({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}=n;y({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}=n;y({eventType:"secure_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_start_accelerometer"===i&&y({eventType:"accelerometer_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_gyroscope"===i&&y({eventType:"gyroscope_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_device_orientation"===i&&y({eventType:"device_orientation_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_add_to_home_screen"===i&&y({eventType:"home_screen_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_check_home_screen"===i&&y({eventType:"home_screen_checked",eventData:{status:"unsupported"}}),"web_app_set_emoji_status"===i){const{custom_emoji_id:e,duration:t}=n;if(!e||"string"!=typeof e)return void y({eventType:"emoji_status_failed",eventData:{error:"SUGGESTED_EMOJI_INVALID"}});if(t)try{BigInt(t)}catch(e){return void y({eventType:"emoji_status_failed",eventData:{error:"DURATION_INVALID"}})}if(!r)return void y({eventType:"emoji_status_failed",eventData:{error:"UNKNOWN_ERROR"}});p({webAppKey:(0,l.rp)(r),customEmojiId:e,duration:Number(t),botId:r.botId})}a(e)}catch(e){}},[o,y,a,Y,r,P,w,I,c,b.isResizing,e]);return(0,n.vJ)(()=>{const{width:e,height:t,isResizing:i}=b;C.current&&C.current.width===e&&C.current.height===t&&!C.current.isResizing||(C.current={width:e,height:t,isResizing:i},w(i))},[w,I,b]),(0,n.vJ)(()=>{r?.plannedEvents?.length&&(r.plannedEvents.forEach(e=>{y(e)}),g({key:(0,l.rp)(r),update:{plannedEvents:[]}}))},[y,r]),(0,n.vJ)(()=>(window.addEventListener("message",F),()=>window.removeEventListener("message",F)),[F,e]),(0,n.vJ)(()=>{t&&e.current?.contentWindow?(w(),I(),f.current=!1):C.current=void 0},[t,i,w,I,e]),{sendEvent:y,sendFullScreenChanged:S,reloadFrame:N,sendViewport:w,sendSafeArea:I,sendTheme:P}})(st,lt,Ne,ct,function(e){const{eventType:t,eventData:n}=e;if("web_app_request_fullscreen"===t&&((0,Y.cB)()?O({state:"fullScreen"}):ht({eventType:"fullscreen_failed",eventData:{error:"UNSUPPORTED"}})),"web_app_exit_fullscreen"===t&&Tt(),"web_app_open_tg_link"===t){O({state:"minimized"});const e=a.jsp+n.path_full;I({url:e,shouldIgnoreCache:n.force_request})}if("web_app_setup_back_button"===t&&$e({isBackButtonVisible:n.is_visible}),"web_app_setup_settings_button"===t&&$e({isSettingsButtonVisible:n.is_visible}),"web_app_set_background_color"===t){const e=At(n.color);e&&Ze(e)}if("web_app_set_header_color"===t){const e=At(n.color),t=n.color_key,i=t?qe[t]:void 0,s=e||i;s&&it(s)}if("web_app_set_bottom_bar_color"===t){const e=At(n.color);e&&Ae(e)}if("web_app_data_send"===t&&(k(),N({bot:i,buttonText:Re,data:n.data})),"web_app_setup_main_button"===t&&H(e=>{const t=At(n.color)||e?.color||qe.button_color,i=At(n.text_color)||e?.textColor||qe.button_text_color;return{isVisible:n.is_visible&&vt(n.text,n.icon_custom_emoji_id),isActive:n.is_active,text:n.text,color:t,textColor:i,isProgressVisible:n.is_progress_visible,iconCustomEmojiId:n.icon_custom_emoji_id,hasShineEffect:n.has_shine_effect}}),"web_app_setup_secondary_button"===t&&q(e=>{const t=At(n.color)||e?.color||qe.button_color,i=At(n.text_color)||e?.textColor||qe.button_text_color;return{isVisible:n.is_visible&&vt(n.text,n.icon_custom_emoji_id),isActive:n.is_active,text:n.text,color:t,textColor:i,isProgressVisible:n.is_progress_visible,iconCustomEmojiId:n.icon_custom_emoji_id,hasShineEffect:n.has_shine_effect,position:n.position}}),"web_app_setup_closing_behavior"===t&&$e({shouldConfirmClosing:n.need_confirmation}),"web_app_open_popup"===t){if(ee||!n.message.trim().length||!n.buttons?.length||n.buttons.length>3||oe||le||fe>Date.now())return void wt(void 0);ie(n),Ce()}if("web_app_switch_inline_query"===t){const e=n.chat_types?.map(l.Xj).filter(Boolean),t=!e?.length;M({botId:i.id,query:n.query,filter:e,isSamePeer:t}),k()}if("web_app_request_phone"===t){if(ee||le||fe>Date.now())return void Rt();re(!0),Ce()}if("web_app_request_write_access"===t){if(ee||oe||fe>Date.now())return void _t();!async function(){if(!i)return;const e=await(0,Gs.px)("fetchBotCanSendMessage",{bot:i});e&&ht({eventType:"write_access_requested",eventData:{status:"allowed"}}),ce(!e)}(),Ce()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:s}=n;!async function(e,t,n){const s=await(0,Gs.px)("invokeWebViewCustomMethod",{bot:i,customMethod:t,parameters:n});ht({eventType:"custom_method_invoked",eventData:{req_id:e,...s}})}(s,e,JSON.stringify(t))}if("web_app_request_file_download"===t){if(me||fe>Date.now())return void Vt();!async function(e,t){await(0,Gs.px)("checkBotDownloadFileParams",{bot:i,url:e,fileName:t})?(pe({url:e,fileName:t}),Ce()):ht({eventType:"file_download_requested",eventData:{status:"cancelled"}})}(n.url,n.file_name)}if("web_app_send_prepared_message"===t){if(!i||!Oe)return;const{id:e}=n;J({botId:i.id,messageId:e,webAppKey:Oe})}if("web_app_request_emoji_status_access"===t){if(!i)return;_({bot:i,webAppKey:Oe})}if("web_app_check_location"===t&&ht(Ge?{eventType:"location_checked",eventData:{available:!0,access_requested:He,access_granted:ze}}:{eventType:"location_checked",eventData:{available:!1}}),"web_app_request_location"===t&&(async()=>{if(!Ge)return It(),V({message:at("PermissionNoLocationPosition")}),void wt(void 0);if(!He)return void(i&&Oe?U({bot:i,webAppKey:Oe}):It());if(!ze)return void It();const e=await(0,u.Bu)(),{accessRequested:t,accessGranted:n,geolocation:s}=e;if(!n||!t||!s)return It(),V({message:at("PermissionNoLocationPosition")}),void wt(void 0);Pt(s)})(),"web_app_open_location_settings"===t&&jt(),"web_app_read_text_from_clipboard"===t&&ue(n.req_id),"web_app_verify_age"===t){if(!i?.usernames?.some(e=>e.username===C))return;const{passed:e}=n,t=f,s=n.age||0;e&&s>=t?(V({message:{key:"TitleAgeCheckSuccess"}}),j({isSensitiveEnabled:!0})):V({message:{key:"TitleAgeCheckFailed"}})}},t,Q);function vt(e,t){return Boolean(e?.trim().length||t)}function At(e){return e&&(0,Vs.To)(e)?e:void 0}(0,n.vJ)(()=>{Je&&b(ht)},[ht,b,Je]),(0,n.vJ)(()=>{Je&&y(dt)},[dt,y,Je]);const ft=W&&G?.isVisible&&vt(G.text,G.iconCustomEmojiId),Ct=W&&z?.isVisible&&vt(z.text,z.iconCustomEmojiId),bt=(0,T.A)(()=>{$e({isCloseModalOpen:!1})}),yt=(0,T.A)(()=>{$e({shouldConfirmClosing:!1,isCloseModalOpen:!1}),setTimeout(()=>{k()},400)}),St=(0,T.A)(()=>{$e({isRemoveModalOpen:!1})}),kt=(0,T.A)(()=>{ht({eventType:"main_button_pressed"})}),Nt=(0,T.A)(()=>{ht({eventType:"secondary_button_pressed"})}),wt=(0,T.A)(e=>{ie(void 0),be(),ht({eventType:"popup_closed",eventData:{button_id:e}})}),It=(0,T.A)(()=>{ht({eventType:"location_requested",eventData:{available:!1}})}),Pt=(0,T.A)(e=>{ht({eventType:"location_requested",eventData:{available:!0,latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,course:e.heading,speed:e.speed,horizontal_accuracy:e.accuracy,vertical_accuracy:e.altitudeAccuracy,course_accuracy:null,speed_accuracy:null}})}),Yt=(0,T.A)(()=>{wt()}),Ft=(0,T.A)(()=>{gt()});(0,$.A)(()=>{setTimeout(()=>{Ft()},400)},[o]);const Dt=(0,T.A)(()=>{!(0,Ie.j9)()&&Je&&De?.()}),Tt=(0,T.A)(()=>{(0,Ie.j9)()&&Je&&Me?.()}),Bt=(0,T.A)(e=>{Je&&ut(e)});(0,n.vJ)(()=>{Ne?(Dt(),Bt(!0)):(Tt(),Bt(!1))},[Ne]);const Lt=(0,T.A)(e=>{ht({eventType:"visibility_changed",eventData:{is_visible:e}})});(0,n.vJ)(()=>{W&&Lt(Boolean(Je))},[Je,W]),(0,F.A)(([e])=>{"minimized"===h&&Lt(!1),h&&"minimized"===e&&Lt(!0)},[h]),(0,$.A)(([e])=>{r!==e&&t?.slug&&!r&&c&&(ht({eventType:"invoice_closed",eventData:{slug:t.slug,status:c}}),P({slug:void 0}),R())},[r,c,ht,t?.slug]);const xt=(0,T.A)(()=>{w({botId:i.id,isEnabled:!1}),k()}),Rt=(0,T.A)(()=>{re(!1),be(),ht({eventType:"phone_requested",eventData:{status:"cancelled"}})}),Et=(0,T.A)(()=>{L({botId:i.id}),re(!1),be(),ht({eventType:"phone_requested",eventData:{status:"sent"}})}),Vt=(0,T.A)(e=>{e&&(pe(void 0),be()),ht({eventType:"file_download_requested",eventData:{status:"cancelled"}})}),_t=(0,T.A)(()=>{ht({eventType:"write_access_requested",eventData:{status:"cancelled"}}),ce(!1),be()}),Ut=(0,T.A)(async()=>{i&&(await(0,Gs.px)("allowBotSendMessages",{bot:i})?(ht({eventType:"write_access_requested",eventData:{status:"allowed"}}),ce(!1),be()):_t())}),Ot=(0,T.A)(()=>{de&&(ue(void 0),ht({eventType:"clipboard_text_received",eventData:{req_id:de,data:null}}))}),Kt=(0,T.A)(()=>{const e=de;e&&(ue(void 0),window.navigator.clipboard.readText().then(t=>{ht({eventType:"clipboard_text_received",eventData:{req_id:e,data:t}})}).catch(()=>{ht({eventType:"clipboard_text_received",eventData:{req_id:e,data:null}})}))}),Jt=(0,T.A)(()=>{me&&(pe(void 0),be(),(0,Yi.A)(me.url,me.fileName),ht({eventType:"file_download_requested",eventData:{status:"downloading"}}))});(0,n.vJ)(()=>{lt||(ie(void 0),re(!1),ce(!1),H(void 0),q(void 0),pe(void 0),ue(void 0),$e({isSettingsButtonVisible:!1,shouldConfirmClosing:!1,isBackButtonVisible:!1,isCloseModalOpen:!1,isRemoveModalOpen:!1}),Z())},[lt]);const jt=(0,T.A)(()=>{E({id:i.id})}),Gt=(0,Ii.A)(G?.color,!0),Ht=(0,Ii.A)(G?.textColor,!0),zt=(0,Ii.A)(G&&Boolean(G.isActive),!0),$t=(0,Ii.A)(G?.text,!0),qt=(0,Ii.A)(z?.position,!0),Wt=(0,Ii.A)(z?.color,!0),Qt=(0,Ii.A)(z?.textColor,!0),Zt=(0,Ii.A)(z&&Boolean(z.isActive),!0),Xt=(0,Ii.A)(z?.text,!0),[ei,ti]=(0,n.J0)(!1),[ii,ni]=(0,n.J0)(!0),[si,oi]=(0,n.J0)(!0),[ai,ri]=(0,n.J0)(!1),[li,di]=(0,n.J0)(!1),[hi,ui]=(0,n.J0)(!1),[mi,pi]=(0,n.J0)(0);(0,$.A)(()=>{setTimeout(()=>{mt(),pt()},d?0:400)},[li,si,ai,ai,z?.position,mt,d,A,pt]);const gi="top"===qt||"bottom"===qt,vi=gi&&ai&&li?2:ai||li?1:0,Ai=gi||ii||si?"vertical":"horizontal",fi=(0,n.li)(),Ci=(0,n.li)(),bi=(0,n.li)(),yi=(0,n.li)(),Si=(0,n.li)();(0,n.vJ)(()=>(Ne&<&&Boolean(Be)?(ui(!0),Si.current&&clearTimeout(Si.current),Si.current=setTimeout(()=>{ui(!1),Si.current=void 0},3800)):(ui(!1),Si.current&&(clearTimeout(Si.current),Si.current=void 0)),()=>{Si.current&&clearTimeout(Si.current)}),[Ne,lt,Be]),(0,n.vJ)(()=>{fi.current&&clearTimeout(fi.current),Ci.current&&clearTimeout(Ci.current),ft&&(Ci.current=setTimeout(()=>{ri(!0)},35),ni(!1),fi.current=setTimeout(()=>{ti(!0)},io)),ft||(ri(!1),fi.current=setTimeout(()=>{ni(!0)},io))},[ft]),(0,n.vJ)(()=>{bi.current&&clearTimeout(bi.current),yi.current&&clearTimeout(yi.current),Ct&&(yi.current=setTimeout(()=>{di(!0)},35),oi(!1),bi.current=setTimeout(()=>{ti(!0)},io)),Ct||(di(!1),bi.current=setTimeout(()=>{oi(!0)},io))},[Ct]),(0,n.vJ)(()=>{li||ai||ti(!1)},[ti,li,ai]);const ki=(0,ot.A)(`background-color: ${Le||"var(--color-background)"}`,d&&"pointer-events: none;"),Ni=(0,T.A)(()=>{Ee?ht({eventType:"back_button_pressed"}):(Tt(),ut(!1),O({state:"maximized"}),K())}),wi=(0,T.A)(()=>{Tt()}),Pi=(0,T.A)(e=>{S(e)}),Fi=(0,ve.A)("BvNtfigU",Ee&&"rC2wkMIk"),Di=hi?Be:at(Ee?"Back":"Close"),Mi=ke?.current;function Ti(e,t){const i=Boolean(e?.trim().length);if(!i&&!t)return;const n=i?(0,Mt.A)(e,["emoji"]):void 0;return t?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(hs.A,{className:(0,ve.A)("pZ2DXL9u",i&&"QnLFPcmj"),documentId:t,size:1.25*v.$,forceAlways:!0}),i&&(0,ne.Y)("span",{className:"qSs8qsW1",children:n})]}):n}return(0,n.vJ)(()=>{pi(ke?.current?.clientWidth||0)},[Di,Mi]),(0,ne.FD)("div",{ref:ye,className:(0,ve.A)("LeeJZdwH",!Je&&Qs,m&&"ESsGT5OD"),children:[Ne&&(0,Y.cB)()&&(0,ne.FD)("div",{className:"eYrhewMy",children:[(0,ne.FD)("div",{ref:Se,className:to,onClick:Ni,children:[(0,ne.Y)("div",{className:"JXsuZ01s",children:(0,ne.Y)("div",{className:Fi})}),(0,ne.Y)("span",{className:"dpZR3YT7",style:`width: ${mi}px;`,children:(0,ne.Y)(ae.Ay,{activeKey:hi?0:Ee?1:2,name:"slideFade",children:(0,ne.Y)("div",{ref:ke,className:"dWDprnWa",children:Di})})})]}),(0,ne.FD)("div",{className:"Tl4_05AQ",children:[(0,ne.Y)("div",{className:(0,ve.A)(to,"emOpAMBm"),tabIndex:0,role:"button","aria-label":rt("WebAppCollapse"),onClick:wi,children:(0,ne.Y)(he.A,{name:"down",className:eo})}),(0,ne.Y)("div",{className:(0,ve.A)(to,"z4C5VD5o"),tabIndex:0,role:"button","aria-haspopup":"menu","aria-label":rt("AriaMoreButton"),onClick:Pi,children:(0,ne.Y)(he.A,{name:"more",className:(0,ve.A)(eo,"T58ozRyW")})})]})]}),!we&&(Ve?(0,ne.Y)("svg",{className:(0,ve.A)($s,W&&Ws),viewBox:"0 0 512 512",children:(0,ne.Y)("path",{className:"Gx1BIECZ",d:Ve})}):function(){const e=(0,ve.A)($s,"Ig_t1R7i",W&&Ws);return(0,ne.FD)("div",{className:e,children:[(0,ne.Y)("div",{className:qs}),(0,ne.Y)("div",{className:qs}),(0,ne.Y)("div",{className:qs}),(0,ne.Y)("div",{className:qs})]})}()),(0,ne.Y)("iframe",{className:(0,ve.A)("OmY14FFl",ei&&"liDRl1xT",!W&&Ws),style:ki,src:xe,title:rt("AriaMiniApp",{bot:i?.firstName}),sandbox:no,allow:"camera; microphone; geolocation; clipboard-write;",allowFullScreen:!0,ref:st}),!we&&(0,ne.FD)("div",{style:`background-color: ${ge};`,className:(0,ve.A)("mR_hsBdT","left"===qt&&"ntESqwQ_","right"===qt&&"q6IUFEL0","top"===qt&&"gb4iHJ9H","bottom"===qt&&"R_bh3GF8","horizontal"===Ai&&"oYaRA7u4",1===vi&&"YfQO314y",2===vi&&"gUldkEoy"),children:[(0,ne.FD)(X.A,{className:(0,ve.A)("ypxiUCFQ",li&&!si&&Zs,si&&Qs),fluid:!0,style:`background-color: ${Wt}; color: ${Qt}`,disabled:!Zt&&!z?.isProgressVisible,nonInteractive:z?.isProgressVisible,isShiny:z?.hasShineEffect&&!z?.isProgressVisible,onClick:Nt,children:[!z?.isProgressVisible&&Ti(Xt,z?.iconCustomEmojiId),z?.isProgressVisible&&(0,ne.Y)(je.A,{className:Xs,color:"blue"})]}),(0,ne.FD)(X.A,{className:(0,ve.A)("U_ggDKn1",ai&&!ii&&Zs,ii&&Qs),fluid:!0,style:`background-color: ${Gt}; color: ${Ht}`,disabled:!zt&&!G?.isProgressVisible,nonInteractive:G?.isProgressVisible,isShiny:G?.hasShineEffect&&!G?.isProgressVisible,onClick:kt,children:[!G?.isProgressVisible&&Ti($t,G?.iconCustomEmojiId),G?.isProgressVisible&&(0,ne.Y)(je.A,{className:Xs,color:"white"})]})]}),(0,ne.FD)(te.A,{isOpen:Boolean(ee),title:se?.title||" ",className:(0,ve.A)("YEOURXza",!se?.title?.trim().length&&"gvljUzY9"),hasCloseButton:!0,onClose:Yt,children:[se?.message,(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:se?.buttons.map(e=>(0,ne.Y)(X.A,{className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,onClick:()=>wt(e.id),children:e.text||at(so[e.type])},e.id||e.type))})]}),(0,ne.Y)(ci.A,{isOpen:oe,onClose:Rt,title:rt("ShareYouPhoneNumberTitle"),textParts:rt("AreYouSureShareMyContactInfoBot",void 0,{withNodes:!0,withMarkdown:!0,renderTextFilters:["br"]}),confirmHandler:Et,confirmLabel:rt("ContactShare")}),(0,ne.Y)(ci.A,{isOpen:le,onClose:_t,title:at("lng_bot_allow_write_title"),text:at("lng_bot_allow_write"),confirmHandler:Ut,confirmLabel:at("lng_bot_allow_write_confirm")}),(0,ne.Y)(ci.A,{isOpen:Boolean(me),title:rt("BotDownloadFileTitle"),textParts:rt("BotDownloadFileDescription",{bot:i?.firstName,filename:me?.fileName},{withNodes:!0,withMarkdown:!0}),confirmLabel:rt("BotDownloadFileButton"),onClose:Vt,confirmHandler:Jt}),(0,ne.Y)(ci.A,{isOpen:_e,onClose:bt,title:at("lng_bot_close_warning_title"),text:at("lng_bot_close_warning"),confirmHandler:yt,confirmIsDestructive:!0,confirmLabel:at("lng_bot_close_warning_sure")}),(0,ne.Y)(ci.A,{isOpen:Ue,onClose:St,title:at("BotRemoveFromMenuTitle"),textParts:(0,Mt.A)(at("BotRemoveFromMenu",i?.firstName),["simple_markdown"]),confirmHandler:xt,confirmIsDestructive:!0}),(0,ne.Y)(ci.A,{isOpen:Boolean(de),title:rt("BotReadTextFromClipboardTitle"),text:rt("BotReadTextFromClipboardDescription",{bot:(0,l.Yg)(i)}),confirmLabel:rt("BotReadTextFromClipboardConfirm"),onClose:Ot,confirmHandler:Kt})]})})),ao="oHX2d8Or",ro="O4NxErFX",lo="dgdyQDsZ",co="xGefqS93",ho="f7EicoVH",uo="s6pBIYMI",mo="txS0KiU0",po="XpHR_yo0",go="DoeOewUR",vo="YRMGpqUS",Ao="b13oE9uA",fo={width:300,height:40},Co={width:420,height:730},bo={width:300,height:300},yo=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:n}=i||{},s=n?e.attachMenu.bots[n]:void 0,o=n?(0,c.mBe)(e,n):void 0,a=(0,c.meB)(e),r=(0,c.SJA)(e),{miniAppsCachedPosition:l,miniAppsCachedSize:d}=(0,Rn.lS)(e);return{attachBot:s,bot:o,chat:a,theme:r,cachedPosition:l,cachedSize:d}})(({modal:e,chat:t,bot:i,attachBot:o,theme:r,cachedSize:l,cachedPosition:c})=>{const{closeActiveWebApp:d,closeWebAppModal:h,prolongWebView:u,toggleAttachBot:m,openChat:p,changeWebAppModalState:g,openWebAppTab:v,updateWebApp:A,openMoreAppsTab:f,closeMoreAppsTab:C,updateMiniAppCachedPosition:b,updateMiniAppCachedSize:y}=(0,s.ko)(),[S,k]=(0,n.Ul)(l||Co);function w(){return"fullScreen"===e?.modalState?N.A.get():"maximized"===e?.modalState?S():fo}const{openedWebApps:I,activeWebAppKey:P,openedOrderedKeys:F,sessionKeys:M,isMoreAppsTabActive:L}=e||{},x=P?I?.[P]:void 0,{isBackButtonVisible:R,headerColor:E,backgroundColor:V,isSettingsButtonVisible:_}=x||{},U=(0,n.Kr)(()=>F?.map(e=>{const t=I[e];return{bot:(0,s.mS)().users.byId[t.botId],webApp:t,isOpen:Boolean(x&&e===(0,Ys.rp)(x))}}),[F,I,x]),{isMobile:O}=(0,Y.Ay)(),K=e?.isModalOpen||!1,J="maximized"===e?.modalState,j="minimized"===e?.modalState,G="fullScreen"===e?.modalState,H=!O,z=(0,n.li)(),$=(0,n.li)(),q=(0,n.li)(),W=(0,T.A)(()=>z.current),Q=(0,T.A)(()=>z.current),Z=(0,T.A)(()=>q.current),{isContextMenuOpen:ee,contextMenuAnchor:ie,handleContextMenu:se,handleContextMenuClose:oe,handleContextMenuHide:ae}=(0,As.A)(z),[re,le]=(0,n.J0)(!1),ce=$.current,de=z.current;(0,n.vJ)(()=>{le(Boolean(H&&ce&&de&&!G))},[H,ce,de,G]),(0,n.vJ)(()=>{g({state:"maximized"})},[H]);const{isDragging:pe,isResizing:ge,style:fe,size:Ce,position:be}=function(e,t,i=!0,s,o=!1,r={width:0,height:0},l){const[c,d]=(0,n.J0)(l),[h,u]=(0,n.J0)(void 0),[m,p]=(0,n.Ul)({x:0,y:0}),[g,v]=(0,n.Ul)({width:0,height:0}),[A,f]=(0,n.Ul)({x:0,y:0}),C=m(),b=A(),y=e.current,S=t.current,[k,N]=(0,D.A)(!1),[w,I]=(0,D.A)(!1),[P,Y,F]=(0,D.A)(!1),[M,B,L]=(0,D.A)(!1),[x,R,E]=(0,D.A)(!1),[V,_]=(0,n.J0)(void 0);function U(){return{width:window.innerWidth,height:window.innerHeight}}const O=(0,T.A)(e=>{o||d({x:e.x,y:e.y})}),K=(0,T.A)(()=>o?xs:c),J=(0,T.A)(()=>{if(!h)return;const{width:e,height:t}=h,i=U();return{x:(i.width-e)/2,y:(i.height-t)/2}});(0,n.vJ)(()=>{y&&I()},[y]),(0,n.vJ)(()=>{if(!k&&h){const e=J();if(!e)return;O(e),N()}},[h,k,y]);const j=(0,T.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;if(e.target.closest(".no-drag")||!y)return;const{x:t,y:i}=(0,He.A)(e),{left:n,top:s}=y.getBoundingClientRect();p({x:n,y:s}),f({x:t,y:i}),Y()}),G=(0,T.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(a.cnh))for(const e of Bs)if(t(`.${e}`))return Ts[e]}(t);if(void 0===i)return;_(i);const{x:n,y:s}=(0,He.A)(e),{left:o,right:r,top:l,bottom:c}=y.getBoundingClientRect();p({x:o,y:l}),v({width:r-o,height:c-l}),f({x:n,y:s}),B()}),H=(0,T.A)(()=>{F()}),z=(0,T.A)(()=>{L()});(0,n.vJ)(()=>{i||F()},[i]);const $=(e,t)=>{const i=U(),n=i.width,s=i.height,o=h.width,a=h.height;let r=e,l=t;return r<0&&(r=0),l<0&&(l=0),r+o>n&&(r=n-o),l+a>s&&(l=s-a),{x:r,y:l}},q=(0,T.A)(()=>{if(o)return;const e=w||l?c:J();if(!h||!e)return;const t=$(e.x,e.y);O(t)}),W=(0,T.A)(e=>{const t=e,i=U(),n=s.width,o=s.height;return t.width=Math.min(i.width,Math.max(n,t.width)),t.height=Math.min(i.height,Math.max(o,t.height)),t});(0,n.vJ)(()=>{if(M)return;const e=W({width:s.width,height:s.height});e&&u(e)},[s,M]);const Q=(0,T.A)(()=>{if(!h||M)return;const e=W(h);e&&u(e)});(0,n.vJ)(()=>{M||q()},[h,M]),(0,n.vJ)(()=>{const e=()=>{R(),Q(),q(),Ls&&(clearTimeout(Ls),Ls=void 0),Ls=window.setTimeout(()=>{Ls=void 0,E()},250)};return window.addEventListener("resize",e),()=>{clearTimeout(Ls),Ls=void 0,window.removeEventListener("resize",e)}},[q]);const Z=(0,T.A)(e=>{if(!P||!y)return;const{x:t,y:i}=(0,He.A)(e),n=t-b.x,s=i-b.y,o=C.x+n,a=C.y+s;h&&d($(o,a))}),X=(0,T.A)(e=>{if(!M||!y||void 0===V)return;const{x:t,y:i}=(0,He.A)(e),n=g(),s=Math.min(Math.max(0,t),U().width),o=Math.min(Math.max(0,i),U().height),a=s-b.x,l=o-b.y,c=C.x+n.width-r.width,h=C.y+n.height-r.height,m={x:C.x,y:C.y,width:n.width,height:n.height};V!==Ms.Left&&V!==Ms.TopLeft&&V!==Ms.BottomLeft||(m.width=Math.max(n.width-a,r.width),m.x=Math.min(m.x+a,c)),V!==Ms.Right&&V!==Ms.TopRight&&V!==Ms.BottomRight||(m.width=Math.max(n.width+a,r.width)),V!==Ms.Top&&V!==Ms.TopLeft&&V!==Ms.TopRight||(m.height=Math.max(n.height-l,r.height),m.y=Math.min(m.y+l,h)),V!==Ms.Bottom&&V!==Ms.BottomLeft&&V!==Ms.BottomRight||(m.height=Math.max(n.height+l,r.height)),u({width:m.width,height:m.height}),d({x:m.x,y:m.y})});(0,n.vJ)(()=>{let e;return S&&i&&(e=(0,Ae.wJ)(S,{onCapture:j,onDrag:Z,onRelease:H,onClick:H,onDoubleClick:H})),e},[i,S]),(0,n.vJ)(()=>{const e=[];if(y&&i)for(const t of Bs){const i=y.querySelector(`.resizeHandle.${t}`);if(i){const t=(0,Ae.wJ)(i,{onCapture:G,onDrag:X,onRelease:z,onClick:z,onDoubleClick:z});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,ot.A)(`left: ${te.x}px;`,`top: ${te.y}px;`,!o&&`max-width: ${h.width}px;`,!o&&`max-height: ${h.height}px;`,"position: fixed;",(P||M||x)&&"transition: none !important;",ee);return{position:c,size:h,isDragging:P,isResizing:M,style:ie}}(z,$,re,w(),G,function(){if("maximized"===e?.modalState)return bo}(),c),ye=be?.x,Se=be?.y;(0,n.vJ)(()=>{pe||void 0===ye||void 0===Se||b({position:{x:ye,y:Se}})},[pe,ye,Se]),(0,n.vJ)(()=>{!pe&&Ce&&J&&y({size:Ce})},[pe,J,Ce]);const ke=Ce||w(),Ne=ke.width,we=ke.height;(0,n.vJ)(()=>{ge&&k({width:Ne,height:we})},[we,Ne,ge,k]);const Ie=(0,B.A)(),Pe=(0,Bi.A)(),{queryId:Ye}=x||{},Fe=I?Object.values(I).length:0;(0,Ds.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,n.li)(null),Me=(0,n.li)(null),Te=(0,T.A)(e=>{De.current=e}),Be=(0,T.A)(e=>{De.current&&De.current(e)}),Le=(0,T.A)(e=>{Me.current=e}),xe=(0,T.A)(e=>{Me.current&&Me.current(e)}),Re=(0,T.A)(()=>{Be({eventType:"settings_button_pressed"})}),Ee=(0,T.A)(()=>{xe(x.url)}),Ve=(0,T.A)(()=>{h()}),_e=(0,T.A)(()=>{C()}),Ue=(0,T.A)(()=>{Fe>1?d():h()}),Oe=(0,T.A)(()=>{if(o){const e=(0,Ys.rp)(x);return void A({key:e,update:{isRemoveModalOpen:!0}})}m({botId:i.id,isEnabled:!0})}),Ke=(0,T.A)(()=>{R?Be({eventType:"back_button_pressed"}):Ve()}),Je=(0,T.A)(()=>{g({state:"minimized"})}),je=(0,T.A)(()=>{g({state:"fullScreen"})}),Ge=(0,T.A)(()=>{f()}),ze=(0,T.A)(e=>{v({webApp:e.webApp})}),$e=(0,T.A)(()=>{p({id:i.id})}),qe=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{className:(0,ve.A)(H?"gkji2_RB":"kKPD09tc",t&&"active"),round:!0,ripple:!O,size:H?"tiny":"smaller",color:"translucent",onClick:e,ariaLabel:"More actions",iconName:"more"}),[O,H]);function We(){return(0,ne.FD)(ne.FK,{children:[t&&i&&t.id!==i.id&&(0,ne.Y)(me.A,{icon:"bots",onClick:$e,children:Ie("BotWebViewOpenBot")}),(0,ne.Y)(me.A,{icon:"reload",onClick:Ee,children:Ie("WebApp.ReloadPage")}),_&&(0,ne.Y)(me.A,{icon:"settings",onClick:Re,children:Ie("Settings")}),i?.isAttachBot&&(0,ne.Y)(me.A,{icon:o?"stop":"install",onClick:Oe,destructive:Boolean(o),children:Ie(o?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")})]})}function Qe(){return(0,ne.Y)(it.A,{isOpen:ee,anchor:ie,ref:q,className:(0,ve.A)(H?mo:"web-app-more-menu","with-menu-transitions"),getTriggerElement:W,getMenuElement:Z,getRootElement:Q,autoClose:!0,onClose:oe,onCloseAnimationEnd:ae,children:We()})}const Ze=(0,ve.A)("RuJ3d9N6",R&&"IWA50OWU"),Xe=(0,n.Kr)(()=>{if(L)return"color-text";if(!E)return;const{r:e,g:t,b:i}=(0,Fs.hF)(E),n=(0,Fs.LS)([e,t,i]);return("dark"===r?255-n:n)>128?"color-text":"color-background"},[E,r,L]);function et(e){return(0,ne.Y)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,ne.Y)("path",{className:"bOuMHiVw","fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 16V0C16 12 12 16 0 16H16Z"})})}const tt=(0,n.li)();function nt(e){return(0,ve.A)(a.jQ1,e)}return(0,Qn.A)(tt,!K||j||!tt.current),(0,ne.FD)(te.A,{dialogRef:z,className:(0,ve.A)("XWfkIDLY",H&&"gBVR7Hec",j&&"dJ1Ld_PX",G&&"ciSTWz16"),dialogClassName:"mini-app-modal-dialog",dialogStyle:H?fe:void 0,dialogContent:re&&!j?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:nt("top")}),(0,ne.Y)("div",{className:nt("bottom")}),(0,ne.Y)("div",{className:nt("left")}),(0,ne.Y)("div",{className:nt("right")}),(0,ne.Y)("div",{className:nt("topLeft")}),(0,ne.Y)("div",{className:nt("topRight")}),(0,ne.Y)("div",{className:nt("bottomLeft")}),(0,ne.Y)("div",{className:nt("bottomRight")})]}):void 0,isOpen:K,isLowStackPriority:!0,onClose:Ve,header:(0,ne.Y)("div",{ref:$,children:H?J?(0,ne.FD)("div",{className:(0,ve.A)("modal-header","multiTab"),style:(0,ot.A)(Xe&&`--color-header-text: var(--${Xe})`),children:[(0,ne.Y)(X.A,{className:"GE5AkJOU",round:!0,color:"translucent",size:"tiny",ariaLabel:Ie(R?"Back":"Close"),onClick:Ke,children:(0,ne.Y)("div",{className:Ze})}),(0,ne.FD)("div",{className:"X18WbDa5",ref:tt,children:[U?.map(e=>e.isOpen?function(){const e=(0,ot.A)(Xe&&`--color-header-text: var(--${Xe})`,E&&`--active-tab-background: ${E}`);return(0,ne.FD)("div",{className:ao,style:e,children:[et(ho),(0,ne.FD)("div",{className:ro,children:[(0,ne.FD)("div",{className:"z39ojrWc",children:[(0,ne.Y)(Tt.A,{size:"mini",peer:i}),(0,ne.Y)(qe,{onTrigger:se,isOpen:ee})]}),o?.shortName??i?.firstName,(0,ne.Y)("div",{className:lo}),(0,ne.Y)(X.A,{className:co,round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:go,ariaLabel:Ie("Close"),onClick:Ue})]}),et(uo)]})}():(0,ne.Y)(Tt.A,{className:"tI6TE6HP",size:"mini",peer:e.bot,onClick:()=>ze(e)})),L&&(0,ne.FD)("div",{className:ao,children:[et(ho),(0,ne.FD)("div",{className:ro,children:[(0,ne.Y)("div",{className:"Obu3ui67",children:(0,ne.Y)(he.A,{className:Ao,name:"add"})}),Pe("OpenApp"),(0,ne.Y)("div",{className:lo}),(0,ne.Y)(X.A,{className:co,round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:go,ariaLabel:Ie("Close"),onClick:_e})]}),et(uo)]})]}),Qe(),(0,ne.FD)("div",{className:"qK4q0Sat",children:[!L&&(0,ne.Y)(X.A,{className:(0,ve.A)("cEuW1_hJ","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:Ge,iconName:"add",iconClassName:Ao}),!L&&(0,ne.Y)(X.A,{className:(0,ve.A)(po,"otlJULGy","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:je,iconName:"expand-modal",iconClassName:vo}),(0,ne.Y)(X.A,{className:(0,ve.A)(po,"no-drag"),round:!0,color:"translucent",size:"tiny",onClick:Je,iconClassName:vo,iconName:"collapse-modal"})]})]}):(0,ne.Y)(Rs,{}):(0,ne.FD)("div",{className:"modal-header",style:(0,ot.A)(E&&`background-color: ${E}`,Xe&&`--color-header-text: var(--${Xe})`),children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:Ie(R?"Back":"Close"),onClick:Ke,children:(0,ne.Y)("div",{className:Ze})}),(0,ne.Y)("div",{className:"modal-title",children:o?.shortName??i?.firstName}),!L&&(0,ne.Y)(ue.A,{className:(0,ve.A)(H?mo:"web-app-more-menu","with-menu-transitions"),trigger:qe,positionX:H?"left":"right",children:We()})]})}),style:`background-color: ${V||"var(--color-background)"}`,noBackdrop:!0,noBackdropClose:!0,children:[G&&Qe(),I&&M?.map(t=>(0,ne.Y)(oo,{modal:e,registerSendEventCallback:Te,registerReloadFrameCallback:Le,webApp:I[t],isTransforming:pe||ge,onContextMenuButtonClick:se,isMultiTabSupported:H,modalHeight:we},t)),L&&(0,ne.Y)(js,{})]})})),So=(0,n.ph)(({bot:e,type:t,shouldRequestWriteAccess:i})=>{const{cancelBotTrustRequest:o,markBotTrusted:a}=(0,s.ko)(),[r,c]=(0,n.J0)(i||!1),d=(0,B.A)(),h=(0,n.hb)(()=>{a({botId:e.id,isWriteAllowed:r})},[a,r,e]),u=(0,n.hb)(()=>{o()},[]),m=d("game"===t?"AppName":"BotOpenPageTitle"),p=(0,n.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,ne.FD)(ci.A,{isOpen:Boolean(e),onClose:u,title:m,confirmHandler:h,children:[(0,Mt.A)(p,["simple_markdown"]),i&&(0,ne.Y)(es.A,{className:"dialog-checkbox",checked:r,label:(0,Mt.A)(d("WebApp.AddToAttachmentAllowMessages",e?.firstName),["simple_markdown"]),onCheck:c})]})}),ko=(0,n.ph)(({modal:e})=>{const{confirmAttachBotInstall:t,cancelAttachBotInstall:i}=(0,s.ko)(),o=e?.bot,[r,l]=(0,n.J0)(!1),c=(0,B.A)(),d=(0,n.hb)(()=>{t({isWriteAllowed:Boolean(o?.shouldRequestWriteAccess)})},[t,o]);(0,n.vJ)(()=>{o&&l(!1)},[o]);const h=(0,n.Kr)(()=>{const e=c("lng_mini_apps_disclaimer_button").split("{link}"),t=c("lng_mini_apps_disclaimer_link");return[e[0],(0,ne.Y)("a",{href:a.Pje,target:"_blank",rel:"noopener noreferrer",children:t}),e[1]]},[c]);return(0,ne.FD)(ci.A,{isOpen:Boolean(o),onClose:i,title:c("lng_mini_apps_disclaimer_title"),confirmHandler:d,isConfirmDisabled:!r,children:[(0,Mt.A)(c("lng_mini_apps_disclaimer_text",o?.shortName),["simple_markdown"]),(0,ne.Y)(es.A,{className:"dialog-checkbox",checked:r,label:h,onCheck:l}),(0,Mt.A)(c("WebBot.Account.Desclaimer.Desc",o?.shortName),["simple_markdown"])]})}),No=(0,n.ph)(({folder:e})=>{const{closeDeleteChatFolderModal:t,deleteChatFolder:i,openDeleteChatFolderModal:o}=(0,s.ko)(),a=(0,B.A)(),r=Boolean(e),l=(0,K.A)(e)||e,c=l?.hasMyInvites,d=(0,n.hb)(()=>{t(),c?o({folderId:l.id,isConfirmedForChatlist:!0}):i({id:l.id})},[c,l]);return(0,ne.Y)(ci.A,{isOpen:r,onClose:t,text:a(c?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:a("Delete"),confirmHandler:d,confirmIsDestructive:!0})});var wo=i(17142),Io=i(66833),Po=i(526);const Yo={root:"Wn7D2H1e",text:"IQ1U2TrZ",header:"F6qqXRvD",description:"ILLaH6qQ",icon:"DzGwbpu5","font-icon":"Pa9h5mh3",fontIcon:"Pa9h5mh3"},Fo=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(Fs.hF),Do=(0,n.ph)(({icon:e,isFontIcon:t,title:i,text:n,index:s,count:o,section:a,onClick:r})=>{const l=s/o*Fo.length,c=Fo[Math.floor(l)],d=Fo[Math.ceil(l)]??c,{r:h,g:u,b:m}=(0,Fs.R5)(c,d,.5),p=(0,T.A)(()=>{r?.(a)});return(0,ne.FD)(ui.A,{buttonClassName:Yo.root,onClick:p,inactive:!r,children:[t?(0,ne.Y)(he.A,{name:e,className:Yo.fontIcon,style:`--item-color: rgb(${h},${u},${m})`}):(0,ne.Y)("img",{src:e,className:Yo.icon,alt:"",style:`--item-color: rgb(${h},${u},${m})`,draggable:!1}),(0,ne.FD)("div",{className:Yo.text,children:[(0,ne.Y)("div",{className:Yo.title,children:(0,Mt.A)(i,["br"])}),(0,ne.Y)("div",{className:Yo.description,children:n})]})]})});var Mo=i(57446);const To="cqNhvdib",Bo="wDzTWXzO",Lo=(0,n.ph)(({length:e,active:t,onSelectSlide:i})=>{const s=Math.max(0,Math.min(e-8,t-4)),o=s===e-8-1,a=s===e-8,r=0===s,l=1===s,c=Math.min(e,8),d=(0,n.hb)(()=>{i(t+1)},[t,i]),h=(0,n.hb)(()=>{i(t-1)},[t,i]),m=Math.min(8,e);return(0,ne.FD)("div",{children:[!u.TF&&(0,ne.Y)(X.A,{className:(0,ve.A)(To,0===t&&Bo),color:"translucent",disabled:0===t,round:!0,onClick:h,iconName:"previous"}),(0,ne.Y)("div",{className:"HmY1pYD9",style:`--start-from: ${s}; --length: ${e}; --count: ${m};`,children:Array(e).fill(void 0).map((e,n)=>{const d=n,h=n===s+c-1&&!a&&!o,u=n===s+c-2&&!o&&!a||n===s+c-1&&o,m=n===s&&!r&&!l,p=n===s+1&&!r&&!l||n===s&&l,g=n<s||n>=s+c;return(0,ne.Y)("div",{onClick:()=>i(n),className:(0,ve.A)("Ac0pMX9w",d===t&&"NYDxCNdz",(u||p)&&"yDo_8Y7X",(h||m||g)&&"bhODNwmU",g&&"O9pyrgj0")})})}),!u.TF&&(0,ne.Y)(X.A,{className:(0,ve.A)(To,t===e-1&&Bo,"hIgQCprt"),color:"translucent",round:!0,disabled:t===e-1,onClick:d,iconName:"next"})]})}),xo="Hy5kWx0p",Ro=(0,n.ph)(({leftValue:e,rightValue:t,className:i,floatingBadgeIcon:n,rightStyle:s})=>{const o=(0,B.A)();return(0,ne.FD)("div",{className:(0,ve.A)("u84X0r2z",i),children:[n&&(0,ne.FD)("div",{className:"hPi4fICJ",children:[(0,ne.Y)(he.A,{name:n,className:"XkiOXdMP"}),(0,ne.Y)("div",{className:"iC3LJrvy",dir:o.isRtl?"rtl":void 0,children:e}),(0,ne.Y)("div",{className:"jufjjcX9",children:(0,ne.Y)("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none",children:(0,ne.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,ne.FD)("div",{className:(0,ve.A)(xo,"scGr4JS9"),children:[(0,ne.Y)("div",{className:"OejVAPj6 YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitFree")}),!n&&(0,ne.Y)("div",{className:"RJosx238 YaiSoFKE",children:e})]}),(0,ne.FD)("div",{className:(0,ve.A)(xo,"nPaUalQf"),style:s,children:[(0,ne.Y)("div",{className:"COQdFBQk YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitPremium")}),(0,ne.Y)("div",{className:"BEq3jFlz YaiSoFKE YaiSoFKE",children:t})]})]})}),Eo=[91,160,255],Vo=[197,100,243],_o=(0,n.ph)(({title:e,description:t,leftValue:i,rightValue:s,colorStepProgress:o})=>{const a=(0,n.Kr)(()=>Eo.map((e,t)=>(0,fe.Cc)(e,Vo[t],o)),[o]);return(0,ne.FD)("div",{className:"ZXp65Wgy",children:[(0,ne.Y)("div",{className:"W1xG3pjS",children:e}),(0,ne.Y)("div",{className:"b_CBXIkT",children:t}),(0,ne.Y)(Ro,{leftValue:i,rightValue:s,rightStyle:`background: rgb(${a.join(",")})`})]})});var Uo=i(40725),Oo=i(64489);const Ko=(0,n.ph)(()=>{const e=(0,Bi.A)(),t=(0,n.Kr)(()=>[["no-share",e("NoForwardingTitle"),e("NoForwardingDescription")],["no-download",e("NoSavingTitle"),e("NoSavingDescription")]],[e]);return(0,ne.FD)("div",{className:"ALLjgiIU",children:[(0,ne.Y)("div",{className:"YgV1fU9E",children:(0,ne.Y)(Oo.A,{size:100,tgsUrl:Uo.w.HandStop,previewUrl:Uo.d.HandStop,noLoop:!0})}),(0,ne.Y)("div",{className:"jbxddW_x",children:t.map(([e,t,i])=>(0,ne.FD)(ui.A,{isStatic:!0,multiline:!0,icon:e,className:"O0vha2cO",children:[(0,ne.Y)("span",{className:(0,ve.A)("title","Sg_dw4sv"),children:t}),(0,ne.Y)("span",{className:"subtitle",children:i})]}))})]})});var Jo=i(67054),jo=i(18104);const Go=({size:e,realIndex:t,canPlay:i,sticker:s,index:o,maxLength:a,onClick:r,onEnded:l})=>{const c=(0,q.A)(`sticker${s.id}`),d=(0,q.A)(`sticker${s.id}?size=f`),h=0===o,[u,m,p]=(0,D.A)(h),g=e-.6*e,v=3*g,A=3.2*g,f=o/a*(2*Math.PI),C=h?1:.66,b=Math.cos(f)*v-2.8*g,y=Math.sin(f)*A,S=(0,T.A)(()=>{r(t)}),k=(0,T.A)(()=>{p(),l(t)});return(0,n.vJ)(()=>{h&&m()},[h,m]),(0,ne.FD)(ne.FK,{children:[h&&(0,ne.Y)(jo.A,{className:"Stdz4UIW ogaoEAcn",tgsUrl:d,play:i,isLowPriority:!0,noLoop:!0,size:.8*e,style:`--x: calc(${b}px - 10%); --y: ${y}px;`}),(0,ne.Y)(jo.A,{className:"ogaoEAcn",tgsUrl:c,play:i&&u,noLoop:!0,size:.6*e,style:`--x: ${b}px; --y: ${y}px; --opacity: ${C}`,onClick:S,onEnded:k})]})},Ho=(0,n.ph)((0,s.EK)(e=>({stickers:e.stickers.premium.stickers}))(({stickers:e,isActive:t})=>{const i=(0,n.li)(),[s,o]=(0,n.J0)(0),[a,r]=(0,n.J0)(0),l=e?.slice(0,15),c=(0,T.A)(e=>{o(-e)}),d=(0,T.A)(e=>{0===(0,Jo.A)(l.length,e+s)&&setTimeout(()=>{o(e=>(0,Jo.A)(l.length,e+1))},150)});return(0,n.vJ)(()=>{const e=i.current;e&&r(e.closest(".modal-dialog").clientWidth)},[]),(0,ne.Y)("div",{className:"O1fqNCy0",ref:i,children:Boolean(a)&&l?.map((e,i)=>(0,ne.Y)(Go,{size:a,sticker:e,realIndex:i,index:(i+s+l.length)%l.length,maxLength:l.length,onClick:c,onEnded:d,canPlay:t}))})}));var zo=i(38691),$o=i(88554);const qo=["#A667FF","#55A5FF"],Wo={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"},Qo={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},Zo={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"},Xo=Object.keys(Wo),ea=.25*v.$,ta=Tt.R.giant+ea,ia=(0,n.ph)((0,s.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({currentUser:e})=>{const t=(0,n.li)(),i=(0,B.A)(),s=(0,zo.A)();(0,n.Nf)(()=>{t.current&&(0,$o.$)({canvas:t.current,size:ta,strokeWidth:ea,segmentsCount:8,colorStops:qo,readSegmentsCount:0,readSegmentColor:"transparent",dpr:s})},[s]);const{handleScroll:o,isAtBeginning:a}=(0,un.A)(),r=ta;return(0,ne.FD)("div",{className:"mFElmm7a",children:[(0,ne.FD)("div",{className:"Jjbochk6",children:[(0,ne.Y)(Tt.A,{forPremiumPromo:!0,peer:e,size:"giant"}),(0,ne.Y)("canvas",{className:"ChteQ9C3",ref:t,style:`max-width: ${r}px; max-height: ${r}px`})]}),(0,ne.Y)("div",{className:"d2ayix6L",children:i("UpgradedStories")}),(0,ne.FD)("div",{className:(0,ve.A)("ensyCeMe",!a&&"iN1T0a2Y","custom-scroll"),onScroll:o,children:[Xo.map((e,t)=>(0,ne.Y)(Do,{title:i(Wo[e]),text:i(Qo[e]),icon:Zo[e],isFontIcon:!0,index:t,count:Xo.length,section:e},e)),(0,ne.Y)("div",{className:"DFbZJafh",children:i("lng_premium_stories_about_mobile")})]})]})}));var na=i(83240);const sa="a7IoUtQG",oa="gubS9KP1",aa="iZLwcL8v",ra="A7YHY8qF",la={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",ai_compose:"PremiumPreviewAiTools",todo:"PremiumPreviewTodo",pm_noforwards:"PremiumPreviewNoForwards"},ca={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",ai_compose:"PremiumPreviewAiToolsDescription",todo:"PremiumPreviewTodoDescription",pm_noforwards:"PremiumPreviewNoForwardsDescription"},da={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle",recommendedChannels:"SimilarChannelsLimitTitle",moreAccounts:"ConnectedAccountsLimitTitle"},ha={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle",recommendedChannels:"SimilarChannelsLimitSubtitle",moreAccounts:"ConnectedAccountsLimitSubtitle"},ua=(0,n.ph)(({promo:e,initialSection:t,isPremium:i,limits:s,premiumPromoOrder:o,subscriptionOption:l,onBack:c,onClickSubscribe:d})=>{const h=(0,B.A)(),u=(0,Bi.A)(),m=(0,n.li)(),[p,g]=(0,n.J0)(a.O2i.indexOf(t)),[v,A]=(0,n.J0)(0),[f,C,b]=(0,D.A)(),[y,S]=(0,n.J0)(!0),[k,N]=(0,n.J0)(!1),w=(0,K.A)(t),I=(0,n.Kr)(()=>o?o.filter(e=>a.O2i.includes(e)):a.O2i,[o]),P=(0,n.Kr)(()=>{if(!l)return;const{amount:e,months:t,currency:n}=l,s=Math.floor(e/t);return i?u("OK"):u("SubscribeToPremium",{price:(0,wo.vv)(u,s,n)},{withNodes:!0})},[i,u,l]),Y=(0,T.A)(()=>{d(t)});function F(e){const{scrollTop:t,clientHeight:i,scrollHeight:n}=e.currentTarget;S(t<=20),N(t>=n-i-20)}(0,n.vJ)(()=>{const e=m.current;if(!e||w===t)return;const i=I.indexOf(t);g(i),C(),(0,Mo.A)(e,e.clientWidth*i,0).then(b)},[p,I,t,w]);const M=(0,T.A)(async e=>{const t=m.current;t&&(g(e),C(),await(0,Mo.A)(t,t.clientWidth*e,800),b())}),L=I[p],x="double_limits"!==L&&"stories"!==L&&"pm_noforwards"!==L;return(0,ne.FD)("div",{className:"oyUTEj8I",children:[(0,ne.Y)(X.A,{round:!0,size:"tiny",className:(0,ve.A)("njYoMrKM",x&&"SB4pczOo"),color:x?"translucent-white":"translucent",onClick:c,ariaLabel:h("Back"),iconName:"arrow-left"}),(0,ne.Y)("div",{className:"dIVBSdWi"}),(0,ne.Y)("div",{className:(0,ve.A)("sJubG84j","no-scrollbar"),onScroll:function(e){const t=e.currentTarget,{clientWidth:i,scrollLeft:n}=t,s=Math.round(n),o=s%i/i,a=Math.ceil((s+1)/i);A(a);const l=t.querySelector("#premium_feature_preview_video_"+(a-1)),c=t.querySelector(`#premium_feature_preview_video_${a}`);if((0,r.RK)(()=>{t.style.setProperty("--scroll-progress",o.toString()),t.style.setProperty("--abs-scroll-progress",Math.abs(o).toString()),l&&(0,st.dH)(l,"reverse",!1),c&&(0,st.dH)(c,"reverse",!0)}),f)return;const d=Math.round(s/i);g(d)},ref:m,children:I.map((t,i)=>{if("double_limits"===t)return(0,ne.FD)("div",{className:(0,ve.A)(oa,"U7ePgVBR"),children:[(0,ne.Y)("h2",{className:(0,ve.A)("mz2Hmd83",y&&"AgmNOqi7"),children:h(la.double_limits)}),(0,ne.Y)("div",{className:(0,ve.A)("n_rowVPI","custom-scroll"),onScroll:F,children:a.M$8.map((e,t)=>{const i=s?.[e][0].toString(),n=s?.[e][1].toString();return(0,ne.Y)(_o,{title:h(da[e]),description:h(ha[e],n),leftValue:i,rightValue:n,colorStepProgress:t/(a.M$8.length-1)})})})]});if("premium_stickers"===t)return(0,ne.FD)("div",{className:oa,children:[(0,ne.Y)("div",{className:sa,children:(0,ne.Y)(Ho,{isActive:p===i})}),(0,ne.Y)("h1",{className:aa,children:h(la.premium_stickers)}),(0,ne.Y)("div",{className:ra,children:(0,Mt.A)(h(ca.premium_stickers),["br"])})]});if("stories"===t)return(0,ne.Y)("div",{className:(0,ve.A)(oa,"J1M6fEdo"),children:(0,ne.Y)(ia,{})});if("pm_noforwards"===t)return(0,ne.FD)("div",{className:(0,ve.A)(oa,"zmZJKKP5"),children:[(0,ne.Y)(Ko,{}),(0,ne.FD)("div",{className:"iK4wSnTs",children:[(0,ne.Y)("h1",{className:aa,children:u(la.pm_noforwards)}),(0,ne.Y)("div",{className:ra,children:u(ca.pm_noforwards)})]})]});const n=e.videoSections.indexOf(t),o="todo"===t||"ai_compose"===t;return(0,ne.FD)("div",{className:oa,children:[(0,ne.Y)("div",{className:sa,children:(0,ne.Y)(na.A,{isActive:p===i,videoId:-1!==n?e.videos[n].id:void 0,videoThumbnail:-1!==n?e.videos[n].thumbnail:void 0,isDown:a.jhT.includes(t),index:i,isReverseAnimation:i===v})}),(0,ne.Y)("h1",{className:aa,children:o?u(la[t],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(la[t])}),(0,ne.Y)("div",{className:ra,children:(0,Mt.A)(o?u(ca[t],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(ca[t]),["br"])})]})})}),(0,ne.FD)("div",{className:(0,ve.A)("yN2611rA",(k||0!==p)&&"rCHMABcD"),children:[(0,ne.Y)(Lo,{length:I.length,active:p,onSelectSlide:M}),Boolean(P)&&(0,ne.Y)(X.A,{className:(0,ve.A)("EPfM7AgT"),isShiny:!i,withPremiumGradient:!i,onClick:i?c:Y,children:P})]})]})}),ma=(0,n.ph)(({option:e,checked:t,fullMonthlyAmount:i,onChange:s,className:o,isGiveaway:a})=>{const r=(0,B.A)(),l=(0,Bi.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,g=(0,n.Kr)(()=>i&&i>m?Math.ceil(100-m/(i/100)):void 0,[i,m]),v=(0,n.hb)(e=>{e.target.checked&&s(c)},[c,s]);return(0,ne.FD)("label",{className:(0,ve.A)(a?"PkseWxFK":"qZA6S2kc",t&&!a&&"EJOQwnRj",o),dir:l.isRtl?"rtl":void 0,children:[(0,ne.Y)("input",{className:"WOEkhx6R",type:"radio",name:"subscription_option",value:c,checked:t,onChange:v}),(0,ne.FD)("div",{className:"BHUCScsU",children:[(0,ne.FD)("div",{className:"DfYCMUkL",children:[Boolean(g)&&(0,ne.FD)("span",{className:(0,ve.A)("ublijP0j","uqDlP3Zt"),title:r("GiftDiscount"),children:[" ","−",g,"%"]}),r("Months",c)]}),(0,ne.Y)("div",{className:"poxOXJ2o",children:a||p?`${(0,wo.Ad)(d,h,r.code)} x ${u}`:r("PricePerMonth",(0,wo.Ad)(m,h,r.code))}),(0,ne.Y)("div",{className:"IGMrERf_",children:(0,wo.Ad)(d,h,r.code)})]})]})}),pa="yKm9hKQP",ga=i.p+"PremiumAds.a758f19ece91fe91318e.svg",va=i.p+"PremiumAi.314886ee77ae0e1f8d59.svg",Aa=i.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",fa=i.p+"PremiumChats.89d9d315638e283ca895.svg",Ca=i.p+"PremiumEffects.4eab9caad8e9c276842d.svg",ba=i.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",ya=i.p+"PremiumFile.884dd3865acfe594fc61.svg",Sa=i.p+"PremiumLastSeen.9575a548770d23785846.svg",ka=i.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",Na=i.p+"PremiumMessagePrivacy.950cab3e87c60c5733a6.svg",wa=i.p+"PremiumNoForwardsPrivacy.87316a475396fb320c19.svg",Ia=i.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",Pa=i.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",Ya=i.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",Fa=i.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",Da=i.p+"PremiumTags.3b187054cc90f8e16cb7.svg",Ma=i.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",Ta=i.p+"PremiumVideo.288cb61931e33d913f0a.svg",Ba=i.p+"PremiumVoice.b3a2893dbe481108ab94.svg",La=8*v.$,xa={stories:Ya,double_limits:ka,infinite_reactions:Ia,premium_stickers:Fa,animated_emoji:ba,no_ads:ga,voice_to_text:Ba,profile_badge:Aa,faster_download:Pa,more_upload:ya,advanced_chat_management:fa,animated_userpics:Ta,emoji_status:Ya,translations:Ma,saved_tags:Da,last_seen:Sa,message_privacy:Na,effects:Ca,ai_compose:va,todo:Aa,pm_noforwards:wa},Ra=(0,n.ph)((0,s.EK)(e=>{const{premiumModal:t}=(0,c.nTw)(e),i=t?.fromUserId?(0,c.mBe)(e,t.fromUserId):void 0,n=i?.emojiStatus?(0,c.O8F)(e,i.emojiStatus.documentId):void 0,s=n?(0,c.ycM)(e,n.stickerSetInfo):void 0;return{currentUserId:e.currentUserId,promo:t?.promo,isSuccess:t?.isSuccess,isGift:t?.isGift,daysAmount:t?.daysAmount,gift:t?.gift,fromUser:i,fromUserStatusEmoji:n,fromUserStatusSet:s,toUser:t?.toUserId?(0,c.mBe)(e,t.toUserId):void 0,initialSection:t?.initialSection,isPremium:(0,c.g29)(e),limitChannels:(0,In.B)(e,"channels"),limitFolders:(0,In.B)(e,"dialogFilters"),limitPins:(0,In.B)(e,"dialogFolderPinned"),limitLinks:(0,In.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:o,fromUserStatusSet:r,promo:c,initialSection:d,isPremium:h,limitChannels:u,limitLinks:m,limitFolders:p,limitPins:g,limits:v,premiumSlug:A,premiumBotUsername:f,isSuccess:C,isGift:b,toUser:y,daysAmount:S,premiumPromoOrder:k,gift:N})=>{const w=(0,n.li)(),{closePremiumModal:I,openInvoice:P,requestConfetti:Y,openTelegramLink:F,loadStickers:D,openStickerSet:M}=(0,s.ko)(),L=(0,B.A)(),x=(0,Bi.A)(),[R,E]=(0,n.J0)(!0),[V,_]=(0,n.J0)(d),[U,O]=(0,n.J0)();(0,n.vJ)(()=>{e?d&&_(d):(E(!0),_(void 0))},[e,d]);const K=(0,T.A)(e=>{_(e)}),J=(0,T.A)(()=>{_(void 0)}),j=(0,T.A)(e=>{w.current&&(A?P({type:"slug",slug:A}):f&&(F({url:`${a.jsp}${f}?start=${e||"promo"}`}),I()))}),G=(0,T.A)(()=>{U?j(String(U.months)):j()}),H=(0,T.A)(e=>{const t=c?.options.find(t=>t.months===e);O(t)}),z=(0,T.A)(()=>{const t=w.current;if(t&&e){const{top:e,left:i,width:n,height:s}=t.querySelector(".modal-content").getBoundingClientRect();Y({top:e,left:i,width:n,height:s,withStars:!0})}});(0,n.vJ)(()=>{C&&z()},[C,z]),(0,$.A)(([e])=>{e!==h&&z()},[h,z]);const q=(0,n.Kr)(()=>k?k.filter(e=>a.O2i.includes(e)):a.O2i,[k]);(0,n.vJ)(()=>{o&&!r&&D({stickerSetInfo:o.stickerSetInfo})},[D,o,r]),(0,n.vJ)(()=>{const[e]=c?.options??[];O(e)},[c]);const W=(0,T.A)(()=>{r&&M({stickerSetInfo:r})}),Q=(0,n.Kr)(()=>{const e=c?.options.find(e=>1===e.months);if(e)return Number(e.amount)},[c]),Z=(0,n.Kr)(()=>{if(!U)return;const{amount:e,months:t,currency:i}=U,n=Math.floor(e/t);return(0,wo.vv)(x,n,i)},[U,x]);if(c&&(!o||r))return(0,ne.Y)(te.A,{className:"sfbpMFHM",dialogClassName:"premium-main-modal-dialog",onClose:I,isOpen:e,dialogRef:w,hasAbsoluteCloseButton:!V,children:(0,ne.Y)(ae.Ay,{name:"slide",activeKey:V?1:0,className:"ELNkgPve",children:V?(0,ne.Y)(ua,{initialSection:V,onBack:J,promo:c,onClickSubscribe:j,isPremium:h,limits:v,premiumPromoOrder:k,subscriptionOption:U}):(0,ne.FD)("div",{className:(0,ve.A)("ZpOIPrhp","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;E(t<=150)},children:[function(){if(N){const e=(0,Io.yQ)(N);return(0,ne.Y)(Po.A,{model:"sticker",sticker:e,color:"purple",title:ee(),description:(0,Mt.A)(ie(),["simple_markdown","emoji"]),className:"lzalivui"})}return o?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(hs.A,{className:"mQwvY9LA",onClick:W,documentId:o.id,isBig:!0,size:La}),(0,ne.Y)("h2",{className:(0,ve.A)("y71v6ECL",r&&"xw_GbDj7"),children:ee()}),(0,ne.Y)("div",{className:"cUcKXV3j",children:(0,Mt.A)(ie(),["simple_markdown","emoji"])})]}):(0,ne.Y)(Po.A,{model:"swaying-star",color:"purple",title:ee(),description:(0,Mt.A)(ie(),["simple_markdown","emoji"]),className:"z0zfJObh"})}(),!h&&!b&&(0,ne.Y)("div",{className:"xZC_Oajr",children:c?.options.map(e=>(0,ne.Y)(ma,{className:"gygsbDbE",option:e,onChange:H,fullMonthlyAmount:Q,checked:U?.months===e.months},e.amount))}),(0,ne.Y)("div",{className:(0,ve.A)("Bc_F0RKb",R&&"ltXo0Xi7"),children:(0,ne.Y)("h2",{className:"xysPdANX",children:L("TelegramPremium")})}),(0,ne.FD)("div",{className:(0,ve.A)("c3Ee2oSo",h&&"yWEHoJOL"),children:[q.map((e,t)=>{const i="todo"===e||"pm_noforwards"===e||"ai_compose"===e;return(0,ne.Y)(Do,{title:i?x(la[e]):L(la[e]),text:"double_limits"===e?L(ca[e],[u,p,g,m,4]):i?x(ca[e]):L(ca[e]),icon:xa[e],index:t,count:q.length,section:e,onClick:K},e)}),(0,ne.FD)("div",{className:(0,ve.A)(pa,"l1WlNpmu"),dir:x.isRtl?"rtl":void 0,children:[(0,ne.Y)("p",{children:(0,Mt.A)(L("AboutPremiumDescription"),["simple_markdown"])}),(0,ne.Y)("p",{children:(0,Mt.A)(L("AboutPremiumDescription2"),["simple_markdown"])})]}),function(){if(c&&(!b||i?.id!==t))return(0,ne.Y)("div",{className:pa,dir:x.isRtl?"rtl":void 0,children:(0,Gi.fd)({text:c.statusText,entities:c.statusEntities})})}()]}),!h&&U&&(0,ne.Y)("div",{className:"nCnlO9UZ",children:(0,ne.Y)(X.A,{className:"c1tMxuFH",isShiny:!0,withPremiumGradient:!0,onClick:G,children:L("SubscribeToPremium",Z)})})]})})});function ee(){if(N)return x("PremiumGiftHeader");if(b){const e=S?(0,et.w6)(x,S):"";return(0,Mt.A)(i?.id===t?x("DialogTitlePremiumGiftSentTo",{user:(0,l.Yg)(y),amount:e}):x("DialogTitlePremiumGiftReceivedFrom",{user:(0,l.Yg)(i),amount:e}),["simple_markdown","emoji"])}if(r&&i){const e=L("lng_premium_emoji_status_title").replace("{user}",(0,l.Yg)(i)),[t,n]=e.split("{link}"),s=r.thumbCustomEmojiId?(0,ne.Y)(hs.A,{className:"Y0jTcadE",documentId:r.thumbCustomEmojiId}):void 0,o=(0,ne.FD)("span",{className:"FLzl2ng5",onClick:W,children:[s,(0,Mt.A)(r.title)]});return[(0,Mt.A)(t),o,(0,Mt.A)(n)]}return(0,Mt.A)(i?L("TelegramPremiumUserDialogTitle",(0,l.Yg)(i)):L(h?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])}function ie(){return N&&"starGiftUnique"!==N.type&&N.perUserTotal?x("DescriptionGiftPremiumRequired2",{count:N.perUserTotal},{pluralValue:N.perUserTotal}):b?i?.id===t?L("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Yg)(y)):L("TelegramPremiumUserGiftedPremiumDialogSubtitle"):L(r?"TelegramPremiumUserStatusDialogSubtitle":i?"TelegramPremiumUserDialogSubtitle":h?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle")}}));var Ea=i(80089),Va=i(80464);const _a=e=>{const{isOpen:t}=e,i=(0,Va.A)(Ea.ar.Extra,"CountryPickerModal",!t);return i?(0,ne.Y)(i,{...e}):void 0};var Ua=i(1526),Oa=i(96530),Ka=i(11124),Ja=i(34642);const ja=(0,n.ph)(({isOpen:e,giveawayChatId:t,selectionLimit:i,initialSelectedIds:o,onSelectedIdsConfirmed:a,onClose:r})=>{const{showNotification:c}=(0,s.ko)(),d=(0,B.A)(),[h,u]=(0,n.J0)(void 0),[m,p]=(0,n.J0)(""),[g,v,A]=(0,D.A)(),[f,C]=(0,n.J0)(o);(0,n.vJ)(()=>{C(o)},[o]);const b=(0,n.Kr)(()=>{const e=(0,s.mS)(),i=e.chats.byId,{active:n,archived:o}=e.chats.listIds,a=(n||[]).concat(o||[]);return(0,pi.Am)(a).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,n.Kr)(()=>{const e=b?(0,Dt.PU)({ids:b,query:m,type:"chat"}):[];return(0,Dn.A)(e,!1,f)},[b,m,f]),S=(0,T.A)(e=>{const t=(0,s.mS)().chats.byId,n=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)}):n?(u(n),v()):C(e)}),k=(0,T.A)(()=>{h&&C((0,pi.Am)([...f,h])),A()}),N=(0,T.A)(()=>{a(f),r()});return(0,ne.FD)(Ja.A,{isOpen:e,onClose:r,title:d("RequestPeer.ChooseChannelTitle"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:d("Save"),onConfirm:N,onEnter:N,children:[(0,ne.Y)(vi.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,ne.Y)(ci.A,{title:d("BoostingGiveawayPrivateChannel"),text:d("BoostingGiveawayPrivateChannelWarning"),confirmLabel:d("Add"),isOpen:g,onClose:A,confirmHandler:k})]})}),Ga=(0,n.ph)(({option:e,checked:t,name:i,text:n,img:s,isLink:o,onChange:a,onClickAction:r,className:l,userNames:c,selectedMemberIds:d})=>{const h=(0,B.A)();let u=h(n);o&&d?.length&&(u=d.length>2?d.length.toString():c);const m=(0,T.A)(t=>{t.target.checked&&a(e)}),p=(0,T.A)(()=>{r?.()});return(0,ne.FD)("label",{className:(0,ve.A)("w3OGYFKn",l),dir:h.isRtl?"rtl":void 0,role:"button",tabIndex:0,children:[(0,ne.Y)("input",{className:"xy4AclZa",type:"radio",name:"giveaway_option",value:e,checked:t,onChange:m,onClick:e=>e.stopPropagation()}),(0,ne.FD)("div",{className:"TTgSI7Xh",children:[(0,ne.Y)("img",{className:"lGhZJbMF",src:s,alt:"",draggable:!1}),(0,ne.FD)("div",{className:"sEt7TF59",children:[(0,ne.Y)("h3",{className:"u4NzVBBi",children:h(i)}),o?(0,ne.FD)("div",{className:"y7XfPOoG",onClick:p,children:[(0,ne.Y)("span",{children:u}),(0,ne.Y)(he.A,{name:"next"})]}):(0,ne.Y)("span",{className:"kt2ZKZ6j",children:u})]})]})]})}),Ha=(0,n.ph)((0,s.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:o,initialSelectedIds:a,onSelectedIdsConfirmed:r,onClose:c})=>{const{showNotification:d}=(0,s.ko)(),h=(0,B.A)(),[u,m]=(0,n.J0)(""),[p,g]=(0,n.J0)(a);(0,n.vJ)(()=>{g(a)},[a]);const v=(0,n.Kr)(()=>{const e=(0,s.mS)(),{byId:t,statusesById:n}=e.users;if(!i?.length)return[];const a=o&&new Set(Object.keys(o)),r=(0,l.UB)(i.map(({userId:e})=>e),t,n);return a?r.filter(e=>!a.has(e)):r},[o,i]),A=(0,n.Kr)(()=>{const e=(0,s.mS)().users.byId,t=v?(0,Dt.PU)({ids:v,query:u,type:"user"}):[];return(0,Dn.A)((0,pi.Am)(t).filter(t=>{const i=e[t];return!i||!(0,l.tv)(i)}))},[v,u]),f=(0,T.A)(e=>{e.length>t?d({message:h("BoostingSelectUpToWarningUsers",t)}):g(e)}),C=(0,T.A)(()=>{r(p),c()});return(0,ne.Y)(Ja.A,{isOpen:e,onClose:c,title:h("BoostingAwardSpecificUsers"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:h("Save"),onConfirm:C,onEnter:C,children:(0,ne.Y)(vi.A,{itemIds:A,selectedIds:p,filterValue:u,filterPlaceholder:h("Search"),onSelectedIdsChange:f,onFilterChange:m,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"})})})),za="rZRDMqUL",$a="JjDLNrKG",qa="p5Hn4Q6E",Wa="rniPcuiP",Qa="G9H3tm6D",Za="xKl2UeV8",Xa="HLx3wTBD",er="Ftr7zf2v",tr="Ce0Ob2tg",ir="rDFQAfTt",nr="LZ3vPzak",sr="Z9QJQ6IS",or="ldn4mh2T";var ar=i(72078),rr=i(68153),lr=i(65741),cr=i(45318);const dr=i.p+"PremiumStar.39c1ff364d35554f4b80.svg",hr={3:rr,6:ar,12:lr},ur=(0,n.ph)((0,s.EK)(e=>{const{giveawayModal:t}=(0,c.nTw)(e),i=t?.chatId,n=i?(0,c.hds)(e,i):void 0,s=n&&(0,l.WX)(n);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:s,starsGiftOptions:t?.starOptions}})(({chatId:e,gifts:t,isOpen:i,isChannel:o,selectedMemberList:r,selectedChannelList:c,giveawayBoostPerPremiumLimit:d=a.CQG,countryList:h,prepaidGiveaway:u,countrySelectionLimit:m=a.y67,userSelectionLimit:p=a.qbC,isStarsGiftEnabled:g,starsGiftOptions:v})=>{const A=(0,n.li)(),{closeGiveawayModal:f,openInvoice:C,openPremiumModal:b,launchPrepaidGiveaway:y,launchPrepaidStarsGiveaway:S}=(0,s.ko)(),k=(0,B.A)(),[N,w,I]=(0,D.A)(),[P,Y,F]=(0,D.A)(),[M,L,x]=(0,D.A)(),[R,E,V]=(0,D.A)(),[_,U,O]=(0,D.A)(),K=[{name:"Premium.Title",text:"BoostingWinnersRandomly",value:"premium_giveaway",img:ar,actions:"createPremiumGiveaway",isLink:!0,onClickAction:()=>{E()}}];g&&K.push({name:"TelegramStars",text:"BoostingWinnersRandomly",value:"stars_giveaway",img:cr,actions:"createStarsGiveaway",isLink:!1});const[J,j]=(0,n.J0)(()=>Date.now()+2592e5),[G,H]=(0,n.J0)(!0),[z,$]=(0,n.J0)(5),[q,W]=(0,n.J0)(K[0].value),[Q,Z]=(0,n.J0)(),[se,oe]=(0,n.J0)("all"),[ae,re]=(0,n.J0)(),[le,ce]=(0,n.J0)([]),[de,ue]=(0,n.J0)([]),[me,pe]=(0,n.J0)([]),[ge,Ae]=(0,n.J0)(!1),[fe,Ce]=(0,n.J0)(!1),[be,ye]=(0,n.J0)(void 0),[Se,ke]=(0,n.J0)(void 0),[Ne,we]=(0,n.J0)(void 0),Ie="premium_giveaway"===q,Pe="stars_giveaway"===q,Ye=Ie&&!le.length?z:le.length,Fe=Ye*d,De=Q?.yearlyBoosts,Me=(0,n.Kr)(()=>[{value:"all",label:k(o?"BoostingAllSubscribers":"BoostingAllMembers"),subLabel:me&&me.length>0?k("Giveaway.ReceiverType.Countries",me.length):k("BoostingFromAllCountries")},{value:"new",label:k(o?"BoostingNewSubscribers":"BoostingNewMembers"),subLabel:me&&me.length>0?k("Giveaway.ReceiverType.Countries",me.length):k("BoostingFromAllCountries")}],[o,k,me]),Te=k("Months",ae),Be="starsGiveaway"===u?.type,Le="giveaway"===u?.type,xe=(0,n.Kr)(()=>t?.find(e=>e.months===ae&&e.users===Ye),[t,ae,Ye]),Re=(0,n.Kr)(()=>v?.find(e=>Be&&e.stars===Ne?.stars),[Ne,v,Be]),Ee=(0,n.Kr)(()=>t?.filter(e=>e.users===Ye&&e.currency!==a.OUy),[t,Ye]),Ve=(0,n.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,n.Kr)(()=>(0,pi.Am)(t?.filter(e=>e.currency!==a.OUy)?.map(e=>e.users)||[]).sort((e,t)=>e-t),[t]),Ue=(0,n.Kr)(()=>(0,pi.Am)(Q?.winners?.map(e=>e.users)||[]).sort((e,t)=>e-t),[Q]);(0,n.vJ)(()=>{i&&t?.length&&!Be&&re(t?.[0].months)},[i,t,Be]),(0,n.vJ)(()=>{i&&v?.length&&!Le&&Z(v?.[0])},[i,v,Le]),(0,n.vJ)(()=>{i&&Be&&($(u.quantity),we(u))},[i,Be,u]),(0,n.vJ)(()=>{i&&Le&&($(u.quantity),ke(u),re(u.months))},[i,Le,u]),(0,n.vJ)(()=>{r&&ce(r)},[r]),(0,n.vJ)(()=>{c&&ue(c)},[c]);const Oe=(0,T.A)(()=>{b()}),Ke=(0,T.A)(()=>{we(void 0),ke(void 0),Z(void 0),re(void 0),$(5),f()}),Je=(0,T.A)(()=>{C(Ie?le?.length?{type:"giftcode",boostChannelId:e,userIds:le,currency:xe.currency,amount:xe.amount,option:xe}:{type:"giveaway",chatId:e,additionalChannelIds:de,isOnlyForNewSubscribers:"new"===se,countries:me,areWinnersVisible:ge,prizeDescription:be,untilDate:J/1e3,currency:xe.currency,amount:xe.amount,option:xe}:{type:"starsgiveaway",chatId:e,additionalChannelIds:de,isOnlyForNewSubscribers:"new"===se,countries:me,areWinnersVisible:ge,prizeDescription:be,untilDate:J/1e3,currency:Q.currency,amount:Q.amount,stars:Q.stars,users:z}),Ke()}),je=(0,T.A)(()=>{Be?S({chatId:e,giveawayId:Ne.id,paymentPurpose:{additionalChannelIds:de,countries:me,prizeDescription:be,areWinnersVisible:ge,untilDate:J/1e3,stars:Ne.stars,currency:Re.currency,amount:Re.amount,users:Ne.quantity}}):y({chatId:e,giveawayId:Se.id,paymentPurpose:{additionalChannelIds:de,countries:me,prizeDescription:be,areWinnersVisible:ge,untilDate:J/1e3,currency:xe.currency,amount:xe.amount}}),x(),Ke()}),Ge=(0,T.A)(e=>{$(e)}),He=(0,T.A)(e=>{$(e)}),ze=(0,T.A)(e=>{ye(e.target.value)}),$e=(0,n.Kr)(()=>{const e=(0,s.mS)().users.byId;return le?.map(t=>(0,l.Yg)(e[t])).join(", ")},[le]),qe=(0,T.A)(e=>{oe(e)}),We=(0,T.A)(e=>{W(e),ce([]),$(5)}),Qe=(0,T.A)(e=>{j(e.getTime()),I()}),Ze=(0,T.A)(e=>{pe(e)}),Xe=(0,T.A)(e=>{ce(e),e.length||W("premium_giveaway")}),tt=(0,T.A)(e=>{ue(e)}),it=(0,T.A)(()=>{Y()}),nt=(0,T.A)(e=>{Z(e)});function st(){return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:za,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingChannelsGroupsIncludedGiveaway")}),(0,ne.Y)(ui.A,{inactive:!0,className:"chat-item-clickable contact-list-item",children:(0,ne.Y)(vn.A,{chatId:e,status:k(o?"BoostingChannelWillReceiveBoost":"BoostingGroupWillReceiveBoost",Fe||De,"i")})}),de?.map(e=>(0,ne.Y)(ui.A,{ripple:!0,className:"chat-item-clickable contact-list-item",onClick:()=>function(e){const t=de.filter(t=>t!==e);ue(t)}(e),rightElement:(0,ne.Y)(he.A,{name:"close",className:"UZdErfVI"}),children:(0,ne.Y)(vn.A,{chatId:e.toString()})},e)),de.length<9&&(0,ne.Y)(ui.A,{icon:"add",ripple:!0,onClick:U,className:"sOXvh85b",iconClassName:"aGbyR60s",children:k("BoostingAddChannelOrGroup")})]}),(0,ne.FD)("div",{className:za,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingEligibleUsers")}),(0,ne.Y)("div",{className:$a,children:(0,ne.Y)(ie.A,{name:"subscribers",options:Me,selected:se,onChange:qe,onClickAction:it,subLabelClassName:"txXJxVFu",isLink:!0})})]}),(0,ne.Y)("div",{className:Wa,children:(0,Mt.A)(k(o?"BoostGift.LimitSubscribersInfo":"lng_giveaway_users_about_group"))}),(0,ne.FD)("div",{className:za,children:[(0,ne.FD)("div",{className:sr,children:[(0,ne.Y)("h2",{className:nr,children:k("BoostingGiveawayAdditionalPrizes")}),(0,ne.Y)(mi.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:fe,onCheck:Ce})]}),fe&&(0,ne.FD)("div",{className:"eQVP0Nx8",children:[(0,ne.Y)("h2",{className:nr,children:z}),(0,ne.Y)(ee.A,{className:"qMYNwiUZ",value:be,onChange:ze,label:k("BoostingGiveawayEnterYourPrize")})]})]}),fe?Pe||Be?void 0:(0,ne.Y)("div",{className:Wa,children:be?.length?(0,Mt.A)(k("BoostingGiveawayAdditionPrizeCountNameHint",Se?[Se.quantity,be,Te]:[Ye,be,Te],void 0,ae),["simple_markdown"]):(0,Mt.A)(k("BoostingGiveawayAdditionPrizeCountHint",Se?[Se.quantity,Te]:[Ye,Te],void 0,ae),["simple_markdown"])}):(0,ne.Y)("div",{className:Wa,children:(0,Mt.A)(k("BoostingGiveawayAdditionPrizeHint"))}),(0,ne.Y)("div",{className:za,children:(0,ne.FD)("div",{className:sr,children:[(0,ne.Y)("h2",{className:nr,children:k("BoostingGiveawayShowWinners")}),(0,ne.Y)(mi.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:ge,onCheck:Ae})]})}),(0,ne.Y)("div",{className:Wa,children:(0,Mt.A)(k("BoostingGiveawayShowWinnersHint"))}),(0,ne.FD)("div",{className:(0,ve.A)(za,(Se||Ne||Pe)&&ir),children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingDateWhenGiveawayEnds")}),(0,ne.FD)(X.A,{ariaLabel:k("BoostGift.DateEnds"),className:(0,ve.A)("GeKqKRgP","expire-limit"),isText:!0,onClick:w,children:[(0,ne.Y)("h3",{className:nr,children:k("BoostGift.DateEnds")}),(0,et.L2)(J,k.code)]})]})]})}return(0,ne.FD)(te.A,{className:"P0kLOw15",onClose:Ke,isOpen:i,dialogRef:A,onEnter:Se||Ne?L:Je,hasAbsoluteCloseButton:!0,children:[(0,ne.FD)("div",{className:(0,ve.A)("SqiN63Ef","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;H(t<=150)},children:[(0,ne.Y)("img",{className:"Me2hCsMs",src:dr,alt:"",draggable:!1}),(0,ne.Y)("h2",{className:"UVDnB0Wq",children:(0,Mt.A)(k("BoostingBoostsViaGifts"))}),(0,ne.Y)("div",{className:"v5yGzV6v",children:(0,Mt.A)(k(o?"BoostingGetMoreBoost":"BoostingGetMoreBoostsGroup"))}),(0,ne.Y)("div",{className:(0,ve.A)("U6XNIToQ",G&&"tDZc21ZC"),children:(0,ne.Y)("h2",{className:"v6hiGpEn",children:k("BoostingBoostsViaGifts")})}),Se||Ne?(0,ne.FD)("div",{className:"q1y2qUTn",children:[(0,ne.Y)("div",{children:Ne?(0,ne.Y)("img",{className:or,src:cr,alt:""}):(0,ne.Y)("img",{className:or,src:hr[Se.months]||hr[3],alt:""})}),(0,ne.FD)("div",{className:"IsT38nlq",children:[(0,ne.Y)("h3",{className:nr,children:Ne?k("Giveaway.Stars.Prepaid.Title",Ne?.stars):k("BoostingTelegramPremiumCountPlural",Se.quantity)}),(0,ne.Y)("p",{className:"TsGuei3B",children:Ne?k("Giveaway.Stars.Prepaid.Desc",Ne?.quantity):k("PrepaidGiveawayMonths",Se?.months)})]}),(0,ne.Y)("div",{className:Qa,children:(0,ne.FD)("div",{className:(0,ve.A)(Za,Xa),children:[(0,ne.Y)(he.A,{name:"boost",className:er}),(0,ne.Y)("div",{className:tr,dir:k.isRtl?"rtl":void 0,children:Ne?Ne?.boosts:Se.quantity*(d??a.CQG)})]})})]}):(0,ne.Y)("div",{className:(0,ve.A)(za,"sQ5PkKEs"),children:(0,ne.Y)("div",{className:$a,children:K.map(e=>(0,ne.Y)(Ga,{name:e.name,text:e.text,option:e.value,img:e.img,onChange:We,checked:q===e.value,isLink:e.isLink,userNames:$e,selectedMemberIds:le,onClickAction:e.onClickAction},e.name))})}),Ie&&!le?.length&&(0,ne.FD)(ne.FK,{children:[!Se&&!Ne&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:za,children:[(0,ne.FD)("div",{className:Qa,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingQuantityPrizes")}),(0,ne.FD)("div",{className:(0,ve.A)(Za,Xa),children:[(0,ne.Y)(he.A,{name:"boost",className:er}),(0,ne.Y)("div",{className:tr,dir:k.isRtl?"rtl":void 0,children:Fe})]})]}),(0,ne.Y)(Ka.A,{rangeCount:Ye,marks:_e,onChange:Ge})]}),(0,ne.Y)("div",{className:Wa,children:(0,Mt.A)(k("BoostingChooseHowMany"))})]}),st()]}),Pe&&(0,ne.FD)(ne.FK,{children:[!Ne&&!Se&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:za,children:[(0,ne.FD)("div",{className:Qa,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingStarsOptions")}),(0,ne.FD)("div",{className:(0,ve.A)(Za,Xa),children:[(0,ne.Y)(he.A,{name:"boost",className:er}),(0,ne.Y)("div",{className:tr,dir:k.isRtl?"rtl":void 0,children:De})]})]}),(0,ne.Y)(Ua.A,{className:"cLhNkYPB",options:v,selectedStarCount:z,selectedStarOption:Q,onClick:nt})]}),(0,ne.Y)("div",{className:(0,ve.A)(Wa,"bzRAETfR"),children:(0,Mt.A)(k("BoostGift.Stars.Info"))}),(0,ne.FD)("div",{className:za,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingStarsQuantityPrizes")}),(0,ne.Y)(Ka.A,{rangeCount:z,marks:Ue,onChange:He}),(0,ne.Y)("div",{className:Wa,children:(0,Mt.A)(k("BoostingStarsQuantityPrizesInfo"))})]})]}),st()]}),!Se&&!Ne&&Ie&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:za,children:[(0,ne.Y)("h2",{className:qa,children:k("BoostingDurationOfPremium")}),(0,ne.Y)("div",{className:$a,children:Ee?.map(e=>(0,ne.Y)(ma,{isGiveaway:!0,option:e,fullMonthlyAmount:Ve,checked:e.months===ae,onChange:re},e.months))})]}),(0,ne.Y)("div",{className:(0,ve.A)(Wa,ir),children:function(){const e=k("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return(0,ne.FD)("p",{className:"eNQ_nrKr",children:[e[1],(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:Oe,children:e[2]}),e[3]]})}()})]}),q&&(0,ne.Y)("div",{className:"hD_AEzjd",children:(0,ne.Y)(X.A,{className:"ILuhBsJG",onClick:Se||Ne?L:Je,children:k("BoostingStartGiveaway")})})]}),(0,ne.Y)(ks,{isOpen:N,isFutureMode:!0,withTimePicker:!0,onClose:I,onSubmit:Qe,selectedAt:J,submitButtonLabel:k("Save")}),(0,ne.Y)(_a,{isOpen:P,onClose:F,countryList:h,onSubmit:Ze,selectionLimit:m}),(0,ne.Y)(Ha,{isOpen:R,onClose:V,onSelectedIdsConfirmed:Xe,initialSelectedIds:le,selectionLimit:p,giveawayChatId:e}),(0,ne.Y)(ja,{isOpen:_,onClose:O,initialSelectedIds:de,onSelectedIdsConfirmed:tt,selectionLimit:a.cgU,giveawayChatId:e}),(0,ne.Y)(ci.A,{title:k("BoostingStartGiveawayConfirmTitle"),text:k("BoostingStartGiveawayConfirmText"),confirmLabel:k("Start"),isOpen:M,onClose:x,confirmHandler:je})]})})),mr={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders",savedDialogsPinned:"LimitReachedPinSavedDialogs"},pr={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked",savedDialogsPinned:"LimitReachedPinSavedDialogsLocked"},gr={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium",savedDialogsPinned:"LimitReachedPinSavedDialogsPremium"},vr={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"},Ar={uploadMaxFileparts:(e,t)=>8e3===t?e("MediaSizeGB",{size:4},{pluralValue:4}):4e3===t?e("MediaSizeGB",{size:2},{pluralValue:2}):(0,Es.v7)(e,t*a.dK5)},fr=(0,n.ph)((0,s.EK)((e,{limit:t})=>{const{limits:i}=e.appConfig,n=(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:n}})(({defaultValue:e,premiumValue:t,limit:i,isPremium:o,canBuyPremium:a})=>{const{closeLimitReachedModal:r,openPremiumModal:l}=(0,s.ko)(),c=(0,Bi.A)(),d=(0,B.A)(),[h,u,m]=(0,D.A)(),p=(0,n.hb)(()=>{l(),u()},[l,u]);(0,n.vJ)(()=>{!i&&h&&m()},[h,i,m]);const g=c("LimitReached"),v=i&&Ar[i],A=function({lang:e,oldLang:t,limitType:i,isPremium:n,canBuyPremium:s,defaultValue:o,premiumValue:a,valueFormatter:r}){if(!i)return;const l=r?r(e,o):o,c=r?r(e,a):a;return n?t(gr[i],c):s?t(mr[i],"channelsPublic"===i?c:[l,c]):t(pr[i],l)}({lang:c,oldLang:d,limitType:i,isPremium:o,canBuyPremium:a,defaultValue:e,premiumValue:t,valueFormatter:v}),f=i&&vr[i],C=a&&!o;return(0,ne.FD)(te.A,{onClose:u,onCloseAnimationEnd:r,isOpen:Boolean(i)&&!h,title:g,className:"QAs_iFxO",children:[!C&&(0,ne.FD)("div",{className:"Q5d_7bB4",children:[(0,ne.Y)("i",{className:(0,ve.A)("rbnU7JVX",f,"icon")}),(0,ne.Y)("div",{className:"ArEy3hhB",children:v?.(c,o?t:e)||(o?t:e)})]}),C&&(0,ne.Y)(Ro,{className:"k0O6Rnjh",leftValue:v?.(c,e)||e?.toString(),rightValue:v?.(c,t)||t?.toString(),floatingBadgeIcon:f}),(0,ne.Y)("div",{children:(0,Mt.A)(A||"",["simple_markdown","br"])}),(0,ne.FD)("div",{className:"RVM_RSap",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary",children:c(C?"Cancel":"OK")}),C&&(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",iconName:"double-badge",iconClassName:"esB1OhAF",iconAlignment:"end",children:c("IncreaseLimit")})]})]})}));var Cr=i(93809),br=i(81954),yr=i(5912);const Sr=350+a.xB5,kr=.5*v.$;function Nr(e,t,i,s){const o=(0,n.li)([]),[a,r]=(0,n.J0)(0),{observe:l,freeze:c,unfreeze:d}=(0,yr.BL)({rootRef:e},e=>{const t=o.current;e.forEach(e=>{const n=Number(e.target.id.replace(`${i}-`,""));t[n]=e.isIntersecting});const n=t.reduce((e,t,i)=>t&&i<e?i:e,1/0);n!==1/0&&r(n)}),{observe:h,freeze:u,unfreeze:m}=(0,yr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:p}=(0,yr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:g}=(0,yr.BL)({rootRef:t});return(0,$.A)(()=>{if(!s){const e=window.setTimeout(()=>{m(),d()},Sr);return()=>{clearTimeout(e)}}c(),u()},[c,u,s,d,m]),{activeSetIndex:a,observeIntersectionForSet:l,observeIntersectionForShowingItems:h,observeIntersectionForPlayingItems:p,observeIntersectionForCovers:g,selectStickerSet:(0,T.A)(t=>{r(n=>{const s=document.getElementById(`${i}-${t}`),o=1===Math.abs(n-t);return(0,br.Ay)({container:e.current,element:s,position:"start",margin:kr,maxDistance:o?200:80}),t})})}}var wr=i(37479),Ir=i(87094),Pr=i(94519),Yr=i(45294);const Fr=(0,n.ph)(({stickerSet:e,size:t=a.TBj,noPlay:i,forcePlayback:o,observeIntersection:r,sharedCanvasRef:d})=>{const{loadStickers:h}=(0,s.ko)(),m=(0,n.li)(),{hasThumbnail:p,hasVideoThumb:g,hasAnimatedThumb:v,hasStaticThumb:A,thumbCustomEmojiId:f}=e,{customEmoji:C}=(0,Yr.A)(f),b=C?.shouldUseTextColor,y=(0,Ir.A)(m,void 0,!b),S=(0,wr.A)(y),k=(0,yr.Vz)(m,r),N=k&&!i,w=!p||g&&!u.OF&&!v&&!A,I=w&&e.stickers?.[0]&&(0,l.Mw)(e.stickers[0],"preview"),P=(0,q.A)(I,!k),Y=(p&&!I||v)&&`stickerSet${e.id}`,F=(0,q.A)(Y,!k),D=f||F||P,M=(0,xi.A)(D),T=(0,Pr.A)(m,d);return(0,n.vJ)(()=>{k&&!e.stickers?.length&&h({stickerSetInfo:e})},[k,h,e]),(0,ne.Y)("div",{ref:m,className:(0,ve.A)("m6XpTzQX","sticker-set-cover"),style:`--_size: ${t}px`,children:D?f?(0,ne.Y)(hs.A,{documentId:f,size:t,observeIntersectionForPlaying:r,noPlay:i}):v?(0,ne.Y)(jo.A,{className:M,tgsUrl:F,size:t,play:N,isLowPriority:!(0,c.CzR)((0,s.mS)(),e),sharedCanvas:d?.current||void 0,sharedCanvasCoords:T,forceAlways:o}):g&&!w?(0,ne.Y)(Ui.A,{className:(0,ve.A)("OZHqKbDL",M),src:F,canPlay:N,style:S,isPriority:o,loop:!0,disablePictureInPicture:!0}):(0,ne.Y)("img",{src:F||P,style:S,className:(0,ve.A)("enA6c8gc",M),alt:"",draggable:!1}):(0,Es.Qh)(e.title,2)})});var Dr=i(54464),Mr=i(82855);const Tr=[{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}],Br=(0,n.ph)(({sticker:e,size:t,noPlay:i,title:o,className:a,noContextMenu:r,isSavedMessages:l,isStatusPicker:c,canViewSet:d,isSelected:h,isCurrentUserPremium:m,shouldIgnorePremium:p,noShowPremium:g,sharedCanvasRef:v,withTranslucentThumb:A,forcePlayback:f,isEffectEmoji:C,noIcons:b,clickArg:y,onClick:S,observeIntersection:k,observeIntersectionForShowing:N,onFaveClick:w,onUnfaveClick:I,onRemoveRecentClick:P,onDismiss:Y})=>{const{openStickerSet:F,openPremiumModal:D,setEmojiStatus:M}=(0,s.ko)(),L=(0,n.li)(),x=(0,n.li)(),R=(0,B.A)(),E=e.shouldUseTextColor,V=(0,Ir.A)(L,void 0,!E),{id:_,stickerSetInfo:U}=e,O=!e.isFree||e.hasEffect,K=e.isCustomEmoji||C,J=!K&&O,j=!m&&O&&!p,G=(0,yr.Vz)(L,k),H=G,z=G&&!i,$=(0,yr.Vz)(L,N),{isContextMenuOpen:q,contextMenuAnchor:W,handleBeforeContextMenu:Q,handleContextMenu:Z,handleContextMenuClose:ee,handleContextMenuHide:te}=(0,As.A)(L),ie=Boolean(!r&&W),se=(0,T.A)(()=>L.current),oe=(0,T.A)(()=>L.current.closest(".custom-scroll, .no-scrollbar")),ae=(0,T.A)(()=>c?x.current:L.current.querySelector(".sticker-context-menu .bubble")),re=(0,T.A)(()=>({withPortal:c,shouldAvoidNegativePosition:!0}));(0,n.vJ)(()=>{G||ee()},[ee,G]);const le=(0,T.A)(t=>{t.stopPropagation(),t.preventDefault(),P(e)}),ce=(0,T.A)(()=>{P(e)}),de=(0,T.A)(()=>{I(e)}),ue=(0,T.A)(()=>{w(e)}),pe=(0,T.A)(()=>{S?.(y,!0)}),ge=(0,T.A)(()=>{S?.(y,void 0,!0)}),Ae=(0,T.A)(()=>{F({stickerSetInfo:U})}),fe=(0,T.A)((t,i=0)=>{t.preventDefault(),t.stopPropagation(),ee(),Y?.(),M({emojiStatus:{type:"regular",documentId:e.id,until:(0,Di.Fm)()+i}})}),Ce=!u.TF&&P,be=(0,ve.A)("StickerButton",S&&"interactive",h&&"selected",K&&"custom-emoji",C&&"effect-emoji",a),ye=(0,n.Kr)(()=>{if(!ie||r||K&&!c)return[];const e=[];return K?(Tr.forEach(t=>{e.push((0,ne.Y)(me.A,{onClick:fe,clickArg:t.arg,children:R(t.title,t.value,"i")}))}),e):(I&&e.push((0,ne.Y)(me.A,{icon:"favorite",onClick:de,children:R("Stickers.RemoveFromFavorites")})),w&&e.push((0,ne.Y)(me.A,{icon:"favorite",onClick:ue,children:R("Stickers.AddToFavorites")})),!j&&S&&(l||e.push((0,ne.Y)(me.A,{onClick:pe,icon:"muted",children:R("SendWithoutSound")})),e.push((0,ne.Y)(me.A,{onClick:ge,icon:"calendar",children:R(l?"SetReminder":"ScheduleMessage")}))),d&&e.push((0,ne.Y)(me.A,{onClick:Ae,icon:"stickers",children:R("ViewPackPreview")})),P&&e.push((0,ne.Y)(me.A,{icon:"delete",onClick:ce,children:R("DeleteFromRecent")})),e)},[ie,r,K,c,I,w,j,S,d,P,fe,R,de,ue,l,ge,pe,Ae,ce]);return(0,ne.FD)("div",{ref:L,className:be,title:o||e?.emoji,"data-sticker-id":_,onMouseDown:e=>{(0,Dr.u)(e),Q(e)},onClick:()=>{if(!q)return j?(D(C?{initialSection:"effects"}:K?{initialSection:"animated_emoji"}:{initialSection:"premium_stickers"}),void Y?.()):void S?.(y)},onContextMenu:Z,children:[$&&(0,ne.Y)(Mr.A,{containerRef:L,sticker:e,isSmall:!0,size:t,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!H,noPlay:!z,noVideoOnMobile:!0,withSharedAnimation:!0,sharedCanvasRef:v,withTranslucentThumb:A,customColor:V,forceAlways:f}),!b&&!g&&j&&(0,ne.Y)("div",{className:"sticker-locked",children:(0,ne.Y)(he.A,{name:"lock-badge"})}),!b&&!g&&J&&!j&&(0,ne.Y)("div",{className:"sticker-premium",children:(0,ne.Y)(he.A,{name:"star"})}),Ce&&(0,ne.Y)(X.A,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:le,iconName:"close"}),Boolean(ye.length)&&(0,ne.Y)(it.A,{ref:x,isOpen:q,anchor:W,getTriggerElement:se,getRootElement:oe,getMenuElement:ae,getLayout:re,className:"sticker-context-menu",autoClose:!0,withPortal:c,onClose:ee,onCloseAnimationEnd:te,children:ye})]})});var Lr=i(93545),xr=i(95773);const Rr=(0,n.ph)(({reaction:e,availableReactions:t,isSelected:i,loadAndPlay:s,observeIntersection:o,sharedCanvasRef:r,sharedCanvasHqRef:c,forcePlayback:d,onClick:h,onContextMenu:u})=>{const m=(0,n.li)(),p="custom"===e.type,g=(0,n.Kr)(()=>t?.find(t=>(0,l.a0)(t.reaction,e)),[t,e]),v=g?.staticIcon?.thumbnail?.dataUri,A=g?.selectAnimation?.id,f=(0,Pr.A)(m,r),C=(0,q.A)(g?.selectAnimation?(0,l.mr)(g.selectAnimation,"full"):void 0,!A),{isContextMenuOpen:b,handleBeforeContextMenu:y,handleContextMenu:S,handleContextMenuClose:k,handleContextMenuHide:N}=(0,As.A)(m,"paid"!==e.type,void 0,void 0,void 0,!0);(0,n.vJ)(()=>{b&&(u?.(e),k(),N())},[k,u,N,b,e]);const w="paid"===e.type?Uo.w.StarReaction:C,I=(0,T.A)(()=>{h(e)}),P=(0,xi.A)(C),Y=(0,ve.A)("AVrrYEbM",i&&"QkdO_lz1",!p&&"sticker-reaction");return(0,ne.Y)("div",{ref:m,className:Y,onClick:I,title:g?.title,"data-sticker-id":p?e.documentId:void 0,onMouseDown:y,onContextMenu:S,children:p?(0,ne.Y)(hs.A,{ref:m,documentId:e.documentId,size:a.g0Q,noPlay:!s,observeIntersectionForPlaying:o,sharedCanvasRef:r,sharedCanvasHqRef:c,withTranslucentThumb:!0,forceAlways:d}):(0,ne.Y)(Oo.A,{tgsUrl:w,thumbDataUri:v,play:s,noLoop:!1,size:a.g0Q,isLowPriority:!0,className:P,sharedCanvas:r.current||void 0,sharedCanvasCoords:f,forceAlways:d})})});var Er=i(38027);const Vr=(0,n.ph)((0,s.EK)(e=>{const t=e.collectibleEmojiStatuses?.statuses;return{collectibleStatuses:t}})(({stickerSet:e,loadAndPlay:t,index:i,idPrefix:o,isNearActive:r,favoriteStickers:d,availableReactions:h,isSavedMessages:u,isStatusPicker:m,isReactionPicker:p,isCurrentUserPremium:g,shouldHideHeader:v,withDefaultTopicIcon:A,selectedReactionIds:f,withDefaultStatusIcon:C,isChatEmojiSet:b,isChatStickerSet:y,isTranslucent:S,noContextMenus:k,noAddButton:N,forcePlayback:w,collectibleStatuses:I,observeIntersection:P,observeIntersectionForPlayingItems:F,observeIntersectionForShowingItems:M,onReactionSelect:L,onReactionContext:x,onStickerSelect:R,onStickerUnfave:E,onStickerFave:V,onStickerRemoveRecent:_,onDismiss:U})=>{const{clearRecentStickers:O,clearRecentCustomEmoji:K,clearRecentReactions:J,openPremiumModal:j,toggleStickerSet:G,loadStickers:H}=(0,s.ko)(),z=(0,n.li)(),$=(0,n.li)(),q=(0,n.li)(),W=(0,B.A)(),{width:Q}=(0,Pe.A)(),[Z,ee,te]=(0,D.A)(),{isMobile:ie}=(0,Y.Ay)(),[se,oe]=(0,n.J0)(()=>_r(Q)),ae=(0,yr.Vz)(z,P??M),re=(0,xi.A)(ae),le=r||ae,ce=ie?8:4,de=ie?8:10,ue=ie?8:4,me=e.id===a.sR2,pe=e.id===a.j1l,ge=e.id===a.tRH,Ae=e.id===a.EPW,fe=e.isEmoji,Ce=!me&&(0,c.Q31)(e),be=(0,T.A)(()=>{p?J():fe?K():O(),te()}),ye=(0,T.A)(()=>{Ce&&!g?j({initialSection:"animated_emoji"}):G({stickerSetId:e.id})}),Se=(0,T.A)(()=>{R?.({mediaType:"sticker",id:a.MyF,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),ke=(0,T.A)(()=>{R?.({mediaType:"sticker",id:a.zNY,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Ne=fe?a.g0Q:a.bkT,we=fe?de:ce,Ie=fe?ue:ce,Ye=(0,T.A)(e=>e?Math.floor((e+we)/(Ne+we)):_r(Q)),Fe=(0,T.A)(e=>{oe(Ye(e.contentRect.width))});(0,Lr.A)(z,Fe),(0,n.vJ)(()=>{z.current&&oe(Ye(z.current.clientWidth))},[Ye]),(0,n.vJ)(()=>{le&&!e.stickers?.length&&!e.reactions?.length&&e.accessHash&&H({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})},[le,H,e]);const De=!u&&!g&&Ce&&!b,Me=e.installedDate&&!e.isArchived,Te=!Me&&e.id!==a.sR2&&e.id!==a.EPW&&e.id!==a.hfH&&e.id!==a.Kp3&&!b&&!y,[Be,,Le]=(0,D.A)(Te),xe=3*se-1,Re=A||C?e.count+1:e.count,Ee=Ne+Ie,Ve=Math.ceil(Math.min(xe,Re)/se)*Ee-Ie,_e=Be?Ve:Math.ceil(Re/se)*Ee-Ie,Ue=(0,n.Kr)(()=>d?new Set(d.map(({id:e})=>e)):void 0,[d]),Oe=(0,n.Kr)(()=>I?new Set(I.map(({documentId:e})=>e)):void 0,[I]),Ke=!N&&!v&&!me&&!pe&&fe&&!Ae&&!b&&(!Me||!g&&!u),Je=(0,n.Kr)(()=>W(De?Me?"lng_emoji_premium_restore":"Unlock":"Add"),[De,W,Me]);return(0,ne.FD)("div",{ref:z,id:`${o}-${i}`,className:(0,ve.A)("symbol-set",De&&"symbol-set-locked"),children:[!v&&(0,ne.FD)("div",{className:"symbol-set-header",children:[(0,ne.FD)("p",{className:(0,ve.A)("symbol-set-title",Ke&&"symbol-set-title-external"),children:[De&&(0,ne.Y)(he.A,{name:"lock-badge",className:"symbol-set-locked-icon"}),(0,ne.Y)("span",{className:"symbol-set-name",children:e.title}),(b||y)&&(0,ne.Y)("span",{className:"symbol-set-chat",children:W(b?"GroupEmoji":"GroupStickers")}),Ke&&Boolean(e.stickers)&&(0,ne.Y)("span",{className:"symbol-set-amount",children:W(fe?"EmojiCount":"Stickers",e.stickers.length,"i")})]}),me&&(0,ne.Y)(he.A,{className:"symbol-set-remove",name:"close",onClick:ee}),Ke&&(0,ne.Y)(X.A,{className:"symbol-set-add-button",withPremiumGradient:Ce&&!g,onClick:ye,pill:!0,size:"tiny",fluid:!0,children:Je})]}),(0,ne.FD)("div",{className:(0,ve.A)("symbol-set-container shared-canvas-container",re,e.id===a.hfH&&"effect-emojis"),style:`height: ${_e}px;`,children:[(0,ne.Y)("canvas",{ref:$,className:"shared-canvas",style:Te?`height: ${Ve}px;`:void 0}),(me||ge||Te)&&(0,ne.Y)("canvas",{ref:q,className:"shared-canvas"}),A&&(0,ne.Y)(X.A,{className:"StickerButton custom-emoji",color:"translucent",onClick:Se,children:(0,ne.Y)("img",{src:Er,alt:"Reset",className:"sticker-media",draggable:!1})},"default-topic-icon"),C&&(0,ne.Y)(X.A,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:ke,iconName:"star"},"default-status-icon"),le&&e.reactions?.map(i=>{const n=(0,l.Jj)(i),s=n?f?.includes(n):void 0;return(0,ne.Y)(Rr,{reaction:i,isSelected:s,loadAndPlay:t,availableReactions:h,observeIntersection:F,onClick:L,onContextMenu:x,sharedCanvasRef:$,sharedCanvasHqRef:q,forcePlayback:w},`${e.id}_${n}`)}),le&&e.stickers?.slice(0,Be?xe:e.stickers.length).map((i,n)=>{const o=(me||ge)&&(0,c.CzR)((0,s.mS)(),i.stickerSetInfo),r=Te&&n>=xe||o?q:$,l=i.isCustomEmoji?i.id:i.emoji,d=l?f?.includes(l):void 0,h=e.id===a.j1l||Oe?.has(i.id),p=(0,ne.Y)(Br,{sticker:i,size:Ne,observeIntersection:F,observeIntersectionForShowing:M,noPlay:!t,isSavedMessages:u,isStatusPicker:m,canViewSet:!0,noContextMenu:k,isCurrentUserPremium:g,shouldIgnorePremium:b,sharedCanvasRef:r,withTranslucentThumb:S,onClick:R,clickArg:i,noIcons:fe&&!me,isSelected:d,onUnfaveClick:ge&&Ue?.has(i.id)?E:void 0,onFaveClick:Ue?.has(i.id)?void 0:V,onRemoveRecentClick:me?_:void 0,onDismiss:U,forcePlayback:w,isEffectEmoji:e.id===a.hfH,noShowPremium:g&&(e.id===a.Kp3||e.id===a.hfH)},i.id);return h?(0,ne.Y)(xr.A,{className:"gift-effect-wrapper",withSparkles:!0,children:p}):p}),Be&&Re>xe&&(0,ne.FD)(X.A,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:Le,children:["+",Re-xe]},"more")]}),me&&(0,ne.Y)(ci.A,{text:W(p?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:Z,onClose:te,confirmHandler:be,confirmIsDestructive:!0})]},e.id)}));function _r(e){return e>440?8:e<362?6:7}const Ur="p7c8y0LH",Or="zTGriBHY",Kr="Qn3lBUNs",Jr="HMspKpNp",jr="YKO0Obwy",Gr="BZfaP1GD",Hr=2.5*v.$,zr=new Set([a.sR2,a.tRH,a.EPW]),$r=new Set([a.sR2,a.tRH,a.EPW]),qr=(0,n.ph)((0,s.EK)((e,{chatId:t,isStatusPicker:i,isReactionPicker:n})=>{const{stickers:{setsById:s},customEmojis:{byId:o,featuredIds:a,statusRecent:{emojis:r}},recentCustomEmojis:l,reactions:{availableReactions:d,recentReactions:h,topReactions:u,defaultTags:m}}=e,p=Boolean(t&&(0,c.nZ4)(e,t)),g=t?(0,c.AWZ)(e,t):void 0,v=e.collectibleEmojiStatuses?.statuses;return{customEmojisById:o,recentCustomEmojiIds:i?void 0:l,recentStatusEmojis:i?r:void 0,collectibleStatuses:i?v:void 0,stickerSetsById:s,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,c.BWX)(e),isSavedMessages:p,isCurrentUserPremium:(0,c.g29)(e),customEmojiFeaturedIds:a,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:n?u:void 0,recentReactions:n?h:void 0,chatEmojiSetId:g?.emojiSet?.id,isWithPaidReaction:n&&g?.isPaidReactionAvailable,availableReactions:n?d:void 0,defaultTagReactions:n?m:void 0}})(({className:e,pickerListClassName:t,isHidden:i,loadAndPlay:o,addedCustomEmojiIds:r,customEmojisById:d,recentCustomEmojiIds:h,selectedReactionIds:m,recentStatusEmojis:p,collectibleStatuses:g,stickerSetsById:v,chatEmojiSetId:A,topReactions:f,recentReactions:C,availableReactions:b,idPrefix:y="custom-emoji-set",customEmojiFeaturedIds:S,canAnimate:k,isReactionPicker:N,isStatusPicker:w,isTranslucent:I,noAddButton:P,isSavedMessages:F,isCurrentUserPremium:D,withDefaultTopicIcons:M,defaultTopicIconsId:L,defaultStatusIconsId:x,defaultTagReactions:R,isWithPaidReaction:E,onCustomEmojiSelect:V,onReactionSelect:_,onReactionContext:U,onDismiss:O})=>{const K=(0,n.li)(),J=(0,n.li)(),j=(0,n.li)(),G=(0,n.li)(),{isMobile:H}=(0,Y.Ay)(),{handleScroll:z,isAtBeginning:$}=(0,un.A)(),q=(0,n.Kr)(()=>w?p:Object.values((0,pi._E)(d,h)),[d,w,h,p]),W=(0,n.Kr)(()=>{const e=g?.map(e=>e.documentId);return d&&e?.map(e=>d[e]).filter(Boolean)},[d,g]),Q=`${y}-custom-emoji`,{activeSetIndex:Z,observeIntersectionForSet:ee,observeIntersectionForPlayingItems:te,observeIntersectionForShowingItems:ie,observeIntersectionForCovers:se,selectStickerSet:oe}=Nr(K,J,Q,i),re=(0,ji.A)(o||void 0,a.jhd),le=(0,B.A)(),ce=(0,Bi.A)(),de=Boolean(r),ue=(0,n.Kr)(()=>{const e=[];if(N&&F&&R?.length&&e.push({id:a.G3A,accessHash:"",title:le("PremiumPreviewTags"),reactions:R,count:R.length,isEmoji:!0}),N&&!F){const t=f?.slice(0,16)||[];E&&t.unshift({type:"paid"}),t?.length&&e.push({id:a.G3A,accessHash:"",title:le("Reactions"),reactions:t,count:t.length,isEmoji:!0});const i=(C||[]).filter(e=>!t.some(t=>(0,l.a0)(t,e))).slice(0,32),n=(b||[]).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(n?.length||i?.length){const t=!i?.length,s=i.concat(n);e.push({id:t?a.EPW:a.sR2,accessHash:"",title:le(t?"PopularReactions":"RecentStickers"),reactions:s,count:s.length,isEmoji:!0})}}else if(w){const t=v[x];if(t?.stickers?.length){const i=(0,pi.Xd)(t.stickers.slice(0,7).concat(q||[]),"id");e.push({...t,stickers:i,count:i.length,id:a.sR2,title:le("RecentStickers"),isEmoji:!0})}W?.length&&e.push({id:a.j1l,accessHash:"",count:W.length,stickers:W,title:ce("CollectibleStatusesCategory"),isEmoji:!0})}else if(M){const t=v[L];t.stickers?.length&&e.push({...t,id:a.sR2,title:le("RecentStickers")})}else q?.length&&e.push({id:a.sR2,accessHash:"0",title:le("RecentStickers"),stickers:q,count:q.length,isEmoji:!0});const t=[...r||[]];A&&t.unshift(A);const i=(0,pi.Am)(t.concat(S||[])),n=Object.values((0,pi._E)(v,i));return[...e,...n]},[r,N,w,M,q,S,v,f,b,le,C,x,L,F,R,A,E,W,ce]),me=(0,n.Kr)(()=>de&&0===ue.filter(e=>e.stickers?.length).length,[ue,de]),pe=(0,Cr.A)([],a.jhd),ge=de&&pe&&!me;(0,Qn.A)(J,H||!ge),(0,n.vJ)(()=>{if(!de)return;const e=J.current;if(!e)return;const t=Z*Hr-(e.offsetWidth/2-Hr/2);(0,Mo.A)(e,t)},[de,Z]);const Ae=(0,T.A)(e=>{V(e)}),fe=(0,ve.A)("StickerPicker","Qk9PEGRE",e),Ce=(0,ve.A)(Kr,"no-scrollbar",!$&&Jr),be=(0,ve.A)(Ur,"U0BL1VvK",u.TF?"no-scrollbar":"custom-scroll",t,Or),ye=!ge&&!me;return(0,ne.Y)(ae.Ay,{className:fe,name:"fade",activeKey:ye?0:1,shouldCleanup:!0,children:ge||me?!ge&&me?(0,ne.Y)("div",{className:Gr,children:le("NoStickers")}):(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{ref:J,className:Ce,children:(0,ne.FD)("div",{className:"shared-canvas-container",children:[(0,ne.Y)("canvas",{ref:j,className:"shared-canvas"}),(0,ne.Y)("canvas",{ref:G,className:"shared-canvas"}),ue.map(function(e,t){const i=e.stickers?.[0],n=(0,ve.A)(jr,t===Z&&"WYeuJNQx"),o=t<a.j41,r=(0,c.CzR)((0,s.mS)(),e);if(e.id!==a.G3A){if($r.has(e.id)||e.hasThumbnail||!i){const i=e.id===a.sR2||e.id===a.EPW,s=zr.has(e.id);return(0,ne.Y)(X.A,{className:n,ariaLabel:e.title,round:!0,faded:s,color:"translucent",onClick:()=>oe(i?0:t),children:i?(0,ne.Y)(he.A,{name:"recent"}):(0,ne.Y)(Fr,{stickerSet:e,noPlay:!k||!re,forcePlayback:!0,observeIntersection:se,sharedCanvasRef:o?r?G:j:void 0})},e.id)}return(0,ne.Y)(Br,{sticker:i,size:a.TBj,title:e.title,className:n,noPlay:!k||!re,observeIntersection:se,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:o?r?G:j:void 0,withTranslucentThumb:I,onClick:oe,clickArg:t,forcePlayback:!0},e.id)}})]})}),(0,ne.Y)("div",{ref:K,onScroll:z,className:be,children:ue.map((e,t)=>{const i=e.id===a.G3A||e.id===a.sR2&&(M||w),n=e.id===A;return(0,ne.Y)(Vr,{stickerSet:e,loadAndPlay:Boolean(k&&re),index:t,idPrefix:Q,observeIntersection:ee,observeIntersectionForPlayingItems:te,observeIntersectionForShowingItems:ie,isNearActive:Z>=t-1&&Z<=t+1,isSavedMessages:F,isStatusPicker:w,isReactionPicker:N,noAddButton:P,shouldHideHeader:i,withDefaultTopicIcon:M&&e.id===a.sR2,withDefaultStatusIcon:w&&e.id===a.sR2,isChatEmojiSet:n,isCurrentUserPremium:D,selectedReactionIds:m,availableReactions:b,isTranslucent:I,onReactionSelect:_,onReactionContext:U,onStickerSelect:Ae,onDismiss:O,forcePlayback:!0},e.id)})})]}):(0,ne.Y)(Jn.A,{})})}));var Wr=i(3325);const Qr=(0,n.ph)((0,s.EK)(e=>({areFeaturedStickersLoaded:Boolean(e.customEmojis.featuredIds?.length),isTranslucent:(0,c.cwE)(e)}))(({isOpen:e,statusButtonRef:t,areFeaturedStickersLoaded:i,isTranslucent:o,onEmojiStatusSelect:a,onClose:r})=>{const{loadFeaturedEmojiStickers:l}=(0,s.ko)(),c=(0,n.li)(0);(0,n.vJ)(()=>{t.current&&(c.current=t.current.getBoundingClientRect().right)},[e,t]),(0,n.vJ)(()=>{e&&!i&&l()},[i,e,l]);const d=(0,n.hb)(e=>{a(e),r()},[r,a]);return(0,ne.Y)(Wr.A,{children:(0,ne.Y)(it.A,{isOpen:e,noCompact:!0,positionX:"left",bubbleClassName:"hRzvfaRb",onClose:r,transformOriginX:c.current,children:(0,ne.Y)(qr,{idPrefix:"status-emoji-set-",loadAndPlay:e,isHidden:!e,isStatusPicker:!0,isTranslucent:o,onDismiss:r,onCustomEmojiSelect:d})})})})),Zr=6*v.$,Xr=(0,n.ph)((0,s.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:o,closeSuggestedStatusModal:a,sendWebAppEvent:r}=(0,s.ko)(),c=(0,Bi.A)(),d=Boolean(e),h=(0,Ii.A)(e),u=(0,n.Kr)(()=>{if(t&&h)return{...t,emojiStatus:{type:"regular",documentId:h.customEmojiId}}},[t,h]),m=(0,n.Kr)(()=>{if(!h||!i)return;const e=(0,l.Yg)(i);return h.duration?c("BotSuggestedStatusFor",{bot:e,duration:(0,et.A$)(c,h.duration)},{withNodes:!0,withMarkdown:!0}):c("BotSuggestedStatus",{bot:e},{withNodes:!0,withMarkdown:!0})},[i,c,h]),p=(0,T.A)(()=>{const e=h?.webAppKey;e&&r({webAppKey:e,event:{eventType:"emoji_status_failed",eventData:{error:"USER_DECLINED"}}}),a()}),g=(0,T.A)(()=>{if(!h)return;const e=h.duration?(0,Di.Fm)()+h.duration:void 0;o({referrerWebAppKey:h.webAppKey,emojiStatus:{type:"regular",documentId:h.customEmojiId,until:e}}),a()});return(0,ne.FD)(te.A,{isOpen:d,contentClassName:"C9sWDINB",hasAbsoluteCloseButton:!0,isSlim:!0,onClose:p,children:[h&&(0,ne.Y)(hs.A,{className:"gdG3oY21",documentId:h.customEmojiId,size:Zr,loopLimit:1,forceAlways:!0}),(0,ne.FD)("div",{children:[(0,ne.Y)("h3",{className:"KVpsce1g",children:c("BotSuggestedStatusTitle")}),(0,ne.Y)("p",{className:"p7S4AH8A",children:m})]}),u&&(0,ne.Y)(xn.A,{mockPeer:u,withEmojiStatus:!0}),(0,ne.Y)(X.A,{onClick:g,children:c("GeneralConfirm")})]})}));var el=i(55317),tl=i(20333);const il="j6xEoljc";function nl(e,t){return e.find(e=>!e.chatId)||e.filter(e=>t&&e.chatId!==t).sort((e,t)=>e.date-t.date)[0]}const sl=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t&&(0,c.hds)(e,t?.chatId),n=i&&(0,c.AWZ)(e,i.id),s=t?.myBoosts&&nl(t.myBoosts,t.chatId);return{chat:i,chatFullInfo:n,prevBoostedChat:s?.chatId?(0,c.hds)(e,s?.chatId):void 0,isCurrentUserPremium:(0,c.g29)(e)}})(({modal:e,chat:t,chatFullInfo:i,prevBoostedChat:o,isCurrentUserPremium:a})=>{const{applyBoost:r,closeBoostModal:c,requestConfetti:d,openPremiumModal:h,loadFullChat:u}=(0,s.ko)(),[m,p,g]=(0,D.A)(),[v,A,f]=(0,D.A)(),[C,b,y]=(0,D.A)(),S=t&&(0,l.WX)(t),k=Boolean(e),N=(0,B.A)(),w=(0,Bi.A)();(0,n.vJ)(()=>{t&&!i&&u({chatId:t.id})},[t,i]);const I=(0,n.Kr)(()=>{if(t)return(0,l.Js)(N,t)},[t,N]),P=(0,n.Kr)(()=>{if(o)return(0,l.Js)(N,o)},[o,N]),{isStatusLoaded:Y,isBoosted:F,boost:M,title:L,leftText:x,rightText:R,value:E,progress:V,descriptionText:_,canBoostMore:U}=(0,n.Kr)(()=>{if(!e?.boostStatus||!t)return{isStatusLoaded:!1,title:N("Loading")};const{hasMyBoost:n}=e.boostStatus,s=e?.myBoosts&&nl(e.myBoosts,t.id),o=e?.myBoosts&&(a=e.myBoosts,r=t.id,!a.every(e=>e.chatId===r));var a,r;const{boosts:c,currentLevel:d,hasNextLevel:h,levelProgress:u,remainingBoosts:m,isMaxLevel:p}=(0,el.z)(e.boostStatus,!0),g=n,v=N("BoostsLevel",d),A=h?N("BoostsLevel",d+1):void 0,f=N("ChannelBoost.MoreBoosts",m),C=N(S?"BoostChannel":"BoostGroup"),b=(i?.boostsToUnrestrict||0)-(i?.boostsApplied||0);let y;if(p)y=N("BoostsMaxLevelReached");else if(b>0&&!(0,l.SJ)(t)){const e=N("GroupBoost.BoostToUnrestrict.Times",b);y=N("GroupBoost.BoostToUnrestrict",[e,I])}else y=N("ChannelBoost.MoreBoostsNeeded.Text",[I,f]);return{isStatusLoaded:!0,title:C,leftText:v,rightText:A,value:c.toString(),progress:u,remainingBoosts:m,descriptionText:y,boost:s,isBoosted:g,canBoostMore:o&&!p}},[t,I,e,N,i,S]),O=!e?.myBoosts?.length&&a,K=M?.chatId&&M.chatId!==e?.chatId,J=(0,T.A)(()=>{g(),r({chatId:t.id,slots:[M.slot]}),d({})}),j=(0,T.A)(()=>{h(),y(),c()}),G=(0,T.A)(()=>{if(!M)return a?void c():void b();U?M.cooldownUntil?A():K?p():J():c()}),H=(0,T.A)(()=>{c()});return(0,ne.FD)(te.A,{isOpen:k,title:L,className:"IK2mBqbm",contentClassName:"pUyNTysT",onClose:c,children:[Y?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(tl.A,{leftText:x,rightText:R,progress:V,floatingBadgeText:E,floatingBadgeIcon:"boost"}),F&&(0,ne.Y)("div",{className:(0,ve.A)(il,"hAA6B1lc"),children:N("ChannelBoost.YouBoostedChannelText",I)}),(0,ne.Y)("div",{className:il,children:(0,Mt.A)(_,["simple_markdown","emoji"])}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",disabled:O,onClick:G,children:U?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(he.A,{name:"boost"}),N(S?"ChannelBoost.BoostChannel":"GroupBoost.BoostGroup")]}):N("OK")}),(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:H,children:N("Cancel")})]})]}):(0,ne.Y)(Jn.A,{className:"zjXCH3pT"}),K&&P&&(0,ne.FD)(te.A,{isOpen:m,className:"GIFAjZPY",contentClassName:"Jxyz9TaL",onClose:g,children:[(0,ne.FD)("div",{className:"OKp6HS1U",children:[(0,ne.FD)("div",{className:"NU9itcIm",children:[(0,ne.Y)(Tt.A,{peer:o,size:"large"}),(0,ne.Y)(he.A,{name:"boostcircle",className:"upXvhNRY"})]}),(0,ne.Y)(he.A,{name:"next",className:"WSJdWV7L"}),(0,ne.Y)(Tt.A,{peer:t,size:"large"})]}),(0,ne.Y)("div",{children:(0,Mt.A)(N("ChannelBoost.ReplaceBoost",[P,I]),["simple_markdown","emoji"])}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:J,children:N("Replace")}),(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:g,children:N("Cancel")})]})]}),Boolean(M?.cooldownUntil)&&(0,ne.Y)(ci.A,{isOpen:v,isOnlyConfirm:!0,confirmLabel:N("OK"),title:N("ChannelBoost.Error.BoostTooOftenTitle"),onClose:f,confirmHandler:f,children:(0,Mt.A)(N("ChannelBoost.Error.BoostTooOftenText",(0,et.A$)(w,M.cooldownUntil-(0,Di.Fm)())),["simple_markdown","emoji"])}),!a&&(0,ne.Y)(ci.A,{isOpen:C,confirmLabel:N("Common.Yes"),title:N("PremiumNeeded"),onClose:y,confirmHandler:j,children:(0,Mt.A)(N("PremiumNeededForBoosting"),["simple_markdown","emoji"])})]})}));var ol=i(47058),al=i(70046);const rl="xVLGjLub",ll=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const{message:i}=t||{},n=i&&(0,c.O5q)(e,i.chatId,i.messageId),s=n&&(0,c.Y7C)(e,n);return{currentUserId:e.currentUserId,messageSender:s}})(({currentUserId:e,modal:t,messageSender:i})=>{const{closeGiftCodeModal:o,applyGiftCode:r,focusMessage:l}=(0,s.ko)(),c=(0,Bi.A)(),d=(0,B.A)(),h=Boolean(t),u=!(t?.info.toId&&t?.info.toId!==e||t?.info.usedAt),m=(0,T.A)(()=>{t&&t.info.giveawayMessageId&&(l({chatId:t.info.fromId,messageId:t.info.giveawayMessageId}),o())}),p=(0,T.A)(()=>{u?r({slug:t.slug}):o()}),g=(0,n.Kr)(()=>{if(!t)return;const{slug:e,info:n}=t,s=n.fromId||i?.id,o=(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("img",{src:dr,alt:"",className:"Mtx4SWww"}),(0,ne.Y)("p",{className:rl,children:(0,Mt.A)(d("lng_gift_link_about"),["simple_markdown"])}),(0,ne.Y)(ol.A,{title:"BoostingGiftLink",link:`${a.jsp}/giftcode/${e}`})]}),r=[[d("BoostingFrom"),s?{chatId:s}:d("BoostingNoRecipient")],[d("BoostingTo"),n.toId?{chatId:n.toId}:d("BoostingNoRecipient")],[d("BoostingGift"),d("BoostingTelegramPremiumFor",(0,et.w6)(c,n.days))]];return n.isFromGiveaway&&r.push([d("BoostingReason"),(0,ne.Y)("span",{className:(0,ve.A)(n.giveawayMessageId&&"IzcASdzD"),onClick:m,children:n.isFromGiveaway&&!n.toId?d("BoostingIncompleteGiveaway"):d("BoostingGiveaway")})]),r.push([d("BoostingDate"),(0,et.L2)(1e3*n.date,d.code,!0)]),{header:o,tableData:r,footer:(0,ne.Y)("span",{className:rl,children:(0,Mt.A)(n.usedAt?d("BoostingUsedLinkDate",(0,et.L2)(1e3*n.usedAt,d.code,!0)):d("BoostingSendLinkToAnyone"),["simple_markdown"])})}},[c,d,i?.id,t]);if(g)return(0,ne.Y)(al.A,{isOpen:h,title:d("lng_gift_link_title"),tableData:g.tableData,header:g.header,footer:g.footer,buttonText:d(u?"BoostingUseLink":"Close"),onButtonClick:p,onClose:o})}));function cl(e,t){return e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)}const dl=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const{selfDestructAccountDays:i}=t||{};return{selfDestructAccountDays:i}})(({modal:e,selfDestructAccountDays:t})=>{const{closeGiftCodeModal:i,closeDeleteAccountModal:o,setAccountTTL:r}=(0,s.ko)(),l=(0,Bi.A)(),c=Boolean(e),[d,h]=(0,n.J0)(),u=(0,T.A)(e=>30*Number(e)),m=(0,n.Kr)(()=>{if(t)return cl(a.WF4,t/30).toString()},[t]);(0,n.vJ)(()=>{m&&h(m)},[m]);const p=(0,n.Kr)(()=>a.WF4.map(e=>({value:String(e),label:l("Months",{count:e},{pluralValue:1})})),[l]),g=(0,T.A)(e=>{h(e)}),v=(0,T.A)(()=>{d&&r({days:u(d)})}),A=(0,T.A)(()=>{o()});return(0,ne.FD)(te.A,{isOpen:c,title:l("SelfDestructTitle"),onClose:i,className:"X6K5oA8U",children:[(0,ne.Y)("p",{children:l("SelfDestructSessionsDescription")}),(0,ne.Y)(ie.A,{className:"dialog-checkbox-group",name:"quick-reaction-settings",options:p,selected:d,onChange:g,withIcon:!0}),(0,ne.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:v,children:l("Save")}),(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:A,children:l("Cancel")})]})]})})),hl={root:"OviJR58x",content:"BlpqzGYt",header:"b9RUzfpF",iconWrapper:"l1X5kBUM",icon:"qOoRnv_Y",mainText:"s2SOQSml",description:"wiKBjcl2"},ul=(0,n.ph)((0,s.EK)(e=>({verifyAgeMin:e.appConfig.verifyAgeMin||a.lYi}))(({modal:e,verifyAgeMin:t})=>{const{closeAgeVerificationModal:i,requestAgeVerification:n}=(0,s.ko)(),o=(0,Bi.A)(),a=Boolean(e),r=(0,T.A)(()=>{n()}),l=(0,T.A)(()=>{i()});return(0,ne.FD)(te.A,{isOpen:a,onClose:l,className:hl.root,children:[(0,ne.FD)("div",{className:hl.content,children:[(0,ne.Y)("div",{className:hl.header,children:(0,ne.Y)("div",{className:hl.iconWrapper,children:(0,ne.Y)(he.A,{name:"user",className:hl.icon})})}),(0,ne.Y)("h2",{className:hl.title,children:o("TitleAgeVerificationModal")}),(0,ne.Y)("p",{className:hl.mainText,children:o("TextAgeVerificationModal",{count:t},{withMarkdown:!0,withNodes:!0,pluralValue:t})}),(0,ne.Y)("p",{className:hl.description,children:o("DescriptionAgeVerificationModal")})]}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{onClick:r,children:o("ButtonAgeVerification")})})]})}));var ml=i(34132),pl=i(24713);const gl={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"},vl=(0,n.ph)(({invite:e,folder:t})=>{const{closeChatlistModal:i,joinChatlistInvite:o}=(0,s.ko)(),a=(0,Bi.A)(),r=(0,B.A)(),[l,c]=(0,n.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?a("FolderLinkSubtitleNew"):u?a("FolderLinkSubtitleAdd",{chats:a("FolderLinkSubtitleAddCount",{count:u},{pluralValue:u}),title:(0,Gi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})},{withNodes:!0,withMarkdown:!0}):a("FolderLinkSubtitleAlready"),g=(0,n.hb)(()=>{i(),l.length&&o({invite:e,peerIds:l})},[e,l]),v=(0,n.hb)(()=>{const t=l.length===e.missingPeerIds.length;c(t?[]:e.missingPeerIds)},[e.missingPeerIds,l.length]);return(0,ne.FD)("div",{className:gl.content,children:[(0,ne.Y)("div",{className:gl.description,children:(0,Mt.A)(p,["simple_markdown","emoji"])}),(0,ne.FD)("div",{className:(0,ve.A)(gl.pickerWrapper,"custom-scroll"),children:[Boolean(e.missingPeerIds.length)&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:gl.pickerHeader,children:[(0,ne.Y)("div",{className:gl.pickerHeaderInfo,children:r("FolderLinkHeaderChatsJoin",l.length,"i")}),(0,ne.Y)("div",{className:gl.selectionToggle,role:"button",tabIndex:0,onClick:v,children:l.length===e.missingPeerIds.length?r("DeselectAll"):r("SelectAll")})]}),(0,ne.Y)(vi.A,{itemIds:e.missingPeerIds,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ne.Y)("div",{className:gl.pickerHeader,children:(0,ne.Y)("div",{className:gl.pickerHeaderInfo,children:r("FolderLinkHeaderAlready")})}),(0,ne.Y)(vi.A,{itemIds:e.alreadyPeerIds,lockedSelectedIds:e.alreadyPeerIds,selectedIds:e.alreadyPeerIds,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ne.Y)(X.A,{onClick:g,children:(0,ne.FD)("div",{className:gl.buttonText,children:[!l.length&&r("OK"),Boolean(l.length)&&(0,ne.FD)(ne.FK,{children:[r("FolderLinkButtonJoinPlural",l.length,"i"),(0,ne.Y)(pl.A,{className:gl.buttonBadge,text:m,isAlternateColor:!0})]})]})})]})}),Al=(0,n.ph)(({folder:e,suggestedPeerIds:t=gi.p})=>{const{closeChatlistModal:i,leaveChatlist:o}=(0,s.ko)(),a=(0,B.A)(),[r,l]=(0,n.J0)([]),c=r.length?r.length.toString():void 0,d=(0,n.hb)(()=>{const e=r.length===t.length;l(e?[]:t)},[t,r.length]),h=(0,n.hb)(()=>{i(),o({folderId:e.id,peerIds:r})},[e.id,r]);return(0,ne.FD)("div",{className:gl.content,children:[Boolean(t?.length)&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:gl.description,children:(0,Mt.A)(a("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])}),(0,ne.FD)("div",{className:(0,ve.A)(gl.pickerWrapper,"custom-scroll"),children:[(0,ne.FD)("div",{className:gl.pickerHeader,children:[(0,ne.Y)("div",{className:gl.pickerHeaderInfo,children:a("FolderLinkHeaderChatsQuit",r.length,"i")}),(0,ne.Y)("div",{className:gl.selectionToggle,role:"button",tabIndex:0,onClick:d,children:r.length===t.length?a("DeselectAll"):a("SelectAll")})]}),(0,ne.Y)(vi.A,{itemIds:t,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]})]}),(0,ne.Y)(X.A,{onClick:h,children:(0,ne.FD)("div",{className:gl.buttonText,children:[!r.length&&a("FolderLinkButtonRemove"),Boolean(r.length)&&(0,ne.FD)(ne.FK,{children:[a("FolderLinkButtonRemoveChats"),(0,ne.Y)(pl.A,{className:gl.buttonBadge,text:c,isAlternateColor:!0})]})]})})]})}),fl=(0,n.ph)(({invite:e})=>{const{closeChatlistModal:t,joinChatlistInvite:i}=(0,s.ko)(),o=(0,Bi.A)(),a=(0,B.A)(),[r,l]=(0,n.J0)(e.peerIds),c=(0,n.Kr)(()=>{const t=(0,s.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,n.hb)(()=>{t(),i({invite:e,peerIds:r})},[e,r]),m=(0,n.hb)(()=>{const t=r.length===e.peerIds.length;l(t?c:e.peerIds)},[e.peerIds,c,r.length]);return(0,ne.FD)("div",{className:gl.content,children:[(0,ne.Y)("div",{className:gl.description,children:o("FolderLinkSubtitleNew")}),(0,ne.FD)("div",{className:(0,ve.A)(gl.pickerWrapper,"custom-scroll"),children:[(0,ne.FD)("div",{className:gl.pickerHeader,children:[(0,ne.Y)("div",{className:gl.pickerHeaderInfo,children:a("FolderLinkHeaderChatsJoin",d,"i")}),(0,ne.Y)("div",{className:gl.selectionToggle,role:"button",tabIndex:0,onClick:m,children:r.length===e.peerIds.length?a("DeselectAll"):a("SelectAll")})]}),(0,ne.Y)(vi.A,{itemIds:e.peerIds,lockedSelectedIds:c,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ne.Y)(X.A,{onClick:u,disabled:!r.length,children:(0,ne.FD)("div",{className:gl.buttonText,children:[o("FolderLinkAddFolder"),(0,ne.Y)(pl.A,{className:gl.buttonBadge,text:h,isAlternateColor:!0})]})})]})}),Cl=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const{invite:i,removal:n}=t||{},s=n?.folderId||(i&&"folderId"in i?i.folderId:void 0);return{folder:s?(0,c.$aQ)(e,s):void 0}})(({modal:e,folder:t})=>{const{closeChatlistModal:i}=(0,s.ko)(),o=(0,B.A)(),a=Boolean(e),r=(0,K.A)(e)||e,l=(0,K.A)(t)||t,c=(0,n.Kr)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?o("FolderLinkTitleAddChats"):o("FolderLinkTitleAlready"):o("FolderLinkTitleAdd")}return r.removal?o("FolderLinkTitleRemove"):void 0}},[o,r]),d=(0,n.Kr)(()=>l?(0,Gi.fd)({text:l.title.text,entities:l.title.entities,noCustomEmojiPlayback:l.noTitleAnimations}):r?.invite&&"title"in r.invite?(0,Gi.fd)({text:r.invite.title.text,entities:r.invite.title.entities,noCustomEmojiPlayback:r.invite.noTitleAnimations}):void 0,[l,r]),h=(0,n.Kr)(()=>{if(r?.invite)return"missingPeerIds"in r.invite?r.invite.missingPeerIds.length:void 0},[r]),u=(0,n.hb)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?(0,ne.Y)(vl,{invite:e,folder:l}):(0,ne.Y)(fl,{invite:e})}return r.removal?(0,ne.Y)(Al,{folder:l,suggestedPeerIds:r.removal.suggestedPeerIds}):void 0}},[l,r]);return(0,ne.FD)(te.A,{isOpen:a,title:c,onClose:i,isSlim:!0,hasCloseButton:!0,children:[d&&(m=d,(0,ne.Y)("div",{className:gl.foldersWrapper,children:(0,ne.FD)("div",{className:gl.folders,children:[(0,ne.Y)(ml.A,{className:gl.folder,title:o("FolderLinkPreviewLeft")}),(0,ne.Y)(ml.A,{className:gl.folder,isActive:!0,badgeCount:h,isBadgeActive:!0,title:m}),(0,ne.Y)(ml.A,{className:gl.folder,title:o("FolderLinkPreviewRight")})]})})),u()]});var m})),bl={content:"MZ0RCecx",title:"ar8XeydN",participantCount:"un00TXYY",participants:"YvkZ6c2D",participant:"DHJSBDeE",buttons:"KFtrPtNr"},yl=(0,n.ph)(({modal:e})=>{const{acceptChatInvite:t,closeChatInviteModal:i,showNotification:o}=(0,s.ko)(),a=(0,n.li)(),r=(0,B.A)(),d=(0,O.A)(e),{hash:h,inviteInfo:u}=e||d||{},{about:m,isBroadcast:p,participantIds:g,participantsCount:v,photo:A,isRequestNeeded:f}=u||{},C=(0,T.A)(()=>{i()}),b=(0,T.A)(()=>{t({hash:h}),f&&o({message:r(p?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),C()}),y=p?"ProfileJoinChannel":"JoinGroup",S=p?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup",k=(0,n.Kr)(()=>{if(u)return(0,l.nr)(u)},[u]),N=(0,n.Kr)(()=>{if(!g)return;const e=(0,s.mS)();return g.map(t=>(0,c.mBe)(e,t)).filter(Boolean)},[g]);return(0,Qn.A)(a,!e||!N),(0,ne.FD)(te.A,{isOpen:Boolean(e),contentClassName:bl.content,isSlim:!0,onClose:C,onEnter:b,children:[k&&(0,ne.Y)(Tt.A,{size:"jumbo",photo:A,peer:k,withVideo:!0}),k&&(0,ne.Y)(jn.A,{className:bl.title,peer:k}),m&&(0,ne.Y)("p",{className:bl.about,children:m}),(0,ne.Y)("p",{className:bl.participantCount,children:r(p?"Subscribers":"Members",v,"i")}),N&&(0,ne.Y)("div",{ref:a,className:(0,ve.A)(bl.participants,"no-scrollbar"),children:N.map(e=>(0,ne.Y)(_s.A,{className:bl.participant,peer:e,text:(0,l.Yg)(e)}))}),(0,ne.FD)("div",{className:(0,ve.A)("dialog-buttons",bl.buttons),children:[(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:b,children:r(f?S:y)}),(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:C,children:r("Cancel")})]})]})});var Sl=i(5463);const kl=(0,n.ph)(({modal:e})=>{const{closePasskeyModal:t,startPasskeyRegistration:i}=(0,s.ko)(),o=(0,Bi.A)(),a=(0,T.A)(()=>{t()}),r=(0,T.A)(()=>{i(),a()}),l=(0,n.Kr)(()=>({header:(0,ne.FD)("div",{className:"flex-column-centered",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Passkeys,previewUrl:Uo.d.Passkeys,size:120}),(0,ne.Y)("h3",{className:"vi6YQWX0",children:o("PasskeyModalTitle")}),(0,ne.Y)("p",{children:o("PasskeyModalDescription")})]}),listItemData:[["key",o("PasskeyModalFeature1Title"),o("PasskeyModalFeature1Description")],["animals",o("PasskeyModalFeature2Title"),o("PasskeyModalFeature2Description")],["lock",o("PasskeyModalFeature3Title"),o("PasskeyModalFeature3Description")]]}),[o]);return(0,ne.Y)(Sl.A,{isOpen:Boolean(e),listItemData:l.listItemData,header:l.header,buttonText:o("PasskeyModalButtonText"),onButtonClick:r,onClose:a})}),Nl="kiV5YwpR",wl=(new Date).getFullYear(),Il=wl-150,Pl=Array.from({length:12},(e,t)=>t+1),Yl=(e,t)=>e?2===e?t&&(t%4!=0||t%100==0&&t%400!=0)?28:29:4===e||6===e||9===e||11===e?30:31:31,Fl=(0,n.ph)(({modal:e})=>{const{closeBirthdaySetupModal:t,openSettingsScreen:i,updateBirthday:a}=(0,s.ko)(),{currentBirthday:r}=e||{},l=(0,n.li)(),[c,d]=(0,n.J0)(r?.day),[h,u]=(0,n.J0)(r?.month),[m,p]=(0,n.J0)(r?.year),g=(0,Bi.A)(),v=(0,T.A)(()=>{t()}),A=(0,T.A)(()=>{a({birthday:void 0}),t()}),f=(0,T.A)(()=>{i({screen:o.VS.PrivacyBirthday}),t()}),C=Yl(h,m),b=(0,T.A)(e=>{if(!e.target.value)return void d(void 0);const t=Number(e.target.value.replace(/[^\d]+/g,""));t?d(t>C?C:Math.max(t,1)):e.preventDefault()}),y=(0,T.A)(e=>{u(e),c&&d(Math.min(c,Yl(e,m)))}),S=(0,T.A)(e=>{if(!e.target.value)return void p(void 0);const t=Number(e.target.value.replace(/[^\d]+/g,""));t?t>wl?p(wl):(p(t),c&&d(Math.min(c,Yl(h,t)))):e.preventDefault()}),k=(0,T.A)(()=>{m?m<100?p(1900+m):m<Il&&p(Il):p(void 0)}),N=(0,T.A)(()=>{c&&h&&(a({birthday:{day:c,month:h,year:m}}),t())}),w=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(ee.A,{label:g("BirthdayInputMonth"),className:(0,ve.A)(Nl,"xSFFwTx2",t&&"active"),value:h?g(`Month${h}`):"",onClick:e,inputMode:"numeric",teactExperimentControlled:!0}),[g,h]);return(0,ne.FD)(te.A,{isOpen:Boolean(e),hasCloseButton:!0,hasAbsoluteCloseButton:!0,isSlim:!0,dialogRef:l,contentClassName:"W0kySiJ6",onClose:v,children:[(0,ne.FD)("div",{className:"PpcrztHS",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.DuckCake,size:120,className:"section-icon"}),(0,ne.Y)("h3",{className:"lMKiFLTe",children:g("BirthdaySetupTitle")})]}),(0,ne.FD)("div",{className:"sje6F_wI",children:[(0,ne.Y)(ee.A,{label:g("BirthdayInputDay"),className:Nl,value:c?.toString(),onChange:b,maxLength:2,inputMode:"numeric"}),(0,ne.Y)(ue.A,{className:(0,ve.A)("OMO_wq8N","with-menu-transitions"),bubbleClassName:"JcsMNM0K",autoClose:!0,positionY:"bottom",trigger:w,children:Pl.map(e=>(0,ne.Y)(me.A,{onClick:()=>y(e),children:g(`Month${e}`)},e))}),(0,ne.Y)(ee.A,{label:g("BirthdayInputYear"),className:Nl,value:m?.toString(),onBlur:k,onChange:S,maxLength:4,inputMode:"numeric"})]}),(0,ne.FD)("div",{className:"mkIotrno",children:[(0,ne.Y)("span",{className:"INQVqP2z",children:g("BirthdayPrivacySuggestion",{link:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:f,children:g("BirthdayPrivacySuggestionLink",void 0,{withNodes:!0,specialReplacement:Fi.hG})})},{withNodes:!0})}),r&&(0,ne.Y)(X.A,{isText:!0,onClick:A,children:g("BirthdayRemove")}),(0,ne.Y)(X.A,{disabled:!c||!h,onClick:N,children:g("Save")})]})]})});var Dl=i(89873);const Ml="La4sUYaq",Tl="Bn5kz5br",Bl=(0,n.ph)((0,s.EK)(e=>({minLevelToRestrictAds:e.appConfig.channelRestrictAdsLevelMin}))(({modal:e,minLevelToRestrictAds:t})=>{const{closeAboutAdsModal:i}=(0,s.ko)(),o=(0,n.li)(),a=Boolean(e),r=(0,Ii.A)(e),{canReport:l,randomId:c,additionalInfo:d,sponsorInfo:h}=r||{},u=l,m=(0,Ii.A)(u),p=(0,B.A)(),g=(0,n.Kr)(()=>(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{children:p("SponsoredMessageInfoScreen.Title")}),(0,ne.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription1"),["br"])}),(0,ne.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription2"),["br"])}),(0,ne.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription3"),["br"])}),(0,ne.Y)("p",{children:(0,ne.Y)(us.A,{url:p("SponsoredMessageAlertLearnMoreUrl"),text:p("SponsoredMessageAlertLearnMoreUrl")})}),(0,ne.Y)("p",{children:(0,Mt.A)(p("SponsoredMessageInfoDescription4"),["br"])})]}),[p]),{isContextMenuOpen:v,contextMenuAnchor:A,handleContextMenu:f,handleContextMenuClose:C,handleContextMenuHide:b}=(0,As.A)(o,!m),y=(0,T.A)(()=>{i(),C(),b()}),S=(0,n.Kr)(()=>{if(a)return{header:(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:Ml,children:p("AboutRevenueSharingAds")}),(0,ne.Y)("p",{className:(0,ve.A)(Tl,"hbsLlXSH"),children:p("RevenueSharingAdsAlertSubtitle")}),(0,ne.Y)(X.A,{ref:o,round:!0,size:"smaller",color:"translucent",className:"JdN5pGTw",onClick:f,iconName:"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,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:Ml,children:(0,Mt.A)(p("RevenueSharingAdsInfo4Title"),["simple_markdown"])}),(0,ne.FD)("p",{className:Tl,children:[(0,Mt.A)(p("RevenueSharingAdsInfo4Subtitle2",""),["simple_markdown"]),(0,ne.Y)(us.A,{url:p("PromoteUrl"),text:p("LearnMoreArrow")})]})]})}},[a,p,f,t]);return m?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Sl.A,{isOpen:a,listItemData:S?.listItemData,headerIconName:"channel",headerIconPremiumGradient:!0,withSeparator:!0,header:S?.header,footer:S?.footer,buttonText:p("RevenueSharingAdsUnderstood"),onClose:y}),A&&c&&(0,ne.Y)(Dl.A,{isOpen:v,anchor:A,triggerRef:o,randomId:c,additionalInfo:d,canReport:l,sponsorInfo:h,shouldSkipAbout:!0,onItemClick:y,onClose:C,onCloseAnimationEnd:b})]}):(0,ne.FD)(te.A,{isOpen:a,className:"LFkgLoAk",contentClassName:"TZE15Pt_",onClose:y,children:[g,(0,ne.Y)(X.A,{onClick:y,children:p("RevenueSharingAdsUnderstood")})]})})),Ll="t9iZUzOj",xl=(0,n.ph)(({isOpen:e,onClose:t})=>{const i=(0,B.A)(),s=(0,Bi.A)(),o=(0,n.Kr)(()=>{const e=i("LearnMore");return s("ChannelEarnLearnCoinAbout",{link:(0,ne.FD)(us.A,{url:i("MonetizationInfoTONLink"),text:e,children:[e,(0,ne.Y)(he.A,{name:"next"})]})},{withNodes:!0})},[s,i]),a=(0,n.Kr)(()=>s("MonetizationInfoTONTitle",void 0,{withNodes:!0,specialReplacement:{"💎":(0,ne.Y)(he.A,{className:"ATkOSqJ7",name:"toncoin"})}}),[s]),r=(0,n.Kr)(()=>{if(e)return{header:(0,ne.Y)("h3",{className:Ll,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,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:Ll,children:a}),(0,ne.Y)("p",{className:"mjveZmdr",children:o})]})}},[e,i,a,o]);if(r)return(0,ne.Y)(Sl.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 Rl=i(15535);const El="oofoCYlu",Vl=(0,n.ph)((0,s.EK)(e=>{const{twoFaSettings:{hint:t}}=e;return{passwordHint:t}})(({modal:e,passwordHint:t})=>{const{closeMonetizationVerificationModal:i,clearMonetizationVerificationError:o,processMonetizationRevenueWithdrawalUrl:a}=(0,s.ko)(),r=Boolean(e),l=(0,Ii.A)(e),c=(0,Bi.A)(),[d,h]=(0,n.J0)(!1),u=(0,T.A)(e=>{l&&a({peerId:l.chatId,currentPassword:e})}),m=(0,T.A)(()=>{o()}),p=(0,T.A)(()=>{i()});return(0,ne.Y)(te.A,{isOpen:r,hasCloseButton:!0,title:c("CheckPasswordTitle"),className:"WqeWhMAS",contentClassName:El,onClose:p,children:(0,ne.Y)("div",{className:(0,ve.A)(El,"settings-content password-form custom-scroll"),children:(0,ne.Y)("div",{className:"settings-item pt-0",children:(0,ne.Y)(Rl.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})})})})})),_l={content:"MKdSUg2P",chatItem:"qEIwBtp0"},Ul=(0,n.ph)((0,s.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:o,isAccountFrozen:a})=>{const{closeEmojiStatusAccessModal:r,toggleUserEmojiStatusPermission:c,sendWebAppEvent:d,openPremiumModal:h,loadDefaultStatusIcons:u}=(0,s.ko)(),m=Boolean(e),p=(0,B.A)(),g=(0,Bi.A)(),v=(0,n.li)(),[A,f]=(0,n.J0)(0);(0,n.vJ)(()=>{!m||i?.stickers||a||u()},[m,i,a]);const C=(0,n.Kr)(()=>{if(t&&i?.stickers)return{...t,emojiStatus:{type:"regular",documentId:i.stickers[A].id}}},[t,i,A]),b=i?.stickers?.length;(0,Ds.A)(()=>{b&&f(e=>(e+1)%b)},b?3200:void 0);const y=(0,T.A)(()=>(0,ne.Y)(xn.A,{withEmojiStatus:!0,className:_l.chatItem,itemClassName:_l.itemName,mockPeer:C})),S=(0,T.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&(o?(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,T.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}),o&&c({botId:e.bot.id,isEnabled:!1}))}),N=(0,T.A)(()=>{if(e?.bot)return g("EmojiStatusAccessText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,ne.FD)(te.A,{className:(0,ve.A)("confirm"),contentClassName:_l.content,isOpen:m,onClose:k,children:[y(),(0,ne.FD)("div",{children:[N(),(0,ne.FD)("div",{className:"dialog-buttons mt-2",ref:v,children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:S,color:"primary",children:p("lng_bot_allow_write_confirm")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:k,children:g("Cancel")})]})]})]})})),Ol=(0,n.ph)((0,s.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({modal:e,currentUser:t})=>{const{closeLocationAccessModal:i,toggleUserLocationPermission:o,sendWebAppEvent:a,showNotification:r}=(0,s.ko)(),c=Boolean(e),d=(0,B.A)(),h=(0,Bi.A)(),m=(0,n.li)(),p=(0,T.A)(async()=>{if(!e?.bot?.id)return;const t=await(0,u.Bu)(),{accessRequested:n,accessGranted:s,geolocation:l}=t,c=n&&s&&Boolean(l);if(i(),e?.webAppKey){if(o({botId:e.bot.id,isAccessGranted:c}),!c||!l)return a({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}}),void r({message:d("PermissionNoLocationPosition")});a({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!0,latitude:l.latitude,longitude:l.longitude,altitude:l.altitude,course:l.heading,speed:l.speed,horizontal_accuracy:l.accuracy,vertical_accuracy:l.altitudeAccuracy,course_accuracy:null,speed_accuracy:null}}})}}),g=(0,T.A)(()=>{e?.bot?.id&&(i(),e?.webAppKey&&(o({botId:e.bot.id,isAccessGranted:!1}),a({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}})))}),v=(0,T.A)(()=>{if(e?.bot)return(0,ne.FD)("div",{className:"CGPoDaLo",children:[(0,ne.Y)(Tt.A,{size:"large",peer:t}),(0,ne.Y)(he.A,{name:"next",className:"pzERgD5x"}),(0,ne.Y)(Tt.A,{size:"large",peer:e.bot})]})}),A=(0,T.A)(()=>{if(e?.bot)return h("LocationPermissionText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,ne.FD)(te.A,{className:(0,ve.A)("confirm"),isOpen:c,onClose:g,children:[v(),(0,ne.FD)("div",{children:[A(),(0,ne.FD)("div",{className:"dialog-buttons mt-2",ref:m,children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",children:d("lng_bot_allow_write_confirm")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:g,children:h("Cancel")})]})]})]})})),Kl="qJDgUtjV",Jl=(0,n.ph)(({modal:e})=>{const{reportSponsored:t,closeReportAdModal:i,openPreviousReportAdModal:o}=(0,s.ko)(),a=(0,B.A)(),l=Boolean(e),c=(0,n.li)(),d=(0,T.A)((i,n)=>{const{chatId:s,randomId:o}=e;t({peerId:s,randomId:o,option:n})}),[h,u]=(0,n.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e.sections[t],t]},[e]),m=(0,T.A)(()=>{u?o():i()}),p=(0,n.Kr)(()=>{if(!e)return;const t=a("lng_report_sponsored_reported_learn").split("{link}");return[t[0],(0,ne.Y)(us.A,{text:a("lng_report_sponsored_reported_link"),url:a("ReportAd.Help_URL")}),t[1]]},[a,e]),g=(0,n.Kr)(()=>{if(!e)return;const t=Boolean(h?.subtitle);return(0,ne.FD)("div",{className:"modal-header-condensed",children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:a(u?"Back":"Close"),onClick:m,iconName:u?"arrow-left":"close"}),(0,ne.FD)("div",{className:(0,ve.A)("modal-title","ZAdG13Ah",t&&"lVVyV0py"),children:[(0,ne.Y)("h3",{className:"mMmY6YR4",children:a("ReportAd")}),t&&(0,ne.Y)("span",{className:"gSkAFc4u",children:h.subtitle})]})]})},[a,e,u,h?.subtitle]);(0,n.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 v=(0,T.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,ne.Y)(te.A,{isOpen:l,hasCloseButton:!0,className:"njPBcVYr",header:g,onClose:i,children:(0,ne.FD)(ae.Ay,{name:"slide",className:"HjsGIG6e",ref:c,activeKey:u,onStart:v,children:[(0,ne.FD)("div",{className:Kl,children:[(0,ne.Y)("h3",{className:"jrA2dOiw",children:h?.title}),h?.options.map(e=>(0,ne.Y)(ui.A,{narrow:!0,secondaryIcon:"next",className:"aFbjDzNo",buttonClassName:"VbE0HzDs",clickArg:e.option,onClick:d,children:(0,ne.Y)("div",{className:"oWujoaSC",children:e.text})}))]}),(0,ne.Y)("p",{className:"k71Zrc_P",children:p})]})})}),jl="kq9LwNTZ",Gl=(0,n.ph)(({modal:e})=>{const{reportMessages:t,reportStory:i,closeReportModal:o,openPreviousReportModal:a}=(0,s.ko)(),l=(0,B.A)(),c=Boolean(e),d=(0,n.li)(),[h,u]=(0,n.J0)(""),m=(0,T.A)((n,s)=>{const{messageIds:o,subject:a,peerId:r,chatId:l}=e;if(o)switch(a){case"message":t({chatId:l,messageIds:o,option:s});break;case"story":i({storyId:o[0],peerId:r,option:s})}}),[p,g]=(0,n.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e?.sections[t],t]},[e]),v=(0,T.A)(()=>{a()}),A=(0,T.A)(()=>{o()}),f=(0,n.Kr)(()=>{if(!e)return;const t=Boolean(p?.subtitle);return(0,ne.FD)("div",{className:"modal-header-condensed",children:[g?(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:l("Back"),onClick:v,iconName:"arrow-left"}):(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:l("Close"),onClick:A,iconName:"close"}),(0,ne.FD)("div",{className:(0,ve.A)("modal-title","Lj_ezEWU",t&&"OYFbu8fQ"),children:[(0,ne.Y)("h3",{className:(0,ve.A)("QawchdxB",g&&"CV7kzv9H"),children:p?.options?l("story"===e?.subject?"ReportStory":"Report"):p?.title}),t&&(0,ne.Y)("span",{className:"OUFckTb7",children:p.subtitle})]})]})},[l,e,g,p?.options,p?.subtitle,p?.title]),C=(0,T.A)(e=>{u(e.target.value)});(0,n.vJ)(()=>{if(!e)return;const t=document.querySelector(`.${ae.uo} > .${jl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${i}px`})},[e]);const b=(0,T.A)(()=>{const e=document.querySelector(`.${ae.VY} > .${jl}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${t+20}px`})})}),y=(0,T.A)(()=>{u(""),o()}),S=(0,T.A)(()=>{const{messageIds:n,subject:s,peerId:o,chatId:a}=e;switch(s){case"message":t({chatId:a,messageIds:n,option:p?.option,description:h});break;case"story":i({storyId:n?.[0],peerId:o,option:p?.option,description:h})}y()});return(0,ne.Y)(te.A,{isOpen:c,header:f,onClose:y,contentClassName:"tNysQgHL",className:(0,ve.A)("E1bGWeON","story"===e?.subject&&"component-theme-dark"),children:(0,ne.Y)(ae.Ay,{name:"slide",className:"n2VxPirU",ref:d,activeKey:g,onStart:b,children:(0,ne.FD)("div",{className:jl,children:[p?.options?(0,ne.Y)("h3",{className:"GSfUuTet",children:p?.title}):void 0,p?.options?.map(e=>(0,ne.Y)(ui.A,{narrow:!0,nonInteractive:!0,secondaryIcon:"next",className:"RoxwMzvA",buttonClassName:"Z6skYdvb",clickArg:e.option,onClick:m,children:(0,ne.Y)("div",{className:"FU8m6NUU",children:e.text})})),p?.option?(0,ne.FD)("div",{className:"KpptZ3Mk",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Report,size:100,className:"kO8JC4gK",nonInteractive:!0,forceAlways:!0,noLoop:!1}),(0,ne.Y)(Is.A,{id:"option",className:"yc3szGcx",label:p.isOptional?l("Report2CommentOptional"):l("Report2Comment"),onChange:C,value:h,maxLength:512,maxLengthIndicator:(512-h.length).toString(),noReplaceNewlines:!0}),(0,ne.Y)(X.A,{onClick:S,disabled:p.isOptional?void 0:!h.length,children:l("ReportSend")})]}):void 0]})})})});var Hl=i(65632),zl=i(18444);const $l=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:n,patternColor:s,background:o,backgroundColor:a}=(0,c.Gyz)(e,i)||{};return{theme:i,isBackgroundBlurred:n,patternColor:s,customBackground:o,backgroundColor:a,bot:t?(0,c.mBe)(e,t?.botId):void 0,currentUserId:e.currentUserId}})(({modal:e,theme:t,isBackgroundBlurred:i,patternColor:o,customBackground:a,backgroundColor:r,bot:c})=>{const{closePreparedInlineMessageModal:d,sendWebAppEvent:h,openSharePreparedMessageModal:u}=(0,s.ko)(),m=(0,Bi.A)(),p=Boolean(e),{webAppKey:g,message:v,botId:A}=e||{},f=(0,n.li)(),C=(0,Hl.A)(t,a),b=(0,T.A)(()=>{g&&A&&v&&(u({webAppKey:g,message:v}),d())}),y=(0,T.A)(()=>{d(),g&&h({webAppKey:g,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),S=(0,n.Kr)(()=>{if(e)return(0,ne.FD)("div",{className:"P1fPh6h8",children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:y,iconName:"close"}),(0,ne.Y)("h3",{className:(0,ve.A)("modal-title","E42tgAwD"),children:m("BotShareMessage")})]})},[m,e]),k=(0,n.Kr)(()=>{if(A&&v&&g)return(0,l.i7)(A,v)},[A,v,g]),N=(0,ve.A)("_6w75ldP","lElCwweL",a&&"CZkpv8n0",r&&"VJAYrDF_",a&&i&&"m8xzfVvU");return(0,ne.FD)(te.A,{dialogRef:f,isOpen:p,header:S,onClose:y,className:"Rzj2LMLf",contentClassName:"Ve4u2KVI",children:[(0,ne.FD)("div",{className:(0,ve.A)("McJgXCtB","MessageList"),inert:!0,style:(0,ot.A)(`--pattern-color: ${o}`,r&&`--theme-background-color: ${r}`),children:[(0,ne.Y)("div",{className:N,style:C?`--custom-background: ${C}`:void 0}),k&&(0,ne.Y)(zl.A,{message:k,threadId:j.l3,messageListType:"thread",noComments:!0,noReplies:!0,appearanceOrder:0,isJustAdded:!1,isFirstInGroup:!0,isLastInGroup:!0,isLastInList:!1,isFirstInDocumentGroup:!1,isLastInDocumentGroup:!1},A)]}),(0,ne.FD)("div",{className:"pNSCKAVN",children:[(0,ne.Y)("p",{className:"xWnXsG7q",children:m("WebAppShareMessageInfo",{user:(0,l.Yg)(c)})}),(0,ne.Y)(X.A,{onClick:b,children:m("BotShareMessageShare")})]})]})}));var ql=i(20247),Wl=i(48227);const Ql=(0,n.ph)((0,s.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:o})=>{const{closeSharePreparedMessageModal:a,sendInlineBotResult:r,sendWebAppEvent:l,showNotification:d,updateSharePreparedMessageModalSendArgs:h}=(0,s.ko)(),u=(0,B.A)(),m=Boolean(e),[p,g,v]=(0,D.A)();(0,n.vJ)(()=>{m&&g()},[m,g]);const{message:A,filter:f,webAppKey:C,pendingSendArgs:b}=e||{},{starsForSendMessage:y}=b||{},{closeConfirmDialog:S,dialogHandler:k,shouldAutoApprove:N,setAutoApprove:w,handleWithConfirmation:I}=(0,ql.A)(y||0,i,o),P=(0,T.A)(()=>{a(),C&&l({webAppKey:C,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),Y=(0,T.A)((e,t)=>{if(A&&C){const i=(0,s.mS)(),n=(0,c.PVB)(i,e);r({chatId:e,threadId:t||j.l3,id:A.result.id,queryId:A.result.queryId}),y||d({message:u("BotSharedToOne",(0,Dt.F9)(u,n))}),l({webAppKey:C,event:{eventType:"prepared_message_sent"}}),a(),h({args:void 0})}}),F=(0,T.A)((e,t)=>{h({args:{peerId:e,threadId:t}})}),M=(0,T.A)(()=>{b&&I(Y,b.peerId,b.threadId)}),L=(0,T.A)(()=>{S(),h({args:void 0})});(0,n.vJ)(()=>{b&&M()},[b]);const x=(0,s.mS)(),R=b?(0,c.PVB)(x,b.peerId):void 0,E=R?(0,Dt.F9)(u,R):void 0;if(m||p)return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Xn,{isOpen:m,title:u("SelectChat"),searchPlaceholder:u("Search"),filter:f,onSelectRecipient:F,onClose:P,onCloseAnimationEnd:v,isLowStackPriority:!0}),(0,ne.Y)(Wl.A,{isOpen:t,onClose:L,userName:E,messagePriceInStars:y||0,messagesCount:1,shouldAutoApprove:N,setAutoApprove:w,confirmHandler:k})]})})),Zl={content:"iGABsB4C",modalHeader:"Ofq4u4pq",section:"k44LZ99u",form:"VhNBPaMY",label:"anDcU5bi",input:"kYxuUcwe",description:"A_JjwhXv",timeInputIcon:"pHne2E6K",offerButton:"d_PCM2tC",currencySelector:"genSNudF",currencyIcon:"fT5aRs0H"},Xl=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=e.stars?.balance,n=t?(0,c.PVB)(e,t.chatId):void 0,s=t?(0,En.GA)(e,t.chatId,j.l3):void 0,{appConfig:o}=e,a=o.starsSuggestedPostAmountMax,r=o.starsSuggestedPostAmountMin,l=o.starsSuggestedPostAgeMin,d=o.starsSuggestedPostFutureMin,h=o.starsSuggestedPostFutureMax,u=o.tonSuggestedPostAmountMax,m=o.tonSuggestedPostAmountMin,p=!!t&&(0,c.ODG)(e,t.chatId);return{peer:n,starBalance:i,tonBalance:e.ton?.balance?.amount,currentDraft:s,maxStarsAmount:a,minStarsAmount:r,tonMaxAmount:u,tonMinAmount:m,ageMinSeconds:l,futureMin:d,futureMax:h,isMonoforumAdmin:p}})(({modal:e,starBalance:t,tonBalance:i,peer:o,currentDraft:r,maxStarsAmount:l,minStarsAmount:c,tonMaxAmount:d,tonMinAmount:h,ageMinSeconds:u,futureMin:m,futureMax:p,isMonoforumAdmin:g})=>{const{closeSuggestMessageModal:v,updateDraftSuggestedPostInfo:A,openStarsBalanceModal:f}=(0,s.ko)(),[C,b,y]=(0,D.A)(),S=r?.suggestedPostInfo,k=r?.replyInfo,N=Boolean(k),[w,I]=(0,n.J0)(S?.price?.amount||void 0),[P,Y]=(0,n.J0)(S?.price?.currency||a.OUy),[F,M]=(0,n.J0)(S?.scheduleDate?1e3*S.scheduleDate:void 0);(0,n.vJ)(()=>{const e=S?.price,t=e?.currency===a.ykW?(0,wo.wD)(e.amount):e?.amount;I(t),Y(S?.price?.currency||a.OUy),M(S?.scheduleDate?1e3*S.scheduleDate:void 0)},[S]);const L=(0,Bi.A)(),x=(0,B.A)(),R=P===a.OUy,E=(0,Di.Fm)(),V=1e3*(E+m),_=1e3*(E+p),U=1e3*(E+2*m),O=(0,T.A)(e=>{const t=e.target.value,i=parseFloat(t),n=""===t||Number.isNaN(i)?void 0:Math.min(Math.max(i,0),G);I(n)}),K=(0,T.A)(e=>{M(e.getTime()),y()}),J=(0,T.A)(()=>{M(void 0),y()}),j=R?c:(0,wo.wD)(h),G=R?l:(0,wo.wD)(d),H=Boolean(w)&&w<j,z=(0,T.A)(()=>{const e=w?R?w:(0,wo.tT)(w):0;if(!H){if(!g)if(R){if(e>(t?.amount||0))return void f({topup:{balanceNeeded:e}})}else if(e>(i||0))return void f({currency:a.ykW});A({price:{currency:P,amount:e,nanos:0},scheduleDate:F?Math.max(F/1e3,(0,Di.Fm)()+m+60):void 0}),v()}});return(0,ne.Y)(te.A,{headerClassName:Zl.modalHeader,isOpen:Boolean(e),onClose:v,isSlim:!0,isLowStackPriority:!0,hasCloseButton:!0,contentClassName:Zl.content,title:L(N?"TitleSuggestedChanges":"TitleSuggestMessage"),children:(0,ne.FD)("div",{className:Zl.form,children:[(0,ne.FD)("div",{className:Zl.section,children:[(0,ne.FD)("div",{className:Zl.currencySelector,children:[(0,ne.FD)(X.A,{className:Zl.currencyButton,color:R?"primary":"translucent",pill:!0,fluid:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(a.OUy),children:[(0,ne.Y)(he.A,{name:"star",className:Zl.currencyIcon}),L("CurrencyStars")]}),(0,ne.FD)(X.A,{className:Zl.currencyButton,fluid:!0,color:R?"translucent":"primary",pill:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(a.ykW),children:[(0,ne.Y)(he.A,{name:"toncoin",className:Zl.currencyIcon}),L("CurrencyTon")]})]}),(0,ne.Y)(ee.A,{label:L("InputPlaceholderPrice"),className:(0,ve.A)(Zl.input),value:w?.toString(),onChange:O,inputMode:"numeric",tabIndex:0,teactExperimentControlled:R}),(0,ne.Y)("div",{className:Zl.description,children:void 0!==w&&w>0&&w<j?L("DescriptionSuggestedPostMinimumOffer",{amount:R?(0,Fi.Kk)(L,j):(0,Fi.QH)(L,j)},{withNodes:!0,withMarkdown:!0}):L(R?"SuggestMessagePriceDescriptionStars":"SuggestMessagePriceDescriptionTon")})]}),(0,ne.FD)("div",{className:Zl.section,children:[(0,ne.FD)("div",{className:(0,ve.A)(Zl.input,"input-group","touched"),children:[(0,ne.Y)("input",{type:"text",className:(0,ve.A)("form-control",C&&"focus"),value:F?(0,et.e0)(F/1e3,L,x):L("SuggestMessageAnytime"),autoComplete:"off",onClick:b,onFocus:b,readOnly:!0}),(0,ne.Y)("label",{children:L("InputTitleSuggestMessageTime")}),(0,ne.Y)(he.A,{name:"down",className:Zl.timeInputIcon})]}),(0,ne.Y)("div",{className:Zl.description,children:L("SuggestMessageTimeDescription",{hint:L("SuggestMessageDateTimeHint"),duration:(0,et.A$)(L,u,!0)})})]}),(0,ne.Y)(ks,{isOpen:C,isFutureMode:!0,withTimePicker:!0,minAt:V,maxAt:_,onClose:y,onSubmit:K,selectedAt:F||U,submitButtonLabel:L("Save"),secondButtonLabel:L("SuggestMessageAnytime"),onSecondButtonClick:J,description:L("SuggestMessageDateTimeHint")}),(0,ne.Y)(X.A,{className:Zl.offerButton,onClick:z,disabled:H,inline:!0,children:N?L("ButtonUpdateTerms"):w?L("ButtonOfferAmount",{amount:R?(0,Fi.U2)(L,w,{asFont:!0}):(0,Fi.Ms)(L,w)},{withNodes:!0,withMarkdown:!0}):L("ButtonOfferFree")})]})})})),ec="xqyFGV8R",tc=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t&&(0,c.O5q)(e,t.chatId,t.messageId),n=i?(0,c.Y7C)(e,i):void 0,s=t&&(0,c.ODG)(e,t.chatId),{appConfig:o}=e,a=o.starsSuggestedPostCommissionPermille,r=o.tonSuggestedPostCommissionPermille,l=o.starsSuggestedPostAgeMin,d=o.starsSuggestedPostFutureMin,h=o.starsSuggestedPostFutureMax,u=i?.suggestedPostInfo?.scheduleDate;return{minAge:l,futureMin:d,futureMax:h,message:i,sender:n,isAdmin:s,commissionPermille:a,tonCommissionPermille:r,scheduleDate:u}})(({modal:e,message:t,sender:i,isAdmin:o,commissionPermille:r,tonCommissionPermille:l,minAge:c,futureMin:d,futureMax:h,scheduleDate:u})=>{const{closeSuggestedPostApprovalModal:m,approveSuggestedPost:p}=(0,s.ko)(),g=(0,Bi.A)(),v=(0,B.A)(),[A,f,C]=(0,D.A)(),b=(0,Di.Fm)(),y=1e3*(b+d),S=1e3*(b+h),k=b+2*d,[N,w]=(0,n.J0)(k),I=(0,T.A)(()=>{m()}),P=(0,T.A)(t=>{e&&(p({chatId:e.chatId,messageId:e.messageId,scheduleDate:t}),m())}),Y=(0,T.A)(e=>{const t=Math.floor(e.getTime()/1e3);w(t)}),F=(0,T.A)(e=>{const t=Math.floor(e.getTime()/1e3);C(),P(t)}),M=(0,T.A)(()=>{C(),P()}),L=(0,T.A)(()=>{u?P(u):f()});if(!e||!t)return;const x=i?(0,Dt.em)(v,i):"";return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(ci.A,{isOpen:Boolean(e)&&!A,onClose:I,title:g("SuggestedPostConfirmTitle"),confirmHandler:L,confirmLabel:g(u?"ButtonPublish":"Next"),children:(()=>{const e=t?.suggestedPostInfo?.price,i=e?.amount,n=e?.currency||a.OUy,s=g("SuggestedPostConfirmMessage",{peer:x},{withNodes:!0,withMarkdown:!0}),d=(0,Mt.A)(s);if(!i)return d;const h=(n===a.ykW?l:r)/10,m=i/100*h,p=n===a.ykW?(0,Fi.QH)(g,(0,wo.wD)(m)):(0,Fi.Kk)(g,m),A=c,f=(0,et.A$)(g,A,!0);if(u){const e=(0,et.e0)(u,g,v),t=o?"SuggestedPostConfirmDetailsWithTimeAdmin":"SuggestedPostConfirmDetailsWithTimeUser";return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{children:d}),(0,ne.Y)("div",{className:ec,children:(0,Mt.A)(g(t,{amount:p,commission:h,duration:f,time:e},{withNodes:!0,withMarkdown:!0}))})]})}const C=o?"SuggestedPostConfirmDetailsAdmin":"SuggestedPostConfirmDetailsUser";return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{children:d}),(0,ne.Y)("div",{className:ec,children:(0,Mt.A)(g(C,{amount:p,commission:h,duration:f},{withNodes:!0,withMarkdown:!0}))})]})})()}),(0,ne.Y)(ks,{isOpen:A,isFutureMode:!0,withTimePicker:!0,minAt:y,maxAt:S,onClose:C,onSubmit:F,onDateChange:Y,selectedAt:1e3*N,submitButtonLabel:g("ButtonPublishAtTime",{time:(0,et.e0)(N,g,v)}),secondButtonLabel:g("PublishNow"),onSecondButtonClick:M,description:g("SuggestMessageDateTimeHint")})]})})),ic=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],nc=[...ic,"sendPlain"];function sc(e){const[t,i]=(0,n.J0)({}),[s,o]=(0,n.J0)(!1),[a,r]=(0,n.J0)(!1);(0,n.vJ)(()=>{i(e||{}),o(!1),setTimeout(()=>{r(!1)},250)},[e]);const l=(0,n.hb)(n=>{const{name:s}=n.target,a=s;function r(e){return!e||void 0}const l=t;let c={...l,[a]:r(l[a]),..."sendStickers"===a&&{sendGifs:r(l[a])}};const d=()=>{const e=ic.map(e=>c[e]);e.some(e=>!e)?c={...c,sendMedia:void 0}:e.every(Boolean)&&(c={...c,sendMedia:!0})};"sendMedia"!==a?d():c={...c,...ic.reduce((e,t)=>Object.assign(e,{[t]:c.sendMedia}),{})},"embedLinks"!==a&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==a&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==a&&d();const h=nc.every(e=>c[e]);c={...c,sendMessages:!!h||void 0},i(c),o(!e||Object.keys(c).some(t=>{const i=t;return Boolean(e[i])!==Boolean(c[i])}))},[e,t]),c=(0,n.hb)(()=>{i(e||{}),o(!1)},[e]);return{permissions:t,isLoading:a,havePermissionChanged:s,handlePermissionChange:l,setIsLoading:r,resetPermissions:c}}const oc=["sendPhotos","sendVideos","sendStickers","sendAudios","sendDocs","sendVoices","sendRoundvideos","embedLinks","sendPolls"],ac=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=t?(0,c.hds)(e,t):void 0,n=i&&(0,c.AWZ)(e,i.id);return{chat:i,hasLinkedChat:Boolean(n?.linkedChatId)}})(({chat:e,isMediaDropdownOpen:t,hasLinkedChat:i,permissions:o,className:a,shiftedClassName:r,dropdownClassName:c,withCheckbox:d,permissionGroup:h,setIsMediaDropdownOpen:u,handlePermissionChange:m,getControlIsDisabled:p})=>{const{showNotification:g}=(0,s.ko)(),{isForum:v}=e||{},A=(0,Bi.A)(),f=(0,n.Kr)(()=>e&&(0,l.gA)(e),[e]),C=i||f,b=(0,n.Kr)(()=>oc.reduce((e,t)=>(o[t]||(e+=1),e),0),[o]),S=(0,T.A)(e=>{(0,y.A)(e),u(!t)}),k=(0,T.A)(()=>{g({message:A("ChatPermissionNotAvailable")})});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendPlain",checked:!o.sendPlain,label:A("UserRestrictionsSend"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendPlain")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendMedia",checked:!o.sendMedia,label:A("UserRestrictionsSendMedia"),labelText:`${b}/${oc.length}`,blocking:!0,permissionGroup:h,rightIcon:t?"up":"down",onChange:m,onClickLabel:S,disabled:p&&p("sendMedia")})}),(0,ne.Y)("div",{className:c,children:(0,ne.FD)("div",{className:a,children:[(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendPhotos",checked:!o.sendPhotos,label:A("SendMediaPermissionPhotos"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendPhotos")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendVideos",checked:!o.sendVideos,label:A("SendMediaPermissionVideos"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendVideos")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendStickers",checked:!o.sendStickers&&!o.sendGifs,label:A("SendMediaPermissionStickersGifs"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendStickers")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendAudios",checked:!o.sendAudios,label:A("SendMediaPermissionAudios"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendAudios")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendDocs",checked:!o.sendDocs,label:A("SendMediaPermissionFiles"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendDocs")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendVoices",checked:!o.sendVoices,label:A("SendMediaPermissionVoices"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendVoices")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendRoundvideos",checked:!o.sendRoundvideos,label:A("SendMediaPermissionRoundVideos"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendRoundvideos")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"embedLinks",checked:!o.embedLinks,label:A("SendMediaPermissionWebPages"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("embedLinks")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"sendPolls",checked:!o.sendPolls,label:A("SendMediaPermissionPolls"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("sendPolls")})})]})}),(0,ne.FD)("div",{className:r,children:[(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"inviteUsers",checked:!o.inviteUsers,label:A("UserRestrictionsInviteUsers"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("inviteUsers")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),onClick:C?k:void 0,children:(0,ne.Y)(es.A,{name:"pinMessages",checked:!o.pinMessages,label:A("UserRestrictionsPinMessages"),disabled:p?p("pinMessages"):C,blocking:!0,permissionGroup:h,onChange:m})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"editRank",checked:!o.editRank,label:A("UserRestrictionsEditRank"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("editRank")})}),(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),onClick:C?k:void 0,children:(0,ne.Y)(es.A,{name:"changeInfo",checked:!o.changeInfo,label:A("UserRestrictionsChangeInfo"),blocking:!0,permissionGroup:h,disabled:p?p("changeInfo"):C,onChange:m})}),v&&(0,ne.Y)("div",{className:(0,ve.A)("ListItem",d&&"with-checkbox"),children:(0,ne.Y)(es.A,{name:"manageTopics",checked:!o.manageTopics,label:A("UserRestrictionsCreateTopics"),blocking:!0,permissionGroup:h,onChange:m,disabled:p&&p("manageTopics")})})]})]})}));var rc=i(77561);const lc="yGhFKTl5",cc="goI3MITH",dc=(0,n.ph)((0,s.EK)(e=>{const{deleteMessageModal:t}=(0,c.nTw)(e),i=t?.messageIds,n=t?.chatId,{canDeleteForAll:s}=(0,c.jyG)(e,i),o=n?(0,c.hds)(e,n):void 0,a=o&&(0,c.AWZ)(e,o.id),r=a?.linkedChatId,d=Boolean(o)&&(0,l.WX)(o),h=Boolean(o)&&(0,l.Vs)(o),u=t?.isSchedule,m=t?.onConfirm,p=n&&(0,g.L8)(n)?(0,l.u0)((0,c.mBe)(e,n)):void 0,v=Boolean(o&&!(0,l.DX)(o.id)&&(0,c.yps)(e,o.id)),A=a?.adminMembersById,f=o&&(0,l.ub)(o,"banUsers")&&!o.isMonoforum,C=o?.isCreator,b=n?(0,c.ALW)(e,n):void 0,y=o&&(0,l.yn)(o)&&!s||b,S=o&&((0,l.Vs)(o)||d);return{chat:o,isChannel:d,isSuperGroup:h,messageIds:i,currentUserId:e.currentUserId,canDeleteForAll:!u&&s,contactName:p,willDeleteForCurrentUserOnly:y,willDeleteForAll:S,adminMembersById:A,chatBot:v,canBanUsers:f,linkedChatId:r,isSchedule:u,isCreator:C,onConfirm:m}})(({isOpen:e,chat:t,isChannel:i,isSuperGroup:o,isSchedule:a,currentUserId:r,messageIds:l,isCreator:d,canDeleteForAll:h,contactName:u,willDeleteForCurrentUserOnly:m,willDeleteForAll:p,chatBot:g,adminMembersById:v,canBanUsers:A,linkedChatId:f,onConfirm:C})=>{const{closeDeleteMessageModal:b,deleteMessages:y,reportChannelSpam:S,deleteChatMember:k,deleteScheduledMessages:N,exitMessageSelectMode:w,updateChatMemberBannedRights:I,deleteParticipantHistory:P}=(0,s.ko)(),Y=(0,K.A)(e),F=(0,B.A)(),D=(0,Bi.A)(),{permissions:M,havePermissionChanged:L,handlePermissionChange:x,resetPermissions:R}=sc(t?.defaultBannedRights),[E,V]=(0,n.J0)([]),[_,U]=(0,n.J0)([]),[O,J]=(0,n.J0)([]),[j,G]=(0,n.J0)(!1),[H,z]=(0,n.J0)(!1),[$,q]=(0,n.J0)(!0),W=(0,n.Kr)(()=>{if(i||!l||!t)return gi.p;const e=(0,s.mS)(),n=(0,c.SpN)(e,t.id,l);return n?(0,pi.Am)(n).filter(e=>e?.id!==t?.id&&e?.id!==f&&e?.id!==t?.linkedMonoforumId):gi.p},[t,i,f,l]),Q=(0,T.A)(()=>W.map(e=>({value:e.id,label:(0,Dt.F9)(D,e)||"",leftElement:(0,ne.Y)(Tt.A,{size:"small",peer:e})}))),Z=(0,n.Kr)(()=>W.filter(e=>e.id!==f&&e.id!==t?.linkedMonoforumId&&e.id!==r),[W,r,f,t?.linkedMonoforumId]),ee=(0,n.Kr)(()=>W.filter(e=>e.id!==r&&e.id!==f&&e.id!==t?.linkedMonoforumId),[W,r,f,t?.linkedMonoforumId]),ie=(0,n.Kr)(()=>{const e=W.some(e=>e.id===r);return!A||e?gi.p:W.filter(e=>{const t=v?.[e.id];return d||!t})},[W,d,r,A,v]),se=(0,n.Kr)(()=>Boolean(Z.length||ee.length||ie.length),[Z,ee,ie])&&!h&&!a&&o,oe=(0,n.Kr)(()=>!W||a?{}:(0,pi.pA)(W,e=>[e.id,(0,Dt.F9)(D,e)]),[a,D,W]),ae=(0,n.Kr)(()=>[{value:l&&W.length>=2?"spam":W?.[0]?.id,label:F("ReportSpamTitle"),nestedOptions:l&&W.length>=2?[...Q().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,f,t?.linkedMonoforumId,r]),re=(0,n.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?[...Q().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,oe,f,t?.linkedMonoforumId,r]),le=(0,n.Kr)(()=>[{value:l&&W.length>=2?"ban":W?.[0]?.id,label:l&&W.length>=2?F(H?"DeleteRestrictUsers":"DeleteBanUsers"):H?F("KickFromSupergroup"):F("DeleteBan",Object.values(oe)[0]),nestedOptions:l&&W.length>=2?[...Q()]:void 0}],[H,F,l,W,oe]),ce=(0,T.A)(()=>{z(e=>!e)}),de=(0,T.A)((e,i)=>{if(!t)return gi.p;const n=(0,s.mS)();return i.filter(i=>{const s=(0,c.LM$)(n,t.id,i);return s&&e.includes(s.id)})}),ue=(0,T.A)(e=>{Object.entries(e).forEach(([e,i])=>{i.length&&S({participantId:e,chatId:t.id,messageIds:i})})}),me=(0,T.A)(e=>{y({messageIds:e,shouldDeleteForAll:!0})}),pe=(0,T.A)(e=>{t&&e.forEach(e=>{P({peerId:e,chatId:t.id})})}),ge=(0,T.A)(e=>{e.forEach(e=>{k({chatId:t.id,userId:e})})}),Ae=(0,T.A)(e=>{e.forEach(e=>{I({chatId:t.id,userId:e,bannedRights:M})})}),fe=(0,T.A)(()=>{if(t&&l){if(C?.(),a)N({messageIds:l});else if(se){if(O?.length){const e=(0,s.mS)(),i=O.filter(e=>!Number.isNaN(Number(e))),n=l.reduce((n,s)=>{const o=(0,c.LM$)(e,t.id,s);return o&&i.includes(o.id)&&(n[o.id]||(n[o.id]=[]),n[o.id].push(Number(s))),n},{});ue(n)}if(E?.length){const e=E.filter(e=>!Number.isNaN(Number(e)));pe(e)}if(_?.length&&!L){const e=_.filter(e=>!Number.isNaN(Number(e)));ge(e);const t=de(e,l);me(t)}if(_?.length&&L){const e=_.filter(e=>!Number.isNaN(Number(e)));Ae(e)}O?.length&&E?.length&&_?.length||y({messageIds:l,shouldDeleteForAll:$})}else y({messageIds:l,shouldDeleteForAll:$});b(),w()}}),Ce=(0,T.A)(()=>{b()});return(0,n.vJ)(()=>{!e&&Y&&(J([]),V([]),U([]),q(!0),G(!1),z(!1),R())},[e,Y,R]),(0,ne.Y)(te.A,{isOpen:e,onClose:Ce,onEnter:fe,className:"SeaF_shb",children:(0,ne.FD)("div",{className:"_YNfwDqt",children:[(0,ne.FD)("div",{className:se&&"axa67kqo",dir:D.isRtl?"rtl":void 0,children:[se&&(0,ne.Y)(Xi.A,{size:"small",peers:W}),(0,ne.Y)("h3",{className:(0,ve.A)(se?"U4IFhV0a":"qd6OFHiG"),children:F("Chat.DeleteMessagesConfirmation",l?.length)})]}),se&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("p",{className:lc,children:F("DeleteAdditionalActions")}),(0,ne.FD)("div",{className:"b6847Kh3",children:[(0,ne.Y)(rc.A,{options:ae,onChange:J,selected:O,nestedCheckbox:l&&W.length>=2}),Z?.length>0&&(0,ne.Y)(rc.A,{options:re,onChange:V,selected:E,nestedCheckbox:l&&W.length>=2}),ie?.length>0&&(0,ne.Y)(rc.A,{options:le,onChange:U,selected:_,nestedCheckbox:l&&W.length>=2})]}),(0,ne.FD)("div",{className:(0,ve.A)("iv0u9Zw6",H&&"qCQftA04"),children:[(0,ne.Y)("h3",{className:(0,ve.A)(lc,"t3KOsBfm"),children:F("UserRestrictionsCanDoUsers",W.length)}),(0,ne.Y)(ac,{withCheckbox:!0,chatId:t?.id,isMediaDropdownOpen:j,setIsMediaDropdownOpen:G,handlePermissionChange:x,permissions:M,className:(0,ve.A)("czTjjKim",j&&"Ifpyv7Jp")})]}),_?.length&&A?(0,ne.FD)(ui.A,{narrow:!0,buttonClassName:cc,onClick:ce,children:[F(H?"DeleteToggleBanUsers":"DeleteToggleRestrictUsers"),(0,ne.Y)(he.A,{name:H?"up":"down",className:(0,ve.A)(cc,"ml-2")})]}):z(!1)]}),(h||g||!se)&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("p",{children:l&&l.length>1?D("AreYouSureDeleteFewMessages"):D("AreYouSureDeleteSingleMessage")}),m&&(0,ne.Y)("p",{children:F("lng_delete_for_me_chat_hint",1,"i")}),p&&(0,ne.Y)("p",{children:F("lng_delete_for_everyone_hint",1,"i")})]}),h&&(0,ne.Y)(es.A,{className:"dialog-checkbox",label:u?(0,Mt.A)(F("DeleteMessagesOptionAlso",u)):F("Conversation.DeleteMessagesForEveryone"),checked:$,onCheck:q}),(0,ne.FD)("div",{className:(0,ve.A)("dialog-buttons",j?"JTT_DIRv":"L4YzeG91"),children:[(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:fe,children:se?F("DeleteProceedBtn"):D("Delete")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:Ce,children:F("Cancel")})]})]})})})),hc=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,g.L8)(t),n=(0,c.nZ4)(e,t),s=(0,c.hds)(e,t),o=Boolean(s)&&(0,l.WX)(s),a=Boolean(s)&&(0,l.yn)(s),r=Boolean(s)&&(0,l.Vs)(s);return{isPrivateChat:i,isChatWithSelf:n,isChannel:o,isGroup:a,isSuperGroup:r,canPinForAll:i&&!n||r||a,contactName:t&&(0,g.L8)(t)?(0,l.u0)((0,c.mBe)(e,t)):void 0}})(({isOpen:e,chatId:t,messageId:i,isChannel:o,isGroup:a,isSuperGroup:r,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:h}=(0,s.ko)(),[u,m]=(0,n.J0)(!0),p=(0,T.A)(()=>{h({chatId:t,messageId:i,isUnpin:!1,isOneSide:!u,isSilent:!u}),d()}),g=(0,B.A)();return(0,ne.FD)(te.A,{isOpen:e,onClose:d,className:"pin",title:g("PinMessageAlertTitle"),children:[(0,ne.Y)("p",{children:g(o?"PinMessageAlertChannel":a||r?"PinMessageAlert":"PinMessageAlertChat")}),l&&(0,ne.Y)(es.A,{className:"dialog-checkbox",label:c?(0,Mt.A)(g("Conversation.PinMessagesFor",c)):g("Conversation.PinMessageAlert.PinAndNotifyMembers"),checked:u,onCheck:m}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:g("DialogPin")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:g("Cancel")})]})]})})),uc=(0,n.ph)(({isOpen:e,pinnedMessagesCount:t=0,onClose:i,onUnpin:n})=>{const s=(0,B.A)();return(0,ne.FD)(te.A,{isOpen:e,onClose:i,className:"unpin-all",title:s("Chat.PanelUnpinAllMessages"),children:[(0,ne.Y)("p",{children:s("Chat.UnpinAllMessagesConfirmation",t,"i")}),(0,ne.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:n,children:s("DialogUnpin")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:i,children:s("Cancel")})]})]})});var mc=i(2178);const pc=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.nTw)(e),{shouldWarnAboutFiles:i}=(0,Rn.lS)(e),n=(0,c.meB)(e),{type:s,chatId:o}=(0,c.Xf0)(e)||{},a="scheduled"===s,{canDelete:r}=(0,c.jyG)(e),l=Boolean(!a&&(0,c.mDG)(e)),d=(0,c.ori)(e),{messageIds:h}=t.selectedMessages||{},u=!!o&&(0,c.o45)(e,o,h),m=!(a||!o)&&(0,c.Y8y)(e,o,h),p=!(!h||!o)&&(0,c.h5w)(e,o,h),g=t.isShareMessageModalShown,v=Boolean(g||t.requestedDraft||t.requestedAttachBotInChat||t.requestedAttachBotInstall||t.reportModal||t.deleteMessageModal);return{chat:n,isSchedule:a,selectedMessagesCount:(0,c.ZZ2)(e),canDeleteMessages:r,canReportMessages:l,canDownloadMessages:d,canForwardMessages:m,selectedMessageIds:h,hasProtectedMessage:u,isAnyModalOpen:v,shouldWarnAboutFiles:i,hasIpRevealingMedia:p}})(({chat:e,canPost:t,isActive:i,messageListType:o,isSchedule:a,selectedMessagesCount:r,canDeleteMessages:l,canReportMessages:c,canDownloadMessages:d,canForwardMessages:h,hasProtectedMessage:u,isAnyModalOpen:m,selectedMessageIds:p,shouldWarnAboutFiles:g,hasIpRevealingMedia:v})=>{const{exitMessageSelectMode:A,openForwardMenuForSelectedMessages:f,downloadSelectedMessages:C,copySelectedMessages:b,showNotification:y,reportMessages:S,openDeleteMessageModal:k,setSharedSettingOption:N}=(0,s.ko)(),w=(0,B.A)();(e=>{function t(e){e.preventDefault(),(0,s.ko)().copySelectedMessages()}(0,mc.v)((0,n.Kr)(()=>e?{"Mod+C":t}:void 0,[e]))})(i);const[I,P,Y]=(0,D.A)(),[F,M]=(0,n.J0)(!1),L=(0,T.A)(()=>{A()}),x=(0,T.A)(()=>{p&&e&&k({chatId:e.id,messageIds:p,isSchedule:a})});(0,n.vJ)(()=>i&&!m?(0,Pi.A)({onBackspace:l?x:void 0,onDelete:l?x:void 0,onEsc:L}):void 0,[i,x,L,m,l]);const R=(0,T.A)(()=>{b(),y({message:w("Share.Link.Copied")}),A()}),E=(0,T.A)(()=>{C(),A()}),V=(0,T.A)(()=>{g&&v?P():E()}),_=(0,T.A)(()=>{N({shouldWarnAboutFiles:!F}),Y(),E()}),U=(0,K.A)(r||void 0,!0),O=w("VoiceOver.Chat.MessagesSelected",i?r:U,"i"),J=(0,T.A)(()=>{p&&e&&(S({chatId:e.id,messageIds:p}),A())}),j=(0,ve.A)("MessageSelectToolbar",t&&"with-composer",i&&"shown"),G=(e,t,i,n)=>(0,ne.Y)("div",{role:"button",tabIndex:0,className:(0,ve.A)("div-button","item",n&&"destructive"),onClick:i,title:t,"aria-label":t,children:(0,ne.Y)(he.A,{name:e})});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:j,children:(0,ne.FD)("div",{className:"MessageSelectToolbar-inner",children:[(0,ne.Y)(X.A,{color:"translucent",round:!0,onClick:L,ariaLabel:"Exit select mode",iconName:"close"}),(0,ne.Y)("span",{className:"MessageSelectToolbar-count",title:O,children:O}),Boolean(r)&&(0,ne.FD)("div",{className:"MessageSelectToolbar-actions",children:["scheduled"!==o&&h&&G("forward",w("Chat.ForwardActionHeader"),f),c&&G("flag",w("Conversation.ReportMessages"),J),d&&!u&&G("download",w("lng_media_download"),V),!u&&G("copy",w("lng_context_copy_selected_items"),R),l&&G("delete",w("EditAdminGroupDeleteMessages"),x,!0)]})]})}),(0,ne.FD)(ci.A,{isOpen:I,onClose:Y,confirmHandler:_,children:[w("lng_launch_svg_warning"),(0,ne.Y)(es.A,{className:"dialog-checkbox",checked:F,label:w("lng_launch_exe_dont_ask"),onCheck:M})]})]})})),gc=(0,n.ph)((0,s.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:o}=(0,s.ko)(),a=(0,B.A)(),r=(0,Ii.A)(t,!0),l=(0,n.Kr)(()=>{if(!r)return;const e=Object.keys(r);return e.sort((e,t)=>r[t]-r[e]),e},[r]),c=(0,T.A)(e=>{o(),setTimeout(()=>{i({id:e})},100)}),d=(0,T.A)(()=>{o()});return(0,ne.FD)(te.A,{isOpen:e,onClose:o,className:(0,ve.A)("slqA9gR2","narrow"),title:`Seen by ${l?.length} users`,children:[(0,ne.Y)("div",{dir:a.isRtl?"rtl":void 0,children:l&&l.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>c(e),children:(0,ne.Y)(An.A,{userId:e,noStatusOrTyping:!0,status:(0,et.U)(a,1e3*r[e]),statusIcon:"message-read"})},e))}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:a("Close")})})]})}));var vc=i(32581);const Ac="MQxuEIRA",fc="AEAN1Au4",Cc="F7owtTHj",bc=te.U+a.xB5,yc=(0,n.ph)((0,s.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:n,openPremiumModal:o,closePrivacySettingsNoticeModal:a,showNotification:r,setPrivacyVisibility:c,loadUser:d}=(0,s.ko)(),h=(0,B.A)(),u=(0,Bi.A)(),m=(0,l.u0)(i),p=(0,T.A)(()=>{n({shouldHideReadMarks:!1}),a(),setTimeout(()=>{r({message:h("PremiumReadSet")})},bc)}),g=(0,T.A)(()=>{c({privacyKey:"lastSeen",visibility:"everybody",onSuccess:()=>d({userId:i.id})}),a(),setTimeout(()=>{r({message:h("PremiumLastSeenSet")})},bc)}),v=(0,T.A)(()=>{a(),setTimeout(()=>{o({initialSection:"last_seen"})},bc)}),A=(0,T.A)(()=>{a()});return(0,ne.Y)(te.A,{isSlim:!0,isOpen:e,onClose:A,children:(0,ne.FD)("div",{className:"tauadiDm",dir:u.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{className:"i6iFv9YE",color:"translucent",round:!0,size:"tiny",onClick:A,ariaLabel:"Close",iconName:"close"}),(0,ne.Y)(Oo.A,{tgsUrl:t?Uo.w.ReadTime:Uo.w.LastSeen,size:84,className:"i4wZg_0J",nonInteractive:!0,noLoop:!0}),(0,ne.Y)("h2",{className:Ac,children:h(t?"PremiumReadHeader1":"PremiumLastSeenHeader1")}),(0,ne.Y)("p",{className:fc,children:(0,Mt.A)(h(t?"PremiumReadText1":"PremiumLastSeenText1Locked",m),["simple_markdown"])}),(0,ne.Y)(X.A,{onClick:t?p:g,className:Cc,children:h(t?"PremiumReadButton1":"PremiumLastSeenButton1")}),(0,ne.Y)(vc.A,{className:"sXXb5yOS",children:h("PremiumOr")}),(0,ne.Y)("h2",{className:Ac,children:h("PremiumReadHeader2")}),(0,ne.Y)("p",{className:fc,children:(0,Mt.A)(h(t?"PremiumReadText2":"PremiumLastSeenText2",m),["simple_markdown"])}),(0,ne.Y)(X.A,{withPremiumGradient:!0,onClick:v,className:Cc,children:h("PremiumLastSeenButton2")})]})})}));var Sc=i(97822),kc=i(24956),Nc=i(31722);const wc="ItemPickerItem",Ic=(0,n.ph)(({className:e,isSearchable:t,searchInputId:i,items:s,filterValue:o,notFoundText:a,isLoading:l,noScrollRestore:c,filterPlaceholder:d,isViewOnly:h,itemInputType:u,itemClassName:m,withDefaultPadding:p,forceRenderAllItems:g,onFilterChange:v,onDisabledClick:A,onLoadMore:f,...C})=>{const b=(0,B.A)(),y=(0,n.li)(),S=C.allowMultiple,k=S?C.lockedSelectedValues:void 0,N=S?C.lockedUnselectedValues:void 0;(0,n.vJ)(()=>{t&&(0,r.YS)(()=>{(0,Sc.A)(y.current)})},[t]);const w=(0,n.Kr)(()=>S?C.selectedValues:C.selectedValue?[C.selectedValue]:gi.p,[S,C.selectedValue,C.selectedValues]),I=(0,n.Kr)(()=>new Set(k),[k]),P=(0,n.Kr)(()=>new Set(N),[N]),Y=(0,n.Kr)(()=>{if(o)return s.map(e=>e.value);const e=[],t=[],i=[];return s.forEach(n=>{I.has(n.value)?e.push(n):P.has(n.value)?i.push(n):t.push(n)}),e.concat(t,i).map(e=>e.value)},[o,s,I,P]),F=(0,T.A)(e=>{if(S){const t=w.slice(),i=t.indexOf(e);return i>=0?t.splice(i,1):t.push(e),void C.onSelectedValuesChange?.(t)}C.onSelectedValueChange?.(e)}),[D,M]=(0,Un.A)(f,Y,Boolean(g||o)),L=(0,T.A)(e=>{const{value:t}=e.currentTarget;v?.(t)}),x=(0,n.hb)(e=>{const t=s.find(t=>t.value===e);if(!t)return;const{label:i,subLabel:n,isLoading:o}=t,a=P.has(e),r=I.has(e),l=a||r,c=w.includes(e);return(0,ne.Y)(Hn.A,{className:(0,ve.A)(wc,m),title:i,subtitle:n,disabled:l,inactive:h,ripple:!0,inputElement:l?(0,ne.Y)(he.A,{name:"lock-badge"}):"radio"===u?(0,ne.Y)(kc.A,{checked:c,disabled:l,isLoading:o,onlyInput:!0}):"checkbox"===u?(0,ne.Y)(es.A,{checked:c,disabled:l,isLoading:o,onlyInput:!0}):void 0,onClick:()=>F(e),onDisabledClick:A&&(()=>A(e,r))},e)},[s,P,I,w,h,A,u,m]);return(0,ne.FD)("div",{className:(0,ve.A)(Nc.A.container,e),children:[t&&(0,ne.Y)("div",{className:(0,ve.A)(Nc.A.header,"custom-scroll"),dir:b.isRtl?"rtl":void 0,children:(0,ne.Y)(ee.A,{id:i,ref:y,value:o,onChange:L,placeholder:d||b("Search")})}),D?.length?(0,ne.Y)(mn.A,{className:(0,ve.A)(Nc.A.pickerList,p&&Nc.A.padded,"custom-scroll"),items:D,itemSelector:`.${wc}`,onLoadMore:M,noScrollRestore:c,children:D.map(e=>x(e))}):l||!D||D.length?(0,ne.Y)(Jn.A,{}):(0,ne.Y)("p",{className:Nc.A.noResults,children:a||b("SearchEmptyViewTitle")})]})}),Pc={root:"wzzA3MFh",pickerSelector:"xhujrq9i",pickerTitle:"YuRK4e7S",picker:"YF9nLkCK",footer:"ATCZ2Q5G"},Yc=(0,n.ph)(({isOpen:e,onClose:t,onSubmit:i,countryList:o,selectionLimit:a})=>{const{showNotification:r}=(0,s.ko)(),l=(0,B.A)(),[c,d]=(0,n.J0)([]),h=(0,K.A)(c)===c,u=(0,n.Kr)(()=>o?o.filter(e=>!e.isHidden&&"FT"!==e.iso2).map(({iso2:e,defaultName:t})=>({value:e,label:t})):[],[o]),m=(0,T.A)(e=>{a&&e.length>a?r({message:l("BoostingSelectUpToWarningCountries",a)}):d(e)}),p=(0,T.A)(()=>{i(c),t()});return(0,ne.FD)(te.A,{className:Pc.root,isOpen:e,onClose:t,onEnter:p,hasAbsoluteCloseButton:!0,children:[(0,ne.Y)("div",{className:Pc.container,children:(0,ne.Y)("div",{className:Pc.pickerSelector,children:(0,ne.Y)("h4",{className:Pc.pickerTitle,children:l("BoostingSelectCountry")})})}),(0,ne.Y)("div",{className:(0,ve.A)(Pc.main,"custom-scroll"),children:(0,ne.Y)(Ic,{className:Pc.picker,items:u,selectedValues:c,onSelectedValuesChange:m,noScrollRestore:h,allowMultiple:!0,itemInputType:"checkbox"})}),(0,ne.Y)("div",{className:Pc.footer,children:(0,ne.Y)(X.A,{onClick:p,children:l("SelectCountries.OK")})})]})});var Fc=i(60406);const Dc=1.5*v.$,Mc=(0,n.ph)((0,s.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).reactorModal||{},n=t&&i?(0,c.O5q)(e,t,i):void 0;return{chatId:t,messageId:i,reactions:n?.reactions,reactors:n?.reactors,seenByDates:n?.seenByDates,availableReactions:e.reactions.availableReactions,animationLevel:(0,Rn.lS)(e).animationLevel}})(({isOpen:e,reactors:t,reactions:i,chatId:a,messageId:r,seenByDates:c,availableReactions:d,animationLevel:h})=>{const{loadReactors:u,closeReactorListModal:m,openChat:p}=(0,s.ko)(),g=(0,s.mS)().chats.byId,v=(0,s.mS)().users.byId,A=(0,B.A)(),f=(0,Bi.A)(),[C,b,y]=(0,D.A)(!1),[S,k]=(0,n.J0)(void 0),N=t&&i&&t.count>=10&&i.results.length>1,w=(0,n.li)(),I=(0,n.li)(),P=(0,n.li)();(0,Qn.A)(I,!N||!e),(0,n.vJ)(()=>{e&&!C&&(w.current=void 0),C&&!e&&(y(),k(void 0))},[C,e,y]);const Y=(0,T.A)(()=>{w.current&&p({id:w.current}),m()}),F=(0,T.A)(()=>{b()}),M=(0,T.A)(e=>{w.current=e,F()}),L=(0,T.A)(()=>{u({chatId:a,messageId:r})}),x=(0,n.Kr)(()=>{const e=[];return t?.reactions?.forEach(({reaction:t})=>{e.some(e=>(0,l.a0)(e,t))||e.push(t)}),e},[t]),R=(0,n.Kr)(()=>S?x.findIndex(e=>(0,l.a0)(e,S))+1:0,[S,x]),E=(0,n.Kr)(()=>{if(S)return t?.reactions.filter(({reaction:e})=>(0,l.a0)(e,S)).map(({peerId:e})=>e);const e=Object.keys(c||{});return(0,pi.Am)(t?.reactions.map(({peerId:e})=>e).concat(e||[])||[])},[S,t,c]),[V,_]=(0,Un.A)(L,E,t&&void 0===t.nextOffset);return(0,Fc.A)({containerRef:P,selector:".reactor-list"},[R,e]),(0,n.vJ)(()=>{_?.({direction:o.TN.Backwards})},[_]),(0,ne.FD)(te.A,{isOpen:e&&!C,onClose:F,className:"ReactorListModal narrow",title:A("Reactions"),onCloseAnimationEnd:Y,isCondensedHeader:!0,hasCloseButton:!0,children:[N&&(0,ne.FD)("div",{ref:I,className:(0,ve.A)("Reactions","no-scrollbar"),dir:f.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{color:S?"adaptive":"primary",size:"tiny",ripple:!0,iconName:"heart",className:S?"not-chosen-button":void 0,pill:!0,fluid:!0,onClick:()=>k(void 0),children:Boolean(t?.count)&&(0,Es.Vw)(f,t.count)}),x.map(e=>{const t=i?.results.find(t=>(0,l.a0)(t.reaction,e))?.count,n=(0,l.a0)(S,e);return(0,ne.FD)(X.A,{className:n?void 0:"not-chosen-button",color:n?"primary":"adaptive",size:"tiny",pill:!0,fluid:!0,ripple:!0,onClick:()=>k(e),children:[(0,ne.Y)(fn.A,{reaction:e,className:"reaction-filter-emoji",availableReactions:d,size:Dc}),Boolean(t)&&(0,Es.Vw)(f,t)]},(0,l.Jj)(e))})]}),(0,ne.Y)("div",{ref:P,dir:f.isRtl?"rtl":void 0,className:"reactor-list-wrapper",children:(0,ne.Y)(ae.Ay,{activeKey:R,name:(0,Vn.P)("slide",h,void 0,f.isRtl),children:V?.length?(0,ne.Y)(mn.A,{className:"reactor-list custom-scroll",items:V,onLoadMore:_,children:V?.flatMap(e=>{const i=v[e]||g[e],n=t?.reactions.filter(t=>t.peerId===e),s=[],o=c?.[e];return n?.forEach(t=>{S&&!(0,l.a0)(t.reaction,S)||s.push((0,ne.FD)(ui.A,{className:"chat-item-clickable reactors-list-item",onClick:()=>M(e),children:[(0,ne.Y)(Tt.A,{peer:i,size:"medium"}),(0,ne.FD)("div",{className:"info",children:[(0,ne.Y)(jn.A,{peer:i,withEmojiStatus:!0}),(0,ne.FD)("span",{className:"status",dir:"auto",children:[(0,ne.Y)(he.A,{name:"heart-outline",className:"status-icon"}),(0,et.U)(A,1e3*t.addedDate)]})]}),t.reaction&&(0,ne.Y)(fn.A,{className:"reactors-list-emoji",reaction:t.reaction,availableReactions:d,size:Dc})]},`${e}-${(0,l.Jj)(t.reaction)}`))}),S||n?.length||s.push((0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>M(e),children:(0,ne.Y)(An.A,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:o?(0,et.U)(A,1e3*o):void 0,statusIcon:"message-read"})},`${e}-seen-by`)),s})}):(0,ne.Y)(Jn.A,{})})})]})})),Tc=(0,n.ph)((0,s.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,s.ko)(),[o,a]=(0,D.A)(!1),[r,l]=(0,D.A)(!1),c=(0,n.li)(),d=(0,T.A)(()=>{a(),c.current&&clearTimeout(c.current),setTimeout(()=>{i({id:t.id})},250)}),h=(0,T.A)(e=>{e.target?.closest(".AnimatedEmoji")||d()});(0,n.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,n.Nf)(()=>{const e=(0,n.VK)();return c.current=setTimeout(()=>{d(),e()},3e3),()=>{clearTimeout(c.current),e()}},[]);const m=e&&`sticker${e}`,p=(0,q.A)(m,!e);if(!t.startSize)return;const g=(t.startSize||0)/309;return(0,ne.Y)("div",{className:(0,ve.A)("EmojiInteractionAnimation",o&&"hiding",r&&"playing",t.isReversed&&"reversed"),style:`--scale: ${g}; --start-x: ${t.x}px; --start-y: ${t.y}px;`,children:(0,ne.Y)(jo.A,{size:309,tgsUrl:p,play:!0,quality:u.Ni?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:l},`effect_${e}`)})})),Bc=(0,n.ph)((0,s.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).chatLanguageModal||{},n=(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:n,currentTone:t&&i?(0,c.ztL)(e,t,i):void 0}})(({isOpen:e,chatId:t,messageId:i,activeTranslationLanguage:o,currentLanguageCode:r,currentTone:l})=>{const{requestMessageTranslation:c,closeChatLanguageModal:d,setSettingOption:h,requestChatTranslation:u}=(0,s.ko)(),[m,p]=(0,n.J0)(""),g=(0,B.A)(),v=(0,T.A)(e=>{t&&(i?c({chatId:t,id:i,toLanguageCode:e,tone:l}):(h({translationLanguage:e}),u({chatId:t,toLanguageCode:e})),d())}),A=(0,T.A)(e=>{p(e.target.value)}),f=(0,n.Kr)(()=>a.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,n.vJ)(()=>{e||p("")},[e]);const C=(0,n.Kr)(()=>m.trim()?f.filter(({langCode:e,translatedName:t,originalName:i})=>t.toLowerCase().includes(m.toLowerCase())||i.toLowerCase().includes(m.toLowerCase())||e.toLowerCase().includes(m.toLowerCase())):f,[f,m]);return(0,ne.FD)(te.A,{className:"aMjNU9gm",isSlim:!0,isOpen:e,hasCloseButton:!0,title:g("Language"),onClose:d,children:[(0,ne.Y)(ee.A,{value:m,onChange:A,placeholder:g("Search"),teactExperimentControlled:!0},"search"),(0,ne.Y)("div",{className:(0,ve.A)("r3YNWDQr","custom-scroll"),children:C.map(({langCode:e,originalName:t,translatedName:i})=>(0,ne.FD)(ui.A,{className:(0,ve.A)("T3An6Hoz","no-icon"),secondaryIcon:o===e?"check":void 0,disabled:o===e,multiline:!0,narrow:!0,onClick:()=>v(e),children:[(0,ne.Y)("span",{className:(0,ve.A)("title","dQ9wwFu1"),children:(0,Mt.A)(t,["highlight"],{highlight:m})}),(0,ne.Y)("span",{className:(0,ve.A)("subtitle","m_J41YYl"),children:(0,Mt.A)(i,["highlight"],{highlight:m})})]},e))})]})}));var Lc=i(85982),xc=i(24899);const Rc={content:"WEJIbFQj",closeButton:"_vwPuDEM",icon:"BUiGM8qZ",title:"Q3NhXpNI",description:"frZbGQ0G"},Ec=(0,n.ph)((0,s.EK)(e=>{const{countryList:t}=e;return{phoneCodeList:t.phoneCodes}})(({modal:e,phoneCodeList:t})=>{const{closeCollectibleInfoModal:i,openChat:o,openUrl:a,showNotification:r}=(0,s.ko)(),l=(0,B.A)(),c="username"===e?.type,d=(0,T.A)(()=>{i()}),h=(0,T.A)(()=>{o({id:e.peerId}),d()}),u=(0,T.A)(()=>{a({url:e.url}),d()}),m=(0,T.A)(()=>{const i=c?(0,xc.A)(e.collectible):(0,ds.Ox)(t,e.collectible);(0,Lc.eM)(i),r({message:l(c?"UsernameCopied":"PhoneCopied")}),d()}),p=(0,n.Kr)(()=>{if(!e)return;const i=c?"FragmentUsernameTitle":"FragmentPhoneTitle",n=c?(0,xc.A)(e.collectible):(0,ds.Ox)(t,e.collectible);return l(i,n)},[e,c,t,l]),g=(0,n.Kr)(()=>{if(!e)return;const t=c?"FragmentUsernameMessage":"FragmentPhoneMessage",i=(0,et.U)(l,1e3*e.purchaseDate),n=(0,wo.Ad)(e.amount,e.currency,l.code),s=(0,wo.Ad)(e.cryptoAmount,e.cryptoCurrency,l.code);return l(t,[i,`${s} (${n})`])},[e,c,l]);return(0,ne.FD)(te.A,{isOpen:Boolean(e),isSlim:!0,contentClassName:Rc.content,onClose:i,hasAbsoluteCloseButton:!0,children:[(0,ne.Y)("div",{className:Rc.icon,children:(0,ne.Y)(Oo.A,{tgsUrl:c?Uo.w.Mention:Uo.w.Fragment,size:60})}),(0,ne.Y)("h3",{className:Rc.title,children:p&&(0,Mt.A)(p,["simple_markdown"])}),(0,ne.Y)(xn.A,{className:Rc.chip,peerId:e?.peerId,forceShowSelf:!0,clickArg:e?.peerId,onClick:h}),(0,ne.Y)("p",{className:Rc.description,children:g&&(0,Mt.A)(g,["simple_markdown"])}),(0,ne.FD)("div",{className:"dialog-buttons dialog-buttons-centered",children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",onClick:u,children:l("FragmentUsernameOpen")}),(0,ne.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:m,children:l(c?"FragmentUsernameCopy":"FragmentPhoneCopy")})]})]})}));var Vc=i(22191),_c=i(57309);function Uc(e){return(t,i)=>{const n=(0,c.nTw)(t),{byId:s}=t.chats,{byId:o}=t.users,{fetchingStatus:a,resultsByType:r,chatId:l}=n.globalSearch,{shouldWarnAboutFiles:d}=(0,Rn.lS)(t),h="audio"!==e?e:i?.isVoice?"voice":"audio",{byChatId:u}=t.messages,m=r?.[h]?.foundIds,p=n.activeDownloads;return{theme:(0,c.SJA)(t),isLoading:void 0===m||!!a&&Boolean(a.chats||a.messages),chatsById:s,usersById:o,globalMessagesByChatId:u,foundIds:m,searchChatId:l,activeDownloads:p,isChatProtected:l?(0,c.hds)(t,l)?.isProtected:void 0,shouldWarnAboutFiles:d}}}var Oc=i(55429),Kc=i(65240),Jc=i(42827);const jc=(0,Ce.nF)(e=>e(),500,!0),Gc=(0,n.ph)((0,s.EK)(Uc("audio"))(({theme:e,isVoice:t,searchQuery:i,isLoading:r,chatsById:c,usersById:d,globalMessagesByChatId:h,foundIds:u,activeDownloads:m})=>{const{searchMessagesGlobal:p,focusMessage:g,openAudioPlayer:v}=(0,s.ko)(),A=(0,B.A)(),f=t?"voice":"audio",C=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&jc(()=>{p({type:f})})},[f,p,i]),b=(0,n.Kr)(()=>u&&h?u.map(e=>{const[t,i]=(0,_c.a)(e);return h[t]?.byId[i]}).filter(Boolean):gi.p,[h,u]),y=(0,n.hb)(e=>{g({chatId:e.chatId,messageId:e.id})},[g]),S=(0,n.hb)((e,t)=>{v({chatId:t,messageId:e})},[v]),k=(0,Cr.A)([i],a.jhd)&&!r;return(0,ne.Y)(ae.Ay,{slideClassName:"LeftSearch--content",name:"fade",activeKey:k?1:0,shouldCleanup:!0,children:(0,ne.FD)(mn.A,{className:"search-content documents-list custom-scroll",items:k?b:void 0,onLoadMore:C,noFastList:!0,children:[!k&&(0,ne.Y)(Jn.A,{}),k&&(!u||0===u.length)&&(0,ne.Y)(Jc.A,{withSticker:!0,text:A("ChatList.Search.NoResults"),description:A("ChatList.Search.NoResultsDescription")}),k&&u&&u.length>0&&b.map((t,i)=>{const n=(0,s.mS)(),a=0===i||(0,et.$$)(t.date)!==(0,et.$$)(b[i-1].date),r=(0,Ve.iS)(n,t);return(0,ne.FD)(ne.FK,{children:[a&&(0,ne.Y)("p",{className:"section-heading",dir:A.isRtl?"rtl":void 0,children:(0,et.i6)(A,new Date(1e3*t.date))},t.date),(0,ne.Y)("div",{className:"ListItem small-icon",children:(0,ne.Y)(Kc.Ay,{theme:e,message:t,origin:o.d9.Search,senderTitle:(0,Oc.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 Hc=i(27109),zc=i(75956),$c=i(47067);const qc=e=>{const t=(0,n.li)(),i=(0,T.A)(i=>{"Enter"===i.key&&t.current===document.activeElement&&e()});return(0,n.vJ)(()=>(window.addEventListener("keydown",i,!1),()=>window.removeEventListener("keydown",i,!1)),[]),t};var Wc=i(97967),Qc=i(97046);const Zc=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),n=(0,c.mBe)(e,t),s=(0,c.D3D)(e,t),o=i&&(0,Hc.If)(i,(0,c.K52)(e),(0,c.P5N)(e,i.id)),a=(0,c.xyP)(e,t)?.listedTopicIds;return{chat:i,user:n,isPinned:s,isMuted:o,canChangeFolder:Boolean(e.chatFolders.orderedIds?.length),listedTopicIds:a}})(({chatId:e,withUsername:t,chat:i,user:r,listedTopicIds:l,isPinned:c,isMuted:d,canChangeFolder:h,withOpenAppButton:u,onClick:m})=>{const{requestMainWebView:p,updateChatMutedState:v,openQuickPreview:A}=(0,s.ko)(),f=(0,Bi.A)(),[C,b,y]=(0,D.A)(),[S,k,N]=(0,D.A)(),[w,I,P]=(0,D.A)(),[Y,F,M]=(0,D.A)(),B=(0,n.hb)(()=>{I(),k()},[I,k]),L=(0,n.hb)(()=>{F(),b()},[F,b]),x=(0,T.A)(()=>{v({chatId:e,mutedUntil:a.Os5})}),R=(0,$c.A)({chat:i,user:r,isPinned:c,isMuted:d,canChangeFolder:h,topicIds:l,handleMute:L,handleUnmute:x,handleChatFolderChange:B},!0),E=(0,T.A)(t=>{if(t.altKey&&i&&!i.isForum)return t.preventDefault(),void A({id:e});m(e)}),V=(0,T.A)(t=>{t.stopPropagation();const i=(0,Vs.A)();p({botId:e,peerId:e,theme:i})}),_=(0,T.A)(t=>{t.preventDefault(),(0,zc.W)(()=>{m(e)},!0)}),U=qc(()=>{m(e)});return(0,ne.FD)(ui.A,{className:"chat-item-clickable search-result",contextActions:R,buttonRef:U,onClick:E,onDragEnter:_,onDragLeave:zc.d,children:[(0,g.L8)(e)?(0,ne.Y)(An.A,{userId:e,withUsername:t,withStory:!0,avatarSize:"medium",storyViewerOrigin:o.G9.SearchResult}):(0,ne.Y)(vn.A,{chatId:e,withUsername:t,avatarSize:"medium",withStory:!0,storyViewerOrigin:o.G9.SearchResult}),u&&r?.hasMainMiniApp&&(0,ne.Y)(X.A,{className:"search-result-miniapp-button",pill:!0,fluid:!0,size:"tiny",onClick:V,children:f("BotChatMiniAppOpen")}),Y&&(0,ne.Y)(Qc.A,{isOpen:C,onClose:y,onCloseAnimationEnd:M,chatId:e}),w&&(0,ne.Y)(Wc.A,{isOpen:S,onClose:N,onCloseAnimationEnd:P,chatId:e})]})})),Xc=(0,Ce.nF)(e=>e(),500,!0),ed=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topPeerCategories.botsApp?.peerIds}})(({searchQuery:e,isLoading:t,foundIds:i,recentBotIds:r})=>{const{searchPopularBotApps:l,openChatWithInfo:c}=(0,s.ko)(),d=(0,n.li)(),h=(0,B.A)(),[u,m]=(0,n.J0)(!1),p=(0,n.Kr)(()=>{if(!i)return[];const t=new Set(r),n=i.filter(e=>!t.has(e));return(0,Dt.PU)({ids:n,query:e,type:"user"})},[i,r,e]),g=(0,T.A)(e=>{c({id:e,shouldReplaceHistory:!0})}),v=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&Xc(()=>{l()})},[]),A=(0,T.A)(()=>{m(e=>!e)}),f=(0,Cr.A)([e],a.jhd)&&!t;return(0,ne.Y)(ae.Ay,{ref:d,slideClassName:"LeftSearch--content",name:"fade",activeKey:f?1:0,shouldCleanup:!0,children:(0,ne.FD)(mn.A,{className:"search-content custom-scroll",items:f?p:void 0,onLoadMore:v,noFastList:!0,children:[!f&&(0,ne.Y)(Jn.A,{}),f&&!p?.length&&(0,ne.Y)(Jc.A,{withSticker:!0,text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),f&&!e&&Boolean(r?.length)&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.FD)("h3",{className:"section-heading",children:[r.length>5&&(0,ne.Y)(Oa.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,ne.Y)(Zc,{chatId:e,onClick:g,withOpenAppButton:!0})})]}),f&&Boolean(p?.length)&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.Y)("h3",{className:"section-heading",children:h("SearchAppsPopular")}),p.map(e=>(0,ne.Y)(Zc,{chatId:e,onClick:g,withOpenAppButton:!0}))]})]})})}));var td=i(35749),id=i(2338);function nd(e,t,i,n,s){if(!i)return(0,A.C)(e,t,void 0,n);const o=(0,l.y2)(t);return(0,ne.FD)("span",{className:"media-preview",children:[(0,ne.Y)("img",{src:i,alt:"",className:(0,ve.A)("media-preview--image",s&&"round",o&&"media-preview-spoiler"),draggable:!1}),(0,l.zX)(t)&&(0,ne.Y)(he.A,{name:"play"}),(0,A.C)(e,t,!0,n)]})}const sd=(0,n.ph)((0,s.EK)((e,{chatId:t})=>({peer:(0,c.PVB)(e,t)}))(({message:e,searchQuery:t,chatId:i,peer:n})=>{const{focusMessage:o}=(0,s.ko)(),{isMobile:a}=(0,Y.Ay)(),r=(0,id.A)(e),c=(0,l.fP)(e)?void 0:r,d=(0,td.A)(e,"micro"),h=(0,q.A)(d),u=Boolean((0,l.lk)(e)),m=(0,T.A)(()=>{o({chatId:i,messageId:e.id,shouldReplaceHistory:!0})}),p=(0,Bi.A)(),g=(0,B.A)(),v=qc(m);if(!n)return;const A=(0,Dt.mO)(n)?n:void 0;return(0,ne.FD)(ui.A,{className:"ChatMessage chat-item-clickable",ripple:!a,onClick:m,buttonRef:v,children:[(0,ne.Y)(Tt.A,{peer:n,isSavedMessages:A?.isSelf}),(0,ne.FD)("div",{className:"info",children:[(0,ne.FD)("div",{className:"info-row",children:[(0,ne.Y)(jn.A,{peer:n,withEmojiStatus:!0,isSavedMessages:A?.isSelf}),(0,ne.Y)("div",{className:"message-date",children:(0,ne.Y)(Oa.A,{className:"date",children:(0,et.be)(g,1e3*e.date)})})]}),(0,ne.Y)("div",{className:"subtitle",children:(0,ne.Y)("div",{className:"message",dir:"auto",children:nd(p,e,h||c,t,u)})})]})]})})),od=(0,n.ph)(({searchDate:e,onSelect:t})=>{const i=(0,n.Kr)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,et.A)(t)}]}const t=[],i=new Date,n=i.getFullYear(),s=i.getTime()>new Date(`${n}-${e}`).getTime()?n:n-1;for(let i=0;i<8;i++){const n=new Date(`${s-i}-${e}`);t.push({date:n,text:(0,et.A)(n)})}return t}(e),[e]);return(0,ne.Y)("section",{className:"DateSuggest custom-scroll custom-scroll-x",children:i.map(({date:e,text:i})=>(0,ne.FD)("div",{onClick:()=>t(e),className:"date-item",children:[(0,ne.Y)(he.A,{name:"calendar"}),(0,ne.Y)("span",{children:i})]},i))})}),ad=2*v.$,rd=(0,n.ph)((0,s.EK)((e,{chatId:t,topicId:i})=>({topic:(0,c.S0q)(e,t,i)}))(({chatId:e,topicId:t,topic:i,onClick:o})=>{const{openQuickPreview:a}=(0,s.ko)(),r=(0,n.hb)(i=>{if(i.altKey)return i.preventDefault(),void a({id:e,threadId:t});o(t)},[e,t,o,a]),l=qc(()=>o(t));if(i)return(0,ne.FD)(ui.A,{className:"chat-item-clickable search-result",onClick:r,buttonClassName:"topic-item",buttonRef:l,children:[(0,ne.Y)(Gn.A,{size:ad,topic:i,className:"topic-icon",letterClassName:"topic-icon-letter"}),(0,ne.Y)("div",{dir:"auto",className:"fullName",children:(0,Mt.A)(i.title)})]})})),ld=(0,Ce.nF)(e=>e(),500,!0),cd=(0,n.ph)((0,s.EK)(e=>{const{byId:t}=e.chats,{currentUserId:i,messages:{byChatId:n}}=e,{fetchingStatus:s,resultsByType:o,foundTopicIds:a,chatId:r}=(0,c.nTw)(e).globalSearch,{foundIds:l}=o?.text||{};return{currentUserId:i,foundIds:l,globalMessagesByChatId:n,chatsById:t,fetchingStatus:s,foundTopicIds:a,searchChatId:r}})(({searchQuery:e,dateSearchQuery:t,foundIds:i,globalMessagesByChatId:a,chatsById:r,fetchingStatus:l,foundTopicIds:c,searchChatId:d,onSearchDateSelect:h,onReset:u})=>{const{searchMessagesGlobal:m,openThread:p}=(0,s.ko)(),g=(0,Bi.A)(),{isMobile:v}=(0,Y.Ay)(),f=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&ld(()=>{m({type:"text"})})},[e]),C=(0,n.hb)(e=>{d&&(p({chatId:d,threadId:e,shouldReplaceHistory:!0}),v||u())},[d,v,u]),b=(0,n.Kr)(()=>i&&0!==i.length?i.map(e=>{const[t,i]=(0,_c.a)(e);return a?.[t]?.byId[i]}).filter(Boolean).sort((e,t)=>t.date-e.date):gi.p,[i,a]),y=l&&!l.chats&&!l.messages&&!b.length&&!c?.length;return(0,ne.Y)("div",{className:"LeftSearch--content",children:(0,ne.FD)(mn.A,{className:"search-content custom-scroll chat-list",items:b,onLoadMore:f,noFastList:!0,children:[t&&(0,ne.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ne.Y)(od,{searchDate:t,onSelect:h})}),y&&(0,ne.Y)(Jc.A,{withSticker:!0,text:g("ChatListSearchNoResults"),description:g("ChatListSearchNoResultsDescription")}),Boolean(c?.length)&&(0,ne.FD)("div",{className:"pb-2",children:[(0,ne.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("SearchResultTopics")}),c.map(e=>(0,ne.Y)(rd,{chatId:d,topicId:e,onClick:C}))]}),Boolean(b.length)&&(0,ne.FD)("div",{className:"pb-2",children:[(0,ne.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("SearchMessages")}),b.map(function(t){const i=(0,A.C)(g,t),n=r[t.chatId];if(i&&n)return(0,ne.Y)(sd,{chatId:t.chatId,message:t,searchQuery:e})})]})]})})}));var dd=i(49763),hd=i(81949);const ud=(0,n.ph)(({sponsoredPeer:e,observeIntersection:t})=>{const i=(0,n.li)(),{clickSponsored:a,viewSponsored:r,openChat:l}=(0,s.ko)(),c=(0,Bi.A)(),{peerId:d,randomId:h,additionalInfo:u,sponsorInfo:m}=e;(0,yr.mv)(i,t,e=>{1===e.intersectionRatio&&r({randomId:h})});const p=(0,T.A)(()=>{a({randomId:h}),l({id:d})}),{isContextMenuOpen:v,contextMenuAnchor:A,handleBeforeContextMenu:f,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:y}=(0,As.A)(i),{handleClick:S,handleMouseDown:k}=(0,Hi.Q)(e=>{e.stopPropagation(),C(e)}),N=qc(p);return(0,ne.FD)(ui.A,{ref:i,className:"chat-item-clickable search-result",onClick:p,onMouseDown:f,onContextMenu:C,buttonRef:N,children:[(0,g.L8)(d)?(0,ne.Y)(An.A,{userId:d,withUsername:!0,withStory:!0,avatarSize:"medium",storyViewerOrigin:o.G9.SearchResult}):(0,ne.Y)(vn.A,{chatId:d,withUsername:!0,avatarSize:"medium",withStory:!0,storyViewerOrigin:o.G9.SearchResult}),(0,ne.FD)(hd.A,{className:"search-sponsored-badge",onMouseDown:k,onClick:S,children:[c("SponsoredPeerBadge"),(0,ne.Y)(he.A,{name:"more"})]}),A&&(0,ne.Y)(Dl.A,{isOpen:v,anchor:A,triggerRef:i,randomId:h,additionalInfo:u,canReport:!0,sponsorInfo:m,onClose:b,onCloseAnimationEnd:y})]})}),md=(0,Ce.nF)(e=>e(),6e4,!0),pd=(0,n.ph)((0,s.EK)(e=>{const t=e.topPeerCategories.correspondents?.peerIds,{recentlyFoundChatIds:i}=e;return{topPeerIds:t,recentlyFoundChatIds:i}})(({topPeerIds:e,recentlyFoundChatIds:t,onReset:i})=>{const{loadTopPeers:o,openChat:a,addRecentlyFoundChatId:r,clearRecentlyFoundChats:l}=(0,s.ko)(),d=(0,n.li)();(0,n.vJ)(()=>{md(()=>{o({category:"correspondents"})})},[o]);const h=(0,n.hb)(t=>e?.map(e=>(0,c.PVB)(t,e)).filter(Boolean),[e]),u=(0,_n.LV)(h),m=Boolean(u?.length);(0,Qn.A)(d,!m);const p=(0,n.hb)(e=>{a({id:e,shouldReplaceHistory:!0}),i(),setTimeout(()=>{r({id:e})},250)},[a,r,i]),g=(0,n.hb)(()=>{l()},[l]),v=(0,Bi.A)();return(0,ne.FD)("div",{className:"RecentContacts custom-scroll",children:[m&&(0,ne.Y)("div",{className:"top-peers-section",dir:v.isRtl?"rtl":void 0,children:(0,ne.Y)("div",{ref:d,className:"top-peers",children:u?.map(e=>(0,ne.FD)("div",{className:"top-peer-item",onClick:()=>p(e.id),dir:v.isRtl?"rtl":void 0,children:[(0,ne.Y)(Tt.A,{peer:e}),(0,ne.Y)("div",{className:"top-peer-name",children:(0,Mt.A)((0,Dt.F9)(v,e)||" ")})]},e.id))})}),t&&(0,ne.FD)("div",{className:"search-section pt-1",children:[(0,ne.FD)("h3",{className:(0,ve.A)("section-heading mt-0 recent-chats-header",!m&&"without-border"),dir:v.isRtl?"rtl":void 0,children:[v("Recent"),(0,ne.Y)(X.A,{className:"clear-recent-chats",round:!0,size:"smaller",color:"translucent",ariaLabel:v("Clear"),onClick:g,isRtl:v.isRtl,iconName:"close"})]}),t.map(e=>(0,ne.Y)(Zc,{chatId:e,withOpenAppButton:!0,onClick:p}))]})]})})),gd=(0,Ce.nF)(e=>e(),500,!1),vd=(0,n.ph)((0,s.EK)((e,{isChannelList:t})=>{const{userIds:i}=e.contactList||{},{currentUserId:n,messages:s}=e;if(!i)return{};const{fetchingStatus:o,globalResults:r,localResults:l,resultsByType:d,sponsoredPeer:h}=(0,c.nTw)(e).globalSearch,{peerIds:u}=r||{},{peerIds:m}=l||{},{byChatId:p}=s,g=d?.[t?"channels":"text"]?.foundIds,{similarChannelIds:v}=(0,c.dg4)(e,a.rBM)||{};return{currentUserId:n,contactIds:i,accountPeerIds:m,globalPeerIds:u,foundIds:g,globalMessagesByChatId:p,fetchingStatus:o,sponsoredPeer:h,suggestedChannelIds:v}})(({isChannelList:e,searchQuery:t,searchDate:i,dateSearchQuery:r,currentUserId:c,contactIds:d,accountPeerIds:h,globalPeerIds:u,foundIds:m,globalMessagesByChatId:p,fetchingStatus:g,suggestedChannelIds:v,sponsoredPeer:f,onReset:C,onSearchDateSelect:b})=>{const{openChat:y,addRecentlyFoundChatId:S,searchMessagesGlobal:k,setGlobalSearchChatId:N,loadChannelRecommendations:w}=(0,s.ko)(),I=(0,n.li)(),P=(0,n.li)(),F=(0,Bi.A)(),{isMobile:D}=(0,Y.Ay)(),[M,B]=(0,n.J0)(!1),[L,x]=(0,n.J0)(!1),[R,E]=(0,n.J0)("all"),V=(0,n.li)();(0,Ne.A)(()=>{e&&w({})});const _=(0,n.hb)(({direction:t})=>{t===o.TN.Backwards&&gd(()=>{k({type:e?"channels":"text",context:R})})},[t,R]),U=(0,n.hb)(e=>{y({id:e,shouldReplaceHistory:!0}),e!==c&&S({id:e}),D||C()},[y,c,D,S,C]),O=(0,n.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:j,handleContextMenu:G,handleContextMenuClose:H,handleContextMenuHide:z}=(0,As.A)(V),$=(0,T.A)(()=>V.current),q=(0,T.A)(()=>V.current.querySelector(".chatResultsContextMenu .bubble")),W=(0,T.A)(()=>V.current.querySelector(".menuTrigger")),Q=(0,T.A)(e=>{G(e)}),Z=(0,ve.A)("icon","iconPlaceholder"),X=(0,n.Kr)(()=>{if(!e&&(!t||t.startsWith("@")&&t.length<2))return gi.p;const i=(0,s.mS)().chats.byId,n=((0,dd.YA)(a.DSF)??[]).filter(t=>{if(!e)return!0;const n=i[t];return n&&(0,l.WX)(n)}),o=(0,Dt.PU)({ids:n,query:t,type:"chat"});if(e)return o;const r=[...c?[c]:[],...d||[]],u=[...(0,Dt.PU)({ids:r,query:t,type:"user"}),...o];return(0,pi.Am)([...(0,Dn.A)(u,void 0,c?[c]:void 0),...(0,Dn.A)(h||[])])},[t,c,d,h,e]);(0,Qn.A)(P,!X.length||e,!0);const ee=(0,n.Kr)(()=>{if(!t||t.length<4||!u)return gi.p;const i=(0,s.mS)().chats.byId,n=u.filter(t=>{if(!e)return!0;const n=i[t];return n&&(0,l.WX)(n)});return(0,Dn.A)(n,!0)},[u,e,t]),te=(0,n.Kr)(()=>{if(!t&&!i||!m||0===m.length)return gi.p;const n=(0,s.mS)().chats.byId;return m.map(t=>{const[i,s]=(0,_c.a)(t),o=n[i];if(o&&(!e||(0,l.WX)(o)))return p?.[i]?.byId[s]}).filter(Boolean)},[t,i,m,e,p]);(0,n.vJ)(()=>{t&&k({type:e?"channels":"text",context:R,shouldResetResultsByType:!0,shouldCheckFetchingMessagesStatus:!0})},[R]);const ie=(0,n.hb)(()=>{B(!M)},[M]),se=(0,n.hb)(()=>{x(!L)},[L]),oe=te,re="all"===R&&g&&!g.chats&&!g.messages&&!X.length&&!ee.length&&!oe.length,le=g?.messages,ce=!t&&!i&&!e,{observe:de}=(0,yr.BL)({rootRef:I,throttleMs:200,isDisabled:!ce});if(ce)return(0,ne.Y)(pd,{onReset:C});const ue="all"!==R||Boolean(oe.length);return(0,ne.FD)(mn.A,{ref:I,className:"LeftSearch--content custom-scroll",items:oe,onLoadMore:_,noScrollRestoreOnTop:!0,noFastList:!0,children:[r&&(0,ne.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ne.Y)(od,{searchDate:r,onSelect:b})}),re&&(0,ne.Y)(Jc.A,{withSticker:!0,text:F("ChatListSearchNoResults"),description:F("ChatListSearchNoResultsDescription")}),Boolean(X.length)&&!e&&(0,ne.Y)("div",{className:"chat-selection no-scrollbar",dir:F.isRtl?"rtl":void 0,ref:P,children:X.map(e=>(0,ne.Y)(xn.A,{peerId:e,className:"left-search-local-suggestion",onClick:O,clickArg:e}))}),Boolean(X.length)&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[X.length>5&&(0,ne.Y)(Oa.A,{className:"Link",onClick:ie,children:F(M?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F(e?"SearchResultMyChannels":"DialogListSearchSectionDialogs")]}),X.map((e,t)=>{if(M||!(t>=5))return(0,ne.Y)(Zc,{withOpenAppButton:!0,chatId:e,onClick:U})})]}),Boolean(ee.length)&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[ee.length>5&&(0,ne.Y)(Oa.A,{className:"Link",onClick:se,children:F(L?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F("DialogListSearchSectionGlobal")]}),f&&(0,ne.Y)(ud,{sponsoredPeer:f,observeIntersection:de}),ee.map((e,t)=>{if(L||!(t>=5))return(0,ne.Y)(Zc,{chatId:e,withUsername:!0,onClick:U})})]}),Boolean(v?.length)&&!t&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.Y)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:F("SearchResultRecommendedChannels")}),v.map(e=>(0,ne.Y)(Zc,{chatId:e,withUsername:!0,onClick:U}))]}),(0,ne.FD)("div",{className:"menuOwner",ref:V,children:[(0,ne.Y)(it.A,{isOpen:J,anchor:j,getTriggerElement:W,getRootElement:$,getMenuElement:q,className:"chatResultsContextMenu",onClose:H,onCloseAnimationEnd:z,autoClose:!0,children:(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(me.A,{icon:"all"===R?"check":void 0,customIcon:"all"!==R?(0,ne.Y)("i",{className:Z}):void 0,onClick:()=>E("all"),children:K("all")}),(0,ne.Y)(me.A,{icon:"users"===R?"check":void 0,customIcon:"users"!==R?(0,ne.Y)("i",{className:Z}):void 0,onClick:()=>E("users"),children:K("users")}),(0,ne.Y)(me.A,{icon:"groups"===R?"check":void 0,customIcon:"groups"!==R?(0,ne.Y)("i",{className:Z}):void 0,onClick:()=>E("groups"),children:K("groups")}),(0,ne.Y)(me.A,{icon:"channels"===R?"check":void 0,customIcon:"channels"!==R?(0,ne.Y)("i",{className:Z}):void 0,onClick:()=>E("channels"),children:K("channels")})]})}),ue&&(0,ne.FD)("div",{className:"search-section",children:[(0,ne.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[!e&&(0,ne.FD)(Oa.A,{className:"Link menuTrigger dropDownLink",onClick:Q,children:[F("SearchContextCaption",{type:K(R)},{withNodes:!0}),(0,ne.FD)(ae.Ay,{name:"fade",shouldCleanup:!0,activeKey:Number(le),className:"iconContainer",slideClassName:"iconContainerSlide",children:[le&&(0,ne.Y)(Jn.A,{}),!le&&(0,ne.Y)(he.A,{name:"down"})]})]}),F("SearchMessages")]}),oe.map(function(e){const i=(0,s.mS)().chats.byId,n=(0,A.C)(F,e),o=i[e.chatId];if(n&&o)return(0,ne.Y)(sd,{chatId:e.chatId,message:e,searchQuery:t})})]})]})]})}));var Ad=i(55723);const fd="documents",Cd=(0,Ce.nF)(e=>e(),500,!0),bd=(0,n.ph)((0,s.EK)(Uc(fd))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:c,foundIds:d,activeDownloads:h,shouldWarnAboutFiles:u})=>{const{searchMessagesGlobal:m,focusMessage:p}=(0,s.ko)(),g=(0,n.li)(),v=(0,B.A)(),{observe:A}=(0,yr.BL)({rootRef:g,throttleMs:500}),f=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&Cd(()=>{m({type:fd})})},[e]),C=(0,n.Kr)(()=>d&&c?d.map(e=>{const[t,i]=(0,_c.a)(e),n=c[t]?.byId[i];return n&&(0,l.zC)(n)?n:void 0}).filter(Boolean):gi.p,[c,d]),b=(0,n.hb)(e=>{p({chatId:e.chatId,messageId:e.id})},[p]),y=(0,Cr.A)([e],a.jhd)&&!t;return(0,ne.Y)(ae.Ay,{ref:g,slideClassName:"LeftSearch--content",name:"fade",activeKey:y?1:0,shouldCleanup:!0,children:(0,ne.FD)(mn.A,{className:"search-content documents-list custom-scroll",items:y?C:void 0,onLoadMore:f,noFastList:!0,children:[!y&&(0,ne.Y)(Jn.A,{}),y&&(!d||0===d.length)&&(0,ne.Y)(Jc.A,{withSticker:!0,text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),y&&d&&d.length>0&&C.map((e,t)=>{const n=0===t||(0,et.$$)(e.date)!==(0,et.$$)(C[t-1].date);return(0,ne.FD)(ne.FK,{children:[n&&(0,ne.Y)("p",{className:"section-heading",dir:v.isRtl?"rtl":void 0,children:(0,et.i6)(v,new Date(1e3*e.date))},e.date),(0,ne.Y)("div",{className:"ListItem small-icon",children:(0,ne.Y)(Ad.A,{document:(0,l.zC)(e),message:e,datetime:e.date,fileSize:"small",sender:(0,Oc.N)(v,e,i,r),className:"scroll-item",isDownloading:(0,l.$r)(h,e.content.document),shouldWarnAboutFiles:u,observeIntersection:A,onDateClick:b})},e.id)]})})]})})}));var yd=i(37378);const Sd="links",kd=(0,Ce.nF)(e=>e(),500,!0),Nd=(0,n.ph)((0,s.EK)(Uc(Sd))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:l,foundIds:c,isChatProtected:d})=>{const{searchMessagesGlobal:h,focusMessage:u}=(0,s.ko)(),m=(0,n.li)(),p=(0,B.A)(),{observe:g}=(0,yr.BL)({rootRef:m,throttleMs:500}),v=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&kd(()=>{h({type:Sd})})},[e]),A=(0,n.Kr)(()=>c&&l?c.map(e=>{const[t,i]=(0,_c.a)(e);return l[t]?.byId[i]}).filter(Boolean):gi.p,[l,c]),f=(0,n.hb)(e=>{u({chatId:e.chatId,messageId:e.id})},[u]),C=(0,Cr.A)([e],a.jhd)&&!t;return(0,ne.Y)(ae.Ay,{ref:m,slideClassName:"LeftSearch--content",name:"fade",activeKey:C?1:0,shouldCleanup:!0,children:(0,ne.FD)(mn.A,{className:"search-content documents-list custom-scroll",items:C?A:void 0,onLoadMore:v,noFastList:!0,children:[!C&&(0,ne.Y)(Jn.A,{}),C&&(!c||0===c.length)&&(0,ne.Y)(Jc.A,{withSticker:!0,text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),C&&c&&c.length>0&&A.map((e,t)=>{const n=0===t||(0,et.$$)(e.date)!==(0,et.$$)(A[t-1].date);return(0,ne.FD)(ne.FK,{children:[n&&(0,ne.Y)("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0,children:(0,et.i6)(p,new Date(1e3*e.date))},e.date),(0,ne.Y)("div",{className:"ListItem small-icon",dir:p.isRtl?"rtl":void 0,children:(0,ne.Y)(yd.A,{message:e,senderTitle:(0,Oc.N)(p,e,i,r),isProtected:d||e.isProtected,observeIntersection:g,onMessageClick:f},e.id)},e.id)]})})]})})}));var wd=i(81524);const Id="media",Pd=(0,Ce.nF)(e=>e(),500,!0),Yd=(0,n.ph)((0,s.EK)(Uc(Id))(({searchQuery:e,isLoading:t,globalMessagesByChatId:i,foundIds:r,isChatProtected:l})=>{const{searchMessagesGlobal:c,openMediaViewer:d,focusMessage:h}=(0,s.ko)(),u=(0,n.li)(),m=(0,B.A)(),p=(0,Bi.A)(),{observe:g}=(0,yr.BL)({rootRef:u,throttleMs:500}),v=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&Pd(()=>{c({type:Id})})},[c,e]),A=(0,n.Kr)(()=>r&&i?r.map(e=>{const[t,n]=(0,_c.a)(e);return i[t]?.byId[n]}).filter(Boolean):gi.p,[i,r]),f=(0,n.hb)((e,t)=>{d({chatId:t,messageId:e,origin:o.TQ.SearchResult})},[d]),C=(0,T.A)(e=>[{title:p("FocusMessage"),icon:"show-message",handler:()=>{h({chatId:e.chatId,messageId:e.id})}}]),b=(0,Cr.A)([e],a.jhd)&&!t,y=b&&r&&r.length>0&&!e,S=b&&r&&r.length>0&&e,k=(0,ve.A)("search-content custom-scroll",S&&"chat-list");return(0,ne.Y)(ae.Ay,{ref:u,slideClassName:"LeftSearch--content LeftSearch--media",name:"fade",activeKey:b?1:0,shouldCleanup:!0,children:(0,ne.FD)(mn.A,{className:k,items:b?A:void 0,itemSelector:e?".ListItem":".Media",onLoadMore:v,noFastList:!0,children:[!b&&(0,ne.Y)(Jn.A,{}),b&&(!r||0===r.length)&&(0,ne.Y)(Jc.A,{withSticker:!0,text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),y&&(0,ne.Y)("div",{className:"media-list",dir:m.isRtl?"rtl":void 0,children:A.map(e=>(0,ne.Y)(wd.A,{idPrefix:"search-media",message:e,isProtected:l||e.isProtected,observeIntersection:g,onClick:f,contextActions:C(e)},`${e.chatId}-${e.id}`))}),S&&A.map(e=>(0,ne.Y)(sd,{chatId:e.chatId,message:e},e.id))]})})}));var Fd=i(537),Dd=i(61361);const Md={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"},Td=(0,Ce.nF)(e=>e(),500,!1),Bd=(0,n.ph)((0,s.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),starsBalance:e.stars?.balance?.amount||0}))(({searchQuery:e,searchFlood:t,onSearch:i,isLoading:o,isCurrentUserPremium:r,starsBalance:l})=>{const{checkSearchPostsFlood:c,openPremiumModal:d,openStarsBalanceModal:h}=(0,s.ko)(),u=(0,Bi.A)(),m=t?.queryIsFree,p=t?.query,g=(0,Fd.A)([e?.slice(0,18).trimEnd()]),v=(0,T.A)(()=>{i()});(0,n.vJ)(()=>{m&&e&&p===e&&i()},[m,e,p,i]);const A=(0,T.A)(()=>{const e=t?.starsAmount||0;l<e?h({topup:{balanceNeeded:e}}):i()});(0,n.vJ)(()=>{e&&p!==e&&Td(()=>{c({query:e})})},[e,p]);const f=(0,T.A)(()=>{c({})}),C=(0,T.A)(()=>{d()}),b=(0,Di.Fm)(),y=0===t?.remains||t?.waitTill&&t.waitTill>b;return(0,ne.Y)(ae.Ay,{name:"fade",activeKey:r?o?2:y?0:1:3,children:r?o?(0,ne.Y)("div",{className:Md.container,children:(0,ne.Y)("div",{className:(0,ve.A)(Md.content,Md.loadingScreen),children:(0,ne.Y)(Jn.A,{})})}):y?(()=>{const i=t?.waitTill,n=t?.starsAmount||a._tP,s=t?.totalDaily||a.M3$;return(0,ne.Y)("div",{className:Md.container,children:(0,ne.FD)("div",{className:Md.content,children:[(0,ne.Y)(Oo.A,{className:Md.sticker,size:120,tgsUrl:Uo.w.Search,previewUrl:Uo.d.Search,nonInteractive:!0,noLoop:!1}),(0,ne.Y)("div",{className:Md.limitTitle,children:u("PublicPostsLimitReached")}),(0,ne.Y)("div",{className:Md.limitDescription,children:u("HintPublicPostsSearchQuota",{count:s},{pluralValue:s})}),(0,ne.Y)(X.A,{className:Md.paidSearchButton,color:"primary",disabled:!e,noForcedUpperCase:!0,inline:!0,onClick:A,children:u("PublicPostsSearchForStars",{stars:(0,Fi.U2)(u,n,{asFont:!0})},{withNodes:!0})}),Boolean(i)&&(0,ne.Y)("div",{className:Md.freeSearchUnlock,children:u("UnlockTimerPublicPostsSearch",{time:(0,ne.Y)(Dd.A,{endsAt:i+2,onEnd:f})},{withNodes:!0})})]})})})():(()=>{const i=t?.remains||0;return(0,ne.Y)("div",{className:Md.container,children:(0,ne.FD)("div",{className:Md.content,children:[(0,ne.Y)(Oo.A,{className:Md.sticker,size:120,tgsUrl:Uo.w.Search,previewUrl:Uo.d.Search,nonInteractive:!0,noLoop:!1}),(0,ne.Y)("div",{className:Md.title,children:u("GlobalSearch")}),(0,ne.Y)("div",{className:Md.description,children:u("DescriptionPublicPostsSearch")}),(0,ne.Y)(X.A,{className:Md.searchButton,color:"primary",noForcedUpperCase:!0,disabled:!e,onClick:v,children:(0,ne.Y)(ae.Ay,{name:"fade",activeKey:g,children:(0,ne.FD)("div",{className:Md.searchButtonContent,children:[(0,ne.Y)(he.A,{name:"search",className:(0,ve.A)(Md.searchIcon,e&&Md.searchIconWithNext)}),u("ButtonSearchPublicPosts",{query:e?(0,ne.Y)("span",{className:Md.searchQuery,children:e}):""},{withNodes:!0}),e&&(0,ne.Y)(he.A,{name:"next",className:Md.nextIcon})]})})}),(0,ne.Y)("div",{className:Md.remainingSearches,children:u("RemainingPublicPostsSearch",{count:i},{pluralValue:i})})]})})})():(0,ne.Y)("div",{className:Md.container,children:(0,ne.FD)("div",{className:Md.content,children:[(0,ne.Y)("div",{className:Md.premiumTitle,children:u("GlobalSearch")}),(0,ne.Y)("div",{className:Md.premiumDescription,children:u("PublicPostsPremiumFeatureDescription")}),(0,ne.Y)(X.A,{className:Md.subscribePremiumButton,color:"primary",noForcedUpperCase:!0,onClick:C,children:u("PublicPostsSubscribeToPremium")}),(0,ne.Y)("div",{className:Md.premiumSubtitle,children:u("PublicPostsPremiumFeatureSubtitle")})]})})})})),Ld=(0,Ce.nF)(e=>e(),500,!0),xd=(0,n.ph)((0,s.EK)(e=>{const{messages:{byChatId:t}}=e,{resultsByType:i,searchFlood:n,fetchingStatus:s}=(0,c.nTw)(e).globalSearch,o=i?.publicPosts,{foundIds:a}=o||{},r=Boolean(s?.publicPosts&&!o),l=!o&&!r,d=o&&!a?.length,{animationLevel:h}=(0,Rn.lS)(e);return{foundIds:a,globalMessagesByChatId:t,searchFlood:n,shouldShowSearchLauncher:l,isNothingFound:d,isLoading:r,animationLevel:h}})(({searchQuery:e,foundIds:t,globalMessagesByChatId:i,searchFlood:a,shouldShowSearchLauncher:r,isNothingFound:l,isLoading:c,animationLevel:d})=>{const{searchMessagesGlobal:h}=(0,s.ko)(),u=(0,Bi.A)(),m=(0,T.A)(()=>{e&&h({type:"publicPosts",shouldResetResultsByType:!0})}),p=(0,n.hb)(({direction:e})=>{e===o.TN.Backwards&&Ld(()=>{h({type:"publicPosts"})})},[]),g=(0,n.Kr)(()=>t&&0!==t.length?t.map(e=>{const[t,n]=(0,_c.a)(e);return i?.[t]?.byId[n]}).filter(Boolean):gi.p,[t,i]);return(0,ne.Y)(ae.Ay,{name:(0,Vn.P)("slideOptimized",d,void 0,u.isRtl),activeKey:r||c?0:1,children:r||c?(0,ne.Y)(Bd,{searchQuery:e,searchFlood:a,onSearch:m,isLoading:c}):(0,ne.Y)("div",{className:"LeftSearch--content",children:(0,ne.FD)(mn.A,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:p,noFastList:!0,children:[l&&(0,ne.Y)(Jc.A,{text:u("ChatListSearchNoResults"),description:u("ChatListSearchNoResultsDescription"),withSticker:!0}),Boolean(g.length)&&(0,ne.FD)("div",{className:"pb-2",children:[(0,ne.Y)("h3",{className:"section-heading",dir:u.isRtl?"auto":void 0,children:u("PublicPosts")}),g.map(function(t){const i=(0,s.mS)().chats.byId,n=(0,A.C)(u,t),o=i[t.chatId];if(n&&o)return(0,ne.Y)(sd,{chatId:t.chatId,message:t,searchQuery:e},`${t.chatId}-${t.id}`)})]})]},e)})})})),Rd=[{type:o.$C.ChatList,key:"SearchTabChats"},{type:o.$C.ChannelList,key:"SearchTabChannels"},{type:o.$C.BotApps,key:"SearchTabApps"},{type:o.$C.PublicPosts,key:"SearchTabPublicPosts"},{type:o.$C.Media,key:"SearchTabMedia"},{type:o.$C.Links,key:"SearchTabLinks"},{type:o.$C.Files,key:"SearchTabFiles"},{type:o.$C.Music,key:"SearchTabMusic"},{type:o.$C.Voice,key:"SearchTabVoice"}],Ed=[{type:o.$C.ChatList,key:"SearchTabMessages"},...Rd.slice(3)],Vd=(0,n.ph)((0,s.EK)(e=>{const{currentContent:t,chatId:i}=(0,c.nTw)(e).globalSearch,{animationLevel:n}=(0,Rn.lS)(e);return{currentContent:t,chatId:i,animationLevel:n}})(({searchQuery:e,searchDate:t,isActive:i,currentContent:a=o.$C.ChatList,chatId:r,animationLevel:l,onReset:c})=>{const{setGlobalSearchContent:d,setGlobalSearchDate:h,checkSearchPostsFlood:u}=(0,s.ko)(),m=(0,Bi.A)(),[p,g]=(0,n.J0)(a),v=(0,n.Kr)(()=>(0,et.Rm)(e),[e]);(0,n.vJ)(()=>{i&&u({})},[i]);const A=(0,n.Kr)(()=>(r?Ed:Rd).map(e=>({...e,title:m(e.key)})),[r,m]),f=(0,T.A)(e=>{const t=A[e];d({content:t.type}),g(e)}),C=(0,T.A)(e=>{h({date:e.getTime()/1e3})});(0,ke.A)({isActive:i,onBack:c});const b=(0,n.li)(),y=(0,Kn.A)(b,i,void 0,".ListItem-button",!0);return(0,ne.FD)("div",{className:"LeftSearch",ref:b,onKeyDown:y,children:[(0,ne.Y)(Vc.A,{activeTab:p,tabs:A,onSwitchTab:f}),(0,ne.Y)(ae.Ay,{name:(0,Vn.P)("slideOptimized",l,void 0,m.isRtl),renderCount:A.length,activeKey:a,children:(()=>{switch(a){case o.$C.ChatList:case o.$C.ChannelList:return r?(0,ne.Y)(cd,{searchQuery:e,dateSearchQuery:v,onReset:c,onSearchDateSelect:C}):(0,ne.Y)(vd,{isChannelList:a===o.$C.ChannelList,searchQuery:e,searchDate:t,dateSearchQuery:v,onReset:c,onSearchDateSelect:C});case o.$C.Media:return(0,ne.Y)(Yd,{searchQuery:e});case o.$C.Links:return(0,ne.Y)(Nd,{searchQuery:e});case o.$C.Files:return(0,ne.Y)(bd,{searchQuery:e});case o.$C.Music:return(0,ne.Y)(Gc,{searchQuery:e},"audio");case o.$C.Voice:return(0,ne.Y)(Gc,{isVoice:!0,searchQuery:e},"voice");case o.$C.BotApps:return(0,ne.Y)(ed,{searchQuery:e},"botApps");case o.$C.PublicPosts:return(0,ne.Y)(xd,{searchQuery:e},"publicPosts");default:return}})()})]})}));var _d=i(42215);const Ud={currentPassword:"",password:"",hint:"",email:""},Od=(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 Ud;default:return e}};var Kd=i(31880),Jd=i(58968);const jd=(0,n.ph)((0,s.EK)(e=>({maxChats:(0,In.d)(e,"dialogFiltersChats")}))(({mode:e,state:t,dispatch:i,isActive:o,onReset:r,onSaveFilter:l,maxChats:c})=>{const d=(0,B.A)(),{openLimitReachedModal:h}=(0,s.ko)(),{chatFilter:u}=t,{selectedChatIds:m,selectedChatTypes:p}=(0,n.Kr)(()=>(0,Kd.a)(t,e,!0),[e,t]),g="included"===e?Jd.V2:Jd.LS,[v,A]=(0,n.J0)(!1),f=(0,Mn.Rh)(a.DSF),C=(0,Mn.Rh)(a._E9),b=t.folder.isChatList;(0,n.vJ)(()=>{o||A(!1)},[o]);const y=(0,n.Kr)(()=>{const e=[...f||[],...C||[]];return(0,pi.Am)([...(0,Dt.PU)({ids:e,query:u,type:"chat"})])},[f,C,u]),S=(0,T.A)(e=>{i({type:"setChatFilter",payload:e}),A(!0)}),k=(0,T.A)(n=>{if("included"===e){if(n.length>=c)return void h({limit:"dialogFiltersChats"});i({type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:n}})}else i({type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:n}});A(!0)}),N=(0,T.A)(t=>{const n={};t.forEach(e=>{n[e]=!0}),i("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:m,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:m,...n}}),A(!0)});return(0,ke.A)({isActive:o,onBack:r}),y?(0,ne.FD)("div",{className:"Picker settings-folders-chat-list settings-picker-islands",children:[(0,ne.Y)(vi.A,{categories:b?void 0:g,itemIds:y,selectedIds:m,selectedCategories:p,filterValue:u,filterPlaceholder:d("Search"),categoryPlaceholderKey:"FilterChatTypes",searchInputId:"new-group-picker-search",isSearchable:!0,withDefaultPadding:!0,withPeerTypes:!0,withIslands:!0,allowMultiple:!0,itemInputType:"checkbox",onSelectedIdsChange:k,onSelectedCategoriesChange:N,onFilterChange:S}),(0,ne.Y)(fi.A,{isShown:v,onClick:l,ariaLabel:d("Save"),iconName:"check"})]}):(0,ne.Y)(Jn.A,{})}));var Gd=i(72167),Hd=i(79462),zd=i(37903),$d=i(98021);const qd=(0,n.ph)(({isOpen:e,onEmojiSelect:t,onClose:i})=>{const s=(0,n.hb)(e=>{t(e),i()},[i,t]);return(0,ne.Y)(it.A,{isOpen:e,positionX:"left",onClose:i,withPortal:!0,className:"settings-folders-icon-picker-menu SymbolMenu",children:(0,ne.FD)("div",{className:"SymbolMenu-main",children:[(0,ne.Y)("div",{className:"settings-folders-icon-picker-menu-folders",children:Object.keys($d.E6).map(e=>(0,ne.Y)("div",{className:"EmojiButton",onClick:()=>s(e),children:(0,ne.Y)(he.A,{name:$d.E6[e]})}))}),(0,ne.Y)(qr,{idPrefix:"folder-emoji-set-",loadAndPlay:e,isHidden:!e,onCustomEmojiSelect:e=>s(e),onDismiss:i})]})})}),Wd=[0,1,2,3,4,5,6],Qd="Please provide a title for this folder.",Zd="ChatList.Filter.Error.Empty",Xd=(0,n.ph)((0,s.EK)((e,{state:t})=>{const{listIds:i}=e.chats,{byId:n,invites:s}=e.chatFolders,o=Object.values(n).reduce((e,t)=>e+(t.isChatList?1:0),0),a=(0,c.g29)(e);return{loadedActiveChatIds:i.active,loadedArchivedChatIds:i.archived,invites:t.folderId?s[t.folderId]||gi.p:void 0,isRemoved:void 0!==t.folderId&&!n[t.folderId],maxInviteLinks:(0,In.d)(e,"chatlistInvites"),maxChatLists:(0,In.d)(e,"chatlistJoined"),chatListCount:o,isCurrentUserPremium:a}})(({state:e,dispatch:t,onAddIncludedChats:i,onAddExcludedChats:o,onShareFolder:r,onOpenInvite:l,isActive:d,onReset:h,isRemoved:u,onBack:m,loadedActiveChatIds:p,isOnlyInvites:v,loadedArchivedChatIds:A,invites:f,maxInviteLinks:C,maxChatLists:b,chatListCount:y,onSaveFolder:S,isCurrentUserPremium:k,isMobile:N})=>{const{loadChatlistInvites:w,openLimitReachedModal:I,showNotification:P,openPremiumModal:Y}=(0,s.ko)(),F="create"===e.mode,D=e.folder.isChatList,[M,L]=(0,n.J0)(!1),[x,R]=(0,n.J0)(!1),[E,V]=(0,n.J0)(!1);(0,n.vJ)(()=>{u&&h()},[u,h]),(0,n.vJ)(()=>{d&&e.folderId&&e.folder.isChatList&&w({folderId:e.folderId})},[d,e.folder.isChatList,e.folderId]);const{selectedChatIds:_,selectedChatTypes:U}=(0,n.Kr)(()=>(0,Kd.a)(e,"included"),[e]),{selectedChatIds:O,selectedChatTypes:K}=(0,n.Kr)(()=>(0,Kd.a)(e,"excluded"),[e]);(0,n.vJ)(()=>{L(!1),R(!1)},[e.folderId]);const[J,G]=(0,n.Kr)(()=>{const e=new Set([...p||[],...A||[]]),t=(0,pi.$h)(_,e),i=(0,pi.$h)(O,e);return[M?t:t.slice(0,5-U.length),x?i:i.slice(0,5-K.length)]},[O,_,U,K,x,M,p,A]),H=(0,B.A)(),z=(0,Bi.A)();(0,ke.A)({isActive:d,onBack:m});const $=(0,n.Kr)(()=>e.folder.title.entities?.find(e=>e.type===j.C7.CustomEmoji&&0===e.offset),[e.folder.title]),q=(0,n.Kr)(()=>a.kGl-($?$.length:0),[$]),W=(0,n.hb)(i=>{let n=e.folder.title.text;const s=[];let o="🗂";if($){const{offset:e,length:t}=$;n=n.replace(n.substring(e,e+t),"")}if("string"==typeof i)o=i;else{const{id:e,emoji:t}=i;s.push({type:j.C7.CustomEmoji,documentId:e,offset:0,length:t?.length||2}),t&&(n=`${t}${n}`,o=t,n.length>q&&(n=n.slice(0,q)))}t({type:"setEmoticon",payload:o}),t({type:"setTitle",payload:{text:n,entities:s}})},[t,$,e.folder.title,q]),Q=(0,n.hb)(e=>{const{currentTarget:i}=e;let n=i.value;if($){const{emoji:e}=(0,c.O8F)((0,s.mS)(),$.documentId);n=`${e}${n}`}t({type:"setTitle",payload:{text:n,entities:$?[$]:[]}})},[t,$]),Z=(0,n.hb)(()=>{t({type:"setIsLoading",payload:!0}),S(()=>{setTimeout(()=>{h()},500)})},[t,S,h]),X=(0,n.hb)(()=>{f?(0,c.w5O)((0,s.mS)(),e.folderId)?y>=b&&!e.folder.isChatList?I({limit:"chatlistJoined"}):f.length<C?e.isTouched?S(r):r():I({limit:"chatlistInvites"}):P({message:H("ChatList.Filter.InviteLink.IncludeExcludeError")}):F&&S(r)},[f,e.folderId,e.isTouched,y,C,F,S,r,H,b,e.folder.isChatList]),te=(0,n.hb)((t,i)=>{e.isTouched?S(()=>l(i)):l(i)},[S,l,e.isTouched]);function ie(e){const t="included"===e?U:K,i="included"===e?J:G,n="included"===e?M:x,s=("included"===e?_:O).length-i.length,o="included"===e?()=>L(!0):()=>R(!0);return(0,ne.FD)(ne.FK,{children:[t.map(t=>function(e,t){const i="included"===t?Jd.V2.find(({type:t})=>t===e):Jd.LS.find(({type:t})=>t===e);if(i)return(0,ne.Y)(ui.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,ne.Y)(An.A,{avatarSize:"small",customPeer:i})},i.type)}(t,e)),i.map(e=>(0,ne.Y)(ui.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,g.L8)(e)?(0,ne.Y)(An.A,{avatarSize:"small",userId:e}):(0,ne.Y)(vn.A,{avatarSize:"small",chatId:e})})),!n&&s>0&&(0,ne.Y)(ui.A,{className:"settings-folders-list-item",narrow:!0,onClick:o,icon:"down",children:H("FilterShowMoreChats",s,"i")},"load-more")]})}const se=(0,T.A)(e=>{W(e)}),oe=(0,T.A)(()=>{V(!1)}),ae=(0,T.A)(()=>{V(!0)}),re=(0,n.Kr)(()=>{let t=e.folder.title.text;if($){const{offset:e,length:i}=$;t=t.substring(e+i,t.length)}return t},[e.folder.title.text,$]);return(0,ne.FD)("div",{className:"settings-fab-wrapper",children:[(0,ne.FD)(zd.A,{scrollable:!0,className:"settings-content no-border",children:[(0,ne.FD)(Hd.LY,{className:"settings-content-header settings-folders-header",children:[(0,ne.Y)(Oo.A,{size:a.fwn,tgsUrl:Uo.w.FoldersNew,play:String(e.folderId),className:"settings-content-icon"}),F&&(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterIncludeInfo")}),(0,ne.FD)(Hd.Ay,{className:"settings-folders-input-container",children:[(0,ne.Y)(ee.A,{className:(0,ve.A)(!N&&"settings-folders-input-with-icon"),label:z("FilterNameHint"),value:re,maxLength:q,onChange:Q,error:e.error&&e.error===Qd?Qd:void 0}),!N&&(0,ne.FD)("div",{className:"settings-folders-icon-picker",dir:z.isRtl?"rtl":void 0,children:[(0,ne.Y)("div",{className:"settings-folders-icon-picker-button",onClick:ae,children:(0,ne.Y)(Gd.A,{emoji:e.folder.emoticon,customEmojiId:$?.documentId,shouldAnimate:e.folder.noTitleAnimations})}),(0,ne.Y)(qd,{isOpen:E,onEmojiSelect:se,onClose:oe})]})]})]}),!v&&(0,ne.FD)(ne.FK,{children:[e.error&&e.error===Zd&&(0,ne.Y)(Hd.IW,{className:"color-danger",dir:z.isRtl?"rtl":void 0,children:H(e.error)}),(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:z("FilterInclude")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:i,children:z("FilterAddChats")}),ie("included")]})]}),!v&&!D&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:z("FilterExclude")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:o,children:z("FilterAddChats")}),ie("excluded")]})]}),(0,ne.FD)(Hd.Qg,{className:"color-picker-header",dir:z.isRtl?"rtl":void 0,children:[(0,ne.Y)("span",{className:"color-picker-title-text",children:z("FilterColorTitle")}),(0,ne.Y)("div",{className:(0,ve.A)("color-picker-title","color-picker-selected-color",k&&void 0!==e.folder.color&&-1!==e.folder.color?(0,zi.yp)(e.folder.color):"color-picker-item-disabled"),children:(0,Gi.fd)({text:e.folder.title.text,entities:e.folder.title.entities,noCustomEmojiPlayback:e.folder.noTitleAnimations})})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)("div",{className:"color-picker custom-scroll-x",children:[Wd.map(i=>(0,ne.Y)("button",{type:"button",onClick:()=>{k?t({type:"setColor",payload:i}):Y()},className:(0,ve.A)("color-picker-item",(0,zi.yp)(i),!k&&"color-picker-item-hover-disabled",i===e.folder.color&&k&&"color-picker-item-active")},i)),(0,ne.Y)("button",{type:"button",onClick:()=>{k?t({type:"setColor",payload:void 0}):Y()},className:(0,ve.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,ne.Y)(he.A,{name:"close",className:"color-picker-item-none-icon"}):(0,ne.Y)(he.A,{name:"lock-badge",className:"color-picker-item-none-icon"})})]})}),(0,ne.Y)(Hd.IW,{dir:z.isRtl?"rtl":void 0,children:z("FilterColorHint")}),(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:H("FolderLinkScreen.Title")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:X,children:H("ChatListFilter.CreateLinkNew")}),f?.map(e=>(0,ne.FD)(ui.A,{className:"settings-folders-list-item",icon:"link",narrow:!0,multiline:!0,onClick:te,clickArg:e.url,children:[(0,ne.Y)("span",{className:"title",dir:"auto",children:e.title||e.url}),(0,ne.Y)("span",{className:"subtitle",children:H("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i")})]}))]})]}),(0,ne.Y)(fi.A,{isShown:Boolean(e.isTouched),disabled:e.isLoading,onClick:Z,ariaLabel:"edit"===e.mode?"Save changes":"Create folder",iconName:"check",isLoading:e.isLoading})]})}));var eh=i(80401);const th=(0,Ce.nF)(e=>e(),6e4,!0),ih=(0,n.ph)((0,s.EK)(e=>{const{orderedIds:t,byId:i,recommended:n,areTagsEnabled:s}=e.chatFolders;return{folderIds:t,foldersById:i,isPremium:(0,c.g29)(e),recommendedChatFolders:n,maxFolders:(0,In.d)(e,"dialogFilters"),areTagsEnabled:s,foldersPosition:e.sharedState.settings.foldersPosition}})(({isActive:e,foldersById:t,isPremium:i,recommendedChatFolders:o,maxFolders:r,areTagsEnabled:c,foldersPosition:d,isMobile:h,onCreateFolder:u,onEditFolder:m,onReset:p,folderIds:g})=>{const{loadRecommendedChatFolders:v,addChatFolder:A,openLimitReachedModal:f,openDeleteChatFolderModal:C,sortChatFolders:b,toggleDialogFilterTags:y,openPremiumModal:S,setSharedSettingOption:k}=(0,s.ko)(),[N,w]=(0,n.J0)({orderedFolderIds:g,dragOrderIds:g,draggedIndex:void 0}),I=(0,K.A)(g);(0,n.vJ)(()=>{I!==g&&w({orderedFolderIds:g,dragOrderIds:g,draggedIndex:void 0})},[I,g,N.orderedFolderIds?.length]),(0,n.vJ)(()=>{th(()=>{v()})},[v]);const P=(0,n.hb)(()=>{Object.keys(t).length>=r-1?f({limit:"dialogFilters"}):u()},[t,r,u,f]),Y=(0,Bi.A)();(0,ke.A)({isActive:e,onBack:p});const F=(0,Mn.g5)(),D=(0,n.Kr)(()=>{if(g)return g.length<=1?gi.p:g.map(e=>{const i=t[e];return e===a.DSF?{id:e,title:{text:Y("FilterAllChats"),entities:[]}}:{id:i.id,title:i.title,subtitle:(0,l.A5)(Y,i,F[i.id]),isChatList:i.isChatList,color:i.color,noTitleAnimations:i.noTitleAnimations}})},[g,t,Y,F]),M=(0,n.hb)(e=>{Object.keys(t).length>=r-1?f({limit:"dialogFilters"}):A({folder:e})},[t,r,A,f]),B=(0,n.hb)(()=>{i&&y({isEnabled:!c})},[c,i,y]),L=(0,n.hb)((e,t)=>{const n=Math.round(e.y/56),s=N.orderedFolderIds?.indexOf(t)||0,o=N.orderedFolderIds?.filter(e=>e!==t);o&&(0,fe.Bt)(s+n,0,g?.length||0)&&(o.splice(s+n+(i?0:1),0,t),w(e=>({...e,draggedIndex:s,dragOrderIds:o})))},[g?.length,i,N.orderedFolderIds]),x=(0,n.hb)(()=>{w(e=>(b({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0}))},[b]),R=(0,T.A)(e=>{k({foldersPosition:e})}),E=(0,n.Kr)(()=>!i||Object.keys(t).length<r-1,[t,i,r]);return(0,ne.FD)(zd.A,{scrollable:!0,className:"settings-content no-border",children:[(0,ne.FD)(Hd.LY,{className:"settings-content-header",children:[(0,ne.Y)(Oo.A,{size:a.fwn,tgsUrl:Uo.w.FoldersAll,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:Y("CreateNewFilterInfo")}),E&&(0,ne.Y)(X.A,{className:"settings-button with-icon",color:"primary",pill:!0,fluid:!0,onClick:P,isRtl:Y.isRtl,iconName:"add",children:Y("CreateNewFilter")})]}),(0,ne.Y)(Hd.Qg,{dir:Y.isRtl?"rtl":void 0,children:Y("Filters")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{className:"settings-sortable-container",style:`height: ${56*(g?.length||0)}px`,children:D?.length?D.map((n,s)=>{const o=s>r-1,l=N.draggedIndex===s,d=56*(N.orderedFolderIds?.indexOf(n.id)??0),h=56*(N.dragOrderIds?.indexOf(n.id)??0),u=void 0!==n?.color&&-1!==n.color&&c;return n.id===a.DSF?(0,ne.Y)(eh.A,{id:n.id,onDrag:L,onDragEnd:x,style:`top: ${l?d:h}px;`,knobStyle:(Y.isRtl?"left":"right")+": 0.375rem;",isDisabled:!i||!e,children:(0,ne.FD)(ui.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0,allowSelection:!0,children:[(0,ne.Y)("span",{className:"title",children:(0,Gi.fd)({text:n.title.text,entities:n.title.entities,noCustomEmojiPlayback:n.noTitleAnimations})}),(0,ne.Y)("span",{className:"subtitle",children:Y("FoldersAllChatsDesc")})]},n.id)},n.id):(0,ne.Y)(eh.A,{id:n.id,onDrag:L,onDragEnd:x,style:`top: ${l?d:h}px;`,knobStyle:`${Y.isRtl?"left":"right"}: ${u?"4rem":"2.5rem"};`,isDisabled:o||!e,children:(0,ne.FD)(ui.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{C({folderId:n.id})},destructive:!0,title:Y("Delete"),icon:"delete"}],onClick:()=>{o?f({limit:"dialogFilters"}):m(t[n.id])},children:[(0,ne.FD)("span",{className:"title",children:[(0,Gi.fd)({text:n.title.text,entities:n.title.entities,noCustomEmojiPlayback:n.noTitleAnimations}),o&&(0,ne.Y)(he.A,{name:"lock-badge",className:"settings-folders-blocked-icon"})]}),(0,ne.FD)("span",{className:"subtitle",children:[n.isChatList&&(0,ne.Y)(he.A,{name:"link",className:"mr-1"}),n.subtitle]}),u&&(0,ne.Y)("div",{className:(0,ve.A)("settings-folders-color-circle",void 0!==n.color&&-1!==n.color&&(0,zi.yp)(n.color))})]})},n.id)}):D&&!D.length?(0,ne.Y)("p",{className:"settings-item-description my-4",dir:"auto",children:Y("SettingsFoldersEmpty")}):(0,ne.Y)(Jn.A,{})})}),o&&Boolean(o.length)&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:Y.isRtl?"rtl":void 0,children:Y("FilterRecommended")}),(0,ne.Y)(Hd.Ay,{children:o.map(e=>(0,ne.Y)(ui.A,{narrow:!0,onClick:()=>M(e),children:(0,ne.FD)("div",{className:"settings-folders-recommended-item",children:[(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:(0,Gi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,ne.Y)("span",{className:"subtitle",children:e.description})]}),(0,ne.Y)(X.A,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:Y.isRtl,children:Y("Add")})]})},e.id))})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)("div",{className:"settings-item-relative",children:[(0,ne.Y)(es.A,{label:Y("ShowFolderTags"),subLabel:Y("ShowFolderTagsHint"),checked:i&&c,onChange:B,onClickLabel:e=>{i||(e.preventDefault(),S())}}),!i&&(0,ne.Y)(he.A,{name:"lock-badge",className:"settings-folders-lock-icon"})]})}),!h&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:Y.isRtl?"rtl":void 0,children:Y("TabsPosition")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"tabsPosition",options:[{label:Y("TabsPositionLeft"),value:a._C3},{label:Y("TabsPositionTop"),value:a.ATy}],selected:d,onChange:R})})]})]})}));var nh=i(4438);const sh=(0,n.ph)((0,s.EK)(e=>{const{folderId:t,url:i,isLoading:n}=(0,c.nTw)(e).shareFolderScreen||{},s=t?(0,c.$aQ)(e,t):void 0,o=t?e.chatFolders.invites[t]?.find(e=>e.url===i):void 0;return{folderId:t,folder:s,url:i,isLoading:n,peerIds:o?.peerIds}})(({isActive:e,onReset:t,folderId:i,folder:o,peerIds:r,url:d,isLoading:h})=>{const{createChatlistInvite:u,deleteChatlistInvite:m,editChatlistInvite:p,showNotification:g}=(0,s.ko)(),v=(0,Bi.A)(),A=(0,B.A)(),[f,C]=(0,n.J0)(!1);(0,ke.A)({isActive:e,onBack:t}),(0,n.vJ)(()=>{h||C(!1)},[h]),(0,n.vJ)(()=>{!d&&i&&e&&u({folderId:i})},[i,e,d]);const b=(0,T.A)(()=>{d&&i&&(m({folderId:i,url:d}),t())}),y=(0,n.Kr)(()=>(o?.includedChatIds||[]).concat(o?.pinnedChatIds||[]),[o?.includedChatIds,o?.pinnedChatIds]),[S,k]=(0,n.Kr)(()=>{const e=(0,s.mS)();return(0,pi.jB)(y,t=>(0,c.hXb)(e,t))},[y]),[N,w]=(0,n.J0)(r||[]),I=(0,n.li)(!0);(0,F.A)(([e])=>{e!==d&&(I.current=!0),I.current&&(I.current=!1,d?r&&w(r):w(S))},[d,S,r]);const P=(0,T.A)(e=>{const t=(0,s.mS)(),i=(0,c.mBe)(t,e),n=(0,c.hds)(t,e);i&&(0,l.tv)(i)?g({message:A("FolderLinkScreen.AlertTextUnavailableBot")}):i?g({message:A("FolderLinkScreen.AlertTextUnavailableUser")}):n&&(0,l.WX)(n)?g({message:A("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):g({message:A("FolderLinkScreen.AlertTextUnavailablePublicGroup")})}),Y=(0,T.A)(e=>{w(e),C(!0)}),D=(0,T.A)(()=>{i&&d&&f&&p({folderId:i,peerIds:N,url:d})}),M=N.length,L=!M||h;return(0,ne.FD)("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker",children:[(0,ne.FD)("div",{className:"settings-content-header",children:[(0,ne.Y)(nh.A,{size:a.fwn,tgsUrl:Uo.w.FoldersShare,className:"settings-content-icon"}),o&&(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:v("FolderLinkTitleDescription",{folder:(0,Gi.fd)({text:o.title.text,entities:o.title.entities,noCustomEmojiPlayback:o.noTitleAnimations}),chats:v("FolderLinkTitleDescriptionChats",{count:M},{pluralValue:M})},{withMarkdown:!0,withNodes:!0})})]}),(0,ne.Y)(Hd.Qg,{children:A("InviteLink.InviteLink")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ol.A,{link:d||A("Loading"),withShare:!0,noTitle:!0,onRevoke:b,isDisabled:!M||f})}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(vi.A,{itemIds:y,lockedUnselectedIds:k,onSelectedIdsChange:Y,selectedIds:N,onDisabledClick:P,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})}),(0,ne.Y)(fi.A,{isShown:h||f,disabled:L,onClick:D,ariaLabel:"Save changes",iconName:"check",isLoading:h})]})})),oh=(0,n.ph)(({currentScreen:e,shownScreen:t,state:i,dispatch:a,isActive:r,onReset:l})=>{const{isMobile:c}=(0,Y.Ay)(),{openShareChatFolderModal:d,editChatFolder:h,addChatFolder:u,openSettingsScreen:m}=(0,s.ko)(),p=(0,n.hb)(()=>{e!==o.VS.FoldersCreateFolder&&e!==o.VS.FoldersEditFolder&&e!==o.VS.FoldersEditFolderFromChatList&&e!==o.VS.FoldersEditFolderInvites||setTimeout(()=>{a({type:"reset"})},200),e!==o.VS.FoldersIncludedChats&&e!==o.VS.FoldersExcludedChats?l():"create"===i.mode?m({screen:o.VS.FoldersCreateFolder}):m({screen:o.VS.FoldersEditFolder})},[i.mode,a,e,l]),g="create"===i.mode,v=(0,n.hb)(e=>{const{title:{text:t}}=e.folder;if(!t)return a({type:"setError",payload:Qd}),!1;const{selectedChatIds:i,selectedChatTypes:n}=(0,Kd.a)(e,"included");return i.length||Object.keys(n).length?(g?u({folder:e.folder}):h({id:e.folderId,folderUpdate:e.folder}),a({type:"setError",payload:void 0}),a({type:"setIsTouched",payload:!1}),!0):(a({type:"setError",payload:Zd}),!1)},[a,g]),A=(0,n.hb)(e=>{v(i)&&e?.()},[v,i]),f=(0,n.hb)(()=>{a({type:"saveFilters"}),p()},[a,p]),C=(0,n.hb)(()=>{a({type:"reset"}),m({screen:o.VS.FoldersCreateFolder})},[a]),b=(0,n.hb)(e=>{a({type:"editFolder",payload:e}),m({screen:o.VS.FoldersEditFolder})},[a]),y=(0,n.hb)(()=>{a({type:"editIncludeFilters"}),m({screen:e===o.VS.FoldersEditFolderFromChatList?o.VS.FoldersIncludedChatsFromChatList:o.VS.FoldersIncludedChats})},[e,a]),S=(0,n.hb)(()=>{a({type:"editExcludeFilters"}),m({screen:e===o.VS.FoldersEditFolderFromChatList?o.VS.FoldersExcludedChatsFromChatList:o.VS.FoldersExcludedChats})},[e,a]),k=(0,n.hb)(()=>{d({folderId:i.folderId,noRequestNextScreen:!0}),a({type:"setIsChatlist",payload:!0}),m({screen:o.VS.FoldersShare})},[a,i.folderId]),N=(0,n.hb)(e=>{d({folderId:i.folderId,url:e,noRequestNextScreen:!0}),m({screen:o.VS.FoldersShare})},[i.folderId]);switch(e){case o.VS.Folders:return(0,ne.Y)(ih,{onCreateFolder:C,onEditFolder:b,isActive:r||[o.VS.FoldersCreateFolder,o.VS.FoldersEditFolder,o.VS.FoldersIncludedChats,o.VS.FoldersExcludedChats].includes(t),onReset:l,isMobile:c});case o.VS.FoldersCreateFolder:case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:return(0,ne.Y)(Xd,{state:i,dispatch:a,onAddIncludedChats:y,onAddExcludedChats:S,onShareFolder:k,onOpenInvite:N,onReset:p,isActive:r||[o.VS.FoldersIncludedChats,o.VS.FoldersExcludedChats].includes(t),isOnlyInvites:e===o.VS.FoldersEditFolderInvites,onBack:l,onSaveFolder:A,isMobile:c});case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:return(0,ne.Y)(jd,{mode:"included",state:i,dispatch:a,onReset:p,onSaveFilter:f,isActive:r});case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:return(0,ne.Y)(jd,{mode:"excluded",state:i,dispatch:a,onReset:p,onSaveFilter:f,isActive:r});case o.VS.FoldersShare:return(0,ne.Y)(sh,{isActive:r,onReset:p});default:return}});var ah=i(70934),rh=i(3178);const lh=(0,n.ph)(({isActive:e,error:t,isLoading:i,shouldDisablePasswordManager:s,expectedPassword:o,placeholder:a,hint:r,submitLabel:l,onSubmit:c,onClearError:d,onReset:h})=>{const[u,m]=(0,n.J0)(""),[p,g]=(0,n.J0)(!1),v=(0,Bi.A)(),A=(0,n.hb)(e=>{o&&e!==o?m(v("SettingsPasswordEqual")):c(e)},[c,o,v]),f=(0,n.hb)(()=>{d&&d(),m("")},[d]);return(0,ke.A)({isActive:e,onBack:h}),(0,ne.FD)("div",{className:"settings-content password-form custom-scroll",children:[(0,ne.Y)("div",{className:"settings-content-header no-border",children:(0,ne.Y)(rh.A,{isBig:!0,isPasswordVisible:p})}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{className:"settings-input",children:(0,ne.Y)(Rl.A,{error:u||t,hint:r,placeholder:a||v("CurrentPasswordPlaceholder"),shouldDisablePasswordManager:s,submitLabel:l,onClearError:f,isLoading:i,isPasswordVisible:p,shouldResetValue:e,onChangePasswordVisibility:g,onSubmit:A})})})]})}),ch=(0,n.ph)(({isActive:e,onReset:t})=>{const i=(0,B.A)(),s=(0,n.hb)(()=>{t(!0)},[t]);return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(nh.A,{size:a.BYH,tgsUrl:Uo.w.Congratulations,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Congratulations!"}),(0,ne.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,ne.Y)(X.A,{onClick:s,children:i("Back")})]})});var dh=i(89704);const hh=(0,n.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,s.ko)(),n=(0,B.A)();return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Lock,previewUrl:dh,size:160,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Local passcode is enabled."})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"edit",onClick:()=>i({screen:o.VS.PasscodeChangePasscodeCurrent}),children:n("Passcode.Change")}),(0,ne.Y)(ui.A,{icon:"password-off",onClick:()=>i({screen:o.VS.PasscodeTurnOff}),children:n("Passcode.TurnOff")})]})]})}),uh=(0,n.ph)(({isActive:e,onReset:t,onStart:i})=>{const n=(0,Bi.A)();return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Lock,previewUrl:dh,size:a.BYH,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description",dir:"auto",children:n("SettingsPasscodeStart1",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:n("SettingsPasscodeStart2",void 0,{withNodes:!0,renderTextFilters:["br"]})})]}),(0,ne.Y)(X.A,{onClick:i,children:n("EnablePasscode")})]})}),mh=(0,n.ph)((0,s.EK)(e=>({...e.passcode}))(({passcode:e,currentScreen:t,shownScreen:i,error:a,isActive:r,isLoading:l,onSetPasscode:c,onReset:d})=>{const{setPasscode:h,clearPasscode:u,setPasscodeError:m,clearPasscodeError:p,openSettingsScreen:g}=(0,s.ko)(),v=(0,B.A)(),A=(0,n.hb)(()=>{c(""),g({screen:o.VS.PasscodeNewPasscode})},[c]),f=(0,n.hb)(e=>{c(e),g({screen:o.VS.PasscodeNewPasscodeConfirm})},[c]),C=(0,n.hb)(()=>{h({passcode:e}),c(""),g({screen:o.VS.PasscodeCongratulations})},[c,e]),b=(0,n.hb)(e=>{c(""),(0,ah.UQ)(e).then(()=>{g({screen:o.VS.PasscodeChangePasscodeNew})},()=>{m({error:v("PasscodeController.Error.Current")})})},[v,c]),y=(0,n.hb)(e=>{c(e),g({screen:o.VS.PasscodeChangePasscodeConfirm})},[c]),S=(0,n.hb)(e=>{(0,ah.UQ)(e).then(()=>{u(),g({screen:o.VS.Privacy})},()=>{m({error:v("PasscodeController.Error.Current")})})},[v]);switch(t){case o.VS.PasscodeDisabled:return(0,ne.Y)(uh,{onStart:A,isActive:r||[o.VS.PasscodeNewPasscode,o.VS.PasscodeNewPasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeNewPasscode:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,placeholder:v("EnterNewPasscode"),submitLabel:v("Continue"),onSubmit:f,isActive:r||[o.VS.PasscodeNewPasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeNewPasscodeConfirm:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:v("ReEnterYourPasscode"),submitLabel:v("Continue"),isLoading:l,onSubmit:C,isActive:r||[o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeCongratulations:return(0,ne.Y)(ch,{isActive:r,onReset:d});case o.VS.PasscodeEnabled:return(0,ne.Y)(hh,{isActive:r||[o.VS.PasscodeChangePasscodeCurrent,o.VS.PasscodeChangePasscodeNew,o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations,o.VS.PasscodeTurnOff].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeCurrent:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,error:a,onClearError:p,placeholder:v("PasscodeController.Current.Placeholder"),onSubmit:b,isActive:r||[o.VS.PasscodeChangePasscodeNew,o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeNew:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,placeholder:v("PleaseEnterNewFirstPassword"),onSubmit:y,isActive:r||[o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeConfirm:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:v("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:l,onSubmit:C,isActive:r||[o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeTurnOff:return(0,ne.Y)(lh,{shouldDisablePasswordManager:!0,error:a?v(a):void 0,onClearError:p,placeholder:v("PasscodeController.Current.Placeholder"),onSubmit:S,isActive:r,onReset:d});default:return}})),ph=[50,100,500,1e3,2e3,5e3,1e4];function gh(e,t){const i=e.findIndex(e=>t<=e),n=e[i-1]||1,s=e[i]||e[e.length-1];return i+(t-n)/(s-n)}function vh(e,t){const i=Math.floor(t),n=e[i-1]||1,s=n+((e[i]||e[e.length-1])-n)*(t-i);return s<100?Math.round(s):10*Math.round(s/10)}const Ah=(0,n.ph)(({min:e=0,max:t,value:i,disabled:s,readOnly:o,bold:a,className:r,defaultValue:l,onChange:c,canChangeChargeForMessages:d})=>{const h=(0,Bi.A)(),u=(0,n.Kr)(()=>{const e=[];for(let i=0;i<ph.length;i++)if(ph[i]<t&&e.push(ph[i]),ph[i]>=t){e.push(t);break}return e},[t]),m=(0,T.A)(e=>{const t=Number(e.currentTarget.value);c(vh(u,t))}),p=(0,ve.A)(r,"RangeSlider",s&&"disabled",o&&"readOnly",a&&"bold");return(0,ne.FD)("div",{className:p,children:[(0,ne.FD)("div",{className:"slider-top-row",dir:h.isRtl?"rtl":void 0,children:[(0,ne.Y)("span",{className:"value-min",dir:"auto",children:h.number(e)}),(0,ne.FD)("span",{className:"settings-range-value",children:[!d&&(0,ne.Y)(he.A,{name:"lock-badge"}),(0,Fi.Kk)(h,vh(u,gh(u,i)))]}),(0,ne.Y)("span",{className:"value-max",dir:"auto",children:h.number(t)})]}),(0,ne.FD)("div",{className:"slider-main",children:[(0,ne.Y)("div",{className:"slider-fill-track",style:`width: ${gh(u,i)/u.length*100}%`}),(0,ne.Y)("input",{min:0,max:u.length,defaultValue:gh(u,l),step:"any",type:"range",className:"RangeSlider__input",onChange:m})]})]})}),fh=(0,n.ph)((0,s.EK)(e=>{const t=e.appConfig.starsUsdWithdrawRateX1000,i=t?t/1e3:1,n=e.appConfig.starsPaidMessageCommissionPermille;return{starsPaidMessageCommissionPermille:n?n/1e3:100,starsUsdWithdrawRate:i,starsPaidMessageAmountMax:e.appConfig.starsPaidMessageAmountMax||a.$$v}})(function({starsUsdWithdrawRate:e,starsPaidMessageAmountMax:t,starsPaidMessageCommissionPermille:i,canChangeChargeForMessages:n,isGroupChat:o,chargeForMessages:r,onChange:l}){const{openPremiumModal:c}=(0,s.ko)(),d=(0,Bi.A)(),h=(0,T.A)(e=>{l?.(e)}),u=(0,T.A)(()=>{c({initialSection:"message_privacy"})});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("SectionTitleStarsForForMessages")}),(0,ne.Y)(Ah,{defaultValue:r,min:a.BSg,max:t,value:r,onChange:h,canChangeChargeForMessages:n,readOnly:!n}),!n&&(0,ne.Y)(X.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:u,children:(0,ne.FD)("span",{className:"settings-unlock-button-title",children:[d("UnlockButtonTitle"),(0,ne.Y)(he.A,{name:"lock-badge",className:"settings-unlock-button-icon"})]})}),n&&(0,ne.Y)("p",{className:"settings-item-description-larger",dir:d.isRtl?"rtl":void 0,children:d(o?"SetPriceGroupDescription":"SectionDescriptionStarsForForMessages",{percent:(0,Es.l9)(100*i),amount:(0,wo.Ad)(r*e*i,"USD",d.code)},{withNodes:!0})})]})}));var Ch=i(9267);const bh=(0,n.ph)(function({premiumSection:e}){const{openPremiumModal:t}=(0,s.ko)(),i=(0,B.A)(),n=(0,T.A)(()=>t({initialSection:e}));return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{leftElement:(0,ne.Y)(Ch.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:n,children:i("PrivacyLastSeenPremium")})}),(0,ne.Y)(Hd.IW,{dir:i.isRtl?"rtl":void 0,children:i("lng_messages_privacy_premium_about")})]})}),yh=(0,n.ph)(function({label:e,isChecked:t}){const i=(0,B.A)(),{showNotification:n}=(0,s.ko)();return(0,ne.FD)("div",{className:(0,ve.A)("sBptmiga",t&&"U_6O1ebL"),onClick:()=>n({message:i("OptionPremiumRequiredMessage")}),children:[(0,ne.Y)("span",{children:e}),(0,ne.Y)(he.A,{name:"lock-badge",className:"jWxrRbkh"})]})}),Sh=(0,n.ph)((0,s.EK)(e=>{const{settings:{privacy:t}}=e,i=(0,c.Iv$)(e),n=e.settings.privacy.noPaidMessages?.allowUserIds.length||0;return{shouldNewNonContactPeersRequirePremium:(0,c.BSN)(e),shouldChargeForMessages:Boolean(i),nonContactPeersPaidStars:i||a.wZe,isCurrentUserPremium:(0,c.g29)(e),canLimitNewMessagesWithoutPremium:e.appConfig.canLimitNewMessagesWithoutPremium,canChargeForMessages:e.appConfig.starsPaidMessagesAvailable,noPaidReactionsForUsersCount:n,privacy:t}})(function({isActive:e,canLimitNewMessagesWithoutPremium:t,canChargeForMessages:i,shouldNewNonContactPeersRequirePremium:a,shouldChargeForMessages:r,nonContactPeersPaidStars:l,isCurrentUserPremium:c,noPaidReactionsForUsersCount:d,onReset:h,privacy:u}){const{updateGlobalPrivacySettings:m,openSettingsScreen:p,showNotification:g}=(0,s.ko)(),v=(0,B.A)(),A=(0,Bi.A)(),f=c||t,C=c&&i,[b,y]=(0,n.J0)(l),[S,k]=(0,n.J0)(!1),N=(0,n.Kr)(()=>r?"charge_for_messages":a?"contacts_and_premium":"everybody",[r,a]);(0,F.A)(([e])=>{S||void 0===e||"everybody"===N||N===e||("everybody"===u.chatInvite?.visibility&&g({message:A("CheckPrivacyInviteText"),action:{action:"openSettingsScreen",payload:{screen:o.VS.PrivacyGroupChats}},actionText:{key:"Review"},duration:8e3}),"everybody"===u.phoneCall?.visibility&&g({message:A("CheckPrivacyCallsText"),action:{action:"openSettingsScreen",payload:{screen:o.VS.PrivacyPhoneCall}},actionText:{key:"Review"},duration:8e3}),k(!0))},[N,r,u,A,S]);const w=(0,n.Kr)(()=>[{value:"everybody",label:v("P2PEverybody")},{value:"contacts_and_premium",label:f?v("PrivacyMessagesContactsAndPremium"):(0,ne.Y)(yh,{label:v("PrivacyMessagesContactsAndPremium"),isChecked:"contacts_and_premium"===N}),hidden:!f,isCanCheckedInDisabled:!0},{value:"charge_for_messages",label:C?A("PrivacyChargeForMessages"):(0,ne.Y)(yh,{label:A("PrivacyChargeForMessages"),isChecked:"charge_for_messages"===N}),hidden:!C,isCanCheckedInDisabled:!0}],[v,A,f,C,N]),I=(0,T.A)(e=>{m({shouldNewNonContactPeersRequirePremium:"contacts_and_premium"===e,nonContactPeersPaidStars:"charge_for_messages"===e?b:null})}),P=(0,ye.A)(e=>{m({nonContactPeersPaidStars:e})},[m],300,!0),Y=(0,n.hb)(e=>{y(e),P(e)},[y,P]);(0,ke.A)({isActive:e,onBack:h});const D=(0,n.Kr)(()=>A(r?"PrivacyDescriptionChargeForMessages":"PrivacyDescriptionMessagesContactsAndPremium"),[r,A]);return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:A.isRtl?"rtl":void 0,children:v("PrivacyMessagesTitle")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"privacy-messages",options:w,onChange:I,selected:N})}),(0,ne.Y)(Hd.IW,{dir:A.isRtl?"rtl":void 0,children:D}),"charge_for_messages"===N&&(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(fh,{canChangeChargeForMessages:C,chargeForMessages:b,onChange:Y})}),C&&"charge_for_messages"===N&&function(){const e=d?v("Users",d,"i"):A("SubtitlePrivacyAddUsers");return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:A.isRtl?"rtl":void 0,children:A("RemoveFeeTitle")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{narrow:!0,icon:"delete-user",onClick:()=>{p({screen:o.VS.PrivacyNoPaidMessages})},children:(0,ne.FD)("div",{className:"multiline-item full-size",children:[(0,ne.Y)("span",{className:"title",children:A("ExceptionTitlePrivacyChargeForMessages")}),(0,ne.Y)("span",{className:"subtitle",children:e})]})})})]})}(),!c&&"charge_for_messages"!==N&&(0,ne.Y)(bh,{premiumSection:"message_privacy"})]})}));function kh(e){const t=e.platform.toLowerCase(),i=e.deviceModel.toLowerCase(),n=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")||n.includes("macos")?"apple":t.includes("ubuntu")||n.includes("ubuntu")?"ubuntu":t.includes("linux")||n.includes("linux")?"linux":t.includes("windows")||n.includes("windows")?"windows":"unknown"}var Nh=i(55810);const wh={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"};function Ih(e){return[e.region,e.country].filter(Boolean).join(", ")}const Ph=(0,n.ph)((0,s.EK)((e,{hash:t})=>({session:t?e.activeSessions.byHash[t]:void 0}))(({isOpen:e,session:t,onClose:i})=>{const{changeSessionSettings:o,terminateAuthorization:a}=(0,s.ko)(),r=(0,Bi.A)(),l=(0,Ii.A)(t,!0),c=(0,n.hb)(()=>{o({hash:t.hash,areSecretChatsEnabled:!t.areSecretChatsEnabled})},[o,t]),d=(0,n.hb)(()=>{o({hash:t.hash,areCallsEnabled:!t.areCallsEnabled})},[o,t]),h=(0,n.hb)(()=>{a({hash:t.hash}),i()},[i,t,a]);if(l)return(0,ne.FD)(te.A,{header:(0,ne.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:i,iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:r("SessionPreviewTitle")})]}),isOpen:e,hasCloseButton:!0,onClose:i,className:wh.SettingsActiveSession,children:[(0,ne.Y)("div",{className:(0,ve.A)(wh.iconDevice,l&&wh[`iconDevice__${kh(l)}`])}),(0,ne.Y)("h3",{className:wh.title,dir:"auto",children:l?.deviceModel}),(0,ne.Y)("div",{className:wh.date,"aria-label":r("PrivacySettingsLastSeen"),children:(0,et.L2)(1e3*l.dateActive,r.code)}),(0,ne.FD)("dl",{className:wh.box,children:[(0,ne.Y)("dt",{children:r("SessionPreviewApp")}),(0,ne.FD)("dd",{children:[l?.appName," ",l?.appVersion,","," ",l?.platform," ",l?.systemVersion]}),l?.ip&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("dt",{children:r("SessionPreviewIp")}),(0,ne.Y)("dd",{children:l.ip})]}),(0,ne.Y)("dt",{children:r("SessionPreviewLocation")}),(0,ne.Y)("dd",{children:l&&Ih(l)})]}),(0,ne.Y)("p",{className:wh.note,children:r("SessionPreviewIpDesc")}),(0,ne.Y)("h4",{className:wh.actionHeader,children:r("AuthSessionsViewAcceptTitle")}),(0,ne.FD)(ui.A,{onClick:c,children:[(0,ne.Y)("span",{className:wh.actionName,children:r("SessionPreviewAcceptSecret")}),(0,ne.Y)(Nh.A,{id:"accept_secrets",checked:l.areSecretChatsEnabled})]}),(0,ne.FD)(ui.A,{onClick:d,children:[(0,ne.Y)("span",{className:wh.actionName,children:r("SessionPreviewAcceptCalls")}),(0,ne.Y)(Nh.A,{id:"accept_calls",checked:l.areCallsEnabled})]}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h,children:r("SessionPreviewTerminateSession")})})]})}));function Yh(e){return[e.region,e.country].filter(Boolean).join(", ")}const Fh=(0,n.ph)((0,s.EK)(e=>e.activeSessions)(({isActive:e,onReset:t,byHash:i,orderedHashes:o,ttlDays:a})=>{const{terminateAuthorization:r,terminateAllAuthorizations:l,changeSessionTtl:c}=(0,s.ko)(),d=(0,B.A)(),h=(0,Bi.A)(),[u,m,p]=(0,D.A)(),[g,v]=(0,n.J0)(),[A,f,C]=(0,D.A)(),b=(0,n.Kr)(()=>{if(void 0!==a)return a<=7?"7":a<=30?"30":a<=93?"90":a<=183?"183":a>183?"365":void 0},[a]),y=(0,n.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 a&&a>=365&&e.push({label:h("Years",{count:1},{pluralValue:1}),value:"365"}),e},[h,a]),S=(0,n.hb)(e=>{r({hash:e})},[r]),k=(0,n.hb)(()=>{p(),l()},[p,l]),N=(0,n.hb)(e=>{v(e),f()},[f]),w=(0,n.hb)(()=>{v(void 0),C()},[C]),I=(0,n.hb)(e=>{c({days:Number(e)})},[c]),P=(0,n.Kr)(()=>{const e=o.find(e=>i[e].isCurrent);return e?i[e]:void 0},[i,o]),Y=(0,n.Kr)(()=>o.filter(e=>!i[e].isCurrent),[i,o]),F=Boolean(Y.length);return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content custom-scroll SettingsActiveSessions",children:[P&&(T=P,(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:h.isRtl?"rtl":void 0,children:h("AuthSessionsCurrentSession")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{narrow:!0,inactive:!0,icon:`device-${kh(T)}`,iconClassName:"icon-device",children:(0,ne.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ne.Y)("span",{className:"title",dir:"auto",children:T.deviceModel}),(0,ne.FD)("span",{className:"subtitle black tight",children:[T.appName," ",T.appVersion,","," ",T.platform," ",T.systemVersion]}),(0,ne.FD)("span",{className:"subtitle",children:[T.ip," ","-"," ",Yh(T)]})]})}),F&&(0,ne.Y)(ui.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:m,children:h("TerminateAllSessions")})]})]})),F&&(M=Y,(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:h.isRtl?"rtl":void 0,children:h("OtherSessions")}),(0,ne.Y)(Hd.Ay,{children:M.map(function(e){const t=i[e];return(0,ne.Y)(ui.A,{ripple:!0,narrow:!0,contextActions:[{title:h("SessionTerminate"),icon:"stop",destructive:!0,handler:()=>{S(t.hash)}}],icon:`device-${kh(t)}`,iconClassName:"icon-device",onClick:()=>{N(t.hash)},children:(0,ne.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ne.FD)("span",{className:"title title-with-date",children:[t.deviceModel,(0,ne.Y)("span",{className:"date",children:(0,et.be)(d,1e3*t.dateActive)})]}),(0,ne.FD)("span",{className:"subtitle black tight",children:[t.appName," ",t.appVersion,","," ",t.platform," ",t.systemVersion]}),(0,ne.FD)("span",{className:"subtitle",children:[t.ip," ",Yh(t)]})]})},t.hash)})})]})),(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:h.isRtl?"rtl":void 0,children:h("TerminateOldSessionHeader")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)("p",{className:"settings-item-description-larger",children:h("IfInactiveFor")}),(0,ne.Y)(ie.A,{name:"session_ttl",options:y,selected:b,onChange:I})]})]}),F&&(0,ne.Y)(ci.A,{isOpen:u,onClose:p,text:h("AreYouSureSessions"),confirmLabel:h("TerminateAllSessions"),confirmHandler:k,confirmIsDestructive:!0,areButtonsInColumn:!0}),(0,ne.Y)(Ph,{isOpen:A,hash:g,onClose:w})]});var M,T})),Dh="YRYk96ki",Mh=(0,n.ph)((0,s.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:o})=>{const{terminateWebAuthorization:a}=(0,s.ko)(),r=(0,B.A)(),l=(0,Ii.A)(t,!0),c=(0,Ii.A)(i,!0),d=(0,n.hb)(()=>{a({hash:t.hash}),o()},[o,t,a]);if(l)return(0,ne.FD)(te.A,{header:(0,ne.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:o,iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:r("WebSessionsTitle")})]}),isOpen:e,hasCloseButton:!0,onClose:o,className:"Wd0fmiSY",children:[(0,ne.Y)(Tt.A,{className:"OhZHdRsP",peer:c,size:"large"}),c&&(0,ne.Y)(jn.A,{className:"EQ7__xGn",peer:c}),(0,ne.Y)("div",{className:Dh,children:l?.domain}),(0,ne.FD)("dl",{className:"kmCTIfvf",children:[(0,ne.Y)("dt",{children:r("AuthSessions.View.Browser")}),(0,ne.Y)("dd",{children:l?.browser}),(0,ne.Y)("dt",{children:r("SessionPreview.Ip")}),(0,ne.Y)("dd",{children:l?.ip}),(0,ne.Y)("dt",{children:r("SessionPreview.Location")}),(0,ne.Y)("dd",{children:l?.region})]}),(0,ne.Y)("p",{className:Dh,children:r("AuthSessions.View.LocationInfo")}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d,children:r("AuthSessions.LogOut")})})]})})),Th={avatar:"v0wP46TR","clear-help":"WnnxcARX",clearHelp:"WnnxcARX",subtitle:"uEUfjByC"},Bh=(0,n.ph)((0,s.EK)(e=>{const{byHash:t,orderedHashes:i}=e.activeWebSessions;return{byHash:t,orderedHashes:i}})(({isActive:e,byHash:t,orderedHashes:i,onReset:o})=>{const{terminateWebAuthorization:a,terminateAllWebAuthorizations:r}=(0,s.ko)(),l=(0,B.A)(),[c,d,h]=(0,D.A)(),[u,m]=(0,n.J0)(),[p,g,v]=(0,D.A)(),A=(0,n.hb)(e=>{a({hash:e})},[a]),f=(0,n.hb)(()=>{h(),r()},[h,r]),C=(0,n.hb)(e=>{m(e),g()},[g]),b=(0,n.hb)(()=>{m(void 0),v()},[v]);var y;if((0,n.vJ)(()=>{i.length||o()},[o,i]),(0,ke.A)({isActive:e,onBack:o}),i.length)return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d,children:l("AuthSessions.LogOutApplications")})}),(0,ne.Y)(Hd.IW,{className:Th.clearHelp,children:l("ClearOtherWebSessionsHelp")}),(y=i,(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:l.isRtl?"rtl":void 0,children:l("WebSessionsTitle")}),(0,ne.Y)(Hd.Ay,{children:y.map(function(e){const i=t[e],n=(0,s.mS)().users.byId[i.botId];return(0,ne.FD)(ui.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{A(i.hash)}}],onClick:()=>C(i.hash),children:[(0,ne.Y)(Tt.A,{className:Th.avatar,peer:n,size:"tiny"}),(0,ne.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ne.FD)("div",{className:"title title-with-date",children:[n&&(0,ne.Y)(jn.A,{className:Th.title,peer:n}),(0,ne.Y)("span",{className:"date",children:(0,et.be)(l,1e3*i.dateActive)})]}),(0,ne.FD)("span",{className:(0,ve.A)("subtitle","black","tight",Th.platform),children:[i.domain,",",i.browser,",",i.platform]}),(0,ne.FD)("span",{className:(0,ve.A)("subtitle",Th.subtitle),children:[i.ip," ",i.region]})]})]},i.hash)})})]})),(0,ne.Y)(ci.A,{isOpen:c,onClose:h,title:l("AuthSessions.LogOutApplications"),text:l("AreYouSureWebSessions"),confirmHandler:f,confirmIsDestructive:!0}),(0,ne.Y)(Mh,{isOpen:p,hash:u,onClose:b})]})})),Lh=(0,n.ph)(({stickerSet:e,noPlay:t,className:i,observeIntersection:n,onClick:s})=>{const o=(0,B.A)(),r=e?.stickers?.[0],l=(0,T.A)(()=>{r&&s(r)});if(e?.stickers)return(0,ne.FD)(ui.A,{className:(0,ve.A)("StickerSetCard","small-icon",i),inactive:!r,onClick:l,children:[function(){if(e)return e.hasThumbnail||!r?(0,ne.Y)(X.A,{ariaLabel:e.title,color:"translucent",isRtl:o.isRtl,children:(0,ne.Y)(Fr,{stickerSet:e,size:a.RCH,noPlay:t,observeIntersection:n})}):(0,ne.Y)(Br,{sticker:r,size:a.RCH,title:e.title,noPlay:t,observeIntersection:n,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("div",{className:"title",children:e.title}),(0,ne.Y)("div",{className:"subtitle",children:o("StickerPack.StickerCount",e.count,"i")})]})]})}),xh=(0,n.ph)((0,s.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:o,canPlayAnimatedEmojis:a,onReset:r})=>{const{openStickerSet:l,setSettingOption:c}=(0,s.ko)(),d=(0,B.A)(),h=(0,n.li)(),{observe:u}=(0,yr.BL)({rootRef:h});(0,ke.A)({isActive:e,onBack:r});const m=(0,n.hb)(e=>{l({stickerSetInfo:e.stickerSetInfo})},[l]),p=(0,n.hb)(e=>{c({shouldSuggestCustomEmoji:e})},[c]),g=(0,n.Kr)(()=>t&&Object.values((0,pi.Up)(i,t)),[t,i]);return(0,ne.Y)("div",{className:"settings-content custom-scroll",children:g&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:d("SuggestAnimatedEmoji"),checked:o,onCheck:p})}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{ref:h,children:g.map(e=>(0,ne.Y)(Lh,{stickerSet:e,observeIntersection:u,onClick:m,noPlay:!a},e.id))})}),(0,ne.Y)(Hd.IW,{dir:"auto",children:(0,Mt.A)(d("EmojiBotInfo"),["links"])})]})})}));var Rh=i(74824);const Eh=(0,n.ph)((0,s.EK)(e=>(0,pi.Up)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"]))(({isActive:e,canAutoLoadPhotoFromContacts:t,canAutoLoadPhotoInPrivateChats:i,canAutoLoadPhotoInGroups:n,canAutoLoadPhotoInChannels:o,canAutoLoadVideoFromContacts:r,canAutoLoadVideoInPrivateChats:l,canAutoLoadVideoInGroups:c,canAutoLoadVideoInChannels:d,canAutoLoadFileFromContacts:h,canAutoLoadFileInPrivateChats:u,canAutoLoadFileInGroups:m,canAutoLoadFileInChannels:p,autoLoadFileMaxSizeMb:g,onReset:v})=>{const{setSettingOption:A,showNotification:f}=(0,s.ko)(),C=(0,Bi.A)();(0,ke.A)({isActive:e,onBack:v});const b=(0,T.A)(e=>{const t=a.$gx[e];return C("AutodownloadSizeLimitUpTo",{limit:C("MediaSizeMB",{size:t},{pluralValue:t})})}),y=(0,T.A)(e=>{A({autoLoadFileMaxSizeMb:a.$gx[e]})}),S=(0,T.A)(()=>{(0,Rh.purgeClearableCache)(),f({message:{key:"SettingsDataClearMediaDone"}})});function k(){const e=a.$gx.indexOf(g);return(0,ne.Y)("div",{children:(0,ne.Y)(nt.A,{label:C("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:b,onChange:y})})}function N(e,t,i,n,s,o){return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:C.isRtl?"rtl":void 0,children:e}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:C("AutoDownloadSettingsContacts"),checked:i,onCheck:e=>A({[`canAutoLoad${t}FromContacts`]:e})}),(0,ne.Y)(es.A,{label:C("AutoDownloadSettingsPrivateChats"),checked:n,onCheck:e=>A({[`canAutoLoad${t}InPrivateChats`]:e})}),(0,ne.Y)(es.A,{label:C("AutoDownloadSettingsGroupChats"),checked:s,onCheck:e=>A({[`canAutoLoad${t}InGroups`]:e})}),(0,ne.Y)(es.A,{label:C("AutoDownloadSettingsChannels"),checked:o,onCheck:e=>A({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&k()]})]})}return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[N(C("AutoDownloadPhotosTitle"),"Photo",t,i,n,o),N(C("AutoDownloadVideosTitle"),"Video",r,l,c,d),N(C("AutoDownloadFilesTitle"),"File",h,u,m,p),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{onClick:S,icon:"delete",multiline:!0,children:[(0,ne.Y)("span",{className:"title",children:C("SettingsDataClearMediaCache")}),(0,ne.Y)("span",{className:"subtitle",children:C("SettingsDataClearMediaCacheDescription")})]})})]})})),Vh={root:"Ys1i4ssl",item:"skaVPMTF"},_h=(0,n.ph)((0,s.EK)(e=>{const{doNotTranslate:t}=e.settings.byKey;return{doNotTranslate:t}})(({isActive:e,doNotTranslate:t,onReset:i})=>{const{setSettingOption:o}=(0,s.ko)(),r=(0,Bi.A)(),l=r.code,[c,d]=(0,n.J0)(""),h=(0,n.Kr)(()=>{const e=new Intl.DisplayNames([l],{type:"language"}),t=a.N89.map(t=>{const i=e.of(t),n=new Intl.DisplayNames([t],{type:"language"}).of(t);if(i&&n)return{value:t,label:i,subLabel:n}}).filter(Boolean);if(!c.trim()){const e=t.find(e=>e.value===l),i=t.filter(e=>e.value!==l);return e?[e,...i]:t}return t?.filter(e=>e.label.toLowerCase().includes(c.toLowerCase())||e.subLabel?.toLowerCase().includes(c.toLowerCase())||e.value.toLowerCase().includes(c.toLowerCase()))},[l,c]),u=(0,T.A)(e=>{o({doNotTranslate:e})});return(0,ke.A)({isActive:e,onBack:i}),(0,ne.FD)("div",{className:(0,ve.A)(Vh.root,"settings-content infinite-scroll"),children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ee.A,{id:"lang-picker-search",value:c,onChange:e=>d(e.currentTarget.value),placeholder:r("Search"),noMargin:!0})}),(0,ne.Y)(Hd.Ay,{className:Vh.item,children:(0,ne.Y)(Ic,{className:Vh.picker,items:h,selectedValues:t,onSelectedValuesChange:u,filterValue:c,onFilterChange:d,allowMultiple:!0,withDefaultPadding:!0,itemInputType:"checkbox"})})]})})),Uh=(0,n.ph)(({chatId:e,usernames:t,onEditUsername:i})=>{const{showNotification:o,toggleUsername:a,toggleChatUsername:r,sortUsernames:l,sortChatUsernames:c}=(0,s.ko)(),d=(0,B.A)(),h=(0,Bi.A)(),[u,m]=(0,n.J0)(),p=(0,n.Kr)(()=>t.map(({username:e})=>e),[t]),g=(0,K.A)(p),[v,A]=(0,n.J0)({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0});(0,n.vJ)(()=>{g!==p&&A({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0})},[g,p]);const f=(0,n.hb)(e=>{(0,Lc.eM)(`@${e}`),o({message:d("UsernameCopied")})},[d,o]),C=(0,n.hb)(e=>{e.isEditable?i(e.username):m(e)},[i]),b=(0,n.hb)(()=>{m(void 0)},[]),y=(0,n.hb)(()=>{u&&(e?r({chatId:e,username:u.username,isActive:!u.isActive}):a({username:u.username,isActive:!u.isActive}),b())},[e,b,r,a,u]),S=(0,n.hb)((e,t)=>{const i=Math.round(e.y/56),n=v.orderedUsernames?.indexOf(t)||0,s=v.orderedUsernames?.filter(e=>e!==t);s&&(0,fe.Bt)(n+i,0,p.length)&&(s.splice(n+i,0,t),A(e=>({...e,draggedIndex:n,dragOrderUsernames:s})))},[v.orderedUsernames,p.length]),k=(0,n.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,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_subtitle")}),(0,ne.Y)(Hd.Ay,{className:"PaO1MMi5",children:(0,ne.Y)("div",{className:"lAeeBh9K",style:`height: ${56*t.length}px`,children:t.map((e,t)=>{const i=v.draggedIndex===t,n=56*(v.orderedUsernames?.indexOf(e.username)??0),s=56*(v.dragOrderUsernames?.indexOf(e.username)??0),o=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return(0,ne.Y)(eh.A,{id:e.username,onDrag:S,onDragEnd:k,style:`top: ${i?n:s}px;`,knobStyle:"inset-inline-end: 3rem;",isDisabled:!e.isActive,children:(0,ne.FD)(ui.A,{className:(0,ve.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:()=>{C(e)},children:[(0,ne.FD)("span",{className:"title",children:["@",e.username]}),(0,ne.Y)("span",{className:"subtitle",children:d(o)})]},e.username)},e.username)})})}),(0,ne.Y)(Hd.IW,{dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_description")}),(0,ne.Y)(ci.A,{isOpen:Boolean(u),onClose:b,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 Oh=i(11116);const Kh=/https:\/\/t\.me\/?/i,Jh=(0,Ce.sg)(e=>e(),250,!1),jh=(0,n.ph)(({currentUsername:e,asLink:t,isLoading:i,isUsernameAvailable:o,checkedUsername:r,onChange:l})=>{const{checkUsername:c,checkPublicLink:d}=(0,s.ko)(),[h,u]=(0,n.J0)(e||""),m=(0,B.A)(),p=t?"SetUrl":"Username",g=m(t?"SetUrlPlaceholder":"Username"),v=(0,K.A)(o),A=e!==h?o??v:void 0,f=h&&e!==h&&r!==h,[C,b]=(0,n.Kr)(()=>h.length?h.length<Oh.tX?[void 0,m(`${p}InvalidShort`)]:h.length>Oh.Tk?[void 0,m(`${p}InvalidLong`)]:Oh.Ny.test(h)?void 0===A||f?[]:[A?m(`${p}Available`,g):void 0,!1===A?m(`${p}InUse`):void 0]:[void 0,m(`${p}Invalid`)]:[],[h,A,f,m,p,g]);(0,n.vJ)(()=>{u(e||"")},[t,e]);const y=(0,n.hb)(i=>{const n=i.target.value.trim();if(t&&!n.match(Kh))return void(n.length||(u(""),l?.("")));const s=n.replace(Kh,"");u(s),(""===s||(0,Oh.BU)(s,!0))&&(l?.(s),Jh(()=>{s!==e&&(t?d:c)({username:s})}))},[t,d,c,e,l]);return(0,ne.Y)(ee.A,{value:`${t?a.jsp:""}${h}`,onChange:y,label:f?m("Checking"):g,error:b,success:C,readOnly:i,teactExperimentControlled:!0})});var Gh=i(43434);const Hh=(0,Ce.nF)(e=>e(),6e4,!0),zh="Please provide your first name",$h=(0,n.ph)((0,s.EK)(e=>{const{currentUserId:t}=e,{progress:i,isUsernameAvailable:n,checkedUsername:s,error:o}=(0,c.nTw)(e).profileEdit||{},a=t?(0,c.mBe)(e,t):void 0,r=(0,In.d)(e,"aboutLength"),{firstName:d,lastName:h,usernames:u}=a||{},m=t?(0,c.vGo)(e,t):void 0;return{currentAvatarHash:a&&(0,l.cP)(a),currentFirstName:d,currentLastName:h,currentBirthday:m?.birthday,currentBio:m?.bio,progress:i,isUsernameAvailable:n,checkedUsername:s,editUsernameError:o,maxBioLength:r,usernames:u}})(({isActive:e,currentAvatarHash:t,currentFirstName:i,currentLastName:r,currentBirthday:l,currentBio:c,progress:d,checkedUsername:h,editUsernameError:u,isUsernameAvailable:m,maxBioLength:p,usernames:g,onReset:v})=>{const{loadCurrentUser:A,updateProfile:f,openSettingsScreen:C,openBirthdaySetupModal:b}=(0,s.ko)(),y=(0,B.A)(),S=(0,Bi.A)(),k=(0,n.Kr)(()=>g?.find(({isEditable:e})=>e),[g]),N=k?.username||"",[w,I]=(0,n.J0)(!1),[P,Y]=(0,n.J0)(!1),[F,D]=(0,n.J0)(),[M,L]=(0,n.J0)(),[x,R]=(0,n.J0)(i||""),[E,V]=(0,n.J0)(r||""),[_,U]=(0,n.J0)(c||""),[O,J]=(0,n.J0)(N),G=(0,q.A)(t,!1,j.qZ.BlobUrl),H=d===o.DV.InProgress,z=!1===O,$=(0,K.A)(m),W=m??$,Q=g&&g.length>1,Z=(0,n.Kr)(()=>!z&&(Boolean(M)||P||w&&!0===W),[z,M,P,w,W]);(0,ke.A)({isActive:e,onBack:v}),(0,n.vJ)(()=>{Hh(()=>{A()})},[A]),(0,n.vJ)(()=>{L(void 0)},[G]),(0,n.vJ)(()=>{R(i||""),V(r||""),U(c||"")},[i,r,c]),(0,n.vJ)(()=>{J(N||"")},[N]),(0,n.vJ)(()=>{d===o.DV.Complete&&(Y(!1),I(!1),D(void 0))},[d]);const X=(0,n.Kr)(()=>{if(!l)return;const e=new Date(l.year||2024,l.month-1,l.day);return(0,et.A)(e,S.code,!0,"long")},[l,S]),te=(0,T.A)(e=>{L(e)}),ie=(0,T.A)(e=>{R(e.target.value),Y(!0)}),se=(0,T.A)(e=>{V(e.target.value),Y(!0)}),oe=(0,T.A)(e=>{U(e.target.value),Y(!0)}),ae=(0,T.A)(e=>{J(e),I(N!==e)}),re=(0,T.A)(()=>{C({screen:o.VS.PrivacyBirthday})}),le=(0,T.A)(()=>{b({currentBirthday:l})}),ce=(0,T.A)(()=>{const e=x.trim(),t=E.trim(),i=_.trim();O&&(e.length?f({photo:M,...P&&{firstName:e,lastName:t,bio:i},...w&&{username:O}}):D(zh))});return(0,ne.FD)("div",{className:"settings-fab-wrapper",children:[(0,ne.FD)(zd.A,{scrollable:!0,className:"settings-content no-border",children:[(0,ne.Y)(Hd.LY,{className:"settings-content-header",children:(0,ne.Y)(Gh.A,{currentAvatarBlobUrl:G,onChange:te,title:S("AriaSettingsEditProfilePhoto"),disabled:H})}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)("div",{className:"settings-input",children:[(0,ne.Y)(ee.A,{value:x,onChange:ie,label:y("FirstName"),disabled:H,error:F===zh?F:void 0}),(0,ne.Y)(ee.A,{value:E,onChange:se,label:y("LastName"),disabled:H}),(0,ne.Y)(Is.A,{value:_,onChange:oe,label:y("UserBio"),disabled:H,maxLength:p,maxLengthIndicator:p?(p-_.length).toString():void 0})]})}),(0,ne.Y)(Hd.IW,{dir:y.isRtl?"rtl":void 0,children:(0,Mt.A)(y("lng_settings_about_bio"),["br","simple_markdown"])}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{icon:"gift",narrow:!0,rightElement:X?(0,ne.Y)("span",{className:"settings-birthday-date",children:X}):void 0,onClick:le,children:(0,ne.Y)("span",{className:"flex-grow",children:S("SettingsBirthday")})})}),(0,ne.Y)(Hd.IW,{dir:y.isRtl?"rtl":void 0,children:S("BirthdayPrivacySuggestion",{link:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:re,children:S("BirthdayPrivacySuggestionLink",void 0,{withNodes:!0,specialReplacement:Fi.hG})})},{withNodes:!0})}),(0,ne.Y)(Hd.Qg,{dir:y.isRtl?"rtl":void 0,children:y("Username")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{className:"settings-input",children:(0,ne.Y)(jh,{currentUsername:N,isLoading:H,isUsernameAvailable:m,checkedUsername:h,onChange:ae})})}),u===a.Y3M&&function(){const e=`${a.jsp}${a.NjX}`;return(0,ne.Y)(Hd.IW,{dir:y.isRtl?"rtl":void 0,children:y("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,ne.Y)(us.A,{url:e,text:`@${a.NjX}`}):t)})}(),(0,ne.Y)(Hd.IW,{dir:y.isRtl?"rtl":void 0,children:(0,Mt.A)(y("UsernameHelp"),["br","simple_markdown"])}),O&&(0,ne.FD)(Hd.IW,{dir:y.isRtl?"rtl":void 0,children:[y("lng_username_link"),(0,ne.Y)("br",{}),(0,ne.FD)("span",{className:"username-link",children:[a.jsp,O]})]}),Q&&(0,ne.Y)(Uh,{usernames:g,onEditUsername:J})]}),(0,ne.Y)(fi.A,{isShown:Z,onClick:ce,disabled:H,ariaLabel:y("Save"),iconName:"check",isLoading:H})]})}));var qh=i(61182),Wh=i(4350),Qh=i(93855),Zh=i(15006);const Xh=(0,n.ph)((0,s.EK)(e=>{const{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:n,shouldDebugExportedSenders:s}=(0,Rn.lS)(e);return{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:n,shouldDebugExportedSenders:s}})(({isActive:e,shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:o,shouldDebugExportedSenders:r,onReset:l})=>{const{requestConfetti:c,setSharedSettingOption:d,requestWave:h}=(0,s.ko)(),m=(0,n.li)(),[p,g]=(0,n.J0)(!1),v=(0,B.A)(),A=(0,Qh.A)();(0,ke.A)({isActive:e,onBack:l});const f=(0,T.A)(()=>{const e=new File([(0,qh.F8)()],a.lFE,{type:"text/plain"}),t=URL.createObjectURL(e);(0,Yi.A)(t,a.lFE)}),C=(0,T.A)(e=>{h({startX:e.clientX,startY:e.clientY})}),b=(0,T.A)(()=>{c({withStars:!0})}),y=(0,T.A)(()=>{const e=m.current;e&&(0,Zh.U)(e)&&(g(!0),setTimeout(()=>{g(!1)},1500))}),S=(0,n.Kr)(()=>{if(!Object.values(A).length)return;let e=1;for(;A[e];)e+=1;return(0,Wh.Nv)(e,!0,!0)},[A]);return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),(0,ne.Y)("p",{className:"settings-item-description pt-3",dir:"auto",children:v("lng_settings_experimental_about")})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{href:S,icon:"add-user",children:(0,ne.Y)("div",{className:"title",children:"Login on Test Server"})})}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{onClick:b,icon:"animations",children:(0,ne.Y)("div",{className:"title",children:"Launch some confetti!"})}),(0,ne.Y)(ui.A,{onClick:C,icon:"story-expired",disabled:!u.J6,children:(0,ne.Y)("div",{className:"title",children:"Start wave"})}),(0,ne.Y)(ui.A,{ref:m,onClick:y,icon:"spoiler",disabled:!u.bW,style:p?"visibility: hidden":"",children:(0,ne.Y)("div",{className:"title",children:"Vaporize this button"})})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:"Allow HTTP Transport",checked:Boolean(i),onCheck:()=>d({shouldAllowHttpTransport:!i})}),(0,ne.Y)(es.A,{label:"Force HTTP Transport",disabled:!i,checked:Boolean(t),onCheck:()=>d({shouldForceHttpTransport:!t})})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:v("DebugMenuEnableLogs"),checked:Boolean(o),onCheck:()=>d({shouldCollectDebugLogs:!o})}),(0,ne.Y)(es.A,{label:"Enable exported senders debug",checked:Boolean(r),onCheck:()=>d({shouldDebugExportedSenders:!r})}),(0,ne.Y)(ui.A,{onClick:f,icon:"bug",children:(0,ne.Y)("div",{className:"title",children:"Download log"})})]})]})}));var eu=i(84382);const tu=(0,n.ph)((0,s.EK)(e=>{const{theme:t,shouldUseSystemTheme:i,messageSendKeyCombo:n,messageTextSize:s,timeFormat:o}=(0,Rn.lS)(e);return{messageSendKeyCombo:n,messageTextSize:s,timeFormat:o,theme:t,shouldUseSystemTheme:i}})(({isActive:e,messageTextSize:t,messageSendKeyCombo:i,timeFormat:a,theme:r,shouldUseSystemTheme:l,onReset:c})=>{const{setSharedSettingOption:d,openSettingsScreen:h}=(0,s.ko)(),m=(0,Bi.A)(),{isMobile:p}=(0,Y.Ay)(),g=p&&(u.pz||u.Ni),v=[{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=g?void 0:[{value:"enter",label:m("SettingsSendEnter"),subLabel:m("SettingsSendEnterDescription")},{value:"ctrl-enter",label:m(u.MP||u.pz?"SettingsSendCmdenter":"SettingsSendCtrlenter"),subLabel:m("SettingsSendPlusEnterDescription")}],C=(0,n.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.25*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),d({messageTextSize:e})},[]),b=(0,n.hb)(e=>{const t="auto"===e?(0,eu.V)():e;d({theme:t}),d({shouldUseSystemTheme:"auto"===e})},[]),y=(0,n.hb)(e=>{d({timeFormat:e}),d({wasTimeFormatSetManually:!0})},[]),S=(0,n.hb)(e=>{d({messageSendKeyCombo:e})},[]);return(0,ke.A)({isActive:e,onBack:c}),(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:m.isRtl?"rtl":void 0,children:m("Settings")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(nt.A,{label:m("TextSize"),min:12,max:20,value:t,onChange:C}),(0,ne.Y)(ui.A,{icon:"photo",narrow:!0,onClick:()=>h({screen:o.VS.GeneralChatBackground}),children:m("ChatBackground")})]}),(0,ne.Y)(Hd.Qg,{dir:m.isRtl?"rtl":void 0,children:m("Theme")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"theme",options:A,selected:l?"auto":r,onChange:b})}),(0,ne.Y)(Hd.Qg,{dir:m.isRtl?"rtl":void 0,children:m("SettingsTimeFormat")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"timeformat",options:v,selected:a,onChange:y})}),f&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:m.isRtl?"rtl":void 0,children:m("SettingsKeyboard")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"keyboard-send-settings",options:f,onChange:S,selected:i})})]})]})}));var iu=i(52844);const nu=(0,n.ph)(({wallpaper:e,theme:t,isSelected:i,onClick:s})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,h=(0,q.A)(`${c}?size=m`),u=(0,Ti.A)(l.thumbnail?.dataUri,Boolean(h),!0),{transitionClassNames:m}=(0,qe.A)(Boolean(h||d),void 0,void 0,"slow"),p=(0,n.li)(!1),[g,v]=(0,n.J0)(!1),{mediaData:A,loadProgress:f}=(0,W.A)(c,!g),C=!1===(0,K.A)(g),{shouldRender:b,transitionClassNames:y}=(0,qe.A)(g&&!A||r===o.Vw,void 0,C,"slow"),S=(0,n.li)();S.current=t;const k=(0,n.hb)(()=>{(async()=>{const e=await(0,H.sZ)(A);await Rh.save(a.nfi,S.current,e),s(r)})()},[A,s,r]);(0,n.vJ)(()=>{A&&p.current&&(k(),p.current=!1)},[A,k]);const N=(0,n.hb)(()=>{A?k():(p.current=!0,v(e=>!e))},[A,k]),w=(0,ve.A)("WallpaperTile",i&&"selected");return(0,ne.Y)("div",{className:w,onClick:N,children:(0,ne.FD)("div",{className:"media-inner",children:[(0,ne.Y)("canvas",{ref:u,className:"thumbnail"}),(0,ne.Y)("img",{src:h||d,className:(0,ve.A)("full-media",m),alt:"",draggable:!1}),b&&(0,ne.Y)("div",{className:(0,ve.A)("spinner-container",y),children:(0,ne.Y)(pe.A,{progress:f,onClick:N})})]})})}),su=(0,Ce.nF)(e=>e(),6e4,!0),ou=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.SJA)(e),{background:i,isBlurred:n}=(0,c.Gyz)(e,t)||{},{loadedWallpapers:s}=e.settings;return{background:i,isBlurred:n,loadedWallpapers:s,theme:t}})(({isActive:e,onReset:t,background:i,isBlurred:r,loadedWallpapers:l,theme:c})=>{const{loadWallpapers:d,uploadWallpaper:h,setThemeSettings:u,openSettingsScreen:m}=(0,s.ko)(),p=(0,n.li)();p.current=c,(0,n.vJ)(()=>{su(()=>{d()})},[d]);const g=(0,n.hb)(e=>{const{files:t}=e.target,i=(0,H.kc)(t);i?.length&&h(i[0])},[h]),v=(0,n.hb)(()=>{(0,iu.p)("image/jpeg",g,!0)},[g]),A=(0,n.hb)(()=>{m({screen:o.VS.GeneralChatBackgroundColor})},[]),f=(0,n.hb)(()=>{u({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?a.MkD:a.be8})},[u,c]),C=(0,n.hb)(e=>{u({theme:p.current,background:e});const t=l&&l.find(t=>t.slug===e);t?.document.thumbnail&&(0,Fs.rX)(t.document.thumbnail.dataUri).then(e=>{u({theme:p.current,backgroundColor:(0,Fs.v2)(e),patternColor:(0,Fs.Yi)(e)})})},[l,u]),b=(0,n.hb)(e=>{u({theme:p.current,isBlurred:e.target.checked})},[u]),y=(0,B.A)();(0,ke.A)({isActive:e,onBack:t});const S=l?.[0]&&l[0].slug===o.Vw;return(0,ne.FD)("div",{className:"SettingsGeneralBackground settings-content custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"camera-add",className:"mb-0",disabled:S,onClick:v,children:y("UploadImage")}),(0,ne.Y)(ui.A,{icon:"colorize",className:"mb-0",onClick:A,children:y("SetColor")}),(0,ne.Y)(ui.A,{icon:"favorite",onClick:f,children:y("ThemeResetToDefaults")}),(0,ne.Y)(es.A,{label:y("BackgroundBlurred"),checked:Boolean(r),onChange:b})]}),l?(0,ne.Y)("div",{className:"settings-wallpapers",children:l.map(e=>(0,ne.Y)(nu,{wallpaper:e,theme:c,isSelected:i===e.slug,onClick:C},e.slug))}):(0,ne.Y)(Jn.A,{})]})})),au=(0,Fs.bi)((0,Fs.xp)("e6ebee")),ru=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function lu(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 cu({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 du=(0,n.ph)((0,s.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:o})=>{const{setThemeSettings:a}=(0,s.ko)(),r=(0,n.li)();r.current=i;const l=(0,n.li)(),c=(0,n.li)(),d=(0,n.li)(),h=(0,n.li)(!0),[u,m]=(0,n.J0)(()=>function(e){return e?.startsWith("#")?(0,Fs.bi)((0,Fs.xp)(e)):au}(o)),p=(0,n.li)(u);(0,n.vJ)(()=>{p.current=u},[u]);const[g,v,A]=(0,D.A)(),[f,C]=(0,n.J0)(""),[b,y]=(0,n.J0)(""),S=(0,n.li)(),k=(0,n.li)();(0,n.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:n}=lu(p.current,S.current);return m(cu({colorPosition:i,huePosition:n},S.current)),v(),!0}function n(e){const{colorPosition:i}=lu(p.current,S.current),n=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return m(cu({colorPosition:i,huePosition:n},S.current)),v(),!0}S.current={colorRect:e,hueRect:t},(0,Ae.wJ)(c.current,{onCapture:i,onDrag:i,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Ae.wJ)(d.current,{onCapture:n,onDrag:n,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})},[v,A]);const{colorPosition:N=[0,0],huePosition:w=0}=S.current?lu(u,S.current):{},I=(0,Fs.v2)((0,Fs.hT)(u)),P=u[0],Y=(0,Fs.v2)((0,Fs.hT)([P,1,1]));(0,n.vJ)(()=>{const e=(0,Fs.hT)(u),t=(0,Fs.v2)(e);if(C(e.join(", ")),y(t),!h.current){const i=(0,Fs.Yi)(e);a({theme:r.current,background:void 0,backgroundColor:t,patternColor:i})}h.current=!1},[u,a]),(0,n.vJ)(()=>{!function(e,t,i,n){let s,o,a;i.current&&n.current?(s=n.current.colorRect.width,o=n.current.colorRect.height,a=i.current):(s=e.offsetWidth,o=e.offsetHeight,a=e.getContext("2d"),e.width=s,e.height=o,i.current=a);const r=a.createImageData(s,o),l=r.data,c=(0,Fs.hT)([t,1,1]);let d=0;for(let e=0;e<o;e++){const t=1-e/(o-1),i=[255*t,255*t,255*t],n=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);l[d++]=i[0]+(n[0]-i[0])*t,l[d++]=i[1]+(n[1]-i[1])*t,l[d++]=i[2]+(n[2]-i[2])*t,l[d++]=255}}a.putImageData(r,0,0)}(c.current.firstChild,P,k,S)},[P]),(0,n.vJ)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const i=e.getContext("2d"),n=i.createImageData(t,1),s=n.data;let o=0;for(let e=0;e<t;e++){const i=e/(t-1),n=(0,Fs.hT)([i,1,1]);s[o++]=n[0],s[o++]=n[1],s[o++]=n[2],s[o++]=255}i.putImageData(n,0,0)}(d.current.firstChild)},[]);const F=(0,n.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,Fs.bi)(e))}e.currentTarget.value=t},[]),M=(0,n.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,Fs.bi)((0,Fs.xp)(t))),e.currentTarget.value=t},[]),T=(0,n.hb)(e=>{m((0,Fs.bi)((0,Fs.xp)(e.currentTarget.dataset.color)))},[]),B=(0,ve.A)("SettingsGeneralBackgroundColor settings-content custom-scroll",g&&"is-dragging");return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{ref:l,className:B,children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)("div",{ref:c,className:"color-picker",children:[(0,ne.Y)("canvas",{}),(0,ne.Y)("div",{className:"handle",style:`transform: translate(${N[0]}px, ${N[1]}px); background-color: ${I};`})]}),(0,ne.FD)("div",{ref:d,className:"hue-picker",children:[(0,ne.Y)("canvas",{}),(0,ne.Y)("div",{className:"handle",style:`transform: translateX(${w}px); background-color: ${Y};`})]}),(0,ne.FD)("div",{className:"tools",children:[(0,ne.Y)(ee.A,{value:b,label:"HEX",onChange:M}),(0,ne.Y)(ee.A,{value:f,label:"RGB",onChange:F})]})]}),(0,ne.Y)("div",{className:"predefined-colors",children:ru.map(e=>(0,ne.Y)("div",{className:(0,ve.A)("predefined-color",e===I?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:T}))})]})})),hu=(0,n.ph)(({currentScreen:e,editedFolderId:t,hasProfileBackground:i,onReset:a})=>{const{signOut:r,openDeleteChatFolderModal:l,openSettingsScreen:c}=(0,s.ko)(),{isMobile:d}=(0,Y.Ay)(),[h,u]=(0,n.J0)(!1),m=function(e,t){const i=(0,n.li)(0),s=(0,n.li)();return(0,n.hb)(()=>{if(i.current++,5===i.current)return i.current=0,void t();s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{i.current=0},300)},[5,t])}(0,()=>{c({screen:o.VS.Experimental})}),p=(0,n.hb)(()=>{u(!0)},[]),g=(0,n.hb)(()=>{u(!1)},[]),v=(0,n.hb)(()=>{t&&l({folderId:t})},[t,l]),A=(0,n.hb)(()=>{g(),r({forceInitApi:!0})},[g,r]),f=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{round:!0,ripple:!d,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[d]),C=(0,B.A)(),b=(0,Bi.A)();return(0,ne.FD)("div",{className:i&&e===o.VS.Main?"left-header":"left-header secondary",children:[(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:C("AccDescrGoBack"),iconName:"arrow-left"}),function(){switch(e){case o.VS.EditProfile:return(0,ne.Y)("h3",{children:C("lng_settings_information")});case o.VS.General:return(0,ne.Y)("h3",{children:C("General")});case o.VS.QuickReaction:return(0,ne.Y)("h3",{children:C("DoubleTapSetting")});case o.VS.CustomEmoji:return(0,ne.Y)("h3",{children:C("Emoji")});case o.VS.Notifications:return(0,ne.Y)("h3",{children:C("Notifications")});case o.VS.DataStorage:return(0,ne.Y)("h3",{children:C("DataSettings")});case o.VS.Privacy:return(0,ne.Y)("h3",{children:C("PrivacySettings")});case o.VS.Language:return(0,ne.Y)("h3",{children:C("Language")});case o.VS.DoNotTranslate:return(0,ne.Y)("h3",{children:C("DoNotTranslate")});case o.VS.Stickers:return(0,ne.Y)("h3",{children:C("StickersName")});case o.VS.Experimental:return(0,ne.Y)("h3",{children:C("lng_settings_experimental")});case o.VS.GeneralChatBackground:return(0,ne.Y)("h3",{children:C("ChatBackground")});case o.VS.GeneralChatBackgroundColor:return(0,ne.Y)("h3",{children:C("SetColor")});case o.VS.PrivacyPhoneNumber:return(0,ne.Y)("h3",{children:C("PrivacyPhone")});case o.VS.PrivacyLastSeen:return(0,ne.Y)("h3",{children:C("PrivacyLastSeen")});case o.VS.PrivacyProfilePhoto:return(0,ne.Y)("h3",{children:C("Privacy.ProfilePhoto")});case o.VS.PrivacyBio:return(0,ne.Y)("h3",{children:C("PrivacyBio")});case o.VS.PrivacyBirthday:return(0,ne.Y)("h3",{children:C("PrivacyBirthday")});case o.VS.PrivacyGifts:return(0,ne.Y)("h3",{children:b("PrivacyGifts")});case o.VS.PrivacyForwarding:return(0,ne.Y)("h3",{children:C("PrivacyForwards")});case o.VS.PrivacyVoiceMessages:return(0,ne.Y)("h3",{children:C("PrivacyVoiceMessages")});case o.VS.PrivacyMessages:return(0,ne.Y)("h3",{children:C("PrivacyMessages")});case o.VS.PrivacyGroupChats:return(0,ne.Y)("h3",{children:C("AutodownloadGroupChats")});case o.VS.PrivacyPhoneCall:return(0,ne.Y)("h3",{children:C("Calls")});case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:return(0,ne.Y)("h3",{children:C("AlwaysShareWith")});case o.VS.PrivacyLastSeenDeniedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:case o.VS.PrivacyBioDeniedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return(0,ne.Y)("h3",{children:C("NeverShareWith")});case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneP2PAllowedContacts:return(0,ne.Y)("h3",{children:C("AlwaysAllow")});case o.VS.PrivacyPhoneNumberDeniedContacts:case o.VS.PrivacyBirthdayDeniedContacts:case o.VS.PrivacyGiftsDeniedContacts:case o.VS.PrivacyForwardingDeniedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return(0,ne.Y)("h3",{children:C("NeverAllow")});case o.VS.PrivacyNoPaidMessages:return(0,ne.Y)("h3",{children:b("RemoveFeeTitle")});case o.VS.Performance:return(0,ne.Y)("h3",{children:b("MenuAnimations")});case o.VS.ActiveSessions:return(0,ne.Y)("h3",{children:C("SessionsTitle")});case o.VS.ActiveWebsites:return(0,ne.Y)("h3",{children:C("OtherWebSessions")});case o.VS.PrivacyBlockedUsers:return(0,ne.Y)("h3",{children:C("BlockedUsers")});case o.VS.TwoFaDisabled:case o.VS.TwoFaEnabled:return(0,ne.Y)("h3",{children:C("TwoStepVerification")});case o.VS.TwoFaNewPassword:case o.VS.TwoFaChangePasswordNew:case o.VS.TwoFaChangePasswordConfirm:return(0,ne.Y)("h3",{children:C("PleaseEnterCurrentPassword")});case o.VS.TwoFaNewPasswordConfirm:return(0,ne.Y)("h3",{children:C("PleaseReEnterPassword")});case o.VS.TwoFaNewPasswordHint:case o.VS.TwoFaChangePasswordHint:return(0,ne.Y)("h3",{children:C("PasswordHint")});case o.VS.TwoFaNewPasswordEmail:case o.VS.TwoFaRecoveryEmail:return(0,ne.Y)("h3",{children:C("RecoveryEmailTitle")});case o.VS.TwoFaNewPasswordEmailCode:case o.VS.TwoFaRecoveryEmailCode:return(0,ne.Y)("h3",{children:"Recovery Email Code"});case o.VS.TwoFaCongratulations:return(0,ne.Y)("h3",{children:C("TwoStepVerificationPasswordSet")});case o.VS.TwoFaChangePasswordCurrent:case o.VS.TwoFaTurnOff:case o.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ne.Y)("h3",{children:C("PleaseEnterCurrentPassword")});case o.VS.PasscodeDisabled:case o.VS.PasscodeEnabled:case o.VS.PasscodeNewPasscode:case o.VS.PasscodeNewPasscodeConfirm:case o.VS.PasscodeCongratulations:return(0,ne.Y)("h3",{children:C("Passcode")});case o.VS.PasscodeTurnOff:return(0,ne.Y)("h3",{children:C("PasscodeController.Disable.Title")});case o.VS.PasscodeChangePasscodeCurrent:case o.VS.PasscodeChangePasscodeNew:return(0,ne.Y)("h3",{children:C("PasscodeController.Change.Title")});case o.VS.PasscodeChangePasscodeConfirm:return(0,ne.Y)("h3",{children:C("PasscodeController.ReEnterPasscode.Placeholder")});case o.VS.Folders:return(0,ne.Y)("h3",{children:C("Filters")});case o.VS.FoldersCreateFolder:return(0,ne.Y)("h3",{children:C("FilterNew")});case o.VS.FoldersShare:return(0,ne.Y)("h3",{children:C("FolderLinkScreen.Title")});case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:return(0,ne.FD)("div",{className:"settings-main-header",children:[(0,ne.Y)("h3",{children:C("FilterEdit")}),Boolean(t)&&(0,ne.Y)(ue.A,{className:"settings-more-menu",trigger:f,positionX:"right",children:(0,ne.Y)(me.A,{icon:"delete",destructive:!0,onClick:v,children:C("Delete")})})]});case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:return(0,ne.Y)("h3",{children:C(e===o.VS.FoldersIncludedChats||e===o.VS.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude")});case o.VS.Passkeys:return(0,ne.Y)("h3",{children:b("SettingsPasskeyTitle")});default:return(0,ne.FD)("div",{className:"settings-main-header",children:[(0,ne.Y)("h3",{onClick:m,children:C("SETTINGS")}),(0,ne.Y)(X.A,{round:!0,ripple:!d,size:"smaller",color:"translucent",onClick:()=>c({screen:o.VS.EditProfile}),ariaLabel:C("lng_settings_information"),iconName:"edit"}),(0,ne.Y)(ue.A,{className:"settings-more-menu",trigger:f,positionX:"right",children:(0,ne.Y)(me.A,{icon:"logout",onClick:p,children:C("LogOutTitle")})})]})}}(),(0,ne.Y)(ci.A,{isOpen:h,onClose:g,text:C("lng_sure_logout"),confirmLabel:C("AccountSettings.Logout"),confirmHandler:A,confirmIsDestructive:!0})]})});var uu=i(6e4);const mu=(0,n.ph)((0,s.EK)(e=>{const{canTranslate:t,canTranslateChats:i,doNotTranslate:n}=e.settings.byKey,{language:s,languages:o}=(0,Rn.lS)(e);return{isCurrentUserPremium:(0,c.g29)(e),languages:o,language:s,canTranslate:t,canTranslateChats:i,doNotTranslate:n}})(({isActive:e,isCurrentUserPremium:t,languages:i,language:a,canTranslate:r,canTranslateChats:l,doNotTranslate:c,onReset:d})=>{const{loadLanguages:h,setSettingOption:m,setSharedSettingOption:p,openPremiumModal:g,openSettingsScreen:v}=(0,s.ko)(),[A,f]=(0,n.J0)(a),[C,b,y]=(0,D.A)(),S=t&&l,k=(0,B.A)();(0,n.vJ)(()=>{i?.length||h()},[i]);const N=(0,T.A)(e=>{f(e),b(),(0,uu.wT)(e,()=>{y(),p({language:e})})}),w=(0,n.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&&C})).sort(i=>!e||i.value!==e&&i.value!==t?0:-1)},[C,i,A]),I=(0,T.A)(e=>{m({canTranslate:e})}),P=(0,T.A)(e=>{m({canTranslateChats:e})}),Y=(0,T.A)(()=>{t||g({initialSection:"translations"})}),F=(0,n.Kr)(()=>{if(u.CM&&c.length)return 1===c.length?new Intl.DisplayNames([a],{type:"language"}).of(c[0]):k("Languages",c.length)},[c,k,a]),M=(0,T.A)(()=>{v({screen:o.VS.DoNotTranslate})});return(0,ke.A)({isActive:e,onBack:d}),(0,ne.FD)("div",{className:"settings-content settings-language custom-scroll",children:[u.CM&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:k("ShowTranslateButton"),checked:r,onCheck:I}),(0,ne.Y)(es.A,{label:k("ShowTranslateChatButton"),checked:S,disabled:!t,rightIcon:t?void 0:"lock",onClickLabel:Y,onCheck:P}),(r||S)&&(0,ne.FD)(ui.A,{narrow:!0,onClick:M,children:[k("DoNotTranslate"),(0,ne.Y)("span",{className:"settings-item__current-value",children:F})]})]}),(0,ne.Y)(Hd.IW,{children:k("lng_translate_settings_about")})]}),(0,ne.Y)(ae.Ay,{activeKey:w?1:0,name:"fade",className:"settings-language-transition",children:w?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:k("Localization.InterfaceLanguage")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(Ic,{items:w,selectedValue:A,forceRenderAllItems:!0,onSelectedValueChange:N,itemInputType:"radio",className:"settings-picker"})})]}):(0,ne.Y)(Jn.A,{})})]})}));var pu=i(86046),gu=i(25301),vu=i(87970);const Au=(0,n.ph)((0,s.EK)(e=>{const{currentUserId:t}=e,i=(0,c.hc)(e),n=e.stars?.balance,s=e.ton?.balance;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,c.n_C)(e),isGiveawayAvailable:i,starsBalance:n,tonBalance:s}})(({isActive:e,currentUserId:t,sessionCount:i,canBuyPremium:r,isGiveawayAvailable:l,starsBalance:c,tonBalance:d,onReset:h})=>{const{loadMoreProfilePhotos:u,openPremiumModal:m,openSupportChat:p,openUrl:g,openGiftRecipientPicker:v,openStarsBalanceModal:A,openSettingsScreen:f}=(0,s.ko)(),[C,b,y]=(0,D.A)(!1),S=(0,Bi.A)();(0,n.vJ)(()=>{t&&u({peerId:t,isPreload:!0})},[t]),(0,ke.A)({isActive:e,onBack:h});const k=(0,T.A)(()=>{p(),y()});return(0,ne.FD)("div",{className:(0,ve.A)("G5A_hHwt","settings-main-scroll","custom-scroll"),children:[(0,ne.FD)("div",{className:"NIeY5sj7",children:[t&&(0,ne.Y)(vu.A,{peerId:t,canPlayVideo:Boolean(e),isForSettings:!0}),t&&(0,ne.Y)(gu.A,{chatOrUserId:t,isInSettings:!0})]}),(0,ne.FD)("div",{className:"oMmVeS19",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"settings",narrow:!0,onClick:()=>f({screen:o.VS.General}),children:S("TelegramGeneralSettingsViewController")}),(0,ne.Y)(ui.A,{icon:"animations",narrow:!0,onClick:()=>f({screen:o.VS.Performance}),children:S("MenuAnimations")}),(0,ne.Y)(ui.A,{icon:"unmute",narrow:!0,onClick:()=>f({screen:o.VS.Notifications}),children:S("Notifications")}),(0,ne.Y)(ui.A,{icon:"data",narrow:!0,onClick:()=>f({screen:o.VS.DataStorage}),children:S("DataSettings")}),(0,ne.Y)(ui.A,{icon:"lock",narrow:!0,onClick:()=>f({screen:o.VS.Privacy}),children:S("PrivacySettings")}),(0,ne.Y)(ui.A,{icon:"folder",narrow:!0,onClick:()=>f({screen:o.VS.Folders}),children:S("Filters")}),(0,ne.FD)(ui.A,{icon:"active-sessions",narrow:!0,onClick:()=>f({screen:o.VS.ActiveSessions}),children:[S("SessionsTitle"),i>0&&(0,ne.Y)("span",{className:"settings-item__current-value",children:i})]}),(0,ne.FD)(ui.A,{icon:"language",narrow:!0,onClick:()=>f({screen:o.VS.Language}),children:[S("Language"),(0,ne.Y)("span",{className:"settings-item__current-value",children:S.languageInfo.nativeName})]}),(0,ne.Y)(ui.A,{icon:"stickers",narrow:!0,onClick:()=>f({screen:o.VS.Stickers}),children:S("MenuStickers")})]}),(0,ne.FD)(Hd.Ay,{children:[r&&(0,ne.Y)(ui.A,{leftElement:(0,ne.Y)(Ch.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),narrow:!0,onClick:()=>m(),children:S("TelegramPremium")}),(0,ne.FD)(ui.A,{leftElement:(0,ne.Y)(Ch.A,{className:"icon ListItem-main-icon",type:"gold",size:"big"}),narrow:!0,onClick:()=>A({}),children:[S("MenuStars"),Boolean(c)&&(0,ne.Y)("span",{className:"settings-item__current-value",children:(0,pu.ZF)(S,c)})]}),(0,ne.FD)(ui.A,{leftElement:(0,ne.Y)(he.A,{className:"icon ListItem-main-icon",name:"toncoin"}),narrow:!0,onClick:()=>A({currency:a.ykW}),children:[S("MenuTon"),Boolean(d)&&(0,ne.Y)("span",{className:"settings-item__current-value",children:(0,wo.UL)(d.amount,d.currency)})]}),l&&(0,ne.Y)(ui.A,{icon:"gift",narrow:!0,onClick:()=>v(),children:S("MenuSendGift")})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"ask-support",narrow:!0,onClick:b,children:S("AskAQuestion")}),(0,ne.Y)(ui.A,{icon:"help",narrow:!0,onClick:()=>g({url:a.r9K}),children:S("MenuTelegramFaq")}),(0,ne.Y)(ui.A,{icon:"privacy-policy",narrow:!0,onClick:()=>g({url:a.pkx}),children:S("MenuPrivacyPolicy")})]})]}),(0,ne.Y)(ci.A,{isOpen:C,confirmLabel:S("OK"),title:S("AskAQuestion"),textParts:S("MenuAskText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:k,onClose:y})]})}));var fu=i(5560),Cu=i(56133);const bu=(0,n.ph)((0,s.EK)(e=>({hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),shouldNotifyAboutPinnedMessages:e.settings.byKey.shouldNotifyAboutPinnedMessages,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:o,shouldNotifyAboutPinnedMessages:a,hasPushNotifications:r,hasWebNotifications:l,notificationSoundVolume:c})=>{const{loadNotificationSettings:d,setSettingOption:h,updateContactSignUpNotification:u,updateNotificationSettings:m,updateWebNotificationSettings:p}=(0,s.ko)();(0,n.vJ)(()=>{d()},[d]);const g=(0,Cu.A)(500,!0),v=(0,fu.M2)(),A=v&&!(0,fu.Ac)(),f=Boolean(i?.channels?.mutedUntil),C=Boolean(i?.groups?.mutedUntil),b=Boolean(i?.users?.mutedUntil),y=(0,n.hb)((e,t,n)=>{const s=Boolean(i?.[t]?.mutedUntil),o=Boolean(i?.[t]?.shouldShowPreviews);m({peerType:t,isMuted:"mute"===n?!e.target.checked:s,shouldShowPreviews:"showPreviews"===n?e.target.checked:o})},[i,m]),S=(0,n.hb)(e=>{const t=e.target.checked;p({hasWebNotifications:t,hasPushNotifications:!!t&&void 0})},[p]),k=(0,n.hb)(e=>{p({hasPushNotifications:e.target.checked})},[p]),N=(0,n.hb)(e=>{y(e,"users","mute")},[y]),w=(0,n.hb)(e=>{y(e,"users","showPreviews")},[y]),I=(0,n.hb)(e=>{y(e,"groups","mute")},[y]),P=(0,n.hb)(e=>{y(e,"groups","showPreviews")},[y]),Y=(0,n.hb)(e=>{y(e,"channels","mute")},[y]),F=(0,n.hb)(e=>{y(e,"channels","showPreviews")},[y]),D=(0,n.hb)(e=>{u({isSilent:!e.target.checked})},[u]),M=(0,n.hb)(e=>{h({shouldNotifyAboutPinnedMessages:e.target.checked})},[h]),T=(0,n.hb)(e=>{p({notificationSoundVolume:e}),g(()=>(0,fu.BA)(void 0,e))},[g,p]),B=(0,Bi.A)();return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:B.isRtl?"rtl":void 0,children:B("NotificationsWeb")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:B("NotificationsWeb"),subLabel:B(l?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:l,disabled:!v,onChange:S}),(0,ne.Y)(es.A,{label:B("NotificationsOffline"),disabled:!l||!A,subLabel:B(A?r?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled":"SettingsOfflineNotificationUnsupported"),checked:r,onChange:k}),(0,ne.Y)(nt.A,{label:B("NotificationsSound"),min:0,max:10,disabled:!v,value:c,onChange:T})]}),(0,ne.Y)(Hd.Qg,{dir:B.isRtl?"rtl":void 0,children:B("AutodownloadPrivateChats")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:B("NotificationsForPrivateChats"),subLabel:B(b?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!b,onChange:N}),(0,ne.Y)(es.A,{label:B("MessagePreview"),disabled:b,subLabel:B(i?.users?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.users?.shouldShowPreviews),onChange:w})]}),(0,ne.Y)(Hd.Qg,{dir:B.isRtl?"rtl":void 0,children:B("FilterGroups")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:B("NotificationsForGroups"),subLabel:B(C?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!C,onChange:I}),(0,ne.Y)(es.A,{label:B("MessagePreview"),disabled:C,subLabel:B(i?.groups?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.groups?.shouldShowPreviews),onChange:P})]}),(0,ne.Y)(Hd.Qg,{dir:B.isRtl?"rtl":void 0,children:B("FilterChannels")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:B("NotificationsForChannels"),subLabel:B(f?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!f,onChange:Y}),(0,ne.Y)(es.A,{label:B("MessagePreview"),disabled:f,subLabel:B(i?.channels?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.channels?.shouldShowPreviews),onChange:F})]}),(0,ne.Y)(Hd.Qg,{dir:B.isRtl?"rtl":void 0,children:B("PhoneOther")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:B("ContactJoined"),checked:o,onChange:D}),(0,ne.Y)(es.A,{label:B("PinnedMessagesNotifications"),checked:a,onChange:M})]})]})}));var yu=i(19801);const Su=2*v.$;function ku(e,t){const i=new Date,n=(0,yu.qj)(t,i);return Math.abs(n)>28?(0,yu.r6)(e,t):(0,yu.r6)(e,t,{relative:"auto"})}const Nu=(0,n.ph)((0,s.EK)(e=>({passkeys:e.settings.passkeys,maxPasskeysCount:e.appConfig.passkeysMaxCount}))(({isActive:e,passkeys:t,maxPasskeysCount:i,onReset:o})=>{const{startPasskeyRegistration:a,deletePasskey:r,openPasskeyModal:l}=(0,s.ko)(),c=(0,Bi.A)(),[d,h]=(0,n.J0)(),m=u.DL&&(t?.length??0)<i,p=(0,T.A)(()=>{a()}),g=(0,T.A)(()=>{l()}),v=(0,T.A)(()=>{d&&(r({id:d}),h(void 0))});return(0,n.vJ)(()=>{t&&!t.length&&e&&o()},[t,o,e]),(0,ke.A)({isActive:e,onBack:o}),(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Passkeys,previewUrl:Uo.d.Passkeys,size:120,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description",dir:"auto",children:c("SettingsPasskeyInfo")})]}),(0,ne.FD)(Hd.Ay,{className:"settings-item",children:[t?.map(function(e){const{softwareEmojiId:t,id:i,name:n,date:s,lastUsageDate:o}=e;return(0,ne.Y)(ui.A,{ripple:!0,narrow:!0,contextActions:[{title:c("Delete"),icon:"delete",destructive:!0,handler:()=>{h(i)}}],leftElement:t?(0,ne.Y)(hs.A,{size:Su,className:(0,ve.A)("KYlz_M1L","ListItem-main-icon"),documentId:t,noPlay:!0}):(0,ne.Y)(he.A,{name:"lock",className:(0,ve.A)("eHtPi2EI","ListItem-main-icon")}),children:(0,ne.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ne.FD)("span",{className:"title title-with-date",children:[n||c("SettingsPasskeyFallbackTitle"),(0,ne.Y)("span",{className:"date",children:ku(c,(0,yu.Ft)(s))})]}),Boolean(o)&&(0,ne.Y)("span",{className:"subtitle",children:c("SettingsPasskeyUsedAt",{date:ku(c,(0,yu.Ft)(o))})})]})},i)}),m&&(0,ne.Y)(X.A,{className:"settings-button",color:"primary",iconName:"add",isText:!0,noForcedUpperCase:!0,onClick:p,children:c("SettingsPasskeysCreate")})]}),(0,ne.Y)(Hd.IW,{dir:"auto",children:c("SettingsPasskeysFooter",{link:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:g,children:c("SettingsPasskeysFooterLink",void 0,{withNodes:!0,specialReplacement:Fi.hG})})},{withNodes:!0})}),(0,ne.Y)(ci.A,{isOpen:Boolean(d),title:c("PasskeyDeleteTitle"),textParts:c("PasskeyDeleteText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:v,confirmIsDestructive:!0,confirmLabel:c("Delete"),onClose:()=>h(void 0)})]})}));var wu=i(20714),Iu=i(22986);const Pu=["SettingsPerformanceSliderLow","SettingsPerformanceSliderMedium","SettingsPerformanceSliderHigh"],Yu=["SettingsPerformanceSliderLow","SettingsPerformanceSliderCustom","SettingsPerformanceSliderHigh"],Fu=[["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:"messageBlur",label:"SettingsPerformanceMessageBlur",disabled:!u.Fy},{key:"rightColumnAnimations",label:"SettingsPerformanceRightColumn"},{key:"snapEffect",label:"SettingsPerformanceThanos"},{key:"textStreaming",label:"SettingsPerformanceTextStreaming"}]],["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"}]]],Du=(0,n.ph)((0,s.EK)(e=>({performanceSettings:(0,c.Cw0)(e)}))(function({isActive:e,performanceSettings:t,onReset:i}){const{setSharedSettingOption:o,updatePerformanceSettings:r}=(0,s.ko)();(0,ke.A)({isActive:e,onBack:i});const l=(0,Bi.A)(),[c,d]=(0,n.J0)({}),h=(0,n.Kr)(()=>Fu.reduce((e,[,i],n)=>(e[n]=i.every(({key:e})=>t[e]),e),{}),[t]),m=(0,n.Kr)(()=>(0,Iu.T)(t,wu.LH)?a.zP3:(0,Iu.T)(t,wu.PI)?a.dnp:(0,Iu.T)(t,wu.tS)?a.zHL:a.M8B,[t]),p=(0,n.Kr)(()=>(m===a.M8B?Yu:Pu).map(e=>l(e)),[m,l]),g=(0,n.hb)((e,t)=>{e.preventDefault();const i=Number(t);d(e=>({...e,[i]:!e[i]}))},[]),v=(0,n.hb)(e=>{const t=e===a.dnp?wu.PI:e===a.zHL?wu.tS:wu.LH;o({animationLevel:e,wasAnimationLevelSetManually:!0}),r(t)},[]),A=(0,n.hb)(e=>{const{name:t,checked:i}=e.target,n=Fu.find(([e])=>e===t);if(!n)return;const s=n[1].reduce((e,{key:t})=>(e[t]=i,e),{});r(s)},[]),f=(0,n.hb)(e=>{const{name:t,checked:i}=e.target;r({[t]:i})},[]);return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderTitle")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(nt.A,{options:p,value:m===a.M8B?a.zHL:m,onChange:v})}),(0,ne.Y)(Hd.IW,{dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderSubtitle")}),(0,ne.Y)(Hd.Qg,{dir:"auto",children:l("SettingsPerformanceGranularTitle")}),(0,ne.Y)(Hd.Ay,{children:Fu.map(([e,i],n)=>(0,ne.FD)("div",{className:"settings-dropdown-section",children:[(0,ne.Y)("div",{className:"ListItem with-checkbox",children:(0,ne.Y)(es.A,{name:e,value:n.toString(),checked:h[n],label:l(e),rightIcon:c[n]?"up":"down",onChange:A,onClickLabel:g})}),Boolean(c[n])&&(0,ne.Y)("div",{className:"DropdownList DropdownList--open",children:i.map(({key:e,label:i,disabled:n})=>{if("snapEffect"!==e||u.bW)return(0,ne.Y)(es.A,{name:e,checked:t[e],label:l(i),disabled:n,onChange:f},e)})})]},e))})]})})),Mu=(0,n.ph)((0,s.EK)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:i,canChangeSensitive:n,shouldArchiveAndMuteNewNonContact:s,shouldNewNonContactPeersRequirePremium:o,nonContactPeersPaidStars:a},privacy:r,accountDaysTtl:l,passkeys:d},blocked:h,passcode:{hasPasscode:u},appConfig:m}=e,{canDisplayChatInTitle:p}=(0,Rn.lS)(e),g=Boolean(a),v=(0,c.trm)(e),A=(0,c.g29)(e);return{isCurrentUserPremium:A,hasPassword:t,hasPasscode:Boolean(u),blockedCount:h.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:i,canDisplayAutoarchiveSetting:m.canDisplayAutoarchiveSetting||A,shouldArchiveAndMuteNewNonContact:s,canChangeSensitive:n,shouldNewNonContactPeersRequirePremium:o,shouldChargeForMessages:g,needAgeVideoVerification:Boolean(m.needAgeVideoVerification),privacy:r,canDisplayChatInTitle:p,canSetPasscode:(0,c.Ntz)(e),isCurrentUserFrozen:v,accountDaysTtl:l,passkeyCount:d?.length,arePasskeysAvailable:m.arePasskeysAvailable}})(({isActive:e,isCurrentUserPremium:t,hasPassword:i,hasPasscode:r,blockedCount:l,webAuthCount:c,passkeyCount:d,arePasskeysAvailable:h,isSensitiveEnabled:u,canChangeSensitive:m,canDisplayAutoarchiveSetting:p,shouldArchiveAndMuteNewNonContact:g,shouldNewNonContactPeersRequirePremium:v,shouldChargeForMessages:A,canDisplayChatInTitle:f,canSetPasscode:C,needAgeVideoVerification:b,privacy:y,isCurrentUserFrozen:S,accountDaysTtl:k,onReset:N})=>{const{openDeleteAccountModal:w,loadPrivacySettings:I,loadBlockedUsers:P,updateContentSettings:Y,loadGlobalPrivacySettings:F,updateGlobalPrivacySettings:D,loadWebAuthorizations:M,setSharedSettingOption:L,openSettingsScreen:x,loadAccountDaysTtl:R,openAgeVerificationModal:E,loadPasskeys:V,openPasskeyModal:_}=(0,s.ko)();(0,n.vJ)(()=>{S||(P(),I({}),M(),V())},[S]),(0,n.vJ)(()=>{e&&!S&&(F(),R())},[e,S]);const U=(0,B.A)(),O=(0,Bi.A)();(0,ke.A)({isActive:e,onBack:N});const K=(0,T.A)(e=>{D({shouldArchiveAndMuteNewNonContact:e})}),J=(0,T.A)(e=>{L({canDisplayChatInTitle:e})}),j=(0,T.A)(e=>{Y({isSensitiveEnabled:e})}),G=(0,T.A)(()=>{E()}),H=(0,T.A)(()=>{k&&w({days:k})}),z=(0,T.A)(()=>{h&&void 0!==d&&(0!==d?x({screen:o.VS.Passkeys}):_())}),$=(0,n.Kr)(()=>{if(k)return cl(a.WF4,k/30).toString()},[k]);function q(e){if(!e)return U("Loading");const{visibility:t,shouldAllowPremium:i,botsPrivacy:n}=e,s="everybody"===t,o="allow"===n&&!s,a=e.blockChatIds.length+e.blockUserIds.length,r=e.allowChatIds.length+e.allowUserIds.length,l=[];a&&l.push(`-${a}`),r&&!s&&l.push(`+${r}`);const c=[o?O("PrivacyValueBots"):"",O.conjunction(l)].filter(Boolean).join(" ");if(o&&!s)return c;if(i)return U(c?"ContactsAndPremium":"PrivacyPremium");switch(t){case"everybody":return`${U("P2PEverybody")} ${c}`;case"contacts":return`${U("P2PContacts")} ${c}`;case"nobody":return`${U("P2PNobody")} ${c}`}}return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)(ui.A,{icon:"delete-user",narrow:!0,onClick:()=>x({screen:o.VS.PrivacyBlockedUsers}),children:[U("BlockedUsers"),(0,ne.Y)("span",{className:"settings-item__current-value",children:l||""})]}),C&&(0,ne.Y)(ui.A,{icon:"lock",narrow:!0,onClick:()=>x({screen:r?o.VS.PasscodeEnabled:o.VS.PasscodeDisabled}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("Passcode")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:O(r?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),(0,ne.Y)(ui.A,{icon:"admin",narrow:!0,onClick:()=>x({screen:i?o.VS.TwoFaEnabled:o.VS.TwoFaDisabled}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("TwoStepVerification")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:O(i?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),h&&(0,ne.Y)(ui.A,{icon:"key",narrow:!0,onClick:z,children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:O("SettingsItemPrivacyPasskeys")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:O(void 0===d?"Loading":d>0?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),c>0&&(0,ne.FD)(ui.A,{icon:"web",narrow:!0,onClick:()=>x({screen:o.VS.ActiveWebsites}),children:[U("PrivacySettings.WebSessions"),(0,ne.Y)("span",{className:"settings-item__current-value",children:c})]})]}),(0,ne.Y)(Hd.Qg,{dir:O.isRtl?"rtl":void 0,children:U("PrivacyTitle")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyPhoneNumber}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyPhoneTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.phoneNumber)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyLastSeen}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("LastSeenTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.lastSeen)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyProfilePhoto}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyProfilePhotoTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.profilePhoto)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyBio}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyBio")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.bio)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyBirthday}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyBirthday")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.birthday)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyGifts}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:O("PrivacyGifts")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.gifts)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyForwarding}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyForwardsTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.forwards)})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyPhoneCall}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("WhoCanCallMe")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.phoneCall)})]})}),(0,ne.Y)(ui.A,{narrow:!0,allowDisabledClick:!0,rightElement:t&&(0,ne.Y)(Ch.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyVoiceMessages}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyVoiceMessagesTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.voiceMessages)})]})}),(0,ne.Y)(ui.A,{narrow:!0,rightElement:t&&(0,ne.Y)(Ch.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyMessages}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("PrivacyMessagesTitle")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:A?O("PrivacyPaidMessagesValue"):U(v?"PrivacyMessagesContactsAndPremium":"P2PEverybody")})]})}),(0,ne.Y)(ui.A,{narrow:!0,className:"no-icon",onClick:()=>x({screen:o.VS.PrivacyGroupChats}),children:(0,ne.FD)("div",{className:"multiline-item",children:[(0,ne.Y)("span",{className:"title",children:U("WhoCanAddMe")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:q(y.chatInvite)})]})})]}),m&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:O.isRtl?"rtl":void 0,children:U("lng_settings_sensitive_title")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:U("lng_settings_sensitive_disable_filtering"),subLabel:U("lng_settings_sensitive_about"),checked:Boolean(u),disabled:!m||!u&&b,onCheck:j}),!u&&b&&(0,ne.Y)(X.A,{color:"primary",noForcedUpperCase:!0,className:"settings-unlock-button",onClick:G,children:(0,ne.Y)("span",{className:"settings-unlock-button-title",children:O("ButtonAgeVerification")})})]})]}),p&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:O.isRtl?"rtl":void 0,children:U("NewChatsFromNonContacts")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:U("ArchiveAndMute"),subLabel:U("ArchiveAndMuteInfo"),checked:Boolean(g),onCheck:K})})]}),(0,ne.Y)(Hd.Qg,{dir:O.isRtl?"rtl":void 0,children:U("lng_settings_window_system")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:U("lng_settings_title_chat_name"),checked:Boolean(f),onCheck:J})}),(0,ne.Y)(Hd.Qg,{dir:O.isRtl?"rtl":void 0,children:O("DeleteMyAccount")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{narrow:!0,onClick:H,children:[O("DeleteAccountIfAwayFor"),(0,ne.Y)("span",{className:"settings-item__current-value",children:O("Months",{count:$},{pluralValue:1})})]})})]})})),Tu=(0,n.ph)((0,s.EK)(e=>{const{users:{byId:t},blocked:{ids:i},contactList:n,currentUserId:s}=e;return{usersById:t,blockedIds:i,contactIds:n?.userIds,localContactIds:(0,c.nTw)(e).userSearch.localUserIds,currentUserId:s}})(({usersById:e,blockedIds:t,contactIds:i,localContactIds:o,currentUserId:a,isOpen:r,onClose:c})=>{const{setUserSearchQuery:d,blockUser:h}=(0,s.ko)(),u=(0,Bi.A)(),[m,p]=(0,n.J0)("");(0,n.vJ)(()=>{d({query:m})},[m,d]);const g=(0,n.Kr)(()=>{const n=(0,pi.Am)([...i||[],...o||[]].filter(e=>e!==a&&!t.includes(e)));return(0,Dt.PU)({ids:n,query:m,type:"user"}).sort((t,i)=>{const n=(0,l.Yg)(e[t])||"",s=(0,l.Yg)(e[i])||"";return n.localeCompare(s)})},[t,i,a,m,o,e]),v=(0,n.hb)(e=>{h({userId:e}),c()},[c]);return(0,ne.Y)(Wn,{isOpen:r,chatOrUserIds:g,title:u("BlockedUsersBlockUser"),searchPlaceholder:u("Search"),search:m,onSearchChange:p,onSelectChatOrUser:v,onClose:c})})),Bu=(0,n.ph)((0,s.EK)(e=>{const{chats:{byId:t},users:{byId:i},blocked:{ids:n},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:i,blockedIds:n,phoneCodeList:s}})(({isActive:e,onReset:t,chatsByIds:i,usersByIds:o,blockedIds:r,phoneCodeList:c})=>{const{unblockUser:d}=(0,s.ko)(),h=(0,B.A)(),[u,m,p]=(0,D.A)(),v=(0,n.hb)(e=>{d({userId:e})},[d]);(0,ke.A)({isActive:e,onBack:t});const A=(0,n.Kr)(()=>r.reduce((e,t)=>{const i=(0,g.L8)(t)?o[t]:void 0,n=i&&!i.phoneNumber&&(0,l.Kl)(i);return n&&(e[t]=n),e},{}),[r,o]);return(0,ne.FD)("div",{className:"settings-fab-wrapper",children:[(0,ne.FD)(zd.A,{className:"CUpIVyQd",children:[(0,ne.Y)(Hd.IW,{dir:h.isRtl?"rtl":void 0,children:h("BlockedUsersInfo")}),(0,ne.Y)(Hd.Ay,{className:"RxElucVY",children:(0,ne.Y)("div",{className:"chat-list custom-scroll",children:r?.length?(0,ne.Y)("div",{className:"scroll-container",style:`height: ${r.length*a.yq1}px`,children:r.map((e,t)=>function(e,t){const n=(0,g.L8)(e),s=o[e],r=i[e],l=s||r,d=(0,ve.A)("Chat chat-item-clickable blocked-list-item small-icon",n?"private":"group"),h=A[e];return(0,ne.FD)(ui.A,{className:d,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{v(e)}}],style:`top: ${(0+t)*a.yq1}px;`,children:[(0,ne.Y)(Tt.A,{size:"medium",peer:l}),(0,ne.FD)("div",{className:"contact-info",dir:"auto",children:[l&&(0,ne.Y)(jn.A,{peer:l}),s?.phoneNumber&&(0,ne.Y)("div",{className:"contact-phone",dir:"auto",children:(0,ds.Ox)(c,s.phoneNumber)}),h&&(0,ne.FD)("div",{className:"contact-username",dir:"auto",children:["@",h]})]})]},`blocked_${e}`)}(e,t))}):r&&!r.length?(0,ne.Y)("div",{className:"no-results",dir:"auto",children:h("NoBlocked")}):(0,ne.Y)(Jn.A,{},"loading")})})]}),(0,ne.Y)(fi.A,{isShown:!0,className:"block-user-button",onClick:m,ariaLabel:h("BlockContact"),iconName:"add"}),(0,ne.Y)(Tu,{isOpen:u,onClose:p})]})}));function Lu(e){switch(e){case o.VS.PrivacyPhoneNumber:case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case o.VS.PrivacyLastSeen:case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyLastSeenDeniedContacts:return"lastSeen";case o.VS.PrivacyProfilePhoto:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case o.VS.PrivacyBio:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBioDeniedContacts:return"bio";case o.VS.PrivacyBirthday:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyBirthdayDeniedContacts:return"birthday";case o.VS.PrivacyGifts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyGiftsDeniedContacts:return"gifts";case o.VS.PrivacyForwarding:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyForwardingDeniedContacts:return"forwards";case o.VS.PrivacyVoiceMessages:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case o.VS.PrivacyGroupChats:case o.VS.PrivacyGroupChatsAllowedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return"chatInvite";case o.VS.PrivacyPhoneCall:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:return"phoneCall";case o.VS.PrivacyPhoneP2P:case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return"phoneP2P";case o.VS.PrivacyAddByPhone:return"addByPhone";case o.VS.PrivacyNoPaidMessages:return"noPaidMessages"}}const xu=(0,n.ph)((0,s.EK)(e=>{const{settings:{byKey:{disallowedGifts:t}}}=e;return{disallowedGifts:t,isCurrentUserPremium:(0,c.g29)(e)}})(({disallowedGifts:e,isCurrentUserPremium:t})=>{const{showNotification:i,updateGlobalPrivacySettings:n}=(0,s.ko)(),o=(0,Bi.A)(),a=(0,T.A)(()=>{i({message:o("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),r=(0,T.A)(()=>{t?n({disallowedGifts:{...e,shouldDisallowLimitedStarGifts:!e?.shouldDisallowLimitedStarGifts||void 0}}):a()}),l=(0,T.A)(()=>{t?n({disallowedGifts:{...e,shouldDisallowUnlimitedStarGifts:!e?.shouldDisallowUnlimitedStarGifts||void 0}}):a()}),c=(0,T.A)(()=>{t?n({disallowedGifts:{...e,shouldDisallowUniqueStarGifts:!e?.shouldDisallowUniqueStarGifts||void 0}}):a()}),d=(0,T.A)(()=>{t?n({disallowedGifts:{...e,shouldDisallowPremiumGifts:!e?.shouldDisallowPremiumGifts||void 0}}):a()});return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftTitle")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)(ui.A,{onClick:r,children:[(0,ne.Y)("span",{children:o("PrivacyGiftLimitedEdition")}),(0,ne.Y)(Nh.A,{id:"limited_edition",disabled:!t,checked:!t||!e?.shouldDisallowLimitedStarGifts})]}),(0,ne.FD)(ui.A,{onClick:l,children:[(0,ne.Y)("span",{children:o("PrivacyGiftUnlimited")}),(0,ne.Y)(Nh.A,{id:"unlimited",disabled:!t,checked:!t||!e?.shouldDisallowUnlimitedStarGifts})]}),(0,ne.FD)(ui.A,{onClick:c,children:[(0,ne.Y)("span",{children:o("PrivacyGiftUnique")}),(0,ne.Y)(Nh.A,{id:"unique",disabled:!t,checked:!t||!e?.shouldDisallowUniqueStarGifts})]}),(0,ne.FD)(ui.A,{onClick:d,children:[(0,ne.Y)("span",{children:o("PrivacyGiftPremiumSubscription")}),(0,ne.Y)(Nh.A,{id:"premium_subscription",disabled:!t,checked:!t||!e?.shouldDisallowPremiumGifts})]})]}),(0,ne.Y)(Hd.IW,{dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftInfo")})]})})),Ru=(0,n.ph)((0,s.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),shouldHideReadMarks:Boolean((0,c.KIM)(e))}))(({isCurrentUserPremium:e,shouldHideReadMarks:t,visibility:i})=>{const{updateGlobalPrivacySettings:n,openPremiumModal:o}=(0,s.ko)(),a=(0,B.A)(),r="nobody"===i||"contacts"===i,l=(0,T.A)(e=>n({shouldHideReadMarks:e})),c=(0,T.A)(()=>{o({initialSection:"last_seen"})});return(0,ne.FD)(ne.FK,{children:[r&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:a("HideReadTime"),checked:t,onCheck:l})}),(0,ne.Y)(Hd.IW,{dir:a.isRtl?"rtl":void 0,children:(0,Mt.A)(a("HideReadTimeInfo"),["br"])})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{leftElement:(0,ne.Y)(Ch.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:c,children:a(e?"PrivacyLastSeenPremiumForPremium":"PrivacyLastSeenPremium")})}),(0,ne.Y)(Hd.IW,{dir:a.isRtl?"rtl":void 0,children:a(e?"PrivacyLastSeenPremiumInfoForPremium":"PrivacyLastSeenPremiumInfo")})]})}));var Eu=i(91356);const Vu=(0,n.ph)(({currentUserId:e,hasCurrentUserFullInfo:t,currentUserFallbackPhoto:i})=>{const{loadFullUser:o,uploadProfilePhoto:a,deleteProfilePhoto:r,showNotification:l}=(0,s.ko)(),c=(0,B.A)(),[d,h,u]=(0,D.A)(!1),m=(0,n.li)();(0,n.vJ)(()=>{t||o({userId:e})},[t,e,o]);const p=(0,n.hb)(e=>{a({file:e,isFallback:!0}),l({message:c("Privacy.ProfilePhoto.PublicPhotoSuccess")})},[c,l,a]),g=(0,n.hb)(()=>{u(),r({photo:i})},[u,r,i]),v=(0,n.hb)(()=>{m.current?.click()},[]);return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)(ui.A,{narrow:!0,icon:"camera-add",onClick:v,children:[(0,ne.Y)(Eu.A,{onChange:p,inputRef:m}),c(i?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")]}),i&&(0,ne.FD)(ui.A,{narrow:!0,leftElement:(0,ne.Y)(Tt.A,{photo:i,size:"mini",className:"Qvhl9Jjv"}),onClick:h,destructive:!0,children:[c(i.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),(0,ne.Y)(ci.A,{isOpen:d,onClose:u,text:c("Privacy.ResetPhoto.Confirm"),confirmLabel:c("Delete"),confirmHandler:g,confirmIsDestructive:!0})]})]}),(0,ne.Y)(Hd.IW,{dir:c.isRtl?"rtl":void 0,children:c("Privacy.ProfilePhoto.PublicPhotoInfo")})]})});function _u({screen:e,privacy:t,isPremiumRequired:i}){const{setPrivacyVisibility:a,openSettingsScreen:r}=(0,s.ko)(),l=(0,B.A)(),c=(0,Bi.A)(),d=(0,n.Kr)(()=>{const t=e!==o.VS.PrivacyAddByPhone,n=[{value:"everybody",label:l("P2PEverybody")},{value:"contacts",label:i?(0,ne.Y)(yh,{label:l("P2PContacts")}):l("P2PContacts"),hidden:i}];return t&&n.push({value:"nobody",label:i?(0,ne.Y)(yh,{label:l("P2PNobody")}):l("P2PNobody"),hidden:i}),n},[l,e,i]),h=(0,n.Kr)(()=>e===o.VS.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==t?.visibility,shouldShowAllowed:"everybody"!==t?.visibility},[t,e]),u=Lu(e),m=(0,n.Kr)(()=>{switch(e){case o.VS.PrivacyGifts:return c("PrivacyGiftsInfo");case o.VS.PrivacyLastSeen:return l("CustomHelp");case o.VS.PrivacyAddByPhone:return l("everybody"===t?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");case o.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesInfo");default:return}},[l,c,e,t]),p=(0,n.Kr)(()=>{switch(e){case o.VS.PrivacyPhoneNumber:return l("PrivacyPhoneTitle");case o.VS.PrivacyAddByPhone:return l("PrivacyPhoneTitle2");case o.VS.PrivacyLastSeen:return l("LastSeenTitle");case o.VS.PrivacyProfilePhoto:return l("PrivacyProfilePhotoTitle");case o.VS.PrivacyBio:return l("PrivacyBioTitle");case o.VS.PrivacyBirthday:return l("PrivacyBirthdayTitle");case o.VS.PrivacyGifts:return c("PrivacyGiftsTitle");case o.VS.PrivacyForwarding:return l("PrivacyForwardsTitle");case o.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesTitle");case o.VS.PrivacyGroupChats:return l("WhoCanAddMe");case o.VS.PrivacyPhoneCall:return l("WhoCanCallMe");case o.VS.PrivacyPhoneP2P:return l("PrivacyP2P");default:return}},[l,c,e]),g=(0,T.A)((e,t,i,n)=>{const s=e?.length||0,o=t?.length||0,a="allow"===n;if(!s&&!o&&!a)return l(i?"PrivacyPremium":"EditAdminAddUsers");if(i)return l("ContactsAndPremium");const r=s>0?l("Users",s):void 0,d=o>0?l("Chats",o):void 0;return[a?c("PrivacyValueBots"):"",c.conjunction([r,d].filter(Boolean))].filter(Boolean).join(" ")}),v=(0,n.Kr)(()=>g(t?.allowUserIds,t?.allowChatIds,t?.shouldAllowPremium,t?.botsPrivacy),[t]),A=(0,n.Kr)(()=>g(t?.blockUserIds,t?.blockChatIds),[t]),f=(0,n.hb)(e=>{a({privacyKey:u,visibility:e})},[u]),C=(()=>{switch(e){case o.VS.PrivacyPhoneNumber:return o.VS.PrivacyPhoneNumberAllowedContacts;case o.VS.PrivacyLastSeen:return o.VS.PrivacyLastSeenAllowedContacts;case o.VS.PrivacyProfilePhoto:return o.VS.PrivacyProfilePhotoAllowedContacts;case o.VS.PrivacyBio:return o.VS.PrivacyBioAllowedContacts;case o.VS.PrivacyBirthday:return o.VS.PrivacyBirthdayAllowedContacts;case o.VS.PrivacyGifts:return o.VS.PrivacyGiftsAllowedContacts;case o.VS.PrivacyForwarding:return o.VS.PrivacyForwardingAllowedContacts;case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneCallAllowedContacts;case o.VS.PrivacyPhoneP2P:return o.VS.PrivacyPhoneP2PAllowedContacts;case o.VS.PrivacyVoiceMessages:return o.VS.PrivacyVoiceMessagesAllowedContacts;default:return o.VS.PrivacyGroupChatsAllowedContacts}})(),b=(()=>{switch(e){case o.VS.PrivacyPhoneNumber:return o.VS.PrivacyPhoneNumberDeniedContacts;case o.VS.PrivacyLastSeen:return o.VS.PrivacyLastSeenDeniedContacts;case o.VS.PrivacyProfilePhoto:return o.VS.PrivacyProfilePhotoDeniedContacts;case o.VS.PrivacyBio:return o.VS.PrivacyBioDeniedContacts;case o.VS.PrivacyBirthday:return o.VS.PrivacyBirthdayDeniedContacts;case o.VS.PrivacyGifts:return o.VS.PrivacyGiftsDeniedContacts;case o.VS.PrivacyForwarding:return o.VS.PrivacyForwardingDeniedContacts;case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneCallDeniedContacts;case o.VS.PrivacyPhoneP2P:return o.VS.PrivacyPhoneP2PDeniedContacts;case o.VS.PrivacyVoiceMessages:return o.VS.PrivacyVoiceMessagesDeniedContacts;default:return o.VS.PrivacyGroupChatsDeniedContacts}})();return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:c.isRtl?"rtl":void 0,children:p}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:`visibility-${u}`,options:d,onChange:f,selected:t?.visibility})}),m&&(0,ne.Y)(Hd.IW,{dir:c.isRtl?"rtl":void 0,children:m}),!i&&(h.shouldShowAllowed||h.shouldShowDenied)&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:c.isRtl?"rtl":void 0,children:l("PrivacyExceptions")}),(0,ne.FD)(Hd.Ay,{children:[h.shouldShowAllowed&&(0,ne.Y)(ui.A,{narrow:!0,icon:"add-user",onClick:()=>{r({screen:C})},children:(0,ne.FD)("div",{className:"multiline-item full-size",children:[(0,ne.Y)("span",{className:"title",children:l("AlwaysAllow")}),(0,ne.Y)("span",{className:"subtitle",children:v})]})}),h.shouldShowDenied&&(0,ne.Y)(ui.A,{narrow:!0,icon:"delete-user",onClick:()=>{r({screen:b})},children:(0,ne.FD)("div",{className:"multiline-item full-size",children:[(0,ne.Y)("span",{className:"title",children:l("NeverAllow")}),(0,ne.Y)("span",{className:"subtitle",children:A})]})})]})]}),i&&(0,ne.Y)(bh,{})]})}const Uu=(0,n.ph)((0,s.EK)((e,{screen:t})=>{let i,n;const{currentUserId:s,settings:{privacy:a,byKey:{shouldDisplayGiftsButton:r}}}=e,l=(0,c.vGo)(e,s);switch(t){case o.VS.PrivacyPhoneNumber:i=a.phoneNumber,n=a.addByPhone;break;case o.VS.PrivacyLastSeen:i=a.lastSeen;break;case o.VS.PrivacyProfilePhoto:i=a.profilePhoto;break;case o.VS.PrivacyBio:i=a.bio;break;case o.VS.PrivacyBirthday:i=a.birthday;break;case o.VS.PrivacyGifts:i=a.gifts;break;case o.VS.PrivacyPhoneP2P:case o.VS.PrivacyPhoneCall:i=a.phoneCall,n=a.phoneP2P;break;case o.VS.PrivacyForwarding:i=a.forwards;break;case o.VS.PrivacyVoiceMessages:i=a.voiceMessages;break;case o.VS.PrivacyGroupChats:i=a.chatInvite}return i?{primaryPrivacy:i,secondaryPrivacy:n,currentUserId:s,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto,isPremiumRequired:t===o.VS.PrivacyVoiceMessages&&!(0,c.g29)(e),shouldDisplayGiftsButton:r,isCurrentUserPremium:(0,c.g29)(e)}:{currentUserId:s,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto}})(({screen:e,isActive:t,primaryPrivacy:i,secondaryPrivacy:a,currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c,isPremiumRequired:d,onReset:h,shouldDisplayGiftsButton:u,isCurrentUserPremium:m})=>{const{updateGlobalPrivacySettings:p,showNotification:g}=(0,s.ko)(),v=(0,Bi.A)();(0,ke.A)({isActive:t,onBack:h});const A=(0,T.A)(()=>{m?p({shouldDisplayGiftsButton:!u}):g({message:v("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),f=(0,n.Kr)(()=>{switch(e){case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneP2P;case o.VS.PrivacyPhoneNumber:return"nobody"===i?.visibility?o.VS.PrivacyAddByPhone:void 0;default:return}},[i,e]);return(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[e===o.VS.PrivacyGifts&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{onClick:A,children:[(0,ne.Y)("span",{children:v("PrivacyDisplayGiftsButton")}),(0,ne.Y)(Nh.A,{id:"gift",disabled:!m,checked:Boolean(u)})]})}),(0,ne.Y)(Hd.IW,{dir:v.isRtl?"rtl":void 0,children:v("PrivacyDisplayGiftIconInChats",{icon:(0,ne.Y)(he.A,{name:"gift",className:"gift-icon"}),gift:v("PrivacyDisplayGift")},{withNodes:!0})})]}),(0,ne.Y)(_u,{screen:e,privacy:i,isPremiumRequired:d}),e===o.VS.PrivacyProfilePhoto&&"everybody"!==i?.visibility&&(0,ne.Y)(Vu,{currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c}),e===o.VS.PrivacyLastSeen&&(0,ne.Y)(Ru,{visibility:i?.visibility}),e===o.VS.PrivacyGifts&&(0,ne.Y)(xu,{}),Boolean(f)&&(0,ne.Y)(_u,{screen:f,privacy:a})]})})),Ou=[Jd.lw];function Ku(e,t){const{privacy:i}=e.settings;switch(t){case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyPhoneNumberDeniedContacts:return i.phoneNumber;case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyLastSeenDeniedContacts:return i.lastSeen;case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:return i.profilePhoto;case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBioDeniedContacts:return i.bio;case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyBirthdayDeniedContacts:return i.birthday;case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyGiftsDeniedContacts:return i.gifts;case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:return i.phoneCall;case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return i.phoneP2P;case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyForwardingDeniedContacts:return i.forwards;case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:return i.voiceMessages;case o.VS.PrivacyGroupChatsDeniedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:return i.chatInvite;case o.VS.PrivacyNoPaidMessages:return i.noPaidMessages}}const Ju=(0,n.ph)((0,s.EK)((e,{screen:t})=>({currentUserId:e.currentUserId,settings:Ku(e,t)}))(({isAllowList:e,withPremiumCategory:t,withMiniAppsCategory:i,screen:o,isActive:r,currentUserId:c,settings:d,usersOnly:h=!1,onReset:u})=>{const{setPrivacySettings:m}=(0,s.ko)(),p=(0,B.A)(),g=(0,Bi.A)(),v=(0,n.Kr)(()=>({isCustomPeer:!0,type:"bots",title:g("PrivacyValueBots"),avatarIcon:"bots",isAvatarSquare:!0,peerColorId:6}),[g]),A=(0,n.Kr)(()=>[v],[v]),f=(0,n.Kr)(()=>d?e?[...d.allowUserIds,...d.allowChatIds]:[...d.blockUserIds,...d.blockChatIds]:[],[e,d]),C=(0,n.Kr)(()=>d?d.shouldAllowPremium?[Jd.lw.type]:"allow"===d.botsPrivacy&&e?[v.type]:[]:[],[d,e,v]),[b,y]=(0,n.J0)(""),[S,k]=(0,n.J0)(!1),[N,w]=(0,n.J0)(f),[I,P]=(0,n.J0)(C);(0,n.vJ)(()=>{r||(w(f),P(C))},[r,C,f]);const Y=(0,Mn.Rh)(a.DSF),F=(0,Mn.Rh)(a._E9),D=(0,n.Kr)(()=>{const e=(0,s.mS)().chats.byId,t=(0,s.mS)().users.byId,i=(0,pi.Am)([...Y||[],...F||[]]).filter(i=>{const n=e[i],s=t[i],o=s&&(0,l.PL)(s),r=n&&(0,l.WX)(n);return(!h||s)&&i!==c&&i!==a.zv8&&!r&&!o}),n=(0,Dt.PU)({ids:i,query:b});return b?n:(0,pi.Am)([...f,...i])},[Y,F,f,b,c,h]),M=(0,n.hb)(e=>{P(e),k(!0)},[]),T=(0,n.hb)(e=>{w(e),k(!0)},[]),L=(0,n.hb)(()=>{m({privacyKey:Lu(o),isAllowList:Boolean(e),updatedIds:N,isPremiumAllowed:I.includes(Jd.lw.type)||void 0,botsPrivacy:i?I.includes(v.type)?"allow":"disallow":"none"}),u()},[e,i,I,N,u,o,v]);return(0,ke.A)({isActive:r,onBack:u}),(0,ne.FD)("div",{className:"Picker settings-picker-islands",children:[(0,ne.Y)(vi.A,{categories:t?Ou:i&&e?A:void 0,itemIds:D||[],selectedIds:N,selectedCategories:I,filterValue:b,filterPlaceholder:p(e?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),categoryPlaceholderKey:"PrivacyUserTypes",searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:T,onSelectedCategoriesChange:M,onFilterChange:y,allowMultiple:!0,itemInputType:"checkbox",withDefaultPadding:!0,withStatus:!0,withIslands:!0}),(0,ne.Y)(fi.A,{isShown:S,onClick:L,ariaLabel:p(e?"AlwaysAllow":"NeverAllow"),iconName:"check"})]})})),ju=(0,n.ph)((0,s.EK)(e=>{const{config:t,reactions:i}=e;return{availableReactions:i.availableReactions,selectedReaction:t?.defaultReaction}})(({isActive:e,availableReactions:t,selectedReaction:i,onReset:o})=>{const{setDefaultReaction:a}=(0,s.ko)();(0,ke.A)({isActive:e,onBack:o});const r=(0,n.Kr)(()=>(t||[]).filter(e=>!e.isInactive).map(e=>({label:(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(fn.A,{reaction:e.reaction,availableReactions:t}),e.title]}),value:e.reaction.emoticon})),[t]),l=(0,n.hb)(e=>{a({reaction:{type:"emoji",emoticon:e}})},[a]);return(0,ne.Y)(zd.A,{scrollable:!0,className:"settings-content settings-quick-reaction",children:(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{name:"quick-reaction-settings",options:r,selected:"emoji"===i?.type?i.emoticon:void 0,onChange:l,withIcon:!0})})})})),Gu=1.5*v.$,Hu=(0,n.ph)((0,s.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:a,defaultReaction:r,shouldSuggestStickers:l,shouldUpdateStickerSetOrder:c,availableReactions:d,canPlayAnimatedEmojis:h,onReset:u})=>{const{setSettingOption:m,openStickerSet:p,openSettingsScreen:g}=(0,s.ko)(),v=(0,B.A)(),A=(0,n.li)(),{observe:f}=(0,yr.BL)({rootRef:A}),C=(0,n.hb)(e=>{p({stickerSetInfo:e.stickerSetInfo})},[p]),b=(0,n.hb)(e=>{m({shouldUpdateStickerSetOrder:e})},[m]),y=(0,n.hb)(e=>{m({shouldSuggestStickers:e})},[m]),S=(0,n.Kr)(()=>t&&Object.values((0,pi.Up)(a,t)),[t,a]);return(0,ke.A)({isActive:e,onBack:u}),(0,ne.FD)("div",{className:"settings-content custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(es.A,{label:v("SuggestStickers"),checked:l,onCheck:y}),(0,ne.FD)(ui.A,{narrow:!0,onClick:()=>g({screen:o.VS.CustomEmoji}),icon:"smile",children:[v("StickersList.EmojiItem"),i&&(0,ne.Y)("span",{className:"settings-item__current-value",children:i.length})]}),r&&(0,ne.FD)(ui.A,{className:"SettingsDefaultReaction",narrow:!0,onClick:()=>g({screen:o.VS.QuickReaction}),children:[(0,ne.Y)(fn.A,{reaction:r,className:"current-default-reaction",size:Gu,availableReactions:d}),(0,ne.Y)("div",{className:"title",children:v("DoubleTapSetting")})]})]}),(0,ne.Y)(Hd.Qg,{dir:v.isRtl?"rtl":void 0,children:v("InstalledStickers.DynamicPackOrder")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:v("InstalledStickers.DynamicPackOrder"),checked:c,onCheck:b})}),(0,ne.Y)(Hd.IW,{dir:"auto",children:v("InstalledStickers.DynamicPackOrderInfo")}),S&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:v.isRtl?"rtl":void 0,children:v("ChooseStickerMyStickerSets")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{ref:A,children:S.map(e=>(0,ne.Y)(Lh,{stickerSet:e,observeIntersection:f,onClick:C,noPlay:!h},e.id))})}),(0,ne.Y)(Hd.IW,{dir:"auto",children:(0,Mt.A)(v("StickersBotInfo"),["links"])})]})]})})),zu=(0,n.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,s.ko)(),n=(0,B.A)(),r=(0,T.A)(()=>{i({screen:o.VS.Privacy})});return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(nh.A,{size:a.r2x,tgsUrl:Uo.w.Congratulations,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:n("TwoStepVerificationPasswordSetInfo")})]}),(0,ne.Y)(X.A,{onClick:r,children:n("TwoStepVerificationPasswordReturnSettings")})]})});var $u=i(79577);const qu=(0,n.ph)((0,s.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:s,clearError:o,onSubmit:a,isActive:r,onReset:l,recoveryEmail:c})=>{const d=(0,n.li)(),[h,m]=(0,n.J0)("");(0,n.vJ)(()=>{!u.TF&&r&&d.current.focus()},[r]);const p=(0,B.A)();(0,ke.A)({isActive:r,onBack:l});const g=(0,n.hb)(e=>{s&&o&&o();const i=e.target.value.slice(0,t);i.length===t&&a(i),m(i),e.target.value=i},[o,t,s,a]);return(0,ne.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)($u.A,{sticker:e,size:160,className:"settings-content-icon"}),c&&(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:p("TwoStepAuth.ConfirmEmailDescription",c)})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ee.A,{value:h,ref:d,inputMode:"decimal",label:p("YourEmailCode"),error:s,onChange:g}),i&&(0,ne.Y)(Jn.A,{})]})]})})),Wu=(0,n.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,s.ko)(),n=(0,B.A)();return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Lock,previewUrl:dh,size:160,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:(0,Mt.A)(n("EnabledPasswordText"),["br"])})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"edit",onClick:()=>i({screen:o.VS.TwoFaChangePasswordCurrent}),children:n("ChangePassword")}),(0,ne.Y)(ui.A,{icon:"password-off",onClick:()=>i({screen:o.VS.TwoFaTurnOff}),children:n("TurnPasswordOff")}),(0,ne.Y)(ui.A,{icon:"email",onClick:()=>i({screen:o.VS.TwoFaRecoveryEmailCurrentPassword}),children:n("SetRecoveryEmail")})]})]})}),Qu=(0,n.ph)((0,s.EK)((e,{icon:t})=>({animatedEmoji:(0,c.oei)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:i,error:s,placeholder:o,shouldConfirm:a,clearError:r,onSubmit:l,isActive:c,onReset:d})=>{const h=(0,n.li)(),[m,p]=(0,n.J0)(""),[g,v,A]=(0,D.A)(!1);(0,n.vJ)(()=>{!u.TF&&c&&h.current.focus()},[c]);const f=(0,n.hb)(e=>{s&&r&&r(),p(e.target.value)},[r,s]),C=(0,n.hb)(()=>{l()},[l]),b=(0,n.hb)(()=>{A(),l()},[l,A]),y=(0,B.A)();return(0,ke.A)({isActive:c,onBack:d}),(0,ne.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)($u.A,{sticker:e,size:160,className:"settings-content-icon"}),"email"===t&&(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:y("RecoveryEmailSubtitle")})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)("form",{className:"settings-input",action:"",onSubmit:e=>{e.preventDefault(),h.current&&l(m)},children:[(0,ne.Y)(ee.A,{ref:h,value:m,inputMode:t,label:o,error:s,onChange:f}),m?(0,ne.Y)(X.A,{type:"submit",isLoading:i,ripple:!0,children:y("Continue")}):(0,ne.Y)(X.A,{isText:!0,isLoading:i,ripple:!0,onClick:a?v:C,children:y("YourEmailSkip")})]}),a&&(0,ne.FD)(te.A,{className:"narrow",isOpen:g,title:y("YourEmailSkipWarning"),onClose:A,children:[(0,Mt.A)(y("YourEmailSkipWarningText"),["br","simple_markdown"]),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:b,children:y("YourEmailSkip")}),(0,ne.Y)(X.A,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:A,children:y("Cancel")})]})]})]})]})})),Zu=(0,n.ph)(({isActive:e,onReset:t,onStart:i})=>{const n=(0,B.A)();return(0,ke.A)({isActive:e,onBack:t}),(0,ne.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ne.FD)("div",{className:"settings-content-header no-border",children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Lock,previewUrl:dh,size:160,className:"settings-content-icon"}),(0,ne.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:n("SetAdditionalPasswordInfo")})]}),(0,ne.Y)(X.A,{onClick:i,children:n("EditAdminTransferSetPassword")})]})}),Xu=(0,n.ph)((0,s.EK)(e=>({...e.twoFaSettings}))(({currentScreen:e,shownScreen:t,state:i,hint:a,isLoading:r,errorKey:l,waitingEmailCodeLength:c,dispatch:d,isActive:h,onReset:u})=>{const{updatePassword:m,checkPassword:p,clearTwoFaError:g,updateRecoveryEmail:v,provideTwoFaEmailCode:A,clearPassword:f,openSettingsScreen:C}=(0,s.ko)(),b=(0,Bi.A)(),y=(0,B.A)();(0,n.vJ)(()=>{c&&(e===o.VS.TwoFaNewPasswordEmail?C({screen:o.VS.TwoFaNewPasswordEmailCode}):e===o.VS.TwoFaRecoveryEmail&&C({screen:o.VS.TwoFaRecoveryEmailCode}))},[e,c,C]);const S=(0,n.hb)(()=>{d({type:"reset"}),C({screen:o.VS.TwoFaNewPassword})},[d,C]),k=(0,n.hb)(e=>{d({type:"setPassword",payload:e}),C({screen:o.VS.TwoFaNewPasswordConfirm})},[d,C]),N=(0,n.hb)(()=>{C({screen:o.VS.TwoFaNewPasswordHint})},[C]),w=(0,n.hb)(e=>{d({type:"setHint",payload:e}),C({screen:o.VS.TwoFaNewPasswordEmail})},[d,C]),I=(0,n.hb)(e=>{d({type:"setEmail",payload:e}),m({...i,email:e,onSuccess:()=>{C({screen:o.VS.TwoFaCongratulations})}})},[d,i,m,C]),P=(0,n.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{C({screen:o.VS.TwoFaChangePasswordNew})}})},[p,d,C]),Y=(0,n.hb)(e=>{d({type:"setPassword",payload:e}),C({screen:o.VS.TwoFaChangePasswordConfirm})},[d,C]),F=(0,n.hb)(()=>{C({screen:o.VS.TwoFaChangePasswordHint})},[C]),D=(0,n.hb)(e=>{d({type:"setHint",payload:e}),m({...i,hint:e,onSuccess:()=>{C({screen:o.VS.TwoFaCongratulations})}})},[d,i,m,C]),M=(0,n.hb)(e=>{f({currentPassword:e,onSuccess:()=>{C({screen:o.VS.Privacy})}})},[f,C]),T=(0,n.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{C({screen:o.VS.TwoFaRecoveryEmail})}})},[p,d,C]),L=(0,n.hb)(e=>{d({type:"setEmail",payload:e}),v({...i,email:e,onSuccess:()=>{C({screen:o.VS.TwoFaCongratulations})}})},[d,i,v,C]),x=(0,n.hb)(e=>{A({code:e})},[A]);switch(e){case o.VS.TwoFaDisabled:return(0,ne.Y)(Zu,{onStart:S,isActive:h||[o.VS.TwoFaNewPassword,o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaNewPassword:return(0,ne.Y)(lh,{placeholder:y("PleaseEnterPassword"),submitLabel:y("Continue"),onSubmit:k,isActive:h||[o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaNewPasswordConfirm:return(0,ne.Y)(lh,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),submitLabel:y("Continue"),onSubmit:N,isActive:h||[o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaNewPasswordHint:return(0,ne.Y)(Qu,{icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:w,isActive:h||[o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaNewPasswordEmail:return(0,ne.Y)(Qu,{icon:"email",type:"email",isLoading:r,error:l&&b.withRegular(l),clearError:g,placeholder:y("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,isActive:h||[o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaNewPasswordEmailCode:return(0,ne.Y)(qu,{isLoading:r,error:l&&b.withRegular(l),clearError:g,onSubmit:x,isActive:h||t===o.VS.TwoFaCongratulations,onReset:u});case o.VS.TwoFaCongratulations:return(0,ne.Y)(zu,{isActive:h,onReset:u});case o.VS.TwoFaEnabled:return(0,ne.Y)(Wu,{isActive:h||[o.VS.TwoFaChangePasswordCurrent,o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaTurnOff,o.VS.TwoFaRecoveryEmailCurrentPassword,o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaChangePasswordCurrent:return(0,ne.Y)(lh,{isLoading:r,error:l&&b.withRegular(l),onClearError:g,hint:a,onSubmit:P,isActive:h||[o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaChangePasswordNew:return(0,ne.Y)(lh,{placeholder:y("PleaseEnterNewFirstPassword"),onSubmit:Y,isActive:h||[o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaChangePasswordConfirm:return(0,ne.Y)(lh,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),onSubmit:F,isActive:h||[o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaChangePasswordHint:return(0,ne.Y)(Qu,{isLoading:r,error:l&&b.withRegular(l),clearError:g,icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:D,isActive:h||t===o.VS.TwoFaCongratulations,onReset:u});case o.VS.TwoFaTurnOff:return(0,ne.Y)(lh,{isLoading:r,error:l&&b.withRegular(l),onClearError:g,hint:a,onSubmit:M,isActive:h,onReset:u});case o.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ne.Y)(lh,{isLoading:r,error:l&&b.withRegular(l),onClearError:g,hint:a,onSubmit:T,isActive:h||[o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaRecoveryEmail:return(0,ne.Y)(Qu,{icon:"email",type:"email",placeholder:y("RecoveryEmailTitle"),onSubmit:L,isActive:h||[o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:u});case o.VS.TwoFaRecoveryEmailCode:return(0,ne.Y)(qu,{isLoading:r,error:l&&b.withRegular(l),clearError:g,onSubmit:x,isActive:h||t===o.VS.TwoFaCongratulations,onReset:u});default:return}})),em=Object.keys(o.VS).length/2,tm=[o.VS.TwoFaDisabled,o.VS.TwoFaNewPassword,o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations,o.VS.TwoFaEnabled,o.VS.TwoFaChangePasswordCurrent,o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaTurnOff,o.VS.TwoFaRecoveryEmailCurrentPassword,o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode],im=[o.VS.PasscodeDisabled,o.VS.PasscodeEnabled],nm=[o.VS.Folders,o.VS.FoldersCreateFolder,o.VS.FoldersEditFolder,o.VS.FoldersEditFolderFromChatList,o.VS.FoldersEditFolderInvites,o.VS.FoldersIncludedChats,o.VS.FoldersIncludedChatsFromChatList,o.VS.FoldersExcludedChats,o.VS.FoldersExcludedChatsFromChatList,o.VS.FoldersShare],sm=[o.VS.PrivacyBlockedUsers,o.VS.ActiveWebsites,o.VS.Passkeys],om=[o.VS.PrivacyPhoneNumberAllowedContacts,o.VS.PrivacyPhoneNumberDeniedContacts],am=[o.VS.PrivacyLastSeenAllowedContacts,o.VS.PrivacyLastSeenDeniedContacts],rm=[o.VS.PrivacyProfilePhotoAllowedContacts,o.VS.PrivacyProfilePhotoDeniedContacts],lm=[o.VS.PrivacyBioAllowedContacts,o.VS.PrivacyBioDeniedContacts],cm=[o.VS.PrivacyBirthdayAllowedContacts,o.VS.PrivacyBirthdayDeniedContacts],dm=[o.VS.PrivacyGiftsAllowedContacts,o.VS.PrivacyGiftsDeniedContacts],hm=[o.VS.PrivacyPhoneCallAllowedContacts,o.VS.PrivacyPhoneCallDeniedContacts],um=[o.VS.PrivacyPhoneP2PAllowedContacts,o.VS.PrivacyPhoneP2PDeniedContacts],mm=[o.VS.PrivacyForwardingAllowedContacts,o.VS.PrivacyForwardingDeniedContacts],pm=[o.VS.PrivacyVoiceMessagesAllowedContacts,o.VS.PrivacyVoiceMessagesDeniedContacts],gm=[o.VS.PrivacyGroupChatsAllowedContacts,o.VS.PrivacyGroupChatsDeniedContacts],vm=[o.VS.PrivacyNoPaidMessages],Am=(0,n.ph)(({isActive:e,currentScreen:t,foldersState:i,foldersDispatch:a,onReset:r,animationLevel:l,shouldSkipTransition:d,hasProfileBackground:h})=>{const{closeShareChatFolderModal:u,openSettingsScreen:m}=(0,s.ko)(),p=(0,n.li)(),[g,v]=(0,_d.A)(Od,Ud),[A,f]=(0,n.J0)("");(0,Fc.A)({containerRef:p,selector:".Transition_slide-active .settings-content, .Transition_slide-active .settings-main-scroll"},[t]);const C=(0,T.A)(e=>{const n=(0,c.nTw)((0,s.mS)()).shareFolderScreen?.isFromSettings;t===o.VS.FoldersShare&&u(),!0===e||void 0!==n&&!n?r(!0):(t!==o.VS.FoldersCreateFolder&&t!==o.VS.FoldersEditFolder&&t!==o.VS.FoldersEditFolderFromChatList&&t!==o.VS.FoldersEditFolderInvites||setTimeout(()=>{a({type:"reset"})},200),t!==o.VS.FoldersIncludedChats&&t!==o.VS.FoldersExcludedChats?r():"create"===i.mode?m({screen:o.VS.FoldersCreateFolder}):m({screen:o.VS.FoldersEditFolder}))});function b(n,s){const r={[o.VS.PrivacyPhoneNumber]:om.includes(s),[o.VS.PrivacyLastSeen]:am.includes(s),[o.VS.PrivacyProfilePhoto]:rm.includes(s),[o.VS.PrivacyBio]:lm.includes(s),[o.VS.PrivacyBirthday]:cm.includes(s),[o.VS.PrivacyGifts]:dm.includes(s),[o.VS.PrivacyPhoneCall]:hm.includes(s),[o.VS.PrivacyPhoneP2P]:um.includes(s),[o.VS.PrivacyForwarding]:mm.includes(s),[o.VS.PrivacyVoiceMessages]:pm.includes(s),[o.VS.PrivacyGroupChats]:gm.includes(s),[o.VS.PrivacyMessages]:vm.includes(s)},l=tm.includes(s),c=im.includes(s),d=nm.includes(s),h=sm.includes(s)||l||c||Object.keys(r).map(Number).includes(s)||Object.values(r).includes(!0);switch(t){case o.VS.Main:return(0,ne.Y)(Au,{isActive:e,onReset:C});case o.VS.EditProfile:return(0,ne.Y)($h,{isActive:e&&n,onReset:C});case o.VS.General:return(0,ne.Y)(tu,{isActive:n||s===o.VS.GeneralChatBackgroundColor||s===o.VS.GeneralChatBackground||s===o.VS.QuickReaction||s===o.VS.CustomEmoji||h||d,onReset:C});case o.VS.QuickReaction:return(0,ne.Y)(ju,{isActive:n,onReset:C});case o.VS.CustomEmoji:return(0,ne.Y)(xh,{isActive:n,onReset:C});case o.VS.Notifications:return(0,ne.Y)(bu,{isActive:n,onReset:C});case o.VS.DataStorage:return(0,ne.Y)(Eh,{isActive:n,onReset:C});case o.VS.Privacy:return(0,ne.Y)(Mu,{isActive:n||h,onReset:C});case o.VS.Language:return(0,ne.Y)(mu,{isActive:n||s===o.VS.DoNotTranslate,onReset:C});case o.VS.DoNotTranslate:return(0,ne.Y)(_h,{isActive:n,onReset:C});case o.VS.Stickers:return(0,ne.Y)(Hu,{isActive:n,onReset:C});case o.VS.Experimental:return(0,ne.Y)(Xh,{isActive:n,onReset:C});case o.VS.GeneralChatBackground:return(0,ne.Y)(ou,{isActive:n||s===o.VS.GeneralChatBackgroundColor,onReset:C});case o.VS.GeneralChatBackgroundColor:return(0,ne.Y)(du,{isActive:n,onReset:C});case o.VS.ActiveSessions:return(0,ne.Y)(Fh,{isActive:n,onReset:C});case o.VS.ActiveWebsites:return(0,ne.Y)(Bh,{isActive:n,onReset:C});case o.VS.PrivacyBlockedUsers:return(0,ne.Y)(Bu,{isActive:n,onReset:C});case o.VS.PrivacyPhoneNumber:case o.VS.PrivacyLastSeen:case o.VS.PrivacyProfilePhoto:case o.VS.PrivacyBio:case o.VS.PrivacyBirthday:case o.VS.PrivacyGifts:case o.VS.PrivacyPhoneCall:case o.VS.PrivacyForwarding:case o.VS.PrivacyVoiceMessages:case o.VS.PrivacyGroupChats:return(0,ne.Y)(Uu,{screen:t,isActive:n||r[t],onReset:C});case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:case o.VS.PrivacyNoPaidMessages:return(0,ne.Y)(Ju,{isAllowList:!0,usersOnly:t===o.VS.PrivacyNoPaidMessages,withPremiumCategory:t===o.VS.PrivacyGroupChatsAllowedContacts,withMiniAppsCategory:t===o.VS.PrivacyGiftsAllowedContacts,screen:t,isActive:n||r[t],onReset:C});case o.VS.PrivacyPhoneNumberDeniedContacts:case o.VS.PrivacyLastSeenDeniedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:case o.VS.PrivacyBioDeniedContacts:case o.VS.PrivacyBirthdayDeniedContacts:case o.VS.PrivacyGiftsDeniedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:case o.VS.PrivacyForwardingDeniedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return(0,ne.Y)(Ju,{screen:t,isActive:n,onReset:C});case o.VS.PrivacyMessages:return(0,ne.Y)(Sh,{isActive:n,onReset:C});case o.VS.Folders:case o.VS.FoldersCreateFolder:case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:case o.VS.FoldersShare:return(0,ne.Y)(oh,{currentScreen:t,shownScreen:s,state:i,dispatch:a,isActive:n,onReset:C});case o.VS.TwoFaDisabled:case o.VS.TwoFaNewPassword:case o.VS.TwoFaNewPasswordConfirm:case o.VS.TwoFaNewPasswordHint:case o.VS.TwoFaNewPasswordEmail:case o.VS.TwoFaNewPasswordEmailCode:case o.VS.TwoFaCongratulations:case o.VS.TwoFaEnabled:case o.VS.TwoFaChangePasswordCurrent:case o.VS.TwoFaChangePasswordNew:case o.VS.TwoFaChangePasswordConfirm:case o.VS.TwoFaChangePasswordHint:case o.VS.TwoFaTurnOff:case o.VS.TwoFaRecoveryEmailCurrentPassword:case o.VS.TwoFaRecoveryEmail:case o.VS.TwoFaRecoveryEmailCode:return(0,ne.Y)(Xu,{currentScreen:t,state:g,dispatch:v,shownScreen:s,isActive:n,onReset:C});case o.VS.PasscodeDisabled:case o.VS.PasscodeNewPasscode:case o.VS.PasscodeNewPasscodeConfirm:case o.VS.PasscodeChangePasscodeCurrent:case o.VS.PasscodeChangePasscodeNew:case o.VS.PasscodeChangePasscodeConfirm:case o.VS.PasscodeCongratulations:case o.VS.PasscodeEnabled:case o.VS.PasscodeTurnOff:return(0,ne.Y)(mh,{currentScreen:t,passcode:A,onSetPasscode:f,shownScreen:s,isActive:n,onReset:C});case o.VS.Performance:return(0,ne.Y)(Du,{isActive:n,onReset:C});case o.VS.Passkeys:return(0,ne.Y)(Nu,{isActive:n,onReset:C});default:return}}return(0,ne.Y)(ae.Ay,{ref:p,id:"Settings",name:(0,Vn.P)("layers",l,d),activeKey:t,renderCount:em,shouldWrap:!0,withSwipeControl:!0,children:function(e,n,s,o){return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(hu,{currentScreen:t,onReset:C,editedFolderId:i.folderId,hasProfileBackground:h}),b(e,o)]})}})}),fm=(0,n.ph)((0,s.EK)(e=>{const{userIds:t}=e.contactList||{},{byId:i,statusesById:n}=e.users;return{usersById:i,userStatusesById:n,contactIds:t}})(({isActive:e,filter:t,usersById:i,userStatusesById:a,contactIds:r,onReset:c})=>{const{openChat:d,openNewContactDialog:h}=(0,s.ko)(),u=(0,B.A)(),{isMobile:m}=(0,Y.Ay)();(0,ke.A)({isActive:e,onBack:c});const p=(0,n.hb)(e=>{d({id:e,shouldReplaceHistory:!0})},[d]),g=(0,n.Kr)(()=>{if(!r)return;const e=(0,Dt.PU)({ids:r,query:t,type:"user"});return(0,l.UB)(e,i,a)},[r,t,i,a]),[v,A]=(0,Un.A)(void 0,g,Boolean(t));return(0,ne.FD)(mn.A,{items:v,onLoadMore:A,className:"chat-list custom-scroll",children:[v?.length?v.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable contact-list-item",onClick:()=>p(e),children:(0,ne.Y)(An.A,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:o.G9.ChatList,ripple:!m})},e)):v&&!v.length?(0,ne.Y)("p",{className:"no-results",dir:"auto",children:t.length?"No contacts matched your search.":"Contact list is empty."},"no-results"):(0,ne.Y)(Jn.A,{},"loading"),(0,ne.Y)(fi.A,{isShown:!0,onClick:h,ariaLabel:u("CreateNewContact"),iconName:"add-user-filled"},"create-new-contact")]})})),Cm=(0,n.ph)((0,s.EK)(e=>{const{userIds:t}=e.contactList||{},{query:i,fetchingStatus:n,globalResults:s,localResults:o}=(0,c.nTw)(e).globalSearch,{peerIds:a}=s||{},{peerIds:r}=o||{};return{localContactIds:t,searchQuery:i,isSearching:n?.chats,globalPeerIds:a,localPeerIds:r}})(({isChannel:e,isActive:t,selectedMemberIds:i,localContactIds:o,searchQuery:a,isSearching:r,localPeerIds:c,globalPeerIds:d,onSelectedMemberIdsChange:h,onNextStep:u,onReset:m})=>{const{setGlobalSearchQuery:p}=(0,s.ko)(),g=(0,B.A)();(0,ke.A)({isActive:t,onBack:m});const v=(0,n.hb)(e=>{p({query:e})},[]),A=(0,n.Kr)(()=>{const e=(0,s.mS)().users.byId,t=o?(0,Dt.PU)({ids:o,query:a,type:"user"}):[];return(0,Dn.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)},[o,a,c,d,i]),f=(0,n.hb)(()=>{p({query:""}),u()},[u]);return(0,ne.FD)("div",{className:"NewChat step-1",children:[(0,ne.FD)("div",{className:"left-header",children:[(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:m,ariaLabel:"Return to Chat List",iconName:"arrow-left"}),(0,ne.Y)("h3",{children:g("GroupAddMembers")})]}),(0,ne.FD)("div",{className:"NewChat-inner step-1",children:[(0,ne.Y)(vi.A,{itemIds:A,selectedIds:i,filterValue:a,filterPlaceholder:g("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:r,isSearchable:!0,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox",withDefaultPadding:!0,onSelectedIdsChange:h,onFilterChange:v}),(0,ne.Y)(fi.A,{isShown:!0,onClick:f,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info",iconName:"arrow-right"})]})]})})),bm=(0,n.ph)((0,s.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:a,creationProgress:r,creationError:c,onReset:d})=>{const{createGroupChat:h,createChannel:u}=(0,s.ko)(),m=(0,B.A)();(0,ke.A)({isActive:t,onBack:d});const[p,g]=(0,n.J0)(""),[v,A]=(0,n.J0)(""),[f,C]=(0,n.J0)(),[b,y]=(0,n.J0)(),S="Chat title can't be empty",k="Channel title can't be empty",N=r===o.n7.InProgress;(0,n.vJ)(()=>{if(e)return;if(!i.length||i.length>4)return void g("");const t=(0,s.mS)(),n=t.users.byId,o=[t.currentUserId,...i].map(e=>(0,l.u0)(n[e])).filter(Boolean),a=o.slice(0,-1).join(", ")+m("CreateGroup.PeersTitleLastDelimeter")+o[o.length-1];g(a)},[e,i,m]);const w=(0,n.hb)(e=>{const{value:t}=e.currentTarget,i=t.replace(/^\s+/,"");g(i),i!==t&&(e.currentTarget.value=i)},[]),I=(0,n.hb)(e=>{A(e.currentTarget.value)},[]),P=(0,n.hb)(()=>{p.length?a&&i.length>=a?y("Sorry, creating supergroups is not yet supported"):h({title:p,photo:f,memberIds:i}):y(S)},[p,i,a,h,f]),Y=(0,n.hb)(()=>{p.length?u({title:p,about:v,photo:f,memberIds:i,isChannel:!0}):y(k)},[p,u,v,f,i,k]);(0,n.vJ)(()=>{r===o.n7.Complete&&d(!0)},[r,d]);const F=c&&m(c)||(b!==S&&b!==k?b:void 0);return(0,ne.FD)("div",{className:"NewChat",children:[(0,ne.FD)("div",{className:"left-header",children:[(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection",iconName:"arrow-left"}),(0,ne.Y)("h3",{children:m(e?"NewChannel":"NewGroup")})]}),(0,ne.FD)("div",{className:"NewChat-inner step-2",children:[(0,ne.Y)(Gh.A,{onChange:C,title:m("AddPhoto")}),(0,ne.Y)(ee.A,{value:p,onChange:w,label:m(e?"EnterChannelName":"GroupName"),error:b===S||b===k?b:void 0}),e&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(ee.A,{value:v,onChange:I,label:m("DescriptionOptionalPlaceholder")}),(0,ne.Y)("p",{className:"note",children:m("DescriptionInfo")})]}),F&&(0,ne.Y)("p",{className:"error",children:F}),i.length>0&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:"chat-members-heading",children:m("GroupInfo.ParticipantCount",i.length,"i")}),(0,ne.Y)("div",{className:"chat-members-list custom-scroll",children:i.map(e=>(0,ne.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ne.Y)(An.A,{userId:e})}))})]})]}),(0,ne.Y)(fi.A,{isShown:0!==p.length,onClick:e?Y:P,disabled:N,ariaLabel:e?m("ChannelIntro.CreateChannel"):"Create Group",iconName:"arrow-right",isLoading:N})]})})),ym=Object.keys(o.Bn).length/2,Sm=(0,n.ph)(({isActive:e,isChannel:t=!1,content:i,animationLevel:a,onReset:r})=>{const{openLeftColumnContent:l,setGlobalSearchQuery:c}=(0,s.ko)(),[d,h]=(0,n.J0)([]),u=(0,n.hb)(()=>{l({contentKey:t?o.Bn.NewChannelStep2:o.Bn.NewGroupStep2})},[t]),m=(0,T.A)(e=>{const t=e.length>d.length;h(e),t&&c({query:""})});return(0,ne.Y)(ae.Ay,{id:"NewChat",name:(0,Vn.P)("layers",a),renderCount:ym,activeKey:i,children:n=>{switch(i){case o.Bn.NewChannelStep1:case o.Bn.NewGroupStep1:return(0,ne.Y)(Cm,{isChannel:t,isActive:e,selectedMemberIds:d,onSelectedMemberIdsChange:m,onNextStep:u,onReset:r});case o.Bn.NewChannelStep2:case o.Bn.NewGroupStep2:return(0,ne.Y)(bm,{isChannel:t,isActive:n&&e,memberIds:d,onReset:r});default:return}}})});var km=i(34458),Nm=i(11462),wm=i(24920),Im=i(75343),Pm=i(40175),Ym=i(70463),Fm=i(77018);const Dm=(0,n.ph)(({isActive:e,isForumPanelOpen:t,archiveSettings:i,isStoryRibbonShown:n,onReset:o,onTopicSearch:r,foldersDispatch:l})=>{const{updateArchiveSettings:c}=(0,s.ko)(),d=(0,B.A)();(0,ke.A)({isActive:e,onBack:o});const h=(0,T.A)(()=>{c({isHidden:!1})}),{shouldDisableDropdownMenuTransitionRef:u,handleDropdownMenuTransitionEnd:m}=(0,wm.A)(t),{shouldRender:p,transitionClassNames:g}=(0,qe.A)(!t,void 0,void 0,!1),{shouldRenderForumPanel:v,handleForumPanelAnimationEnd:A,handleForumPanelAnimationStart:f,isAnimationStarted:C}=(0,Nm.A)(t),b=t&&C,{shouldRender:y,transitionClassNames:S,isClosing:k}=(0,qe.A)(n,void 0,void 0,"",!1,km.UG+a.xB5);return(0,ne.FD)("div",{className:"ArchivedChats",children:[(0,ne.FD)("div",{className:(0,ve.A)("left-header",!y&&"left-header-shadow"),children:[d.isRtl&&(0,ne.Y)("div",{className:"DropdownMenuFiller"}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:o,ariaLabel:"Return to chat list",className:(0,ve.A)(d.isRtl&&"rtl",b&&d.isRtl&&"right-aligned",u.current&&d.isRtl&&"disable-transition"),onTransitionEnd:m,iconName:"arrow-left"}),p&&(0,ne.Y)("h3",{className:g,children:d("ArchivedChats")}),(0,ne.Y)("div",{className:"story-toggler-wrapper",children:(0,ne.Y)(Pm.A,{canShow:!0,isArchived:!0})}),i.isHidden&&(0,ne.Y)(ue.A,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:d.isRtl?m:void 0,children:(0,ne.Y)(me.A,{icon:"archive-from-main",onClick:h,children:d("lng_context_archive_to_list")})})]}),(0,ne.FD)("div",{className:(0,ve.A)("chat-list-wrapper",y&&"with-story-ribbon",S),children:[y&&(0,ne.Y)(Im.A,{isArchived:!0,className:"left-header-shadow",isClosing:k}),(0,ne.Y)(Ym.A,{folderType:"archived",isActive:e,isForumPanelOpen:b,isMainList:!0,foldersDispatch:l,archiveSettings:i,isStoryRibbonShown:n})]}),v&&(0,ne.Y)(Fm.A,{isOpen:t,onTopicSearch:r,onOpenAnimationStart:f,onCloseAnimationEnd:A})]})}),Mm=(0,n.ph)((0,s.EK)(e=>{const{byId:t,orderedIds:i}=e.chatFolders;return{foldersById:t,folderOrderedIds:i}})(({isOpen:e,chatId:t,foldersById:i,folderOrderedIds:o,onClose:r,onCloseAnimationEnd:l})=>{const{editChatFolders:c}=(0,s.ko)(),d=(0,B.A)(),h=(0,n.Kr)(()=>i?Object.keys(i).reduce((e,n)=>{const{includedChatIds:s,pinnedChatIds:o}=i[Number(n)];return(s.includes(t)||o?.includes(t))&&e.push(n),e},[]):[],[t,i]),[u,m]=(0,n.J0)(h),p=(0,n.Kr)(()=>o?.filter(e=>e!==a.DSF).map(e=>{const t=i?i[e]:void 0;return{label:t?(0,Gi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}):"",value:String(e)}})||[],[o,i]),g=(0,n.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&&o)return(0,ne.FD)(te.A,{isOpen:e,onClose:r,onCloseAnimationEnd:l,onEnter:g,className:(0,ve.A)("_fJBBCCE","delete"),contentClassName:"EG5lPWY1",title:d("FilterAddTo"),children:[(0,ne.Y)("div",{className:(0,ve.A)("heYMHiUt","custom-scroll"),children:(0,ne.Y)(rc.A,{options:p,selected:u,onChange:m})}),(0,ne.Y)("div",{className:"_jtqAaUU",children:(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:g,children:d("FilterAddTo")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:r,children:d("Cancel")})]})})]})}));var Tm=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(Tm||{});const Bm=(0,n.ph)(({isOpen:e,chatId:t,topicId:i,onClose:o,onCloseAnimationEnd:r})=>{const[l,c]=(0,n.J0)(Tm.Forever),{updateChatMutedState:d,updateTopicMutedState:h}=(0,s.ko)(),u=(0,B.A)(),m=(0,n.Kr)(()=>[{label:u("MuteFor.Hours",1),value:Tm.OneHour},{label:u("MuteFor.Hours",4),value:Tm.FourHours},{label:u("MuteFor.Hours",8),value:Tm.EightHours},{label:u("MuteFor.Days",1),value:Tm.OneDay},{label:u("MuteFor.Days",3),value:Tm.ThreeDays},{label:u("MuteFor.Forever"),value:Tm.Forever}],[u]),p=(0,n.hb)(()=>{let e;e=l===Tm.Forever?a.xEh:Math.floor(Date.now()/1e3)+Number(l),i?h({chatId:t,topicId:i,mutedUntil:e}):d({chatId:t,mutedUntil:e}),o()},[t,l,o,i]);return(0,ne.FD)(te.A,{isOpen:e,onClose:o,onCloseAnimationEnd:r,onEnter:p,className:"delete",title:u("Notifications"),children:[(0,ne.Y)(ie.A,{className:"dialog-checkbox-group",name:"muteFor",options:m,selected:l,onChange:c}),(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(X.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:p,children:u("Common.Done")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:u("Cancel")})]})]})});var Lm=i(99515),xm=i(11186);const Rm=(0,n.ph)((0,s.EK)((e,{fromSticker:t,stickerSetShortName:i})=>{const n=(0,c.Xf0)(e),{chatId:s,threadId:o}=n||{},a=s&&(0,c.hds)(e,s),r=s?(0,c.AWZ)(e,s):void 0,d=s&&(0,c.yps)(e,s),h=s?(0,c.nZ4)(e,s):void 0,u=a?(0,l.Q_)(a,r,Boolean(d),h):void 0,m=s&&o?(0,En.Vw)(e,s,o):void 0,p=Boolean(!m?.isCommentsInfo&&m?.fromChannelId),g=s&&o?(0,c.S0q)(e,s,o):void 0,v=Boolean(a&&o&&(0,l.__)(a,g,p,r)&&u?.canSendStickers),A=t?t.stickerSetInfo:i?{shortName:i}:void 0,f=A?(0,c.ycM)(e,A):void 0,C=s?(0,c.WA9)(e,s):void 0;return{canScheduleUntilOnline:Boolean(s)&&(0,c.RBq)(e,s),canSendStickers:v,isSavedMessages:h,shouldSchedule:!C&&(0,c.PIP)(e),stickerSet:f,isCurrentUserPremium:(0,c.g29)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:n}})(({isOpen:e,fromSticker:t,stickerSetShortName:i,stickerSet:o,canSendStickers:r,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isCurrentUserPremium:h,shouldUpdateStickerSetOrder:u,currentMessageList:m,onClose:p})=>{const{loadStickers:g,toggleStickerSet:v,sendMessage:A,showNotification:f}=(0,s.ko)(),C=(0,n.li)(),b=(0,n.li)(),y=(0,B.A)(),{isMobile:S}=(0,Y.Ay)(),k=(0,K.A)(o),N=o||k,w=Boolean(!N?.isArchived&&N?.installedDate),I=N?.isEmoji,[P,F]=(0,xm.A)(l),{handleScroll:D,isAtBeginning:M}=(0,un.A)(),{observe:T}=(0,yr.BL)({rootRef:C,throttleMs:200,isDisabled:!e});(0,n.vJ)(()=>{e&&!N?.stickers&&g({stickerSetInfo:t?t.stickerSetInfo:{shortName:i}})},[e,t,g,i,N]);const L=(0,n.hb)((e,t,i)=>{m&&(e={...e,isPreloadedGlobally:!0},c||i?P((i,n)=>{A({messageList:m,sticker:e,isSilent:t,scheduledAt:i,scheduleRepeatPeriod:n}),p()}):(A({messageList:m,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:u&&w}),p()))},[m,c,P,p,u,w]),x=(0,n.hb)(()=>{N&&(v({stickerSetId:N.id}),p())},[p,N,v]),R=(0,n.hb)(()=>{if(!N)return;const{shortName:e}=N,t=I?"addemoji":"addstickers",i=`${a.jsp}${t}/${e}`;(0,Lc.eM)(i),f({message:y("LinkCopied")})},[I,y,N,f]),E=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{round:!0,ripple:!S,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[S]);return(0,ne.FD)(te.A,{className:(0,ve.A)("StickerSetModal",I&&"custom-emoji"),isOpen:e,onClose:p,header:function(){const e=(0,ve.A)("modal-header",!M&&"with-top-border");return(0,ne.FD)("div",{className:e,dir:y.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:y("Close"),onClick:p,iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:N?(0,Mt.A)(N.title,["emoji","links"]):y("AccDescrStickerSet")}),(0,ne.Y)(ue.A,{className:"stickers-more-menu with-menu-transitions",trigger:E,positionX:"right",children:(0,ne.Y)(me.A,{icon:"copy",onClick:R,children:y("StickersCopy")})})]})}(),children:[N?.stickers?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{ref:C,className:"stickers custom-scroll",onScroll:D,children:(0,ne.FD)("div",{className:"shared-canvas-container stickers-grid",children:[(0,ne.Y)("canvas",{ref:b,className:"shared-canvas"}),N.stickers.map(e=>(0,ne.Y)(Br,{sticker:e,size:I?a.$nk:a.GhT,observeIntersection:T,onClick:r&&!I?L:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h,sharedCanvasRef:b}))]})}),(0,ne.Y)("div",{className:"button-wrapper",children:(0,ne.Y)(X.A,{fluid:!0,color:w?"danger":"primary",onClick:x,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,ne.Y)(Jn.A,{}),F]})})),Em={root:"nZYT4vJ3",sets:"JzkmXjFF"},Vm=(0,n.ph)((0,s.EK)(e=>({canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({customEmojiSetIds:e,canPlayAnimatedEmojis:t,onClose:i})=>{const{openStickerSet:o}=(0,s.ko)(),a=(0,B.A)(),r=(0,n.Kr)(()=>e?.map(e=>(0,s.mS)().stickers.setsById[e]),[e]),l=(0,n.li)(),{observe:c}=(0,yr.BL)({rootRef:l,isDisabled:!r}),d=(0,K.A)(r),h=r||d,u=(0,T.A)(e=>{o({stickerSetInfo:e.stickerSetInfo})});return(0,ne.Y)(te.A,{isOpen:Boolean(r),className:Em.root,onClose:i,hasCloseButton:!0,title:a("lng_custom_emoji_used_sets"),children:(0,ne.Y)("div",{className:(0,ve.A)(Em.sets,"custom-scroll"),ref:l,teactFastList:!0,children:h?.map(e=>(0,ne.Y)(Lh,{className:Em.setCard,stickerSet:e,onClick:u,observeIntersection:c,noPlay:!t},e.id))})})}));var _m=i(54314),Um=i(60859);const Om={settings:{icon:"bots",label:"BotSettings"},help:{icon:"help",label:"BotHelp"}},Km=(0,n.ph)((0,s.EK)((e,{chatId:t,threadId:i})=>{const n=(0,c.hds)(e,t),s=(0,c._ls)(e,t);if(!n||s)return{};const o=(0,g.L8)(n.id),a=o?(0,c.mBe)(e,t):void 0,r=a&&(0,l.Gh)(a),d=i===j.l3,h=(0,c.nZ4)(e,t),{chatId:u,threadId:m}=(0,c.Xf0)(e)||{},p=d&&!a&&((0,l.WX)(n)||(0,l.YE)(n))&&!(0,l.SJ)(n),v=(0,l.DX)(t)?void 0:(0,c.yps)(e,t),A=o?(0,c.vGo)(e,t):void 0,f=o?void 0:(0,c.AWZ)(e,t),C=A||f,b=(0,c.X2D)(e,t),y=(0,c.S0q)(e,t,i),S=n.isForum&&!n.isBotForum&&(n.isCreator||!(0,l.Sq)(n,"manageTopics")||(0,l.ub)(n,"manageTopics")),k=y&&(0,l.l1)(n,y),N=(0,c.e5V)(e,t),w=(0,c.jGY)(e,t)&&C?.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:n,isMuted:(0,Hc.If)(n,(0,c.K52)(e),(0,c.P5N)(e,n.id)),isPrivate:o,isTopic:n?.isForum&&!d,isForum:n?.isForum,isBotForum:n?.isBotForum,isForumAsMessages:n?.isForumAsMessages,canAddContact:r,canDeleteChat:(0,l.IC)(n),canReportChat:p,canGift:b,hasLinkedChat:Boolean(f?.linkedChatId),botCommands:v?A?.botInfo?.commands:void 0,botPrivacyPolicyUrl:v?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(v),isChatWithSelf:h,savedDialog:I,disallowedGifts:A?.disallowedGifts,isAccountFrozen:P,noForwardsMyEnabled:A?.noForwardsMyEnabled,noForwardsPeerEnabled:A?.noForwardsPeerEnabled}})(({chatId:e,threadId:t,isOpen:i,withExtraActions:o,anchor:r,isChannel:l,botCommands:c,botPrivacyPolicyUrl:d,withForumActions:h,isTopic:u,isForum:m,isBotForum:p,isForumAsMessages:g,isChatInfoShown:v,canStartBot:A,canSubscribe:f,canReportChat:C,canSearch:b,canCall:y,canMute:S,canViewStatistics:k,canViewMonetization:N,canViewBoosts:w,pendingJoinRequests:I,canLeave:P,canEnterVoiceChat:F,canCreateVoiceChat:M,chat:L,isPrivate:x,isMuted:R,canDeleteChat:E,canGift:V,hasLinkedChat:_,canAddContact:U,canCreateTopic:O,canEditTopic:K,canManage:J,isRightColumnShown:j,canTranslate:G,isBlocked:H,isBot:z,isChatWithSelf:$,savedDialog:q,canShowBoostModal:W,disallowedGifts:Q,isAccountFrozen:Z,noForwardsMyEnabled:X,noForwardsPeerEnabled:ee,channelMonoforumId:te,onJoinRequestsClick:ie,onSubscribeChannel:se,onSearchClick:oe,onAsMessagesClick:ae,onClose:re,onCloseAnimationEnd:le})=>{const{updateChatMutedState:ce,enterMessageSelectMode:de,sendBotCommand:he,restartBot:ue,requestMasterAndJoinGroupCall:pe,createGroupCall:ge,openLinkedChat:ve,openAddContactDialog:Ae,openFrozenAccountModal:fe,requestMasterAndRequestCall:Ce,toggleStatistics:be,openMonetizationStatistics:ye,openBoostStatistics:Se,openGiftModal:ke,openThreadWithInfo:Ne,openCreateTopicPanel:we,openEditTopicPanel:Ie,openChat:Pe,openUrl:Ye,toggleManagement:Fe,togglePeerTranslations:De,blockUser:Me,unblockUser:Te,setViewForumAsMessages:Be,openBoostModal:Le,reportMessages:xe,showNotification:Re,toggleNoForwards:Ee,openDisableSharingAboutModal:Ve}=(0,s.ko)(),_e=(0,B.A)(),Ue=(0,Bi.A)(),{isMobile:Oe}=(0,Y.Ay)(),[Ke,Je]=(0,n.J0)(!0),[je,Ge]=(0,n.J0)(!1),[He,ze]=(0,n.J0)(!1),[$e,We]=(0,n.J0)(!1),[Qe,Ze,Xe]=(0,D.A)(),{x:et,y:tt}=r;(0,qe.A)(i,le,void 0,!1);const nt=(0,ji.A)(!(v||!m)||void 0,200),st=(0,n.Kr)(()=>{if(Q)return Object.values(Q).every(Boolean)},[Q]),ot=(0,T.A)(()=>{We(!1),re()}),at=(0,T.A)(()=>{Z?fe():(Je(!1),xe({chatId:e,messageIds:[]})),re()}),rt=(0,T.A)(()=>{Z?(fe(),re()):ze(!0),Je(!1)}),lt=(0,T.A)(()=>{Je(!1),re()}),ct=(0,T.A)(()=>{Ne({chatId:e,threadId:t}),Ge(!j),lt()}),dt=(0,T.A)(()=>{ze(!1),re()}),ht=(0,T.A)(()=>{Z?fe():he({command:"/start"})}),ut=(0,T.A)(()=>{Z?fe():ue({chatId:e})}),mt=(0,T.A)(()=>{Z?fe():ce({chatId:e,mutedUntil:a.Os5}),lt()}),pt=(0,T.A)(()=>{Z?(fe(),lt()):(Ze(),We(!0)),Je(!1)}),gt=(0,T.A)(()=>{Z?fe():(we({chatId:e}),Ge(!j)),lt()}),vt=(0,T.A)(()=>{Z?fe():(Fe({force:!0}),Ge(!j)),lt()}),At=(0,T.A)(()=>{Z?fe():(Ie({chatId:e,topicId:Number(t)}),Ge(!j)),lt()}),ft=(0,T.A)(()=>{Pe({id:void 0}),Be({chatId:e,isEnabled:!1}),lt()}),Ct=(0,T.A)(()=>{Z?fe():M?ge({chatId:e}):pe({chatId:e}),lt()}),bt=(0,T.A)(()=>{ve({id:e}),lt()}),yt=(0,T.A)(()=>{st&&L?Re({message:Ue("SendDisallowError")}):(ke({forUserId:e}),Z?fe():ke({forUserId:e}),lt())}),St=(0,T.A)(()=>{Z?fe():Ae({userId:e}),lt()}),kt=(0,T.A)(()=>{Z?fe():se(),lt()}),Nt=(0,T.A)(()=>{Z?fe():Ce({userId:e,isVideo:!0}),lt()}),wt=(0,T.A)(()=>{Z?fe():Ce({userId:e}),lt()}),It=(0,T.A)(()=>{oe(),lt()}),Pt=(0,T.A)(()=>{be(),Ge(!j),lt()}),Yt=(0,T.A)(()=>{ye({chatId:e}),Ge(!j),lt()}),Ft=(0,T.A)(()=>{Z?fe():w?(Se({chatId:e}),Ge(!j)):Le({chatId:e}),lt()}),Dt=(0,T.A)(()=>{De({chatId:e,isEnabled:!0}),lt()}),Mt=(0,T.A)(()=>{Z?fe():de(),lt()}),Tt=(0,T.A)(()=>{ae(),lt()}),Bt=(0,T.A)(()=>{Z?fe():Me({userId:e}),lt()}),Lt=(0,T.A)(()=>{Z?fe():Te({userId:e}),lt()}),xt=(0,T.A)(()=>{lt(),Z?fe():X||ee?Ee({userId:e,isEnabled:!1}):Ve({userId:e})}),Rt=(0,T.A)(()=>{Pe({id:te}),lt()});(0,n.vJ)(wi.M6,[]);const Et=(0,n.Kr)(()=>{const e=c?.map(({command:e})=>{const t=Om[e];if(t)return(0,ne.Y)(me.A,{icon:t.icon,onClick:()=>{he({command:`/${e}`}),lt()},children:_e(t.label)},e)}),t=c?.some(({command:e})=>"privacy"===e);return[...e||[],z&&(0,ne.Y)(me.A,{icon:"privacy-policy",onClick:()=>{t&&!d?he({command:"/privacy"}):Ye({url:d||_e("BotDefaultPrivacyPolicy")}),lt()},children:_e("BotPrivacyPolicy")})].filter(Boolean)},[c,_e,d,z]),Vt=(0,n.Kr)(()=>{if(L)return _e(q?"Delete":x?"DeleteChatUser":E?"GroupInfo.DeleteAndExit":l?"LeaveChannel":"Group.LeaveGroup")},[E,L,l,x,q,_e]);return(0,ne.Y)(Wr.A,{children:(0,ne.FD)("div",{className:"HeaderMenuContainer",children:[(0,ne.FD)(it.A,{isOpen:Ke,positionX:"right",style:`left: ${et}px;top: ${tt}px;`,onClose:lt,shouldCloseFast:je,children:[Oe&&b&&(0,ne.Y)(me.A,{icon:"search",onClick:It,children:_e("Search")}),h&&O&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(me.A,{icon:"comments",onClick:gt,children:_e("lng_forum_create_topic")}),(0,ne.Y)(Um.A,{})]}),te&&(0,ne.Y)(me.A,{icon:"message",onClick:Rt,children:Ue("ChannelSendMessage")}),nt&&(0,ne.Y)(me.A,{icon:"info",onClick:ct,children:_e(u?"lng_context_view_topic":"lng_context_view_group")}),J&&!K&&(0,ne.Y)(me.A,{icon:"edit",onClick:vt,children:_e("Edit")}),K&&(0,ne.Y)(me.A,{icon:"edit",onClick:At,children:_e("lng_forum_topic_edit")}),Oe&&!h&&m&&!p&&!u&&(0,ne.Y)(me.A,{icon:"forums",onClick:ft,children:_e("Chat.ContextViewAsTopics")}),h&&Boolean(I)&&(0,ne.FD)(me.A,{icon:"user",onClick:ie,children:[_e(l?"SubscribeRequests":"MemberRequests"),(0,ne.Y)("div",{className:"right-badge",children:I})]}),h&&!u&&!p&&!g&&(0,ne.Y)(me.A,{icon:"message",onClick:Tt,children:_e("lng_forum_view_as_messages")}),o&&A&&(0,ne.Y)(me.A,{icon:"bots",onClick:ht,children:_e("BotStart")}),o&&f&&(0,ne.Y)(me.A,{icon:l?"channel":"group",onClick:kt,children:_e(l?"ProfileJoinChannel":"ProfileJoinGroup")}),W&&!w&&(0,ne.Y)(me.A,{icon:"boost-outline",onClick:Ft,children:_e(l?"BoostingBoostChannelMenu":"BoostingBoostGroupMenu")}),U&&(0,ne.Y)(me.A,{icon:"add-user",onClick:St,children:_e("AddContact")}),Oe&&y&&(0,ne.Y)(me.A,{icon:"phone",onClick:wt,children:_e("Call")}),y&&(0,ne.Y)(me.A,{icon:"video-outlined",onClick:Nt,children:_e("VideoCall")}),S&&(R?(0,ne.Y)(me.A,{icon:"unmute",onClick:mt,children:_e("ChatsUnmute")}):(0,ne.FD)(me.A,{icon:"mute",onClick:pt,children:[_e("ChatsMute"),"..."]})),(F||M)&&(0,ne.Y)(me.A,{icon:"voice-chat",onClick:Ct,children:_e(M?"StartVoipChat":"VoipGroupJoinCall")}),_&&(0,ne.Y)(me.A,{icon:l?"comments":"channel",onClick:bt,children:_e(l?"ViewDiscussion":"lng_profile_view_channel")}),!h&&(0,ne.Y)(me.A,{icon:"select",onClick:Mt,children:_e("ReportSelectMessages")}),w&&(0,ne.Y)(me.A,{icon:"boost-outline",onClick:Ft,children:_e("Boosts")}),k&&(0,ne.Y)(me.A,{icon:"stats",onClick:Pt,children:_e("Statistics")}),l&&N&&(0,ne.Y)(me.A,{icon:"cash-circle",onClick:Yt,children:_e("lng_channel_earn_title")}),G&&(0,ne.Y)(me.A,{icon:"language",onClick:Dt,children:_e("lng_context_translate")}),C&&(0,ne.Y)(me.A,{icon:"flag",onClick:at,children:_e("ReportPeer.Report")}),Et,V&&(0,ne.Y)(me.A,{icon:"gift",onClick:yt,children:_e("ProfileSendAGift")}),z&&(0,ne.Y)(me.A,{icon:H?"bots":"hand-stop",onClick:H?ut:Bt,children:_e(H?"BotRestart":"Bot.Stop")}),x&&!$&&!z&&(0,ne.Y)(me.A,{icon:X||ee?"allow-share":"no-share",onClick:xt,children:Ue(X||ee?"EnableSharing":"DisableSharing")}),x&&!$&&!z&&(0,ne.Y)(me.A,{icon:H?"user":"hand-stop",onClick:H?Lt:Bt,children:_e(H?"Unblock":"BlockUser")}),P&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Um.A,{}),(0,ne.Y)(me.A,{destructive:!0,icon:"delete",onClick:rt,children:Vt})]})]}),L&&(0,ne.Y)(_m.A,{isOpen:He,onClose:dt,chat:q||L,isSavedDialog:Boolean(q)}),S&&Qe&&L?.id&&(0,ne.Y)(Qc.A,{isOpen:$e,onClose:ot,onCloseAnimationEnd:Xe,chatId:L.id})]})})}));var Jm=i(87306),jm=i(92915),Gm=i(81642),Hm=i(18653);const zm={root:"vv5ppXel",active:"FVgqrSSK",info:"DboxqiZd",topRow:"Ymu2m1PR",meta:"A2rsvUBm",subtitle:"qUzmwaIn"},$m=(0,n.ph)(({isActive:e,message:t,peer:i,messageChat:n,shouldShowChat:s,query:o,className:a,onClick:r})=>{const c=(0,Bi.A)(),d=(0,T.A)(()=>{r(t)});if(i&&!t){const t=(0,l.Kl)(i),n=()=>{r(i.id)};return(0,ne.FD)("div",{role:"button",tabIndex:0,className:(0,ve.A)(zm.root,e&&zm.active,a),onClick:n,children:[(0,ne.Y)(Tt.A,{className:zm.avatar,peer:i,size:"medium"}),(0,ne.FD)("div",{className:zm.info,children:[(0,ne.Y)("div",{className:zm.topRow,children:(0,ne.Y)(jn.A,{peer:i,withEmojiStatus:!0})}),((0,Dt.vj)(i)||t)&&(0,ne.Y)("div",{className:zm.subtitle,dir:"auto",children:t?`@${t}`:(0,l.sT)(c,i)})]})]})}if(!t)return;const h=t.forwardInfo?.hiddenUserName,u=s?n:i,m=s&&i?(0,Dt.Q5)(c,t.chatId,i):void 0;return(0,ne.FD)("div",{role:"button",tabIndex:0,className:(0,ve.A)(zm.root,e&&zm.active,a),onClick:d,children:[(0,ne.Y)(Tt.A,{className:zm.avatar,peer:u,text:h,size:"medium"}),(0,ne.FD)("div",{className:zm.info,children:[(0,ne.FD)("div",{className:zm.topRow,children:[u&&(0,ne.Y)(jn.A,{peer:u,withEmojiStatus:!0})||h,(0,ne.Y)(Gm.A,{className:zm.meta,message:t})]}),(0,ne.FD)("div",{className:zm.subtitle,dir:"auto",children:[m&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("span",{className:"sender-name",children:(0,Mt.A)(m)}),(0,ne.Y)("span",{className:"colon",children:":"})]}),(0,ne.Y)(Hm.A,{message:t,highlight:o,truncateLength:200})]})]})]})}),qm={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",fromTag:"xh4OgYEH",searchTypes:"rVYZG__K",searchType:"nE1Xwoo7",selectedType:"i29dP8iT",icons:"Mx8TXRsg",footer:"jyS1l9yn","keyboard-visible":"ao05jKHW",keyboardVisible:"ao05jKHW",counter:"NmmL_cO3",mobileNavigation:"dLO1hlHU",navigationButton:"Z4vLAlsu",navigationDisabled:"IqA7R2xO",memberItem:"BEPRQhWE",jumpIn:"n9kXbTu6"},Wm={isCustomPeer:!0,avatarIcon:"channel-filled",titleKey:"SearchPublicPosts"},Qm="MiddleSearchResult",Zm=(0,Ce.sg)(e=>e(),200,!1),Xm=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.Xf0)(e);if(!t)return{};const{chatId:i,threadId:n}=t,s=(0,c.hds)(e,i);if(!s)return{};const{requestedQuery:o,savedTag:a,results:r,fetchingQuery:d,isHashtag:h,type:u,fromPeerId:m}=(0,c.TCk)(e)||{},{totalCount:p,foundIds:g,query:v}=r||{},A=e.currentUserId,f=(0,c.nZ4)(e,i),C=(0,l.cG)(i,n,A),b=f&&!C?e.savedReactionTags?.byKey:void 0;return{chat:s,monoforumChat:(0,c.k2W)(e,i),requestedQuery:o,totalCount:p,threadId:n,foundIds:g,isHistoryCalendarOpen:Boolean((0,c.nTw)(e).historyCalendarSelectedAt),savedTags:b,savedTag:a,isCurrentUserPremium:(0,c.g29)(e),isSavedMessages:f,fetchingQuery:d,isHashtagQuery:h,currentUserId:A,searchType:u,lastSearchQuery:v,fromPeerId:m,isGroupChat:(0,l.YE)(s)}})(({isActive:e,chat:t,monoforumChat:i,threadId:o,requestedQuery:d,savedTags:h,savedTag:p,totalCount:g,lastSearchQuery:v,foundIds:A,isHistoryCalendarOpen:f,isCurrentUserPremium:C,isSavedMessages:b,fetchingQuery:y,isHashtagQuery:S,searchType:k="chat",currentUserId:N,fromPeerId:w,isGroupChat:I})=>{const{updateMiddleSearch:P,resetMiddleSearch:M,performMiddleSearch:L,focusMessage:x,closeMiddleSearch:R,openHistoryCalendar:E,openPremiumModal:V,loadSavedReactionTags:_}=(0,s.ko)(),U=(0,n.li)(),O=(0,n.li)(),K=(0,n.li)(),J=(0,n.li)(!1),{isMobile:j}=(0,Y.Ay)(),G=(0,B.A)(),H=(0,Bi.A)(),[z,$]=(0,n.J0)(d||""),[q,W]=(0,n.J0)(0),Q=A&&q>0,Z=A&&q<A.length-1,[ee,te]=(0,n.J0)(!e),ie=(0,n.li)(),se=(0,n.li)(!0),[oe,ae,re]=(0,D.A)(),[le,ce]=(0,n.J0)(!0),[de,he]=(0,n.J0)(!1),[ue,me]=(0,n.J0)(Boolean(w)),[pe,ge]=(0,n.J0)("");(0,n.vJ)(()=>{w&&(me(!0),De())},[w]);const Ae=(0,n.Kr)(()=>t&&I?(0,Jm.qS)(t):void 0,[t,I]),fe=ue&&!w,{result:be,isLoading:ye}=(0,Jm.Ay)({query:fe?pe||" ":z,queryFn:Ae,isDisabled:!I||Boolean(w)||!ue&&(!z||S)});!function(e,t){const i=(0,T.A)(i=>{e.every(e=>e.current&&!e.current.contains(i.target))&&t(i)});(0,n.vJ)(()=>(document.addEventListener("click",i),()=>{document.removeEventListener("click",i)}),[i])}([U],(0,T.A)(e=>{se.current||e.target.closest(".Modal")||re()}));const Se=Boolean((z||w)&&A||S),Ne=S&&!z,we="myChats"===k||"channels"===k,Ie=!S&&Boolean(be?.length),Pe=Boolean(z&&!Ne||p||w),Ye="chat"===k&&Boolean(A?.length),Fe=(0,T.A)(()=>{R()}),De=(0,T.A)(()=>{(0,r.YS)(()=>{(0,Sc.A)(O.current)})}),Me=(0,T.A)(()=>{O.current?.blur()});(0,n.vJ)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),i=()=>{const{activeElement:i}=document;if(i&&i===O.current){const{pageTop:i,height:n}=e;(0,r.RK)(()=>{t.style.transform=`translateY(${i}px)`,t.style.height=`${n}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,n.vJ)(()=>{W(-1)},[v]),(0,n.Nf)(()=>{u.pz&&Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==O.current)})},[e]),(0,n.vJ)(()=>{e?(te(!1),clearTimeout(ie.current)):(O.current.blur(),ce(!0),W(0),$(""),me(!1),ge(""),ie.current=window.setTimeout(()=>te(!0),200))},[e]),(0,n.vJ)(()=>{d&&t?.id&&($(d),P({chatId:t.id,threadId:o,update:{requestedQuery:void 0}}),he(!0),(0,r.Uz)(()=>{const e=O.current;e&&((0,Ni.A)(e,!0,!0),ae())}))},[t?.id,d,o]),(0,F.A)(([t])=>{e!==t&&!z&&v&&$(v)},[e,v,z]),(0,F.A)(([t])=>{e&&t!==f&&(f?(Me(),re()):De())},[f,e]);const Te=(0,T.A)(()=>{z?.length||p||w||ue?($(""),he(!1),me(!1),ge(""),M(),De()):Fe()});(0,n.vJ)(()=>e?(0,m.A)(Te):void 0,[e,Fe]);const Be=(0,n.Kr)(()=>{if(h)return Object.values(h)},[h]),Le=Boolean(Be?.length),xe=Le&&!C;(0,n.vJ)(()=>{b&&e&&_()},[b,e]);const Re=(0,T.A)(()=>{const e=t?.id;e&&Zm(()=>{J.current||L({chatId:e,threadId:o,query:z})})}),Ee=(0,T.A)(e=>{if(J.current=!1,e.startsWith("#")&&!S)return P({chatId:t.id,threadId:o,update:{isHashtag:!0}}),$(e.slice(1)),void Re();if(I&&e.toLowerCase().startsWith("from:")&&!w&&!ue){me(!0);const t=e.slice(5).trim();return void ge(t)}!ue||w?($(e),e||w||(he(!1),M(),J.current=!0)):ge(e)});(0,n.vJ)(()=>{e&&(z||w)&&Re()},[e,z,w]),(0,n.vJ)(()=>{he(Boolean(y))},[y]),(0,n.vJ)(()=>{A?.length&&A.length-q<5&&Re()},[q,A?.length]),(0,n.vJ)(()=>{if(e)return se.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(){O.current?.focus(),ae(),(0,Ce.IJ)(()=>{se.current=!1})}function i(){window.removeEventListener("touchend",t),window.removeEventListener("mouseup",t),(0,Ce.IJ)(()=>{se.current=!1})}},[e]),(0,ke.A)({isActive:e,onBack:Fe});const[Ve,_e,Ue=0]=(0,Un.A)(Re,A),[Oe,Ke]=(0,Un.A)(void 0,fe?be:void 0),Je=Ie&&(fe?Oe:be.slice(0,5))||void 0,je=(0,n.Kr)(()=>{if(!z&&!p&&!w||!Ve?.length)return gi.p;const e=(0,s.mS)();return Ve.map(t=>{const[i,n]=(0,_c.a)(t),s=(0,c.O5q)(e,i,n);if(!s)return;const o=b||(0,l.DX)(i)||i===a.Ckz?(0,c.Szq)(e,s):void 0,r=(0,c.Y7C)(e,s);return{searchResultKey:t,message:s,messageChat:(0,c.hds)(e,s.chatId),senderPeer:o||r}}).filter(Boolean)},[z,p,w,Ve,b]),Ge=Boolean((z||w)&&!de&&!je.length&&!Ne&&!Ie),He=e&&(le||!j)&&(oe||we)&&Boolean(Se||Ge||Ne||h||Ie),ze=(0,T.A)(e=>{const t=(0,_c.D)(e),i=A?.indexOf(t)||0;W(i+Ue),"chat"===k&&ce(!1),x({chatId:e.chatId,messageId:e.id,threadId:S?void 0:o}),re()}),$e=(0,T.A)(()=>{ce(e=>!e),ae()}),qe=(0,Kn.A)(K,Se||Ie,e=>{const t=-1===e?0:e,i=Je?.length||0;if(t<i&&Je){const e=Je[t];return void(e&&nt(e))}const n=t-i,s=je?.[n];s&&(ze(s.message),W(n+Ue))},`.${Qm}`,!0),We=(0,T.A)(e=>{P({chatId:t.id,threadId:o,update:e}),Re()}),Qe=(0,T.A)(e=>{xe?V({initialSection:"saved_tags"}):We({savedTag:e})}),Ze=(0,T.A)(()=>{We({savedTag:void 0})}),Xe=(0,T.A)(()=>w?(We({fromPeerId:void 0}),void ge("")):ue?(me(!1),void ge("")):void(S?We({isHashtag:!1}):p&&Ze())),tt=(0,T.A)(e=>{We({type:e}),ce(!0)}),it=(0,T.A)(()=>{me(!0),ge(""),De()}),nt=(0,T.A)(e=>{P({chatId:t.id,threadId:o,update:{fromPeerId:e}}),ge(""),$(""),De()}),st=(0,T.A)(()=>{if("chat"===k&&(re(),Me(),A)){const e=q+1,[t,i]=(0,_c.a)(A[e]);x({chatId:t,messageId:i,threadId:o}),W(e)}}),ot=(0,T.A)(()=>{if("chat"===k&&(re(),Me(),A)){const e=q-1,[t,i]=(0,_c.a)(A[e]);x({chatId:t,messageId:i,threadId:o}),W(e)}});function at(e,i){const n=!i&&k===e;switch(e){case"chat":return(0,ne.Y)(xn.A,{className:(0,ve.A)(qm.searchType,n&&qm.selectedType),peerId:t?.id,title:G("SearchThisChat"),clickArg:"chat",onClick:i?Xe:tt});case"myChats":return(0,ne.Y)(xn.A,{className:(0,ve.A)(qm.searchType,n&&qm.selectedType),peerId:N,forceShowSelf:!0,title:G("SearchMyMessages"),clickArg:"myChats",onClick:i?Xe:tt});case"channels":return(0,ne.Y)(xn.A,{className:(0,ve.A)(qm.searchType,n&&qm.selectedType),customPeer:Wm,title:G("SearchPublicPosts"),clickArg:"channels",onClick:i?Xe:tt})}}function rt(e){const t=(0,c.PVB)((0,s.mS)(),e);if(t)return(0,ne.Y)($m,{className:Qm,peer:t,onClick:nt},`member-${e}`)}function lt(){return(0,ne.FD)("div",{className:(0,ve.A)(qm.dropdown,!He&&qm.dropdownHidden),children:[!j&&(0,ne.Y)("div",{className:qm.separator}),Le&&!S&&!fe&&(0,ne.Y)("div",{className:(0,ve.A)(qm.savedTags,!j&&qm.wrap,"no-scrollbar"),children:Be.map(e=>{const t=(0,l.a0)(e.reaction,p);return(0,ne.Y)(jm.A,{containerId:"local-search",reaction:e.reaction,tag:e,withCount:!0,isDisabled:xe,isChosen:t,onClick:t?Ze:Qe},(0,l.Jj)(e.reaction))})}),S&&!fe&&(0,ne.FD)("div",{className:(0,ve.A)(qm.searchTypes,"no-scrollbar"),children:[at("chat"),at("myChats"),at("channels")]}),Boolean(Se||Ie)&&(0,ne.FD)(mn.A,{ref:K,className:(0,ve.A)(qm.results,"custom-scroll"),items:fe?Je:je,itemSelector:`.${Qm}`,preloadBackwards:0,onLoadMore:fe?Ke:_e,onKeyDown:qe,children:[ye&&fe&&(0,ne.Y)(Jn.A,{}),Je?.map(rt),fe&&!ye&&!be?.length&&(0,ne.Y)("span",{className:qm.placeholder,children:G("NoResult")}),Ge&&(0,ne.Y)("span",{className:qm.placeholder,children:G("NoResultFoundFor",z)},"nothing"),Ne&&(0,ne.Y)("span",{className:qm.placeholder,children:G("HashtagSearchPlaceholder")},"enterhash"),!fe&&je?.map(({message:e,senderPeer:t,messageChat:i,searchResultKey:n},s)=>(0,ne.Y)($m,{teactOrderKey:-e.date,className:Qm,query:z,message:e,peer:t,messageChat:i,shouldShowChat:S,isActive:q-Ue===s,onClick:ze},n))]})]})}return(0,ne.FD)("div",{id:"MiddleSearch",className:(0,ve.A)(qm.root,e&&qm.active,!e&&ee&&"visually-hidden",oe&&qm.focused,j&&qm.mobile),ref:U,children:[(0,ne.FD)("div",{className:qm.header,children:[!j&&(0,ne.Y)(Tt.A,{className:qm.avatar,peer:i||t,size:"medium",isSavedMessages:b}),(0,ne.FD)(gn.A,{ref:O,value:ue&&!w?pe:z,className:(0,ve.A)(qm.input,He&&qm.withDropdown,He&&!j&&qm.adaptSearchBorders),canClose:!j,isLoading:de,resultsItemSelector:`.${qm.results} .${Qm}`,hasUpButton:Ye&&!j,hasDownButton:Ye&&!j,placeholder:G(S?"SearchHashtagsHint":"Search"),teactExperimentControlled:!0,onChange:Ee,onStartBackspace:Xe,onReset:Te,withBackIcon:j,onFocus:ae,focused:oe,onUpClick:Z?st:void 0,onDownClick:Q?ot:void 0,children:[(0,ne.FD)("div",{className:qm.searchTags,children:[p&&(0,ne.Y)(jm.A,{containerId:"local-search-tags",className:qm.savedSearchTag,reaction:p,tag:h[(0,l.Jj)(p)],onClick:Ze}),S&&(0,ne.Y)("div",{className:qm.hash,children:"#"}),(ue||w)&&(0,ne.FD)("div",{className:qm.fromTag,children:[H("SearchFilterFrom"),w&&(0,ne.Y)(xn.A,{peerId:w,forceShowSelf:!0,canClose:!0,onClick:Xe})]})]}),!j&<()]}),!j&&(0,ne.FD)("div",{className:qm.icons,children:[I&&!ue&&!w&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:it,ariaLabel:G("FilterByUser"),iconName:"user"}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>E({selectedAt:(0,et.CS)(Date.now())}),ariaLabel:G("JumpToDate"),iconName:"calendar"})]})]}),j&<(),j&&(0,ne.FD)("div",{className:qm.footer,children:[I&&!ue&&!w&&(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:it,ariaLabel:G("FilterByUser"),iconName:"user"}),(0,ne.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>E({selectedAt:(0,et.CS)(Date.now())}),ariaLabel:G("JumpToDate"),iconName:"calendar"}),(0,ne.Y)("div",{className:qm.counter,children:Pe&&(A?.length?G("Of",[Math.max(q+1,1),g]):A&&!A.length&&G("NoResult"))}),"chat"===k&&Boolean(A?.length)&&(0,ne.Y)(X.A,{className:qm.viewStyle,size:"smaller",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:$e,children:G(le?"SearchAsChat":"SearchAsList")}),Ye&&!He&&(0,ne.FD)("div",{className:qm.mobileNavigation,children:[(0,ne.Y)(X.A,{className:(0,ve.A)(qm.navigationButton,!Z&&qm.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:st,nonInteractive:!Z,ariaLabel:H("AriaSearchOlderResult"),iconName:"up"}),(0,ne.Y)(X.A,{className:(0,ve.A)(qm.navigationButton,!Q&&qm.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:ot,nonInteractive:!Q,ariaLabel:H("AriaSearchNewerResult"),iconName:"down"})]})]})]})}));var ep=i(80539),tp=i(58734),ip=i(73172);const np=2.5*v.$,sp=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{setsById:i,added:n,recent:s,favorite:o,effect:a}=e.stickers,r=(0,c.nZ4)(e,t),l=(0,c.hds)(e,t),d=(0,g.L8)(t)?void 0:(0,c.AWZ)(e,t)?.stickerSet?.id;return{chat:l,effectStickers:a?.stickers,effectEmojis:a?.emojis,recentStickers:s.stickers,favoriteStickers:o.stickers,stickerSetsById:i,addedSetIds:n.setIds,canAnimate:(0,c.ML4)(e),isSavedMessages:r,isCurrentUserPremium:(0,c.g29)(e),chatStickerSetId:d}})(({chat:e,threadId:t,className:i,isHidden:o,isTranslucent:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:h,effectStickers:m,effectEmojis:p,addedSetIds:g,stickerSetsById:v,chatStickerSetId:A,canAnimate:f,isSavedMessages:C,isCurrentUserPremium:b,noContextMenus:y,idPrefix:S,onStickerSelect:k,isForEffects:N})=>{const{loadRecentStickers:w,addRecentSticker:I,unfaveSticker:P,faveSticker:Y,removeRecentSticker:F}=(0,s.ko)(),D=(0,n.li)(),M=(0,n.li)(),L=(0,n.li)(),{handleScroll:x,isAtBeginning:R}=(0,un.A)(),E=(0,ip.A)(e?.id,t),V=`${S}-sticker-set`,{activeSetIndex:_,observeIntersectionForSet:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,observeIntersectionForCovers:J,selectStickerSet:j}=Nr(D,M,V,o),G=(0,B.A)(),H=Boolean(g),z=(0,n.Kr)(()=>{if(N&&m){const e=[];return p?.length&&e.push({id:a.hfH,accessHash:"0",title:"",stickers:p,count:p.length,isEmoji:!0}),m?.length&&e.push({id:a.Kp3,accessHash:"0",title:G("StickerEffects"),stickers:m,count:m.length}),e}if(!g)return gi.p;const e=[];h.length&&e.push({id:a.tRH,accessHash:"0",title:G("FavoriteStickers"),stickers:h,count:h.length}),d.length&&e.push({id:a.sR2,accessHash:"0",title:G("RecentStickers"),stickers:d,count:d.length});const t=[...g||[]];A&&t.unshift(A);const i=Object.values((0,pi._E)(v,t));return[...e,...i]},[g,v,h,d,A,G,m,N,p]),$=(0,n.Kr)(()=>H&&0===z.filter(e=>e.stickers?.length).length,[z,H]);(0,n.vJ)(()=>{l&&(w(),c&&E({type:"chooseSticker"}))},[c,l,w,E]);const q=(0,Cr.A)([],a.jhd),W=H&&q&&!$&&(c||N);(0,Qn.A)(M,!W||!M.current),(0,n.vJ)(()=>{if(!H)return;const e=M.current;if(!e)return;const t=_*np-(e.offsetWidth/2-np/2);(0,Mo.A)(e,t)},[H,_]);const Q=(0,T.A)((e,t,i)=>{k(e,t,i,!0),I({sticker:e})}),Z=(0,T.A)(e=>{P({sticker:e})}),ee=(0,T.A)(e=>{Y({sticker:e})}),te=(0,T.A)(()=>{c&&E({type:"chooseSticker"})}),ie=(0,T.A)(e=>{F({sticker:e})});if(!e)return;const se=(0,ve.A)("lq8BD6Hc",i),oe=(0,ve.A)(Kr,"no-scrollbar",!R&&Jr),re=!W&&(c||N)&&!$;return(0,ne.Y)(ae.Ay,{className:se,activeKey:re?0:1,name:"fade",shouldCleanup:!0,children:W?(0,ne.FD)(ne.FK,{children:[!N&&(0,ne.Y)("div",{ref:M,className:oe,children:(0,ne.FD)("div",{className:"shared-canvas-container",children:[(0,ne.Y)("canvas",{ref:L,className:"shared-canvas"}),z.map(function(t,i){const n=t.stickers?.[0],s=(0,ve.A)(jr,i===_&&"y02WwQk6"),o=i<a.j41;return t.id===a.sR2||t.id===a.tRH||t.id===a.eKB||t.hasThumbnail||!n?(0,ne.Y)(X.A,{className:s,ariaLabel:t.title,round:!0,faded:t.id===a.sR2||t.id===a.tRH,color:"translucent",onClick:()=>j(i),children:t.id===a.sR2?(0,ne.Y)(he.A,{name:"recent"}):t.id===a.tRH?(0,ne.Y)(he.A,{name:"favorite"}):t.id===a.eKB?(0,ne.Y)(Tt.A,{peer:e,size:"small"}):(0,ne.Y)(Fr,{stickerSet:t,noPlay:!f||!l,observeIntersection:J,sharedCanvasRef:o?L:void 0,forcePlayback:!0})},t.id):(0,ne.Y)(Br,{sticker:n,size:a.TBj,title:t.title,className:s,noPlay:!f||!l,observeIntersection:J,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:o?L:void 0,withTranslucentThumb:r,onClick:j,clickArg:i,forcePlayback:!0},t.id)})]})}),(0,ne.Y)("div",{ref:D,onMouseMove:te,onScroll:x,className:(0,ve.A)(Ur,u.TF?"no-scrollbar":"custom-scroll",!N&&Or),children:z.map((e,t)=>(0,ne.Y)(Vr,{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:C,isCurrentUserPremium:b,isTranslucent:r,isChatStickerSet:e.id===A,onStickerSelect:Q,onStickerUnfave:Z,onStickerFave:ee,onStickerRemoveRecent:ie,forcePlayback:!0,shouldHideHeader:e.id===a.hfH},e.id))})]}):c||N?$?(0,ne.Y)("div",{className:Gr,children:G("NoStickers")}):(0,ne.Y)(Jn.A,{}):(0,ne.Y)("div",{className:Gr,children:G("ErrorSendRestrictedStickersAll")})})})),op=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{availableReactions:i,topReactions:n}=e.reactions,{maxUniqueReactions:s}=e.appConfig,{enabledReactions:o,isPaidReactionAvailable:a}=(0,c.AWZ)(e,t)||{};return{enabledReactions:o,availableReactions:i,topReactions:n,reactionsLimit:s,isWithPaidReaction:a}})(({loadAndPlay:e,enabledReactions:t,availableReactions:i,topReactions:s,selectedReactionIds:o,isWithPaidReaction:a,message:r,reactionsLimit:c,onReactionSelect:d,onReactionContext:h})=>{const u=(0,n.li)(),m=(0,n.li)(),{width:p}=(0,Pe.A)(),{isTouchScreen:g}=(0,Y.Ay)(),A=r?.reactions?.results,f=c&&A&&A.length>=c,C=(0,n.Kr)(()=>{if(f){const e=A.map(({reaction:e})=>e);return a&&e.unshift({type:"paid"}),e}if(!t)return[];if("all"===t.type){const e=(i||[]).map(({reaction:e})=>e);return a&&e.unshift({type:"paid"}),(0,l.fu)(e,s)}const e=t.allowed.slice();return a&&e.unshift({type:"paid"}),(0,l.fu)(e,s)},[i,t,s,f,A,a]),b=(0,n.Kr)(()=>{const e=Math.min(26.25*v.$,p),t=(p>600?.625:.5)*v.$,i=e-.5*v.$,n=Math.floor((i+t)/(36+t)),s=Math.ceil(C.length/n),o=36*s+(s-1)*t+.5*v.$*2;return Math.min(18*v.$,o)},[C.length,p]);return(0,ne.Y)("div",{className:"MhpiTAwi",style:`height: ${b}px`,children:(0,ne.Y)("div",{className:(0,ve.A)("NIaqmosK",g?"no-scrollbar":"custom-scroll"),children:(0,ne.FD)("div",{className:"symbol-set-container shared-canvas-container",children:[(0,ne.Y)("canvas",{ref:u,className:"shared-canvas"}),(0,ne.Y)("canvas",{ref:m,className:"shared-canvas"}),C.map(t=>{const n=(0,l.Jj)(t),s=n?o?.includes(n):void 0;return(0,ne.Y)(Rr,{reaction:t,isSelected:s,loadAndPlay:e,availableReactions:i,onClick:d,onContextMenu:h,sharedCanvasRef:u,sharedCanvasHqRef:m},n)})]})})})})),ap=16.375*v.$,rp=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.nTw)(e),i=e.availableEffectById,{chatId:n,messageId:s,storyPeerId:o,storyId:a,position:r,sendAsMessage:l,isForEffects:d}=t.reactionPicker||{},h=o&&a?(0,c.Msb)(e,o,a):void 0,u=n?(0,c.hds)(e,n):void 0,m=n?(0,c.AWZ)(e,n):void 0,p=n&&s?(0,c.O5q)(e,n,s):void 0,v=(0,g.L8)(n||o||""),A="some"===m?.enabledReactions?.type,{maxUniqueReactions:f}=e.appConfig,C="all"===m?.enabledReactions?.type&&m?.enabledReactions?.areCustomAllowed,b=p?.reactions?.results,y=Boolean(f&&b&&b.length>=f);return{message:p,story:h,position:r,shouldUseFullPicker:!(u?.isForbidden||A||y)&&(C||v),isTranslucent:(0,c.cwE)(e),isCurrentUserPremium:(0,c.g29)(e),sendAsMessage:l,isForEffects:d,chatId:n,availableEffectById:i}})(({isOpen:e,message:t,story:i,position:o,isTranslucent:a,isCurrentUserPremium:r,shouldUseFullPicker:c,sendAsMessage:d,chatId:h,isForEffects:u,availableEffectById:m})=>{const{toggleReaction:p,closeReactionPicker:g,sendMessage:v,showNotification:A,sendStoryReaction:f,saveEffectInDraft:C,requestEffectInComposer:b,addLocalPaidReaction:y,openPaidReactionModal:S}=(0,s.ko)(),k=(0,B.A)(),N=(0,Ii.A)(t?.id,!0),w=(0,Ii.A)(t?.chatId,!0),I=(0,Ii.A)(i?.peerId,!0),P=(0,Ii.A)(i?.id),F=(0,Ii.A)(o,!0),D=(0,n.li)(),M=(0,n.Kr)(()=>{if(F)return P?F:{x:F.x+(c?-23:-21),y:F.y+(c?-64:-10)}},[P,F,c]),L=(0,T.A)(()=>D.current),x=(0,T.A)(()=>({withPortal:!0,isDense:!I,deltaX:!(0,Y.Ny)()&&D.current?-(D.current.offsetWidth-ap)/2- -11.5:0})),R=(0,T.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}),g()}),E=(0,T.A)(e=>{w&&N&&("paid"===e.type?y({chatId:w,messageId:N,count:1}):p({chatId:w,messageId:N,reaction:e,shouldAddToRecent:!0}),g())}),V=(0,T.A)(e=>{"paid"===e.type&&(S({chatId:w,messageId:N}),g())}),_=(0,T.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,s.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 g();if(!d)return f({peerId:I,storyId:P,containerId:(0,l.$_)(I,P),reaction:t,shouldAddToRecent:!0}),void g();let n,o;if("type"in e&&"emoji"===e.type)n=e.emoticon;else{const e=(0,ep.A)((0,tp.hB)(i));n=e.text,o=e.entities}v({text:n,entities:o,isReaction:!0}),g()}),U=(0,T.A)(e=>{const t=Object.values(m),i=t.find(t=>t.effectStickerId===e.id)?.id;h&&C({chatId:h,threadId:j.l3,effectId:i}),i&&b({}),g()}),O=(0,n.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,ne.Y)(it.A,{isOpen:e,ref:D,className:(0,ve.A)("gBh4WvBC","ReactionPicker"),bubbleClassName:(0,ve.A)("qSfKwMzX",!c&&!P&&"dRNSqkOC",P&&"srpBMrqr"),withPortal:!0,noCompact:!0,anchor:M,positionY:i&&"bottom",getTriggerElement:lp,getRootElement:cp,getMenuElement:L,getLayout:x,backdropExcludedSelector:".Modal.confirm",onClose:g,children:u&&h?(0,ne.Y)(sp,{className:"",isHidden:!e,loadAndPlay:Boolean(e&&c),idPrefix:"message-effect",canSendStickers:!1,noContextMenus:!1,chatId:h,isTranslucent:a,onStickerSelect:U,isForEffects:u}):(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(qr,{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:a,onCustomEmojiSelect:P?_:R,onReactionSelect:P?_:E,onReactionContext:V}),!c&&Boolean(w)&&(0,ne.Y)(op,{chatId:w,loadAndPlay:e,onReactionSelect:P?_:E,onReactionContext:V,selectedReactionIds:O,message:t})]})})}));function lp(){return document.querySelector("body")}function cp(){return document.querySelector("body")}var dp=i(19408),hp=i(19926),up=i(6070),mp=i(46144),pp=i(41730);const gp="V9YdBX5q",vp="_E7X0OCM",Ap="MH618yH0",fp="O9SivgQj",Cp="nC4mjFMS",bp="K0Yfg1Pc",yp="t5woFtcb",Sp="XjR09glB",kp="tF4WbK2o",Np="Kr6AVdDr",wp=(0,n.ph)(({isLoading:e,transitionKey:t,className:i,loadingElement:s,children:o})=>{const a=(0,n.li)(),[l,c]=(0,n.J0)(void 0);(0,n.Nf)(()=>{!e&&a.current&&(0,r.YS)(()=>{if(!a.current)return;const e=a.current.scrollHeight+4;c(e)})},[o,e,t]);const d=void 0!==l,h=d?l:e?100:void 0;return(0,ne.FD)("div",{className:(0,ve.A)("YRLcrLTq",d&&"_ZRpMnuW",i),style:void 0!==h?`height: ${h}px`:void 0,children:[(0,ne.Y)("div",{className:(0,ve.A)("I4JmTj3Z",!e&&fp),children:s||(0,ne.Y)(pp.A,{lines:6})}),(0,ne.Y)(ae.Ay,{name:"fade",activeKey:t??0,className:(0,ve.A)("NoJPc6lG",e&&fp),children:(0,ne.Y)("div",{ref:a,className:Cp,children:o})})]})}),Ip=(0,n.ph)(({error:e,isPremium:t})=>{const{openPremiumModal:i}=(0,s.ko)(),n=(0,Bi.A)(),o=(0,T.A)(()=>{i({initialSection:"ai_compose"})});if(!e)return;const a="floodPremium"===e;return(0,ne.Y)("div",{className:Np,children:a?t?n("AiMessageEditorDailyLimitReachedPremium"):n("AiMessageEditorDailyLimitReached",{link:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:o,children:n("TelegramPremium")})},{withNodes:!0}):n("AiMessageEditorGenericError")})}),Pp=(0,n.ph)(({textToCopy:e,isHidden:t,className:i})=>{const{showNotification:n}=(0,s.ko)(),o=(0,Bi.A)(),a=(0,T.A)(()=>{e&&((0,Lc.eM)(e),n({message:{key:"TextCopied"}}))});return(0,ne.Y)(X.A,{className:(0,ve.A)("Cv0ZdlN7",t&&fp,i),round:!0,size:"tiny",color:"translucent-primary",iconName:"copy",ariaLabel:o("Copy"),onClick:a})}),Yp="rtx20jZ5",Fp="XkjO7HcV",Dp=(0,n.ph)(({text:e,isLoading:t,result:i,error:n,isPremium:s})=>{const o=(0,Bi.A)(),a=Boolean(n),r=i?.diffText||i?.resultText;return(0,ne.FD)("div",{className:Fp,children:[(0,ne.FD)("div",{className:"vE9gVhXo",children:[(0,ne.Y)("div",{className:gp,children:(0,ne.Y)("span",{className:vp,children:o("AiMessageEditorOriginal")})}),(0,ne.Y)(mp.A,{text:e?.text})]}),(0,ne.Y)("div",{className:Ap}),(0,ne.Y)("div",{className:gp,children:(0,ne.Y)("span",{className:vp,children:o("AiMessageEditorResult")})}),(0,ne.Y)(wp,{isLoading:t,children:a?(0,ne.Y)(Ip,{error:n,isPremium:s}):r&&function(e){const{text:t,entities:i}=e;return(0,Gi.fd)({text:t,entities:i})}(r)}),(0,ne.Y)(Pp,{textToCopy:i?.resultText?.text||e?.text,isHidden:t||a||!r?.text})]})});var Mp=i(53097),Tp=i(67778),Bp=i(41494),Lp=i(69287);const xp=(0,n.ph)(({label:e,description:t,disabled:i,loading:n,isCentered:s,className:o,controlClassName:a,labelClassName:r,descriptionClassName:l,ripple:c,...d})=>(0,ne.Y)(Bp.Ay,{asLabel:!0,clickable:!0,ripple:c,disabled:i,loading:n,className:(0,ve.A)(o,s&&"wqeQOFOb"),children:(0,ne.FD)(Tp.Ay,{className:(0,ve.A)(a,s&&"iC8a5viA"),children:[(0,ne.Y)(Lp.A,{...d}),(0,ne.Y)(Tp.mq,{className:r,children:e}),void 0!==t?(0,ne.Y)(Tp.eI,{className:l,children:t}):void 0]})})),Rp=e=>{const{isOpen:t}=e,i=(0,Va.A)(Ea.ar.Extra,"AiToneEmojiPickerModal",!t);return i?(0,ne.Y)(i,{...e}):void 0};var Ep=i(25903),Vp=i(54839),_p=i(14745);let Up=0;const Op=(0,n.q6)(void 0),Kp={slim:"API3HXiP",regular:"IYmYhqB_",wide:"dsGywG6R",fullscreen:"RkwfFxQX"},Jp={auto:"v_OmaSFu",regular:"OuX8A82T",tall:"hGYQF8M_",fullscreen:"oHcCrKI_"};function jp(){return(0,Vp.A)(Op)}const Gp=({className:e,children:t})=>{const i=jp();return(0,ne.Y)("div",{className:(0,ve.A)("nJlso_dX",i?.hasSubtitle&&"j1CJH7MP",e),children:t})},Hp=({className:e,children:t})=>(0,ne.Y)("div",{className:(0,ve.A)("pNKko9JX",e),children:t}),zp=({className:e,children:t})=>{const i=jp();return(0,n.Nf)(()=>(i?.registerTitle(!0),()=>{i?.registerTitle(!1)}),[i]),(0,ne.Y)("div",{id:i?.titleId,className:(0,ve.A)("qYfdLliy",e),dir:"auto",children:t})},$p=({asAbsolute:e,className:t})=>{const i=(0,Bi.A)(),n=jp(),s=(0,T.A)(()=>{n?.onClose()});return(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:i("Close"),className:(0,ve.A)("zBZilEdZ",e&&"ARZMWu_d",t),onClick:s,children:(0,ne.Y)("div",{className:"animated-close-icon"})})},qp=(0,n.ph)(({isOpen:e,children:t,header:i,dialogClassName:s,contentClassName:o,width:a="regular",height:l="regular",noBackdrop:c,noLightDismiss:d,noScrollable:h,noContentInlinePadding:u,keepMounted:m,stickyFooter:p,ariaLabel:g,noContainment:v,onClose:A})=>{const[f,C]=(0,n.J0)(Boolean(e)),[b,y]=(0,n.J0)(Boolean(e)),[S,k]=(0,n.J0)(!1),[N,w]=(0,n.J0)(!1),[I,P]=(0,n.J0)(!1),Y=(0,n.li)(),F=(0,n.li)(),D=(0,n.li)(),M=(0,_p.A)(),B=`modal-title-${M}`,L=`modal-subtitle-${M}`,x=(0,Nn.A)({header:i,children:t,stickyFooter:p,dialogClassName:s,contentClassName:o,width:a,height:l,noBackdrop:c,noScrollable:h,noContentInlinePadding:u,ariaLabel:g,noContainment:v},!e),R=Boolean(x.header),E=(0,T.A)(()=>{D.current?.(),D.current=void 0}),V=(0,T.A)(()=>{E();const e=Y.current;e?.open&&e.close(),k(!1),y(!1)}),_=(0,T.A)(()=>{S||A()}),U=(0,T.A)(e=>{w(e)}),O=(0,T.A)(e=>{P(e)}),K=(0,n.Kr)(()=>({onClose:_,titleId:B,subtitleId:L,hasSubtitle:I,registerTitle:U,registerSubtitle:O}),[_,I,O,U,L,B]);(0,n.vJ)(()=>{e&&!f&&C(!0)},[f,e]),(0,n.vJ)(()=>{if(e)return E(),b?void(S&&k(!1)):void y(!0);b&&!S&&k(!0)},[S,e,b]),(0,n.vJ)(()=>{if(!S)return void E();const e=F.current;if(e){if(!document.body.classList.contains("no-page-transitions"))return D.current=(0,Ep.e)(e,V,void 0,300),E;V()}else V()},[S]),(0,n.Nf)(()=>{if(!b)return;const e=Y.current;return e?(e.open||e.showModal(),()=>{E(),e.open&&e.close()}):void 0},[b]),(0,n.vJ)(()=>{if(b)return Up+=1,(0,r.RK)(()=>{document.body.classList.add("has-open-dialog")}),()=>{Up=Math.max(0,Up-1),Up||(0,r.RK)(()=>{document.body.classList.remove("has-open-dialog")})}},[b]),(0,n.vJ)(()=>{if(!b)return;const t=Y.current;if(!t)return;const i=t=>{t.preventDefault(),d||!e||S||_()};return t.addEventListener("cancel",i),()=>{t.removeEventListener("cancel",i)}},[S,e,d,b]),(0,ke.A)({isActive:Boolean(e&&!d),onBack:_});const J=(0,T.A)(t=>{t.target!==t.currentTarget||d||!e||S||_()});if(b||m&&f)return(0,ne.Y)(Wr.A,{children:(0,ne.Y)(Op.Provider,{value:K,children:(0,ne.Y)("dialog",{ref:Y,className:(0,ve.A)("UZ9UQW7q",Kp[x.width],Jp[x.height],x.noBackdrop&&"tIUaMRGA",("fullscreen"===x.width||"fullscreen"===x.height)&&"ejG3jFOu",S?"kPnAPn2B":"v6rqfNtS",x.dialogClassName,!x.noContainment&&"Miw47_fM"),"aria-modal":"true","aria-label":N?void 0:x.ariaLabel,"aria-labelledby":N?B:void 0,"aria-describedby":I?L:void 0,onClick:J,children:(0,ne.FD)("div",{ref:F,className:"TTrOEqZg",children:[R&&(0,ne.Y)("div",{className:"ytSlUZUc",children:x.header}),(0,ne.Y)(zd.A,{scrollable:!x.noScrollable,noPadding:x.noContentInlinePadding,className:(0,ve.A)("boQSv9X_",R&&"E8MhZ14U",x.contentClassName),children:(0,ne.Y)("div",{className:"b24Fc9LR",children:x.children})}),Boolean(x.stickyFooter)&&(0,ne.Y)("div",{className:"G08N5DgO",children:x.stickyFooter})]})})})})}),Wp="Ew_pfjkt",Qp=(0,n.ph)((0,s.EK)(e=>({toneToEdit:(0,c.nTw)(e).aiToneEditorModal?.toneToEdit,titleMaxLength:e.appConfig.aiComposeToneTitleLengthMax,promptMaxLength:e.appConfig.aiComposeTonePromptLengthMax}))(({isOpen:e,toneToEdit:t,titleMaxLength:i=12,promptMaxLength:o=1024})=>{const{closeAiToneEditorModal:a,createAiTone:r,updateAiTone:l,deleteAiTone:c}=(0,s.ko)(),d=(0,Bi.A)(),h=Boolean(t),[u,m]=(0,n.J0)(),[p,g]=(0,n.J0)(""),[v,A]=(0,n.J0)(""),[f,C]=(0,n.J0)(!1),[b,y,S]=(0,D.A)(),[k,N,w]=(0,D.A)();(0,n.vJ)(()=>{e&&(t?(m(t.emojiId),g(t.title),A(t.prompt||""),C(Boolean(t.authorId))):(m(void 0),g(""),A(""),C(!1)))},[e,t]);const I=Boolean(u&&p.trim()&&v.trim()),P=(0,T.A)(()=>{a(),S(),w()}),Y=(0,T.A)(()=>{if(I){if(h){const e=(0,Mp.fv)(t);l({tone:e,title:p.trim(),emojiId:u,prompt:v.trim(),shouldDisplayAuthor:f||void 0})}else r({title:p.trim(),emojiId:u,prompt:v.trim(),shouldDisplayAuthor:f||void 0});P()}}),F=(0,T.A)(()=>{if(!t)return;const e=(0,Mp.fv)(t);c({tone:e}),w(),P()}),M=(0,T.A)(e=>{g(e.target.value)}),B=(0,T.A)(e=>{A(e.target.value)}),L=(0,T.A)(e=>{m(e),S()}),x=d(h?"AiToneEditorEditTitle":"AiToneEditorTitle"),R=(0,n.Kr)(()=>(0,ne.FD)(Gp,{children:[(0,ne.Y)($p,{}),(0,ne.Y)(zp,{children:x})]}),[x]);return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(qp,{isOpen:e,onClose:P,header:R,ariaLabel:x,width:"slim",children:[(0,ne.Y)("div",{className:"x3emP3sa",children:(0,ne.Y)("button",{type:"button",className:"I3eaONv2",onClick:y,children:u?(0,ne.Y)(hs.A,{documentId:u,size:48}):(0,ne.Y)(he.A,{name:"smile",className:"CBGQxDVB"})})}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ee.A,{className:Wp,value:p,onChange:M,placeholder:d("AiToneEditorNamePlaceholder"),maxLength:i,hasLengthIndicator:!0}),(0,ne.Y)(Is.A,{className:(0,ve.A)(Wp,"FdiDwnNH"),value:v,onChange:B,placeholder:d("AiToneEditorPromptPlaceholder"),maxLength:o,hasLengthIndicator:!0,noReplaceNewlines:!0})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(xp,{label:d("AiToneEditorDisplayAuthor"),checked:f,isRound:!0,isCentered:!0,onChange:C})}),(0,ne.FD)("div",{className:"tXyJ3Pbn",children:[h&&(0,ne.Y)(X.A,{className:"x7ly6ots",onClick:N,color:"danger",isText:!0,children:d("AiToneDeleteStyle")}),(0,ne.Y)(X.A,{className:"o3o0Tiig",onClick:Y,disabled:!I,children:d(h?"Save":"Create")})]})]}),(0,ne.Y)(Rp,{isOpen:b,onEmojiSelect:L,onClose:S}),(0,ne.Y)(ci.A,{isOpen:k,title:d("AiToneDeleteStyle"),text:d("AiToneDeleteStyleConfirm"),confirmLabel:d("Delete"),confirmIsDestructive:!0,onClose:w,confirmHandler:F})]})})),Zp="tA81SxGH",Xp=(0,n.ph)((0,s.EK)(e=>({tones:e.aiComposeTones?.tones??gi.p,isAiToneEditorOpen:Boolean((0,c.nTw)(e).aiToneEditorModal)}))(({text:e,selectedTone:t,shouldEmojify:i,isLoading:o,result:r,error:l,isPremium:c,tones:d,isAiToneEditorOpen:h})=>{const{setAiMessageEditorStyleOptions:u,composeWithAiMessageEditor:m,openAiToneEditorModal:p,closeAiMessageEditorModal:g,deleteAiTone:v,openChatWithDraft:A}=(0,s.ko)(),f=(0,Bi.A)(),[C,b]=(0,n.J0)(),[y,S]=(0,n.J0)(!1),k=(0,T.A)(()=>{C&&(v({tone:C}),b(void 0))}),N=(0,T.A)(()=>{b(void 0)}),w=Boolean(r?.resultText),I=Boolean(t)||i,P=Boolean(l)&&I,Y=(0,T.A)(e=>{if(!("id"in e))return;const t=(0,Mp.fv)(e),i=[];return e.isCreator&&i.push({title:f("AiToneEditStyle"),icon:"edit",handler:()=>{p({toneToEdit:e})}}),i.push({title:f("AiToneShareStyle"),icon:"forward",handler:()=>{g(),A({text:{text:`${a.jsp}addstyle/${e.slug}`}})}}),i.push({title:f("AiToneDeleteStyle"),icon:"delete",destructive:!0,handler:()=>{b(t),S(Boolean(e.isCreator))}}),i}),F=(0,n.Kr)(()=>{const e=d.map(e=>({customEmojiDocumentId:e.emojiId,title:e.title,contextActions:Y(e)}));return d.length&&e.push({icon:"add",title:f("AiToneEditorNewStyle")}),e},[d,f,Y]),D=d.findIndex(e=>(0,Mp.pd)(t,(0,Mp.fv)(e))),M=(0,T.A)(e=>{if(e===d.length)return void p();const t=(0,Mp.fv)(d[e]);u({selectedTone:t}),m({tone:t,isEmojify:i})}),B=(0,T.A)(e=>{t||e?(u({shouldEmojify:e}),m({tone:t,isEmojify:e})):u({shouldEmojify:e,clearResult:!0})}),L=w?r?.resultText:e,x=I||o,R=f(x?"AiMessageEditorResult":"AiMessageEditorOriginal"),E=(D>=0?D:0)+(i?d.length:0);return(0,ne.FD)("div",{className:(0,ve.A)(Fp,"aewk4bnJ"),children:[(0,ne.FD)("div",{className:"qErGedf4",children:[F.length>0&&(0,ne.Y)(Ln.A,{tabs:F,activeTab:D,onSwitchTab:M,className:"rQS33JdR",tabClassName:"yqE8Sqon",indicatorClassName:"YwErZsMA",itemAlignment:"vertical"}),(0,ne.FD)("div",{className:(0,ve.A)("MywI2Bpe",F.length&&"hCBRNK1Z"),children:[(0,ne.Y)(Oi.A,{className:Zp,variant:"round",animation:"wave"}),(0,ne.Y)(Oi.A,{className:Zp,variant:"round",animation:"wave"}),(0,ne.Y)(Oi.A,{className:Zp,variant:"round",animation:"wave"}),(0,ne.Y)(Oi.A,{className:Zp,variant:"round",animation:"wave"}),(0,ne.Y)(Oi.A,{className:Zp,variant:"round",animation:"wave"})]})]}),(0,ne.Y)("div",{className:Ap}),(0,ne.FD)("div",{className:bp,children:[(0,ne.Y)(ae.Ay,{name:"fade",activeKey:x?1:0,className:"zqzd10Fz",slideClassName:"lrmOf0dP",children:(0,ne.Y)("span",{className:x?"s_SFKKbM":"b4tQkpHT",children:R})}),(0,ne.Y)(xp,{className:yp,controlClassName:Sp,labelClassName:kp,label:f("AiMessageEditorEmojify"),checked:Boolean(i),isRound:!0,onChange:B})]}),(0,ne.Y)(wp,{isLoading:o,transitionKey:E,children:P?(0,ne.Y)(Ip,{error:l,isPremium:c}):(0,ne.Y)("div",{className:"cp2quSKT",children:L?.text&&(0,Gi.fd)({text:L.text,entities:L.entities})})}),(0,ne.Y)(Pp,{textToCopy:L?.text,isHidden:o||P||!L?.text}),(0,ne.Y)(Qp,{isOpen:Boolean(h)}),(0,ne.Y)(ci.A,{isOpen:Boolean(C),title:f("AiToneDeleteStyle"),text:f(y?"AiToneDeleteStyleConfirmOwn":"AiToneDeleteStyleConfirm"),confirmLabel:f("Delete"),confirmIsDestructive:!0,onClose:N,confirmHandler:k})]})}));var eg=i(52603);const tg="aMNreDl5",ig="SCNivsRH",ng="E4qlH4cn",sg=(0,n.ph)((0,s.EK)(e=>({tones:e.aiComposeTones?.tones??gi.p}))(({selectedTone:e,style:t,tones:i,onSelectTone:n})=>{const s=(0,Bi.A)(),o=(0,T.A)(e=>{n(e)});if(i.length)return(0,ne.Y)("div",{className:(0,ve.A)("m1dRSg6D","TranslationToneSelector"),style:t,children:(0,ne.FD)("div",{className:"hdPPJ8FJ",children:[(0,ne.FD)("div",{className:(0,ve.A)(tg,!e&&ig),onClick:()=>o(void 0),children:[(0,ne.Y)("span",{className:"tfdfMWrV",children:"🏳️"}),(0,ne.Y)("span",{className:ng,children:s("TranslationToneNeutral")})]}),i.map(t=>{const i=(0,Mp.fv)(t);return(0,ne.FD)("div",{className:(0,ve.A)(tg,(0,Mp.pd)(e,i)&&ig),onClick:()=>o(i),children:[t.emojiId&&(0,ne.Y)(hs.A,{documentId:t.emojiId,size:20,shouldNotLoop:!0}),(0,ne.Y)("span",{className:ng,children:t.title})]},"tone"in t?t.tone:t.id)})]})})})),og=(0,n.ph)((0,s.EK)(e=>({tones:e.aiComposeTones?.tones??gi.p}))(({text:e,selectedLanguage:t,selectedTone:i,shouldEmojify:o,isLoading:r,result:l,error:c,isPremium:d,tones:h})=>{const{setAiMessageEditorTranslateOptions:u,composeWithAiMessageEditor:m}=(0,s.ko)(),p=(0,Bi.A)(),[g,v,A]=(0,D.A)(!1),[f,C]=(0,n.J0)(),b=(0,n.li)(),y=(0,eg.A)(e?.text),S=Boolean(c),k=p.code,N=(0,n.Kr)(()=>a.N89.map(e=>({langCode:e,displayName:new Intl.DisplayNames([k],{type:"language"}).of(e)||e})),[k]),w=(0,n.Kr)(()=>{if(y)return new Intl.DisplayNames([k],{type:"language"}).of(y)},[y,k]),I=(0,n.Kr)(()=>{if(t)return new Intl.DisplayNames([k],{type:"language"}).of(t)},[t,k]),P=(0,T.A)(e=>{u({selectedLanguage:e}),m({translateToLang:e,isEmojify:o,tone:i})}),Y=(0,T.A)(e=>{u({shouldEmojify:e}),t&&m({translateToLang:t,isEmojify:e,tone:i})}),F=(0,T.A)(()=>{if(b.current){const e=b.current.getBoundingClientRect();C({x:e.left,y:e.bottom}),v()}}),M=(0,T.A)(()=>b.current),B=(0,T.A)(()=>document.body),L=(0,T.A)(()=>document.querySelector(".language-menu .bubble")),x=(0,T.A)(()=>({withPortal:!0})),R=(0,T.A)(e=>{u({selectedTone:e}),t&&m({translateToLang:t,isEmojify:o,tone:e})}),E=l?.resultText,V=a.N89.indexOf(t||""),_=h.findIndex(e=>(0,Mp.pd)(i,(0,Mp.fv)(e))),U=a.N89.length,O=h.length,K=V+(_+1)*U+(o?U*(O+1):0);return(0,ne.FD)("div",{className:Fp,children:[(0,ne.FD)("div",{className:"_gNtGuCq",children:[(0,ne.FD)("div",{className:gp,children:[(0,ne.Y)("span",{className:vp,children:p("AiMessageEditorFrom")}),(0,ne.Y)("span",{className:"I48N7he1",children:w})]}),(0,ne.Y)(mp.A,{text:e?.text})]}),(0,ne.Y)("div",{className:Ap}),(0,ne.FD)("div",{className:bp,children:[(0,ne.FD)("div",{className:gp,children:[(0,ne.Y)("span",{className:vp,children:p("AiMessageEditorTo")}),(0,ne.FD)("span",{ref:b,className:"FuMqt_nq",onClick:F,children:[I,(0,ne.Y)("i",{className:"icon icon-down"})]}),(0,ne.FD)(it.A,{isOpen:g,anchor:f,getTriggerElement:M,getRootElement:B,getMenuElement:L,getLayout:x,className:(0,ve.A)("language-menu","with-menu-transitions","FIVSqg5v"),autoClose:!0,onClose:A,withPortal:!0,children:[(0,ne.Y)(sg,{selectedTone:i,onSelectTone:R}),(0,ne.Y)("div",{className:(0,ve.A)("ts9vJfIE","custom-scroll"),children:N.map(({langCode:e,displayName:t})=>(0,ne.Y)(me.A,{onClick:()=>P(e),children:t},e))})]})]}),(0,ne.Y)(xp,{className:yp,controlClassName:Sp,labelClassName:kp,label:p("AiMessageEditorEmojify"),checked:Boolean(o),isRound:!0,onChange:Y})]}),(0,ne.Y)(wp,{isLoading:r,transitionKey:K,children:S?(0,ne.Y)(Ip,{error:c,isPremium:d}):E&&(0,Gi.fd)({text:E.text,entities:E.entities})}),(0,ne.Y)(Pp,{textToCopy:l?.resultText?.text||e?.text,isHidden:r||S||!E?.text})]})})),ag=["translate","style","fix"],rg=Object.fromEntries(ag.map((e,t)=>[e,t])),lg=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.chatId,n=(0,dp.Xf)(e),s=(0,c.nTw)(e),o=i?(0,c.hds)(e,i):void 0,a=i?(0,c.WA9)(e,i):void 0,r=e.stars?.balance.amount||0,l=Boolean(s.starsBalanceModal);return{animationLevel:(0,Rn.Vu)(e),isPremium:(0,hp.g2)(e),isChatWithSelf:i?(0,c.nZ4)(e,i):void 0,canScheduleUntilOnline:n?.chatId?(0,c.RBq)(e,n.chatId):void 0,isInScheduledList:"scheduled"===n?.type,chat:o,paidMessagesStars:a,isPaymentMessageConfirmDialogOpen:s.isPaymentMessageConfirmDialogOpen,starsBalance:r,isStarsBalanceModalOpen:l}})(({modal:e,animationLevel:t,isPremium:i,isChatWithSelf:o,canScheduleUntilOnline:r,isInScheduledList:l,chat:c,paidMessagesStars:d,isPaymentMessageConfirmDialogOpen:h,starsBalance:u,isStarsBalanceModalOpen:m})=>{const{closeAiMessageEditorModal:p,setAiMessageEditorTab:g,applyAiMessageEditorResult:v,sendAiMessageEditorResult:A,composeWithAiMessageEditor:f,openCocoonModal:C}=(0,s.ko)(),b=(0,Bi.A)(),y=(0,n.li)(),[S,k]=(0,xm.A)(r),{isContextMenuOpen:N,handleContextMenu:w,handleContextMenuClose:I,handleContextMenuHide:P}=(0,As.A)(y,!e),Y=d||0,F=Boolean(d),{closeConfirmDialog:D,handleWithConfirmation:M,dialogHandler:B,shouldAutoApprove:L,setAutoApprove:x}=(0,ql.A)(Y,Boolean(m),u,!0);(0,n.vJ)(()=>{N||(P(),I())},[N,P,I]);const R=Boolean(e),E=(0,Ii.A)(e),{activeTab:V,text:_,translateTab:U,styleTab:O,fixTab:K}=E||{},J="translate"===V?U:"style"===V?O:K,j=J?.isLoading,G=J?.error,H=(0,n.Kr)(()=>[{icon:"language",title:b("AiMessageEditorTranslate")},{icon:"ai-edit",title:b("AiMessageEditorStyle")},{icon:"ai-fix",title:b("AiMessageEditorFix")}],[b]),z=rg[V||"style"]??1,$=(0,T.A)(e=>{const t=ag[e];if(g({tab:t}),_?.text)switch(t){case"translate":f({translateToLang:U?.selectedLanguage,tone:U?.selectedTone,isEmojify:U?.shouldEmojify});break;case"style":O?.selectedTone&&f({tone:O.selectedTone,isEmojify:O?.shouldEmojify});break;case"fix":f({shouldProofread:!0})}}),q=(0,T.A)(()=>{v()}),W=(0,T.A)(()=>{C()}),Q=(0,T.A)((e,t,i)=>{A({isSilent:e,scheduledAt:t,scheduleRepeatPeriod:i})}),Z=(0,T.A)(()=>{l?S((e,t)=>{A({scheduledAt:e,scheduleRepeatPeriod:t})}):M(Q)}),ee=(0,T.A)(()=>{M(Q,!0)}),ie=(0,T.A)(()=>{S((e,t)=>{A({scheduledAt:e,scheduleRepeatPeriod:t})})}),se=(0,T.A)(()=>{A({scheduledAt:a.NkL})});return(0,ne.FD)(te.A,{isOpen:R,title:b("AiMessageEditor"),hasCloseButton:!0,onClose:p,className:"WTBVX3Tb",headerClassName:"modal-header-condensed-wide",dialogClassName:"wVjOVLFw",contentClassName:"JPrLVFvv",headerRightToolBar:(0,ne.Y)(X.A,{className:"cYrg0Gvd",round:!0,size:"tiny",color:"translucent",iconName:"help",ariaLabel:b("ButtonHelp"),onClick:W}),isSlim:!0,children:[(0,ne.Y)(Ln.A,{tabs:H,activeTab:z,withFadeMask:!0,fadeMaskClassName:"qUAIo3of",className:"phZHdshp",tabClassName:"U0BzjL4g",stretched:!0,itemAlignment:"vertical",onSwitchTab:$}),(0,ne.Y)("div",{className:"pHXUvdNs",children:(0,ne.Y)(ae.Ay,{className:"HIqLoMfY",name:(0,Vn.P)("slideOptimized",t,void 0,b.isRtl),activeKey:z,renderCount:H.length,children:function(){switch(z){case 0:return(0,ne.Y)("div",{className:Yp,children:(0,ne.Y)(og,{text:_,selectedLanguage:U?.selectedLanguage,selectedTone:U?.selectedTone,shouldEmojify:U?.shouldEmojify,isLoading:U?.isLoading,result:U?.result,error:U?.error,isPremium:i})});case 1:return(0,ne.Y)("div",{className:Yp,children:(0,ne.Y)(Xp,{text:_,selectedTone:O?.selectedTone,shouldEmojify:O?.shouldEmojify,isLoading:O?.isLoading,result:O?.result,error:O?.error,isPremium:i})});case 2:return(0,ne.Y)("div",{className:Yp,children:(0,ne.Y)(Dp,{text:_,isLoading:K?.isLoading,result:K?.result,error:K?.error,isPremium:i})});default:return}}()})}),(0,ne.FD)("div",{className:"Zs8DrRr7",children:[(0,ne.Y)(X.A,{className:"V6DDmmjc",disabled:j||Boolean(G),onClick:q,children:b("AiMessageEditorApply")}),(0,ne.Y)(X.A,{ref:y,className:"ulGXwNTD",round:!0,color:"primary",disabled:j||Boolean(G),ariaLabel:b("Send"),onClick:Z,onContextMenu:l||d?void 0:w,iconName:"new-send",children:(0,ne.Y)(X.A,{className:(0,ve.A)("_c_kybEm",!F&&"i0YwTrlY"),nonInteractive:!0,size:"tiny",color:"stars",pill:!0,fluid:!0,children:(0,ne.FD)("div",{className:"Agg3XTrV",children:[(0,ne.Y)(he.A,{name:"star"}),(0,ne.Y)(wn.A,{text:b.number(Y)})]})})}),R&&!l&&(0,ne.Y)(up.A,{isOpen:N,canSchedule:!0,canScheduleUntilOnline:r,onSendSilent:o?void 0:ee,onSendSchedule:ie,onSendWhenOnline:se,onClose:I,onCloseAnimationEnd:P,isSavedMessages:o})]}),k,(0,ne.Y)(Wl.A,{isOpen:Boolean(h),onClose:D,userName:c?(0,Dt.F9)(b,c):void 0,messagePriceInStars:d||0,messagesCount:1,shouldAutoApprove:L,setAutoApprove:x,confirmHandler:B})]})})),cg=(0,n.ph)(({isOpen:e,onEmojiSelect:t,onClose:i})=>{const s=(0,Bi.A)(),o=(0,T.A)(e=>{t(e.id)}),a=(0,n.Kr)(()=>(0,ne.FD)(Gp,{children:[(0,ne.Y)($p,{}),(0,ne.Y)(zp,{children:s("AiToneEditorSelectEmoji")})]}),[s]);return(0,ne.Y)(qp,{isOpen:e,onClose:i,header:a,ariaLabel:s("AiToneEditorSelectEmoji"),width:"slim",noScrollable:!0,noContentInlinePadding:!0,keepMounted:!0,contentClassName:"gXwvtkIY",children:(0,ne.Y)("div",{className:"_pvT6yjm",children:(0,ne.Y)(qr,{idPrefix:"ai-tone-icon-",loadAndPlay:e,isHidden:!e,noAddButton:!0,onCustomEmojiSelect:o,onDismiss:i})})})}),dg="jlgUzZx3",hg="aEHvK0Hg",ug=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.tone?.authorId;return{author:i?(0,c.mBe)(e,i):void 0,maxExamples:e.appConfig.aiComposeToneExamplesNum}})(({modal:e,author:t,maxExamples:i=3})=>{const{closeAiTonePreview:o,saveAiTone:a,loadAiTonePreviewExample:r,openChat:l}=(0,s.ko)(),c=(0,Bi.A)(),d=Boolean(e),h=e?.tone,u=e?.example,m=e?.isAlreadyAdded,p=e?.slug,g=e?.hasExampleError,[v,A]=(0,n.J0)(0),f=(0,n.li)(0),C=(0,n.li)(),b=(0,n.li)(),y=(0,n.li)({before:4,after:4}),S=(0,T.A)(()=>{o(),A(0),f.current=0,y.current={before:4,after:4}}),k=(0,T.A)(()=>{h&&a({tone:(0,Mp.fv)(h)})}),N=(0,T.A)(()=>{h&&a({tone:(0,Mp.fv)(h),unsave:!0})}),w=(0,T.A)(()=>{if(!p)return;C.current&&b.current&&(y.current={before:Math.max(4,(0,Ji.A)(C.current).totalLines),after:Math.max(4,(0,Ji.A)(b.current).totalLines)});const e=(v+1)%i;f.current+=1,A(e),r({tone:{type:"slug",slug:p},num:e})}),I=(0,T.A)(()=>{h?.authorId&&(S(),l({id:h.authorId}))}),P=(0,n.Kr)(()=>(0,ne.Y)(Gp,{children:(0,ne.Y)($p,{})}),[]),{before:Y,after:F}=y.current,D=(0,n.Kr)(()=>(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(pp.A,{lines:Y,className:"QRAbvq5f"}),(0,ne.Y)("div",{className:Ap}),(0,ne.Y)("div",{className:gp,children:(0,ne.Y)("span",{className:vp,children:c("AiTonePreviewAfter")})}),(0,ne.Y)(pp.A,{lines:F,className:"QiZb7lJi"})]}),[c,Y,F]),M=(0,n.Kr)(()=>{if(h)return(0,ne.Y)("div",{className:"HjWmMDLy",children:m?(0,ne.Y)(X.A,{className:hg,onClick:h.isCreator?S:N,color:h.isCreator?void 0:"danger",isText:!h.isCreator,noForcedUpperCase:!0,children:c(h.isCreator?"Done":"AiTonePreviewRemoveStyle")}):(0,ne.Y)(X.A,{className:hg,onClick:k,children:c("AiTonePreviewAddStyle")})})},[h,m,c,S,N,k]);return(0,ne.Y)(qp,{isOpen:d,onClose:S,header:P,stickyFooter:M,dialogClassName:"IQiAhn4n",width:"slim",height:"regular",children:h&&(0,ne.FD)(ne.FK,{children:[h.emojiId&&(0,ne.Y)("div",{className:"XL6bxyh3",children:(0,ne.Y)("div",{className:"g5MQs6y4",children:(0,ne.Y)(hs.A,{documentId:h.emojiId,size:48})})}),(0,ne.Y)("div",{className:"vbg2wOsE",children:h.title}),(0,ne.Y)("div",{className:"M2vy26c8",children:c("AiTonePreviewSubtitle")}),(0,ne.FD)("div",{className:"zZ7xUGxY",children:[(0,ne.FD)("div",{className:gp,children:[(0,ne.Y)("span",{className:vp,children:c("AiTonePreviewBefore")}),(0,ne.FD)("button",{type:"button",className:"aIIDBsMl",onClick:w,children:[(0,ne.Y)(he.A,{name:"reload-arrows",className:"KSqXLmIA",style:`transform: rotate(${180*f.current}deg)`}),c("AiTonePreviewAnotherExample")]})]}),(0,ne.Y)(wp,{isLoading:!u&&!g,transitionKey:v,loadingElement:D,children:g?(0,ne.Y)("div",{className:Np,children:c("AiMessageEditorGenericError")}):u?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{ref:C,className:Cp,children:(0,Gi.fd)(u.from)}),(0,ne.Y)("div",{className:Ap}),(0,ne.Y)("div",{className:gp,children:(0,ne.Y)("span",{className:vp,children:c("AiTonePreviewAfter")})}),(0,ne.Y)("div",{ref:b,className:Cp,children:(0,Gi.fd)(u.to)})]}):void 0})]}),function(){if(!h)return;const e=h.installsCount||0,i=t?.usernames?.[0]?.username;if(!e&&!i)return;const n=i?(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:I,children:(0,xc.A)(i)}):void 0,s=e?c("AiTonePreviewUsedBy",{count:c.number(e)}):void 0,o=n?c("AiTonePreviewCreatedBy",{author:n},{withNodes:!0}):void 0;return s&&o?(0,ne.Y)("div",{className:dg,children:c("AiTonePreviewUsedByCreatedBy",{usedBy:s,createdBy:o},{withNodes:!0})}):(0,ne.Y)("div",{className:dg,children:s||o})}()]})})}));var mg=i(39074),pg=i(55153),gg=i(45761);const vg=document.createElement("div");var Ag=i(41316),fg=i(3225),Cg=i(25498),bg=i(9442),yg=i(1715),Sg=i(91525),kg=i(52988),Ng=i(27860);const wg="SHoF85Vw",Ig="Zo7u5epf",Pg=15*v.$,Yg=(0,n.ph)(({attachment:e,className:t,isSingle:i,shouldDisplayCompressed:s,shouldDisplayGrouped:o,index:r,onDelete:l,onToggleSpoiler:c,onEdit:d})=>{const h=(0,Bi.A)(),{isMobile:u}=(0,Y.Ay)(),m=function(e,t){if(t&&e.quick){if(a.gex.has(e.mimeType))return"photo";if(a.fNs.has(e.mimeType))return"video"}return"file"}(e,s),p=(0,T.A)(()=>{c?.(r)}),g=(0,T.A)(()=>{d?.(r)}),v=(0,n.Kr)(()=>{switch(m){case"photo":return(0,ne.Y)("img",{className:wg,src:e.blobUrl,alt:"",draggable:!1});case"video":return(0,ne.FD)(ne.FK,{children:[Boolean(e.quick?.duration)&&(0,ne.Y)("div",{className:"nI2M1SBH",children:(0,et.QO)(e.quick.duration)}),(0,ne.Y)("video",{className:wg,src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})]});default:{const t=a.gex.has(e.mimeType)&&!u;return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(kg.A,{className:"B6f6GcvN",name:e.filename,extension:(0,Sg.QC)(e.filename,e.mimeType),previewAttachment:e,size:e.size,previewSize:"large",onClick:t?g:void 0,actionIcon:t?"edit":void 0}),l&&(0,ne.Y)(he.A,{name:"delete",className:(0,ve.A)(Ig,"CYJwy9T_"),onClick:()=>l(r)})]})}}},[e,m,r,l,u]),A="file"===m||!o,f=Boolean("file"!==m&&e.shouldSendAsSpoiler),C="file"!==m,b=(0,ve.A)(t,"QucaiGVU",i&&"FjrnqGba",A&&"g0cTsM9d");return(0,ne.FD)("div",{className:b,dir:h.isRtl?"rtl":void 0,children:[v,(0,ne.Y)(Ng.A,{isVisible:f,thumbDataUri:e.previewBlobUrl||e.blobUrl,width:Pg,height:Pg}),C&&(0,ne.FD)("div",{className:"bX7LdgxW",children:["photo"===m&&d&&(0,ne.Y)(he.A,{name:"edit",className:Ig,onClick:g}),(0,ne.Y)(he.A,{name:e.shouldSendAsSpoiler?"spoiler-disable":"spoiler",className:Ig,onClick:p}),l&&(0,ne.Y)(he.A,{name:"delete",className:Ig,onClick:()=>l(r)})]})]})});var Fg=i(25897),Dg=i(49068);function Mg(e,t,i=!1){const n=e[i?"scrollLeft":"scrollTop"],s=n+e[i?"offsetWidth":"offsetHeight"],o=t[i?"offsetLeft":"offsetTop"],a=o+t[i?"offsetWidth":"offsetHeight"];return o>n&&a<s}function Tg(e,t,i=0,n=!1,s=!1,o=!1){const a=e[o?"scrollLeft":"scrollTop"],r=a+e[o?"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[o?"offsetLeft":"offsetTop"],u=c+t[o?"offsetWidth":"offsetHeight"];if(s?u>=a-i&&u<=r+i:c<=r+i&&u>=a-i)d.push(e),h=!0;else if(h&&!n)break}return{allElements:l,visibleIndexes:d}}function Bg(e,t,i){const n=i.current;if(!n||t<0)return;const{visibleIndexes:s,allElements:o}=Tg(n,e,8,!0,!0);if(!o.length||!o[t])return;const a=s[0];if(!s.includes(t)||t===a&&!Mg(n,o[a])){const e=t>s[s.length-1]?"start":"end";(0,br.Ay)({container:n,element:o[t],position:e,margin:10})}}function Lg({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:i,shouldRemoveSelectionOnReset:s,noArrowNavigation:o,items:a,shouldSelectOnTab:r,onSelect:l,onClose:c}){const[d,h]=(0,n.J0)(-1),u=(0,T.A)(e=>a?(0,Jo.A)(a.length,e):-1),m=(0,T.A)((e,t)=>{t.preventDefault(),h(t=>u(t+e))}),p=(0,T.A)(t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return!1;if(!e)return!1;if(a&&a.length&&d>-1){const e=a[d];if(e){if(!1===l(e))return!1;t.preventDefault()}}return!0});(0,n.vJ)(()=>{e||h(s?-1:0)},[e,s]);const g=!a||d>a.length-1;return(0,n.vJ)(()=>{i&&!g||h(s?-1:0)},[g,s,i]),(0,n.vJ)(()=>e?(0,Pi.A)({onEsc:c,onUp:o||t?void 0:e=>m(-1,e),onDown:o||t?void 0:e=>m(1,e),onLeft:o||!t?void 0:e=>m(-1,e),onRight:o||!t?void 0:e=>m(1,e),onTab:r?p:void 0,onEnter:p}):void 0,[o,m,p,e,t,c,r]),d}const xg=(0,n.ph)(({isOpen:e,onClose:t,onInsertUserName:i,filteredUsers:o})=>{const a=(0,n.li)(),{shouldRender:r,transitionClassNames:l}=(0,qe.A)(e,void 0,void 0,!1),c=(0,T.A)((e,t=!1)=>{const n=(0,s.mS)().users.byId[e];n&&i(n,t)}),d=(0,T.A)((e,t)=>{e.preventDefault(),c(t)}),h=(0,T.A)(e=>{c(e.id,!0)}),u=Lg({isActive:e,items:o,onSelect:h,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,n.vJ)(()=>{Bg(".chat-item-clickable",u,a)},[u]),(0,n.vJ)(()=>{o&&!o.length&&t()},[o,t]);const m=(0,K.A)(o?.length?o:void 0,r),p=o&&!o.length?m:o;if(!r||p&&!p.length)return;const g=(0,ve.A)("MentionTooltip composer-tooltip custom-scroll",l);return(0,ne.Y)("div",{className:g,ref:a,children:p?.map(({id:e},t)=>(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item smaller-icon",onClick:d,clickArg:e,focus:u===t,children:(0,ne.Y)(An.A,{userId:e,avatarSize:"small",withUsername:!0,noUserStatus:!0})},e))})});var Rg=i(78407),Eg=i(26440);const Vg="AT_d9l0W",_g="AnO3BgVv",Ug="caption-input-text",Og=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{currentUserId:i,recentEmojis:n,customEmojis:s,attachmentSettings:o}=e,{shouldSaveAttachmentsCompression:r,shouldOpenMessageMediaEditor:l,aiMessageEditorPendingResult:d}=(0,c.nTw)(e),h=(0,c.AWZ)(e,t),u=(0,c.nZ4)(e,t),{shouldSuggestCustomEmoji:m}=e.settings.byKey,{language:p}=(0,Rn.lS)(e),g=e.emojiKeywords[a.cUY],v=p!==a.cUY?e.emojiKeywords[p]:void 0;return{isChatWithSelf:u,currentUserId:i,groupChatMembers:h?.members,topGuestBotIds:e.topPeerCategories.botsGuestChat?.peerIds,recentEmojis:n,baseEmojiKeywords:g?.keywords,emojiKeywords:v?.keywords,shouldSuggestCustomEmoji:m,customEmojiForEmoji:s.forEmoji.stickers,captionLimit:(0,In.d)(e,"captionLength"),attachmentSettings:o,shouldSaveAttachmentsCompression:r,shouldOpenMessageMediaEditor:l,aiMessageEditorPendingResult:d}})(({chatId:e,threadId:t,attachments:i,getHtml:o,editingMessage:c,canShowCustomSendMenu:d,captionLimit:h,isReady:u,isChatWithSelf:p,currentUserId:g,groupChatMembers:v,topGuestBotIds:A,recentEmojis:f,baseEmojiKeywords:C,emojiKeywords:b,isForMessage:y,shouldSchedule:S,shouldSuggestCustomEmoji:k,customEmojiForEmoji:N,attachmentSettings:w,shouldSaveAttachmentsCompression:I,shouldForceCompression:P,shouldForceAsFile:F,isForCurrentMessageList:M,forceDarkTheme:B,canScheduleUntilOnline:L,canSchedule:x,paidMessagesStars:R,shouldOpenMessageMediaEditor:E,aiMessageEditorPendingResult:V,onAttachmentsUpdate:_,onCaptionUpdate:U,onSend:O,onFileAppend:J,onClear:j,onSendSilent:G,onSendScheduled:z,onCustomEmojiSelect:$,onRemoveSymbol:q,onEmojiSelect:W,onSendWhenOnline:Q})=>{const Z=(0,n.li)(),ee=(0,n.li)(),{addRecentCustomEmoji:ie,addRecentEmoji:se,updateAttachmentSettings:oe,resetMessageMediaEditorRequest:ae,updateShouldSaveAttachmentsCompression:re,openAiMessageEditorModal:le,clearAiMessageEditorPendingResult:ce}=(0,s.ko)(),de=(0,Bi.A)(),he=(0,n.li)(),pe=(0,n.li)(),ge=(0,n.li)(),Ae=(0,K.A)(i),fe=i.length?i:Ae,{isMobile:Ce}=(0,Y.Ay)(),be=c&&Boolean(c),ye=c&&c?.groupedId,ke="file"!==(be&&i?.length&&(0,l.ES)(i[0])),we=fe?.some(e=>e.gif),[Ie,Pe,Ye]=(0,D.A)(),[Fe,De]=(0,n.J0)(void 0),[Me,Te]=(0,n.J0)(!1),Be=(0,Se.A)(()=>o(),[o]),Le=void 0!==Fe?i[Fe]:void 0;(0,n.vJ)(()=>{E&&i.length&&(De(0),ae())},[E,i.length]);const xe=w.shouldCompress,Re=Boolean((xe||P||ye||we)&&!F),[Ee,Ve]=(0,n.J0)(w.shouldSendGrouped),_e=w.isInvertedMedia,[Ue,Oe]=(0,n.J0)(w.shouldSendInHighQuality),[Ke,Je]=(0,n.J0)(Ue),je=Boolean(i.length),Ge=Boolean(fe?.length),[He,ze,$e]=(0,D.A)(),qe=(0,n.li)();(0,n.vJ)(()=>{je||(Ye(),oe({isInvertedMedia:void 0}))},[Ye,je]),(0,n.vJ)(()=>{we&&(re({shouldSave:!1}),Ve(!1))},[we,re]);const[We,Qe]=(0,n.Kr)(()=>Boolean(fe?.every(e=>e.quick||e.audio))?[!0,!0]:[Boolean(fe?.some(e=>e.quick||e.audio)),!1],[fe]),[Ze,Xe]=(0,n.Kr)(()=>Boolean(fe?.every(e=>e.shouldSendAsSpoiler))?[!0,!0]:[Boolean(fe?.some(e=>e.shouldSendAsSpoiler)),!1],[fe]),et=(0,Ag.A)(`#${a.e0F}`),{isEmojiTooltipOpen:tt,filteredEmojis:it,filteredCustomEmojis:nt,insertEmoji:st,closeEmojiTooltip:ot}=(0,Cg.A)(Boolean(u&&(M||!y)&&Ge),o,U,a.e0F,f,C,b),{isCustomEmojiTooltipOpen:at,insertCustomEmoji:rt,closeCustomEmojiTooltip:lt}=(0,fg.A)(Boolean(u&&(M||!y)&&Ge&&k),o,U,et,pe,N),{isMentionTooltipOpen:ct,closeMentionTooltip:dt,insertMention:ht,mentionFilteredUsers:ut}=(0,bg.A)(Boolean(u&&M&&Ge),o,U,et,pe,v,void 0,A,g);function mt(e){oe({isInvertedMedia:e})}(0,n.vJ)(()=>je?(0,m.A)(j):void 0,[je,j]),(0,n.vJ)(()=>{je&&(Ve(w.shouldSendGrouped),Oe(w.shouldSendInHighQuality))},[w,je]),(0,n.vJ)(()=>{je||oe({isInvertedMedia:void 0})},[oe,je]),(0,n.vJ)(()=>{je&&Ce&&(0,mg.DY)()},[Ce,je]);const{isContextMenuOpen:pt,handleContextMenu:gt,handleContextMenuClose:vt,handleContextMenuHide:At}=(0,As.A)(he,!d||!je);(0,n.vJ)(()=>{(0,r.YS)(()=>{const e=pe.current;if(!Be||!e)return void Te(!1);const{totalLines:t}=(0,Ji.A)(e,!0);Te(t>=3)})},[Be,je]);const ft=(0,T.A)(()=>{const{text:t,entities:i}=(0,ep.A)(o());le({chatId:e,text:{text:t,entities:i},isFromAttachment:!0})}),Ct=(0,T.A)((e,t,i)=>{je&&((S||t)&&y&&!c?z(Re,Ee,_e,"number"==typeof t?t:void 0,i):e?G(Re,Ee,_e):O(Re,Ee,_e),oe({...I&&{defaultAttachmentCompression:w.shouldCompress?"compress":"original"},shouldSendGrouped:Ee,isInvertedMedia:_e,shouldSendInHighQuality:Ue}))}),bt=(0,T.A)(()=>{if(!V?.shouldSendWithAttachments||!je)return;const{text:e,isSilent:t,scheduledAt:i,scheduleRepeatPeriod:n}=V;e&&U((0,Gi.QY)(e)),Ct(t,i,n),ce()});(0,n.vJ)(()=>{bt()},[V,bt]);const yt=(0,T.A)(()=>{Ct(!0)}),St=(0,T.A)(()=>{Ct()}),kt=(0,T.A)(()=>{Ct(!1,!0)}),Nt=(0,T.A)(async e=>{e.preventDefault(),$e();const{dataTransfer:t}=e,i=await(0,gg.A)(t.items);i?.length&&J(i,Xe)}),wt=(0,T.A)(e=>{const{files:t}=e.target,i=(0,H.kc)(t);i?.length&&J(i,Xe)}),It=(0,T.A)(()=>{(0,iu.p)("*",e=>wt(e))}),Pt=(0,T.A)(e=>{_(i.filter((t,i)=>i!==e))}),Yt=(0,T.A)(()=>{_(i.map(e=>({...e,shouldSendAsSpoiler:!0})))}),Ft=(0,T.A)(()=>{oe({shouldCompress:!xe})}),Dt=(0,T.A)(()=>{const e=!Ue;Oe(e),oe({shouldSendInHighQuality:e})}),Mt=(0,T.A)(()=>{_(i.map(e=>({...e,shouldSendAsSpoiler:void 0})))}),Tt=(0,T.A)(e=>{_(i.map((t,i)=>i===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t))}),Bt=(0,T.A)(e=>{De(e)}),Lt=(0,T.A)(()=>{De(void 0)}),xt=(0,T.A)(async e=>{if(void 0===Fe)return;const t=await(0,pg.Ay)(e.name,e,{shouldSendAsFile:i[Fe].shouldSendAsFile,shouldSendAsSpoiler:i[Fe].shouldSendAsSpoiler,shouldSendInHighQuality:i[Fe].shouldSendInHighQuality});_(i.map((e,i)=>i===Fe?t:e)),De(void 0)}),Rt=(0,T.A)(()=>{const e=ee.current;if(!e)return;const{width:t,height:i}=e.getBoundingClientRect();e.viewBox.baseVal.width=t,e.viewBox.baseVal.height=i});(0,Lr.A)(Z,Rt),(0,Ne.A)(Rt),(0,n.vJ)(()=>{const e=he.current,t=document.getElementById(Ug);if(!e||!t)return;const{width:i}=e.getBoundingClientRect();(0,r.RK)(()=>{t.style.setProperty("--margin-for-scrollbar",`${i}px`)})},[de,je]);const Et=(0,n.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,ne.Y)(X.A,{round:!0,ripple:!Ce,size:"tiny",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[Ce]),Vt=(0,Se.A)(()=>{if(!Ge)return;const e=h-function(e){return vg.innerHTML=e,(0,ep.g)(vg),vg.querySelectorAll("br").forEach(e=>{e.replaceWith("\n")}),vg.textContent?.trim().length||0}(o());return e<=100?e:void 0},[h,o,Ge]),_t=Re&&Qe,{areAllPhotos:Ut,areAllVideos:Ot,areAllAudios:Kt,hasAnyPhoto:Jt}=(0,n.Kr)(()=>_t&&fe?{areAllPhotos:fe.every(e=>a.gex.has(e.mimeType)),areAllVideos:fe.every(e=>a.fNs.has(e.mimeType)),areAllAudios:fe.every(e=>a.IH3.has(e.mimeType)),hasAnyPhoto:fe.some(e=>a.gex.has(e.mimeType))}:{areAllPhotos:!1,areAllVideos:!1,areAllAudios:!1,hasAnyPhoto:!1},[fe,_t]),jt=(0,n.Kr)(()=>!!fe&&fe.some(e=>!a.IH3.has(e.mimeType)),[fe]);if((0,n.vJ)(()=>{if(Ue!==Ke)return qe.current&&clearTimeout(qe.current),qe.current=window.setTimeout(()=>{Je(Ue)},200),()=>{qe.current&&(clearTimeout(qe.current),qe.current=void 0)}},[Ue,Ke]),!fe)return;const Gt=fe.length>1,Ht=!(be||!We||!(F||P||Re)||Gt&&Ee);let zt="";const $t=fe.length;zt=de(Ut?`Attachment${be?"Replace":"Send"}Photo`:Ot?`Attachment${be?"Replace":"Send"}Video`:Kt?`Attachment${be?"Replace":"Send"}Audio`:`Attachment${be?"Replace":"Send"}File`,{count:$t},{pluralValue:$t});const qt=R?(0,Fi.U2)(de,$t*R,{asFont:!0}):void 0;return(0,ne.FD)(te.A,{isOpen:je,header:function(){if(fe)return(0,ne.FD)("div",{className:"modal-header-condensed-wide",dir:de.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:"Cancel attachments",onClick:j,iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:zt}),ke&&!ye&&(0,ne.FD)(ue.A,{className:"with-menu-transitions",trigger:Et,positionX:"right",children:[Boolean(!c)&&!we&&(0,ne.Y)(me.A,{icon:"add",onClick:It,children:de("Add")}),We&&(0,ne.FD)(ne.FK,{children:[Ht&&(_e?(0,ne.Y)(me.A,{icon:"move-caption-down",onClick:()=>mt(void 0),children:de("ContextMoveTextDown")}):(0,ne.Y)(me.A,{icon:"move-caption-up",onClick:()=>mt(!0),children:de("ContextMoveTextUp")})),!F&&!P&&!we&&(Re?(0,ne.Y)(me.A,{icon:"document",onClick:Ft,children:de(Gt?"AttachmentMenuSendAllAsFiles":"AttachmentMenuSendAsFiles")}):(0,ne.Y)(me.A,{icon:"photo",onClick:Ft,children:de(Gt?"AttachmentMenuSendAllAsMedia":"AttachmentMenuSendAsMedia")})),Re&&!c&&Jt&&(0,ne.Y)(me.A,{icon:Ke?"sd-photo":"hd-photo",onClick:Dt,children:de(Ke?"SendInStandardQuality":"SendInHighQuality")}),Re&&jt&&Boolean(!c)&&(Ze?(0,ne.Y)(me.A,{icon:"spoiler-disable",onClick:Mt,children:de("AttachmentMenuDisableSpoiler")}):(0,ne.Y)(me.A,{icon:"spoiler",onClick:Yt,children:de("AttachmentMenuEnableSpoiler")}))]}),Gt&&(Ee?(0,ne.Y)(me.A,{icon:"grouped-disable",onClick:()=>Ve(!1),children:de("AttachmentMenuUngroupAllMedia")}):(0,ne.Y)(me.A,{icon:"grouped",onClick:()=>Ve(!0),children:de("AttachmentMenuGroupAllMedia")}))]})]})}(),className:(0,ve.A)("a27O2Qlr",He&&_g,Ce&&"khvUZbGZ",Ie&&"ir5kkMy1",B&&"component-theme-dark"),hasAbsoluteCloseButton:Boolean(fe),noBackdropClose:!0,isLowStackPriority:!0,onClose:j,children:[(0,ne.FD)("div",{className:Vg,onDragEnter:ze,onDrop:Nt,onDragOver:function(e){e.preventDefault(),ge.current&&(window.clearTimeout(ge.current),ge.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:i}=e;i.matches(`.${Vg}`)&&!t&&(ge.current=window.setTimeout($e,150)),i&&i.closest(`.${_g}`)||(t&&e.stopPropagation(),$e())},onClick:$e,"data-attach-description":de("AttachmentDragAddItems"),"data-dropzone":!0,children:[(0,ne.Y)("svg",{className:"d9O65j_I",children:(0,ne.Y)("rect",{className:"jzCBDWMw",x:"0",y:"0",width:"100%",height:"100%",rx:"8"})}),(0,ne.Y)("div",{className:(0,ve.A)("_bxSIFgj","custom-scroll",!Re&&"xo5WijLn"),children:fe.map((e,t)=>(0,ne.Y)(Yg,{attachment:e,shouldDisplayCompressed:Re,shouldDisplayGrouped:Ee,isSingle:1===fe.length,index:t,onDelete:Pt,onToggleSpoiler:Tt,onEdit:Ce?void 0:Bt},e.uniqueId||t))}),(0,ne.FD)("div",{className:(0,ve.A)("EtmiUn2k"),children:[(0,ne.Y)(X.A,{round:!0,size:"tiny",color:"translucent",tabIndex:Me?0:-1,className:(0,ve.A)("eiheQYtJ",!Me&&"NmjNsgLA"),onClick:ft,ariaLabel:de("AiMessageEditor"),iconName:"ai"}),(0,ne.Y)(xg,{isOpen:ct,filteredUsers:ut,onInsertUserName:ht,onClose:dt}),(0,ne.Y)(Dg.A,{isOpen:tt,emojis:it,customEmojis:nt,addRecentEmoji:se,addRecentCustomEmoji:ie,onEmojiSelect:st,onCustomEmojiSelect:st,onClose:ot}),(0,ne.Y)(Fg.A,{chatId:e,isOpen:at,addRecentCustomEmoji:ie,onCustomEmojiSelect:rt,onClose:lt}),(0,ne.FD)("div",{className:"Te7lIfpB",children:[(0,ne.Y)(Eg.A,{chatId:e,threadId:t,isMobile:Ce,isReady:u,isSymbolMenuOpen:Ie,openSymbolMenu:Pe,closeSymbolMenu:Ye,onCustomEmojiSelect:$,onRemoveSymbol:q,onEmojiSelect:W,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:B}),(0,ne.Y)(Rg.A,{ref:pe,id:Ug,chatId:e,threadId:t,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:u,isActive:je,getHtml:o,editableInputId:a.e0F,placeholder:de("AttachmentCaptionPlaceholder"),onUpdate:U,onSend:St,canAutoFocus:Boolean(u&&M&&i.length),captionLimit:Vt,shouldSuppressFocus:Ce&&Ie,onSuppressedFocus:Ye}),(0,ne.FD)("div",{className:"wDqWK9MD",children:[(0,ne.Y)(X.A,{ref:he,className:"kNlWmBJI",size:"smaller",inline:!0,onClick:St,onContextMenu:d?gt:void 0,iconName:c||S||R?void 0:"new-send",iconClassName:"YhSs6nkg",children:S&&!c?de("Next"):c?de("Save"):qt}),d&&(0,ne.Y)(up.A,{isOpen:pt,canSchedule:x&&y,onSendSilent:p?void 0:yt,onSendSchedule:kt,onClose:vt,onCloseAnimationEnd:At,isSavedMessages:p,onSendWhenOnline:Q,canScheduleUntilOnline:L})]})]})]})]}),(0,ne.Y)(yg.A,{isOpen:Boolean(Le),imageUrl:Le?.blobUrl,mimeType:Le?.mimeType,filename:Le?.filename,onClose:Lt,onSave:xt})]})}));var Kg=i(14235),Jg=i(27102);const jg=4*v.$,Gg=.5*v.$;function Hg(e,t){const{top:i,bottom:n}=e.getBoundingClientRect(),{scrollTop:s,scrollHeight:o,clientHeight:a}=e,r=t-i,l=n-t,c=o-a;if(r<jg&&s>0){const e=jg-Math.max(r,0),t=-Math.min(zg(e),s);return{delta:t,targetScrollTop:s+t}}if(l<jg&&s<c){const e=jg-Math.max(l,0),t=Math.min(zg(e),c-s);return{delta:t,targetScrollTop:s+t}}}function zg(e){return $g(e/jg*Gg,1,Gg)}function $g(e,t,i){return Math.min(Math.max(e,t),i)}var qg=i(57003),Wg=i(65036);const Qg="K_83OtXu",Zg="DPygKSBN",Xg=[hi.dp,3*hi.dp,8*hi.dp,hi.d_,3*hi.d_],ev=({iconName:e,iconBackgroundColor:t,label:i,description:n,checked:s,disabled:o,locked:a,onChange:r})=>(0,ne.Y)(Bp.Ay,{asLabel:!0,clickable:!0,disabled:o,children:(0,ne.FD)(Tp.Ay,{inputEnd:!0,children:[(0,ne.Y)(Nh.A,{checked:s,disabled:o,locked:a,onChange:r}),(0,ne.Y)(Tp.xh,{iconName:e,backgroundColor:t}),(0,ne.Y)(Tp.mq,{children:i}),void 0!==n?(0,ne.Y)(Tp.eI,{children:n}):void 0]})}),tv=({iconName:e,iconBackgroundColor:t,label:i,value:n,onClick:s})=>(0,ne.Y)(Bp.Ay,{clickable:!0,onClick:s,children:(0,ne.FD)(Tp.Ay,{children:[(0,ne.Y)(Tp.xh,{iconName:e,backgroundColor:t}),(0,ne.Y)(Tp.mq,{children:i}),(0,ne.Y)(Tp.Al,{className:"T9lWgftm",children:n})]})});function iv(e=""){return{id:(0,Kg.t)().toString(),text:e}}function nv(e,t){const i=[...e];for(;i.length>1&&!i[i.length-1].text.trim()&&!i[i.length-2].text.trim();)i.pop();return i.length||i.push(iv()),i.length<t&&i[i.length-1].text.trim()&&i.push(iv()),i}const sv=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=(0,c.nTw)(e),{chatId:n}=t,s=(0,c.hds)(e,n);return{chat:s,isChannel:s?(0,l.WX)(s):void 0,pollMaxAnswers:e.appConfig.pollMaxAnswers,pollClosePeriodMax:e.appConfig.pollClosePeriodMax,paidMessagesStars:(0,c.WA9)(e,n),isPaymentMessageConfirmDialogOpen:i.isPaymentMessageConfirmDialogOpen,starsBalance:e.stars?.balance.amount||0,isStarsBalanceModalOpen:Boolean(i.starsBalanceModal),isSilentPosting:s?(0,Hc.RY)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id))?.isSilentPosting:void 0}})(({modal:e,isOpen:t,chat:i,isChannel:o,pollMaxAnswers:a,pollClosePeriodMax:l,paidMessagesStars:c,isPaymentMessageConfirmDialogOpen:d,starsBalance:h,isStarsBalanceModalOpen:u,isSilentPosting:m})=>{const{closePollModal:p,sendMessage:g}=(0,s.ko)(),v=(0,Bi.A)(),A=(0,n.li)(),f=(0,n.li)(),C=(0,n.li)(),[b,y]=(0,n.J0)(""),[S,k]=(0,n.J0)(""),[N,w]=(0,n.J0)(()=>[iv()]),[I,P]=(0,n.J0)(!0),[Y,F]=(0,n.J0)(!0),[D,M]=(0,n.J0)(Boolean(e.isQuiz)),[B,L]=(0,n.J0)([]),[x,R]=(0,n.J0)(""),[E,V]=(0,n.J0)(!0),[_,U]=(0,n.J0)(!0),[O,K]=(0,n.J0)(!1),[J,G]=(0,n.J0)(),[H,z]=(0,n.J0)(),[$,q]=(0,n.J0)(()=>(0,Di.Fm)()),[W,Q]=(0,n.J0)(!1),[Z,te]=(0,n.J0)(!1),[ie,se]=(0,n.J0)(!1),[oe,ae]=(0,xm.A)(),{isContextMenuOpen:re,handleContextMenu:le,handleContextMenuClose:ce,handleContextMenuHide:de}=(0,As.A)(A,!t||"scheduled"===e.messageListType),{isContextMenuOpen:ue,handleContextMenu:pe,handleContextMenuClose:ge,handleContextMenuHide:Ae}=(0,As.A)(C,!t),{closeConfirmDialog:fe,dialogHandler:Ce,shouldAutoApprove:be,setAutoApprove:ye,handleWithConfirmation:Se}=(0,ql.A)(c||0,u,h,!0);(0,n.vJ)(()=>{o&&(P(!1),V(!1))},[o]),(0,n.vJ)(()=>{!D&&I||V(!1)},[I,D]),(0,n.vJ)(()=>{J||H||Q(!1)},[H,J]),(0,n.vJ)(()=>{!Y&&B.length>1&&L(B.slice(0,1))},[B,Y]);const ke=(0,n.Kr)(()=>N.map(e=>({id:e.id,text:e.text.trim().substring(0,100)})).filter(({text:e})=>Boolean(e)),[N]),Ne=(0,n.Kr)(()=>B.reduce((e,t)=>{const i=ke.findIndex(e=>e.id===t);return i>=0&&e.push(i),e},[]),[B,ke]),we=(0,n.Kr)(()=>ke.map(({id:e})=>e),[ke]),Ie=(0,n.Kr)(()=>b.trim().substring(0,255),[b]),Pe="scheduled"===e.messageListType,Ye=Boolean(!c&&!i?.isMonoforum),Fe=Z&&D&&!Ne.length,De=D||!I,Me=Math.max(a-ke.length,0),Te=!Ie||ke.length<1||D&&!Ne.length,Be=void 0!==J||void 0!==H,Le=void 0!==H?(0,et.L2)(1e3*H,v.code,!0):void 0!==J?(0,et.A$)(v,J):v("PollSelectCloseDate"),xe=1e3*($+l),Re=void 0!==H?1e3*H:1e3*($+(J||hi.d_)),Ee={chatId:e.chatId,threadId:e.threadId||j.l3,type:"scheduled"===e.messageListType?"scheduled":"thread"},Ve=(0,T.A)(()=>{p()}),_e=(0,T.A)(e=>{w(t=>{const i=new Map(t.map(e=>[e.id,e]));return nv(e.reduce((e,t)=>{const n=i.get(t);return n&&e.push(n),e},[]),a)})}),{draggedId:Ue,getRowProps:Oe,getDragElementProps:Ke,getHandleProps:Je,getPlaceholderStyle:je,getDragStyle:Ge}=function({itemIds:e,isDisabled:t,withAutoscroll:i,onReorder:s}){const o=(0,n.li)(new Map),a=(0,n.li)(new Map),l=(0,n.li)(new Map),c=(0,n.li)(e),d=(0,n.li)(),h=(0,n.li)(!1),u=(0,n.li)(),m=(0,n.li)(),[p,g]=(0,n.Ul)(),[v,A]=(0,n.J0)(),[f,C]=(0,n.J0)();(0,n.vJ)(()=>{c.current=e;const t=d.current;void 0!==t&&(d.current=void 0,l.current?.get(t)?.focus())},[e]);const b=(0,T.A)((e,t)=>{if(e===t)return;const i=function(e,t,i){const n=[...e],[s]=n.splice(t,1);return n.splice(i,0,s),n}(c.current,e,t);c.current=i,s(i)}),y=(0,T.A)((e,t,i)=>{const n=c.current;if(n.indexOf(e)<0)return;const a=n.filter(t=>t!==e),r=function(e,t,i,n){const s=e.reduce((e,i)=>{const n=t.get(i);if(!n)return e;const{top:s,height:o}=n.getBoundingClientRect();return e.push({id:i,top:s,height:o}),e},[]);if(s.sort((e,t)=>e.top-t.top),n){let t=0;for(const{id:n,top:o}of s)i>=o&&(t=e.indexOf(n)+1);return t}for(const{id:t,top:n,height:o}of s)if(i<=n+o)return e.indexOf(t);return e.length}(a,o.current,t,i),l=[...a];l.splice(r,0,e),(0,Jg.vq)(n,l)||(c.current=l,s(l))}),S=(0,T.A)((e,t)=>{const i=p();if(!i)return;const n=function(e,t){return e.reduce((e,i)=>{const n=t.get(i);if(!n)return e;const{top:s,bottom:o}=n.getBoundingClientRect();return e?{top:Math.min(e.top,s),bottom:Math.max(e.bottom,o)}:{top:s,bottom:o}},void 0)}(c.current,o.current),s=e-i.offsetY,l=n?$g(s,n.top,Math.max(n.top,n.bottom-i.height)):s,d=l-i.top,h=l+i.height/2,u={...i,centerY:h,translateY:d};g(u),(0,r.RK)(()=>{const e=p(),t=a.current.get(i.id);e===u&&t&&(t.style.transform=`translateY(${u.translateY}px)`)}),y(i.id,h,t??h>i.centerY)}),k=(0,T.A)(()=>{h.current=!0,(0,r.YS)(()=>{const e=p(),t=u.current,i=m.current;if(!e||!t||void 0===i)return void(h.current=!1);const n=Hg(t,i);n?(0,r.RK)(()=>{const s=p();s===e&&u.current===t?(t.scrollTop=n.targetScrollTop,n.delta&&(0,r.YS)(()=>{S(i,n.delta>0)}),k()):s&&u.current===t||(h.current=!1)}):h.current=!1})}),N=(0,T.A)(e=>{const t=u.current;!h.current&&t&&Hg(t,e)&&k()}),w=(0,T.A)(e=>{e.cancelable&&e.preventDefault();const{y:t}=(0,He.A)(e);m.current=t,S(t),N(t)}),I=(0,T.A)(()=>{const e=p(),t=e?a.current.get(e.id):void 0;if(e&&t){const i=e.id;(0,r.RK)(()=>{p()?.id!==i&&a.current.get(i)===t&&(t.style.transform="")})}h.current=!1,u.current=void 0,m.current=void 0,g(void 0),A(void 0),C(void 0)});(0,n.vJ)(()=>{if(void 0!==v)return document.addEventListener("mousemove",w),document.addEventListener("mouseup",I),document.addEventListener("touchmove",w,{passive:!0}),document.addEventListener("touchend",I),document.addEventListener("touchcancel",I),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",I),document.removeEventListener("touchmove",w),document.removeEventListener("touchend",I),document.removeEventListener("touchcancel",I)}},[v]);const P=(0,T.A)((e,n)=>{if(t||c.current.length<2)return;if("button"in e&&0!==e.button)return;e.preventDefault(),e.stopPropagation();const s=o.current.get(n);if(!s)return;const{y:a}=(0,He.A)(e);m.current=a;const{left:r,top:l,width:d,height:h}=s.getBoundingClientRect();g({id:n,offsetY:a-l,left:r,top:l,centerY:l+h/2,translateY:0,width:d,height:h}),A(n),C(h),u.current=i?function(e){let t=e.parentElement;for(;t;){if(t.scrollHeight>t.clientHeight)return t;t=t.parentElement}}(s):void 0,N(a)}),Y=(0,T.A)((e,i)=>{if(t||c.current.length<2)return;const n=c.current.indexOf(i);if(n<0)return;const s="ArrowUp"===e.key?-1:"ArrowDown"===e.key?1:0;if(!s)return;const o=n+s;o<0||o>=c.current.length||(e.preventDefault(),e.stopPropagation(),d.current=i,b(n,o))}),F=(0,T.A)(e=>({ref:t=>{t?o.current?.set(e,t):o.current?.delete(e)}})),D=(0,T.A)(i=>({ref:e=>{e?l.current?.set(i,e):l.current?.delete(i)},role:"button",tabIndex:t||e.length<2?-1:0,onMouseDown:e=>P(e,i),onTouchStart:e=>P(e,i),onKeyDown:e=>Y(e,i)})),M=(0,T.A)(e=>({ref:t=>{if(t){a.current?.set(e,t);const i=p();i?.id===e&&(t.style.transform=`translateY(${i.translateY}px)`)}else a.current?.delete(e)}})),B=(0,T.A)(e=>{if(v===e&&void 0!==f)return`height: ${f}px`}),L=(0,T.A)(e=>{const t=p();if(t?.id===e)return(0,ot.A)("position: fixed",`left: ${t.left}px`,`top: ${t.top}px`,`transform: translateY(${t.translateY}px)`,`width: ${t.width}px`,`height: ${t.height}px`)});return{draggedId:v,getRowProps:F,getDragElementProps:M,getHandleProps:D,getPlaceholderStyle:B,getDragStyle:L}}({itemIds:we,withAutoscroll:!0,onReorder:_e}),ze=(0,T.A)((e,t)=>{const i=N.map(i=>i.id===e?{...i,text:t}:i);w(nv(i,a))}),$e=(0,T.A)(e=>{const t=nv(N.filter(t=>t.id!==e),a);w(t),L(B.filter(t=>t!==e))}),qe=(0,T.A)(e=>{L(Y?t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]:[e])}),We=(0,T.A)(e=>{if("Enter"!==e.key)return;if(e.preventDefault(),!f.current)return;const t=f.current.querySelectorAll(`.${Zg} input`),i=t[t.length-1];i&&(0,r.YS)(()=>{i.focus()})}),Qe=(0,T.A)(e=>{y(e.currentTarget.value)}),Ze=(0,T.A)(e=>{k(e.currentTarget.value)}),Xe=(0,T.A)(e=>{R(e.currentTarget.value)}),tt=(0,T.A)(e=>{M(e)}),nt=(0,T.A)(e=>{F(e)}),st=(0,T.A)(e=>{if(!e)return G(void 0),z(void 0),void Q(!1);const t=Math.floor(Date.now()/1e3);q(t),G(hi.d_),z(void 0)}),at=(0,T.A)(e=>{G(void 0),z(Math.round(e.getTime()/1e3)),se(!1)}),rt=(0,T.A)(()=>{se(!1)}),lt=(0,T.A)(()=>{q(Math.floor(Date.now()/1e3)),se(!0)}),ct=(0,T.A)(e=>{G(e),z(void 0)}),dt=(0,T.A)(()=>{const e=nv(N.map(e=>({...e,text:e.text.trim().substring(0,100)})),a);if(y(Ie),w(e),te(!0),!Ie||ke.length<1)return;if(D&&!Ne.length)return;const t=ke.map(({text:e},t)=>({text:{text:e},option:String(t)}));return{summary:{id:(0,Kg.t)().toString(),hash:"0",question:{text:Ie},answers:t,isPublic:!(o||!I)||void 0,isMultipleChoice:!!Y||void 0,isQuiz:!!D||void 0,canAddAnswers:!(o||!I||!E)||void 0,isRevoteDisabled:!_||void 0,shouldShuffleAnswers:!!O||void 0,shouldHideResultsUntilClose:!!W||void 0,closePeriod:J,closeDate:H,isCreator:!0},correctAnswers:D?Ne:void 0,solution:D?x.trim().substring(0,200):void 0}}),ht=(0,T.A)((e,t,i,n)=>{g({messageList:Ee,text:S,poll:e,isSilent:i?void 0:t||m,scheduledAt:i,scheduleRepeatPeriod:n}),p()}),ut=(0,T.A)(e=>{const t=dt();t&&Se(ht,t,e)}),mt=(0,T.A)((e,t)=>{const i=dt();i&&Se(ht,i,void 0,e,t)}),pt=(0,T.A)(()=>{Pe?oe(mt):ut()}),gt=(0,T.A)(()=>{ut(!0)}),vt=(0,T.A)(()=>{oe(mt)}),At=(0,n.Kr)(()=>(0,ne.FD)(Gp,{children:[(0,ne.Y)($p,{}),(0,ne.Y)(zp,{children:v("NewPoll")}),(0,ne.FD)(Hp,{children:[(0,ne.Y)(X.A,{ref:A,color:"primary",pill:!0,disabled:Te,noForcedUpperCase:!0,size:"smaller",onClick:pt,onContextMenu:Pe?void 0:le,children:v("Send")}),!Pe&&(0,ne.Y)(up.A,{isOpen:re,canSchedule:Ye,onSendSilent:gt,onSendSchedule:vt,onClose:ce,onCloseAnimationEnd:de})]})]}),[Ye,le,ce,de,re,Pe,Te,v]);return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(qp,{isOpen:t,onClose:Ve,header:At,ariaLabel:v("NewPoll"),width:"slim",children:[(0,ne.Y)(Hd.Qg,{children:v("PollModalQuestionTitle")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ee.A,{className:Qg,label:v("AskAQuestion"),value:b,maxLength:255,autoFocus:!0,error:Z&&!Ie?v("PollsChooseQuestion"):void 0,onChange:Qe}),(0,ne.Y)(ee.A,{className:Qg,label:v("DescriptionOptionalPlaceholder"),value:S,onChange:Ze})]}),(0,ne.Y)(Hd.Qg,{children:v("PollModalOptionsTitle")}),(0,ne.FD)(Hd.Ay,{ref:f,className:"rYlQXk3J",teactFastList:!0,children:[N.map((e,t)=>{const i=Boolean(e.text.trim()),n=!i&&t===N.length-1,s=B.includes(e.id),o=N.length>1&&!n,a=Z&&!ke.length&&0===t,r=i?Oe(e.id):void 0,l=i?Je(e.id):void 0,c=i?Ke(e.id):void 0,d=i?je(e.id):void 0,h=i?Ge(e.id):void 0;return(0,ne.Y)("div",{ref:r?.ref,className:"YaELEQTg",style:d,children:(0,ne.FD)("div",{ref:c?.ref,style:h,className:(0,ve.A)("HCAOVLrh",n&&"H6dklKBa",Ue===e.id&&"rz2ZtcZx"),children:[(0,ne.Y)("div",{className:(0,ve.A)("TgBwDHkp",n&&"tZRLMkK2",i&&"jibj2KjZ"),role:l?.role,tabIndex:l?.tabIndex,"aria-label":i?v("DragToSortAria"):void 0,onMouseDown:l?.onMouseDown,onTouchStart:l?.onTouchStart,onKeyDown:l?.onKeyDown,ref:l?.ref,children:(0,ne.Y)(he.A,{name:n?"add":"sort",className:"tnVHyvU7"})}),D&&(0,ne.Y)("div",{className:"FV5p0JiF",children:Y?(0,ne.Y)(Lp.A,{checked:s,disabled:n,isInvalid:Fe&&!s&&!n,onChange:()=>qe(e.id)}):(0,ne.Y)(Wg.A,{value:e.id,checked:s,disabled:n,className:!Fe||s||n?void 0:"q3b3l66l",onChange:()=>qe(e.id)})}),(0,ne.Y)(ee.A,{className:(0,ve.A)("FlAj0qv5",Zg,n&&"vFG2gXhM"),placeholder:v(n?"CreatePollAddOption":"OptionHint"),value:e.text,maxLength:100,error:a?v("PollsChooseAnswers"):void 0,onChange:t=>ze(e.id,t.currentTarget.value),onKeyDown:We}),o&&(0,ne.Y)(X.A,{round:!0,size:"tiny",color:"translucent",className:"uVy1ejxT",ariaLabel:v("Delete"),iconName:"close",onClick:()=>$e(e.id)})]})},e.id)}),Fe&&(0,ne.Y)(Hd.IW,{className:"LTmkyHB8",children:v("PollsChooseCorrect")},"correct-answer-error")]}),(0,ne.Y)(Hd.IW,{children:Me>0?v("PollModalAddMoreText",{count:Me},{pluralValue:Me}):v("PollModalAddNoMore")}),(0,ne.Y)(Hd.Qg,{children:v("PollModalSettingsTitle")}),(0,ne.FD)(Hd.Ay,{children:[!o&&(0,ne.Y)(ev,{iconName:"eye",iconBackgroundColor:"#0a84ff",label:v("PollAnswersVisible"),description:v("PollAnswersVisibleDescription"),checked:I,onChange:P}),(0,ne.Y)(ev,{iconName:"choice-selected",iconBackgroundColor:"#ffb300",label:v("PollMultiple"),description:v("PollMultipleDescription"),checked:Y,onChange:nt}),!o&&(0,ne.Y)(ev,{iconName:"add-filled",iconBackgroundColor:"#2faeff",label:v("PollAllowAddingAnswers"),description:v("PollAllowAddingAnswersDescription"),checked:E,disabled:De,locked:De,onChange:V}),(0,ne.Y)(ev,{iconName:"reload",iconBackgroundColor:"#6a5cff",label:v("PollAllowVoteChanges"),description:v("PollAllowVoteChangesDescription"),checked:_,onChange:U}),(0,ne.Y)(ev,{iconName:"replace-round",iconBackgroundColor:"#b75bff",label:v("PollRandomOrder"),description:v("PollRandomOrderDescription"),checked:O,onChange:K}),(0,ne.Y)(ev,{iconName:"check-filled",iconBackgroundColor:"#34c759",label:v("PollQuiz"),description:v("PollQuizDescription"),checked:D,onChange:tt}),(0,ne.Y)(ev,{iconName:"timer-filled",iconBackgroundColor:"#ff5e3a",label:v("PollLimitedDuration"),description:v("PollLimitedDurationDescription"),checked:Be,onChange:st}),Be?(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{ref:C,className:"AwVy28d1",children:[(0,ne.Y)(tv,{label:v("PollDuration"),value:Le,onClick:pe}),(0,ne.FD)(it.A,{isOpen:ue,className:(0,ve.A)("with-menu-transitions","TA2JxcRX"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:ge,onCloseAnimationEnd:Ae,children:[Xg.map(e=>(0,ne.Y)(me.A,{disabled:e>l,onClick:()=>ct(e),children:(0,et.A$)(v,e)},e)),(0,ne.Y)(me.A,{onClick:lt,children:v("PollDurationOther")})]})]}),(0,ne.Y)(ev,{label:v("PollHideResultsUntilClose"),checked:W,onChange:Q})]}):void 0]}),D&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:v("PollsSolutionTitle")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(Is.A,{className:"t2bG7AXN",value:x,label:v("PollsSolutionTitle"),maxLength:200,noReplaceNewlines:!0,onChange:Xe})}),(0,ne.Y)(Hd.IW,{children:v("CreatePollExplanationInfo")})]})]}),ae,(0,ne.Y)(qg.A,{isOpen:ie,selectedAt:Re,maxAt:xe,isFutureMode:!0,withTimePicker:!0,submitButtonLabel:v("Save"),onClose:rt,onSubmit:at}),(0,ne.Y)(Wl.A,{isOpen:d,onClose:fe,userName:i?(0,Dt.F9)(v,i):void 0,messagePriceInStars:c||0,messagesCount:1,shouldAutoApprove:be,setAutoApprove:ye,confirmHandler:Ce})]})})),ov=(0,n.ph)((0,s.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:o,editingMessage:a,onSend:l,onClear:c})=>{const{editTodo:d,closeTodoListModal:h,appendTodoList:u}=(0,s.ko)(),p=(0,n.li)(),g=(0,n.li)(),[v,A]=(0,n.J0)(""),[f,C]=(0,n.J0)(()=>[{id:(0,Kg.t)(),text:""}]),[b,y]=(0,n.J0)(!0),[S,k]=(0,n.J0)(!0),[N,w]=(0,n.J0)(!1),I=(0,Bi.A)(),P=Boolean(e),Y=(0,Ii.A)(e),F=Y?.forNewTask&&!a?.isOutgoing,D=a?.content.todo?.todo,M=(0,n.Kr)(()=>F&&D?D.items.map(e=>({id:e.id,text:e.title.text,isDisabled:!0})):gi.p,[F,D]),B=(0,T.A)(e=>{P&&e.current&&e.current.focus()});(0,n.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,Kg.t)(),text:""}),C(e)}},[D,F,t]),(0,n.vJ)(()=>P?(0,m.A)(c):void 0,[P,c]),(0,n.vJ)(()=>{P||(A(""),C([{id:(0,Kg.t)(),text:""}]),y(!0),k(!0),w(!1))},[P]),(0,n.vJ)(()=>{P&&(0,r.YS)(()=>{if(Y?.forNewTask){const e=g.current?.querySelectorAll("input"),t=e?.[e.length-1];t?.focus()}else B(p)})},[B,P,Y?.forNewTask]);const L=(0,T.A)(e=>{const t=(0,Kg.t)();C([...e,{id:t,text:""}]),(0,r.Uz)(()=>{const e=g.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),x=(0,T.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,o)}}}).filter(Boolean),t=v.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,o)})).filter(e=>e.text.length);0===e.length?L([]):C([...e,{id:(0,Kg.t)(),text:""}])}else L([]);return void w(!0)}if(F&&a)return u({chatId:a.chatId,messageId:a.id,items:e}),void h();const n={todo:{title:{text:t},items:e,othersCanAppend:b,othersCanComplete:S}};a?d({chatId:a.chatId,todo:n,messageId:a.id}):l(n),h()}),R=(0,T.A)((e,i)=>{const n=[...f];n[e]={...n[e],text:i},n[n.length-1].text.trim().length&&n.length<t?L(n):C(n)}),E=(0,T.A)(e=>{const t=[...f];t.splice(e,1),C(t),(0,r.Uz)(()=>{g.current&&g.current.classList.toggle("overflown",g.current.scrollHeight>320)})}),V=(0,T.A)(e=>{y(e.target.checked)}),_=(0,T.A)(e=>{k(e.target.checked)}),U=(0,T.A)(e=>{"Enter"===e.key&&x()}),O=(0,T.A)(e=>{A(e.target.value)}),K=(0,T.A)(()=>{if(N&&!v.trim().length)return I("ToDoListErrorChooseTitle")}),J=(0,T.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")}),j=t-f.length-(F&&D?D.items.length:0);return(0,ne.FD)(te.A,{isOpen:P,onClose:c,header:function(){const e=F?"TitleAppendToDoList":a?"TitleEditToDoList":"TitleNewToDoList";return(0,ne.FD)("div",{className:"modal-header-condensed",children:[(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:I("AriaToDoCancel"),onClick:c,iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:I(e)}),(0,ne.Y)(X.A,{color:"primary",size:"tiny",className:"modal-action-button",onClick:x,children:I(F?"Add":a?"Save":"Create")})]})}(),className:"ToDoListModal",children:[!F&&(0,ne.Y)(ee.A,{ref:p,label:I("InputTitle"),value:v,error:K(),onChange:O,onKeyPress:U}),F&&(0,ne.Y)("div",{className:"readonly-title",children:v}),(0,ne.Y)("div",{className:"options-divider"}),(0,ne.FD)("div",{className:"options-list custom-scroll",ref:g,children:[(0,ne.Y)("h3",{className:"items-header",children:I("TitleToDoList")}),function(){const e=[...M,...f];return e.map((i,n)=>{const s=n-M.length;return(0,ne.FD)("div",{className:"item-wrapper",children:[(0,ne.Y)(ee.A,{maxLength:100,label:n!==e.length-1||e.length===t?I("TitleTask"):I("TitleAddTask"),error:J(s),value:i.text,disabled:i.isDisabled,onChange:e=>R(s,e.currentTarget.value),onKeyPress:U}),n!==e.length-1&&!i.isDisabled&&(0,ne.Y)(X.A,{className:"item-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:I("Delete"),onClick:()=>E(s),iconName:"close"})]})})}()]}),(0,ne.Y)("div",{className:"items-count-hint",children:I("HintTodoListTasksCount2",{count:j},{pluralValue:j})}),(0,ne.Y)("div",{className:"options-divider"}),!F&&(0,ne.Y)("div",{className:"options-footer",children:(0,ne.FD)("div",{className:"dialog-checkbox-group",children:[(0,ne.Y)(es.A,{label:I("AllowOthersAddTasks"),checked:b,onChange:V}),(0,ne.Y)(es.A,{label:I("AllowOthersMarkAsDone"),checked:S,onChange:_})]})})]})}));var av=i(36680),rv=i(52491);const lv=(0,n.ph)(({emoji:e,focus:t,onClick:i})=>{const n=(0,T.A)(t=>{t.preventDefault(),i(e.native,e.id)}),s=(0,ve.A)("EmojiButton",t&&"focus"),o=`./img-apple-64/${e.image}.png`,a=rv.On.has(o);return(0,ne.Y)("div",{className:s,onMouseDown:n,title:`:${e.names[0]}:`,children:u.TL?e.native:(0,ne.Y)("img",{src:o,className:a?void 0:"opacity-transition shown",alt:e.native,loading:"lazy","data-path":o,onLoad:a?void 0:rv.P_,draggable:!1})})}),cv=.625*v.$,dv=.25*v.$,hv=.5*v.$,uv=.5*v.$,mv=(0,n.ph)(({category:e,index:t,allEmojis:i,observeIntersection:s,shouldRender:o,onEmojiSelect:r})=>{const l=(0,n.li)();(0,yr.mv)(l,s);const c=(0,xi.A)(o),d=(0,B.A)(),{isMobile:h}=(0,Y.Ay)(),u=h?Math.floor((N.A.get().width-uv+cv)/(a.g0Q+cv)):8,m=Math.ceil(e.emojis.length/u)*(a.g0Q+(h?hv:dv));return(0,ne.FD)("div",{ref:l,id:`emoji-category-${t}`,className:"symbol-set",children:[(0,ne.Y)("div",{className:"symbol-set-header",children:(0,ne.Y)("p",{className:"symbol-set-name",dir:"auto",children:d(e.id===a.sR2?"RecentStickers":`Emoji${t}`)})}),(0,ne.Y)("div",{className:(0,ve.A)("symbol-set-container",c),style:`height: ${m}px;`,dir:d.isRtl?"rtl":void 0,children:o&&e.emojis.map(e=>{const t=i[e];if(!t)return;const n="id"in t?t:t[1];return(0,ne.Y)(lv,{emoji:n,onClick:r},n.id)})})]},e.id)}),pv={recent:"recent",people:"smile",nature:"animals",foods:"eats",activity:"sport",places:"car",objects:"lamp",symbols:"language",flags:"flag"},gv=3.25*v.$,vv=2.625*v.$,Av=[];let fv,Cv,bv;const yv=(0,n.ph)((0,s.EK)(e=>(0,pi.Up)(e,["recentEmojis"]))(({className:e,recentEmojis:t,onEmojiSelect:s})=>{const o=(0,n.li)(),r=(0,n.li)(),[l,c]=(0,n.J0)(),[d,h]=(0,n.J0)(),[m,p]=(0,n.J0)(0),{isMobile:g}=(0,Y.Ay)(),{handleScroll:v,isAtBeginning:A}=(0,un.A)(),{observe:f}=(0,yr.BL)({rootRef:o,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-",""));Av[i]=e.isIntersecting});const t=Av.reduce((e,t,i)=>t&&i<e?i:e,1/0);t!==1/0&&p(t)}),C=(0,Cr.A)([],a.vVF),b=d&&C;(0,Qn.A)(r,!(g&&b)),(0,n.vJ)(()=>{if(!l)return;const e=r.current;if(!e)return;const t=m*vv-e.offsetWidth/2+vv/2;(0,Mo.A)(e,t)},[l,m]);const y=(0,B.A)(),S=(0,n.Kr)(()=>{if(!l)return gi.p;const e=[...l];return t?.length&&e.unshift({id:a.sR2,name:y("RecentStickers"),emojis:t}),e},[l,y,t]);(0,n.vJ)(()=>{const e=setTimeout(()=>{const e=()=>{c(bv.categories),h(bv.emojis)};bv?e():async function(){return fv||(fv=i.e(996).then(i.t.bind(i,20996,19)),Cv=(await fv).default,bv=(0,rv.cp)(Cv)),fv}().then(e)},200);return()=>{clearTimeout(e)}},[]);const k=(0,T.A)(e=>{p(e);const t=o.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,br.Ay)({container:o.current,element:t,position:"start",margin:gv,maxDistance:100})}),N=(0,T.A)((e,t)=>{s(e,t)}),w=(0,ve.A)("EmojiPicker",e),I=(0,ve.A)("EmojiPicker-header",!A&&"with-top-border");return(0,ne.Y)(ae.Ay,{className:w,activeKey:b?1:0,name:"fade",shouldCleanup:!0,children:b?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{ref:r,className:I,dir:y.isRtl?"rtl":void 0,children:S.map(function(e,t){const i=pv[e.id];return i&&(0,ne.Y)(X.A,{className:"symbol-set-button "+(t===m?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>k(t),ariaLabel:e.name,iconName:i})})}),(0,ne.Y)("div",{ref:o,onScroll:v,className:(0,ve.A)("EmojiPicker-main",u.TF?"no-scrollbar":"custom-scroll"),children:S.map((e,t)=>(0,ne.Y)(mv,{category:e,index:t,allEmojis:d,observeIntersection:f,shouldRender:m>=t-1&&m<=t+1,onEmojiSelect:N}))})]}):(0,ne.Y)(Jn.A,{})})})),Sv=(0,n.ph)(({gif:e,isDisabled:t,className:i,observeIntersection:s,isSavedMessages:o,onClick:a,onUnsaveClick:r,onAddCaption:c})=>{const d=(0,n.li)(),h=(0,B.A)(),m=(0,Bi.A)(),p=(0,yr.Vz)(d,s)&&!t,g=!e.hasVideoPreview&&e.thumbnail&&(0,l.sC)(e,"pictogram"),v=(0,q.A)(g,!p),[A]=(0,n.J0)(e.thumbnail?.dataUri&&!v),f=(0,Ti.A)(e.thumbnail?.dataUri,!A),C=(0,l.Ct)(e)||(0,l.sC)(e,"full"),b=(0,q.A)(C,!p),y=Boolean(p&&b),{isBuffered:S,bufferingHandlers:k}=(0,$e.A)(!0),N=p&&!S,w=p&&S,{isContextMenuOpen:I,contextMenuAnchor:P,handleBeforeContextMenu:Y,handleContextMenu:F,handleContextMenuClose:D,handleContextMenuHide:M}=(0,As.A)(d),L=(0,T.A)(()=>d.current),x=(0,T.A)(()=>d.current.closest(".custom-scroll, .no-scrollbar")),R=(0,T.A)(()=>d.current.querySelector(".gif-context-menu .bubble")),E=(0,T.A)(()=>({shouldAvoidNegativePosition:!0})),V=(0,T.A)(()=>{!I&&a&&a({...e,blobUrl:b})}),_=(0,T.A)(t=>{t.stopPropagation(),t.preventDefault(),r(e)}),U=(0,T.A)(()=>{r?.(e)}),O=(0,T.A)(()=>{a({...e,blobUrl:b},!0)}),K=(0,T.A)(()=>{a({...e,blobUrl:b},void 0,!0)}),J=(0,T.A)(()=>{c?.({...e,blobUrl:b})}),j=(0,T.A)(e=>{(0,Dr.u)(e),Y(e)});(0,n.vJ)(()=>{t&&D()},[D,t]);const G=(0,ve.A)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",a&&"interactive",i);return(0,ne.FD)("div",{ref:d,className:G,onMouseDown:j,onClick:V,onContextMenu:F,children:[!u.TF&&r&&(0,ne.Y)(X.A,{className:"gif-unsave-button",color:"dark",pill:!0,iconName:"close",iconClassName:"gif-unsave-button-icon",noFastClick:!0,onClick:_}),A&&(0,ne.Y)("canvas",{ref:f,className:"thumbnail"}),v&&!w&&(0,ne.Y)("img",{src:v,alt:"",className:"preview",draggable:!1}),y&&(0,ne.Y)(Ui.A,{canPlay:!0,src:b,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none",...k}),N&&(0,ne.Y)(je.A,{color:v||A?"white":"black"}),a&&void 0!==P&&(0,ne.FD)(it.A,{isOpen:I,anchor:P,getTriggerElement:L,getRootElement:x,getMenuElement:R,getLayout:E,className:"gif-context-menu",autoClose:!0,onClose:D,onCloseAnimationEnd:M,children:[!o&&(0,ne.Y)(me.A,{onClick:O,icon:"mute",children:h("SendWithoutSound")}),(0,ne.Y)(me.A,{onClick:K,icon:"calendar",children:h(o?"SetReminder":"ScheduleMessage")}),c&&(0,ne.Y)(me.A,{icon:"add-caption",onClick:J,children:m("MenuAddCaption")}),r&&(0,ne.Y)(me.A,{destructive:!0,icon:"delete",onClick:U,children:h("Delete")})]})]})}),kv=(0,n.ph)((0,s.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:o,isSavedMessages:r,onGifSelect:l,onGifAddCaption:c})=>{const{loadSavedGifs:d,saveGif:h}=(0,s.ko)(),m=(0,n.li)(),{observe:p}=(0,yr.BL)({rootRef:m,debounceMs:300});(0,n.vJ)(()=>{t&&d()},[t,d]);const g=(0,T.A)(e=>{h({gif:e,shouldUnsave:!0})}),v=(0,Cr.A)([],a.jhd),A=i&&(!v||!o);return(0,ne.Y)(ae.Ay,{ref:m,className:(0,ve.A)("GifPicker",e,u.TF?"no-scrollbar":"custom-scroll"),slideClassName:"GifPickerGrid",activeKey:A?0:1,name:"fade",shouldCleanup:!0,children:i?v&&o&&o.length?o.map(e=>(0,ne.Y)(Sv,{gif:e,observeIntersection:p,isDisabled:!t,isSavedMessages:r,onClick:i?l:void 0,onUnsaveClick:g,onAddCaption:i?c:void 0},e.id)):v&&o?(0,ne.Y)("div",{className:"picker-disabled",children:"No saved GIFs."}):(0,ne.Y)(Jn.A,{color:"yellow"}):(0,ne.Y)("div",{className:"picker-disabled",children:"Sending GIFs is not allowed in this chat."})})}));let Nv=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 wv={[Nv.Emoji]:"Emoji",[Nv.CustomEmoji]:"StickersList.EmojiItem",[Nv.Stickers]:"AccDescrStickers",[Nv.GIFs]:"GifsTab"},Iv={[Nv.Emoji]:"icon-smile",[Nv.CustomEmoji]:"icon-favorite",[Nv.Stickers]:"icon-stickers",[Nv.GIFs]:"icon-gifs"},Pv=(0,n.ph)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:i,onSearchOpen:n,isAttachmentModal:s,canSendPlainText:o,canSearch:a})=>{const r=(0,B.A)();function l(i){return(0,ne.Y)(X.A,{className:"symbol-tab-button "+(e===i?"activated":""),onClick:()=>t(i),ariaLabel:r(wv[i]),round:!0,faded:!0,color:"translucent",children:(0,ne.Y)("i",{className:(0,ve.A)("icon",Iv[i])})})}const c=(0,T.A)(()=>{n(e===Nv.Stickers?"stickers":"gifs")});return(0,ne.FD)("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0,children:[e!==Nv.Emoji&&e!==Nv.CustomEmoji&&a&&(0,ne.Y)(X.A,{className:"symbol-search-button",ariaLabel:e===Nv.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:c,iconName:"search"}),o&&l(Nv.Emoji),o&&l(Nv.CustomEmoji),!s&&l(Nv.Stickers),!s&&l(Nv.GIFs),(e===Nv.Emoji||e===Nv.CustomEmoji)&&(0,ne.Y)(X.A,{className:"symbol-delete-button",onClick:i,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent",iconName:"delete-left"})]})});let Yv=!1;const Fv=(0,n.ph)((0,s.EK)(e=>({isLeftColumnShown:(0,c.nTw)(e).isLeftColumnShown,isBackgroundTranslucent:(0,c.cwE)(e),animationLevel:(0,Rn.lS)(e).animationLevel}))(({chatId:e,threadId:t,isOpen:i,canSendStickers:s,canSendGifs:o,isMessageComposer:a,idPrefix:l,isAttachmentModal:c,canSendPlainText:d,className:h,onLoad:m,onClose:p,onEmojiSelect:g,onCustomEmojiSelect:v,onStickerSelect:A,onGifSelect:f,onGifAddCaption:C,onRemoveSymbol:b,onSearchOpen:y,addRecentEmoji:S,addRecentCustomEmoji:k,isLeftColumnShown:N,isBackgroundTranslucent:w,animationLevel:I,...P})=>{const[F,D]=(0,n.J0)(Nv.Emoji),[M,L]=(0,n.J0)([]),[x,R]=(0,n.J0)([]),{isMobile:E}=(0,Y.Ay)(),[V,_]=(0,av.A)(i,p,void 0,E),{shouldRender:U,transitionClassNames:O}=(0,qe.A)(i,p,!1,!1),K=(0,B.A)();!Yv&&i&&(Yv=!0),(0,n.vJ)(()=>{m()},[m]),(0,n.vJ)(()=>{d||D(Nv.Stickers)},[d]),(0,n.Nf)(()=>{if(E&&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,E,i]);const J=(0,n.li)(M);J.current=M,(0,n.vJ)(()=>{J.current.length&&!i&&(J.current.forEach(e=>{S({emoji:e})}),L([]))},[i,S]);const j=(0,T.A)((e,t)=>{L(e=>[...e,t]),g(e)}),G=(0,n.li)(x);G.current=x,(0,n.vJ)(()=>{G.current.length&&!i&&(G.current.forEach(e=>{k({documentId:e})}),R([]))},[i,k]);const H=(0,T.A)(e=>{R(t=>[...t,e.id]),v(e)}),z=(0,T.A)(e=>{p(),y(e)}),$=(0,T.A)((e,t,i,n)=>{A?.(e,t,i,!0,n)}),q=(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()},children:Yv&&(0,ne.Y)(ae.Ay,{name:(0,Vn.P)("slide",I),activeKey:F,renderCount:Object.values(wv).length,children:function(n,r){switch(F){case Nv.Emoji:return(0,ne.Y)(yv,{className:"picker-tab",onEmojiSelect:j});case Nv.CustomEmoji:return(0,ne.Y)(qr,{className:"picker-tab",isHidden:!i||!n,idPrefix:l,loadAndPlay:i&&(n||r),chatId:e,isTranslucent:!E&&w,onCustomEmojiSelect:H});case Nv.Stickers:return(0,ne.Y)(sp,{className:"picker-tab",isHidden:!i||!n,loadAndPlay:!!s&&i&&(n||r),idPrefix:l,canSendStickers:s,noContextMenus:!a,chatId:e,threadId:t,isTranslucent:!E&&w,onStickerSelect:$});case Nv.GIFs:return(0,ne.Y)(kv,{className:"picker-tab",loadAndPlay:!!o&&i&&(n||r),canSendGifs:o,onGifSelect:f,onGifAddCaption:C})}}})}),E&&(0,ne.Y)(X.A,{round:!0,faded:!0,color:"translucent",ariaLabel:K("Close"),className:"symbol-close-button",size:"tiny",onClick:p,iconName:"close"}),(0,ne.Y)(Pv,{activeTab:F,onSwitchTab:D,onRemoveSymbol:b,canSearch:a,onSearchOpen:z,isAttachmentModal:c,canSendPlainText:d})]});if(E){if(!U)return;const e=(0,ve.A)("SymbolMenu mobile-menu",O,N&&"left-column-open",c&&"in-attachment-modal",a&&"in-middle-column");return c?(0,ne.Y)("div",{className:e,children:q}):(0,ne.Y)(Wr.A,{children:(0,ne.Y)("div",{className:e,children:q})})}return(0,ne.Y)(it.A,{isOpen:i,onClose:p,withPortal:c,className:(0,ve.A)("SymbolMenu",h),onCloseAnimationEnd:p,onMouseEnter:u.TF?void 0:V,onMouseLeave:u.TF?void 0:_,noCloseOnBackdrop:!u.TF,noCompact:!0,...c?P:{positionX:"left",positionY:"bottom"},children:q})})),Dv=(0,n.ph)(({withAvatar:e,focus:t,command:i,description:n,peer:s,clickArg:o,onClick:a})=>{const r=(0,T.A)(()=>{a(o)});return(0,ne.FD)(ui.A,{className:(0,ve.A)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:r,focus:t,children:[e&&(0,ne.Y)(Tt.A,{size:"small",peer:s}),(0,ne.FD)("div",{className:"content-inner",children:[(0,ne.FD)("span",{className:"title",children:["/",i]}),(0,ne.Y)("span",{className:"subtitle",children:(0,Mt.A)(n)})]})]},i)}),Mv=(0,n.ph)(({isOpen:e,chatId:t,withUsername:i,botCommands:o,quickReplies:a,quickReplyMessages:r,self:c,getHtml:d,onClick:h,onClose:u})=>{const{sendBotCommand:m,sendQuickReply:p}=(0,s.ko)(),g=(0,n.li)(),{shouldRender:v,transitionClassNames:A}=(0,qe.A)(e,void 0,void 0,!1),f=(0,T.A)(({botId:e,command:t})=>{const n=(0,s.mS)().users.byId[e];m({command:`/${t}${i&&n?`@${(0,l.Kl)(n)}`:""}`}),h()}),C=(0,T.A)(e=>{p({chatId:t,quickReplyId:e}),h()}),b=(0,n.Kr)(()=>{if(a?.length&&r)return a.map(e=>{const t=r[e.topMessageId];return{id:e.id,command:e.shortcut,description:t?.content.text?.text||""}})},[a,r]),y=(0,T.A)(e=>!!e.command.startsWith(d().slice(1))&&("id"in e?C(e.id):f(e),!0)),S=Lg({isActive:e,items:(0,n.Kr)(()=>{if(o||b)return[].concat(b||[],o||[])},[o,b]),onSelect:y,onClose:u}),k=o&&!o.length||a&&!a.length;if((0,n.vJ)(()=>{k&&u()},[k,u]),(0,n.vJ)(()=>{Bg(".chat-item-clickable",S,g)},[S]),!v||k)return;const N=(0,ve.A)("iaTB59vy","composer-tooltip custom-scroll",A);return(0,ne.FD)("div",{className:N,ref:g,children:[b?.map((e,t)=>(0,ne.Y)(Dv,{command:e.command,description:e.description,peer:c,withAvatar:!0,clickArg:e.id,onClick:C,focus:S===t},`quickReply_${e.id}`)),o?.map((e,t)=>(0,ne.Y)(Dv,{command:e.command,description:e.description,peer:(0,s.mS)().users.byId[e.botId],withAvatar:!0,clickArg:e,onClick:f,focus:S+(b?.length||0)===t},`${e.botId}_${e.command}`))]})}),Tv=(0,n.ph)(({isOpen:e,botCommands:t,onClose:i})=>{const{sendBotCommand:n}=(0,s.ko)(),{isMobile:o}=(0,Y.Ay)(),[a,r]=(0,av.A)(e,i,void 0,o),l=(0,T.A)(e=>{n({command:`/${e}`}),i()});return(0,ne.Y)(it.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:i,className:"BotCommandMenu",onCloseAnimationEnd:i,onMouseEnter:u.TF?void 0:a,onMouseLeave:u.TF?void 0:r,noCloseOnBackdrop:!u.TF,noCompact:!0,children:t.map(e=>(0,ne.Y)(Dv,{command:e.command,description:e.description,clickArg:e.command,onClick:l},e.command))})}),Bv=(0,n.ph)((0,s.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:s,onClose:o,stickers:r,isSavedMessages:l,isCurrentUserPremium:c})=>{const d=(0,n.li)(),{shouldRender:h,transitionClassNames:u}=(0,qe.A)(i,void 0,void 0,!1),p=(0,K.A)(r,!0),g=r||p,v=(0,ip.A)(e,t),{observe:A}=(0,yr.BL)({rootRef:d,throttleMs:200});(0,n.vJ)(()=>i?(0,m.A)(o):void 0,[i,o]);const f=(0,ve.A)("StickerTooltip composer-tooltip custom-scroll",u,!g?.length&&"hidden");return(0,ne.Y)("div",{ref:d,className:f,onMouseMove:()=>{v({type:"chooseSticker"})},children:h&&g?g.map(e=>(0,ne.Y)(Br,{sticker:e,size:a.bkT,observeIntersection:A,onClick:i?s:void 0,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c},e.id)):h?(0,ne.Y)(Jn.A,{}):void 0})})),Lv={root:"_8sFuAomM",emojiButton:"crWzZ2jr"},xv=(0,n.ph)((0,s.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:o,customEmoji:r,isSavedMessages:l,isCurrentUserPremium:c,noPlay:d})=>{const{clearCustomEmojiForEmoji:h}=(0,s.ko)(),u=(0,n.li)(),{shouldRender:p,transitionClassNames:g}=(0,qe.A)(e,void 0,void 0,!1),v=(0,K.A)(r,!0),A=r||v;(0,Qn.A)(u);const{observe:f}=(0,yr.BL)({rootRef:u,throttleMs:200,isDisabled:!e});(0,n.vJ)(()=>e?(0,m.A)(o):void 0,[e,o]);const C=(0,T.A)(n=>{e&&(i(n),t({documentId:n.id}),h())}),b=(0,ve.A)(Lv.root,"composer-tooltip no-scrollbar",g,!A?.length&&Lv.hidden);return(0,ne.Y)("div",{ref:u,className:b,children:p&&A?A.map(e=>(0,ne.Y)(Br,{sticker:e,className:Lv.emojiButton,size:a.x6_,observeIntersection:f,onClick:C,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c,noPlay:d},e.id)):p?(0,ne.Y)(Jn.A,{}):void 0})}));var Rv=i(76283);const Ev=(0,n.ph)(({isOpen:e,isOpenToBottom:t=!1,isSavedMessages:i,canSchedule:o,canScheduleUntilOnline:a,onSendSilent:r,onSendSchedule:l,onSendWhenOnline:c,onRemoveEffect:d,onClose:h,onCloseAnimationEnd:m,chatId:p,withEffects:g,hasCurrentEffect:v,effectReactions:A,allAvailableReactions:f,onToggleReaction:C,canBuyPremium:b,isCurrentUserPremium:y,isInSavedMessages:S,isInStoryViewer:k,canPlayAnimatedEmojis:N})=>{const{openEffectPicker:w}=(0,s.ko)(),[I,P]=(0,av.A)(e,h),[Y,M]=(0,n.J0)(!1),L=(0,B.A)(),x=(0,Bi.A)(),[R,E,V]=(0,D.A)();(0,F.A)(([t])=>{e&&!t&&(V(),M(Boolean(a)))},[e,a]);const[_,U,O]=(0,D.A)(),K=(0,T.A)(e=>{E(),p&&w({chatId:p,position:e})});return(0,n.vJ)(()=>{if(!e)return void O();const t=setTimeout(()=>{U()},200);return()=>{clearTimeout(t)}},[e,U,O]),(0,ne.FD)(it.A,{isOpen:e,autoClose:!0,positionX:"right",positionY:t?"top":"bottom",className:(0,ve.A)("CustomSendMenu","fluid","with-menu-transitions",g&&"with-effects"),onClose:h,onCloseAnimationEnd:m,onMouseEnter:u.TF?void 0:I,onMouseLeave:u.TF?void 0:P,noCloseOnBackdrop:!u.TF,children:[g&&!k&&(0,ne.Y)(Rv.A,{allAvailableReactions:f,effectReactions:A,currentReactions:void 0,onToggleReaction:C,isPrivate:!0,isReady:_,canBuyPremium:b,isCurrentUserPremium:y,isInSavedMessages:S,isForEffects:!0,canPlayAnimatedEmojis:N,onShowMore:K,onClose:h,className:(0,ve.A)(R&&"ReactionSelector-hidden")}),(0,ne.FD)("div",{className:(0,ve.A)("CustomSendMenu_items",R&&"CustomSendMenu_items-hidden"),dir:x.isRtl?"rtl":void 0,children:[r&&(0,ne.Y)(me.A,{icon:"mute",onClick:r,children:L("SendWithoutSound")}),o&&l&&(0,ne.Y)(me.A,{icon:"schedule",onClick:l,children:L(i?"SetReminder":"ScheduleMessage")}),o&&l&&Y&&(0,ne.Y)(me.A,{icon:"user-online",onClick:c,children:L("SendWhenOnline")}),g&&v&&(0,ne.Y)(me.A,{icon:"delete",onClick:d,children:x("RemoveEffect")})]})]})});var Vv=i(41510),_v=i(22110),Uv=i(22802);const Ov={B:"bold",STRONG:"bold",I:"italic",EM:"italic",U:"underline",DEL:"strikethrough",CODE:"monospace",SPAN:"spoiler"},Kv=document.createElement("div"),Jv=(0,n.ph)(({isOpen:e,anchorPosition:t,selectedRange:i,setSelectedRange:s,onClose:o})=>{const r=(0,n.li)(),l=(0,n.li)(),{shouldRender:c,transitionClassNames:d}=(0,qe.A)(e),[u,p,g]=(0,D.A)(),[v,A,f]=(0,D.A)(),[C,b]=(0,n.J0)(""),[S,k]=(0,n.J0)(!1),[N,w]=(0,n.J0)(),[I,P]=(0,n.J0)({}),[Y,F]=(0,n.J0)(()=>jv(new Date).getTime()),M=(0,Bi.A)();(0,n.vJ)(()=>e&&!v?(0,m.A)(o):void 0,[v,e,o]),(0,Uv.A)(e&&!v,r,o,!0),(0,n.vJ)(()=>{u?l.current.focus():(b(""),k(!1))},[u]),(0,n.vJ)(()=>{c||(g(),f(),P({}),w(void 0))},[f,g,c]),(0,n.vJ)(()=>{if(!e||!i)return;const t={};let{parentElement:n}=i.commonAncestorContainer;for(;n&&n.id!==a.CfG;){const e=Ov[n.tagName];e&&(t[e]=!0),n=n.parentElement}P(t)},[e,i,p]);const B=(0,T.A)(()=>{if(!i)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(i))}),L=(0,T.A)(()=>{const e=window.getSelection();e&&s(e.getRangeAt(0))}),x=(0,T.A)(e=>{if(i)return Kv.replaceChildren(i.cloneContents()),e&&Kv.querySelectorAll(tp._p).forEach(e=>{e.replaceWith(e.getAttribute("alt"))}),Kv.innerHTML}),R=(0,T.A)(()=>{if(i)return i.commonAncestorContainer.parentElement});function E(){const e=l.current;if(!e)return;const{offsetWidth:t,scrollWidth:i,scrollLeft:n}=e;if(i<=t)return void w(void 0);let s="";n<i-t&&(s="mask-right"),n>0&&(s+=" mask-left"),w(s)}function V(e){if(I[e])return"active";if("monospace"===e||"strikethrough"===e){if(Object.keys(I).some(t=>t!==e&&Boolean(I[t])))return"disabled"}else if(I.monospace||I.strikethrough)return"disabled"}const _=(0,T.A)(()=>{if(I.spoiler){const e=R();if(!i||!e||e.dataset.entityType!==j.C7.Spoiler||!e.textContent)return;return e.replaceWith(e.textContent),void P(e=>({...e,spoiler:!1}))}const e=x();document.execCommand("insertHTML",!1,`<span class="spoiler" data-entity-type="${j.C7.Spoiler}">${e}</span>`),o()}),U=(0,T.A)(()=>{P(e=>(document.execCommand(e.bold?"removeFormat":"bold"),Object.keys(e).forEach(t=>{"italic"!==t&&"underline"!==t||!Boolean(e[t])||document.execCommand(t)}),L(),{...e,bold:!e.bold}))}),O=(0,T.A)(()=>{document.execCommand("italic"),L(),P(e=>({...e,italic:!e.italic}))}),K=(0,T.A)(()=>{document.execCommand("underline"),L(),P(e=>({...e,underline:!e.underline}))}),J=(0,T.A)(()=>{if(I.strikethrough){const e=R();if(!i||!e||"DEL"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void P(e=>({...e,strikethrough:!1}))}const e=x();document.execCommand("insertHTML",!1,`<del>${e}</del>`),o()}),G=(0,T.A)(()=>{if(I.monospace){const e=R();if(!i||!e||"CODE"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void P(e=>({...e,monospace:!1}))}const e=x(!0);document.execCommand("insertHTML",!1,`<code class="text-entity-code" dir="auto">${e}</code>`),o()}),H=(0,T.A)(()=>{const e=((0,as.Tc)(C)||"").split("%").map(encodeURI).join("%");if(S){const t=R();if(!t||"A"!==t.tagName)return;return t.href=e,void o()}const t=x(!0);B(),document.execCommand("insertHTML",!1,`<a href="${e}" class="text-entity-link" dir="auto">${t}</a>`),o()}),z=(0,T.A)(()=>{g(),F(jv(new Date).getTime()),A()}),$=(0,T.A)(e=>{F(e.getTime())}),q=(0,T.A)(e=>{const t=x();t&&i&&(B(),document.execCommand("insertHTML",!1,(0,_v.Oe)(t,{type:j.C7.FormattedDate,offset:0,length:i.toString().length,date:Math.round(e.getTime()/1e3)})),f(),o())}),W=(0,T.A)(e=>{if(v)return;const t={k:p,b:U,u:K,i:O,m:G,s:J,p:_}[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,n.vJ)(()=>(e&&document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)),[e,W]),!c)return;const Q=(0,ve.A)("TextFormatter",d,u&&"link-control-shown"),Z=(0,ve.A)("TextFormatter-link-url-confirm",Boolean(C.length)&&"shown"),ee=t?`left: ${t.x}px; top: ${t.y}px;--text-formatter-left: ${t.x}px;`:"";return(0,ne.FD)("div",{ref:r,className:Q,style:ee,onKeyDown:function(e){if("Enter"===e.key&&u){if(!C.trim())return;H(),e.preventDefault()}},onMouseDown:y.A,children:[(0,ne.FD)("div",{className:"TextFormatter-buttons",children:[(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingSpoilerAria"),className:V("spoiler"),onClick:_,iconName:"eye-crossed"}),(0,ne.Y)("div",{className:"TextFormatter-divider"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingBoldAria"),className:V("bold"),onClick:U,iconName:"bold"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingItalicAria"),className:V("italic"),onClick:O,iconName:"italic"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingUnderlineAria"),className:V("underline"),onClick:K,iconName:"underlined"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingStrikethroughAria"),className:V("strikethrough"),onClick:J,iconName:"strikethrough"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingMonospaceAria"),className:V("monospace"),onClick:G,iconName:"monospace"}),(0,ne.Y)("div",{className:"TextFormatter-divider"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingAddDateAria"),onClick:z,iconName:"calendar"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("FormattingAddLinkAria"),onClick:p,iconName:"link"})]}),(0,ne.Y)("div",{className:"TextFormatter-link-control",children:(0,ne.FD)("div",{className:"TextFormatter-buttons",children:[(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("Cancel"),onClick:g,iconName:"arrow-left"}),(0,ne.Y)("div",{className:"TextFormatter-divider"}),(0,ne.Y)("div",{className:(0,ve.A)("TextFormatter-link-url-input-wrapper",N),children:(0,ne.Y)("input",{ref:l,className:"TextFormatter-link-url-input",type:"text",value:C,placeholder:M("FormattingEnterUrl"),autoComplete:"off",spellCheck:!h.Vq&&void 0,inputMode:"url",dir:"auto",onChange:function(e){b(e.target.value),E()},onScroll:E})}),(0,ne.FD)("div",{className:Z,children:[(0,ne.Y)("div",{className:"TextFormatter-divider"}),(0,ne.Y)(X.A,{color:"translucent",ariaLabel:M("Save"),className:"color-primary",onClick:H,iconName:"check"})]})]})}),(0,ne.Y)(ks,{isOpen:v,selectedAt:Y,withTimePicker:!0,submitButtonLabel:M("Save"),onClose:f,onDateChange:$,onSubmit:q})]})});function jv(e){const t=new Date(e.getTime());return t.setSeconds(0),t.setMilliseconds(0),t}const Gv=(0,n.ph)(({emoji:e,focus:t,onClick:i,observeIntersection:n})=>{const s=(0,T.A)(t=>{t.preventDefault(),i?.(e)}),o=(0,ve.A)("EmojiButton",t&&"focus");return(0,ne.Y)("div",{className:o,onMouseDown:s,title:e.emoji,children:(0,ne.Y)(hs.A,{documentId:e.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:n})})}),Hv=(0,n.ph)(({isOpen:e,emojis:t,customEmojis:i,onClose:s,onEmojiSelect:o,onCustomEmojiSelect:a,addRecentEmoji:r,addRecentCustomEmoji:l})=>{const c=(0,n.li)(),{shouldRender:d,transitionClassNames:h}=(0,qe.A)(e,void 0,void 0,!1),u=(0,ji.A)(t.length?[...t,...i]:void 0,350)||[];(0,Qn.A)(c);const{observe:m}=(0,yr.BL)({rootRef:c,throttleMs:200,isDisabled:!e}),p=(0,T.A)(e=>{o(e.native),r({emoji:e.id})}),g=(0,T.A)(e=>{a(e),l({documentId:e.id})}),v=(0,T.A)(e=>{"native"in e?p(e):g(e)}),A=(0,T.A)((e,t)=>{o(e),r({emoji:t})}),f=(0,T.A)(e=>{a(e),l({documentId:e.id})}),C=Lg({isActive:e,isHorizontal:!0,items:u,shouldRemoveSelectionOnReset:!0,onSelect:v,onClose:s});(0,F.A)(([e])=>{void 0!==e&&-1!==e&&function(e,t){const i=t.current;if(!i)return;const{visibleIndexes:n,allElements:s}=Tg(i,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const o=n[0];if(!n.includes(e)||e===o&&!Mg(i,s[o],!0)){const t="start"==(e>n[n.length-1]?"start":"end")?44*e:0;(0,Mo.A)(i,t)}}(C,c)},[C]);const b=(0,ve.A)("EmojiTooltip composer-tooltip no-scrollbar",h);return(0,ne.Y)("div",{ref:c,className:b,children:d&&u?u.map((e,t)=>"native"in e?(0,ne.Y)(lv,{emoji:e,focus:C===t,onClick:A},e.id):(0,ne.Y)(Gv,{emoji:e,focus:C===t,onClick:f,observeIntersection:m},e.id)):d?(0,ne.Y)(Jn.A,{}):void 0})}),zv=(0,n.ph)(({title:e,description:t,thumbnail:i,thumbUrl:n,focus:s,transitionClassNames:o="",onClick:a})=>{let r;const c=(0,q.A)(i?(0,l.cy)(i):void 0);return(n=n||c)?r=(0,ne.Y)("img",{src:n,className:o,alt:"",decoding:"async",draggable:!1}):e&&(r=(0,Es.Qh)(e,1)),(0,ne.FD)(ui.A,{focus:s,className:(0,ve.A)("BaseResult chat-item-clickable","string"==typeof r&&"with-text"),onMouseDown:Dr.u,onClick:a,children:[(0,ne.Y)("span",{className:"thumb",children:"string"==typeof r?(0,Mt.A)(r):r}),(0,ne.FD)("div",{className:"content-inner",children:[e&&(0,ne.Y)("div",{className:"title",children:e}),t&&(0,ne.Y)("div",{className:"description",children:t})]})]})}),$v=(0,n.ph)(({focus:e,inlineResult:t,onClick:i})=>{const{title:n,description:s}=t,o="url"in t?t.url:void 0,a="webThumbnail"in t?t.webThumbnail:void 0,r=(0,T.A)(()=>{i(t)});return(0,ne.Y)(zv,{focus:e,thumbnail:a,title:n||o,description:s,onClick:r})}),qv=(0,n.ph)(({inlineResult:e,isSavedMessages:t,canSendGifs:i,observeIntersection:n,onClick:s})=>{const{gif:o}=e,a=(0,T.A)((t,i,n)=>{s(e,i,n)});if(o)return(0,ne.Y)(Sv,{gif:o,observeIntersection:n,className:"chat-item-clickable",onClick:i?a:void 0,isSavedMessages:t})}),Wv=(0,n.ph)(({focus:e,isForGallery:t,inlineResult:i,onClick:n})=>{let s,o,a;"photo"in i&&(s=i.photo),"thumbnail"in i&&(o=i.thumbnail),"webThumbnail"in i&&(a=i.webThumbnail);const r=(0,q.A)((0,l.cy)(a)),c=(0,q.A)(s&&(0,l.rI)(s,"pictogram")),d=(0,xi.A)(c||r),h=(0,T.A)(()=>{n(i)});if(t)return(0,ne.FD)("div",{className:"MediaResult chat-item-clickable",onClick:h,children:[(0,ne.Y)("img",{src:s?.thumbnail?.dataUri||r,alt:"",draggable:!1}),(0,ne.Y)("img",{src:c,className:(0,ve.A)("full-media",d),alt:"",draggable:!1})]});const{title:u,description:m}=i;return(0,ne.Y)(zv,{focus:e,thumbnail:a,thumbUrl:c||o?.dataUri,transitionClassNames:d,title:u,description:m,onClick:h})}),Qv=(0,n.ph)(({inlineResult:e,isSavedMessages:t,observeIntersection:i,onClick:n,isCurrentUserPremium:s})=>{const{sticker:o}=e;if(o)return(0,ne.Y)(Br,{sticker:o,size:a.mD0,observeIntersection:i,title:o.emoji,className:"chat-item-clickable",onClick:n,clickArg:e,isSavedMessages:t,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:s})}),Zv=(0,Ce.nF)(e=>e(),500,!0),Xv=(0,n.ph)(({isOpen:e,botId:t,isGallery:i,inlineBotResults:a,switchPm:r,switchWebview:l,isSavedMessages:c,canSendGifs:d,loadMore:h,onClose:m,onSelectResult:p,isCurrentUserPremium:g})=>{const{openChat:v,startBot:A,requestSimpleWebView:f}=(0,s.ko)(),C=(0,n.li)(),{shouldRender:b,transitionClassNames:y}=(0,qe.A)(e,void 0,void 0,!1),S=(0,Ii.A)(i,b),{observe:k}=(0,yr.BL)({rootRef:C,debounceMs:200,isDisabled:!e}),N=(0,T.A)(({direction:e})=>{e===o.TN.Backwards&&Zv(h)}),w=Lg({isActive:e,shouldRemoveSelectionOnReset:S,noArrowNavigation:S,items:a,onSelect:p,onClose:m});(0,n.vJ)(()=>{Bg(".chat-item-clickable",w,C)},[w]);const I=(0,T.A)(()=>{v({id:t}),A({botId:t,param:r.startParam})}),P=(0,T.A)(()=>{const e=(0,Vs.A)();f({botId:t,url:l.url,buttonText:l.text,theme:e,isFromSwitchWebView:!0})}),Y=(0,K.A)(a?.length?a:void 0,b),F=a?.length?a:Y;if(!b||!(F?.length||r||l))return;const D=(0,ve.A)("InlineBotTooltip composer-tooltip",u.TF?"no-scrollbar":"custom-scroll",S&&"gallery",y);return(0,ne.FD)(mn.A,{ref:C,className:D,items:F,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:N,sensitiveArea:160,children:[r&&(0,ne.Y)(ui.A,{ripple:!0,className:"switch-pm scroll-item",onClick:I,children:(0,ne.Y)("span",{className:"title",children:r.text})}),l&&(0,ne.Y)(ui.A,{ripple:!0,className:"switch-pm scroll-item",onClick:P,children:(0,ne.Y)("span",{className:"title",children:l.text})}),Boolean(F?.length)&&F.map((e,t)=>{switch(e.type){case"gif":return(0,ne.Y)(qv,{inlineResult:e,observeIntersection:k,onClick:p,isSavedMessages:c,canSendGifs:d},e.id);case"photo":return(0,ne.Y)(Wv,{isForGallery:S,inlineResult:e,onClick:p},e.id);case"sticker":return(0,ne.Y)(Qv,{inlineResult:e,observeIntersection:k,onClick:p,isSavedMessages:c,isCurrentUserPremium:g},e.id);case"video":case"file":case"game":return(0,ne.Y)(Wv,{focus:w===t,inlineResult:e,onClick:p},e.id);case"article":case"audio":case"voice":return(0,ne.Y)($v,{focus:w===t,inlineResult:e,onClick:p},e.id);default:return}})]})}),eA=(0,n.ph)(({isOpen:e,chatId:t,selectedSendAsId:i,sendAsPeerIds:o,isCurrentUserPremium:a,onClose:r})=>{const{saveDefaultSendAs:l,showNotification:c}=(0,s.ko)(),d=(0,s.mS)().users.byId,h=(0,s.mS)().chats.byId,m=(0,B.A)(),p=(0,n.li)(),[g,v,A]=(0,av.A)(e,r,void 0);(0,n.vJ)(()=>{e&&A()},[e,A]);const f=(0,T.A)(e=>{r(),l({chatId:t,sendAsId:e})}),C=Lg({isActive:e,items:o,onSelect:f,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:r});return(0,n.vJ)(()=>{Bg(".chat-item-clickable",C,p)},[C]),(0,n.vJ)(()=>{o&&!o.length&&r()},[o,r]),(0,ne.FD)(it.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SendAsMenu",onCloseAnimationEnd:r,onMouseEnter:u.TF?void 0:g,onMouseLeave:u.TF?void 0:v,noCloseOnBackdrop:!u.TF,noCompact:!0,children:[(0,ne.Y)("div",{className:"send-as-title",dir:"auto",children:m("SendMessageAsTitle")}),d&&h&&o?.map(({id:e,isPremium:t},n)=>{const s=d[e],o=h[e],r=s||o,l=(0,ve.A)(i===e&&"selected");return(0,ne.FD)(ui.A,{className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!t||a?f(e):c({message:m("SelectSendAsPeerPremiumHint"),actionText:m("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:C===n,rightElement:!a&&t&&(0,ne.Y)(he.A,{name:"lock-badge",className:"send-as-icon-locked"}),children:[(0,ne.Y)(Tt.A,{size:"small",peer:r,className:l}),(0,ne.FD)("div",{className:"info",children:[r&&(0,ne.Y)(jn.A,{peer:r,noFake:!0}),(0,ne.Y)("span",{className:"subtitle",children:s?m("VoipGroupPersonalAccount"):m("Subscribers",o?.membersCount,"i")})]})]},e)})]})}),tA=(0,n.ph)((0,s.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:o,isModalOpen:r,isCurrentUserPremium:l})=>{const{loadStickers:c,toggleStickerSet:d,openStickerSet:h}=(0,s.ko)(),u=(0,n.li)(),m=(0,B.A)(),p=i&&!i.isArchived&&Boolean(i.installedDate),g=Boolean(i?.stickers),v=(0,n.Kr)(()=>{if(!i)return[];const e=(i.stickers?.filter(({hasEffect:e})=>e)??[]).slice(0,3),t=(i.covers||[]).map(({id:e})=>e),n=i.stickers?i.stickers.filter(({id:e})=>!t.includes(e)):[];return[...e,...i.covers||[],...n].slice(0,5)},[i]);(0,n.vJ)(()=>{!g&&v.length<5&&i&&c({stickerSetInfo:{shortName:i.shortName}})},[g,v.length,c,i,e]);const A=(0,n.hb)(()=>{d({stickerSetId:e})},[d,e]),f=(0,n.hb)(e=>{h({stickerSetInfo:e.stickerSetInfo})},[h]);if(!i)return;const C=v.length>0;return(0,ne.FD)("div",{className:"sticker-set",dir:m.isRtl?"rtl":void 0,children:[(0,ne.FD)("div",{className:"sticker-set-header",children:[(0,ne.FD)("div",{className:"title-wrapper",children:[(0,ne.Y)("h3",{className:"title",dir:"auto",children:i.title}),(0,ne.Y)("p",{className:"count",dir:"auto",children:m("Stickers",i.count,"i")})]}),(0,ne.Y)(X.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,ne.FD)("div",{className:"sticker-set-main shared-canvas-container",children:[(0,ne.Y)("canvas",{ref:u,className:"shared-canvas"}),!C&&(0,ne.Y)(je.A,{}),C&&v.map(e=>(0,ne.Y)(Br,{sticker:e,size:a.Rqe,observeIntersection:t,noPlay:!o||r,clickArg:e,onClick:f,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:u}))]})]},i.id)})),iA=(0,Ce.nF)(e=>e(),6e4,!0),nA=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.BmE)(e),{query:i,resultIds:n}=t||{},{featured:s}=e.stickers;return{query:i,featuredIds:s.setIds,resultIds:n,isModalOpen:Boolean((0,c.nTw)(e).openedStickerSetShortName)}})(({isActive:e,query:t,featuredIds:i,resultIds:o,isModalOpen:a,onClose:r})=>{const{loadFeaturedStickers:l}=(0,s.ko)(),c=(0,n.li)(),d=(0,B.A)(),{observe:h}=(0,yr.BL)({rootRef:c,throttleMs:200});return(0,n.vJ)(()=>{iA(()=>{l()})}),(0,ke.A)({isActive:e,onBack:r}),(0,ne.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,ne.Y)(tA,{stickerSetId:e,observeIntersection:h,isModalOpen:a},e)):o?o.length?o.map(e=>(0,ne.Y)(tA,{stickerSetId:e,observeIntersection:h,isModalOpen:a},e)):(0,ne.Y)("p",{className:"helper-text",dir:"auto",children:"Nothing found."}):(0,ne.Y)(Jn.A,{})}()})})),sA=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.Wy7)(e),{query:i,results:n}=t||{},{chatId:s,threadId:o}=(0,c.Xf0)(e)||{},a=s?(0,c.hds)(e,s):void 0,r=s?(0,c.AWZ)(e,s):void 0,d=s?(0,c.ALW)(e,s):void 0,h=Boolean(s)&&(0,c.nZ4)(e,s),u=s&&o?(0,En.Vw)(e,s,o):void 0,m=Boolean(!u?.isCommentsInfo&&u?.fromChannelId),p=s&&o?(0,c.S0q)(e,s,o):void 0;return{query:i,results:n,chat:a,chatFullInfo:r,isChatWithBot:d,isSavedMessages:h,canPostInChat:Boolean(a)&&Boolean(o)&&(0,l.__)(a,p,m,r),canScheduleUntilOnline:Boolean(s)&&(0,c.RBq)(e,s),currentMessageList:(0,c.Xf0)(e)}})(({isActive:e,query:t,results:i,chat:o,chatFullInfo:a,isChatWithBot:r,canScheduleUntilOnline:c,isSavedMessages:d,canPostInChat:h,currentMessageList:m,onClose:p})=>{const{searchMoreGifs:g,sendMessage:v,setGifSearchQuery:A}=(0,s.ko)(),f=(0,n.li)(),[C,b]=(0,xm.A)(c),{observe:y}=(0,yr.BL)({rootRef:f,debounceMs:300}),S=h&&(0,l.Q_)(o,a,r,d).canSendGifs,k=(0,n.hb)((e,t,i)=>{if(S){if(!m)return;i?C((i,n)=>{v({messageList:m,gif:e,scheduledAt:i,scheduleRepeatPeriod:n,isSilent:t})}):v({messageList:m,gif:e,isSilent:t})}u.TF&&A({query:void 0})},[S,m,C]),N=(0,n.hb)(()=>{g()},[g]),w=(0,B.A)();(0,ke.A)({isActive:e,onBack:p});const I=Boolean(void 0!==t&&i&&i.length);return(0,ne.FD)("div",{className:"GifSearch",dir:w.isRtl?"rtl":void 0,children:[(0,ne.Y)(mn.A,{ref:f,className:(0,ve.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,ne.Y)(Sv,{gif:e,observeIntersection:y,onClick:S?k:void 0,isSavedMessages:d},e.id)):(0,ne.Y)("p",{className:"helper-text",dir:"auto",children:w("NoGIFsFound")}):(0,ne.Y)(Jn.A,{})}()}),b]})}));var oA=i(75319),aA=i(71950);const rA="OAKzmAva",lA="BQ6HUOqN",cA="U96CW2I7",dA="vXi2JQlj",hA="bi3fL59p",uA="GUK4ajPK",mA="YH6jeZIh",pA="q1LnuIUn",gA="PJZzyVLK",vA="C7NpG5Y9",AA=(0,n.ph)(function({postStatistic:e}){const t=(0,B.A)(),i=(0,Bi.A)();return(0,ne.FD)("div",{className:mA,children:[e.reactionsCount>0&&(0,ne.FD)("span",{className:pA,children:[(0,ne.Y)(he.A,{name:"heart-outline",className:gA}),(0,Es.Vw)(i,e.reactionsCount)]}),e.forwardsCount>0&&(0,ne.FD)("span",{className:pA,children:[(0,ne.Y)(he.A,{name:"forward",className:gA}),(0,Es.Vw)(i,e.forwardsCount)]}),!e.forwardsCount&&!e.reactionsCount&&t("ChannelStats.SharesCount_ZeroValueHolder")]})});function fA(e,t,i,n){return i?(0,ne.FD)("span",{children:[(0,ne.Y)("img",{src:i,alt:"",draggable:!1,className:(0,ve.A)(cA,n&&"yxjDeIct")}),(0,l.zX)(t)&&(0,ne.Y)(he.A,{name:"play"}),(0,A.C)(e,t,!0)]}):(0,A.C)(e,t)}const CA=(0,n.ph)(({postStatistic:e,message:t})=>{const i=(0,Bi.A)(),{toggleMessageStatistics:o}=(0,s.ko)(),a=(0,id.A)(t),r=(0,td.A)(t,"micro"),c=(0,q.A)(r),d=Boolean((0,l.lk)(t)),h=(0,n.hb)(()=>{o({messageId:t.id})},[o,t.id]);return(0,ne.FD)("div",{className:(0,ve.A)(rA,Boolean(c||a)&&lA),onClick:h,children:[(0,ne.FD)("div",{className:hA,children:[(0,ne.Y)("div",{className:dA,children:fA(i,t,c||a,d)}),(0,ne.Y)("div",{className:mA,children:i("ChannelStatsViewsCount",{count:e.viewsCount},{pluralValue:e.viewsCount})})]}),(0,ne.FD)("div",{className:uA,children:[(0,ne.Y)("div",{className:vA,children:(0,et.L2)(1e3*t.date,i.code)}),(0,ne.Y)(AA,{postStatistic:e})]})]})});function bA(e,t,i){return(0,ne.FD)("span",{children:[i?(0,ne.Y)("span",{className:"TmJvv2A6",children:(0,ne.Y)("img",{src:i,alt:"",draggable:!1,className:(0,ve.A)(cA,"cdfiLmXo","BOfHPv20")})}):(0,ne.Y)(Tt.A,{peer:t,size:"small",className:cA,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story")]})}const yA=(0,n.ph)(function({chat:e,story:t,postStatistic:i}){const n=(0,B.A)(),{toggleStoryStatistics:o}=(0,s.ko)(),a=t&&"content"in t,r=a?t.content.video:void 0,c=a?(0,l.EN)(t):void 0,d=(0,q.A)(c),h=d||r?.thumbnail?.dataUri,u=(0,T.A)(()=>{o({storyId:i.storyId})});return(0,ne.FD)("div",{className:(0,ve.A)(rA,lA),onClick:u,children:[(0,ne.FD)("div",{className:hA,children:[(0,ne.Y)("div",{className:dA,children:bA(n,e,d||h)}),(0,ne.Y)("div",{className:mA,children:n("ChannelStats.ViewsCount",i.viewsCount,"i")})]}),(0,ne.FD)("div",{className:uA,children:[(0,ne.Y)("div",{className:vA,children:a&&Boolean(t.date)&&(0,et.L2)(1e3*t.date,n.code)}),(0,ne.Y)(AA,{postStatistic:i})]})]})}),SA="T1l_4J8z",kA="S1x1ovkC",NA="aUrozL5_",wA="Atd3v2EL",IA="QQHwjG88",PA="QGctP1Nk";let YA,FA;const DA={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"},MA=Object.keys(DA),TA={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},BA=Object.keys(TA),LA=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.gqw)(e,t),n=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t)?.statisticsDcId,o="chatTypeSuperGroup"===n?.type,a=(0,c.zeq)(e,t),r=(0,c._bp)(e,t)?.byId;return{statistics:i,dcId:s,isGroup:o,chat:n,messagesById:a,storiesById:r}})(({chatId:e,chat:t,statistics:o,dcId:a,isGroup:r,messagesById:l,storiesById:c})=>{const d=(0,B.A)(),h=(0,n.li)(),[u,m]=(0,n.J0)(!1),p=(0,n.li)(new Set),g=(0,n.li)(new Set),{loadStatistics:v,loadStatisticsAsyncGraph:A}=(0,s.ko)(),f=(0,M.A)();(0,n.vJ)(()=>{v({chatId:e,isGroup:r})},[e,v,r]);const C=(0,n.Kr)(()=>r?BA:MA,[r]),b=(0,n.Kr)(()=>r?TA:DA,[r]);return(0,n.vJ)(()=>{o&&C.forEach(t=>{const i=o[t];(0,oA.R)(i)&&"async"===i.graphType&&A({name:t,chatId:e,token:i.token,isPercentage:"languagesGraph"===t})})},[C,e,o,A]),(0,n.vJ)(()=>{(async()=>{await async function(){return YA||(YA=i.e(4810).then(i.bind(i,24810)),FA=await YA),YA}(),u?o&&h.current&&(C.forEach((e,t)=>{const i=o[e];if(!(0,oA.R)(i))return;const n="async"===i.graphType,s="error"===i.graphType;if(n||p.current.has(e))return;if(s)return p.current.add(e),void g.current.add(e);const{zoomToken:r}=i;FA.create(h.current.children[t],{title:d(b[e]),...r?{onZoom:e=>(0,Gs.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:a}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e),h.current.children[t].classList.remove(PA)}),f()):m(!0)})()},[C,b,u,o,d,e,A,a,f]),(0,ne.FD)("div",{className:(0,ve.A)(SA,"panel-content custom-scroll",u&&NA),children:[o&&(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(aA.A,{statistics:o,type:r?"group":"channel",title:d("StatisticOverview")})}),!p.current.size&&(0,ne.Y)(Jn.A,{}),(0,ne.Y)("div",{ref:h,"data-stricterdom-ignore":!0,className:wA,children:C.map(e=>{const t=p.current.has(e)&&!g.current.has(e);return(0,ne.Y)("div",{className:(0,ve.A)(IA,!t&&PA)})})}),Boolean(o?.recentPosts?.length)&&(0,ne.FD)(Hd.Ay,{className:"suY9dEIz",children:[(0,ne.Y)("h2",{className:"evQIkAqx",children:d("ChannelStats.Recent.Header")}),o.recentPosts.map(e=>{if("msgId"in e){const t=l[e.msgId];if(!t||!("content"in t))return;return(0,ne.Y)(CA,{message:t,postStatistic:e},`statistic_message_${e.msgId}`)}if("storyId"in e&&t){const i=c?.[e.storyId];return(0,ne.Y)(yA,{chat:t,story:i,postStatistic:e},`statistic_story_${e.storyId}`)}})]})]})})),xA="oXLpD4Y4",RA="paQ2VBe_",EA="WvFuOAIf",VA=(0,n.ph)(({data:e})=>{const t=(0,B.A)(),{openChatByUsername:i}=(0,s.ko)(),o=(0,n.Kr)(()=>e.chat?(0,l.Kl)(e.chat):void 0,[e.chat]),a=(0,n.hb)(()=>{i({username:o,messageId:e.messageId})},[e.messageId,i,o]);return(0,ne.FD)("div",{className:(0,ve.A)(xA,"statistic-public-forward"),onClick:a,children:[(0,ne.Y)(Tt.A,{size:"medium",peer:e.chat}),(0,ne.FD)("div",{children:[(0,ne.Y)("div",{className:RA,children:e.title}),(0,ne.Y)("div",{className:EA,children:t("ChannelStats.ViewsCount",e.views,"i")})]})]})});let _A,UA;const OA={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},KA=Object.keys(OA),JA=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,n=(0,c.nTw)(e);return{statistics:n.statistics.currentMessage,dcId:i,messageId:n.statistics.currentMessageId}})(function({chatId:e,isActive:t,statistics:a,dcId:r,messageId:l}){const c=(0,Bi.A)(),d=(0,B.A)(),h=(0,n.li)(),[u,m]=(0,n.J0)(!1),p=(0,n.li)(new Set),g=(0,n.li)(new Set),{loadMessageStatistics:v,loadMessagePublicForwards:A,loadStatisticsAsyncGraph:f}=(0,s.ko)(),C=(0,M.A)();(0,n.vJ)(()=>{l&&v({chatId:e,messageId:l})},[e,v,l]),(0,n.vJ)(()=>{t&&!l||(p.current.clear(),g.current.clear(),m(!1))},[t,l]),(0,n.vJ)(()=>{a&&KA.forEach(t=>{const i=a[t];(0,oA.R)(i)&&"async"===i.graphType&&f({name:t,chatId:e,token:i.token})})},[e,a,f]),(0,n.vJ)(()=>{(async()=>{await async function(){return _A||(_A=i.e(4810).then(i.bind(i,24810)),UA=await _A),_A}(),u?a&&h.current&&(KA.forEach((e,t)=>{const i=a[e];if(!(0,oA.R)(i))return;const n="async"===i.graphType,s="error"===i.graphType;if(n||p.current.has(e))return;if(s)return p.current.add(e),void g.current.add(e);const{zoomToken:o}=i;UA.create(h.current.children[t],{title:d(OA[e]),...o?{onZoom:e=>(0,Gs.px)("fetchStatisticsAsyncGraph",{token:o,x:e,dcId:r}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e)}),C()):m(!0)})()},[u,a,d,e,l,f,r,C]);const b=(0,T.A)(({direction:t})=>{t===o.TN.Backwards&&l&&A({chatId:e,messageId:l})});return u&&a&&l?(0,ne.FD)("div",{className:(0,ve.A)(SA,"custom-scroll",u&&NA),children:[(0,ne.Y)(Hd.Qg,{children:c("StatisticOverview")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(aA.A,{statistics:a,type:"message"})}),(!p.current.size||!a.publicForwardsData)&&(0,ne.Y)(Jn.A,{}),(0,ne.Y)("div",{ref:h,className:wA,"data-stricterdom-ignore":!0,children:KA.map(e=>{const t=p.current.has(e)&&!g.current.has(e);return(0,ne.Y)("div",{className:(0,ve.A)(IA,!t&&PA)})})}),Boolean(a.publicForwards)&&(0,ne.FD)("div",{className:kA,children:[(0,ne.Y)(Hd.Qg,{children:c("StatsMessagePublicShares")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(mn.A,{items:a.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:b,noFastList:!0,children:a.publicForwardsData.map(e=>(0,ne.Y)(VA,{data:e},e.messageId))})})]})]},`${e}-${l}`):(0,ne.Y)(Jn.A,{})})),jA=(0,n.ph)(function({data:e,chatsById:t,usersById:i}){const n=(0,B.A)(),{openChat:o}=(0,s.ko)(),a=i[e.peerId],r=t[e.peerId],c=(0,T.A)(()=>{o({id:a.id})});return(0,ne.FD)("div",{className:(0,ve.A)(xA,"statistic-public-forward"),onClick:c,children:[(0,ne.Y)(Tt.A,{size:"medium",peer:a||r,withStorySolid:!0,forceUnreadStorySolid:!0}),(0,ne.FD)("div",{children:[(0,ne.Y)("div",{className:RA,children:a?(0,l.Yg)(a):(0,l.Js)(n,r)}),(0,ne.Y)("div",{className:EA,children:e.viewsCount?n("ChannelStats.ViewsCount",e.viewsCount,"i"):n("NoViews")})]})]})});let GA,HA;const zA={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},$A=Object.keys(zA),qA=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,n=(0,c.nTw)(e),s=n.statistics.currentStory,o=n.statistics.currentStoryId,{byId:a}=e.users,{byId:r}=e.chats;return{statistics:s,dcId:i,storyId:o,usersById:a,chatsById:r}})(function({chatId:e,isActive:t,statistics:o,dcId:a,storyId:r,chatsById:l,usersById:c}){const d=(0,B.A)(),h=(0,n.li)(),[u,m]=(0,n.J0)(!1),p=(0,n.li)(new Set),g=(0,n.li)(new Set),{loadStoryStatistics:v,loadStoryPublicForwards:A,loadStatisticsAsyncGraph:f}=(0,s.ko)(),C=(0,M.A)();(0,n.vJ)(()=>{r&&v({chatId:e,storyId:r})},[e,r]),(0,n.vJ)(()=>{t&&!r||(p.current.clear(),g.current.clear(),m(!1))},[t,r]),(0,n.vJ)(()=>{o&&$A.forEach(t=>{const i=o[t];(0,oA.R)(i)&&"async"===i.graphType&&f({name:t,chatId:e,token:i.token})})},[e,o,f]),(0,n.vJ)(()=>{(async()=>{await async function(){return GA||(GA=i.e(4810).then(i.bind(i,24810)),HA=await GA),GA}(),u?o&&h.current&&($A.forEach((e,t)=>{const i=o[e];if(!(0,oA.R)(i))return;const n="async"===i.graphType,s="error"===i.graphType;if(n||p.current.has(e))return;if(s)return p.current.add(e),void g.current.add(e);const{zoomToken:r}=i;HA.create(h.current.children[t],{title:d(zA[e]),...r?{onZoom:e=>(0,Gs.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:a}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e)}),C()):m(!0)})()},[u,o,d,e,r,f,a,C]);const b=(0,T.A)(()=>{r&&A({chatId:e,storyId:r})});return u&&o&&r?(0,ne.FD)("div",{className:(0,ve.A)(SA,"custom-scroll",u&&NA),children:[(0,ne.Y)(aA.A,{statistics:o,type:"story",title:d("StatisticOverview")}),!p.current.size&&(0,ne.Y)(Jn.A,{}),(0,ne.Y)("div",{ref:h,"data-stricterdom-ignore":!0,children:$A.map(e=>{const t=p.current.has(e)&&!g.current.has(e);return(0,ne.Y)("div",{className:(0,ve.A)(IA,!t&&PA)})})}),Boolean(o.publicForwards)&&(0,ne.FD)("div",{className:kA,children:[(0,ne.Y)("h2",{className:"WxL3i5PM",children:d("Stats.Message.PublicShares")}),(0,ne.Y)(mn.A,{items:o.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:b,noFastList:!0,children:o.publicForwardsData.map(e=>"messageId"in e?(0,ne.Y)(VA,{data:e},`message_${e.messageId}`):(0,ne.Y)(jA,{data:e,chatsById:l,usersById:c},`story_${e.storyId}`))})]})]},`${e}-${r}`):(0,ne.Y)(Jn.A,{})}));var WA=i(55573);const QA=(0,n.ph)((0,s.EK)((e,{answer:t})=>{const{votesByOption:i,offsets:n}=(0,c.nTw)(e).pollResults;return{votes:i?.[t.option],offset:n?.[t.option]||""}})(({chat:e,message:t,answer:i,answerVote:o,totalVoters:a,votes:r,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:h}=(0,s.ko)(),u=(0,K.A)(o.votersCount),[m,p]=(0,n.J0)(!0),v=Boolean(r),{option:A,text:f}=i,C=(0,B.A)();(0,n.vJ)(()=>{v&&u===o.votersCount||c({chat:e,messageId:t.id,option:A,offset:l,limit:4,shouldResetVoters:!0})},[o.votersCount,v]);const b=(0,n.hb)(()=>{p(!0),c({chat:e,messageId:t.id,option:A,offset:l,limit:50})},[e,c,t.id,l,A]);(0,n.vJ)(()=>{p(!1)},[r]);const y=(0,n.hb)(e=>{d({id:e}),h()},[h,d]);return(0,ne.FD)("div",{className:"PollAnswerResults",children:[(0,ne.FD)("div",{className:"poll-voters",children:[r?r.map(({peerId:e,date:t})=>(0,ne.FD)(ui.A,{className:"chat-item-clickable",onClick:()=>y(e),children:[(0,g.L8)(e)?(0,ne.Y)(An.A,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):(0,ne.Y)(vn.A,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0}),(0,ne.Y)("span",{className:"vote-date",children:(0,et.fS)(C,1e3*t,!0)})]},e)):(0,ne.Y)(Jn.A,{}),r&&function(){const e=o.votersCount-r.length;return o.votersCount>4&&e>0&&(0,ne.Y)(WA.A,{count:e,itemName:"voter",isLoading:m,onClick:b})}()]}),(0,ne.FD)("div",{className:"answer-head",dir:C.isRtl?"rtl":void 0,children:[(0,ne.Y)("span",{className:"answer-title",dir:"auto",children:(0,Gi.fd)({text:f.text,entities:f.entities})}),(0,ne.FD)("span",{className:"answer-percent",dir:C.isRtl?"auto":void 0,children:[(S=o.votersCount,k=a,k>0?(S/k*100).toFixed():0),"%"]})]})]});var S,k})),ZA=(0,n.ph)((0,s.EK)(e=>{const{pollResults:{chatId:t,messageId:i}}=(0,c.nTw)(e),n=t?(0,c.hds)(e,t):void 0,s=t&&i?(0,c.O5q)(e,t,i):void 0;return{chat:n,message:s,poll:s&&(0,c.zcZ)(e,s)}})(({isActive:e,chat:t,message:i,poll:n,onClose:s})=>{const o=(0,B.A)();if((0,ke.A)({isActive:e,onBack:s}),!i||!n||!t)return(0,ne.Y)(Jn.A,{});const{summary:a,results:r}=n;return r.resultByOption?(0,ne.FD)("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0,children:[(0,ne.Y)("h3",{className:"poll-question",dir:"auto",children:(0,Gi.fd)({text:a.question.text,entities:a.question.entities})}),(0,ne.Y)("div",{className:"poll-results-list custom-scroll",children:a.answers.map(e=>(0,ne.Y)(QA,{chat:t,message:i,answer:e,answerVote:r.resultByOption[e.option],totalVoters:r.totalVoters},`${n.summary.id}-${e.option}`))})]}):void 0}));var XA=i(90603);const ef="xrnUE4e6",tf="z7kF7tij",nf="CWsWIKQ1",sf="KBl0ycLl",of="iJ1U9kDD",af="Rk6PT_yc",rf="qlo3vSEw",lf="r06zwL42",cf=5*v.$,df=(0,n.ph)((0,s.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:o,onClose:r})=>{const{createTopic:l,openPremiumModal:c}=(0,s.ko)(),[d,h]=(0,n.J0)(""),[u,m]=(0,n.J0)(0),[p,g]=(0,n.J0)(void 0),v=(0,B.A)(),A=Boolean(d),f=Boolean(i?.isLoading);(0,ke.A)({isActive:e,onBack:r}),(0,n.vJ)(()=>{e||(h(""),g(void 0))},[e]);const C=(0,n.hb)(e=>{h(e.target.value)},[]),b=(0,n.hb)(()=>{m(e=>(0,Jo.A)((0,XA.e$)().length,e+1))},[]),y=(0,n.hb)(()=>{l({chatId:t.id,title:d,iconColor:(0,XA.e$)()[u],iconEmojiId:p})},[t,l,u,p,d]),S=(0,n.hb)(e=>{e.isFree||o||e.id===a.MyF?e.id!==a.MyF?g(e.id):g(void 0):c({initialSection:"animated_emoji"})},[o,c]),k=(0,n.Kr)(()=>({id:0,title:d,iconColor:(0,XA.e$)()[u],iconEmojiId:p}),[u,p,d]);if(t?.isForum)return(0,ne.FD)("div",{className:ef,children:[(0,ne.FD)("div",{className:(0,ve.A)(tf,"custom-scroll"),children:[(0,ne.FD)(Hd.Ay,{className:nf,children:[(0,ne.Y)("span",{className:rf,children:v("CreateTopicTitle")}),(0,ne.Y)(ae.Ay,{name:"zoomFade",activeKey:Number(k.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:of,children:(0,ne.Y)(Gn.A,{topic:k,className:(0,ve.A)(af,"K1CTKtBS"),onClick:b,size:cf,noLoopLimit:!0})}),(0,ne.Y)(ee.A,{value:d,onChange:C,label:v("lng_forum_topic_title"),disabled:f,teactExperimentControlled:!0})]}),(0,ne.Y)(Hd.Ay,{className:sf,children:(0,ne.Y)(qr,{idPrefix:"create-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:S,className:lf,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]}),(0,ne.Y)(fi.A,{isShown:A,disabled:f,onClick:y,ariaLabel:v("Save"),iconName:"check",isLoading:f})]})})),hf=5*v.$,uf=(0,n.ph)((0,s.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:o,isCurrentUserPremium:r,onClose:l})=>{const{editTopic:c,openPremiumModal:d}=(0,s.ko)(),[h,u]=(0,n.J0)(""),[m,p]=(0,n.J0)(void 0),g=(0,B.A)(),v=Boolean(o?.isLoading),A=i?.id===a.HxB;(0,ke.A)({isActive:e,onBack:l}),(0,n.vJ)(()=>{e||(u(""),p(void 0))},[e]),(0,n.vJ)(()=>{(i?.title||i?.iconEmojiId)&&(u(i.title),p(i.iconEmojiId))},[i]);const f=(0,n.Kr)(()=>h!==i?.title||m!==i?.iconEmojiId,[m,h,i?.iconEmojiId,i?.title]),C=(0,n.hb)(e=>{const t=e.target.value;u(t)},[]),b=(0,n.hb)(()=>{c({chatId:t.id,title:h,topicId:i.id,iconEmojiId:m})},[t,c,m,h,i]),y=(0,n.hb)(e=>{"Enter"!==e.key||e.isComposing||v||!f||(e.preventDefault(),b())},[b,v,f]),S=(0,n.hb)(e=>{e.isFree||r||e.id===a.MyF?e.id!==a.MyF?p(e.id):p("0"):d({initialSection:"animated_emoji"})},[r,d]),k=(0,n.Kr)(()=>({...i,title:h,iconEmojiId:m}),[m,h,i]);if(t?.isForum)return(0,ne.FD)("div",{className:ef,children:[(0,ne.FD)("div",{className:(0,ve.A)(tf,"custom-scroll"),children:[!i&&(0,ne.Y)(Jn.A,{}),i&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(Hd.Ay,{className:(0,ve.A)(nf,A&&"YftUWqqw"),children:[(0,ne.Y)("span",{className:rf,children:g(A?"CreateGeneralTopicTitle":"CreateTopicTitle")}),(0,ne.Y)(ae.Ay,{name:"zoomFade",activeKey:Number(k.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:of,children:(0,ne.Y)(Gn.A,{topic:k,className:af,size:hf,noLoopLimit:!0})}),(0,ne.Y)(ee.A,{value:h,onChange:C,onKeyDown:y,label:g("lng_forum_topic_title"),disabled:v,teactExperimentControlled:!0})]}),!A&&(0,ne.Y)(Hd.Ay,{className:sf,children:(0,ne.Y)(qr,{idPrefix:"edit-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:S,className:lf,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]})]}),(0,ne.Y)(fi.A,{isShown:f,disabled:v,onClick:b,ariaLabel:g("Save"),iconName:"check",isLoading:v})]})})),mf="Please provide name",pf=(0,n.ph)((0,s.EK)((e,{userId:t})=>{const i=(0,c.yps)(e,t),n=(0,c.vGo)(e,t),{progress:s}=(0,c.nTw)(e).management,o=(0,In.d)(e,"aboutLength");return{userId:t,user:i,progress:s,currentBio:n?.bio,maxBioLength:o}})(({userId:e,user:t,progress:i,currentBio:a,isActive:r,maxBioLength:c,onClose:d})=>{const{setBotInfo:h,uploadProfilePhoto:u,uploadContactProfilePhoto:m,startBotFatherConversation:p}=(0,s.ko)(),[g,v,A]=(0,D.A)(!1),[f,C,b]=(0,D.A)(!1),[y,S]=(0,n.J0)(),k=(0,B.A)(),N=(0,n.Kr)(()=>t?(0,l.Kl)(t):void 0,[t]);(0,ke.A)({isActive:r,onBack:d});const w=t?(0,l.u0)(t):"",[I,P]=(0,n.J0)(),[Y,F]=(0,n.J0)(w||""),[M,L]=(0,n.J0)(a||""),x=t&&(0,l.cP)(t),R=(0,q.A)(x,!1,j.qZ.BlobUrl);(0,n.vJ)(()=>{A(),b()},[e]),(0,n.vJ)(()=>{F(w||""),L(a||"")},[w,a,t]),(0,n.vJ)(()=>{P(void 0)},[R]),(0,n.vJ)(()=>{i===o.TD.Complete&&(A(),b(),S(void 0))},[i]);const E=(0,T.A)(e=>{F(e.target.value),v(),y===mf&&S(void 0)}),V=(0,T.A)(e=>{L(e.target.value),v()}),_=(0,T.A)(e=>{P(e),C()}),U=(0,T.A)(()=>{const e=Y.trim(),i=M.trim();e.length?(h({...g&&{bot:t,name:e,description:i}}),I&&u({file:I,...f&&{bot:t}})):S(mf)}),O=(0,T.A)(()=>{p({param:`${N}-intro`})}),K=(0,T.A)(()=>{p({param:`${N}-commands`})}),J=(0,T.A)(()=>{p({param:N})}),G=(0,n.li)(),H=(0,n.li)(!1),z=(0,T.A)(t=>{C(),m({userId:e,file:t,isSuggest:H.current})});if(!t)return;const $=i===o.TD.InProgress;return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(Gh.A,{currentAvatarBlobUrl:R,onChange:_,title:k("ChatSetPhotoOrVideo"),disabled:$}),(0,ne.Y)(ee.A,{id:"user-name",label:k("PaymentCheckoutName"),onChange:E,value:Y,error:y===mf?y:void 0,teactExperimentControlled:!0}),(0,ne.Y)(Is.A,{value:M,onChange:V,label:k("DescriptionPlaceholder"),disabled:$,maxLength:c,maxLengthIndicator:c?(c-M.length).toString():void 0})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)("div",{className:"dialog-buttons",children:[(0,ne.Y)(ui.A,{icon:"bot-commands-filled",ripple:!0,onClick:O,children:(0,ne.Y)("span",{children:k("BotEditIntro")})}),(0,ne.Y)(ui.A,{icon:"bot-command",ripple:!0,onClick:K,children:(0,ne.Y)("span",{children:k("BotEditCommands")})}),(0,ne.Y)(ui.A,{icon:"bots",ripple:!0,onClick:J,children:(0,ne.Y)("span",{children:k("BotChangeSettings")})}),(0,ne.Y)(Hd.IW,{children:(0,Mt.A)(k("BotManageInfo"),["links"])})]})})]}),(0,ne.Y)(fi.A,{isShown:g||f,onClick:U,disabled:$,ariaLabel:k("Save"),iconName:"check",isLoading:$}),(0,ne.Y)(Eu.A,{onChange:z,inputRef:G})]})})),gf="Channel title can't be empty",vf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{management:n}=(0,c.nTw)(e),{progress:s}=n,{invites:o}=n.byChatId[t]||{},a=e.appConfig.channelAutoTranslationLevelMin,r=i?.hasAutoTranslation,d=i?.level,h=!(!d||!a)&&d>=a;return{chat:i,chatFullInfo:(0,c.AWZ)(e,t),progress:s,canChangeInfo:(0,l.ub)(i,"changeInfo"),canInvite:(0,l.ub)(i,"inviteUsers"),exportedInvites:o,availableReactions:e.reactions.availableReactions,hasAutoTranslation:r,canToggleAutoTranslation:h}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:a,canChangeInfo:r,canInvite:d,exportedInvites:h,isActive:u,availableReactions:m,onScreenSelect:p,onClose:g,hasAutoTranslation:v,canToggleAutoTranslation:A})=>{const{updateChat:f,closeManagement:C,leaveChannel:b,deleteChannel:y,openChat:S,loadExportedChatInvites:k,loadChatJoinRequests:N,toggleAutoTranslation:w}=(0,s.ko)(),I=t?.title||"",P=i?.about||"",Y=Boolean(i?.linkedChatId),[F,M,L]=(0,D.A)(),[x,R]=(0,n.J0)(!1),[E,V]=(0,n.J0)(I),[_,U]=(0,n.J0)(P),[O,K]=(0,n.J0)(),[J,G]=(0,n.J0)(),H=t&&(0,l.cP)(t),z=(0,q.A)(H,!1,j.qZ.BlobUrl),$=(0,B.A)(),W=t&&(0,l.WX)(t),Q=(0,T.A)(()=>{w({chatId:e,isEnabled:!v})});(0,ke.A)({isActive:u,onBack:g}),(0,n.vJ)(()=>{d&&(k({chatId:e}),k({chatId:e,isRevoked:!0}),N({chatId:e}))},[e,d]),(0,n.vJ)(()=>{a===o.TD.Complete&&(R(!1),G(void 0))},[a]);const Z=(0,n.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),X=i?.kickedMembers?.length||0,te=(0,T.A)(()=>{p(o.je.ChatPrivacyType)}),ie=(0,T.A)(()=>{p(o.je.Discussion)}),se=(0,T.A)(()=>{p(o.je.Reactions)}),oe=(0,T.A)(()=>{p(o.je.ChatAdministrators)}),ae=(0,T.A)(()=>{p(o.je.Invites)}),re=(0,T.A)(()=>{p(o.je.JoinRequests)}),le=(0,T.A)(e=>{K(e),R(!0)}),ce=(0,T.A)(e=>{V(e.target.value),R(!0)}),de=(0,T.A)(e=>{U(e.target.value),R(!0)}),he=(0,T.A)(()=>{const t=E.trim(),i=_.trim();t.length?f({chatId:e,title:t,about:i,photo:O}):G(gf)}),ue=(0,T.A)(()=>{p(o.je.ChannelSubscribers)}),me=(0,T.A)(()=>{p(o.je.ChannelRemovedUsers)}),pe=(0,T.A)(()=>{t.isCreator?y({chatId:t.id}):b({chatId:t.id}),L(),C(),S({id:void 0})}),ge=(0,n.Kr)(()=>{if(!i?.enabledReactions)return $("ReactionsOff");if("all"===i.enabledReactions.type)return $("ReactionsAll");const e=i.enabledReactions.allowed.length,t=m?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[m,i?.enabledReactions,$]),ve=(0,n.Kr)(()=>(0,l.gA)(t),[t]);if((0,c._ls)((0,s.mS)(),e)||t.isForbidden)return;const Ae=a===o.TD.InProgress;return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Gh.A,{currentAvatarBlobUrl:z,onChange:le,disabled:!r}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)("div",{className:"settings-edit",children:[(0,ne.Y)(ee.A,{id:"channel-title",label:$("EnterChannelName"),onChange:ce,value:E,error:J===gf?J:void 0,disabled:!r}),(0,ne.Y)(Is.A,{id:"channel-about",label:$("DescriptionPlaceholder"),onChange:de,value:_,maxLength:255,maxLengthIndicator:(255-_.length).toString(),disabled:!r,noReplaceNewlines:!0})]}),t.isCreator&&(0,ne.FD)(ui.A,{icon:"lock",multiline:!0,onClick:te,children:[(0,ne.Y)("span",{className:"title",children:$("ChannelType")}),(0,ne.Y)("span",{className:"subtitle",children:$(ve?"TypePublic":"TypePrivate")})]}),(0,ne.FD)(ui.A,{icon:"message",multiline:!0,onClick:ie,disabled:!r,children:[(0,ne.Y)("span",{className:"title",children:$("Discussion")}),(0,ne.Y)("span",{className:"subtitle",children:$(Y?"DiscussionUnlink":"Add")})]}),d&&(0,ne.FD)(ui.A,{icon:"link",onClick:ae,multiline:!0,disabled:!h,children:[(0,ne.Y)("span",{className:"title",children:$("GroupInfo.InviteLinks")}),(0,ne.Y)("span",{className:"subtitle",children:h?(0,Es.Sm)(h.length):$("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ne.FD)(ui.A,{icon:"add-user-filled",onClick:re,multiline:!0,children:[(0,ne.Y)("span",{className:"title",children:$("SubscribeRequests")}),(0,ne.Y)("span",{className:"subtitle",children:(0,Es.Sm)(t.joinRequests.length)})]}),(0,ne.FD)(ui.A,{icon:"heart-outline",multiline:!0,onClick:se,disabled:!r,children:[(0,ne.Y)("span",{className:"title",children:$("Reactions")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:ge})]}),W&&(0,ne.FD)(ui.A,{icon:"language",narrow:!0,ripple:!0,disabled:!A,onClick:Q,children:[(0,ne.Y)("span",{children:$("AutomaticTranslation")}),(0,ne.Y)(Nh.A,{id:"auto-translation",checked:Boolean(v)})]})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)(ui.A,{icon:"admin",multiline:!0,onClick:oe,children:[(0,ne.Y)("span",{className:"title",children:$("ChannelAdministrators")}),(0,ne.Y)("span",{className:"subtitle",children:Z})]}),(0,ne.FD)(ui.A,{icon:"group",multiline:!0,onClick:ue,children:[(0,ne.Y)("span",{className:"title",dir:"auto",children:$("ChannelSubscribers")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:(0,Es.Sm)(t.membersCount)})]}),(0,ne.FD)(ui.A,{icon:"delete-user",multiline:!0,onClick:me,children:[(0,ne.Y)("span",{className:"title",children:$("ChannelBlockedUsers")}),(0,ne.Y)("span",{className:"subtitle",children:X})]})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:M,children:t.isCreator?$("ChannelDelete"):$("LeaveChannel")})})]}),(0,ne.Y)(fi.A,{isShown:x,onClick:he,disabled:Ae,ariaLabel:$("Save"),iconName:"check",isLoading:Ae}),(0,ne.Y)(ci.A,{isOpen:F,onClose:L,text:t.isCreator?$("ChannelDeleteAlert"):$("ChannelLeaveAlert"),confirmLabel:t.isCreator?$("ChannelDelete"):$("LeaveChannel"),confirmHandler:pe,confirmIsDestructive:!0})]})})),Af=(0,n.ph)((0,s.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:a,adminMembersById:r,onScreenSelect:c,onChatMemberSelect:d,onClose:h})=>{const{toggleSignatures:u}=(0,s.ko)(),m=(0,B.A)();(0,ke.A)({isActive:e,onBack:h});const p=Boolean(t?.areSignaturesShown),g=Boolean(t?.areProfilesShown),v=Boolean(t?.isCreator||t&&(0,l.ub)(t,"addAdmins")),A=i&&(0,l.ub)(t,"postMessages"),f=(0,n.Kr)(()=>{if(!r)return[];const[e,t]=(0,pi.jB)(Object.values(r),e=>e.isOwner);return[...e,...t]},[r]),C=(0,T.A)(e=>{d(e.userId,e.promotedByUserId===a),c(o.je.ChatAdminRights)}),b=(0,T.A)(()=>{u({chatId:t.id,areProfilesEnabled:g,areSignaturesEnabled:!p})}),y=(0,T.A)(()=>{u({chatId:t.id,areProfilesEnabled:!g,areSignaturesEnabled:p})}),S=(0,T.A)(()=>{c(o.je.GroupAddAdmins)}),k=(0,T.A)(e=>{if(e.isOwner)return m("ChannelCreator");const t=(0,s.mS)().users.byId,i=e.promotedByUserId?t[e.promotedByUserId]:void 0;return i?m("EditAdminPromotedBy",(0,l.Yg)(i)):m("ChannelAdmin")});return(0,ne.Y)("div",{className:"Management",children:(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{icon:"recent",multiline:!0,disabled:!0,children:[(0,ne.Y)("span",{className:"title",children:m("EventLog")}),(0,ne.Y)("span",{className:"subtitle",children:m(i?"EventLogInfoDetailChannel":"EventLogInfoDetail")})]})}),(0,ne.Y)(Hd.IW,{dir:"auto",children:m(i?"Channel.Management.AddModeratorHelp":"Group.Management.AddModeratorHelp")}),(0,ne.FD)(Hd.Ay,{dir:m.isRtl?"rtl":void 0,children:[f.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable",onClick:()=>C(e),children:(0,ne.Y)(An.A,{userId:e.userId,status:k(e),forceShowSelf:!0})},e.userId)),(0,ne.Y)(fi.A,{isShown:v,onClick:S,ariaLabel:m("Channel.Management.AddModerator"),iconName:"add-user-filled"})]}),A&&(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)("div",{className:"ListItem narrow",children:(0,ne.Y)(es.A,{checked:p,label:m("ChannelSignMessages"),onChange:b})}),p&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("div",{className:"ListItem narrow",children:(0,ne.Y)(es.A,{checked:g,label:m("ChannelSignMessagesWithProfile"),onChange:y})}),(0,ne.Y)(Hd.IW,{children:m("ChannelSignProfilesInfo")})]})]})]})})})),ff=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{isUsernameAvailable:n,checkedUsername:s,error:o}=(0,c.YK)(e,t);return{chat:i,isChannel:(0,l.WX)(i),progress:(0,c.nTw)(e).management.progress,error:o,isUsernameAvailable:n,checkedUsername:s,isProtected:i?.isProtected,maxPublicLinks:(0,In.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:g})=>{const{updatePublicLink:v,updatePrivateLink:A,toggleIsProtected:f,openLimitReachedModal:C,resetManagementError:b}=(0,s.ko)(),y=(0,n.Kr)(()=>e.usernames?.find(({isEditable:e})=>e),[e.usernames]),S=y?.username||"",k=(0,n.Kr)(()=>(0,l.gA)(e),[e]),[N,w]=(0,n.J0)(!1),[I,P]=(0,n.J0)(k?"public":"private"),[Y,F]=(0,n.J0)(),[M,T,L]=(0,D.A)(),[x,R,E]=(0,D.A)(),V=(0,K.A)(c),_=N&&Boolean("public"===I&&(Y||S&&""===Y)&&(c??V)||"private"===I&&k);(0,ke.A)({isActive:t,onBack:g}),(0,n.vJ)(()=>{w(!1)},[S]),(0,n.vJ)(()=>{I&&!p&&A()},[I,p,A]);const U=(0,n.hb)(t=>{F(t),w(!0),h&&b({chatId:e.id})},[e.id,h]),O=(0,n.hb)((e,t)=>{if(Object.values((0,s.mS)().chats.byId).filter(({isCreator:e,usernames:t})=>e&&t?.some(e=>e.isActive)).length>=m&&"public"===e){C({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,C]),J=(0,n.hb)(t=>{f({chatId:e.id,isProtected:"protected"===t})},[e.id,f]),j=(0,n.hb)(()=>{k&&"private"===I?R():v({username:"public"===I&&Y||""})},[k,R,I,v,Y]),G=(0,n.hb)(()=>{v({username:"",shouldDisableUsernames:!0}),E()},[E,v]),H=(0,n.hb)(()=>{L(),A()},[L,A]),z=(0,B.A)(),$=i?"Channel":"Mega",q=i?"Channel":"Group",W=[{value:"private",label:z(`${$}Private`),subLabel:z(`${$}PrivateInfo`)},{value:"public",label:z(`${$}Public`),subLabel:z(`${$}PublicInfo`)}],Q=[{value:"allowed",label:z("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:z("ChannelVisibility.Forwarding.Disabled")}],Z=r===o.TD.InProgress,X="public"===I&&e.usernames&&e.usernames.length>0;return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:z(`${q}Type`)}),(0,ne.Y)(Hd.Ay,{dir:z.isRtl?"rtl":void 0,children:(0,ne.Y)(ie.A,{selected:I,name:"channel-type",options:W,onChange:O})}),"private"===I?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:z("InviteLink.InviteLink")}),(0,ne.Y)(Hd.Ay,{dir:z.isRtl?"rtl":void 0,children:p?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(ol.A,{link:p,className:"invite-link",noTitle:!0}),(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:T,children:z("RevokeLink")}),(0,ne.Y)(ci.A,{isOpen:M,onClose:L,text:z("RevokeAlert"),confirmLabel:z("RevokeButton"),confirmHandler:H,confirmIsDestructive:!0})]}):(0,ne.Y)(Jn.A,{})}),(0,ne.Y)(Hd.IW,{dir:z.isRtl?"rtl":void 0,children:z(`${$}PrivateLinkHelp`)})]}):(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{className:"settings-input",children:(0,ne.Y)(jh,{asLink:!0,currentUsername:S,isLoading:Z,isUsernameAvailable:c,checkedUsername:d,onChange:U})})}),h===a.Y3M&&function(){const e=`${a.jsp}${a.NjX}`;return(0,ne.Y)(Hd.IW,{dir:"auto",children:z("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,ne.Y)(us.A,{url:e,text:`@${a.NjX}`}):t)})}(),(0,ne.Y)(Hd.IW,{dir:"auto",children:z(`${q}.Username.CreatePublicLinkHelp`)})]}),X&&(0,ne.Y)(Uh,{chatId:e.id,usernames:e.usernames,onEditUsername:U}),(0,ne.Y)(Hd.Qg,{dir:z.isRtl?"rtl":void 0,children:z(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")}),(0,ne.Y)(Hd.Ay,{dir:z.isRtl?"rtl":void 0,children:(0,ne.Y)(ie.A,{selected:u?"protected":"allowed",name:"forwarding-type",options:Q,onChange:J})}),(0,ne.Y)(Hd.IW,{children:z(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")})]}),(0,ne.Y)(fi.A,{isShown:_,disabled:Z,ariaLabel:z("Save"),onClick:j,iconName:"check",isLoading:Z}),(0,ne.Y)(ci.A,{isOpen:x,onClose:E,text:z("ChannelVisibility.Confirm.MakePrivate.Channel",S),confirmHandler:G,confirmIsDestructive:!0})]})})),Cf=(0,n.ph)((0,s.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:o,onClose:a})=>{const{loadMoreMembers:r,deleteChatMember:l}=(0,s.ko)(),c=(0,Bi.A)(),[d,h]=(0,n.J0)(""),u=(0,n.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,T.A)(()=>{r({chatId:e.id})}),p=(0,T.A)(t=>{l({chatId:e.id,userId:t}),a()});return(0,ne.Y)(Wn,{isOpen:o,chatOrUserIds:u,title:c("ChannelBlockUser"),searchPlaceholder:c("Search"),search:d,onSearchChange:h,loadMore:m,onSelectChatOrUser:p,onClose:a})})),bf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:n}=e.users;return{chat:i,usersById:n,canDeleteMembers:i&&((0,l.ub)(i,"banUsers")||i.isCreator),removedMembers:(0,c.AWZ)(e,t)?.kickedMembers||gi.p,isChannel:i&&(0,l.WX)(i)}})(({chat:e,usersById:t,canDeleteMembers:i,removedMembers:o,isChannel:a,onClose:r,isActive:c})=>{const{updateChatMemberBannedRights:d}=(0,s.ko)(),h=(0,B.A)(),[u,m,p]=(0,D.A)();(0,ke.A)({isActive:c,onBack:r});const g=(0,n.hb)(e=>{if(!e.kickedByUserId)return;const i=t[e.kickedByUserId];return i?h("UserRemovedBy",(0,l.Yg)(i)):void 0},[h,t]),v=(0,n.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,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.IW,{children:h(a?"NoBlockedChannel2":"NoBlockedGroup2")}),Boolean(o.length)&&(0,ne.Y)(Hd.Ay,{dir:h.isRtl?"rtl":void 0,children:o.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable",ripple:!0,contextActions:v(e),children:(0,ne.Y)(An.A,{userId:e.userId,status:g(e),forceShowSelf:!0})},e.userId))})]}),i&&(0,ne.Y)(fi.A,{isShown:!0,onClick:m,ariaLabel:h("Channel.EditAdmin.Permission.BanUsers"),iconName:"add-user-filled"}),e&&i&&(0,ne.Y)(Cf,{chat:e,isOpen:u,onClose:p})]})})),yf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{linkedChatId:n}=(0,c.AWZ)(e,t)||{},{forDiscussionIds:s,byId:o}=e.chats;return{chat:i,chatsByIds:o,forDiscussionIds:s,linkedChat:n?(0,c.hds)(e,n):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:g,unlinkDiscussionGroup:v,toggleJoinRequest:A,toggleJoinToSend:f}=(0,s.ko)(),[C,b]=(0,n.J0)(),[y,S,k]=(0,D.A)(),[N,w,I]=(0,D.A)(),[P,Y]=(0,n.J0)(Boolean(d?.isJoinToSend)),[F,M]=(0,n.J0)(Boolean(d?.isJoinRequest)),L=(0,B.A)(),x=d?.id;(0,ke.A)({isActive:i,onBack:t}),(0,n.vJ)(()=>{p()},[p]),(0,n.vJ)(()=>{i&&(Y(d?.isJoinToSend||!1),M(d?.isJoinRequest||!1))},[d,i]);const R=(0,n.hb)(()=>{k(),v({channelId:u?r:x}),u||m(o.je.Initial)},[k,v,u,r,x,m]),E=(0,n.hb)(()=>{I(),g({channelId:r,chatId:C})},[I,g,r,C]),V=(0,n.hb)(e=>{Y(e),f({chatId:x,isEnabled:e}),e||M(!1)},[x,f]),_=(0,n.hb)(e=>{M(e),A({chatId:x,isEnabled:e})},[x,A]);const U=(0,T.A)(()=>{m(o.je.NewDiscussionGroup)});return(0,ne.Y)("div",{className:"Management",children:(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.DiscussionGroups,size:a.Uyp,className:"section-icon"}),d&&(0,ne.FD)("div",{children:[d&&(0,ne.Y)(ui.A,{className:"chat-item-clickable",inactive:!0,children:(0,ne.Y)(vn.A,{chatId:d.id})}),(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:L(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")}),(0,ne.Y)(ci.A,{isOpen:y,onClose:k,header:(0,ne.FD)("div",{className:"modal-header",children:[(0,ne.Y)(Tt.A,{size:"tiny",peer:d}),(0,ne.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:R,confirmIsDestructive:!0})]}),!d&&(0,ne.FD)("div",{children:[(0,ne.Y)(Hd.IW,{dir:"auto",children:L("DiscussionChannelHelp")}),(0,ne.FD)("div",{teactFastList:!0,children:[(0,ne.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,ne.Y)(ui.A,{teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{b(e),w()},children:(0,ne.Y)(vn.A,{chatId:e})},e)):(0,ne.Y)(Jc.A,{teactOrderKey:0,text:"No discussion groups found"},"nothing-found")]}),(0,ne.Y)(Hd.IW,{className:"mt-4 mb-0",dir:"auto",children:L("DiscussionChannelHelp2")}),(0,ne.Y)(ci.A,{isOpen:N,onClose:I,header:function(){if(!C)return;const e=c[C];return e?(0,ne.FD)("div",{className:"modal-header",children:[(0,ne.Y)(Tt.A,{size:"tiny",peer:e}),(0,ne.Y)("div",{className:"modal-title",children:L("Channel.DiscussionGroup.LinkGroup")})]}):void 0}(),textParts:function(){if(!C)return;const t=c[C];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,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:L("ChannelSettingsJoinTitle")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)("div",{className:"ListItem narrow",children:(0,ne.Y)(es.A,{checked:P,onCheck:V,label:L("ChannelSettingsJoinToSend")})}),P&&(0,ne.Y)("div",{className:"ListItem narrow",children:(0,ne.Y)(es.A,{checked:F,onCheck:_,label:L("ChannelSettingsJoinRequest")})})]}),(0,ne.Y)(Hd.IW,{children:L(P?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")})]})]})})})),Sf="Group title can't be empty",kf=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],Nf=kf.length+1,wf=(0,Ce.sg)(e=>e(),500,!1),If=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t),{management:s,limitReachedModal:o}=(0,c.nTw)(e),{progress:a}=s,r=Boolean(n?.linkedChatId),d=(0,l.yn)(i),{invites:h}=s.byChatId[t]||{},u=!r&&((0,l.ub)(i,"changeInfo")||i.isCreator);return{chat:i,chatFullInfo:n,progress:a,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"===o?.limit,availableReactions:e.reactions.availableReactions,canEditForum:u}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:a,isBasicGroup:r,hasLinkedChannel:d,canChangeInfo:h,canBanUsers:u,canInvite:m,canEditForum:p,isActive:g,exportedInvites:v,isChannelsPremiumLimitReached:A,availableReactions:f,onScreenSelect:C,onClose:b})=>{const{togglePreHistoryHidden:y,updateChat:S,deleteChat:k,leaveChannel:N,deleteChannel:w,closeManagement:I,openChat:P,loadExportedChatInvites:Y,loadChatJoinRequests:F,toggleForum:M}=(0,s.ko)(),[L,x,R]=(0,D.A)(),E=t.title,V=i?.about||"",[_,U]=(0,n.J0)(!1),[O,K]=(0,n.J0)(E),[J,G]=(0,n.J0)(V),[H,z]=(0,n.J0)(),[$,W]=(0,n.J0)(),[Q,Z]=(0,n.J0)(t.isForum),X=(0,l.cP)(t),te=(0,q.A)(X,!1,j.qZ.BlobUrl),ie=(0,n.Kr)(()=>(0,l.gA)(t),[t]),se=(0,B.A)(),oe=(0,n.li)();(0,ke.A)({isActive:g,onBack:b}),(0,n.vJ)(()=>{m&&(Y({chatId:e}),Y({chatId:e,isRevoked:!0}),F({chatId:e}))},[e,m]),(0,n.vJ)(()=>{Z(Boolean(t.isForum))},[t.isForum]),(0,n.vJ)(()=>{a===o.TD.Complete&&(U(!1),W(void 0))},[a]);const ae=(0,T.A)(()=>{C(o.je.ChatPrivacyType)}),re=(0,T.A)(()=>{C(o.je.Discussion)}),le=(0,T.A)(()=>{C(o.je.Reactions)}),ce=(0,T.A)(()=>{C(o.je.GroupPermissions)}),de=(0,T.A)(()=>{C(o.je.ChatAdministrators)}),he=(0,T.A)(()=>{C(o.je.Invites)}),ue=(0,T.A)(()=>{C(o.je.JoinRequests)}),me=(0,T.A)(e=>{z(e),U(!0)}),pe=(0,T.A)(e=>{K(e.target.value),U(!0)}),ge=(0,T.A)(e=>{G(e.target.value),U(!0)}),ve=(0,T.A)(()=>{const t=O.trim(),i=J.trim();t.length?S({chatId:e,title:t,about:i,photo:H}):W(Sf)}),Ae=(0,T.A)(()=>{C(o.je.GroupMembers)}),fe=(0,T.A)(()=>{if(!i)return;const{isPreHistoryHidden:e}=i;y({chatId:t.id,isEnabled:!e})}),Ce=(0,T.A)(()=>{Z(t=>{const i=!t;return wf(()=>{M({chatId:e,isEnabled:i})}),i})});(0,n.vJ)(()=>{if(!A)return;const e=oe.current?.querySelector("input");e.checked=!i?.isPreHistoryHidden},[A,i?.isPreHistoryHidden]);const be=(0,n.Kr)(()=>{if(!i?.enabledReactions)return se("ReactionsOff");if("all"===i.enabledReactions.type)return se("ReactionsAll");const e=i.enabledReactions.allowed.length,t=f?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[f,i?.enabledReactions,se]),ye=(0,n.Kr)(()=>{if(!t.defaultBannedRights)return 0;let e=kf.filter(e=>!("manageTopics"===e&&!Q||t.defaultBannedRights[e])).length;const{sendStickers:i,sendGifs:n}=t.defaultBannedRights;return i||n||(e+=1),e},[t.defaultBannedRights,Q]),Se=(0,n.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),Ne=(0,T.A)(()=>{r?k({chatId:t.id}):t.isCreator?w({chatId:t.id}):N({chatId:t.id}),R(),I(),P({id:void 0})});if((0,c._ls)((0,s.mS)(),e)||t.isForbidden)return;const we=a===o.TD.InProgress;return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Gh.A,{isForForum:Q,currentAvatarBlobUrl:te,onChange:me,disabled:!h}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)("div",{className:"settings-edit",children:[(0,ne.Y)(ee.A,{id:"group-title",label:se("GroupName"),onChange:pe,value:O,error:$===Sf?$:void 0,disabled:!h}),(0,ne.Y)(Is.A,{id:"group-about",label:se("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-J.length).toString(),onChange:ge,value:J,disabled:!h,noReplaceNewlines:!0})]}),t.isCreator&&(0,ne.FD)(ui.A,{icon:"lock",multiline:!0,onClick:ae,children:[(0,ne.Y)("span",{className:"title",children:se("GroupType")}),(0,ne.Y)("span",{className:"subtitle",children:se(ie?"TypePublic":"TypePrivate")})]}),d&&(0,ne.FD)(ui.A,{icon:"message",multiline:!0,onClick:re,children:[(0,ne.Y)("span",{className:"title",children:se("LinkedChannel")}),(0,ne.Y)("span",{className:"subtitle",children:se("DiscussionUnlink")})]}),(0,ne.FD)(ui.A,{icon:"permissions",multiline:!0,onClick:ce,disabled:!u,children:[(0,ne.Y)("span",{className:"title",children:se("ChannelPermissions")}),(0,ne.FD)("span",{className:"subtitle",dir:"auto",children:[ye,"/",Nf-(Q?0:1)]})]}),(0,ne.FD)(ui.A,{icon:"heart-outline",multiline:!0,onClick:le,disabled:!h,children:[(0,ne.Y)("span",{className:"title",children:se("Reactions")}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:be})]}),(0,ne.FD)(ui.A,{icon:"admin",multiline:!0,onClick:de,children:[(0,ne.Y)("span",{className:"title",children:se("ChannelAdministrators")}),(0,ne.Y)("span",{className:"subtitle",children:(0,Es.Sm)(Se)})]}),m&&(0,ne.FD)(ui.A,{icon:"link",onClick:he,multiline:!0,disabled:!v,children:[(0,ne.Y)("span",{className:"title",children:se("GroupInfo.InviteLinks")}),(0,ne.Y)("span",{className:"subtitle",children:v?(0,Es.Sm)(v.length):se("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ne.FD)(ui.A,{icon:"add-user-filled",onClick:ue,multiline:!0,children:[(0,ne.Y)("span",{className:"title",children:se("MemberRequests")}),(0,ne.Y)("span",{className:"subtitle",children:(0,Es.Sm)(t.joinRequests.length)})]}),p&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(ui.A,{icon:"forums",ripple:!0,onClick:Ce,children:[(0,ne.Y)("span",{children:se("ChannelTopics")}),(0,ne.Y)(Nh.A,{id:"group-notifications",checked:Boolean(Q)})]}),(0,ne.Y)(Hd.IW,{children:se("ForumToggleDescription")})]})]}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.FD)(ui.A,{icon:"group",multiline:!0,onClick:Ae,children:[(0,ne.Y)("span",{className:"title",children:se("GroupMembers")}),(0,ne.Y)("span",{className:"subtitle",children:(0,Es.Sm)(t.membersCount??0)})]}),!ie&&!d&&Boolean(i)&&(0,ne.Y)("div",{className:"ListItem narrow",ref:oe,children:(0,ne.Y)(es.A,{className:"align-checkbox-with-list-buttons",checked:!i.isPreHistoryHidden,label:se("ChatHistory"),onChange:fe,subLabel:i.isPreHistoryHidden?se("ChatHistoryHiddenInfo2"):se("ChatHistoryVisibleInfo"),disabled:!u})})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:x,children:se("DeleteMega")})})]}),(0,ne.Y)(fi.A,{isShown:_,onClick:ve,disabled:we,ariaLabel:se("Save"),iconName:"check",isLoading:we}),(0,ne.Y)(ci.A,{isOpen:L,onClose:R,textParts:(0,Mt.A)(r||!t.isCreator?se("AreYouSureDeleteAndExit"):se("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:r||!t.isCreator?se("DeleteMega"):se("DeleteGroupForAll"),confirmHandler:Ne,confirmIsDestructive:!0})]})})),Pf=(0,n.ph)((0,s.EK)(e=>{const{errorKey:t,hint:i,isLoading:n}=e.twoFaSettings;return{error:t,hint:i,isLoading:n}})(({isOpen:e,title:t,confirmLabel:i,description:o,error:a,hint:r,isLoading:l,onClose:c,onSubmit:d})=>{const{checkPassword:h,clearTwoFaError:u}=(0,s.ko)(),m=(0,Bi.A)(),[p,g]=(0,n.J0)(!1),[v,A]=(0,n.J0)(""),f=(0,T.A)(e=>{A(e)}),C=(0,T.A)(()=>{h({currentPassword:v,onSuccess:()=>{d(v),A(""),g(!1)}})}),b=(0,T.A)(()=>{c(),u(),A(""),g(!1)});return(0,ne.FD)(ci.A,{isOpen:e,title:t||m("EnterPassword"),confirmLabel:i||m("AutoDeleteConfirm"),confirmHandler:C,confirmIsDestructive:!0,onClose:b,children:[(0,ne.Y)(rh.A,{isBig:!0,isPasswordVisible:p}),o&&(0,ne.Y)("p",{className:"vRYK2vZu",children:o}),(0,ne.Y)(Rl.A,{error:a&&m.withRegular(a),hint:r,isLoading:l,isPasswordVisible:p,onChangePasswordVisibility:g,onClearError:u,onInputChange:f})]})})),Yf=(0,n.ph)((0,s.EK)((e,{chatId:t,isPromotedByCurrentUser:i,selectedUserId:n})=>{const s=(0,c.hds)(e,t),o=(0,c.AWZ)(e,t),{byId:a}=e.users,{currentUserId:r}=e,l=!(s.isCreator||i),d=o?.adminMembersById,h=n?d?.[n]:void 0,u=h&&(0,c.b0v)(e,{chatId:t,userId:h.userId,isAdmin:h.isAdmin,isOwner:h.isOwner});return{chat:s,usersById:a,currentUserId:r,isFormFullyDisabled:l,defaultRights:s.adminRights,hasFullInfo:Boolean(o),selectedAdminMember:h,canEditRank:u}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({isActive:e,isNewAdmin:t,selectedUserId:i,defaultRights:a,chat:r,usersById:c,currentUserId:d,selectedAdminMember:h,hasFullInfo:u,isFormFullyDisabled:m,canEditRank:p,onClose:g,onScreenSelect:v})=>{const{updateChatAdmin:A,transferChatOwnership:f,showNotification:C,openTwoFaCheckModal:b,verifyTransferOwnership:y}=(0,s.ko)(),[S,k]=(0,n.J0)({}),[N,w]=(0,n.J0)(Boolean(t)),[I,P]=(0,n.J0)(!1),[Y,F,M]=(0,D.A)(),[B,L,x]=(0,D.A)(),[R,E,V]=(0,D.A)(),[_,U]=(0,n.J0)(""),O=(0,Bi.A)(),K=(0,l.WX)(r),J=r.isForum,j=Boolean(r.linkedMonoforumId);(0,ke.A)({isActive:e,onBack:g});const G=(0,n.Kr)(()=>{if(!t||!h&&i){if(t){const e=(0,s.mS)().users.byId[i];return e?{userId:e.id,adminRights:a,rank:O("ChannelAdmin"),isOwner:void 0,promotedByUserId:void 0}:void 0}return h}},[h,a,t,O,i]);(0,n.vJ)(()=>{u&&i&&!G&&v(o.je.ChatAdministrators)},[r,u,v,G,i]),(0,n.vJ)(()=>{k(G?.adminRights||{}),U((G?.rank||"").slice(0,16)),w(Boolean(t)),P(!1)},[a,t,G]);const H=(0,T.A)(e=>{const{name:t}=e.target;k(e=>{return{...e,[t]:(i=e[t],!i||void 0)};var i}),w(!0)}),z=(0,T.A)(()=>{if(!i)return;const e=_!==h?.rank;P(!0),A({chatId:r.id,userId:i,adminRights:S,rank:e?_:void 0})}),$=(0,T.A)(()=>{i&&(A({chatId:r.id,userId:i,adminRights:{}}),M())}),q=(0,T.A)(e=>!((0,l.yn)(r)||!m&&r.adminRights&&(r.isCreator||r.adminRights[e]))),W=(0,n.Kr)(()=>{if(t||!G)return;if(G.isOwner)return O("ChannelCreator");const e=G.promotedByUserId?c[G.promotedByUserId]:void 0;return e?O("EditAdminPromotedBy",{user:(0,l.Yg)(e)}):O("ChannelAdmin")},[t,G,c,O]),Q=(0,T.A)(e=>{const{value:t}=e.target;U(t),w(!0)}),Z=(0,T.A)(()=>{i&&y({chatId:r.id,userId:i,onSuccess:L,onPasswordMissing:b,onPasswordTooFresh:b,onSessionTooFresh:b})}),X=(0,T.A)(()=>{x(),E()}),te=(0,T.A)(e=>{if(!i)return;const t=c[i],n=t?(0,l.Yg)(t):"";f({chatId:r.id,userId:i,password:e,onSuccess:()=>{C({message:O(K?"EditAdminTransferChannelOwnershipSuccess":"EditAdminTransferGroupOwnershipSuccess",{user:n})})}}),V()}),ie=i?c[i]:void 0,se=Boolean(r.isCreator&&ie&&!(0,l.tv)(ie)&&i!==d);if(G)return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ne.Y)(An.A,{userId:G.userId,status:W,forceShowSelf:!0})})}),(0,ne.Y)(Hd.Qg,{dir:"auto",children:O("EditAdminWhatCanDo")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"changeInfo",checked:Boolean(S.changeInfo),label:O(K?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:q("changeInfo"),onChange:H})}),K&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"postMessages",checked:Boolean(S.postMessages),label:O("EditAdminPostMessages"),blocking:!0,disabled:q("postMessages"),onChange:H})}),K&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"editMessages",checked:Boolean(S.editMessages),label:O("EditAdminEditMessages"),blocking:!0,disabled:q("editMessages"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"deleteMessages",checked:Boolean(S.deleteMessages),label:O(K?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:q("deleteMessages"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"postStories",checked:Boolean(S.postStories),label:O("EditAdminPostStories"),blocking:!0,disabled:q("postStories"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"editStories",checked:Boolean(S.editStories),label:O("EditAdminEditStories"),blocking:!0,disabled:q("editStories"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"deleteStories",checked:Boolean(S.deleteStories),label:O("EditAdminDeleteStories"),blocking:!0,disabled:q("deleteStories"),onChange:H})}),j&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"manageDirectMessages",checked:Boolean(S.manageDirectMessages),label:O("EditAdminManageDirect"),blocking:!0,disabled:q("manageDirectMessages"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"banUsers",checked:Boolean(S.banUsers),label:O("EditAdminBanUsers"),blocking:!0,disabled:q("banUsers"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"inviteUsers",checked:Boolean(S.inviteUsers),label:O("EditAdminAddUsers"),blocking:!0,disabled:q("inviteUsers"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"editRank",checked:Boolean(S.manageRanks),label:O("EditAdminEditRank"),blocking:!0,disabled:q("manageRanks"),onChange:H})}),!K&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"pinMessages",checked:Boolean(S.pinMessages),label:O("EditAdminPinMessages"),blocking:!0,disabled:q("pinMessages"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"addAdmins",checked:Boolean(S.addAdmins),label:O("EditAdminAddAdmins"),blocking:!0,disabled:q("addAdmins"),onChange:H})}),(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"manageCall",checked:Boolean(S.manageCall),label:O("StartVoipChatPermission"),blocking:!0,disabled:q("manageCall"),onChange:H})}),J&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"manageTopics",checked:Boolean(S.manageTopics),label:O("EditAdminManageTopics"),blocking:!0,disabled:q("manageTopics"),onChange:H})}),!K&&(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:"anonymous",checked:Boolean(S.anonymous),label:O("EditAdminSendAnonymously"),blocking:!0,disabled:q("anonymous"),onChange:H})}),m&&(0,ne.Y)(Hd.IW,{className:"mb-4",dir:"auto",children:O("EditAdminUnavailable")}),!K&&(0,ne.Y)(ee.A,{id:"admin-title",label:O("EditAdminRank"),className:"input-admin-title",onChange:Q,value:_,disabled:m||!p,maxLength:16}),se&&d!==i&&!m&&!t&&(0,ne.Y)(ui.A,{icon:"key",ripple:!0,onClick:Z,children:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership")}),d!==i&&!m&&!t&&(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:F,children:O("EditAdminRemoveAdmin")})]})]}),(0,ne.Y)(fi.A,{isShown:N,onClick:z,ariaLabel:O("Save"),disabled:I,iconName:"check",isLoading:I}),!t&&(0,ne.Y)(ci.A,{isOpen:Y,onClose:M,text:O("EditAdminConfirmDismissText"),confirmLabel:O("EditAdminConfirmDismiss"),confirmHandler:$,confirmIsDestructive:!0}),(0,ne.Y)(ci.A,{isOpen:B,onClose:x,title:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership"),textParts:O("EditAdminTransferOwnershipText",{chat:r.title,user:i?(0,l.Yg)(c[i]):""},{withNodes:!0,withMarkdown:!0}),confirmLabel:O("EditAdminTransferChangeOwner"),confirmHandler:X}),(0,ne.Y)(Pf,{isOpen:R,title:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership"),confirmLabel:O("EditAdminTransferChangeOwner"),onClose:V,onSubmit:te})]})}));var Ff=i(23459),Df=i(285);const Mf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{statusesById:n}=e.users,{members:s,adminMembersById:o,areParticipantsHidden:a}=(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:g,fetchingStatus:v,globalUserIds:A,localUserIds:f}=(0,c.nTw)(e).userSearch;return{areParticipantsHidden:Boolean(i&&a),members:s,canAddMembers:p,adminMembersById:o,userStatusesById:n,isChannel:r,localContactIds:d,searchQuery:g,isSearching:v,globalUserIds:A,localUserIds:f,canDeleteMembers:u,currentUserId:e.currentUserId,canHideParticipants:m}})(({chatId:e,noAdmins:t,members:i,canAddMembers:a,adminMembersById:r,userStatusesById:c,isChannel:d,isActive:h,globalUserIds:u,localContactIds:m,localUserIds:p,isSearching:g,searchQuery:v,currentUserId:A,canDeleteMembers:f,areParticipantsHidden:C,canHideParticipants:b,onClose:y,onScreenSelect:S,onChatMemberSelect:k})=>{const{openChat:N,setUserSearchQuery:w,closeManagement:I,toggleParticipantsHidden:P,setNewChatMembersDialogState:Y,toggleManagement:F}=(0,s.ko)(),D=(0,B.A)(),M=(0,Bi.A)(),L=(0,n.li)(),x=(0,n.li)(),[R,E]=(0,n.J0)(),V=(0,n.Kr)(()=>t&&r?Object.keys(r):[],[r,t]),_=(0,n.Kr)(()=>{const e=(0,s.mS)().users.byId;if(!i||!e)return[];const n=(0,l.UB)(i.map(({userId:e})=>e),e,c);return t?n.filter(e=>!V.includes(e)):n},[i,c,t,V]);(0,Ff.A)(_);const U=(0,n.Kr)(()=>{const e=(0,s.mS)().users.byId,i=Boolean(v),n=i?m?(0,Dt.PU)({ids:m,query:v,type:"user"}):[]:_;return(0,Dn.A)((0,pi.Am)([...n,...i&&p||[],...i&&u||[]]).filter(i=>{const n=e[i];return!n||(d||n.canBeInvitedToGroup||!(0,l.tv)(n))&&(!t||!V.includes(i))}),!0)},[_,m,v,p,u,d,t,V]),[O,K]=(0,Un.A)(void 0,U,Boolean(v)),J=(0,T.A)(e=>{t?(k(e,!0),S(o.je.ChatNewAdminRights)):(I(),N({id:e}))}),j=(0,T.A)(e=>{w({query:e.target.value})}),G=(0,Kn.A)(x,h,e=>{O&&O.length>0&&J(O[-1===e?0:e])},".ListItem-button",!0),H=(0,T.A)(()=>{E(void 0)}),z=(0,T.A)(()=>{P({chatId:e,isEnabled:!C})}),$=(0,T.A)(()=>{F(),Y({newChatMembersProgress:o.D7.InProgress})});return(0,ke.A)({isActive:h,onBack:y}),(0,ne.FD)("div",{className:"Management ManageGroupMembers",children:[(0,ne.FD)("div",{className:"panel-content",children:[t&&(0,ne.Y)(Hd.Ay,{dir:D.isRtl?"rtl":void 0,children:(0,ne.Y)(ee.A,{ref:L,value:v,onChange:j,placeholder:D("Search"),noMargin:!0})}),b&&!d&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{icon:"group",ripple:!0,onClick:z,children:[(0,ne.Y)("span",{children:D("ChannelHideMembers")}),(0,ne.Y)(Nh.A,{checked:Boolean(C)})]})}),(0,ne.Y)(Hd.IW,{children:D(C?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff")})]}),O?.length?(0,ne.Y)(Hd.Ay,{className:"island-list",children:(0,ne.Y)(mn.A,{className:"picker-list custom-scroll",items:U,onLoadMore:K,noScrollRestore:Boolean(v),ref:x,onKeyDown:G,children:O.map(e=>{return(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item",onClick:()=>J(e),contextActions:(t=e,t!==A&&f?[{title:D("lng_context_remove_from_group"),icon:"stop",handler:()=>{E(t)}}]:void 0),withPortalForMenu:!0,children:(0,ne.Y)(An.A,{userId:e,forceShowSelf:!0,withStory:!0})},e);var t})})}):g||!O||O.length?(0,ne.Y)(Jn.A,{}):(0,ne.Y)(Jc.A,{teactOrderKey:0,text:M(d?"NoSubscribersFound":"NoMembersFound")},"nothing-found")]}),a&&(0,ne.Y)(fi.A,{isShown:!0,onClick:$,ariaLabel:D("lng_channel_add_users"),iconName:"add-user-filled"}),f&&(0,ne.Y)(Df.A,{isOpen:Boolean(R),userId:R,onClose:H})]})})),Tf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t),{progress:s}=(0,c.nTw)(e).management,o=i?.paidMessagesStars,r=e.appConfig.starsPaidMessageCommissionPermille;return{chat:i,progress:s,currentUserId:e.currentUserId,removedUsersCount:n?.kickedMembers?.length||0,members:n?.members,arePaidMessagesAvailable:Boolean(n?.arePaidMessagesAvailable&&r),canChargeForMessages:Boolean(o&&r),groupPeersPaidStars:o||a.wZe}})(({onScreenSelect:e,onChatMemberSelect:t,chat:i,progress:a,currentUserId:r,removedUsersCount:l,members:c,onClose:d,isActive:h,arePaidMessagesAvailable:u,canChargeForMessages:m,groupPeersPaidStars:p})=>{const{updateChatDefaultBannedRights:g,updatePaidMessagesPrice:v}=(0,s.ko)(),{permissions:A,havePermissionChanged:f,isLoading:C,handlePermissionChange:b,setIsLoading:y}=sc(i?.defaultBannedRights),S=(0,B.A)(),k=(0,Bi.A)();(0,ke.A)({isActive:h,onBack:d});const N=(0,n.hb)(()=>{e(o.je.GroupRemovedUsers)},[e]),w=(0,n.hb)(()=>{e(o.je.GroupUserPermissionsCreate)},[e]),I=(0,n.hb)(i=>{t(i.userId,i.promotedByUserId===r),e(o.je.GroupUserPermissions)},[r,t,e]),[P,Y]=(0,n.J0)(!1),[F,M,L]=(0,D.A)(),[x,R]=(0,n.J0)(m),[E,V]=(0,n.J0)(p);(0,n.vJ)(()=>{a===o.TD.Complete&&L()},[a]);const _=(0,T.A)(()=>{i&&(y(!0),g({chatId:i.id,bannedRights:A}))}),U=(0,T.A)(()=>{i&&v({chatId:i?.id,paidMessagesStars:x?E:0})}),O=(0,T.A)(()=>{F&&U(),f&&_()}),K=(0,n.Kr)(()=>c?c.filter(({bannedRights:e})=>Boolean(e)):[],[c]),J=(0,n.hb)(e=>{const{bannedRights:t}=e;if(!t||!i)return;const{defaultBannedRights:n}=i;return Object.keys(t).reduce((e,i)=>{const s=i;if(!t[s]||n?.[s]||"sendInline"===s||"viewMessages"===s||"sendGames"===s)return e;const o=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}}(s);if(!o)return e;const a=S(o);return`${e}${e.length?`, ${a}`:a}`},"")},[i,S]),j=(0,T.A)(()=>{R(!x),M()}),G=(0,T.A)(e=>{V(e),M()}),H=F||f,z=a===o.TD.InProgress||C;return(0,ne.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 432px;--before-shift-height: 96px;",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.Qg,{dir:"auto",children:k("ChannelPermissionsHeader")}),(0,ne.Y)(Hd.Ay,{className:(0,ve.A)("without-bottom-shadow",P&&"dropdown-open"),children:(0,ne.Y)(ac,{chatId:i?.id,isMediaDropdownOpen:P,setIsMediaDropdownOpen:Y,handlePermissionChange:b,permissions:A,dropdownClassName:"DropdownListTrap",className:(0,ve.A)("DropdownList",P&&"DropdownList--open"),shiftedClassName:"part"})}),u&&(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{onClick:j,children:[(0,ne.Y)("span",{children:k("GroupMessagesChargePrice")}),(0,ne.Y)(Nh.A,{id:"charge_for_messages",checked:Boolean(x)})]})}),u&&(0,ne.Y)(Hd.IW,{dir:k.isRtl?"rtl":void 0,children:k("RightsChargeStarsAbout")}),x&&(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(fh,{canChangeChargeForMessages:!0,isGroupChat:!0,chargeForMessages:E,onChange:G})}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)(ui.A,{icon:"delete-user",multiline:!0,narrow:!0,onClick:N,children:[(0,ne.Y)("span",{className:"title",children:k("ChannelBlockedUsers")}),(0,ne.Y)("span",{className:"subtitle",children:l})]})}),(0,ne.Y)(Hd.Qg,{dir:"auto",children:k("PrivacyExceptions")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"add-user",onClick:w,children:k("ChannelAddException")}),K.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable exceptions-member",onClick:()=>I(e),children:(0,ne.Y)(An.A,{userId:e.userId,status:J(e),forceShowSelf:!0})},e.userId))]})]}),(0,ne.Y)(fi.A,{isShown:H,onClick:O,ariaLabel:k("Save"),disabled:z,iconName:"check",isLoading:z})]})})),Bf=(0,n.ph)((0,s.EK)((e,{chatId:t,isPromotedByCurrentUser:i})=>{const n=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t);return{chat:n,isFormFullyDisabled:!(n.isCreator||i),hasFullInfo:Boolean(s),members:s?.members}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chat:e,selectedChatMemberId:t,hasFullInfo:i,members:a,onScreenSelect:r,isFormFullyDisabled:l,onClose:c,isActive:d})=>{const{updateChatMemberBannedRights:h}=(0,s.ko)(),u=(0,n.Kr)(()=>{if(a)return a.find(({userId:e})=>e===t)},[a,t]),{permissions:m,havePermissionChanged:p,isLoading:g,handlePermissionChange:v,setIsLoading:A}=sc(u?.bannedRights||e?.defaultBannedRights),[f,C,b]=(0,D.A)(),y=(0,Bi.A)(),S=(0,B.A)();(0,ke.A)({isActive:d,onBack:c}),(0,n.vJ)(()=>{i&&t&&!u&&r(o.je.GroupPermissions)},[e,i,r,u,t]);const k=(0,n.hb)(()=>{e&&t&&(A(!0),h({chatId:e.id,userId:t,bannedRights:m}))},[e,t,A,h,m]),N=(0,n.hb)(()=>{e&&t&&h({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,h]),w=(0,n.hb)(t=>!!l||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,l]),[I,P]=(0,n.J0)(!1);if(u)return(0,ne.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 431px;--before-shift-height: 192px;",children:[(0,ne.FD)("div",{className:"custom-scroll",children:[(0,ne.FD)(Hd.Ay,{className:(0,ve.A)("without-bottom-shadow",I&&"dropdown-open"),children:[(0,ne.Y)(ui.A,{inactive:!0,className:"chat-item-clickable",children:(0,ne.Y)(An.A,{userId:u.userId,forceShowSelf:!0})}),(0,ne.Y)(Hd.Qg,{className:"mt-4",dir:"auto",children:S("UserRestrictionsCanDo")}),(0,ne.Y)(ac,{chatId:e?.id,isMediaDropdownOpen:I,setIsMediaDropdownOpen:P,handlePermissionChange:v,permissions:m,className:(0,ve.A)("DropdownList",I&&"DropdownList--open"),dropdownClassName:"DropdownListTrap",shiftedClassName:"part",getControlIsDisabled:w})]}),!l&&(0,ne.Y)(Hd.Ay,{className:(0,ve.A)("part",I&&"shifted"),children:(0,ne.Y)(ui.A,{icon:"delete-user",ripple:!0,destructive:!0,onClick:C,children:S("UserRestrictionsBlock")})})]}),(0,ne.Y)(fi.A,{isShown:p,onClick:k,ariaLabel:S("Save"),disabled:g,iconName:"check",isLoading:g}),(0,ne.Y)(ci.A,{isOpen:f,onClose:b,text:y("GroupManagementBanUserConfirm"),confirmLabel:"Remove",confirmHandler:N,confirmIsDestructive:!0})]})})),Lf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:n,statusesById:s}=e.users,o=(0,c.AWZ)(e,t)?.members;return{members:o,usersById:n,userStatusesById:s,isChannel:i&&(0,l.WX)(i)}})(({usersById:e,userStatusesById:t,members:i,isChannel:s,onScreenSelect:a,onChatMemberSelect:r,onClose:c,isActive:d})=>{const h=(0,Bi.A)();(0,ke.A)({isActive:d,onBack:c});const u=(0,n.Kr)(()=>{if(i&&e)return(0,l.UB)(i.filter(e=>!e.isOwner).map(({userId:e})=>e),e,t)},[i,e,t]),m=(0,n.hb)(e=>{r(e),a(o.je.GroupUserPermissions)},[r,a]);return(0,ne.Y)("div",{className:"Management",children:(0,ne.Y)("div",{className:"custom-scroll",children:u?.length?(0,ne.Y)(Hd.Ay,{teactFastList:!0,children:u.map((e,t)=>(0,ne.Y)(ui.A,{teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e),children:(0,ne.Y)(An.A,{userId:e,forceShowSelf:!0})},e))}):(0,ne.Y)(Jc.A,{text:h(s?"NoSubscribersFound":"NoMembersFound")})})})})),xf=[1,10,100],Rf={hour:36e5,day:864e5,week:6048e5},Ef=Rf.hour,Vf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{editingInvite:i}=(0,c.nTw)(e).management.byChatId[t]||{};return{editingInvite:i}})(({chatId:e,editingInvite:t,isActive:i,onClose:a,onScreenSelect:r})=>{const{editExportedChatInvite:l,exportChatInvite:c}=(0,s.ko)(),d=(0,B.A)(),[h,u,m]=(0,D.A)(),[p,g]=(0,n.J0)(!1),[v,A]=(0,n.J0)(""),[f,C]=(0,n.J0)(()=>Date.now()+Ef),[b,y]=(0,n.J0)("unlimited"),[S,k]=(0,n.J0)(10),[N,w]=(0,n.J0)("0"),[I,P]=(0,n.J0)(!1);(0,ke.A)({isActive:i,onBack:a}),(0,$.A)(([e])=>{if(e!==t)if(t){const{title:e,usageLimit:i,expireDate:n,isRequestNeeded:s}=t;if(e&&A(e),i&&(w(xf.includes(i)?i.toString():"custom"),k(i)),n){const e=(0,Di.Fm)()+Ef;y("custom"),C(1e3*Math.max(n,e))}s&&g(!0)}else A(""),y("unlimited"),w("0"),C(1e3*(0,Di.Fm)()+Ef),k(10),g(!1)},[t]);const Y=(0,n.hb)(e=>{g(e.target.checked)},[]),F=(0,n.hb)(e=>{A(e.target.value)},[]),M=(0,n.hb)(e=>{k(Number.parseInt(e.target.value,10))},[]),T=(0,n.hb)(e=>{C(e.getTime()),m()},[m]),L=(0,n.hb)(()=>{P(!0);const i="custom"===N?S:Number(N);let n;switch(b){case"custom":n=(0,Di.Fm)()+(f-Date.now())/1e3;break;case"hour":case"day":case"week":n=(0,Di.Fm)()+Rf[b]/1e3;break;case"unlimited":n=0;break;default:n=void 0}t?l({link:t.link,chatId:e,title:v,isRequestNeeded:p,expireDate:n,usageLimit:i}):c({chatId:e,title:v,isRequestNeeded:p,expireDate:n,usageLimit:i}),r(o.je.Invites)},[e,f,S,l,t,c,p,b,N,v,r]);return(0,ne.FD)("div",{className:"Management ManageInvite",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(es.A,{label:d("ApproveNewMembers"),subLabel:d("ApproveNewMembersDescription"),checked:p,onChange:Y})}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ee.A,{className:"link-name",placeholder:d("LinkNameHint"),value:v,onChange:F}),(0,ne.Y)(Hd.IW,{children:d("LinkNameHelp")})]}),(0,ne.Y)(Hd.Qg,{children:d("LimitByPeriod")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ie.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:b}),"custom"===b&&(0,ne.FD)(X.A,{className:"expire-limit",isText:!0,onClick:u,children:[(0,et.Lu)(d,f)," ",(0,et.fU)(d,f)]}),(0,ne.Y)(Hd.IW,{children:d("TimeLimitHelp")})]}),!p&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:d("LimitNumberOfUses")}),(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ie.A,{name:"usageOptions",options:[...xf.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,ne.Y)("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:M}),(0,ne.Y)(Hd.IW,{children:d("UsesLimitHelp")})]})]}),(0,ne.Y)(fi.A,{isShown:!0,onClick:L,disabled:I,ariaLabel:d(t?"SaveLink":"CreateLink"),iconName:"check"})]}),(0,ne.Y)(ks,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:m,onSubmit:T,selectedAt:f,submitButtonLabel:d("Save")})]})})),_f=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{inviteInfo:i}=(0,c.nTw)(e).management.byChatId[t]||{},{invite:n,importers:s,requesters:o}=i||{},a=(0,c.hds)(e,t);return{invite:n,importers:s,requesters:o,isChannel:a&&(0,l.WX)(a)}})(({chatId:e,invite:t,importers:i,requesters:o,isChannel:a,isActive:r,onClose:l})=>{const{loadChatInviteImporters:c,loadChatInviteRequesters:d,openChat:h}=(0,s.ko)(),u=(0,B.A)(),{usage:m=0,usageLimit:p,link:g,adminId:v}=t||{},A=t?.expireDate&&1e3*(t.expireDate-(0,Di.Fm)())+Date.now(),f=(t?.expireDate||0)-(0,Di.Fm)()<0;return(0,n.vJ)(()=>{g&&(c({chatId:e,link:g}),d({chatId:e,link:g}))},[e,g,c,d]),(0,ke.A)({isActive:r,onBack:l}),(0,ne.Y)("div",{className:"Management ManageInviteInfo",children:(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[!t&&(0,ne.Y)(Hd.IW,{children:u("Loading")}),t&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ol.A,{title:t.title,link:t.link,className:"invite-link"}),Boolean(A)&&(0,ne.Y)(Hd.IW,{children:f?u("ExpiredLink"):u("LinkExpiresIn",`${(0,et.Lu)(u,A)} ${(0,et.fU)(u,A)}`)})]}),v&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:u("LinkCreatedeBy")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:v}),children:(0,ne.Y)(An.A,{userId:v,status:(0,et.fS)(u,1e3*t.date,!0),forceShowSelf:!0})})})]}),(()=>{if(i?.length||!o?.length)return i?(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:i.length?u("PeopleJoined",m):u("NoOneJoined")}),(0,ne.FD)(Hd.Ay,{children:[!i.length&&(0,ne.Y)(Hd.IW,{children:p?u("PeopleCanJoinViaLinkCount",p-m):u("NoOneJoinedYet")}),i.map(e=>{const t=(0,et.fS)(u,1e3*e.date,!0),i=e.isFromChatList?`${t} • ${u("JoinedViaFolder")}`:t;return(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ne.Y)(An.A,{userId:e.userId,status:i,forceShowSelf:!0})})})]})]}):(0,ne.Y)(je.A,{})})(),(()=>{if(!t?.isRevoked){if(!o&&i)return(0,ne.Y)(je.A,{});if(o?.length)return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:u(a?"SubscribeRequests":"MemberRequests")}),(0,ne.Y)(Hd.Ay,{children:o.map(e=>(0,ne.Y)(ui.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ne.Y)(An.A,{userId:e.userId,status:(0,et.fS)(u,1e3*e.date,!0),forceShowSelf:!0})}))})]})}})()]})]})})})),Uf="•";function Of(e,t){const{isPermanent:i,usage:n=0,date:s}=e,{isPermanent:o,usage:a=0,date:r}=t;return i||o?Number(i)-Number(o):n||a?a-n:r-s}const Kf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{invites:i,revokedInvites:n}=(0,c.nTw)(e).management.byChatId[t]||{},s=(0,c.hds)(e,t);return{exportedInvites:i,revokedExportedInvites:n,chat:s,isChannel:s&&(0,l.WX)(s)}})(({chatId:e,chat:t,exportedInvites:i,revokedExportedInvites:r,isActive:c,isChannel:d,onClose:h,onScreenSelect:u})=>{const{setEditingExportedInvite:m,showNotification:p,editExportedChatInvite:g,deleteExportedChatInvite:v,deleteRevokedExportedChatInvites:A,setOpenedInviteInfo:f}=(0,s.ko)(),C=(0,Bi.A)(),b=(0,B.A)(),[y,S,k]=(0,D.A)(),[N,w,I]=(0,D.A)(),[P,Y]=(0,n.J0)(),[F,T,L]=(0,D.A)(),[x,R]=(0,n.J0)();(0,ke.A)({isActive:c,onBack:h});const E=(0,n.Kr)(()=>{if(i)return i.some(({expireDate:e})=>e&&e-(0,Di.Fm)()<et.il/1e3)},[i]),V=(0,M.A)();(0,Ds.A)(V,E?1e3:void 0);const _=(0,n.Kr)(()=>t&&(0,l.Kl)(t),[t]),U=i?.find(({isPermanent:e})=>e),O=_?`${a.jsp}${_}`:U?.link,K=(0,n.Kr)(()=>{const e=t?.hasUsername?i:i?.filter(({isPermanent:e})=>!e);return e?.sort(Of)},[t?.hasUsername,i]),J=(0,n.hb)(t=>{const{link:i,title:n,isRequestNeeded:s,expireDate:o,usageLimit:a}=t;g({chatId:e,link:i,title:n,isRequestNeeded:s,expireDate:o,usageLimit:a,isRevoked:!0})},[e,g]),j=(0,n.hb)(e=>{Y(e),w()},[w]),G=(0,n.hb)(()=>{P&&(J(P),Y(void 0),I())},[I,J,P]),H=(0,n.hb)(()=>{u(o.je.EditInvite)},[u]),z=(0,n.hb)(()=>{U&&j(U)},[j,U]),$=(0,n.hb)(()=>{A({chatId:e}),k()},[e,k,A]),q=(0,n.hb)(t=>{f({chatId:e,invite:t}),u(o.je.InviteInfo)},[e,u,f]),W=(0,n.hb)(t=>{v({chatId:e,link:t.link})},[e,v]),Q=(0,n.hb)(e=>{R(e),T()},[T]),Z=(0,n.hb)(()=>{x&&(W(x),R(void 0),L())},[L,W,x]),X=(0,n.hb)(e=>{(0,Lc.eM)(e),p({message:b("LinkCopied")})},[b,p]),ee=e=>{const{usage:t=0,usageLimit:i,expireDate:n,isPermanent:s,requested:o,isRevoked:a}=e;let r;if(r=!a&&i&&t<i?b("CanJoin",i-t):t?b("PeopleJoined",t):b("NoOneJoined"),a)return r+=` ${Uf} ${b("Revoked")}`,r;if(o&&(r+=` ${Uf} ${b("JoinRequests",o)}`),void 0!==i&&t===i)r+=` ${Uf} ${b("LinkLimitReached")}`;else if(n){const e=n-(0,Di.Fm)();r+=` ${Uf} `,r+=e>0?b("InviteLink.ExpiresIn",(0,et.zt)(C,e)):b("InviteLink.Expired")}else s&&(r+=` ${Uf} ${b("Permanent")}`);return r},te=e=>{const{usage:t=0,usageLimit:i,isRevoked:n,expireDate:s}=e;return n?"link-status-icon-gray":i&&t<i?"link-status-icon-green":s&&1e3*(s-(0,Di.Fm)())<=0?"link-status-icon-red":"link-status-icon-blue"},ie=t=>{const i=[];return i.push({title:b("Copy"),icon:"copy",handler:()=>X(t.link)}),t.isPermanent||t.isRevoked||i.push({title:b("Edit"),icon:"edit",handler:()=>(t=>{m({chatId:e,invite:t}),u(o.je.EditInvite)})(t)}),t.isRevoked?i.push({title:b("DeleteLink"),icon:"delete",handler:()=>Q(t),destructive:!0}):i.push({title:b("RevokeButton"),icon:"delete",handler:()=>j(t),destructive:!0}),i};return(0,ne.FD)("div",{className:"Management ManageInvites",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.Invite,size:a.xMZ,className:"section-icon"}),(0,ne.Y)(Hd.IW,{children:b(d?"PrimaryLinkHelpChannel":"PrimaryLinkHelp")})]}),O&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:b(t?.usernames?"PublicLink":"lng_create_permanent_link_title")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ol.A,{className:"settings-input",link:O,noTitle:!0,withShare:!0,onRevoke:t?.usernames?void 0:z})})]}),(0,ne.FD)(Hd.Ay,{teactFastList:!0,children:[(0,ne.Y)(ui.A,{icon:"add",withPrimaryColor:!0,className:"create-item",onClick:H,children:b("CreateNewLink")},"create"),(!K||!K.length)&&(0,ne.Y)(Jc.A,{text:"No links found"},"nothing"),K?.map(e=>(0,ne.FD)(ui.A,{leftElement:(0,ne.Y)(he.A,{name:"link",className:`link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ie(e),children:[(0,ne.Y)("span",{className:"title invite-title",children:e.title||e.link}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:ee(e)})]},e.link))]}),(0,ne.Y)(Hd.IW,{children:b("ManageLinksInfoHelp")}),r&&Boolean(r.length)&&(0,ne.FD)(Hd.Ay,{teactFastList:!0,children:[(0,ne.Y)(Hd.IW,{children:b("RevokedLinks")},"title"),(0,ne.Y)(ui.A,{icon:"delete",destructive:!0,onClick:S,children:(0,ne.Y)("span",{className:"title",children:b("DeleteAllRevokedLinks")})},"delete"),r?.map(e=>(0,ne.FD)(ui.A,{leftElement:(0,ne.Y)(he.A,{name:"link",className:`link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ie(e),children:[(0,ne.Y)("span",{className:"title",children:e.title||e.link}),(0,ne.Y)("span",{className:"subtitle",dir:"auto",children:ee(e)})]},e.link))]})]}),(0,ne.Y)(ci.A,{isOpen:y,onClose:k,title:b("DeleteAllRevokedLinks"),text:b("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("DeleteAll"),confirmHandler:$}),(0,ne.Y)(ci.A,{isOpen:N,onClose:I,title:b("RevokeLink"),text:b("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:b("RevokeButton"),confirmHandler:G}),(0,ne.Y)(ci.A,{isOpen:F,onClose:L,title:b("DeleteLink"),text:b("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("Delete"),confirmHandler:Z})]})})),Jf=(0,n.ph)((0,s.EK)((e,{userId:t})=>({user:(0,c.mBe)(e,t)}))(({userId:e,chatId:t,about:i,date:o,isChannel:a,user:r})=>{const{openChat:c,hideChatJoinRequest:d}=(0,s.ko)(),h=(0,ve.x)("JoinRequest"),u=(0,B.A)(),m=(0,l.Yg)(r),p=1e3*(o-(0,Di.Fm)())+Date.now(),g=(0,et.cK)(new Date(p))?(0,et.fU)(u,p):(0,et.F5)(u,p,!0,!1,!0),v=(0,n.hb)(()=>{d({chatId:t,userId:e,isApproved:!0})},[t,d,e]),A=(0,n.hb)(()=>{d({chatId:t,userId:e,isApproved:!1})},[t,d,e]);return(0,ne.FD)("div",{className:h("&"),children:[(0,ne.FD)("div",{className:h("top"),children:[(0,ne.FD)("div",{className:h("user"),onClick:()=>{c({id:e})},children:[(0,ne.Y)(Tt.A,{size:"medium",peer:r},e),(0,ne.FD)("div",{className:h("user-info"),children:[(0,ne.Y)("div",{className:h("user-name"),children:m}),(0,ne.Y)("div",{className:h("user-subtitle"),children:i})]})]}),(0,ne.Y)("div",{className:h("date"),children:g})]}),(0,ne.FD)("div",{className:h("buttons"),children:[(0,ne.Y)(X.A,{className:h("button"),onClick:v,children:u(a?"ChannelAddToChannel":"ChannelAddToGroup")}),(0,ne.Y)(X.A,{className:h("button"),isText:!0,onClick:A,children:u("DismissRequest")})]})]})})),jf=(0,n.ph)((0,s.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:o,onClose:r})=>{const{hideAllChatJoinRequests:l,loadChatJoinRequests:c}=(0,s.ko)(),[d,h,u]=(0,D.A)(),[m,p,v]=(0,D.A)(),A=(0,B.A)();(0,ke.A)({isActive:i,onBack:r}),(0,n.vJ)(()=>{e?.joinRequests||(0,g.L8)(t)||c({chatId:t})},[e,t,c]);const f=(0,n.hb)(()=>{l({chatId:t,isApproved:!0}),u()},[l,t,u]),C=(0,n.hb)(()=>{l({chatId:t,isApproved:!1}),v()},[l,t,v]);return(0,ne.FD)("div",{className:"Management ManageJoinRequests",children:[(0,ne.FD)("div",{className:"custom-scroll",children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(Oo.A,{tgsUrl:Uo.w.JoinRequest,size:a.OMf,className:"section-icon"}),Boolean(e?.joinRequests?.length)&&(0,ne.FD)("div",{className:"bulk-actions",children:[(0,ne.Y)(X.A,{className:"bulk-action-button",onClick:h,children:"Accept all"}),(0,ne.Y)(X.A,{className:"bulk-action-button",onClick:p,isText:!0,children:"Dismiss all"})]})]}),(0,ne.FD)(Hd.Ay,{teactFastList:!0,children:[(0,ne.Y)("p",{children:e?.joinRequests?e.joinRequests.length?A("JoinRequests",e.joinRequests.length):A("NoMemberRequests"):A("Loading")},"title"),!e?.joinRequests&&(0,ne.Y)(je.A,{},"loading"),0===e?.joinRequests?.length&&(0,ne.Y)(Hd.IW,{children:A(o?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")},"empty"),e?.joinRequests?.map(({userId:e,about:i,date:n})=>(0,ne.Y)(Jf,{userId:e,about:i,date:n,isChannel:o,chatId:t},e))]})]}),(0,ne.Y)(ci.A,{isOpen:d,onClose:u,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:f}),(0,ne.Y)(ci.A,{isOpen:m,onClose:v,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:C})]})})),Gf=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{maxUniqueReactions:n}=e.appConfig,s=(0,c.AWZ)(e,t),o=s?.reactionsLimit||n,a=(0,l.WX)(i);return{enabledReactions:s?.enabledReactions,availableReactions:e.reactions.availableReactions,chat:i,maxUniqueReactions:n,reactionsLimit:o,isChannel:a}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({availableReactions:e,enabledReactions:t,chat:i,isActive:o,onClose:a,maxUniqueReactions:r,reactionsLimit:c,isChannel:d})=>{const{setChatEnabledReactions:h}=(0,s.ko)(),u=(0,B.A)(),[m,p]=(0,n.J0)(!1),[g,v]=(0,n.J0)(!1),[A,f]=(0,n.J0)(t),[C,b]=(0,n.J0)(c);(0,ke.A)({isActive:o,onBack:a});const y=(0,n.Kr)(()=>[{value:"all",label:u("AllReactions")},{value:"some",label:u("SomeReactions")},{value:"none",label:u("NoReactions")}],[u]),S=(0,n.hb)(()=>{i&&(v(!0),h({chatId:i.id,enabledReactions:A,reactionsLimit:C}))},[i,A,h,C]);(0,n.vJ)(()=>{v(!1),p(!1),f(t),b(c)},[t,c]);const k=(0,n.Kr)(()=>e?.filter(({isInactive:e})=>!e),[e]);(0,n.vJ)(()=>{if(void 0===C||C===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)},[C,c,A,t]);const N=(0,n.hb)(e=>{"all"===e?(f({type:"all"}),b(c)):"some"===e?(f({type:"some",allowed:"some"===t?.type?t.allowed:[]}),b(c)):(f(void 0),b(void 0))},[t,c]),w=(0,n.hb)(e=>{if(!i||!k)return;const{name:t,checked:n}=e.currentTarget;if("some"===A?.type){const e={emoticon:t};f(n?{type:"some",allowed:[...A.allowed,e]}:{type:"some",allowed:A.allowed.filter(t=>!(0,l.a0)(t,e))})}},[k,i,A]),I=(0,n.hb)(e=>{b(e)},[]),P=(0,n.hb)(e=>u("PeerInfo.AllowedReactions.MaxCountValue",e),[u]),Y=d&&("all"===A?.type||"some"===A?.type);return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"panel-content custom-scroll",children:[Boolean(C&&Y)&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:u("MaximumReactionsHeader")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(nt.A,{min:1,max:r,value:C,onChange:I,renderValue:P,isCenteredLayout:!0})}),(0,ne.Y)(Hd.IW,{children:u("ChannelReactions.MaxCount.Info")})]}),(0,ne.Y)(Hd.Qg,{children:u("AvailableReactions")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ie.A,{selected:A?.type||"none",name:"reactions",options:y,onChange:N})}),(0,ne.FD)(Hd.IW,{children:["all"===A?.type&&u("EnableAllReactionsInfo"),"some"===A?.type&&u("EnableSomeReactionsInfo"),!A&&u("DisableReactionsInfo")]}),"some"===A?.type&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Hd.Qg,{children:u("OnlyAllowThisReactions")}),(0,ne.Y)(Hd.Ay,{children:k?.map(({reaction:t,title:i})=>(0,ne.Y)("div",{className:"ListItem",children:(0,ne.Y)(es.A,{name:t.emoticon,checked:A?.allowed.some(e=>(0,l.a0)(t,e)),label:(0,ne.FD)("div",{className:"Reaction",children:[(0,ne.Y)(fn.A,{reaction:t,availableReactions:e}),i]}),withIcon:!0,onChange:w})},t.emoticon))})]})]}),(0,ne.Y)(fi.A,{isShown:m,onClick:S,ariaLabel:u("Save"),disabled:g,iconName:"check",isLoading:g})]})})),Hf="Please provide first name",zf=(0,n.ph)((0,s.EK)((e,{userId:t})=>{const i=(0,c.mBe)(e,t),n=(0,c.hds)(e,t),s=(0,c.vGo)(e,t),{progress:o}=(0,c.nTw)(e).management,a=n&&(0,Hc.If)(n,(0,c.K52)(e),(0,c.P5N)(e,n.id)),r=s?.personalPhoto,l=s?.profilePhoto||s?.fallbackPhoto,d=s?.note?.text;return{user:i,progress:o,isMuted:a,personalPhoto:r,notPersonalPhoto:l,noteText:d,contactNoteLimit:e.appConfig?.contactNoteLimit||ws.tI}})(({userId:e,user:t,progress:i,isMuted:r,onClose:c,isActive:d,personalPhoto:h,notPersonalPhoto:u,noteText:m,contactNoteLimit:p})=>{const{updateContact:g,updateContactNote:v,deleteContact:A,closeManagement:f,uploadContactProfilePhoto:C,updateChatMutedState:b}=(0,s.ko)(),[y,S,k]=(0,D.A)(),[N,w,I]=(0,D.A)(),[P,Y,F]=(0,D.A)(),[M,T]=(0,n.J0)(),[L,x,R]=(0,D.A)(),E=(0,B.A)(),V=(0,Bi.A)();(0,ke.A)({isActive:d,onBack:c});const _=t&&t.firstName||"",U=t&&t.lastName||"",O=m||"",[K,J]=(0,n.J0)(_),[j,G]=(0,n.J0)(U),[H,z]=(0,n.J0)(O),[$,q]=(0,n.J0)(!r);(0,n.vJ)(()=>{q(!r)},[r]),(0,n.vJ)(()=>{F(),R(),k()},[k,e]),(0,n.vJ)(()=>{J(_),G(U),z(O)},[_,U,O]),(0,n.vJ)(()=>{i===o.TD.Complete&&(F(),T(void 0),k())},[k,i]);const W=(0,n.hb)(e=>{J(e.target.value),Y(),M===Hf&&T(void 0)},[M]),Q=(0,n.hb)(e=>{G(e.target.value),Y()},[]),Z=(0,n.hb)(e=>{z(e.target.value),Y()},[]),X=(0,n.hb)(e=>{q(e.target.checked),x(),Y()},[]),te=(0,n.hb)(()=>{const t=K.trim(),i=j.trim(),n=H.trim();t.length?(se.current?.blur(),oe.current?.blur(),ae.current?.blur(),g({userId:e,firstName:t,lastName:i}),n!==O&&v({userId:e,note:{text:n,entities:[]}}),L&&b({chatId:e,mutedUntil:$?a.Os5:a.xEh})):T(Hf)},[O,K,$,L,j,H,e]),ie=(0,n.hb)(()=>{A({userId:e}),k(),f()},[k,f,A,e]),se=(0,n.li)(),oe=(0,n.li)(),ae=(0,n.li)(),re=(0,n.li)(),le=(0,n.li)(!1),ce=(0,n.hb)(()=>{re.current?.click(),le.current=!0},[]),de=(0,n.hb)(()=>{re.current?.click(),le.current=!1},[]),he=(0,n.hb)(()=>{I(),Y(),C({userId:e})},[I,C,e]),ue=(0,n.hb)(t=>{Y(),C({userId:e,file:t,isSuggest:le.current})},[C,e]);if(!t)return;const me=!(0,l.tv)(t)&&t.id!==a.zv8,pe=i===o.TD.InProgress,ge=p-H.length;return(0,ne.FD)("div",{className:"Management",children:[(0,ne.FD)("div",{className:"custom-scroll",children:[(0,ne.Y)(An.A,{userId:t.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),(0,ne.Y)(Hd.Ay,{children:(0,ne.FD)("div",{className:"settings-edit",children:[(0,ne.Y)(ee.A,{ref:se,id:"user-first-name",label:E("UserInfo.FirstNamePlaceholder"),onChange:W,value:K,error:M===Hf?M:void 0}),(0,ne.Y)(ee.A,{ref:oe,id:"user-last-name",label:E("UserInfo.LastNamePlaceholder"),onChange:Q,value:j}),(0,ne.Y)(Is.A,{ref:ae,id:"user-note",label:V("UserNoteTitle"),onChange:Z,value:H,maxLength:p,maxLengthIndicator:ge.toString(),noReplaceNewlines:!0})]})}),(0,ne.Y)(Hd.IW,{dir:"auto",children:V("EditUserNoteHint")}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)("div",{className:"ListItem narrow",children:(0,ne.Y)(es.A,{checked:$,label:E("Notifications"),subLabel:E($?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:X})})}),me&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(Hd.Ay,{children:[(0,ne.Y)(ui.A,{icon:"camera-add",ripple:!0,onClick:ce,children:(0,ne.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SuggestPhoto",t.firstName)})}),(0,ne.Y)(ui.A,{icon:"camera-add",ripple:!0,onClick:de,children:(0,ne.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SetCustomPhoto",t.firstName)})}),h&&(0,ne.Y)(ui.A,{leftElement:(0,ne.Y)(Tt.A,{photo:u,noPersonalPhoto:!0,peer:t,size:"mini",className:"personal-photo"}),ripple:!0,onClick:w,children:E("UserInfo.ResetCustomPhoto")})]}),(0,ne.Y)(Hd.IW,{dir:"auto",children:E("UserInfo.CustomPhotoInfo",t.firstName)})]}),(0,ne.Y)(Hd.Ay,{children:(0,ne.Y)(ui.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:E("DeleteContact")})})]}),(0,ne.Y)(fi.A,{isShown:P,onClick:te,disabled:pe,ariaLabel:E("Save"),iconName:"check",isLoading:pe}),(0,ne.Y)(ci.A,{isOpen:y,onClose:k,text:E("AreYouSureDeleteContact"),confirmLabel:E("DeleteContact"),confirmHandler:ie,confirmIsDestructive:!0}),(0,ne.Y)(ci.A,{isOpen:N,onClose:I,text:E("UserInfo.ResetToOriginalAlertText",t.firstName),confirmLabel:E("Reset"),confirmHandler:he,confirmIsDestructive:!0}),(0,ne.Y)(Eu.A,{onChange:ue,inputRef:re})]})})),$f=(0,n.ph)((0,s.EK)((e,{chatId:t})=>{const{progress:i,error:n}=(0,c.nTw)(e).chatCreation||{};return{chat:(0,c.hds)(e,t),creationProgress:i,creationError:n}})(({chat:e,onClose:t,isActive:i,creationProgress:a,creationError:r})=>{const{createChannel:l}=(0,s.ko)(),c=(0,Bi.A)();(0,ke.A)({isActive:i,onBack:t});const[d,h]=(0,n.J0)(()=>c("NewDiscussionChatTitle",{name:e?.title})),[u,m]=(0,n.J0)(),[p,g]=(0,n.J0)(),v=a===o.n7.InProgress,A=(0,T.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),C=(0,T.A)(()=>{d.length?e&&l({discussionChannelId:e.id,title:d,photo:u,isSuperGroup:!0}):g(c("NewChatTitleEmptyError"))});return(0,ne.Y)("div",{className:"Management",children:(0,ne.Y)("div",{className:"panel-content custom-scroll",children:(0,ne.FD)("div",{className:"NewChat",children:[(0,ne.FD)("div",{className:"NewChat-inner step-2",children:[(0,ne.Y)(Gh.A,{onChange:m,title:c("AddPhoto")}),(0,ne.Y)(ee.A,{value:d,onChange:A,label:c("GroupName"),error:p===c("NewChatTitleEmptyError")||p===c("NewChannelTitleEmptyError")?p:void 0}),f&&(0,ne.Y)("p",{className:"error",children:f})]}),(0,ne.Y)(fi.A,{isShown:0!==d.length,onClick:C,disabled:v,ariaLabel:c("DiscussionCreateGroup"),iconName:"arrow-right",isLoading:v})]})})})})),qf=(0,n.ph)((0,s.EK)(e=>({managementType:(0,c.vn8)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:i,isPromotedByCurrentUser:n,onScreenSelect:s,onChatMemberSelect:a,onClose:r,isActive:l,managementType:c})=>{switch(t){case o.je.Initial:switch(c){case"bot":return(0,ne.Y)(pf,{userId:e,onClose:r,isActive:l},e);case"user":return(0,ne.Y)(zf,{userId:e,onClose:r,isActive:l},e);case"group":return(0,ne.Y)(If,{chatId:e,onScreenSelect:s,onClose:r,isActive:l||[o.je.ChatPrivacyType,o.je.Discussion,o.je.GroupPermissions,o.je.ChatAdministrators,o.je.GroupRemovedUsers,o.je.GroupUserPermissionsCreate,o.je.GroupUserPermissions,o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t)},e);case"channel":return(0,ne.Y)(vf,{chatId:e,onScreenSelect:s,onClose:r,isActive:l||[o.je.ChannelSubscribers,o.je.ChatAdministrators,o.je.ChannelRemovedUsers,o.je.Discussion,o.je.ChatPrivacyType,o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t)},e)}break;case o.je.ChatPrivacyType:return(0,ne.Y)(ff,{chatId:e,isActive:l,onClose:r});case o.je.Discussion:return(0,ne.Y)(yf,{chatId:e,onScreenSelect:s,isActive:l,onClose:r});case o.je.GroupPermissions:return(0,ne.Y)(Tf,{chatId:e,onScreenSelect:s,onChatMemberSelect:a,isActive:l||[o.je.GroupRemovedUsers,o.je.GroupUserPermissionsCreate,o.je.GroupUserPermissions].includes(t),onClose:r});case o.je.ChannelRemovedUsers:case o.je.GroupRemovedUsers:return(0,ne.Y)(bf,{chatId:e,isActive:l,onClose:r});case o.je.GroupUserPermissionsCreate:return(0,ne.Y)(Lf,{chatId:e,onChatMemberSelect:a,onScreenSelect:s,isActive:l||[o.je.GroupUserPermissions].includes(t),onClose:r});case o.je.GroupUserPermissions:return(0,ne.Y)(Bf,{chatId:e,selectedChatMemberId:i,isPromotedByCurrentUser:n,onScreenSelect:s,isActive:l,onClose:r});case o.je.ChatAdministrators:return(0,ne.Y)(Af,{chatId:e,onScreenSelect:s,onChatMemberSelect:a,isActive:l||[o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t),onClose:r});case o.je.NewDiscussionGroup:return(0,ne.Y)($f,{chatId:e,onScreenSelect:s,isActive:l,onClose:r});case o.je.ChatNewAdminRights:case o.je.ChatAdminRights:return(0,ne.Y)(Yf,{chatId:e,isNewAdmin:t===o.je.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:n,onScreenSelect:s,isActive:l,onClose:r});case o.je.ChannelSubscribers:case o.je.GroupMembers:return(0,ne.Y)(Mf,{chatId:e,isActive:l,onClose:r});case o.je.Invites:return(0,ne.Y)(Kf,{chatId:e,isActive:l,onClose:r,onScreenSelect:s});case o.je.EditInvite:return(0,ne.Y)(Vf,{chatId:e,isActive:l,onClose:r,onScreenSelect:s});case o.je.GroupAddAdmins:return(0,ne.Y)(Mf,{chatId:e,noAdmins:!0,isActive:l,onClose:r,onScreenSelect:s,onChatMemberSelect:a});case o.je.Reactions:return(0,ne.Y)(Gf,{chatId:e,isActive:l,onClose:r});case o.je.InviteInfo:return(0,ne.Y)(_f,{chatId:e,isActive:l,onClose:r});case o.je.JoinRequests:return(0,ne.Y)(jf,{chatId:e,isActive:l,onClose:r})}})),Wf=/^4\d/,Qf=/^5[1-5]/,Zf=/^2[2-7]\d{2}/,Xf=/^220[0-4]/;let eC=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 tC={[eC.Default]:"",[eC.Visa]:"visa",[eC.Mastercard]:"mastercard",[eC.Mir]:"mir"};function iC(e){return e=e.replace(/\s/g,""),Wf.test(e)?eC.Visa:Xf.test(e)?eC.Mir:Qf.test(e)||Zf.test(e)?eC.Mastercard:eC.Default}const nC={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},sC=(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{...nC};default:return e}};var oC=i(37960);const aC={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"},rC=(0,n.ph)(({title:e,description:t,photo:i,invoice:a,shippingPrices:r,checkoutInfo:c,totalPrice:d,isTosAccepted:h,dispatch:u,onAcceptTos:m,tipAmount:p,needAddress:g,hasShippingOptions:v,savedCredentials:A,isPaymentFormUrl:f,botName:C})=>{const{setPaymentStep:b}=(0,s.ko)(),y=(0,B.A)(),S=(0,Bi.A)(),k=Boolean(u),{termsUrl:N,suggestedTipAmounts:w,maxTipAmount:I}=a||{},{paymentMethod:P,paymentProvider:Y,shippingAddress:F,name:D,phone:M,shippingMethod:T}=c||{},L=(0,q.A)((0,l.cy)(i)),{ref:x}=(0,oC.A)({hasMediaData:Boolean(L)}),R=(0,n.hb)(e=>{u({type:"setTipAmount",payload:I?Math.min(e,I):e})},[u,I]),E=(0,n.hb)(()=>{b({step:A?.length?o.tn.SavedPayments:o.tn.PaymentInfo})},[A?.length,b]),V=(0,n.hb)(()=>{b({step:o.tn.ShippingInfo})},[b]),_=(0,n.hb)(()=>{b({step:o.tn.Shipping})},[b]);return(0,ne.FD)("div",{className:aC.root,children:[(0,ne.FD)("div",{className:aC.description,children:[L&&(0,ne.Y)("img",{ref:x,className:aC.checkoutPicture,src:L,draggable:!1,width:i.dimensions?.width,height:i.dimensions?.height,alt:""}),!L&&i&&(0,ne.Y)(Oi.A,{width:i.dimensions?.width,height:i.dimensions?.height,className:aC.checkoutPicture,animation:"pulse",forceAspectRatio:!0}),(0,ne.FD)("div",{className:aC.text,children:[(0,ne.Y)("h5",{className:aC.checkoutTitle,children:e}),t&&(0,ne.Y)("div",{className:aC.checkoutDescription,children:(0,Mt.A)(t,["br","links","emoji"])})]})]}),(0,ne.FD)("div",{className:aC.priceInfo,children:[a.prices.map(e=>lC(S,e.label,e.amount,a.currency)),r&&r.map(e=>lC(S,e.label,e.amount,a.currency)),w&&w.length>0&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:aC.priceInfoItem,children:[(0,ne.Y)("div",{className:aC.priceInfoItemTitle,children:e}),(0,ne.Y)("div",{children:(0,wo.vv)(S,p,a.currency)})]}),(0,ne.Y)("div",{className:aC.tipsList,children:w.map(e=>(0,ne.Y)("div",{className:(0,ve.A)(aC.tipsItem,e===p&&aC.tipsItem_active),onClick:u?()=>R(e===p?0:e):void 0,children:(0,wo.vv)(S,e,a.currency,{shouldOmitFractions:!0})},e))})]}),void 0!==d&&lC(S,y("Checkout.TotalAmount"),d,a.currency,!0)]}),(0,ne.FD)("div",{className:aC.invoiceInfo,children:[!f&&cC({title:P||A?.[0].title,label:y("PaymentCheckoutMethod"),icon:"card",onClick:k?E:void 0}),Y&&cC({title:Y,label:y("PaymentCheckoutProvider"),customIcon:(0,ve.A)(aC.provider,aC[Y.toLowerCase()])}),(g||!k&&F)&&cC({title:F,label:y("PaymentShippingAddress"),icon:"location",onClick:k?V:void 0}),D&&cC({title:D,label:y("PaymentCheckoutName"),icon:"user"}),M&&cC({title:M,label:y("PaymentCheckoutPhoneNumber"),icon:"phone"}),(v||!k&&T)&&cC({title:T,label:y("PaymentCheckoutShippingMethod"),icon:"truck",onClick:k?_:void 0}),N&&(U=N,(0,ne.Y)(es.A,{label:function(e,t){const i=y("PaymentCheckoutAcceptRecurrent",C).split("*");return(0,ne.FD)(ne.FK,{children:[i[0],(0,ne.Y)(us.A,{url:e,text:i[1],isRtl:t}),i.slice(2)]})}(U,S.isRtl),name:"checkout_tos",checked:Boolean(h),className:aC.tosCheckbox,tabIndex:0,onCheck:m}))]})]});var U});function lC(e,t,i,n,s=!1){return(0,ne.FD)("div",{className:(0,ve.A)(aC.priceInfoItem,s&&aC.priceInfoItemMain),children:[(0,ne.Y)("div",{className:aC.priceInfoItemTitle,children:t}),(0,ne.Y)("div",{children:(0,wo.vv)(e,i,n)})]})}function cC({title:e,label:t,icon:i,customIcon:n,onClick:s}){const o=Boolean(e&&t!==e);return(0,ne.FD)(ui.A,{className:aC.list,narrow:!0,multiline:o,icon:i,inactive:!s,onClick:s,leftElement:n&&(0,ne.Y)("i",{className:(0,ve.A)("icon",n)}),children:[(0,ne.Y)("div",{className:aC.checkoutInfoItemInfoTitle,children:e||t}),e&&t!==e&&(0,ne.Y)("p",{className:aC.checkoutInfoItemInfoData,children:t})]})}const dC=(0,n.ph)(({url:e,noRedirect:t,onClose:i,onPaymentFormSubmit:o})=>{const{openTelegramLink:r}=(0,s.ko)(),l=(0,B.A)(),c=(0,n.li)(),d=(0,n.hb)(e=>{if((0,Hs.S)(e,c.current))try{const n=JSON.parse(e.data),{eventType:s,eventData:l}=n;switch(s){case"web_app_open_tg_link":if(!t){const e=a.jsp+l.path_full;r({url:e})}i();break;case"payment_form_submit":o&&o(l);break;default:i()}}catch(e){}},[i,t,r,o]);return(0,n.vJ)(()=>(window.addEventListener("message",d),()=>window.removeEventListener("message",d)),[d]),(0,ne.Y)("div",{className:"ConfirmPayment",children:(0,ne.Y)("iframe",{ref:c,src:e,title:l("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin",className:"ConfirmPayment__content"})})}),hC=(0,n.ph)((0,s.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:o,passwordHint:a,onPasswordChange:r})=>{const{clearPaymentError:l}=(0,s.ko)(),c=(0,B.A)(),d=(0,Bi.A)(),[h,u]=(0,n.J0)(!1),m=(0,n.Kr)(()=>o?.length&&i.savedCredentialId?o.find(({id:e})=>e===i.savedCredentialId)?.title:void 0,[o,i.savedCredentialId]);return(0,ne.FD)("div",{className:"PaymentInfo",children:[(0,ne.Y)(rh.A,{isBig:!0,isPasswordVisible:h}),(0,ne.Y)(Rl.A,{error:t&&d.withRegular(t),hint:a,description:c("PaymentConfirmationMessage",m),placeholder:c("Password"),onClearError:l,shouldShowSubmit:!1,shouldResetValue:e,isPasswordVisible:h,onChangePasswordVisibility:u,onInputChange:r})]})}));var uC=i(63173);const mC=i.p+"mastercard.790db81f7978635f77d8.svg",pC=i.p+"mir.e3a390b90e2e3e292621.svg",gC=i.p+"visa.fb39984c9532c0336be9.svg",vC=(0,n.ph)(({value:e,error:t,onChange:i,isActive:s})=>{const o=(0,B.A)(),a=(0,n.li)();(0,n.vJ)(()=>{s&&!u.TF&&(0,r.YS)(()=>{(0,Sc.A)(a.current)})},[s]);const[l,c]=(0,n.J0)(eC.Default);(0,n.vJ)(()=>{const t=iC(e);c(t)},[]);const d=(0,n.hb)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=iC(e.target.value);c(n),i(t)},[i]),h=function(e){switch(e){case eC.Mastercard:return(0,ne.Y)("img",{src:mC,draggable:!1,alt:""});case eC.Visa:return(0,ne.Y)("img",{src:gC,draggable:!1,alt:""});case eC.Mir:return(0,ne.Y)("img",{src:pC,draggable:!1,alt:""});default:return}}(l);return(0,ne.FD)("div",{className:"CardInput",children:[(0,ne.Y)(ee.A,{ref:a,label:o("PaymentCardNumber"),onChange:d,value:e,inputMode:"numeric",className:l?"has-right-addon":"",error:t,tabIndex:0,maxLength:19,teactExperimentControlled:!0}),(0,ne.Y)("span",{className:"right-addon",children:h})]})}),AC=(0,n.ph)(({value:e,error:t,onChange:i})=>{const s=(0,B.A)(),o=(0,n.hb)(t=>{const n=t.target.value;e.endsWith("/")&&e.length>n.length?i(n):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,ne.Y)(ee.A,{label:s("PaymentCardExpireDate"),onChange:o,value:e,error:t,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})}),fC=(0,n.ph)(({state:e,canSaveCredentials:t,needCardholderName:i,needCountry:s,needZip:o,countryList:a,dispatch:r,isActive:l})=>{const c=(0,n.li)();(0,n.vJ)(()=>{c.current&&c.current.value!==e.billingCountry&&(c.current.value=e.billingCountry)},[e.billingCountry]);const d=(0,n.hb)(e=>{r({type:"changeCardNumber",payload:e})},[r]),h=(0,n.hb)(e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[r]),u=(0,n.hb)(e=>{r({type:"changeExpiryDate",payload:e})},[r]),m=(0,n.hb)(e=>{const t=e.target.value.replace(/[^0-9]/g,"");r({type:"changeCvvCode",payload:t})},[r]),p=(0,n.hb)(e=>{r({type:"changeBillingCountry",payload:e.target.value})},[r]),g=(0,n.hb)(e=>{r({type:"changeBillingZip",payload:e.target.value})},[r]),v=(0,n.hb)(e=>{r({type:"changeSaveCredentials",payload:e.target.value})},[r]),A=(0,B.A)(),f=(0,Bi.A)(),{formErrors:C={}}=e;return(0,ne.Y)("div",{className:"PaymentInfo",children:(0,ne.FD)("form",{children:[(0,ne.Y)("h5",{children:A("PaymentCardTitle")}),(0,ne.Y)(vC,{onChange:d,value:e.cardNumber,error:C.cardNumber&&f.withRegular(C.cardNumber),isActive:l}),i&&(0,ne.Y)(ee.A,{label:A("Checkout.NewCard.CardholderNamePlaceholder"),onChange:h,value:e.cardholder,inputMode:"text",tabIndex:0,error:C.cardholder&&f.withRegular(C.cardholder)}),(0,ne.FD)("section",{className:"inline-inputs",children:[(0,ne.Y)(AC,{value:e.expiry,onChange:u,error:C.expiry&&f.withRegular(C.expiry)}),(0,ne.Y)(ee.A,{label:A("lng_payments_card_cvc"),onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:C.cvv&&f.withRegular(C.cvv),teactExperimentControlled:!0})]}),s||o?(0,ne.Y)("h5",{children:A("PaymentBillingAddress")}):void 0,(0,ne.FD)("section",{className:"inline-inputs",children:[s&&(0,ne.Y)(uC.A,{label:A("PaymentShippingCountry"),onChange:p,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:C.billingCountry&&f.withRegular(C.billingCountry),tabIndex:0,ref:c,children:a.map(({defaultName:t,name:i})=>(0,ne.Y)("option",{value:t,className:"county-item",selected:t===e.billingCountry,children:t||i}))}),o&&(0,ne.Y)(ee.A,{label:A("PaymentShippingZipPlaceholder"),onChange:g,value:e.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:C.billingZip&&f.withRegular(C.billingZip)})]}),(0,ne.Y)("div",{className:"checkbox",children:(0,ne.Y)(es.A,{label:A("PaymentCardSavePaymentInformation"),checked:!!t&&e.saveCredentials,tabIndex:0,subLabel:A(t?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"),onChange:v,disabled:!t})})]})})}),CC=(0,n.ph)(({state:e,savedCredentials:t,dispatch:i,onNewCardClick:s})=>{const o=(0,B.A)(),a=(0,n.Kr)(()=>t?.length?t.map(({id:e,title:t})=>({label:t,value:e})):gi.p,[t]),r=(0,n.hb)(e=>{i({type:"changeSavedCredentialId",payload:e})},[i]);return(0,ne.Y)("div",{className:"PaymentInfo",children:(0,ne.FD)("form",{children:[(0,ne.Y)("h5",{children:o("PaymentCardTitle")}),(0,ne.Y)(ie.A,{name:"saved-credentials",options:a,selected:e.savedCredentialId,onChange:r}),(0,ne.Y)(X.A,{isText:!0,onClick:s,children:o("PaymentCheckoutMethodNewCard")})]})})}),bC=(0,n.ph)(({state:e,shippingOptions:t,currency:i,dispatch:s})=>{const o=(0,B.A)(),a=(0,Bi.A)();(0,n.vJ)(()=>{t&&t.length&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})},[t,e.shipping,s]);const r=(0,n.hb)(e=>{s({type:"changeShipping",payload:e})},[s]),l=(0,n.Kr)(()=>t.map(({id:e,title:t,amount:n})=>({label:t,subLabel:(0,wo.vv)(a,n,i),value:e})),[t,i,a]);return(0,ne.Y)("div",{className:"Shipping",children:(0,ne.FD)("form",{children:[(0,ne.Y)("p",{children:o("PaymentShippingMethod")}),(0,ne.Y)(ie.A,{name:"shipping-options",options:l,onChange:r,selected:e.shipping})]})})}),yC=(0,n.ph)(({state:e,needEmail:t,needPhone:i,needName:s,needAddress:o,countryList:a,dispatch:l})=>{const c=(0,n.li)(),d=(0,n.li)(),h=(0,n.li)();(0,n.vJ)(()=>{h.current&&h.current.value!==e.countryIso2&&(h.current.value=e.countryIso2)},[e.countryIso2]);const m=(0,B.A)(),p=(0,Bi.A)();(0,n.vJ)(()=>{u.TF||(0,r.YS)(()=>{(0,Sc.A)(c.current)})},[c]);const g=(0,n.hb)(e=>{l({type:"changeAddress1",payload:e.target.value})},[l]),v=(0,n.hb)(e=>{l({type:"changeAddress2",payload:e.target.value})},[l]),A=(0,n.hb)(e=>{l({type:"changeCity",payload:e.target.value})},[l]),f=(0,n.hb)(e=>{l({type:"changeState",payload:e.target.value})},[l]),C=(0,n.hb)(e=>{l({type:"changeCountry",payload:a.find(t=>t.iso2===e.target.value)})},[a,l]),b=(0,n.hb)(e=>{l({type:"changePostCode",payload:e.target.value})},[l]),y=(0,n.hb)(e=>{l({type:"changeFullName",payload:e.target.value})},[l]),S=(0,n.hb)(e=>{l({type:"changeEmail",payload:e.target.value})},[l]),k=(0,n.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,n.hb)(e=>{l({type:"changeSaveInfo",payload:e.target.value})},[l]),{formErrors:w}=e;return(0,ne.Y)("div",{className:"ShippingInfo",children:(0,ne.FD)("form",{children:[o?(0,ne.FD)("div",{children:[(0,ne.Y)("h5",{children:m("PaymentShippingAddress")}),(0,ne.Y)(ee.A,{ref:c,label:m("PaymentShippingAddress1Placeholder"),onChange:g,value:e.streetLine1,inputMode:"text",tabIndex:0,error:w.streetLine1&&p.withRegular(w.streetLine1)}),(0,ne.Y)(ee.A,{label:m("PaymentShippingAddress2Placeholder"),onChange:v,value:e.streetLine2,inputMode:"text",tabIndex:0,error:w.streetLine2&&p.withRegular(w.streetLine2)}),(0,ne.Y)(ee.A,{label:m("PaymentShippingCityPlaceholder"),onChange:A,value:e.city,inputMode:"text",tabIndex:0,error:w.city&&p.withRegular(w.city)}),(0,ne.Y)(ee.A,{label:m("PaymentShippingStatePlaceholder"),onChange:f,value:e.state,inputMode:"text",error:w.state&&p.withRegular(w.state)}),(0,ne.Y)(uC.A,{label:m("PaymentShippingCountry"),onChange:C,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:w.countryIso2&&p.withRegular(w.countryIso2),ref:h,tabIndex:0,children:a.map(({defaultName:t,name:i,iso2:n})=>(0,ne.Y)("option",{value:n,className:"county-item",selected:n===e.countryIso2,children:t||i}))}),(0,ne.Y)(ee.A,{label:m("PaymentShippingZipPlaceholder"),onChange:b,value:e.postCode,inputMode:"text",tabIndex:0,error:w.postCode&&p.withRegular(w.postCode)})]}):void 0,s||t||i?(0,ne.Y)("h5",{children:m("PaymentShippingReceiver")}):void 0,s&&(0,ne.Y)(ee.A,{label:m("PaymentShippingName"),onChange:y,value:e.fullName,inputMode:"text",tabIndex:0,error:w.fullName&&p.withRegular(w.fullName)}),t&&(0,ne.Y)(ee.A,{label:m("PaymentShippingEmailPlaceholder"),onChange:S,value:e.email,inputMode:"email",tabIndex:0,error:w.email&&p.withRegular(w.email)}),i&&(0,ne.Y)(ee.A,{label:m("PaymentShippingPhoneNumber"),onChange:k,value:e.phone,inputMode:"tel",tabIndex:0,error:w.phone&&p.withRegular(w.phone),ref:d}),(0,ne.Y)(es.A,{label:m("PaymentShippingSave"),subLabel:m("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),tabIndex:0,onChange:N})]})})}),SC="stripe",kC="smartglocal",NC=new Set([SC,kC]),wC=(0,n.ph)((0,s.EK)(e=>{const{form:t,step:i,shippingOptions:n,error:s,confirmPaymentUrl:o,inputInvoice:a,requestId:r,stripeCredentials:d,smartGlocalCredentials:h,temporaryPassword:u,isExtendedMedia:m,url:p}=(0,c.nTw)(e).payment,{invoice:g,nativeParams:v,nativeProvider:A}=t||{},f=e.countryList.general;let C=t?.nativeProvider;!C&&p&&(C=p.startsWith("https://payment.smart-glocal.com")?kC:void 0);const b=a&&"chatId"in a?(0,c.hds)(e,a.chatId):void 0,y=Boolean(g&&(!C||!NC.has(C))),{needCardholderName:S,needCountry:k,needZip:N}=v||{},w=t?.botId?(0,c.mBe)(e,t.botId):void 0,I=(0,l.Yg)(w);return{step:i,chat:b,shippingOptions:n,nativeProvider:C,isProviderError:y,form:t,invoice:g,needCardholderName:S,needCountry:k,needZip:N,error:s,confirmPaymentUrl:o??p,isPaymentFormUrl:Boolean(!A&&p),countryList:f,requestId:r,hasShippingOptions:Boolean(n?.length),smartGlocalToken:h?.token,stripeId:d?.id,passwordValidUntil:u?.validUntil,isExtendedMedia:m,botName:I}})(({isOpen:e,onClose:t,step:i,shippingOptions:a,form:r,isProviderError:l,invoice:c,nativeProvider:d,needCardholderName:h,needCountry:u,needZip:m,confirmPaymentUrl:p,error:g,countryList:v,hasShippingOptions:A,requestId:f,smartGlocalToken:C,stripeId:b,passwordValidUntil:y,isExtendedMedia:S,isPaymentFormUrl:k,botName:N})=>{const{loadPasswordInfo:w,validateRequestedInfo:I,sendPaymentForm:P,setPaymentStep:Y,sendCredentialsInfo:F,clearPaymentError:M,validatePaymentPassword:L,setSmartGlocalCardInfo:x}=(0,s.ko)(),R=(0,B.A)(),E=(0,Bi.A)(),[V,_,U]=(0,D.A)(),[O,J]=(0,_d.A)(sC,nC),[j,G]=(0,n.J0)(!1),[H,z]=(0,n.J0)(!1),[$,q]=(0,n.J0)(""),W=(0,K.A)(i,!0),Q=(0,K.A)(f),Z=i!==o.tn.ConfirmPayment,ee=(0,n.hb)(e=>{Y({step:e})},[Y]);(0,n.vJ)(()=>{e&&(q(""),w(),_())},[e,w,_]),(0,n.vJ)(()=>{!e&&V&&U()},[U,V,e]),(0,n.vJ)(()=>{(void 0!==i||g)&&G(!1)},[i,g,f]),(0,n.vJ)(()=>{i!==o.tn.Checkout||i!==W||f===Q||O.savedCredentialId||O.cardNumber||ee(o.tn.PaymentInfo)},[O.cardNumber,O.savedCredentialId,Q,W,f,ee,i]),(0,n.vJ)(()=>{g?.field&&J({type:"setFormErrors",payload:{[g.field]:g.messageKey}})},[g,J]),(0,n.vJ)(()=>{if(r?.savedInfo){const{name:e,phone:t,email:i,shippingAddress:n}=r.savedInfo,{countryIso2:s,...o}=n||{},a=s&&v.find(({iso2:e})=>e===s).defaultName;J({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:i,...a&&{country:a,countryIso2:s,...o}}})}},[r,J,v]),(0,n.vJ)(()=>{r?.savedCredentials?.length&&J({type:"changeSavedCredentialId",payload:r.savedCredentials[0].id})},[J,r?.savedCredentials]);const ie=(0,n.hb)(()=>{M()},[M]),se=(0,n.Kr)(()=>i!==o.tn.Checkout?0:function(e=[],t,i,n){const s=t?PC(t,i):[];let o=n;return o=e.concat(s||[]).reduce((e,t)=>e+t.amount,o),o}(c?.prices,a,O.shipping,O.tipAmount),[i,c?.prices,a,O.shipping,O.tipAmount]),oe=(0,n.Kr)(()=>{if(i===o.tn.Checkout)return function(e,t,i){const n=function(e){const t=iC(e);return tC[t]||""}(e.cardNumber),s=n&&e.cardNumber?`${n} *${e.cardNumber.slice(-4)}`:void 0,o=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:a,fullName:r}=e,l=t?IC(t,e.shipping):void 0,c=l?.title;return{paymentMethod:s,paymentProvider:i,shippingAddress:o,name:r,phone:a,shippingMethod:c}}(O,a,d||"")},[i,O,a,d]),re=(0,n.hb)(()=>{ee(o.tn.PaymentInfo)},[ee]),le=(0,n.hb)(()=>{M()},[M]),ce=(0,n.hb)(()=>{P({shippingOptionId:O.shipping,saveCredentials:O.saveCredentials,savedCredentialId:O.savedCredentialId,tipAmount:O.tipAmount})},[P,O]),de=(0,n.hb)(e=>{const{credentials:t}=e;x(t),ce()},[ce]);function he(e,t){switch(e){case o.tn.Checkout:return(0,ne.Y)(rC,{title:r.title,description:r.description,photo:r.photo,dispatch:J,shippingPrices:O.shipping&&a?PC(a,O.shipping):void 0,totalPrice:se,invoice:c,checkoutInfo:oe,isPaymentFormUrl:k,hasShippingOptions:A,tipAmount:O.tipAmount,needAddress:Boolean(c?.isShippingAddressRequested),savedCredentials:r.savedCredentials,isTosAccepted:H,onAcceptTos:z,botName:N});case o.tn.SavedPayments:return(0,ne.Y)(CC,{state:O,savedCredentials:r.savedCredentials,dispatch:J,onNewCardClick:re});case o.tn.ConfirmPassword:return(0,ne.Y)(hC,{state:O,savedCredentials:r.savedCredentials,onPasswordChange:q,isActive:e===i});case o.tn.PaymentInfo:return(0,ne.Y)(fC,{state:O,dispatch:J,canSaveCredentials:Boolean(!r.isPasswordMissing&&r.canSaveCredentials),needCardholderName:h,needCountry:u,needZip:m,countryList:v,isActive:t});case o.tn.ShippingInfo:return(0,ne.Y)(yC,{state:O,dispatch:J,needAddress:Boolean(c?.isShippingAddressRequested),needEmail:Boolean(c?.isEmailRequested||c?.isEmailSentToProvider),needPhone:Boolean(c?.isPhoneRequested||c?.isPhoneSentToProvider),needName:Boolean(c?.isNameRequested),countryList:v});case o.tn.Shipping:return(0,ne.Y)(bC,{state:O,dispatch:J,shippingOptions:a||[],currency:c.currency});case o.tn.ConfirmPayment:return(0,ne.Y)(dC,{url:p,noRedirect:S,onPaymentFormSubmit:de,onClose:U});default:return}}const ue=(0,n.hb)(()=>{const{saveInfo:e}=O,t=function(e){const{streetLine1:t,streetLine2:i,city:n,state:s,countryIso2:o,postCode:a,fullName:r,phone:l,email:c}=e;return{name:r,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:i,city:n,state:s,countryIso2:o,postCode:a}}}(O);I({requestInfo:t,saveInfo:e})},[I,O]),me=(0,n.hb)(()=>{const e=function(e){const{cardNumber:t,cardholder:i,expiry:n,cvv:s,billingCountry:o,billingZip:a}=e,[r,l]=n.split("/");return{data:{cardNumber:t,cardholder:i,expiryMonth:r,expiryYear:l,cvv:s,country:o,zip:a}}}(O);F({credentials:e})},[F,O]),pe=(0,T.A)(()=>{switch(i){case o.tn.ShippingInfo:G(!0),ue();break;case o.tn.Shipping:ee(o.tn.Checkout);break;case o.tn.SavedPayments:ee(o.tn.ConfirmPassword);break;case o.tn.ConfirmPassword:if(""===$)return;G(!0),L({password:$});break;case o.tn.PaymentInfo:G(!0),me(),J({type:"changeSavedCredentialId",payload:""});break;case o.tn.Checkout:{if(k)return G(!0),void ee(o.tn.ConfirmPayment);if(r?.savedInfo&&!f&&!O.shipping)return G(!0),void ue();if(O.savedCredentialId&&(!y||y<=Date.now()/1e3-3))return void ee(o.tn.ConfirmPassword);if(!O.savedCredentialId&&(d===SC&&!b||d===kC&&!C))return void ee(o.tn.PaymentInfo);const{phone:e,email:t,fullName:i}=O,n=c?.isEmailRequested&&!t||c?.isPhoneRequested&&!e||c?.isNameRequested&&!i;if(c?.isShippingAddressRequested&&!f||n)return void ee(o.tn.ShippingInfo);if(c?.isShippingAddressRequested&&!O.shipping&&a?.length)return void ee(o.tn.Shipping);G(!0),ce();break}}});(0,n.vJ)(()=>i===o.tn.ConfirmPassword?(0,Pi.A)({onEnter:pe}):void 0,[pe,i]);const ge=(0,n.hb)(()=>{J({type:"resetState"}),z(!1),t()},[t,J]),Ae=(0,n.hb)(()=>{ee(i===o.tn.ConfirmPassword?o.tn.SavedPayments:o.tn.Checkout)},[ee,i]),fe=(0,n.Kr)(()=>{switch(i){case o.tn.Checkout:return R("PaymentCheckout");case o.tn.ShippingInfo:return R("PaymentShippingInfo");case o.tn.Shipping:return R("PaymentShippingMethod");case o.tn.SavedPayments:return R("PaymentCheckoutMethod");case o.tn.ConfirmPassword:return R("Checkout.PasswordEntry.Title");case o.tn.PaymentInfo:return R("PaymentCardInfo");case o.tn.ConfirmPayment:return R("Checkout.WebConfirmation.Title");default:return""}},[i,R]),Ce=i===o.tn.Checkout?R("Checkout.PayPrice",(0,wo.Ad)(se,c.currency,R.code)):E("PaymentInfoDone");if(l)return(0,ne.FD)(te.A,{className:"error",isOpen:V,onClose:U,onCloseAnimationEnd:ge,children:[(0,ne.Y)("p",{children:E("PaymentsProvidesNotSupported",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{isText:!0,onClick:U,children:R("OK")})})]});const be=function(){if(j)return!0;switch(i){case o.tn.Checkout:return Boolean(c?.termsUrl)&&!H;case o.tn.PaymentInfo:return Boolean(""===O.cardNumber||h&&""===O.cardholder||""===O.cvv||""===O.expiry);default:return!1}}();return(0,ne.FD)(te.A,{className:(0,ve.A)("PaymentModal",c?.isRecurring&&"recurring"),isOpen:V,onClose:U,onCloseAnimationEnd:ge,children:[(0,ne.FD)("div",{className:"header",dir:E.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",iconName:i===o.tn.Checkout?"close":"arrow-left",onClick:i===o.tn.Checkout?U:Ae,ariaLabel:E("Close")}),(0,ne.Y)("h3",{children:fe})]}),void 0!==i?(0,ne.Y)(ae.Ay,{name:"slide",activeKey:i,shouldCleanup:!0,cleanupOnlyKey:o.tn.ConfirmPayment,children:e=>(0,ne.Y)("div",{className:"content custom-scroll",children:he(i,e)})}):(0,ne.Y)("div",{className:"empty-content",children:(0,ne.Y)(je.A,{color:"gray"})}),Z&&(0,ne.Y)("div",{className:"footer",children:(0,ne.Y)(X.A,{className:"button-text",type:"submit",onClick:pe,disabled:be,isLoading:j,children:Ce})}),g&&!g.field&&function(){if(g)return(0,ne.FD)(te.A,{className:"error",isOpen:Boolean(g),onClose:ie,children:[(0,ne.Y)("h4",{children:g.descriptionKey?E.withRegular(g.descriptionKey):E("ErrorUnspecified")}),(0,ne.Y)("div",{className:"dialog-buttons mt-2",children:(0,ne.Y)(X.A,{isText:!0,onClick:le,children:E("OK")})})]})}()]})}));function IC(e,t){return e.find(({id:e})=>e===t)}function PC(e,t){const i=IC(e,t);return i?.prices}const YC=(0,n.ph)((0,s.EK)(e=>{const{receipt:t}=(0,c.nTw)(e).payment;return{receipt:t}})(({isOpen:e,onClose:t,receipt:i})=>{const s=(0,Bi.A)(),[o,a,r]=(0,D.A)();(0,n.vJ)(()=>{e&&a()},[e,a]);const l=(0,O.A)(i),c=i||l,d=(0,n.Kr)(()=>{if(c)return function(e,t,i){if(!t)return{paymentMethod:e};const{shippingAddress:n}=t,s=n?.streetLine1?`${n.streetLine1}, ${n.city}, ${n.countryIso2}`:void 0,{phone:o,name:a}=t;return{paymentMethod:e,shippingAddress:s,name:a,phone:o,shippingMethod:i}}(c.credentialsTitle,c.info,c.shippingMethod)},[c]);return(0,ne.Y)(te.A,{className:"PaymentModal PaymentModal-receipt",isOpen:o,onClose:r,onCloseAnimationEnd:t,children:c&&(0,ne.FD)(ne.FK,{children:[(0,ne.FD)("div",{className:"header",dir:s.isRtl?"rtl":void 0,children:[(0,ne.Y)(X.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:r,ariaLabel:"Close",iconName:"close"}),(0,ne.FD)("h3",{children:[" ",s("PaymentReceipt")," "]})]}),(0,ne.Y)("div",{className:"receipt-content custom-scroll",children:(0,ne.Y)(rC,{shippingPrices:c.shippingPrices,totalPrice:c.totalAmount,tipAmount:c.tipAmount,invoice:c.invoice,checkoutInfo:d,title:c.title,description:c.description,photo:c.photo})})]})})})),FC="Qo4PtFZI",DC="wtfpombl",MC=(0,n.ph)((0,s.EK)((e,{modal:t})=>({chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0}))(({modal:e,chat:t})=>{const{sendInviteMessages:i,closeInviteViaLinkModal:o,openPremiumModal:a}=(0,s.ko)(),{missingUsers:r}=e||{},d=(0,Bi.A)(),[h,u]=(0,n.J0)([]),m=(0,n.Kr)(()=>r?.map(e=>e.id)||gi.p,[r]),[p,g]=(0,n.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]),v=(0,n.Kr)(()=>{const e=(0,s.mS)();return r?.filter(e=>e.isRequiringPremiumToInvite||e.isRequiringPremiumToMessage).map(t=>(0,c.mBe)(e,t.id)).filter(Boolean)},[r]);(0,n.vJ)(()=>{u(g)},[g]);const A=(0,T.A)(()=>o()),f=(0,T.A)(()=>{i({chatId:t.id,userIds:h}),o()}),C=(0,T.A)(()=>{a()}),b=(0,n.Kr)(()=>{if(t)return Boolean(t?.isCreator||t?.adminRights?.inviteUsers)},[t]),y=(0,n.Kr)(()=>b?d(1===r?.length?"InviteBlockedOneMessage":"InviteBlockedManyMessage"):d("InviteRestrictedUsers",{count:r?.length},{pluralValue:r?.length||0,withMarkdown:!0,withNodes:!0}),[b,d,r?.length]),S=(0,n.Kr)(()=>{if(v?.length){if(1===v.length)return d("InviteRestrictedPremiumReasonSingle",{user:(0,l.Yg)(v[0])},{withMarkdown:!0,withNodes:!0});if(v.length<=3){const e=d.conjunction(v.map(e=>(0,l.Yg)(e)).filter(Boolean));return d("InviteRestrictedPremiumReasonMultiple",{list:e},{withMarkdown:!0,withNodes:!0})}if(v.length>3){const e=v.length-2,t=v.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})}}},[v,d]),k=Boolean(v?.length),N=Boolean(g?.length);return(0,ne.FD)(te.A,{isOpen:Boolean(m&&t),contentClassName:"n8eENbaR",hasAbsoluteCloseButton:!0,onClose:A,isSlim:!0,children:[k&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)(Xi.A,{className:"Nc3SOtKd",peers:v,size:"large"}),(0,ne.Y)("h3",{className:DC,children:d(b?"InviteBlockedPremiumTitle":"InviteBlockedNoLinkTitle")}),(0,ne.Y)("p",{className:FC,children:S}),(0,ne.Y)(X.A,{withPremiumGradient:!0,isShiny:!0,onClick:C,children:d("InviteBlockedPremiumButton")})]}),k&&N&&(0,ne.Y)(vc.A,{className:"UoMeVIyC",children:d("InviteBlockedOr")}),N&&(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:DC,children:d("InviteBlockedTitle")}),(0,ne.Y)("p",{className:FC,children:y}),(0,ne.Y)(vi.A,{className:"nEYyTS_m",itemIds:m,selectedIds:h,lockedUnselectedIds:p,lockedUnselectedSubtitle:d("InviteRestrictedPremiumReason"),onSelectedIdsChange:u,isViewOnly:!b,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),b&&(0,ne.Y)(X.A,{className:"Ttkq3nqt",onClick:f,disabled:!h.length,children:d("InviteViaLinkButton")})]})]})}));var TC=i(84555);const BC=(0,n.ph)(({modal:e})=>{const{closeOneTimeMediaModal:t}=(0,s.ko)(),i=(0,B.A)(),n=(0,Ii.A)(e?.message,!0),{shouldRender:a,transitionClassNames:r}=(0,qe.A)(Boolean(e)),d=(0,T.A)(()=>{}),h=(0,T.A)(()=>{t()});if(!a||!n)return;const u=(0,l.Ie)(n),m=(0,c.SJA)((0,s.mS)()),p=i(u?"Chat.Voice.Single.Close":"Chat.Voice.Single.DeleteAndClose");return(0,ne.FD)("div",{className:(0,ve.A)("c3xMWwzW",r),children:[function(){if(!n?.content)return;const{voice:e,video:t}=n.content;return e?(0,ne.Y)(Kc.Ay,{className:"VLiJWMs0",theme:m,message:n,origin:o.d9.OneTimeModal,autoPlay:!0,onPlay:d,onPause:h}):t?.isRound?(0,ne.Y)(TC.A,{className:"ML2YEpGq",message:n,origin:"oneTimeModal",onStop:h}):void 0}(),(0,ne.Y)("div",{className:"VWy1qXJL",children:(0,ne.Y)(X.A,{faded:!0,onClick:h,pill:!0,size:"smaller",color:"dark"===m?"dark":"secondary",className:"FfMrCmD9",children:p})})]})}),LC=(0,n.ph)(({modal:e})=>{const{closeWebAppsCloseConfirmationModal:t,closeWebAppModal:i}=(0,s.ko)(),o=(0,B.A)(),a=(0,Bi.A)(),r=Boolean(e),[l,c]=(0,n.J0)(!1),d=(0,n.li)(),h=(0,n.hb)(()=>{t({shouldSkipInFuture:l})},[l]),u=(0,n.hb)(()=>{i({shouldSkipConfirmation:!0}),t({shouldSkipInFuture:l})},[l]),m=(0,n.hb)(e=>{-1===e&&u()},[u]),p=(0,Kn.A)(d,r,m,".Button");return(0,ne.FD)(te.A,{className:(0,ve.A)("confirm"),title:a("CloseMiniApps"),isOpen:r,onClose:h,children:[(0,ne.Y)("p",{children:a("AreYouSureCloseMiniApps")}),(0,ne.Y)(es.A,{className:"dialog-checkbox",label:a("DoNotAskAgain"),checked:l,onCheck:c}),(0,ne.FD)("div",{className:"dialog-buttons mt-2",ref:d,onKeyDown:p,children:[(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"danger",children:o("Confirm")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:h,children:o("Cancel")})]})]})}),xC=(0,n.ph)((0,s.EK)(e=>{const t=e.appConfig.freezeUntilDate,i=e.appConfig.freezeAppealUrl,n=e.botFreezeAppealId?(0,c.mBe)(e,e.botFreezeAppealId):void 0;return{freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:n&&(0,l.Kl)(n)}})(({modal:e,freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:o})=>{const{closeFrozenAccountModal:a,openUrl:r}=(0,s.ko)(),l=(0,Bi.A)(),c=Boolean(e),d=(0,T.A)(()=>{a()}),h=(0,T.A)(()=>{a(),i&&r({url:i})}),u=(0,n.Kr)(()=>(0,ne.FD)("div",{className:"cW2rtp6M",children:[(0,ne.Y)(Oo.A,{size:130,tgsUrl:Uo.w.BannedDuck,noLoop:!0}),(0,ne.Y)("div",{className:"qLSm0uyC",children:l("FrozenAccountModalTitle")})]}),[l]),m=(0,n.Kr)(()=>{if(c)return(0,ne.FD)("div",{className:"Vj3QQ_JQ",children:[(0,ne.Y)(X.A,{className:"anvg3JaY",onClick:h,children:l("ButtonAppeal")}),(0,ne.Y)(X.A,{isText:!0,onClick:d,children:l("ButtonUnderstood")})]})},[l,c]),p=(0,n.Kr)(()=>{if(!t||!o)return;const e=new Date(1e3*t),i=(0,ne.Y)(Oa.A,{onClick:h,isPrimary:!0,children:(0,xc.A)(o)});return[["hand-stop",l("FrozenAccountViolationTitle"),l("FrozenAccountViolationSubtitle")],["lock",l("FrozenAccountReadOnlyTitle"),l("FrozenAccountReadOnlySubtitle")],["frozen-time",l("FrozenAccountAppealTitle"),l("FrozenAccountAppealSubtitle",{botLink:i,date:(0,et.A)(e,l.code)},{withNodes:!0})]]},[l,o,t]);if(p)return(0,ne.Y)(Sl.A,{isOpen:c,header:u,listItemData:p,footer:m,onClose:d})})),RC={header:"ChJT6ggP",description:"ravQhVQQ",descriptionPreview:"_K5HhOM0",negative:"X6iX4F56",previewLink:"yY4hj8r_",backLink:"dcNVNCXo",title:"IvsV0tkW",ratingProgress:"XYpzs7CQ",withPreview:"UgviXkNW",footer:"XtZPIDLP",badge:"JdeFDQBI",understoodIcon:"Lwz8rpdL",badgeAdded:"Lr6JUU14",badgeDeducted:"OxZxdqcn"},EC=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=e.currentUserId,n=t?.userId?(0,c.mBe)(e,t.userId):void 0,s=t?.userId?(0,c.vGo)(e,t.userId):void 0,o=s?.starsRating,a=s?.starsMyPendingRating,r=s?.starsMyPendingRatingDate;return{user:n,currentUserId:i,starsRating:o,pendingRating:a,pendingRatingDate:r}})(({modal:e,user:t,currentUserId:i,starsRating:o,pendingRating:a,pendingRatingDate:r})=>{const{closeProfileRatingModal:l}=(0,s.ko)(),c=(0,Bi.A)(),d=Boolean(e),h=(0,Ii.A)(t),u=(0,Ii.A)(o),m=(0,Ii.A)(a),p=(0,Ii.A)(r),[g,v]=(0,n.J0)(!1),A=(0,T.A)(()=>{l()});(0,n.vJ)(()=>{d||v(!1)},[d]);const f=(0,T.A)(()=>{v(!0)}),C=(0,T.A)(()=>{v(!1)}),b=e=>{const t="added"===e,i=c(t?"RatingBadgeAdded":"RatingBadgeDeducted"),n=t?RC.badgeAdded:RC.badgeDeducted;return(0,ne.Y)("span",{className:(0,ve.A)(RC.badge,n),children:i})},y=(0,n.Kr)(()=>{if(!h||!u)return;const e=g&&m?m:u,t=e.stars,n=e.currentLevelStars,s=e.nextLevelStars,o=e.level,a=o+1,r=o<0,l=!g&&m?m.level:u.level;let d;d=s&&s>n?Math.max(.03,(t-n)/(s-n)):1;const v=r?.5:Math.max(0,Math.min(1,d)),A=p?p-(0,Di.Fm)():0,b=m?m.stars-u.stars:0,y=m&&p;let S="none";o>=0&&l>=0&&o!==l&&(S=o>l?"forward":"backward"),o<0&&l<0&&o!==l&&(S=o<l?"backward":"forward");const k=c("ActionFallbackUser");return(0,ne.FD)("div",{className:RC.header,children:[(0,ne.Y)(tl.A,{leftText:r?void 0:c("RatingLevel",{level:o}),rightText:r?c("RatingNegativeLevel"):c("RatingLevel",{level:a}),floatingBadgeIcon:r?"warning":"crown-wear",floatingBadgeText:r?o.toString():`${c.number(t)} / ${c.number(s||t)}`,progress:v,isPrimary:o>=0,isNegative:o<0,animationDirection:S,className:(0,ve.A)(RC.ratingProgress,y&&RC.withPreview)}),(()=>{if(y)return(0,ne.Y)(ae.Ay,{name:"fade",className:(0,ve.A)(RC.descriptionPreview,r&&RC.negative),activeKey:g?1:0,shouldCleanup:!0,shouldRestoreHeight:!0,children:g?(0,ne.Y)("p",{children:c("DescriptionFutureRating",{time:(0,et.A$)(c,A),points:Math.abs(b),link:(0,ne.Y)("span",{className:RC.backLink,onClick:C,children:c("LinkDescriptionRatingBack",void 0,{withNodes:!0,specialReplacement:Fi.hG})})},{pluralValue:Math.abs(b),withNodes:!0})}):(0,ne.Y)("p",{children:c("DescriptionPendingRating",{time:(0,et.A$)(c,A),points:Math.abs(b),link:(0,ne.Y)("span",{className:RC.previewLink,onClick:f,children:c("LinkDescriptionRatingPreview",void 0,{withNodes:!0,specialReplacement:Fi.hG})})},{pluralValue:Math.abs(b),withNodes:!0})})})})(),(0,ne.Y)("div",{className:RC.title,children:c("TitleRating")}),(0,ne.Y)("p",{className:RC.description,children:h?.id===i?c("RatingYourReflectsActivity"):c("RatingReflectsActivity",{name:(0,Dt.F9)(c,h)||k},{withMarkdown:!0,withNodes:!0})})]})},[h,i,u,m,p,g,c,f,C]),S=[["closed-gift",c("RatingGiftsFromTelegram"),(0,ne.FD)("span",{children:[b("added"),c("RatingGiftsFromTelegramDesc")]})],["user-stars",c("RatingGiftsAndPostsFromUsers"),(0,ne.FD)("span",{children:[b("added"),c("RatingGiftsAndPostsFromUsersDesc")]})],["stars-refund",c("RatingRefundsAndConversions"),(0,ne.FD)("span",{children:[b("deducted"),c("RatingRefundsAndConversionsDesc")]})]],k=(0,n.Kr)(()=>(0,ne.Y)("div",{className:RC.footer,children:(0,ne.Y)(X.A,{onClick:A,iconName:"understood",iconClassName:RC.understoodIcon,children:c("ButtonUnderstood")})}),[c,A]);return(0,ne.Y)(Sl.A,{contentClassName:RC.content,isOpen:d,header:y,listItemData:S,footer:k,onClose:A})})),VC="XSwOIbEp",_C=(0,n.ph)((0,s.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e)}))(({modal:e,isCurrentUserPremium:t})=>{const{closeDisableSharingAboutModal:i,toggleNoForwards:o,openPremiumModal:a}=(0,s.ko)(),r=(0,Bi.A)(),l=Boolean(e),c=(0,Ii.A)(e),d=c?.userId,h=(0,T.A)(()=>{i()}),u=(0,T.A)(()=>{d&&o({userId:d,isEnabled:!0}),i()}),m=(0,T.A)(()=>{i(),a({initialSection:"pm_noforwards"})}),p=(0,n.Kr)(()=>(0,ne.FD)("div",{className:"FyLfOtHh",children:[(0,ne.Y)(Oo.A,{size:100,tgsUrl:Uo.w.HandStop,previewUrl:Uo.d.HandStop,noLoop:!0}),(0,ne.Y)("h3",{className:"Hvg4WB1e",children:r("DisableSharing")})]}),[r]),g=(0,n.Kr)(()=>[["no-share",r("NoForwardingTitle"),r("NoForwardingDescription")],["no-download",r("NoSavingTitle"),r("NoSavingDescription")]],[r]),v=(0,n.Kr)(()=>t?(0,ne.Y)("div",{className:VC,children:(0,ne.Y)(X.A,{onClick:u,noForcedUpperCase:!0,children:r("DisableSharing")})}):(0,ne.Y)("div",{className:VC,children:(0,ne.Y)(X.A,{onClick:m,iconName:"unlock-badge",iconClassName:"ilfQdSuX",noForcedUpperCase:!0,children:r("UnlockButtonTitle")})}),[t,r,u,m]);return(0,ne.Y)(Sl.A,{isOpen:l,header:p,listItemData:g,footer:v,onClose:h})}));var UC=i(38353);const OC=({children:e,className:t,style:i})=>(0,ne.Y)("span",{className:(0,ve.A)("KI89OAqO",t),style:i,children:e}),KC=(0,n.ph)(({children:e,className:t,style:i,bubbleClassName:n,bubbleStyle:s,headerClassName:o,bodyClassName:a,footerClassName:r,avatar:l,sender:c,badge:d,footer:h,time:u,senderColor:m,backgroundColor:p})=>{const g=void 0!==l,v=void 0!==c,A=void 0!==d,f=void 0!==e,C=void 0!==h,b=v||A,y=C||void 0!==u,S=(0,ot.A)(m&&`--preview-message-sender-color: ${m}`,p&&`--preview-message-background: ${p}`,s),k=(0,ne.FD)(ne.FK,{children:[b?(0,ne.FD)("div",{className:(0,ve.A)("zJaPC7y5",o),children:[v?(0,ne.Y)("span",{className:"v2NetMb9",children:c}):void 0,(0,ne.Y)("span",{className:"gzRZqAxQ"}),A?(0,ne.Y)("span",{className:"UDfkjpOF",children:d}):void 0]}):void 0,f?(0,ne.Y)("div",{className:(0,ve.A)("mefiK4L6",a),children:e}):void 0,y?(0,ne.Y)("div",{className:(0,ve.A)("A1Z7v6Cx",r),children:C?h:(0,ne.Y)(OC,{children:u})}):void 0]});return g?(0,ne.FD)("div",{className:(0,ve.A)("UiuHfSVq",t),style:i,children:[(0,ne.Y)("div",{className:"TPmuwqIE",children:l}),(0,ne.Y)("div",{className:(0,ve.A)("oW4cs2hK",n),style:S,children:k})]}):(0,ne.Y)("div",{className:(0,ve.A)("HciDIlt7",t,n),style:(0,ot.A)(m&&`--preview-message-sender-color: ${m}`,p&&`--preview-message-background: ${p}`,s,i),children:k})});KC.Time=(0,n.ph)(OC);const JC=(0,n.ph)((0,s.EK)(e=>{const t=(0,c.SJA)(e),{isBlurred:i,background:n,backgroundColor:s,patternColor:o}=(0,c.Gyz)(e,t)||{};return{theme:t,themeBackgroundColor:s,themePatternColor:o,themeCustomBackground:n,themeIsBackgroundBlurred:i}})(({children:e,className:t,style:i,contentClassName:n,backgroundClassName:s,backgroundStyle:o,backgroundColor:a,patternColor:r,customBackground:l,isBackgroundBlurred:c,theme:d,themeBackgroundColor:h,themePatternColor:u,themeCustomBackground:m,themeIsBackgroundBlurred:p})=>{const g=a??h,v=r??u,A=l??m,f=c??p,C=(0,Hl.A)(d,A),b=(0,ve.A)("sy_9LIYH",UC.A.background,A&&UC.A.customBgImage,g&&UC.A.customBgColor,A&&f&&UC.A.blurred,s);return(0,ne.FD)("div",{className:(0,ve.A)("q59teiLv",t),style:(0,ot.A)(v&&`--pattern-color: ${v}`,g&&`--theme-background-color: ${g}`,i),children:[(0,ne.Y)("div",{className:b,style:(0,ot.A)(C&&`--custom-background: ${C}`,o)}),(0,ne.Y)("div",{className:(0,ve.A)("B03WTep4",n),children:e})]})}));JC.Message=KC;const jC=JC;var GC=i(85223);const HC={content:"UthamjcO",previewMessage:"jXRNsLif",previewBlock:"NK3RPafN",previewRankBadge:"WYistCid",previewLine:"cKaseNE2",input:"HCTMnW7y",description:"tQv6OTNu"},zC=(0,n.ph)((0,s.EK)((e,{modal:t})=>({user:t?.userId?(0,c.mBe)(e,t.userId):void 0,chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,canEditRank:t&&(0,c.b0v)(e,{chatId:t.chatId,userId:t.userId,isAdmin:t.isAdmin,isOwner:t.isOwner}),isOwn:t&&t.userId===e.currentUserId}))(({modal:e,user:t,chat:i,canEditRank:o,isOwn:a})=>{const{closeEditRankModal:r,editChatParticipantRank:c}=(0,s.ko)(),d=(0,Bi.A)(),h=Boolean(e),u=(0,Ii.A)(e),[m,p]=(0,n.J0)("");(0,n.vJ)(()=>{h&&p((u?.rank||"").slice(0,16))},[u?.chatId,u?.rank,u?.userId,h]);const g=(0,T.A)(()=>{r()}),v=(0,T.A)(e=>{p(e.target.value)}),{userId:A,chatId:f,isAdmin:C,isOwner:b}=u||{},y=(u?.rank||"").slice(0,16),S=Boolean(m||C||b),k=!o||m===y,N=(0,T.A)(()=>{k||f&&A&&(c({chatId:f,userId:A,rank:m}),g())}),w=(0,T.A)(e=>{"Enter"===e.key&&(e.preventDefault(),N())});if(f&&A)return(0,ne.FD)(te.A,{isOpen:h,title:d(a?"RankModalEditMy":"RankModalEdit"),contentClassName:HC.content,isSlim:!0,hasCloseButton:!0,onClose:g,children:[(0,ne.Y)(jC,{className:HC.previewBlock,contentClassName:HC.previewBlockContent,children:(0,ne.Y)(jC.Message,{className:HC.previewMessage,avatar:t?(0,ne.Y)(Tt.A,{peer:t,size:"small"}):void 0,sender:t&&(0,Dt.F9)(d,t),badge:S?(0,ne.Y)(GC.A,{chatId:f,userId:A,className:HC.previewRankBadge,isAdmin:C,isOwner:b,rank:m||void 0}):void 0,time:"9:37",children:(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("span",{className:HC.previewLine,children:(0,ne.Y)(Oi.A,{variant:"rounded-rect",height:10,inline:!0})}),(0,ne.Y)("span",{className:HC.previewLine,children:(0,ne.Y)(Oi.A,{variant:"rounded-rect",width:128,height:10,inline:!0})})]})})}),(0,ne.Y)(ee.A,{id:"edit-rank",label:d("EditAdminRank"),className:HC.input,value:m,maxLength:16,disabled:!i||!t||!o,teactExperimentControlled:!0,onChange:v,onKeyDown:w}),(0,ne.Y)("p",{className:HC.description,children:a?d("RankEditTextOwn"):d("RankEditText",{user:t&&(0,l.u0)(t)})}),(0,ne.Y)(X.A,{disabled:k,onClick:N,children:d("RankEditSave")})]})})),$C={root:"erQTz5ob",content:"l37Sd63y",body:"L6WY6MuJ",previewGrid:"qrm1gxH_",previewBlockContent:"yOQv_e83",previewMessage:"WPZnugFj",previewLine:"Loopjhr6",previewMetaLine:"uGDe3Pb9",memberTag:"YSR6b5e4",previewRankBadge:"B7u4ktQU",footer:"RQamY3BU",understoodIcon:"gzMuqcO5",topIcon:"TsyEXLgZ"},qC="placeholder";function WC(){return(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("span",{className:$C.previewLine,children:(0,ne.Y)(Oi.A,{variant:"rounded-rect",width:168,height:10,inline:!0})}),(0,ne.FD)("span",{className:$C.previewMetaLine,children:[(0,ne.Y)(Oi.A,{variant:"rounded-rect",width:104,height:10,inline:!0}),(0,ne.Y)(jC.Message.Time,{children:"9:37"})]})]})}const QC=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.chatId?(0,c.AWZ)(e,t.chatId):void 0,n=i?.adminMembersById?.[e.currentUserId]||i?.members?.find(t=>t.userId===e.currentUserId);return{user:t?.userId?(0,c.mBe)(e,t.userId):void 0,chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,canEditRank:t&&(0,c.b0v)(e,{chatId:t.chatId,userId:t.userId,isAdmin:t.isAdmin,isOwner:t.isOwner}),canEditOwnRank:t&&(0,c.D9y)(e,t.chatId),currentUserMember:n}})(({modal:e,user:t,chat:i,canEditRank:o,canEditOwnRank:a,currentUserMember:r})=>{const{closeRankModal:l,openEditRankModal:c}=(0,s.ko)(),d=(0,Bi.A)(),h=Boolean(e),u=(0,Ii.A)(e),m=u?.userId===r?.userId,p=(0,T.A)(()=>{l()}),g=(0,T.A)(()=>{u&&(o?c(u):a&&r&&c({chatId:u.chatId,userId:r.userId,isAdmin:r.isAdmin,isOwner:r.isOwner,rank:r.rank}),l())}),v=(0,n.Kr)(()=>d(o?m?"RankModalEditMy":"RankModalEdit":a?"RankModalEditMy":"ButtonUnderstood"),[o,a,m,d]);if(!u)return;const{userId:A,chatId:f,isAdmin:C,isOwner:b,rank:y}=u;return(0,ne.Y)(te.A,{isOpen:h,className:$C.root,contentClassName:$C.content,hasAbsoluteCloseButton:!0,onClose:p,children:(0,ne.FD)("div",{className:$C.body,children:[(0,ne.Y)("div",{className:$C.topIcon,children:(0,ne.Y)(he.A,{name:"user-tag"})}),(0,ne.FD)("div",{children:[(0,ne.Y)("h3",{className:$C.previewTitle,children:d(b?"RankModalOwnerTagTitle":C?"RankModalAdminTagTitle":"RankModalMemberTagTitle")}),(0,ne.Y)("div",{className:$C.previewText,children:d(b?"RankModalOwnerText":C?"RankModalAdminText":"RankModalMemberText",{tag:(0,ne.Y)(GC.A,{chatId:f,userId:A,isAdmin:C,isOwner:b,rank:y}),author:t&&(0,Dt.F9)(d,t),group:i&&(0,Dt.F9)(d,i)},{withNodes:!0,withMarkdown:!0})})]}),(0,ne.FD)("div",{className:$C.previewGrid,children:[(0,ne.Y)(jC,{contentClassName:$C.previewBlockContent,children:(0,ne.Y)(jC.Message,{className:$C.previewMessage,badge:(0,ne.Y)(GC.A,{chatId:qC,userId:qC,className:$C.previewRankBadge,rank:d("RankMemberTag")}),children:WC()})}),(0,ne.Y)(jC,{contentClassName:$C.previewBlockContent,children:(0,ne.Y)(jC.Message,{className:$C.previewMessage,badge:(0,ne.Y)(GC.A,{className:$C.previewRankBadge,chatId:qC,userId:qC,isAdmin:!0,rank:d("RankAdminTag")}),children:WC()})})]}),(0,ne.Y)("div",{className:$C.footer,children:(0,ne.Y)(X.A,{iconName:o?void 0:"understood",iconClassName:$C.understoodIcon,onClick:g,children:v})})]})})}));var ZC=i(46442),XC=i(76786);const eb=(0,n.ph)((0,s.EK)((e,{chatId:t,threadId:i})=>{const n=(0,c.hds)(e,t),s=(0,En._X)(e,t,i||j.l3,"typingStatusByPeerId"),o=(0,l.cG)(t,i||j.l3,e.currentUserId),a=o&&i?(0,En.Qb)(e,t,i):void 0,r=(0,En.a1)(e,t,i||j.l3),d=r?.unreadCount;return{chat:n,connectionState:e.connectionState,isSyncing:e.isSyncing,isFetchingDifference:e.isFetchingDifference,typingStatusByPeerId:s,isSavedDialog:o,messagesCount:a,unreadCount:d,hasUnreadMark:r?.hasUnreadMark}})(({chatId:e,threadId:t,chat:i,connectionState:n,isSyncing:o,isFetchingDifference:a,typingStatusByPeerId:r,isSavedDialog:l,messagesCount:c,unreadCount:d,hasUnreadMark:h,onClose:u})=>{const m=(0,Bi.A)(),{markChatMessagesRead:p,markTopicRead:v}=(0,s.ko)(),{connectionStatusText:A}=(0,XC.A)(m,n,o||a,!0),f=(0,T.A)(()=>{i?.isForum&&void 0!==t&&t!==j.l3?v({chatId:e,topicId:Number(t)}):p({id:e})}),C=l?void 0!==c?m("Messages",{count:c},{pluralValue:c}):m("SavedMessages"):void 0,b=l&&t?String(t):e,y=i?.isMonoforum?i.linkedMonoforumId:b;return(0,ne.FD)("div",{className:"LyrhszzE",children:[Boolean(d||h)&&(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("ChatListContextMarkAsRead"),onClick:f,className:"Bp8eDIso",iconName:"readchats"}),(0,ne.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:m("Close"),onClick:u,className:"jHVcj192",iconName:"close"}),(0,ne.Y)("div",{className:"modal-title",children:(0,ne.Y)("div",{className:"FsTceiGs",children:(0,g.L8)(y)?(0,ne.Y)(An.A,{userId:y,typingStatusByPeerId:r,status:A||C,withDots:Boolean(A),withFullInfo:!1,withMediaViewer:!1,withStory:!1,withUpdatingStatus:!0,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},y):(0,ne.Y)(vn.A,{chatId:y,threadId:l?void 0:t,typingStatusByPeerId:r,withMonoforumStatus:i?.isMonoforum,status:A||C,withDots:Boolean(A),withMediaViewer:!1,withFullInfo:!1,withUpdatingStatus:!0,withStory:!1,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},y)})})]})})),tb=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:n,background:s,backgroundColor:o,patternColor:a}=(0,c.Gyz)(e,i)||{};return{theme:i,customBackground:s,backgroundColor:o,patternColor:a,isBackgroundBlurred:n}})(({modal:e,theme:t,customBackground:i,backgroundColor:o,patternColor:a,isBackgroundBlurred:r})=>{const{closeQuickPreview:l,openChat:c,openThread:d}=(0,s.ko)(),h=e?.chatId,u=e?.threadId,p=Boolean(h),g=(0,Hl.A)(t,i),v=(0,T.A)(()=>{l()}),A=(0,T.A)(()=>{h&&(u?d({chatId:h,threadId:u,shouldReplaceHistory:!0}):c({id:h,shouldReplaceHistory:!0}),l())});(0,n.vJ)(()=>p?(0,m.A)(v):void 0,[p,v]),(0,ke.A)({isActive:p,onBack:v});const{chatId:f,threadId:C}=(0,Ii.A)(e,!0)||{},b=(0,ve.A)(UC.A.background,i&&UC.A.customBgImage,o&&UC.A.customBgColor,i&&r&&UC.A.blurred);if(f)return(0,ne.Y)(te.A,{isOpen:p,onClose:v,header:(0,ne.Y)(eb,{chatId:f,threadId:C,onClose:v}),className:"hJTLQd8O",contentClassName:"zUonvDbp",children:(0,ne.FD)("div",{className:"NYlix6SL",style:(0,ot.A)(`--pattern-color: ${a}`,o&&`--theme-background-color: ${o}`),onClick:A,children:[(0,ne.Y)("div",{className:b,style:g?`--custom-background: ${g}`:void 0}),(0,ne.Y)("div",{className:"IJ0EBwJk",children:(0,ne.Y)(ZC.A,{chatId:f,threadId:C||j.l3,type:"thread",canPost:!1,isReady:!0,withDefaultBg:Boolean(!i&&!o),isQuickPreview:!0})})]})})})),ib=(0,n.ph)((0,s.EK)(e=>({isStoryViewerOpen:(0,c.gd2)(e),stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,c.g29)(e)}))(({modal:e,isStoryViewerOpen:t,stealthMode:i,isCurrentUserPremium:o})=>{const{closeStealthModal:a,activateStealthMode:r,showNotification:l,openPremiumModal:c,openStoryViewer:d}=(0,s.ko)(),h=(0,Bi.A)(),u=(0,M.A)(),m=Boolean(i?.cooldownUntil&&i.cooldownUntil>(0,Di.Fm)()),p=Boolean(e),g=(0,Ii.A)(e),{targetPeerId:v}=g||{},A=(0,T.A)(()=>{u()}),f=(0,T.A)(()=>{a()}),C=(0,T.A)(()=>{if(!o)return c({initialSection:"stories"}),void f();r(),l({title:{key:"StealthModeOnTitle"},message:{key:"StealthModeOnHintEnabled"}}),v&&d({peerId:v}),f()}),b=(0,n.Kr)(()=>(0,ne.FD)(ne.FK,{children:[(0,ne.Y)("h3",{className:"WJuiuEDm",children:h("StealthModeTitle")}),(0,ne.Y)("div",{className:"G9N9Bt0G",children:h(o?"StealthModeDescription":"StealthModeDescriptionPremium")})]}),[h,o]),y=(0,n.Kr)(()=>[["stealth-past",h("StealthModeHideRecentTitle"),h("StealthModeHideRecentDescription")],["stealth-future",h("StealthModeHideFutureTitle"),h("StealthModeHideFutureDescription")]],[h]),S=(0,n.Kr)(()=>o?m?h("StealthModeButtonRecharge",{timer:(0,ne.Y)(Dd.A,{endsAt:i.cooldownUntil,onEnd:A})},{withNodes:!0}):h(v?"StealthModeButtonToStory":"StealthModeButton"):h("StealthModeButtonPremium"),[o,m,h,i,v]);return(0,ne.Y)(Sl.A,{isOpen:p,className:(0,ve.A)(t&&"component-theme-dark"),header:b,headerIconName:"eye-crossed-outline",listItemData:y,buttonText:S,onButtonClick:C,onClose:f})}));var nb=i(69881);const sb=(0,n.ph)((0,s.EK)((e,{modal:t})=>{const i=t?.chatId?(0,c.hds)(e,t.chatId):void 0,n=e.currentUserId?(0,c.PVB)(e,e.currentUserId):void 0,s=t?.nextOwnerId?(0,c.PVB)(e,t.nextOwnerId):void 0,o=t?.chatId?(0,c.AWZ)(e,t.chatId):void 0;return{chat:i,currentUser:n,currentUserId:e.currentUserId,nextOwner:s,chatFullInfo:o}})(({modal:e,chat:t,currentUser:i,currentUserId:o,nextOwner:a,chatFullInfo:r})=>{const{closeLeaveGroupModal:d,leaveChannel:h,leaveBasicGroup:u,loadMoreMembers:m,loadFullChat:p,transferChatOwnership:g,verifyTransferOwnership:v,openTwoFaCheckModal:A}=(0,s.ko)(),f=(0,Bi.A)(),[C,b,y]=(0,D.A)(),[S,k,N]=(0,D.A)(),[w,I]=(0,n.J0)(e?.nextOwnerId),[P,Y]=(0,n.J0)(""),F=Boolean(e),M=(0,Ii.A)(t),B=M&&(0,l.yn)(M),L=(0,Ii.A)(i);(0,n.vJ)(()=>{t&&!r&&p({chatId:t.id})},[t,r]);const x=w&&w!==e?.nextOwnerId?void 0:a,R=(0,Ii.A)(x),E=(0,n.hb)(e=>w?(0,c.PVB)(e,w):void 0,[w]),V=(0,_n.Ay)(E)||R,{adminIds:_,memberIds:U,allIds:O}=(0,n.Kr)(()=>{if(!o)return{adminIds:[],memberIds:[],allIds:[]};const e=r?.adminMembersById,t=r?.members,i=e?Object.values(e).filter(e=>e.userId!==o&&!e.isOwner).map(e=>e.userId):[],n=(t||[]).filter(e=>e.userId!==o&&!e.isOwner&&!e.isAdmin).map(e=>e.userId);return{adminIds:i,memberIds:n,allIds:[...i,...n]}},[o,r]),K=_.length>0,J=Boolean(w&&w!==e?.nextOwnerId),j=(0,n.Kr)(()=>t?(0,Jm.qS)(t):void 0,[t]),{result:G,isLoading:H}=(0,Jm.Ay)({query:P,queryFn:j,defaultValue:O,isDisabled:!t}),{sections:z,filteredIds:$}=(0,n.Kr)(()=>P?{sections:void 0,filteredIds:(G||[]).filter(e=>e!==o&&O.includes(e))}:K?U.length>0?{sections:[{key:"admins",title:f("LeaveGroupAdmins"),ids:_},{key:"members",title:f("LeaveGroupMembers"),ids:U}],filteredIds:O}:{sections:void 0,filteredIds:_}:{sections:void 0,filteredIds:O},[P,G,o,O,K,_,U,f]),q=f("LeaveGroupAppointOwner"),W=(0,T.A)(()=>{const t=e?.chatId;t&&(J&&w?v({chatId:t,userId:w,onSuccess:k,onPasswordMissing:A,onPasswordTooFresh:A,onSessionTooFresh:A}):k())}),Q=(0,T.A)(t=>{const i=e?.chatId;if(!i)return;const n=B?u:h;J&&w?g({chatId:i,userId:w,password:t,onSuccess:()=>n({chatId:i,shouldSkipOwnershipCheck:!0})}):n({chatId:i,shouldSkipOwnershipCheck:!0}),d()}),Z=(0,T.A)(()=>{b()}),ee=(0,T.A)(e=>{I(e),y()}),ie=(0,T.A)(()=>{y()}),se=(0,T.A)(()=>{e?.chatId&&m({chatId:e.chatId})});if(!M||!L)return;const oe=(0,Dt.F9)(f,M),ae=V?(0,Dt.F9)(f,V):void 0;return(0,ne.FD)(ne.FK,{children:[(0,ne.FD)(te.A,{isOpen:F&&!C&&!S,dialogClassName:"LnA5oc8_",onClose:d,children:[V&&(0,ne.Y)(nb.A,{fromPeer:L,toPeer:V}),(0,ne.Y)("h3",{children:f("LeaveGroupTitle",{group:oe})}),(0,ne.Y)("p",{children:f(B?"LeaveBasicGroupDescription":"LeaveGroupDescription",{nextOwner:ae,group:oe},{withNodes:!0,withMarkdown:!0})}),(0,ne.FD)("div",{className:"dialog-buttons-column",children:[(0,ne.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:W,children:f("GroupLeaveGroup")}),O.length>0&&(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:Z,children:f("LeaveGroupAppointOwner")}),(0,ne.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:()=>d(),children:f("Cancel")})]})]}),(0,ne.Y)(Ja.A,{isOpen:C,title:q,hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,onClose:ie,children:z?(0,ne.Y)(vi.A,{sections:z,filterValue:P,filterPlaceholder:f("Search"),isSearchable:!0,isLoading:H,withStatus:!0,withDefaultPadding:!0,onFilterChange:Y,onSelectedIdChange:ee,onLoadMore:se}):(0,ne.Y)(vi.A,{itemIds:$,filterValue:P,filterPlaceholder:f("Search"),isSearchable:!0,isLoading:H,withStatus:!0,withDefaultPadding:!0,onFilterChange:Y,onSelectedIdChange:ee,onLoadMore:se})}),(0,ne.Y)(Pf,{isOpen:S,title:f("EnterPassword"),confirmLabel:f("Transfer"),description:f("EnterPasswordDescription"),onClose:N,onSubmit:Q})]})})),ob=(0,n.ph)((0,s.EK)(e=>({hasPassword:e.settings.byKey.hasPassword}))(({modal:e,hasPassword:t})=>{const{closeTwoFaCheckModal:i,openSettingsScreen:n}=(0,s.ko)(),a=(0,Bi.A)(),r=Boolean(e),l=(0,T.A)(()=>{n({screen:o.VS.TwoFaDisabled}),i()});return(0,ne.FD)(ci.A,{isOpen:r,title:a("SecurityCheck"),className:"QDpfwPcz",confirmLabel:a(t?"OK":"SecurityCheckEnableTwoStep"),confirmHandler:t?i:l,isOnlyConfirm:t,areButtonsInColumn:!t,onClose:i,children:[(0,ne.Y)("p",{children:a("SecurityCheckInfo")}),(0,ne.FD)("ul",{className:"SMPg7E95",children:[(0,ne.Y)("li",{children:a("SecurityCheckTwoStepEnabled",void 0,{withNodes:!0,withMarkdown:!0})}),(0,ne.Y)("li",{children:a("SecurityCheckTwoStepNotChanged",void 0,{withNodes:!0,withMarkdown:!0})}),(0,ne.Y)("li",{children:a("SecurityCheckLoggedIn",void 0,{withNodes:!0,withMarkdown:!0})})]})]})})),ab=(0,n.ph)(({modal:e})=>{const{closeQuickChatPicker:t,openChat:i}=(0,s.ko)(),n=(0,Bi.A)(),o=Boolean(e),a=(0,T.A)(e=>{i({id:e,shouldReplaceHistory:!0}),t()});return(0,ne.Y)(Xn,{isOpen:o,title:n("SelectChat"),searchPlaceholder:n("Search"),onSelectRecipient:a,onClose:t})}),rb=(0,n.ph)(({modal:e})=>{const{closeCocoonModal:t,openTelegramLink:i}=(0,s.ko)(),o=Boolean(e),a=(0,Bi.A)(),r=(0,T.A)(()=>{t()}),l=(0,T.A)(e=>{i({url:e}),r()}),c=(0,n.Kr)(()=>{const e=a("CocoonFeature1Text",{username:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:()=>{l(a("CocoonFeature1UsernameLink"))},children:a("CocoonFeature1Username")})},{withNodes:!0,withMarkdown:!0}),t=a("CocoonFeature3Text",{link:(0,ne.Y)(us.A,{url:a("CocoonFeature3Link"),text:a("CocoonFeature3LinkText")})},{withNodes:!0,withMarkdown:!0});return[["lock",a("CocoonFeature1Title"),e],["stats",a("CocoonFeature2Title"),a("CocoonFeature2Text")],["gift",a("CocoonFeature3Title"),t]]},[a]),d=(0,n.Kr)(()=>(0,ne.Y)(Po.A,{className:"HMfVcNfv",modelClassName:"W2Ujdwo0",model:"ai-egg",color:"purple",title:a("CocoonTitle"),description:a("CocoonDescription",void 0,{withNodes:!0,withMarkdown:!0})}),[a]),h=(0,n.Kr)(()=>(0,ne.FD)("div",{className:"FUJ4PH8B",children:[(0,ne.Y)("span",{className:"uVgm33C1",children:a("CocoonFooterText",{link:(0,ne.Y)(Oa.A,{isPrimary:!0,onClick:()=>l(a("CocoonFooterLink")),children:a("CocoonFooterLinkText")})},{withNodes:!0,withMarkdown:!0})}),(0,ne.Y)(X.A,{iconName:"understood",onClick:r,children:a("ButtonUnderstood")})]}),[a]);return(0,ne.Y)(Sl.A,{isOpen:o,onClose:t,listItemData:c,withSeparator:!0,header:d,footer:h})})},3178(e,t,i){i.d(t,{A:()=>p});var n=i(84051),s=i(31481),o=i(40725),a=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,n.ph)(({isPasswordVisible:e,isBig:t})=>{const[i,p]=(0,l.A)(!1),[g,v]=(0,l.A)(!1),{isMobile:A}=(0,r.Ay)(),f=A?s.UyP:s.H6l;(0,a.A)(v,2e3);const C=(0,n.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?s.r2x:f,className:g?"hidden":"shown",tgsUrl:o.w.MonkeyClose,playSegment:h,noLoop:!0,onLoad:C}),(0,d.Y)(c.A,{size:t?s.r2x:f,className:g?"shown":"hidden",tgsUrl:o.w.MonkeyPeek,playSegment:e?u:m,noLoop:!0})]})})}}]);
|
||
//# sourceMappingURL=9451.7120386d5610b17c8b40.js.map
|