TelegramPWA/dist/9451.9d9b6351a608fdc2dee4.js
Alexander Zinchuk 6fd1d0c598 [Build]
2025-09-19 14:39:00 +02:00

2 lines
681 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[9451],{3178:(e,t,i)=>{i.d(t,{A:()=>p});var s=i(84051),n=i(31481),a=i(58443),o=i(14737),r=i(43874),l=i(37661),c=i(18104),d=i(20021);const h=[0,50],u=[0,20],m=[20,0],p=(0,s.ph)(e=>{let{isPasswordVisible:t,isBig:i}=e;const[p,v]=(0,l.A)(!1),[g,A]=(0,l.A)(!1),{isMobile:f}=(0,r.Ay)(),b=f?n.UyP:n.H6l;(0,o.A)(A,2e3);const C=(0,s.hb)(v,[v]);return(0,d.FD)("div",{id:"monkey",className:i?"big":"",children:[!p&&(0,d.Y)("div",{className:"monkey-preview"}),(0,d.Y)(c.A,{size:i?n.r2x:b,className:g?"hidden":"shown",tgsUrl:a.w.MonkeyClose,playSegment:h,noLoop:!0,onLoad:C}),(0,d.Y)(c.A,{size:i?n.r2x:b,className:g?"shown":"hidden",tgsUrl:a.w.MonkeyPeek,playSegment:t?u:m,noLoop:!0})]})})},52921:(e,t,i)=>{i.r(t),i.d(t,{AboutAdsModal:()=>bl,AboutMonetizationModal:()=>yl,AgeVerificationModal:()=>sl,ArchivedChats:()=>tm,AttachBotInstallModal:()=>ca,AttachBotRecipientPicker:()=>zs,AttachmentModal:()=>rp,BoostModal:()=>qr,BotCommandMenu:()=>_p,BotTrustModal:()=>la,CalendarModal:()=>dn,ChatCommandTooltip:()=>Vp,ChatFolderModal:()=>im,ChatInviteModal:()=>ml,ChatLanguageModal:()=>uc,ChatlistModal:()=>dl,CollectibleInfoModal:()=>gc,ContactList:()=>Ju,ContextMenuContainer:()=>am.A,CountryPickerModal:()=>Io,CreateTopic:()=>vg,CustomEmojiSetsModal:()=>cm,CustomEmojiTooltip:()=>Kp,CustomSendMenu:()=>Gp,DeleteAccountModal:()=>tl,DeleteFolderDialog:()=>da,DeleteMessageModal:()=>Zl,Dialogs:()=>qs,DraftRecipientPicker:()=>js,DropArea:()=>jp.A,EditTopic:()=>Ag,EmojiInteractionAnimation:()=>hc,EmojiStatusAccessModal:()=>Il,EmojiTooltip:()=>Qp,ForwardRecipientPicker:()=>Gs,FrozenAccountModal:()=>UA,GifSearch:()=>cv,GiftCodeModal:()=>Xr,GiveawayModal:()=>Xo,HeaderMenuContainer:()=>mm,HistoryCalendar:()=>hn,InlineBotTooltip:()=>nv,InviteViaLinkModal:()=>xA,LeftSearch:()=>vd,LocationAccessModal:()=>Pl,Management:()=>Xg,MapModal:()=>tn,MediaViewer:()=>Rt,MentionTooltip:()=>tp,MessageSelectToolbar:()=>ic,MessageStatistics:()=>$v,MiddleSearch:()=>km,MinimizedWebAppModal:()=>In,MuteChatModal:()=>nm,NewChat:()=>Hu,NewContactModal:()=>mn,Notifications:()=>Qs,OneTimeMediaModal:()=>VA,PaymentModal:()=>DA,PinMessageModal:()=>Xl,PollModal:()=>cp,PollResults:()=>sg,PremiumLimitReachedModal:()=>ar,PremiumMainModal:()=>Co,PreparedMessageModal:()=>Ll,PrivacySettingsNoticeModal:()=>cc,ProfileRatingModal:()=>KA,ReactionPicker:()=>Mm,ReactorListModal:()=>dc,ReceiptModal:()=>BA,ReportAdModal:()=>Fl,ReportModal:()=>Tl,SafeLinkModal:()=>Xs,SeenByModal:()=>sc,SendAsMenu:()=>av,Settings:()=>Ku,SharePreparedMessageModal:()=>Vl,SponsoredContextMenuContainer:()=>vl.A,Statistics:()=>_v,StatusPickerMenu:()=>Or,StickerSearch:()=>lv,StickerSetModal:()=>rm,StickerTooltip:()=>Up,StoryStatistics:()=>eg,StoryViewer:()=>Ds,SuggestMessageModal:()=>Ol,SuggestedPostApprovalModal:()=>Jl,SuggestedStatusModal:()=>Gr,SymbolMenu:()=>Lp,TextFormatter:()=>qp,ToDoListModal:()=>hp,UnpinAllMessagesModal:()=>ec,UrlAuthModal:()=>nn,VerificationMonetizationModal:()=>wl,WebAppModal:()=>ra,WebAppsCloseConfirmationModal:()=>_A});var s=i(84051),n=i(13439),a=i(89925),o=i(31481),r=i(66644),l=i(90709),c=i(91048),d=i(53827),h=i(63495),u=i(96454),m=i(11778),p=i(14680),v=i(9716),g=i(76023),A=i(49086);function f(e){let{message:t,avatarOwner:i,profilePhotos:s,standaloneMedia:n,mediaIndex:a,sponsoredMessage:o}=e;return i&&s?{type:"avatar",avatarOwner:i,profilePhotos:s,mediaIndex:a}:n?{type:"standalone",media:n,mediaIndex:a}:t?{type:"message",message:t,mediaIndex:a}:o?{type:"sponsoredMessage",message:o,mediaIndex:a}:void 0}function b(e,t){if(!t)return;if("standalone"===t.type)return{media:t.media[t.mediaIndex],isSingle:1===t.media.length};if("avatar"===t.type){const e=t.profilePhotos?.photos[t.mediaIndex];return e?{media:e}:void 0}const{action:i,document:s,photo:n,video:a,paidMedia:o}=(0,l.r_)(t.message);if("chatEditPhoto"===i?.type||"suggestProfilePhoto"===i?.type)return{media:i.photo,isSingle:!0};if(s&&((0,l.Ml)(s)||(0,l.hr)(s)))return{media:s};const r=(0,c.Pn$)(e,t.message);if("full"===r?.webpageType){const{photo:e,video:t,document:i}=r,s=i&&((0,l.Ml)(i)||(0,l.hr)(i)),n=t||(s?i:void 0)||e;if(n)return{media:n,isSingle:!0}}if(o){const e=o.extendedMedia[t.mediaIndex||0];if(!("mediaType"in e)){const{photo:t,video:i}=e;return{media:t||i}}}const d=a||n;return d?{media:d,isSingle:a?.isGif}:void 0}var C=i(19822),y=i(83868),S=i(16460),k=i(41512),w=i(43503);function N(e,t){const i=document.createElement("div");i.classList.add("ghost");const s=new Image;if(s.draggable=!1,s.oncontextmenu=y.A,"string"==typeof e?s.src=e:e instanceof HTMLVideoElement?s.src=e.poster:s.src=e.src,i.appendChild(s),t===a.TQ.ProfileAvatar||t===a.TQ.SettingsAvatar){i.classList.add("ProfileInfo"),t===a.TQ.SettingsAvatar&&i.classList.add("self");const e=document.querySelector(t===a.TQ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&i.appendChild(e.cloneNode(!0))}return i}function I(e,t,i){let s,n;switch(e){case a.TQ.Album:case a.TQ.ScheduledAlbum:s=`.Transition_slide-active > .MessageList #album-media-${(0,l.GZ)(t.id,i)}`,n=".full-media";break;case a.TQ.PreviewMedia:s=`#preview-media${i}`,n="img";break;case a.TQ.SharedMedia:s=`#shared-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.SearchResult:s=`#search-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.MiddleHeaderAvatar:s=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",n=".avatar-media";break;case a.TQ.SettingsAvatar:s="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ProfileAvatar:s="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ChannelAvatar:case a.TQ.SuggestedAvatar:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=".Avatar img";break;case a.TQ.StarsTransaction:s=".transaction-media-preview",n=0===i?`.stars-transaction-media-${i} :is(img, video)`:void 0;break;case a.TQ.SponsoredMessage:s=".Transition_slide-active > .MessageList .sponsored-media-preview",n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`;break;case a.TQ.ScheduledInline:case a.TQ.Inline:default:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`}const r=document.querySelector(s),c=n?r?.querySelectorAll(n):void 0;return{container:r,mediaEl:c?.[0]}}function P(e,t){switch(t){case a.TQ.Album:case a.TQ.ScheduledAlbum:case a.TQ.Inline:case a.TQ.ScheduledInline:case a.TQ.StarsTransaction:case a.TQ.PreviewMedia:e.classList.add("rounded-corners");break;case a.TQ.SharedMedia:case a.TQ.SettingsAvatar:case a.TQ.ProfileAvatar:case a.TQ.SearchResult:e.firstChild.style.objectFit="cover";break;case a.TQ.MiddleHeaderAvatar:case a.TQ.SuggestedAvatar:case a.TQ.ChannelAvatar:e.classList.add("circle")}}var Y=i(43874),F=i(37661),D=i(30857),M=i(17712),T=i(59030),B=i(41733),R=i(22237);const L=(0,R.n5)(!1),x=L[1];function E(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function V(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){o.Oig&&console.log("[MV] PictureInPicture Error",e)}}var _=i(73767),U=i(34780),O=i(23174),K=i(32587),J=i(87679);const G=new Map;var j=i(35297);var z=i(62587),H=i(69419);const $=g.cf,q=e=>{let{media:t,isAvatar:i,origin:n,delay:o}=e;const r=i&&"photo"===t?.mediaType&&!t.isVideo,c=i&&"photo"===t?.mediaType&&t.isVideo,d="document"===t?.mediaType,h="video"===t?.mediaType&&!t.isRound||d&&(0,l.hr)(t),u="photo"===t?.mediaType||d&&(0,l.Ml)(t),m="video"===t?.mediaType&&t.isGif,p=n===a.TQ.SharedMedia,v=n===a.TQ.SearchResult,A=(0,s.Kr)(()=>e=>{if(t)return!r&&!c||e?c&&e?(0,l.Pg)(t):(0,l.VO)(t,e?"full":"preview"):(0,l.mU)(t)},[c,r,t]),f=(0,z.A)(t&&(p||v||d)&&(0,l.VO)(t,"pictogram"),void 0,O.qZ.BlobUrl,o),b=A(),C=(0,z.A)(b,void 0,O.qZ.BlobUrl,o),{mediaData:y,loadProgress:S}=(0,H.A)(A(!0),void 0,t&&(0,l.Cz)(t,"full"),o),k=t&&"blobUrl"in t?t.blobUrl:void 0;let w=!h&&(k||y)||C||f;const N=function(e){const t=(0,s.li)();let i=!1;(0,j.A)(()=>{if(i=!0,t.current=void 0,!e)return;const s=new Image;if(s.src=e,!s.width)return;const n=(0,J.PR)(s);(0,K.A)(n.getContext("2d"),0,0,n.width,n.height,2,2),t.current=n.toDataURL()},[e]);const n=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=(0,s.li)(e?G.get(e):void 0),a=(0,s.li)(),o=(0,D.A)();return a.current&&t&&(clearTimeout(a.current),a.current=void 0),(0,s.vJ)(()=>{if(!e||n.current||t)return;const s=new Image;s.onload=()=>{const t=(0,J.PR)(s);(0,K.A)(t.getContext("2d"),0,0,t.width,t.height,2,2);const i=t.toDataURL();n.current=i,o(),G.size>=1e3&&G.clear(),G.set(e,i)},i?a.current=window.setTimeout(()=>{s.src=e},i):s.src=e},[e,i,o,t]),n.current}(e||void 0,Boolean(t.current));return t.current||!i&&n||e||void 0}(!w&&t&&(0,l.VD)(t));w||n===a.TQ.SearchResult||(w=N),c&&C&&(w=C);const I=k||y||(c||h?void 0:C||f||w),P=t&&(0,l.si)(t),Y=Boolean(k),F=(0,s.Kr)(()=>i?c?g._e:g.cf:d?t.mediaSize||$:u?(0,l.Xn)(t):h?(0,l.NZ)(t):$,[i,d,u,h,c,t]);return{getMediaHash:A,media:t,isVideo:h,isPhoto:u,isGif:m,isDocument:d,bestImageData:w,bestData:I,dimensions:F,isFromSharedMedia:p,isVideoAvatar:c,isLocal:Y,loadProgress:S,mediaSize:P}};var W=i(18276),Q=i(64493),Z=i(40664),X=i(22337),ee=i(1087),te=i(20021);const ie=(0,s.ph)(e=>{let{isOpen:t,peerId:i,photo:a,onClose:o,onCloseAnimationEnd:r}=e;const{reportProfilePhoto:l}=(0,n.ko)(),[c,d]=(0,s.J0)("spam"),[h,u]=(0,s.J0)(""),m=(0,M.A)(()=>{l({chatId:i,photo:a,reason:c,description:h}),o()}),p=(0,M.A)(e=>{d(e)}),v=(0,M.A)(e=>{u(e.target.value)}),g=(0,T.A)(),A=(0,s.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(!i||!a)return;const f=g("ReportPeer.Report");return(0,te.FD)(X.A,{isOpen:t,onClose:o,onEnter:t?m:void 0,onCloseAnimationEnd:r,className:"narrow",title:f,children:[(0,te.Y)(ee.A,{className:"dialog-checkbox-group",name:"report-message",options:A,onChange:p,selected:c}),(0,te.Y)(Z.A,{label:g("lng_report_reason_description"),value:h,onChange:v}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m,children:g("lng_report_button")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:g("Cancel")})]})]})});var se=i(26607),ne=i(41036);const[ae,oe]=(0,R.n5)(1);function re(){return(0,s._W)(()=>{oe(1)}),[ae,oe]}const le=(0,s.ph)(e=>{let{isOpen:t,photo:i,profileId:a,onClose:o,onConfirm:r}=e;const{deleteProfilePhoto:l,deleteChatPhoto:c}=(0,n.ko)(),d=(0,s.hb)(()=>{r?.(),(0,v.L8)(a)?l({photo:i}):c({photo:i,chatId:a}),o()},[r,a,o,l,i,c]),h=(0,T.A)();return(0,te.Y)(X.A,{isOpen:t,onClose:o,onEnter:d,className:"delete dialog-buttons-column",title:h("AreYouSure"),children:(0,te.FD)("div",{className:"dialog-buttons mt-2",children:[(0,te.Y)(Q.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d,children:h("Preview.DeletePhoto")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:h("Cancel")})]})})});var ce=i(22699),de=i(24433),he=i(35913);const ue=(0,s.ph)((0,n.EK)((e,t)=>{let{item:i,canUpdateMedia:s}=t;const n=(0,c.nTw)(e),{origin:a}=n.mediaViewer,o="message"===i?.type?i.message:void 0,r="avatar"===i?.type?i.avatarOwner:void 0,l="avatar"===i?.type&&i.profilePhotos.photos[i.mediaIndex],d=(0,c.meB)(e),h=(0,c.Xf0)(e),{threadId:u}=(0,c.Xf0)(e)||{},m=(0,c.ynf)(e,o),p=(0,c.yuw)(e),v=o&&(0,c.ryq)(e,o?.chatId),{canDelete:g}=u&&o&&(0,c.WAX)(e,o,u)||{},A=l&&l.id===r?.avatarPhotoId,f=s&&Boolean(l),C=g||f,y=s&&Boolean(l)&&!A,S=h?.type;return{activeDownloads:p,isProtected:m,chat:d,isChatProtected:v,canDelete:C,canUpdate:y,messageListType:S,origin:a,viewableMedia:b(e,i)}})(e=>{let{item:t,mediaData:i,isVideo:a,chat:o,isChatProtected:r,isProtected:c,canReportAvatar:d,canDelete:h,canUpdate:u,messageListType:m,activeDownloads:p,origin:g,viewableMedia:A,onReportAvatar:f,onCloseMediaViewer:b,onBeforeDelete:C,onForward:y}=e;const[S,k,w]=(0,F.A)(!1),[N,I]=re(),{isMobile:P}=(0,Y.Ay)(),{downloadMedia:D,cancelMediaDownload:B,updateProfilePhoto:R,updateChatPhoto:L,openMediaViewer:x,openDeleteMessageModal:E}=(0,n.ko)(),V="message"===t?.type,{media:_}=A||{},U=_&&(0,l.sd)(_),O=_&&(0,l.$r)(p,_),{loadProgress:K}=(0,H.A)(_&&(0,l.VO)(_,"download"),!O,_&&(0,l.Cz)(_,"download")),J=(0,M.A)(()=>{if(_)if(O)B({media:_});else{const e="message"===t?.type?t.message:void 0;D({media:_,originMessage:e})}}),G=(0,M.A)(()=>{const e=N();I((e<0?e:0)-1)}),j=(0,M.A)(()=>{const e=N();I((e>0?e:0)+1)}),z=(0,M.A)(()=>{if("avatar"!==t?.type)return;const{avatarOwner:e,profilePhotos:i,mediaIndex:s}=t,n=i?.photos[s];(0,v.L8)(e.id)?R({photo:n}):L({chatId:e.id,photo:n}),x({origin:g,chatId:e.id,mediaIndex:0,isAvatarView:!0},{forceOnHeavyAnimation:!0})}),$=(0,T.A)(),q=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",className:i?"active":void 0,onClick:t,ariaLabel:"More actions",children:(0,te.Y)(W.A,{name:"more"})})},[]);function Z(){return"avatar"===t?.type?(0,te.Y)(le,{isOpen:S,onClose:w,onConfirm:C,profileId:t.avatarOwner.id,photo:t.profilePhotos.photos[t.mediaIndex]}):void 0}const X=(0,M.A)(()=>{"message"===t?.type&&o?E({chatId:o?.id,messageIds:[t.message.id],isSchedule:"scheduled"===m,onConfirm:C}):k()});if(P){const e=[];if(V&&t.message.isForwardingAllowed&&!t.message.content.action&&!r&&e.push({icon:"forward",onClick:y,children:$("Forward")}),c||(a?e.push({icon:O?"close":"download",onClick:J,children:O?`${Math.round(100*K)}% Downloading...`:"Download"}):e.push({icon:"download",href:i,download:U,children:$("AccActionDownload")})),d&&e.push({icon:"flag",onClick:f,children:$("ReportPeer.Report")}),u&&e.push({icon:"copy-media",onClick:z,children:$("ProfilePhoto.SetMainPhoto")}),h&&e.push({icon:"delete",onClick:X,children:$("Delete"),destructive:!0}),0===e.length)return;return(0,te.FD)("div",{className:"MediaViewerActions-mobile",children:[(0,te.Y)(ce.A,{trigger:q,positionX:"right",children:e.map(e=>{let{icon:t,onClick:i,href:s,download:n,children:a,destructive:o}=e;return(0,te.Y)(de.A,{icon:t,href:s,download:n,onClick:i,destructive:o,children:a},t)})}),O&&(0,te.Y)(he.A,{progress:K,size:"s",noCross:!0}),h&&Z()]})}return(0,te.FD)("div",{className:"MediaViewerActions",children:[V&&t.message.isForwardingAllowed&&!r&&(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("Forward"),onClick:y,children:(0,te.Y)(W.A,{name:"forward"})}),function(){if(!c&&"standalone"!==t?.type)return"sponsoredMessage"!==t?.type&&(a?(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("AccActionDownload"),onClick:J,children:O?(0,te.Y)(he.A,{progress:K,size:"s",onClick:J}):(0,te.Y)(W.A,{name:"download"})}):(0,te.Y)(Q.A,{href:i,download:U,round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("AccActionDownload"),children:(0,te.Y)(W.A,{name:"download"})}))}(),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("MediaZoomOut"),onClick:G,children:(0,te.Y)(W.A,{name:"zoom-out"})}),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("MediaZoomIn"),onClick:j,children:(0,te.Y)(W.A,{name:"zoom-in"})}),d&&(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$(a?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:f,children:(0,te.Y)(W.A,{name:"flag"})}),u&&(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("ProfilePhoto.SetMainPhoto"),onClick:z,children:(0,te.Y)(W.A,{name:"copy-media"})}),h&&(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("Delete"),onClick:X,children:(0,te.Y)(W.A,{name:"delete"})}),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:$("Close"),onClick:b,children:(0,te.Y)(W.A,{name:"close"})}),h&&Z()]})}));var me=i(87357),pe=i(50442),ve=i(43336),ge=i(37836),Ae=i(14737),fe=i(16581),be=i(19129),Ce=i(26072),ye=i(15283);function Se(e){const t=(0,s.li)(e());return(0,ye.A)(()=>e.subscribe(()=>{t.current=e()})),t}var ke=i(90423),we=i(39751),Ne=i(83414);const[Ie,Pe]=(0,R.n5)(!1),[Ye,Fe]=(0,R.n5)(!1);function De(){return[(0,Ne.A)(()=>Ie()&&!Ye(),[Ie,Ye]),Pe,Fe]}var Me=i(56494);const[Te,Be]=(0,R.n5)(0);function Re(){return(0,s._W)(()=>{Be(0)}),[Te,Be]}var Le=i(5718),xe=i(672),Ee=i(57474);const Ve=e=>{let{text:t="",buttonText:i,isForVideo:n,onClick:a,handleSponsoredClick:o,isProtected:r,isForceMobileVersion:l}=e;const[c,d]=(0,s.J0)(!1),{isMobile:h}=(0,Y.Ay)(),[m]=De(),p=(0,be.A)(()=>!!u.TF&&!m(),[m]);(0,s.vJ)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;d(t>2*g.$)};t();const i=(0,ge.nF)(t,500,!0);return window.addEventListener("resize",i,!1),()=>{window.removeEventListener("resize",i,!1)}},[]);const v=(0,M.A)(()=>{o()}),A=(0,me.A)("MediaViewerFooter",n&&"is-for-video",p&&"is-hidden",r&&"is-protected",l&&"mobile");return(0,te.FD)("div",{className:A,onClick:function(e){t&&e.stopPropagation()},children:[Boolean(t)&&(0,te.Y)("div",{className:"media-viewer-footer-content",onClick:h?void 0:a,children:(0,te.Y)("p",{className:"media-text custom-scroll allow-selection "+(c?"multiline":""),dir:"auto",children:t})}),Boolean(i)&&(0,te.Y)(Q.A,{className:(0,me.A)("media-viewer-footer-content","media-viewer-button"),size:"default",color:"primary",isRectangular:!0,onClick:v,children:i})]})};var _e=i(15640),Ue=i(84313),Oe=i(71533),Ke=i(50680),Je=i(73622);const[Ge,je]=(0,R.n5)(!1);function ze(){return(0,s._W)(()=>{je(!1)}),[Ge,je]}var He=i(17663),$e=i(14242),qe=i(71429),We=i(82497),Qe=i(41074),Ze=i(4875);const Xe=u.Ni||u.pz,et=u.Ni||u.pz?.3:.25,tt=Xe?40:80,it=200,st=(0,Qe.Ay)();let nt;class at{frames=new Map;currentTime=0;constructor(e,t){this.canvas=t,st.forEach((t,i)=>{let{connector:s}=t;s.request({name:"video-preview:init",args:[e,tt,i,Qe.bP,this.onFrame.bind(this)]})})}onFrame(e,t){this.frames.set(e,t),e===this.currentTime&&this.render(e)}clearCache(){this.frames.forEach(e=>{e.close()}),this.frames.clear()}render(e){this.currentTime=e;const t=this.frames.get(e);return!!t&&((0,r.RK)(()=>{this.canvas.width=t.width,this.canvas.height=t.height,this.canvas.getContext("2d").drawImage(t,0,0,this.canvas.width,this.canvas.height)}),!0)}destroy(){this.clearCache(),st.forEach(e=>{let{connector:t}=e;t.request({name:"video-preview:destroy",args:[]})})}}st.forEach(e=>{let{worker:t}=e;t.addEventListener("message",async e=>{const{type:i,messageId:s,params:n}=e.data;if("requestPart"!==i)return;const a=await(0,Ze.px)("downloadMedia",{mediaFormat:O.qZ.Progressive,...n});if(!a)return;const{arrayBuffer:o}=a;t.postMessage({type:"partResponse",messageId:s,result:o},[o])})});var ot=i(63988);const rt="Od9ZSc1U";let lt;const ct=(0,s.ph)(e=>{let{duration:t,bufferedRanges:i,isReady:n,posterSize:a,playbackRate:o,url:r,isActive:l,isPlaying:c,isPreviewDisabled:d,onSeek:h,onSeekStart:m}=e;const p=(0,s.li)(),[v]=Re(),[g]=ze(),A=(0,ot.aG)(v,250),[f,b]=(0,s.Ul)(A()),[y,S]=(0,s.Ul)(0),[k,w]=(0,s.Ul)(0),N=(0,s.li)(!1),[I,P]=(0,s.J0)(!1),[Y,F]=(0,s.J0)(!1),D=(0,s.li)(),T=(0,s.li)(),B=(0,s.li)(),R=(0,s.li)(),L=(0,s.Kr)(()=>function(e,t){const i=(e=Math.round(e*et))/(t=Math.round(t*et));return e>it&&(e=it,t=Math.round(e/i)),t>it&&(t=it,e=Math.round(t*i)),{width:e,height:t}}(a?.width||0,a?.height||0),[a]),x=(0,M.A)(e=>{e=Math.floor(e),w(e),function(e){nt&&nt.render(e)}(e)});return(0,s.vJ)(()=>{if(!d&&r&&n)return function(e,t){return nt&&nt.destroy(),nt=new at(e,t),()=>{nt?.destroy(),nt=void 0}}(r,D.current)},[r,n,d]),(0,s.vJ)(()=>{P(!1)},[l]),(0,s.vJ)(()=>{if(lt&&lt(),lt=void 0,!N.current&&!Y){const e=A(),i=t-e;lt=(0,C.Hd)({from:e,to:t,duration:1e3*i/o,onUpdate:b})}},[A,Y,b,o,t]),(0,s.vJ)(()=>{c&&!g()||(lt&&lt(),lt=void 0)},[c,f,g]),(0,s.vJ)(()=>{if(c){lt&&lt(),lt=void 0;const e=A(),i=t-e;lt=(0,C.Hd)({from:e,to:t,duration:1e3*i/o,onUpdate:b})}},[c,o,t]),(0,s.Nf)(()=>{if(!B.current)return;const e=(0,ve.LI)(f()/t*100,2);B.current.style.width=`${e}%`},[f,t]),(0,s.Nf)(()=>{T.current&&(T.current.style.left=`${y()}px`)},[y]),(0,s.Nf)(()=>{R.current&&(R.current.innerText=(0,He.QO)(k()))},[k]),(0,s.vJ)(()=>{if(!p.current||!l)return;const e=p.current;let i=e.getBoundingClientRect(),s=0,n=0;const a=s=>{const n=(0,_e.A)(s).x,a=(0,ve.qE)(t*((n-i.left)/i.width),0,t);if(d)return[a,0];i.width||(i=e.getBoundingClientRect());const o=T.current;return[a,(0,ve.qE)(n-i.left-o.clientWidth/2,-4,i.width-o.clientWidth+4)]},o=()=>{lt&&lt(),lt=void 0},r=()=>{o(),N.current=!0,P(!1),F(!1),b(s),h(s),setTimeout(()=>{N.current=!1},250)},c=(0,pe.wJ)(e,{onCapture:()=>{o(),P(!0),F(!0),m()},onRelease:r,onClick:r,onDrag:e=>{o(),P(!0),[s,n]=a(e),x(s),S(n),b(s)}});if(u.TF||d)return c;const v=e=>{P(!0),[s,n]=a(e),S(n),x(s)},g=()=>{P(!1)};return e.addEventListener("mousemove",v),e.addEventListener("mouseenter",v),e.addEventListener("mouseleave",g),()=>{c(),e.removeEventListener("mousemove",v),e.removeEventListener("mouseenter",v),e.removeEventListener("mouseleave",g)}},[t,x,l,h,m,S,b,F,d,o]),(0,te.FD)("div",{className:"ingarEvU",ref:p,children:[!d&&(0,te.FD)(se.A,{isOpen:!0,isHidden:!I,className:"TqpEWfl3",style:`width: ${L.width}px; height: ${L.height}px`,ref:T,children:[(0,te.Y)("canvas",{className:"fKVz2lln",ref:D}),(0,te.Y)("div",{className:"bGiNvx5D",children:(0,te.Y)("span",{className:"mnkqvOMR",ref:R})})]}),(0,te.Y)("div",{className:rt,children:i.map(e=>{let{start:t,end:i}=e;return(0,te.Y)("div",{className:"ANe2DKfp",style:`left: ${100*t}%; right: ${100-100*i}%`},`${t}-${i}`)})}),(0,te.Y)("div",{className:rt,children:(0,te.Y)("div",{ref:B,className:(0,me.A)("igaGLblf",Y&&"beUP6SqY")})})]})}),dt=e=>{e.stopPropagation()},ht=[.5,1,1.5,2];function ut(e,t){return(0,te.Y)("div",{className:"player-time",children:`${(0,He.QO)(e)} / ${(0,He.QO)(t)}`})}const mt=(0,s.ph)(e=>{let{url:t,bufferedRanges:i,bufferedProgress:n,duration:a,isReady:o,fileSize:r,isForceMobileVersion:l,isPlaying:c,isFullscreenSupported:d,isFullscreen:h,isBuffered:m,isPreviewDisabled:p,volume:v,isMuted:g,playbackRate:A,posterSize:f,onChangeFullscreen:b,onVolumeClick:C,onVolumeChange:y,onPlaybackRateChange:S,isPictureInPictureSupported:k,onPictureInPictureChange:w,onPlayPause:N,onSeek:I,onSeekingChange:P}=e;const[D,B,R]=(0,F.A)(),[L]=Re(),x=(0,be.A)(()=>Math.trunc(L()),[L]),[E,V]=(0,s.Ul)(!1),_=(0,s.li)(),{isMobile:U}=(0,Y.Ay)(),[O,K]=De(),J=(0,be.A)(O);(0,s.vJ)(()=>{if(u.TF||l){if(J&&c&&!D&&!E())return _.current=window.setTimeout(()=>{K(!1)},3e3),()=>{_.current&&window.clearTimeout(_.current)};_.current&&window.clearTimeout(_.current)}},[c,J,K,D,E,l]),(0,s.Nf)(()=>(J?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[J]),(0,s.vJ)(()=>{J||R()},[R,J]);const G=(0,T.A)(),j=(0,M.A)(e=>{V(!1),I(e),P(!1)}),z=(0,M.A)(()=>{V(!0),P(!0)}),H=(0,s.Kr)(()=>0===v||g?"muted":v<.3?"volume-1":v<.6?"volume-2":"volume-3",[v,g]);return(0,te.FD)("div",{className:(0,me.A)("VideoPlayerControls",l&&"mobile",J&&"active"),onClick:dt,children:[(0,te.Y)(ct,{url:t,duration:a,isReady:o,isPlaying:c,isPreviewDisabled:p,posterSize:f,bufferedRanges:i,playbackRate:A,onSeek:j,onSeekStart:z,isActive:J}),(0,te.FD)("div",{className:"buttons",children:[(0,te.Y)(Q.A,{ariaLabel:G("AccActionPlay"),size:"tiny",ripple:!U,color:"translucent-white",className:"play",round:!0,onClick:N,children:(0,te.Y)(W.A,{name:c?"pause":"play"})}),(0,te.Y)(Q.A,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:C,children:(0,te.Y)(W.A,{name:H})}),!u.pz&&(0,te.Y)(We.A,{bold:!0,className:"volume-slider",value:g?0:100*v,onChange:y}),ut(x,a),!m&&(0,te.Y)("div",{className:"player-file-size",children:`${(0,$e.v7)(G,r*n)} / ${(0,$e.v7)(G,r)}`}),(0,te.Y)("div",{className:"spacer"}),(0,te.Y)(Q.A,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:B,children:`${A}x`}),k&&(0,te.Y)(Q.A,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:w,children:(0,te.Y)(W.A,{name:"pip"})}),d&&(0,te.Y)(Q.A,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:b,children:(0,te.Y)(W.A,{name:h?"smallscreen":"fullscreen"})})]}),(0,te.Y)(qe.A,{isOpen:D,className:(0,me.A)("playback-rate-menu",!d&&"no-fullscreen",!k&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:R,children:ht.map(e=>(0,te.Y)(de.A,{disabled:A===e,onClick:()=>S(e),children:`${e}x`}))})]})}),pt=(0,s.ph)(e=>{let{url:t,isGif:i,posterData:a,posterSize:r,loadProgress:l,fileSize:c,isMediaViewerOpen:d,noPlay:h,volume:m,isMuted:p,playbackRate:v,isForceMobileVersion:g,shouldCloseOnClick:A,isProtected:f,isClickDisabled:b,isPreviewDisabled:C,isSponsoredMessage:S,timestamp:k,handleSponsoredClick:w,onClose:N}=e;const{setMediaViewerVolume:I,setMediaViewerMuted:P,setMediaViewerPlaybackRate:F,setMediaViewerHidden:D}=(0,n.ko)(),T=(0,s.li)(),[R,L]=(0,s.J0)(!u.TF||!u.pz),[_,U,O]=(0,ke.Ay)(T,L),{isMobile:K}=(0,Y.Ay)(),J=T.current?.duration||0,G=i||J<=30,j=(0,M.A)(()=>{u.Nd||D({isHidden:!0})}),z=(0,M.A)(()=>{u.Nd||D({isHidden:!1})}),[H,$,q]=function(e,t,i){const[n,a]=(0,s.J0)(!1),[r,l]=(0,s.J0)(!1);(0,s.Nf)(()=>{if(u.pz&&u._7||!e.current)return;const s=e.current,n=E(s);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===n)return;s.autoPictureInPicture=!0,a(!0);const o=()=>{t(),l(!0),x(!0)},r=()=>{x(!1),l(!1),i()};return s.addEventListener("enterpictureinpicture",o),s.addEventListener("leavepictureinpicture",r),()=>{s.removeEventListener("enterpictureinpicture",o),s.removeEventListener("leavepictureinpicture",r)}},[e,t,i]);const c=(0,s.hb)(()=>{if(!e.current)return;const t=E(e.current);t?t("inline"):V()},[e]),d=(0,s.hb)(()=>{if(!e.current)return;c();const t=e.current,i=(0,B.e)(t),s=E(t);s?s("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){o.Oig&&console.log("[MV] PictureInPicture Error",e)}}(t),i&&(0,B.A)(t)},[e,c]);return n?[n,d,r]:[!1]}(T,j,z),[,Z,X]=De(),[ee,ie]=(0,s.Ul)(!1),se=(0,s.li)({x:0,y:0});(0,s.vJ)(()=>{const e=e=>{se.current=(0,_e.A)(e)};return window.addEventListener("mousemove",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}},[]);const ne=(0,M.A)((e,t)=>{const i=T.current?.getBoundingClientRect();i&&(e<=i.left||e>=i.right||t<=i.top||t>=i.bottom)&&(ee()||Z(!1))}),ae=(0,M.A)(()=>{Z(!0)}),oe=(0,M.A)(e=>{ne(e.clientX,e.clientY)}),re=(0,M.A)(e=>{if(ie(e),!e){const{x:e,y:t}=se.current;ne(e,t)}}),{isReady:le,isBuffered:ce,bufferedRanges:de,bufferingHandlers:ue,bufferedProgress:me}=(0,Oe.A)(),pe=(0,Ue.A)(T,void 0,!t),{shouldRender:ge,transitionClassNames:Ae}=(0,Ke.A)(!ce&&!pe,void 0,void 0,"slow"),{shouldRender:fe,transitionClassNames:be}=(0,Ke.A)(u.pz&&!R&&!ge&&!pe,void 0,void 0,"slow"),[,Ce]=Re(),[,ye]=ze();(0,s.vJ)(()=>{X(ge)},[X,ge]),(0,s.vJ)(()=>{h||!d||pe?T.current.pause():t&&!u.TF&&(0,B.A)(T.current)},[h,d,t,P,pe]),(0,s.vJ)(()=>{T.current.volume=m},[m]),(0,s.vJ)(()=>{T.current.playbackRate=v},[v]),(0,s.vJ)(()=>{k&&(T.current.currentTime=k,Ce(k))},[Ce,k]);const Se=(0,M.A)(e=>{e.stopPropagation(),R?(T.current.pause(),L(!1)):((0,B.A)(T.current),L(!0))}),we=(0,M.A)(e=>{S&&(w?.(!0),N(e)),b||(A?N(e):Se(e))});(0,Je.A)(T,ue);const Ne=(0,M.A)(e=>{const t=e.currentTarget;t.readyState>=4&&(ye(!1),Ce(t.currentTime)),G||t.currentTime!==t.duration||(Ce(0),L(!1))}),Ie=(0,M.A)(()=>{G||(Ce(0),L(!1),Z(!0))}),Pe=(0,M.A)(()=>{_&&O?O():!_&&U&&U()}),Ye=(0,M.A)(e=>{T.current.currentTime=e}),Fe=(0,M.A)(e=>{I({volume:e/100})}),Me=(0,M.A)(()=>{T.current.muted=!T.current.muted,P({isMuted:!p})}),Te=(0,M.A)(e=>{F({playbackRate:e})});(0,s.vJ)(()=>{if(!d)return;const e=e=>{if(!_)return;const t=T.current,i=(0,ve.qE)(t.currentTime+5*e,0,t.duration);Number.isFinite(i)&&(t.currentTime=i)},t=t=>{if(!q)switch(t.key){case" ":case"Enter":t.preventDefault(),Se(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)}},[Se,d,_,q]);const Be=r&&`width: ${r.width}px; height: ${r.height}px`,Le=`background-image: url(${a})`,xe=!u.TF&&!g;return(0,te.FD)("div",{className:"VideoPlayer",onMouseMove:xe?ae:void 0,onMouseLeave:xe?oe:void 0,children:[(0,te.FD)("div",{style:Be,children:[f&&(0,te.Y)("div",{onContextMenu:y.A,onDoubleClick:u.TF?void 0:Pe,onClick:K?void 0:Se,className:"protector"}),(0,te.Y)("video",{ref:T,autoPlay:u.TF,controlsList:"nodownload",playsInline:!0,loop:G,muted:i||p,id:"media-viewer-video",style:Le,onWaiting:()=>ye(!0),onPlay:()=>L(!0),onEnded:Ie,onClick:K||_?void 0:we,onDoubleClick:u.TF?void 0:Pe,...ue,onPause:e=>{L(!1),ue.onPause(e)},onTimeUpdate:Ne,src:t})]}),fe&&(0,te.Y)(Q.A,{round:!0,className:`play-button ${be}`,onClick:Se,children:(0,te.Y)(W.A,{name:"play"})}),ge&&(0,te.FD)("div",{className:["spinner-container",Ae].join(" "),children:[!ce&&(0,te.Y)("div",{className:"buffering",children:"Buffering..."}),(0,te.Y)(he.A,{size:"xl",progress:ce?1:l,onClick:N})]}),!i&&!S&&!pe&&(0,te.Y)(mt,{url:t,isPlaying:R,bufferedRanges:de,bufferedProgress:me,isBuffered:ce,isFullscreenSupported:Boolean(U),isPictureInPictureSupported:H,isFullscreen:_,isPreviewDisabled:C,fileSize:c,duration:J,isReady:le,posterSize:r,isForceMobileVersion:g,onSeek:Ye,onChangeFullscreen:Pe,onPictureInPictureChange:$,onPlayPause:Se,volume:m,playbackRate:v,isMuted:p,onVolumeClick:Me,onVolumeChange:Fe,onPlaybackRateChange:Te,onSeekingChange:re})]})}),vt=(0,s.ph)((0,n.EK)((e,t)=>{let{item:i}=t;const{volume:s,isMuted:n,playbackRate:a,isHidden:o,origin:r,timestamp:l,threadId:d}=(0,c.nTw)(e).mediaViewer,h="message"===i.type?i.message:void 0,u="sponsoredMessage"===i.type?i.message:void 0,m=h||u,p=b(e,i),v=h&&(0,Me.me)(e,h,!0);return{origin:r,textMessage:m,isProtected:h&&(0,c.ynf)(e,h),volume:s,isMuted:n,isHidden:o,playbackRate:a,threadId:d,timestamp:l,maxTimestamp:v,viewableMedia:p}})(e=>{let{item:t,viewableMedia:i,isActive:s,textMessage:a,origin:r,withAnimation:l,isProtected:c,volume:d,playbackRate:m,isMuted:p,isHidden:v,isMoving:f,threadId:b,timestamp:C,maxTimestamp:y,onClose:S,onFooterClick:k,handleSponsoredClick:w}=e;const{updateLastPlaybackTimestamp:N}=(0,n.ko)(),I=(0,T.A)(),P="avatar"===t.type,F="sponsoredMessage"===t.type,{media:D}=i||{},{isVideo:B,isPhoto:R,bestImageData:L,bestData:x,dimensions:E,isGif:V,isLocal:_,isVideoAvatar:U,mediaSize:O,loadProgress:K}=q({media:D,isAvatar:P,origin:r,delay:!!l&&350}),[,J]=De(),[G]=Re(),j=Boolean(D),{isMobile:z}=(0,Y.Ay)(),H=(0,M.A)(()=>{J(!0)}),$=(0,xe.A)(()=>{if(!s||!a||"video"!==D?.mediaType)return;if(D.duration<o.u4b)return;const e="id"in a?a:void 0,t=G();if(!t||!e||e.isInAlbum)return;const i=D.duration-t>1?t:void 0;N({chatId:e.chatId,messageId:e.id,timestamp:i})},[G,s,D,a],1e3);if((0,Le.R)($,[G]),!D)return;if("avatar"===t.type)return U?(0,te.Y)("div",{className:"MediaViewerContent",children:(0,te.Y)(pt,{url:x,isGif:!0,posterData:L,posterSize:(0,g.sk)(E,!1,!0),loadProgress:K,fileSize:O,isMediaViewerOpen:j&&s,isProtected:c,isPreviewDisabled:!h.G9||_,noPlay:!s,onClose:S,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:f,playbackRate:1,isSponsoredMessage:F,handleSponsoredClick:w},D.id)},D.id):(0,te.Y)("div",{className:"MediaViewerContent",children:gt(x,(0,g.sk)(E,!1),!z&&!c,c)},D.id);const W=a&&(a.content.action?"suggestProfilePhoto"===a.content.action.type?I("Conversation.SuggestedPhotoTitle"):void 0:(0,A.V)({message:a,maxTimestamp:y,threadId:b,forcePlayback:!0,isForMediaViewer:!0})),Q=a&&"buttonText"in a?a.buttonText:void 0,Z=Boolean(W),X=(0,g.sk)(E,Z,B),ee=z||function(e){return!!e&&e.width<350}(X);return(0,te.FD)("div",{className:(0,me.A)("MediaViewerContent",Z&&"has-footer"),onMouseMove:ee&&!u.TF?H:void 0,children:[R&&gt(x,X,!z&&!c,c),B&&(s?(0,te.Y)(pt,{url:x,isGif:V,posterData:L,posterSize:X,loadProgress:K,fileSize:O,isMediaViewerOpen:j&&s,noPlay:!s,isPreviewDisabled:!h.G9||_,onClose:S,isMuted:p,isHidden:v,isForceMobileVersion:ee,isProtected:c,volume:d,isClickDisabled:f,playbackRate:m,isSponsoredMessage:F,handleSponsoredClick:w,timestamp:C},D.id):At(L,X,!z&&!c,c)),W&&(0,te.Y)(Ve,{text:W,buttonText:Q,onClick:k,isProtected:c,isForceMobileVersion:ee,isForVideo:B&&!V,handleSponsoredClick:w})]})}));function gt(e,t,i,s){return e?(0,te.FD)("div",{style:"position: relative;",children:[s&&(0,te.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,te.Y)("img",{src:e,alt:"",className:(0,me.A)(s&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(i)})]}):(0,te.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,te.Y)(Ee.A,{color:"white"})})}function At(e,t,i,s){const n=t&&`width: ${t.width}px; height: ${t.height}px`,a=`background-image: url(${e})`;return e?(0,te.FD)("div",{className:"VideoPlayer",children:[s&&(0,te.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,te.Y)("div",{style:n,children:(0,te.Y)("video",{style:a,className:(0,me.A)(s&&"is-protected"),draggable:Boolean(i)})})]}):(0,te.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,te.Y)(Ee.A,{color:"white"})})}const{easeOutCubic:ft,easeOutQuart:bt}=C.qM,Ct=u.TF?40:0,yt=350;let St,kt;var wt=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(wt||{});const Nt=(0,s.ph)(e=>{let{item:t,isVideo:i,isGif:n,isOpen:a,withAnimation:o,isHidden:r,isLoadingMoreMedia:l,isSynced:c,loadMoreItemsIfNeeded:d,getNextItem:h,selectItem:m,onClose:p,onFooterClick:v,handleSponsoredClick:g}=e;const A=(0,s.li)(),f=(0,s.li)(),b=(0,s.li)(),y=(0,s.li)(),S=(0,s.li)({x:0,y:0,scale:1}),k=(0,s.li)(void 0),w=(0,s.li)(void 0),N=(0,s.li)(!1),[I,P]=(0,s.J0)(!0),[Y]=re(),F=(0,s.li)(Y()),D=(0,ke.zk)(),[B,R]=(0,s.J0)(!1),[L,x]=(0,s.Ul)({x:0,y:0,scale:1}),E=Se(L),[V,_]=(0,s.Ul)(t),U=Se(V),O=(0,be.A)(()=>1!==L().scale,[L]),K=(0,be.A)(V),{height:J,width:G,isResizing:j}=(0,we.A)(),[z,H,$]=De(),q=(0,T.A)();(0,Ce.A)({isActive:a,onBack:p,shouldBeReplaced:!0});const W=(0,fe.A)(m,[m],350,!0),Q=(0,fe.A)(()=>{k.current=void 0},[],500,!0),Z=(0,fe.A)(e=>P(e),[],800,!0),X=Boolean(n&&!u.pz),ee=u.TF?40:G/10,ie=(0,M.A)(e=>{if(!u.TF)return;const t=J-e.pageY<80;!t&&e.pageX<ee||!t&&e.pageX>G-ee||H(!z())});(0,Ae.A)(()=>H(!0),yt),(0,s.vJ)(()=>{const{scale:e,x:i,y:s}=E.current;0===i&&0===s&&1===e&&_(t)},[t,_,E]),(0,s.vJ)(()=>{c&&K&&!l&&d(K)},[K,d,c,l]),(0,s.Nf)(()=>{const{x:e,y:t,scale:i}=L();$(1!==i),b.current&&(b.current.style.transform=It(-G+e-Ct)),f.current&&(f.current.style.transform=It(e,t,i)),y.current&&(y.current.style.transform=It(G+e+Ct))},[L,$,G]),(0,s.vJ)(()=>{if(!A.current||void 0===U.current||r||D)return;let e=S.current;const t={x:0,y:0},i={x:0,y:0},s={x:0,y:0};let n,a=Date.now();const l=(0,ge.sg)(()=>{a=Date.now()},500,!1,!0),c=t=>{const i=U.current;if(void 0===i)return!1;const s=h(i,t);if(void 0!==s){const i=(G+Ct)*t,n=E.current.x+i;return P(!1),_(s),W(s),Z(!0),e={x:0,y:0,scale:1},o?(St=(0,C.Hd)({from:n,to:0,duration:yt,timing:ft,onUpdate:e=>x({y:0,x:e,scale:1})}),!0):(x(e),!0)}return!1},d=e=>{const{scale:t}=E.current;if(1!==t)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let i=0;return J-e.pageY<80?[!1,!1]:(e.pageX<ee?i=-1:e.pageX>G-ee&&(i=1),[0!==i,c(i)])},m=e=>{const{scale:t}=E.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},v=function(e){let{x:t,y:i,scale:s}=e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const a=w.current;if(!a)return[{x:t,y:i,scale:s},!0,!0];let o=!0,r=!0;const l=(G-G*s)/2,c=(J-J*s)/2,d=Math.max(-a.left*s,l),h=G-a.right*s;o=(0,ve.Bt)(t,h,d),t=(0,ve.qE)(t,h,d);const u=Math.max(-a.top*s+n,c),m=J-a.bottom*s;return r=(0,ve.Bt)(i,m,u),i=(0,ve.qE)(i,m,u),[{x:t,y:i,scale:s},o,r]},g=n=>{if(N.current)return void(N.current=!1);"mouseup"===n.type&&R(!1);const o=E.current,{y:r,scale:l}=o;let c=o.x;const d=Math.abs(c),u=Math.abs(r);if(Q(),Z(!0),l<1)return e={x:0,y:0,scale:1},void(St=(0,C.Hd)({from:[c,r,l],to:[0,0,1],duration:yt,timing:ft,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=r*d+(i.y-d*i.y);const m=.15;if("wheel"!==n.type&&e.scale===l){const e=Math.abs(t.x)/(Date.now()-a),i=Math.abs(t.y)/(Date.now()-a);h-=Math.abs(t.x)*e*m*s.x,u-=Math.abs(t.y)*i*m*s.y}return[e]=v({x:h,y:u,scale:o},60),void(St=(0,C.Hd)({from:[c,r,l],to:[e.x,e.y,e.scale],duration:yt,timing:ft,onUpdate:e=>x({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:c,y:r,scale:l},u>=50)return void p();if(u>0)return void(St=(0,C.Hd)({from:r,to:0,duration:yt,timing:ft,onUpdate:e=>x({x:0,y:e,scale:l})}));const m=c<0?1:-1,g=U.current,A=g&&h(g,c<0?1:-1),f=s.x<0?-1:1;void 0!==A&&d>=50&&m===f&&(c+=(G+Ct)*m,_(A),W(A)),St=(0,C.Hd)({from:c,to:0,duration:yt,timing:ft,onUpdate:e=>x({y:0,x:e,scale:l??1})})},b=(0,pe.wJ)(A.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls, .VideoPlayerControls",minZoom:1,maxZoom:4,doubleTapZoom:3,withWheelDrag:!0,onCapture:e=>{if(Yt(e))return;const{x:t,y:i,scale:s}=E.current;if("mousedown"!==e.type||(R(!0),1===s)){if(a=Date.now(),0===t&&0===i&&1===s){if(!f.current)return;if(n=f.current.querySelector("img, video"),!n)return;w.current=n.getBoundingClientRect()}}else e.preventDefault()},onDrag:(i,n,a,o)=>{let{dragOffsetX:r,dragOffsetY:c}=a;if(N.current||Yt(i))return;if(u.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=pe.h6||e>=G-pe.h6)return}St&&(St(),St=void 0),s.x=t.x-r,s.y=t.y-c,t.x=r,t.y=c;const d=Math.abs(r),h=Math.abs(c),{x:m,y:p,scale:A}=E.current;if(l(),1===A){if("mousemove"!==i.type){if(k.current!==wt.Vertical&&(k.current===wt.Horizontal||Math.abs(m)>pe.no||d/h>pe.fG)){k.current=wt.Horizontal,P(!1);const e=G+Ct,t=(0,ve.qE)(r,-e,e);return x({x:t,y:0,scale:A}),void("wheel"===i.type&&Math.abs(t)>100&&(g(i),N.current=!0))}if(k.current===wt.Vertical||Math.abs(p)>pe.no||h/d>pe.fG){k.current=wt.Vertical;const e=J,t=(0,ve.qE)(c,-e,e);x({x:0,y:t,scale:A}),"wheel"===i.type&&Math.abs(t)>100&&(g(i),N.current=!0)}}}else{const t=e.x+r,s=e.y+c;if(["wheel","mousemove"].includes(i.type)){const[e,i,n]=v({x:t,y:s,scale:A},60);return o&&o(!i,!n),void x(e)}"touches"in i&&1===i.touches.length&&x({x:t,y:s,scale:A})}},onZoom:(t,s)=>{let{zoom:n,zoomFactor:a,initialCenterX:o,initialCenterY:r,dragOffsetX:l,dragOffsetY:c,currentCenterX:d,currentCenterY:h}=s;St&&St(),o=o||G/2,r=r||J/2,d=d||G/2,h=h||J/2;const u=n??(0,ve.qE)(e.scale*a,.5,12),m=u/e.scale,p=Math.abs(Math.min(e.x,0)),g=Math.abs(Math.min(e.y,0));i.x=d,i.y=h;const A=p+o,f=g+r,b=A-m*A,C=f-m*f,[y]=v({x:e.x+b+l,y:e.y+C+c,scale:u});x(y)},onClick(t){R(!1);const[i,s]=d(t);if(i){if(t.preventDefault(),t.stopPropagation(),u.TF)return;s||p()}else 1!==e.scale||u.TF||!X&&Pt(t.target,".VideoPlayer")||p()},onDoubleClick(t,i){let{centerX:s,centerY:n}=i;const[a]=d(t);if(a)return t.preventDefault(),void t.stopPropagation();if(!u.TF&&"wheel"!==t.type)return;const{x:o,y:r,scale:l}=E.current;if(1===l){if(0!==o||0!==r)return;e=v({x:s-3*s,y:n-3*n,scale:3})[0]}else e={x:0,y:0,scale:1};St=(0,C.Hd)({from:[o,r,l],to:[e.x,e.y,e.scale],duration:yt,timing:ft,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};x(t)}})},onRelease:g});return document.addEventListener("keydown",m,!1),()=>{b(),document.removeEventListener("keydown",m,!1)}},[U,Q,ee,h,D,r,p,W,_,Z,x,X,E,J,G,o]),(0,s.vJ)(()=>{const e=Y(),t=void 0!==F.current&&F.current!==e;if(!A.current||!t||r||D)return;F.current=e;const{scale:i}=E.current,s=e>0?-1:1;let n=100,a=0;i<=.6&&s>0||i>=12&&s<0||(1===i&&s>0&&(n=20),kt&&kt(),kt=(0,C.Hd)({from:s,to:s*n,duration:yt,timing:bt,onUpdate:e=>{if(!A.current)return;const t=(0,ve.LI)(e-a,2);a=e;const i=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});A.current.dispatchEvent(i)}}))},[Y,r,D,E]);const[se,ne]=(0,s.Kr)(()=>void 0===K?[void 0,void 0]:[h(K,-1),h(K,1)],[K,h]);if(void 0===K)return;const ae=void 0!==se,oe=void 0!==ne,le=B&&O;return(0,te.FD)("div",{className:"MediaViewerSlides",ref:A,children:[(0,te.Y)("div",{className:"MediaViewerSlide",ref:b,children:ae&&!O&&!j&&(0,te.Y)(vt,{withAnimation:o,isMoving:le,item:se,onClose:p,onFooterClick:v,handleSponsoredClick:g})}),(0,te.Y)("div",{className:(0,me.A)("MediaViewerSlide","MediaViewerSlide--active",le&&"MediaViewerSlide--moving"),onClick:ie,ref:f,children:(0,te.Y)(vt,{item:K,withAnimation:o,isActive:I,isMoving:le,onClose:p,onFooterClick:v,handleSponsoredClick:g})}),(0,te.Y)("div",{className:"MediaViewerSlide",ref:y,children:oe&&!O&&!j&&(0,te.Y)(vt,{withAnimation:o,isMoving:le,item:ne,onClose:p,onFooterClick:v,handleSponsoredClick:g})}),ae&&!O&&!u.TF&&(0,te.Y)("button",{type:"button",className:`navigation prev ${i&&!n&&"inline"}`,"aria-label":q("AccDescrPrevious"),dir:q.isRtl?"rtl":void 0}),oe&&!O&&!u.TF&&(0,te.Y)("button",{type:"button",className:`navigation next ${i&&!n&&"inline"}`,"aria-label":q("Next"),dir:q.isRtl?"rtl":void 0})]})});function It(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return`translate3d(${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0).toFixed(3)}px, ${e.toFixed(3)}px, 0px) scale(${t.toFixed(3)})`}function Pt(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function Yt(e){const t=e.target;return!!Pt(t,".VideoPlayerControls")&&(Pt(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu, .SeekLine")||e.preventDefault(),!0)}var Ft=i(70636),Dt=i(4961),Mt=i(21849);const Tt=(0,n.EK)((e,t)=>{let{item:i}=t;const s="message"===i?.type?i.message:void 0,n=s&&(0,c.Y7C)(e,s);return{owner:"avatar"===i?.type?i.avatarOwner:n}})(e=>{let{owner:t,item:i}=e;const{closeMediaViewer:a,focusMessage:o,toggleChatInfo:r}=(0,n.ko)(),{isMobile:c}=(0,Y.Ay)(),d=(0,M.A)(()=>{if(a(),"message"!==i?.type)return;const e=i.message;c?setTimeout(()=>{r({force:!1},{forceSyncOnIOs:!0}),o({chatId:e.chatId,messageId:e.id})},350):o({chatId:e.chatId,messageId:e.id})}),h=(0,T.A)(),u=(0,s.Kr)(()=>{if(!i||"standalone"===i.type)return;const e="avatar"===i.type?i.avatarOwner:void 0,t="avatar"===i.type?i.profilePhotos:void 0,s=t?.photos[i.mediaIndex],n=s?.id===t?.fallbackPhoto?.id,a=s?.id===t?.personalPhoto?.id,o="message"===i.type?i.message.date:s?.date;if(!o)return;const r=(0,He.fS)(h,1e3*o,!0),c=t?.count&&t.count+(t?.fallbackPhoto?1:0),d=i.mediaIndex+1+(t?.personalPhoto?-1:0),u=c&&h("Of",[d,c]),m=[];if(s){const t=(0,v.L8)(e.id)?void 0:e,i=t&&(0,l.WX)(t),s=t&&(0,l.YE)(t);m.push(h(a?"lng_mediaview_profile_photo_by_you":n?"lng_mediaview_profile_public_photo":i?"lng_mediaview_channel_photo":s?"lng_mediaview_group_photo":"lng_mediaview_profile_photo"))}return!u||a||n||m.push(u),m.push(r),m.join(" • ")},[i,h]);if(!t)return;const m=(0,Ft.F9)(h,t);return(0,te.FD)("div",{className:"SenderInfo",onClick:d,children:[(0,te.Y)(Mt.A,{size:"medium",peer:t},t.id),(0,te.FD)("div",{className:"meta",children:[(0,te.Y)("div",{className:"title",dir:"auto",children:m&&(0,Dt.A)(m)}),(0,te.Y)("div",{className:"date",dir:"auto",children:u})]})]})}),Bt=250,Rt=(0,s.ph)((0,n.EK)(e=>{const{mediaViewer:t,shouldSkipHistoryAnimations:i}=(0,c.nTw)(e),{chatId:s,threadId:n,messageId:o,origin:r,isHidden:d,withDynamicLoading:h,standaloneMedia:u,mediaIndex:m,isAvatarView:p,isSponsoredMessage:g}=t,A=(0,c.xYJ)(e,"mediaViewerAnimations"),{currentUserId:C,isSynced:y}=e,S=Boolean(s)&&(0,c.nZ4)(e,s);if(p){const t=(0,c.PVB)(e,s);let a=!1;t&&(a=(0,v.L8)(t.id)?t.id===C:(0,l.SJ)(t));const p=(0,c.IVq)(e,s),g=f({avatarOwner:t,standaloneMedia:u,profilePhotos:p,mediaIndex:m}),k=b(e,g);return{profilePhotos:p,avatar:p?.photos[m],avatarOwner:t,isLoadingMoreMedia:p?.isLoading,isChatWithSelf:S,canUpdateMedia:a,withAnimation:A,origin:r,shouldSkipHistoryAnimations:i,isHidden:d,standaloneMedia:u,mediaIndex:m,isSynced:y,currentItem:g,viewableMedia:k,chatId:s,threadId:n,messageId:o,message:void 0,collectedMessageIds:void 0,chatMessages:void 0,sponsoredMessage:void 0,withDynamicLoading:h}}let k,w,N;s&&o&&(k=r&&[a.TQ.ScheduledAlbum,a.TQ.ScheduledInline].includes(r)?(0,c.Jl6)(e,s,o):(0,c.O5q)(e,s,o)),g&&s&&r===a.TQ.SponsoredMessage&&(w=(0,c.v8U)(e,s)),s&&(N=r&&[a.TQ.ScheduledAlbum,a.TQ.ScheduledInline].includes(r)?(0,c.yFI)(e,s):(0,c.zeq)(e,s));let I=!1;const P=r===a.TQ.Inline,Y=r===a.TQ.Album;let F;if(s&&n&&o)if(h&&(P||Y)){const t=(0,c.CuV)(e);I=Boolean(t?.isLoading);const{foundIds:i}=t?.currentSegment||{};F=i}else if(r===a.TQ.SharedMedia){const t=(0,c.BU_)(e),{foundIds:i}=t&&t.resultsByType&&t.resultsByType.media||{};F=i}else(P||Y)&&(F=(0,c.Lzh)(e,s,n,o)||(0,c.gCU)(e,s,n));const D=f({message:k,standaloneMedia:u,mediaIndex:m,sponsoredMessage:w});return{chatId:s,threadId:n,messageId:o,isChatWithSelf:S,origin:r,message:k,chatMessages:N,sponsoredMessage:w,collectedMessageIds:F,withAnimation:A,isHidden:d,shouldSkipHistoryAnimations:i,withDynamicLoading:h,standaloneMedia:u,mediaIndex:m,isLoadingMoreMedia:I,isSynced:y,currentItem:D,viewableMedia:b(e,D),canUpdateMedia:void 0,avatar:void 0,avatarOwner:void 0,profilePhotos:void 0}})(e=>{let{chatId:t,threadId:i,messageId:c,message:f,collectedMessageIds:b,isChatWithSelf:y,canUpdateMedia:B,origin:R,avatar:x,avatarOwner:E,profilePhotos:O,chatMessages:K,sponsoredMessage:J,standaloneMedia:G,mediaIndex:j,withAnimation:z,isHidden:H,shouldSkipHistoryAnimations:$,withDynamicLoading:Z,isLoadingMoreMedia:X,isSynced:ee,currentItem:ae,viewableMedia:oe}=e;const{openMediaViewer:re,closeMediaViewer:le,openForwardMenu:ce,focusMessage:de,toggleChatInfo:he,searchChatMediaMessages:me,loadMoreProfilePhotos:pe,clickSponsored:ve,openUrl:ge}=(0,n.ko)(),Ae=Boolean(E||f||G||J),{isMobile:fe}=(0,Y.Ay)(),{media:be,isSingle:Ce}=oe||{},ye=(0,s.li)(),Se=f?.senderId||E?.id||f?.chatId,ke=(0,_.A)(Se),we=z?"slideFade":"none",Ne=Boolean(z&&!$),[Ie,Pe,Ye]=(0,F.A)(),{isVideo:Fe,isPhoto:De,bestImageData:Me,bestData:Te,dimensions:Be,isGif:Re,isFromSharedMedia:Le}=q({media:be,isAvatar:Boolean(E),origin:R,delay:Ne&&Bt}),xe=(()=>{if(y)return!1;if("avatar"!==ae?.type||!E)return!1;const e=ae.profilePhotos;return be!==e.personalPhoto})(),Ee=!H&&Ae,Ve=(0,s.Kr)(()=>Z?b:(0,l.Wm)(K||{},b||[],Le),[K,b,Le,Z]);!Ae||ke&&ke===Se&&void 0!==ye.current||(ye.current=Ce?0:c||j);const[_e]=L;(0,s.vJ)(()=>{if(!Ae||_e())return;(0,p.FD)();const e=(0,U.w4)();return()=>{e(),(0,p.wb)()}},[Ae,_e]),(0,s.vJ)(()=>{Ee&&V()},[Ee]),(0,s.vJ)(()=>{fe&&(0,r.RK)(()=>{document.body.classList.toggle("is-media-viewer-open",Ae)})},[fe,Ae]);const Ue=(0,D.A)();(0,s.vJ)(()=>{const e=window.matchMedia(g.wy);return e.addEventListener("change",Ue),()=>{e.removeEventListener("change",Ue)}},[Ue]);const Oe=(0,_.A)(f),Ke=(0,_.A)(H),Je=(0,_.A)(R),Ge=(0,_.A)(ae),je=(0,_.A)(Me),ze=f?(0,A.V)({message:f,forcePlayback:!0,isForMediaViewer:!0}):void 0,He=Boolean(ze),$e=Ke&&Ge!==ae;(0,s.vJ)(()=>{Ne&&Ae&&($e||!Ge)&&((0,s.VK)(Bt+o.xB5),function(e,t,i,s,n,l,c){const{mediaEl:d}=I(t,l,c);if(!d)return;const{width:h}=w.A.get(),{width:m,height:p}=(0,g.$w)(e,n),{width:v,height:A}=(0,g.ky)(m,p,s.width,s.height),f=(h-v)/2,b=function(e){const t=window.matchMedia(g.wy);let i=4.125;return e&&!u.TF&&(i+=t.matches?.875:2.125),i*g.$}(e)+(p-A)/2;let{top:y,left:S,width:k,height:Y}=d.getBoundingClientRect();if([a.TQ.SharedMedia,a.TQ.Album,a.TQ.ScheduledAlbum,a.TQ.SearchResult].includes(t)){const e=function(e,t,i,s,n,a){if(e===t){const o=Math.max(n,a)*(e/t);s-=(o-n)/2,i-=(o-a)/2,n=o,a=o}else if(e>t){const i=n;s-=((n=a*(e/t))-i)/2}else if(t>e){const s=a;i-=((a=n*(t/e))-s)/2}return{top:i,left:s,width:n,height:a}}(v,A,y,S,k,Y);y=e.top,S=e.left,k=e.width,Y=e.height}const F=S+k/2-(f+v/2),D=y+Y/2-(b+A/2),M=k/v,T=Y/A;(0,r.RK)(()=>{const e=N(i||d);(0,C.ZM)(e,{top:`${b}px`,left:`${f}px`,width:`${v}px`,height:`${A}px`,transform:`translate3d(${F}px, ${D}px, 0) scale(${M}, ${T})`}),P(e,t),document.body.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{e.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(e),setTimeout(()=>{(0,r.RK)(()=>{document.body.contains(e)&&document.body.removeChild(e),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(He,R,Me,Be,Fe,f,j)),Ne&&!Ae&&Ge&&((0,s.VK)(Bt+o.xB5),function(e,t,i,s){const{container:n,mediaEl:l}=I(e,i,s);if(!l)return;const c=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!c)return;const{top:d,left:h,width:u,height:m}=c.getBoundingClientRect(),{top:p,left:v,width:g,height:A}=l.getBoundingClientRect();let f=p;if(!(0,k.Y)(n)){const{height:e}=w.A.get();f=p<d?-A:e}const b=h+u/2-(v+g/2),y=d+m/2-(f+A/2);let Y=u/g,F=m/A;const D=[a.TQ.Inline,a.TQ.ScheduledInline,a.TQ.Album,a.TQ.ScheduledAlbum].includes(e)&&!function(e){const t=document.querySelector(".Transition_slide-active > .MessageList"),{top:i}=(0,S.A)(e,t);return i>t.scrollTop&&i+e.offsetHeight<t.scrollTop+t.offsetHeight}(l);[a.TQ.SharedMedia,a.TQ.Album,a.TQ.ScheduledAlbum,a.TQ.SearchResult].includes(e)&&(Y>F?Y=F:F>Y&&(F=Y));const M=document.getElementsByClassName("ghost")[0],T=M||N(t||l,e);let B;if(M){const{top:e,left:t,width:i,height:s}=M.getBoundingClientRect();B={transition:"none",top:`${f}px`,left:`${v}px`,transformOrigin:"top left",transform:`translate3d(${t-v}px, ${e-f}px, 0) scale(${i/g}, ${s/A})`,width:`${g}px`,height:`${A}px`}}else B={top:`${f}px`,left:`${v}px`,width:`${g}px`,height:`${A}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${Y}, ${F})`};(0,r.RK)(()=>{(0,C.ZM)(T,B),M||document.body.appendChild(T),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{M&&(M.style.transition=""),T.style.transform="",D&&(T.style.opacity="0"),P(T,e),setTimeout(()=>{(0,r.RK)(()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(Je,je,Oe,Ge?.mediaIndex))},[Me,Be,He,Ne,Ae,Fe,f,R,je,Ge,Oe,Je,$e,j]);const qe=(0,M.A)(()=>le()),We=(0,M.A)(e=>{e.target instanceof HTMLElement&&e.target.closest("a")||(qe(),t&&c&&(fe?setTimeout(()=>{he({force:!1},{forceSyncOnIOs:!0}),de({chatId:t,threadId:i,messageId:c})},Bt):de({chatId:t,threadId:i,messageId:c})))}),Qe=(0,M.A)(e=>{J&&t&&(ve({isMedia:e,isFullscreen:!0,randomId:J.randomId}),ge({url:J.url}),le())}),Ze=(0,M.A)(()=>{ce({fromChatId:t,messageIds:[c]})});(0,s.vJ)(()=>Ae?(0,m.A)(()=>{qe()}):void 0,[qe,Ae]),(0,s.vJ)(()=>{Fe&&!Re&&(0,d._K)()},[Re,Fe]);const Xe=(0,M.A)(e=>{if(e&&!X){if("avatar"===e.type){if(!(e.mediaIndex>=e.profilePhotos.photos.length-4))return;pe({peerId:e.avatarOwner.id})}"message"===e.type&&Z&&me({chatId:t,threadId:i,currentMediaMessageId:e.message.id})}}),et=(0,M.A)((e,t)=>{if(0===t||Ce)return;if("standalone"===e.type){const{media:i,mediaIndex:s}=e,n=s+t;return n>=0&&n<i.length?{type:"standalone",media:i,mediaIndex:n}:void 0}if("avatar"===e.type){const{avatarOwner:i,profilePhotos:s,mediaIndex:n}=e,a=n+t;return a>=0&&s&&a<s.photos.length?{type:"avatar",avatarOwner:i,profilePhotos:s,mediaIndex:a}:void 0}if("sponsoredMessage"===e.type){const{message:i,mediaIndex:s}=e,n=s+t;return n>=0&&i?{type:"sponsoredMessage",message:i,mediaIndex:n}:void 0}const{message:i,mediaIndex:s}=e,n=(0,l.qG)(i);if(n){const e=s+t;if(e>=0&&e<n.extendedMedia.length)return{type:"message",message:i,mediaIndex:e}}const a=Ve?.indexOf(i.id);if(void 0===a)return;const o=Ve[a+t],r=K?.[o];return r?{type:"message",message:r}:void 0}),tt=(0,M.A)(e=>{if(!e)return void qe();const t="avatar"===e.type?e.avatarOwner.id:"message"===e.type?e.message.chatId:void 0,i="message"===e.type?e.message.id:void 0,s="standalone"===e.type?e.media:void 0;re({origin:R,chatId:t,messageId:i,standaloneMedia:s,mediaIndex:e.mediaIndex,isAvatarView:"avatar"===e.type,withDynamicLoading:Z},{forceOnHeavyAnimation:!0})}),it=(0,M.A)(()=>{if((O?.photos.length||G?.length||Ve?.length||0)<=1||!ae)return void qe();const e=et(ae,-1);e?tt(e):"avatar"===ae.type&&(0,v.L8)(ae.avatarOwner.id)||"standalone"===ae.type||qe()}),st=(0,T.A)();return(0,te.FD)(se.A,{id:"MediaViewer",isOpen:Ae,isHidden:H,shouldAnimateFirstRender:!0,noCloseTransition:$,children:[(0,te.FD)("div",{className:"media-viewer-head",dir:st.isRtl?"rtl":void 0,"data-tauri-drag-region":!(!h.Vq||!u.MP)||void 0,children:[fe&&(0,te.Y)(Q.A,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:st("Close"),onClick:qe,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)(ne.Ay,{activeKey:ye.current,name:we,children:(0,te.Y)(Tt,{item:ae},be?.id)}),(0,te.Y)(ue,{mediaData:Te,isVideo:Fe,item:ae,canUpdateMedia:B,canReportAvatar:xe,onBeforeDelete:it,onReportAvatar:Pe,onCloseMediaViewer:qe,onForward:Ze}),(0,te.Y)(ie,{isOpen:Ie,onClose:Ye,photo:x,peerId:E?.id})]}),(0,te.Y)(Nt,{item:ae,loadMoreItemsIfNeeded:Xe,isLoadingMoreMedia:X,isSynced:ee,getNextItem:et,chatId:t,isPhoto:De,isGif:Re,threadId:i,avatarOwnerId:E?.id,origin:R,isOpen:Ae,hasFooter:He,isVideo:Fe,withAnimation:z,onClose:qe,selectItem:tt,isHidden:H,onFooterClick:We,handleSponsoredClick:Qe})]})}));var Lt=i(2429);const xt="W9A8SEMl",Et="gLHHo5k8",Vt="GJVwqV9e",_t="_Yn4SWUB",Ut="hGCH03qc",Ot="ZecqXqKy",Kt="PVZ8TOWS",Jt="Wi0DXPH2",Gt="Ka1CGfzq",jt="urTtSsk9",zt="AjXOHOgE",Ht="uAlXNXJN",$t="g8ypsnnC",qt="hGTnZuar",Wt="TkphaPyQ",Qt="CvnxnCxN",Zt="nZ30pf4g",Xt="MnNC7VHS",ei="G8OgmMDJ",ti=3.5*g.$,ii=.5*g.$;function si(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=document.createElement("div");s.classList.add(i?"TYicp2_K":"fME2l_yv");const n=new Image;if(n.draggable=!1,n.oncontextmenu=y.A,n.classList.add("HjoURJRK"),t){const t=document.createElement("canvas");t.classList.add(Xt),n.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:i,height:s}=n;(0,r.RK)(()=>{t.width=i,t.height=s,u.QH&&(e.filter="blur(2px)"),e.drawImage(n,-4,-4,i+8,s+8),u.QH||(0,K.A)(e,0,0,i,s,2,2)})},n.src=e,s.appendChild(t)}else n.src=e,s.appendChild(n);return s}function ni(e,t){let i;const s=`#${(0,l.kR)(t)}`;switch(e){case a.G9.StoryRibbon:i=`#LeftColumn .${Lt.A.root}`;break;case a.G9.MiddleHeaderAvatar:i=".MiddleHeader .Transition_slide-active .ChatInfo";break;case a.G9.ChatList:i="#LeftColumn .chat-list";break;case a.G9.SearchResult:i="#LeftColumn .LeftSearch--container"}const n=document.querySelector(i),o=n&&n.querySelectorAll(`${s} img`);return{container:n,mediaEl:o?.[0]}}function ai(e){let{scale:t,slideAmount:i,isActiveSlideSize:s,isMoveThroughActiveSlide:n,isBackward:a}=e;const o=40+(s?405:135),r=(Math.abs(i)-1)*(40+(n?405:135)),l=(0,ve.Ki)((o+r)*t);return a?-l:l}function oi(){const{width:e,height:t}=(0,we.A)();return(0,s.Kr)(()=>function(e,t){const i=function(e,t,i,s){const n=i/1200,a=s/800;return Math.min(n,a)}(0,0,e,t),s=(0,ve.Ki)(405*i),n=(0,ve.Ki)(135*i);return{activeSlide:{width:s,height:(0,ve.Ki)(720*i)},slide:{width:n,height:(0,ve.Ki)(240*i)},scale:i,toActiveScale:s/n,fromActiveScale:n/s}}(e,t),[e,t])}function ri(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=e&&"content"in e,n=e&&"isDeleted"in e,a=!!s&&(0,l.XR)(e),o=s&&Boolean(e.forwardInfo);let r;s&&(e.content.photo?.thumbnail&&(r=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(r=e.content.video.thumbnail.dataUri));const c=s?(0,l.EN)(e):void 0,d=(0,z.A)(c),h=Boolean(s&&e.content.video),u=s&&e.content.video?.noSound,m=s?(0,l.EN)(e,"full"):void 0,p=(0,z.A)(m,!e,h?O.qZ.Progressive:O.qZ.BlobUrl),v=h&&s?(0,l.EN)(e,"full",!0):void 0,g=(0,z.A)(v,!e,O.qZ.Progressive),A=Boolean(p||g),f=h?d:p||d,b=!d&&!A,C=t&&s&&!e.noForwards,y=s?(0,l.EN)(e,"download"):void 0;return{isLoadedStory:s,isDeletedStory:n,hasText:a,hasForwardInfo:o,thumbnail:r,previewHash:c,previewBlobUrl:d,isVideo:h,noSound:u,fullMediaHash:m,fullMediaData:p,altMediaHash:v,altMediaData:g,hasFullData:A,bestImageData:f,hasThumb:b,canDownload:C,downloadMediaData:(0,z.A)(y,!C&&!i)}}var li=i(80140),ci=i(22720),di=i(61361);const hi="RGD70uBt",ui="HCYfPccW",mi="L8oRQyKb",pi=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e);return{isOpen:t.storyViewer?.isStealthModalOpen,stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{isOpen:t,stealthMode:i,isCurrentUserPremium:a}=e;const{toggleStealthModal:o,activateStealthMode:r,showNotification:l,openPremiumModal:c}=(0,n.ko)(),[d,h]=(0,s.J0)(!1);(0,s.vJ)(()=>{if(!i)return;const e=(0,li.Fm)();i.cooldownUntil&&i.cooldownUntil>e&&h(!0)},[i,t]);const u=(0,T.A)(),m=(0,M.A)(()=>{h(!1)}),p=(0,M.A)(()=>{o({isOpen:!1})}),v=(0,M.A)(()=>{a?(r(),l({title:u("StealthModeOn"),message:u("StealthModeOnHint")}),o({isOpen:!1})):c({initialSection:"stories"})});return(0,te.FD)(X.A,{className:"component-theme-dark",contentClassName:"GrE47IXS",isOpen:t,isSlim:!0,onClose:p,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",className:"NlWSF1pA",ariaLabel:u("Close"),onClick:p,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"qKi5jsGM",children:(0,te.Y)(W.A,{name:"eye-crossed-outline"})}),(0,te.Y)("div",{className:"BFctFGoT",children:u("StealthMode")}),(0,te.Y)("div",{className:"fZIJH4IG",children:u(a?"StealthModeHint":"StealthModePremiumHint")}),(0,te.FD)(ci.A,{className:(0,me.A)(hi,"smaller-icon"),multiline:!0,inactive:!0,leftElement:(0,te.Y)(W.A,{name:"stealth-past",className:ui}),children:[(0,te.Y)("span",{className:"title",children:u("HideRecentViews")}),(0,te.Y)("span",{className:(0,me.A)("subtitle",mi),children:u("HideRecentViewsDescription")})]}),(0,te.FD)(ci.A,{className:(0,me.A)(hi,"smaller-icon"),multiline:!0,inactive:!0,leftElement:(0,te.Y)(W.A,{name:"stealth-future",className:ui,"aria-hidden":!0}),children:[(0,te.Y)("span",{className:"title",children:u("HideNextViews")}),(0,te.Y)("span",{className:(0,me.A)("subtitle",mi),children:u("HideNextViewsDescription")})]}),(0,te.Y)(Q.A,{className:"AM_sxoXP",disabled:d,isShiny:!a,withPremiumGradient:!a,onClick:v,children:a?d?(0,te.Y)(di.A,{langKey:"AvailableIn",endsAt:i.cooldownUntil,onEnd:m}):u("EnableStealthMode"):u("UnlockStealthMode")})]})}));var vi=i(94189);const gi=(0,s.ph)(function(e){let{isOpen:t,story:i,onClose:a}=e;const{deleteStory:o,openNextStory:r}=(0,n.ko)(),l=(0,T.A)(),c=(0,s.hb)(()=>{i&&(r(),o({peerId:i.peerId,storyId:i.id}),a())},[a,i]);return(0,te.Y)(vi.A,{isOpen:t,onClose:a,title:l("DeleteStoryTitle"),text:l("DeleteStorySubtitle"),confirmLabel:l("Delete"),confirmHandler:c,confirmIsDestructive:!0,className:"component-theme-dark"})});var Ai=i(21309),fi=i(63152),bi=i(87894),Ci=i(79824),yi=i(54960);const Si=(0,s.ph)(function(e){let{id:t,contactListIds:i,currentUserId:n,selectedIds:a,lockedIds:o,onSelect:r}=e;const l=(0,T.A)(),[c,d]=(0,s.J0)(""),h=(0,s.Kr)(()=>{const e=(i||[]).filter(e=>e!==n);return(0,bi.Am)((0,Ft.PU)({ids:[...a||[],...e],query:c,type:"user"}))},[i,n,c,a]);return(0,te.Y)(yi.A,{itemIds:h,selectedIds:a??Ci.p,lockedSelectedIds:o,filterValue:c,filterPlaceholder:l("Search"),searchInputId:`${t}-picker-search`,isSearchable:!0,withDefaultPadding:!0,forceShowSelf:!0,onSelectedIdsChange:r,onFilterChange:d,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"},t)});var ki=i(82117),wi=i(12933);const Ni=(0,s.ph)(function(e){let{isActive:t,contactListIds:i,usersById:a,currentUserId:o,onClose:r}=e;const{saveCloseFriends:l}=(0,n.ko)(),c=(0,T.A)(),[d,h]=(0,s.J0)(""),[u,m]=(0,s.J0)(!1),[p,v]=(0,s.J0)([]),g=(0,s.Kr)(()=>(i||[]).filter(e=>a[e]?.isCloseFriend),[i,a]),A=(0,s.Kr)(()=>{const e=(i||[]).filter(e=>e!==o);return(0,bi.Am)((0,Ft.PU)({ids:[...g,...e],query:d,type:"user"}))},[g,i,o,d]);(0,ki.A)(e=>{let[i]=e;!i&&t&&(m(!1),v(g))},[t,g]);const f=(0,s.hb)(e=>{v(e),m(!0)},[]),b=(0,M.A)(()=>{l({userIds:p}),r()});return(0,te.FD)(te.FK,{children:[(0,te.Y)(yi.A,{itemIds:A||[],selectedIds:p,filterValue:d,filterPlaceholder:c("Search"),searchInputId:"close-friends-picker-search",isSearchable:!0,withDefaultPadding:!0,onSelectedIdsChange:f,onFilterChange:h,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),(0,te.Y)("div",{className:(0,me.A)("BDK_pgpt",u&&"N8ujSwlC"),children:(0,te.Y)(wi.A,{isShown:u,onClick:b,ariaLabel:c("Save"),children:(0,te.Y)(W.A,{name:"check"})})})]})}),Ii={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"},Pi=[{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 Yi=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(Yi||{});const Fi=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{storyId:t,peerId:i}}=(0,c.nTw)(e),s=i&&t?(0,c.Msb)(e,i,t):void 0;return{story:s&&"content"in s?s:void 0,visibility:s&&"visibility"in s?s.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}})(function(e){let{isOpen:t,story:i,visibility:a,contactListIds:o,usersById:r,currentUserId:c,onClose:d}=e;const{editStoryPrivacy:h,toggleStoryInProfile:u}=(0,n.ko)(),m=(0,T.A)(),[p,v,g]=(0,F.A)(!1),[A,f]=(0,s.J0)(a),[b,C]=(0,s.J0)(i?.isInProfile),[S,k]=(0,s.J0)(Yi.privacy),[w,N]=(0,s.J0)("everybody"),I=S!==Yi.privacy,P=(0,s.Kr)(()=>(o||[]).filter(e=>r[e]?.isCloseFriend),[o,r]),Y=(0,s.Kr)(()=>{if(S===Yi.allowList&&(!A?.allowUserIds?.length||A.allowUserIds[0]===c))return[c]},[S,c,A?.allowUserIds]),D=(0,s.Kr)(()=>w!==A?.visibility?[]:A?.blockUserIds||[],[w,A?.blockUserIds,A?.visibility]),B=(0,M.A)(e=>{f({...A,allowUserIds:e?.length?e?.filter(e=>e!==c):[c]})}),R=(0,M.A)(e=>{f({...A,blockUserIds:e,visibility:w})});(0,s.vJ)(()=>{t&&(k(Yi.privacy),v())},[t]),(0,s.vJ)(()=>{f(a)},[a]);const L=(0,M.A)(()=>{S!==Yi.privacy?k(Yi.privacy):g()}),x=(0,M.A)(()=>{C(!b)}),E=(0,M.A)(()=>{h({peerId:i.peerId,storyId:i.id,privacy:A}),i.isInProfile!==b&&u({peerId:i.peerId,storyId:i.id,isInProfile:b}),g()});return(0,te.FD)(X.A,{isOpen:p,className:(0,me.A)(Ii.modal,"component-theme-dark"),onClose:g,noBackdrop:!0,onCloseAnimationEnd:d,children:[(0,te.FD)("div",{className:Ii.header,children:[(0,te.Y)(Q.A,{className:(0,me.A)(Ii.closeButton,"close-button"),round:!0,color:"translucent",size:"smaller",onClick:L,ariaLabel:m(I?"Common.Back":"Common.Close"),children:(0,te.Y)("div",{className:(0,me.A)("animated-close-icon",I&&"state-back")})}),(0,te.Y)(ne.Ay,{name:"slideFade",activeKey:S,children:function(){switch(S){case Yi.privacy:return(0,te.Y)("h3",{className:Ii.headerTitle,children:m("StoryPrivacyAlertEditTitle")});case Yi.allowList:return(0,te.Y)("h3",{className:Ii.headerTitle,children:m("StoryPrivacyAlertSelectContactsTitle")});case Yi.closeFriends:return(0,te.Y)("h3",{className:Ii.headerTitle,children:m("CloseFriends")});case Yi.denyList:return(0,te.Y)("h3",{className:Ii.headerTitle,children:m("StoryPrivacyAlertExcludedContactsTitle")})}}()})]}),(0,te.Y)(ne.Ay,{activeKey:S,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:Ii.content,children:function(e){switch(S){case Yi.privacy:return function(){const e=i?(0,Ai.qZ)(i.expireDate-i.date):0;return(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:Ii.section,children:[(0,te.Y)("h3",{className:Ii.title,children:m("StoryPrivacyAlertSubtitleProfile")}),(0,te.Y)("div",{className:Ii.list,children:Pi.map(e=>{return(0,te.FD)("label",{className:(0,me.A)(Ii.option,e.value===A?.visibility&&Ii.checked),children:[(0,te.Y)("input",{type:"radio",name:"story_privacy",className:Ii.input,value:e.value,checked:e.value===A?.visibility,onChange:()=>{return t=e.value,void f({...A,visibility:t});var t},teactExperimentControlled:!0}),(0,te.Y)("span",{className:Ii.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`,children:(0,te.Y)(W.A,{name:e.icon})}),(0,te.FD)("div",{className:Ii.optionContent,children:[(0,te.Y)("span",{className:(0,me.A)(Ii.option_name),children:m(e.name)}),e.actions&&(0,te.FD)("div",{tabIndex:0,role:"button",className:Ii.action,"aria-label":m("Edit"),onClick:t=>{!function(e,t){switch((0,y.A)(e),t){case"closeFriends":k(Yi.closeFriends);break;case"allowUserIds":k(Yi.allowList);break;case"blockUserIds":k(Yi.denyList),N("everybody");break;case"blockContactUserIds":k(Yi.denyList),N("contacts")}}(t,e.actions)},children:[(0,te.Y)("span",{className:Ii.actionInner,children:(t=e.actions,"closeFriends"===t?0===P.length?m("StoryPrivacyOptionCloseFriendsDetail"):1===P.length?(0,Ft.F9)(m,r[P[0]]):m("StoryPrivacyOptionPeople",P.length,"i"):"blockUserIds"===t&&"everybody"===A?.visibility||"blockContactUserIds"===t&&"contacts"===A?.visibility?A?.blockUserIds?.length?1===A.blockUserIds.length?m("StoryPrivacyOptionExcludePerson",(0,l.Yg)(r[A.blockUserIds[0]])):m("StoryPrivacyOptionExcludePeople",A.blockUserIds.length,"i"):m("StoryPrivacyOptionContactsDetail"):A?.allowUserIds&&0!==A.allowUserIds.length?1===A.allowUserIds.length?(0,l.Yg)(r[A.allowUserIds[0]]):m("StoryPrivacyOptionPeople",A.allowUserIds.length,"i"):m("StoryPrivacyOptionSelectedContactsDetail"))}),(0,te.Y)(W.A,{name:"next"})]})]})]},e.value);var t})})]}),(0,te.Y)("div",{className:Ii.section,children:(0,te.FD)(ci.A,{ripple:!0,onClick:x,children:[(0,te.Y)("span",{children:m("StoryKeep")}),(0,te.Y)(fi.A,{id:"group-notifications",label:m("StoryKeep"),checked:b,inactive:!0})]})}),(0,te.FD)("div",{className:Ii.footer,children:[(0,te.Y)("div",{className:Ii.info,children:m("StoryKeepInfo",e)}),(0,te.Y)("div",{className:Ii.submit,children:(0,te.Y)(Q.A,{onClick:E,children:m("StoryPrivacyButtonSave")})})]})]})}();case Yi.closeFriends:return(0,te.Y)(Ni,{isActive:e,contactListIds:o,currentUserId:c,usersById:r,onClose:L},"close-friends");case Yi.denyList:return(0,te.Y)(Si,{id:"deny-list",contactListIds:o,currentUserId:c,selectedIds:D,onSelect:R},"deny-list");case Yi.allowList:return(0,te.Y)(Si,{id:"allow-list",contactListIds:o,lockedIds:Y,currentUserId:c,selectedIds:A?.allowUserIds,onSelect:B},"allow-list")}}})]})}));var Di=i(95807),Mi=i(36353),Ti=i(73104),Bi=i(14),Ri=i(52674),Li=i(95362),xi=i(48775),Ei=i(46051),Vi=i(45470),_i=i(39351),Ui=i(38218),Oi=i(83057),Ki=i(66991),Ji=i(61157),Gi=i(92111),ji=i(22081),zi=i(65843),Hi=i(55158),$i=i(59816),qi=i(61433),Wi=i(91800),Qi=i(23565),Zi=i(35049),Xi=i(18501),es=i(11217),ts=i(86070),is=i(39877);const ss=(0,s.ph)((0,n.EK)((e,t)=>{let{forwardInfo:i}=t;return{sender:i.fromPeerId?(0,c.PVB)(e,i.fromPeerId):void 0,story:i.storyId&&i.fromPeerId?(0,c.Msb)(e,i.fromPeerId,i.storyId):void 0}})(e=>{let{className:t,forwardInfo:i,sender:a,story:o}=e;const{openStoryViewer:r,loadPeerStoriesByIds:l,openChat:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,T.A)();(0,s.vJ)(()=>{!o&&i.fromPeerId&&i.storyId&&l({peerId:i.fromPeerId,storyIds:[i.storyId]})},[i,o]);const u=a?(0,Ft.F9)(h,a):i.fromName,m=(0,M.A)(()=>{const{fromPeerId:e,storyId:t}=i;e&&(!o||"isDeleted"in o&&o.isDeleted?c({id:e}):r({peerId:e,storyId:t,isSingleStory:!0}))}),{handleClick:p,handleMouseDown:g}=(0,es.Q)(m);return(0,te.FD)(ts.A,{ref:d,className:(0,me.A)("EmbeddedMessage",t,(0,Zi.y)(a,!0,!0)),dir:h.isRtl?"rtl":void 0,onClick:p,onMouseDown:g,children:[a?.color?.backgroundEmojiId&&(0,te.Y)(is.A,{emojiDocumentId:a.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),(0,te.FD)("div",{className:"message-text",children:[function(){if(o&&"content"in o&&o.content.text)return(0,te.Y)("p",{className:"embedded-text-wrapper",children:(0,Xi.fd)(o.content.text)})}(),(0,te.Y)("div",{className:"message-title",children:function(){if(!a||!u)return;const e=(0,v.L8)(a.id)?"user-filled":"channel-filled";return(0,te.FD)(te.FK,{children:[e&&(0,te.Y)(W.A,{name:e,className:"embedded-chat-icon"}),u&&(0,Dt.A)(u)]})}()})]})]})}));var ns=i(74936);const as=(0,s.ph)(function(e){let{story:t,isExpanded:i,className:n,onExpand:a,onFold:o}=e;const l=(0,T.A)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(),u=(0,s.li)(),m=(0,Bi.A)(t,!0),p=m?.content.text,[v,g]=(0,s.J0)(!1),A=(0,Qi.A)(i||void 0,400),f=i||A;(0,s.vJ)(()=>{(0,r.RK)(()=>{d.current&&(i?(0,qi.YM)(d.current,Qt):(0,qi.HW)(d.current,Qt))})},[i]);const b=v&&!f,{shouldRender:C,transitionClassNames:y}=(0,Ke.A)(b,void 0,!0,"slow",!0);(0,s.Nf)(()=>{(0,r.YS)(()=>{const e=d.current,t=u.current;if(!e||!t)return;const{offsetWidth:i}=t;(0,r.RK)(()=>{e.style.setProperty("--expand-button-width",`${i}px`)})})},[C,l]),(0,s.Nf)(()=>{(0,r.gm)(()=>{if(!d.current||!h.current)return;const e=d.current,t=h.current,i=t.offsetTop,{lineHeight:s,totalLines:n}=(0,Wi.A)(t),a=n>3,o=i+3*s;return()=>{a&&((0,qi.YM)(e,"e1gyTmKe"),g(!0)),e.style.setProperty("--_overflow-shift",`${o}px`)}})},[p]),(0,s.vJ)(()=>{i||c.current?.scrollTo({top:0})},[i]);const S=(0,me.A)("ilyTRZtw",f&&"HIMnUViv",C&&"Vq8pl_kQ");return(0,te.FD)("div",{className:(0,me.A)("RKedwa0I",n),children:[(0,te.Y)("div",{ref:d,className:S,role:b?"button":void 0,onClick:b?a:o,children:(0,te.FD)("div",{ref:c,className:(0,me.A)("D_5mWNmi","allow-selection","custom-scroll"),children:[m?.forwardInfo&&(0,te.Y)(ss,{forwardInfo:m.forwardInfo,className:"_M8CgT7s"}),m&&p&&(0,te.Y)("div",{ref:h,className:"hmFA5qb1",children:(0,te.Y)(ns.A,{messageOrStory:m,withTranslucentThumbs:!0,forcePlayback:!0})})]})}),C&&(0,te.Y)("div",{ref:u,className:(0,me.A)("bM5rlQtM",y),onClick:a,children:l("Story.CaptionShowMore")})]})});var os=i(26875),rs=i(11241);const ls="YVD19vOP",cs="vJRk_UUk",ds="nIv3YAnZ",hs=(0,s.ph)(e=>{let{story:t,className:i}=e;const{openStoryViewModal:a,openForwardMenu:r,sendStoryReaction:c}=(0,n.ko)(),d=(0,T.A)(),{views:h,isOut:u,peerId:m,id:p,sentReaction:g}=t,{viewsCount:A,forwardsCount:f,reactionsCount:b}=h||{},C=!(0,v.L8)(m),y=g&&(0,l.a0)(g,o.tNZ),S=Boolean((u||C)&&t.isPublic&&!t.noForwards),k=(0,l.$_)(m,p),w=(0,s.Kr)(()=>{const{users:{byId:e}}=(0,n.mS)(),t=h&&"recentViewerIds"in h?h.recentViewerIds:void 0;if(t)return t.map(t=>e[t]).filter(Boolean)},[h]),N=(0,M.A)(()=>{a({storyId:p})}),I=(0,M.A)(()=>{r({fromChatId:m,storyId:p})}),P=(0,M.A)(()=>{const e=g?void 0:o.tNZ;c({peerId:m,storyId:p,containerId:k,reaction:e})});return A?(0,te.FD)("div",{className:(0,me.A)(ls,i),children:[(0,te.FD)("div",{className:(0,me.A)("cknL5COh",!C&&"pJAyeGkG"),onClick:C?void 0:N,children:[Boolean(w?.length)&&(0,te.Y)(os.A,{size:"small",peers:w,className:"Vz_VtJ16"}),C?(0,te.FD)("span",{className:ds,children:[(0,te.Y)(W.A,{name:"channelviews",className:"WyBiNM6e"}),A]}):(0,te.Y)("span",{className:ds,children:d("Views",A,"i")}),Boolean(b)&&!C&&(0,te.FD)("span",{className:"sf3u_6Vh",children:[(0,te.Y)(W.A,{name:"heart",className:"Er2XKRqi"}),b]})]}),(0,te.Y)("div",{className:"kKoeDk3Z"}),S&&(0,te.Y)(Q.A,{color:"translucent",size:"smaller",round:!0,onClick:I,ariaLabel:d("Forward"),className:cs,children:(0,te.Y)(W.A,{name:"forward"})}),C&&(0,te.FD)(te.FK,{children:[Boolean(f)&&(0,te.FD)("div",{className:cs,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:d("PublicShares"),children:(0,te.Y)(W.A,{name:"loop"})}),(0,te.Y)("span",{children:f})]}),(0,te.FD)("div",{className:cs,children:[(0,te.FD)(Q.A,{round:!0,className:"lpDXVIuf",color:"translucent",size:"smaller",onClick:P,ariaLabel:d("AccDescrLike"),children:[g&&(0,te.Y)(rs.A,{containerId:k,reaction:g,withEffectOnly:y},(0,l.Jj)(g)),(!g||y)&&(0,te.Y)(W.A,{name:y?"heart":"heart-outline",className:(0,me.A)(y&&"twgMDT1y")})]}),Boolean(b)&&(0,te.Y)("span",{children:b})]})]})]}):(0,te.Y)("div",{className:(0,me.A)(ls,i),children:d("NobodyViewed")})}),us=6,ms=(0,s.ph)(function(e){let{isActive:t,isViewed:i,isVideo:s,duration:n=us,isPaused:a,onImageComplete:o}=e;const r=(0,M.A)(e=>{s||"XY98E7VM"!==e.animationName||o()}),l=(0,me.A)("c1fbGgcx",i&&"xwOKghO2",t&&"ZuByYcIx",a&&"n9V6B7hP");return(0,te.Y)("span",{className:l,"aria-hidden":!0,children:t&&(0,te.Y)("i",{style:`--progress-duration: ${n}s`,className:"qyBCpJct",onAnimationEnd:r})})}),ps=u.Yw?4:3,vs=(0,s.ph)((0,n.EK)((e,t)=>{let{peerId:i,storyId:s,isDeleteModalOpen:n}=t;const{appConfig:a}=e,o=(0,c.mBe)(e,i),r=(0,c.hds)(e,i),l=(0,c.vGo)(e,i),d=(0,c.nTw)(e),{storyViewer:{isMuted:h,viewModal:u,isPrivacyModalOpen:m,isStealthModalOpen:p,storyList:v},forwardMessages:{storyId:g},premiumModal:A,safeLinkModalUrl:f,mapModal:b,reportModal:C,giftInfoModal:y,isPaymentMessageConfirmDialogOpen:S}=d,{isOpen:k}=A||{},w=(0,c.Msb)(e,i,s),N=w&&"content"in w,I=Boolean(S||u||g||d.reactionPicker?.storyId||C||m||k||n||f||p||b||y),P=N?w.forwardInfo:void 0,Y=N?w.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=N&&w.fromId?(0,c.PVB)(e,w.fromId):void 0,B=(0,c.WA9)(e,i),R=(0,c.trm)(e);return{peer:o||r,forwardSender:D,fromPeer:T,story:w,orderedIds:v?.storyIdsByPeerId[i],isMuted:h,isCurrentUserPremium:(0,c.g29)(e),shouldForcePause:I,storyChangelogUserId:a.storyChangelogUserId,viewersExpirePeriod:a.storyViewersExpirePeriod,isChatExist:Boolean(r),arePeerSettingsLoaded:Boolean(l?.settings),stealthMode:e.stories.stealthMode,withHeaderAnimation:M,paidMessagesStars:B,isAccountFrozen:R}})(function(e){let{peerId:t,storyId:i,peer:a,forwardSender:r,fromPeer:c,isMuted:d,isArchivedStories:h,isPrivateStories:u,story:m,orderedIds:p,isSingleStory:g,dimensions:A,shouldForcePause:f,storyChangelogUserId:b,viewersExpirePeriod:C,isChatExist:y,arePeerSettingsLoaded:S,getIsAnimating:k,isCurrentUserPremium:w,stealthMode:N,withHeaderAnimation:I,onDelete:P,onClose:D,onReport:B,paidMessagesStars:R,isAccountFrozen:L}=e;const{viewStory:x,setStoryViewerMuted:E,openPreviousStory:V,openNextStory:_,loadPeerSkippedStories:U,openForwardMenu:K,copyStoryLink:J,toggleStoryInProfile:G,openChat:j,showNotification:z,openStoryPrivacyEditor:H,loadPeerSettings:$,fetchChat:q,loadStoryViews:Z,toggleStealthModal:X}=(0,n.ko)(),ee=(0,li.Fm)(),ie=(0,T.A)(),se=(0,_i.A)(),{isMobile:ae}=(0,Y.Ay)(),[oe,re,le]=(0,F.A)(!1),[he,ue,pe]=(0,F.A)(!1),[ge,Ae,fe]=(0,F.A)(!1),[be,Ce,ye]=(0,F.A)(!0),[Se,ke,we]=(0,F.A)(!1),[Ne,Ie]=(0,s.J0)(!1),[Pe,Ye,Fe]=(0,F.A)(!1),[De,Me,Te]=(0,F.A)(!1),Be=(0,s.li)(),{isDeletedStory:Re,hasText:Le,hasForwardInfo:xe,thumbnail:Ee,previewBlobUrl:Ve,isVideo:_e,noSound:Oe,fullMediaData:Je,altMediaHash:Ge,altMediaData:je,hasFullData:ze,hasThumb:$e,canDownload:qe,downloadMediaData:We}=ri(m,w,De),Qe=m&&"content"in m,Ze=t===b,Xe=(0,v.L8)(t),et=!Xe,tt=et&&(0,l.WX)(a),it=Qe&&m.isOut,st=(0,Bi.A)(it?!m.isInProfile:void 0,!0),nt=(0,Bi.A)(it?m.isInProfile:void 0,!0),at=Boolean(it&&m.date+C<(0,li.Fm)()),ot=r?(0,Ft.F9)(ie,r):Qe&&m.forwardInfo?.fromName,rt=Boolean(Qe&&m.isPublic&&!Ze&&a?.hasUsername),lt=Boolean(Qe&&m.isPublic&&!m.noForwards&&!Ze&&!Se),ct=Boolean(ze&&!f&&be&&!oe&&!Se&&!Ne&&!Pe),dt=Qe&&m.content.video?.duration?m.content.video.duration:void 0,ht=!(it&&Xe||Ze||tt||L),ut=Qe&&!ht&&(it||tt),mt=ae&&I?"slideFade":"none",{shouldRender:pt,transitionClassNames:vt}=(0,Ke.A)(!ze),{transitionClassNames:gt}=(0,Ke.A)(Boolean(Je)),At=(0,Vi.A)(Ee,!$e),ft=(0,Oi.A)(Ve),{shouldRender:bt,transitionClassNames:Ct}=(0,Ke.A)(ht),{shouldRender:yt,transitionClassNames:St}=(0,Ke.A)(Le&&Se),{transitionClassNames:kt}=(0,Ke.A)(!0),{shouldRender:wt,transitionClassNames:Nt}=(0,Ke.A)(Le||xe),It=(0,Ki.Y)(Be,Je,Ei.G);(0,Gi.A)(t,i),(0,s.vJ)(()=>{i&&x({peerId:t,storyId:i})},[i,t]),(0,s.vJ)(()=>{U({peerId:t})},[t]),(0,s.vJ)(()=>{const e=(0,v.L8)(t);!y&&e&&q({chatId:t})},[y,t]),(0,s.vJ)(()=>{y&&!S&&$({peerId:t})},[S,y,t]);const Pt=(0,M.A)(()=>{_e&&Be.current?.pause(),fe(),pe()}),Yt=(0,M.A)(()=>{ct&&(ue(),_e||Ae())}),Tt=(0,M.A)(()=>{Ye()}),Bt=(0,M.A)(()=>{Fe()}),Rt=(0,M.A)(()=>{Me(),Pt()}),Lt=(0,M.A)(()=>{Te(),Yt()}),{onMouseDown:Et,onMouseUp:Vt,onMouseLeave:_t,onTouchStart:Ot,onTouchEnd:jt}=(0,Ui.A)({onStart:Tt,onEnd:Bt}),zt=(0,Ue.A)(Be,void 0,!_e||!Je||It),Ht=Je&&(!Ge||je);(0,s.vJ)(()=>{Ht&&!zt&&Yt()},[Ht,zt]),(0,Ji.Ay)(ye,Ce),(0,s.vJ)(()=>{Ht&&Be.current?.load()},[Ht]),(0,s.vJ)(()=>{!Qe||Re||at||(it||tt)&&Z({peerId:t,storyId:i})},[Re,at,Qe,t,i,it,tt]),(0,s.vJ)(()=>{f||!be||oe||Se||Ne||Pe?Pt():Yt()},[Yt,be,Se,oe,f,Ne,Pe]),(0,s.vJ)(()=>{if(!(oe||f||Se))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),Ie(!Ne))}},[Se,oe,Ne,f]),(0,ki.A)(e=>{let[t,i,s,n,a]=e;!Ne||Se||oe||f||!be||Pe||i===Se&&t===oe&&s===f&&n===be&&a===Pe||Ie(!1)},[oe,Se,f,be,Pe,Ne]);const Qt=(0,M.A)(()=>{D(),j({id:t})}),ti=(0,M.A)(()=>{D(),j({id:r.id})}),ii=(0,M.A)(()=>{D(),j({id:c.id})}),si=(0,M.A)(()=>{V()}),ni=(0,M.A)(()=>{_()}),ai=(0,M.A)(e=>{const t=e.currentTarget;t.readyState>=ps?Ae():fe(),dt&&(0,ve.LI)(t.currentTime,2)>=(0,ve.LI)(dt,2)&&ni()});(0,s.vJ)(()=>k()||oe?void 0:(0,Ri.A)({onRight:ni,onLeft:si}),[k,oe]);const oi=(0,M.A)(()=>{J({peerId:t,storyId:i})}),ci=(0,M.A)(()=>{G({peerId:t,storyId:i,isInProfile:!0})}),di=(0,M.A)(()=>{G({peerId:t,storyId:i,isInProfile:!1})}),hi=(0,M.A)(()=>{P(m)}),ui=(0,M.A)(()=>{B()}),mi=(0,M.A)(()=>{K({fromChatId:t,storyId:i})}),pi=(0,M.A)(()=>{H()}),vi=(0,M.A)(()=>{const e=!Qe||m.isPublic?void 0:m.isForContacts?"contacts":m.isForCloseFriends?"closeFriends":"nobody";let t;const i=(0,Ft.F9)(ie,a);switch(e){case"nobody":t=ie("StorySelectedContactsHint",i);break;case"contacts":t=ie("StoryContactsHint",i);break;case"closeFriends":t=ie("StoryCloseFriendsHint",i);break;default:return}z({message:t})}),gi=(0,M.A)(()=>{Oe?z({message:ie("Story.TooltipVideoHasNoSound")}):(Be.current.muted=!Be.current.muted,E({isMuted:!d}))}),Ai=(0,M.A)(()=>{if(N.activeUntil&&(0,li.Fm)()<N.activeUntil){const e=N.activeUntil-(0,li.Fm)();z({title:ie("StealthModeOn"),message:ie("Story.ToastStealthModeActiveText",(0,He.QO)(e)),duration:4e3})}else X({isOpen:!0})}),fi=(0,M.A)(()=>{We&&(0,Li.A)(We,`story-${t}-${i}.${_e?"mp4":"jpg"}`)});(0,s.vJ)(()=>{Re&&z({message:ie("StoryNotFound")})},[ie,Re]);const bi=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{round:!0,ripple:!ae,size:"tiny",color:"translucent-white",onClick:t,className:(0,me.A)(Wt,i&&"active"),ariaLabel:ie("AccDescrOpenMenu2"),children:(0,te.Y)(W.A,{name:"more"})})},[ae,ie]);const Ci=R?se("ComposerPlaceholderPaidReply",{amount:(0,xi.U2)(se,R,{asFont:!0,className:"placeholder-star-icon"})},{withNodes:!0}):ie(et?"ReplyToGroupStory":"ReplyPrivately");return(0,te.FD)("div",{className:(0,me.A)($t,"component-theme-dark"),onMouseDown:Et,onMouseUp:Vt,onMouseLeave:_t,onTouchStart:Ot,onTouchEnd:jt,children:[(0,te.FD)("div",{className:(0,me.A)("e7HHuS1g",kt),children:[(0,te.Y)("div",{className:"jGDd2sza",children:(g?[i]:p??[]).map(e=>(0,te.Y)(ms,{isActive:e===m?.id,isVideo:_e,isViewed:Boolean(m?.id&&(u||h?e>m?.id:e<m?.id)),isPaused:!ge,duration:dt,onImageComplete:ni},`progress-${e}`))}),(0,te.FD)("div",{className:"eMYhXF_X",children:[(0,te.Y)(ne.Ay,{activeKey:Number(t),name:mt,className:"PXnfXZur",children:(0,te.FD)("div",{className:"WpyVfrsc",children:[(0,te.Y)(Mt.A,{peer:a,size:"tiny",onClick:Qt}),(0,te.FD)("div",{className:"jmKI_lhC",children:[(0,te.Y)("span",{onClick:Qt,className:"H1uod43o",children:(0,Dt.A)((0,Ft.F9)(ie,a)||"")}),(0,te.FD)("div",{className:"zimpR8Hz",children:[ot&&(0,te.FD)("span",{className:(0,me.A)(qt,"JJFtefb9",r&&"BsqMBS2I"),onClick:r?ti:void 0,children:[(0,te.Y)(W.A,{name:"loop"}),(0,te.Y)("span",{className:ei,children:(0,Dt.A)(ot)})]}),c&&(0,te.FD)("span",{className:(0,me.A)(qt,"nJr8QgYX"),onClick:ii,children:[(0,te.Y)(Mt.A,{peer:c,size:"micro"}),(0,te.Y)("span",{className:ei,children:(0,Dt.A)((0,Ft.F9)(ie,c)||"")})]}),m&&"date"in m&&(0,te.Y)("span",{className:qt,children:(0,He.jy)(ie,ee,m.date)}),Qe&&m.isEdited&&(0,te.Y)("span",{className:qt,children:ie("Story.HeaderEdited")})]})]})]})}),(0,te.FD)("div",{className:"GrsJNw3y",children:[function(){if(!Xe)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}=m&&"visibility"in m&&m.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(!m||!("content"in m)||m.isPublic)return;e=m.isForCloseFriends?"favorite-filled":m.isForContacts?"user-filled":"group-filled"}return(0,te.FD)("div",{className:(0,me.A)("prxptFFf",it&&"_MVsZpgB"),onClick:it?pi:vi,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`,children:[(0,te.Y)(W.A,{name:e}),it&&(0,te.Y)(W.A,{name:"next"})]})}(),_e&&(0,te.Y)(Q.A,{className:Wt,round:!0,ripple:!ae,size:"tiny",color:"translucent-white",disabled:!ze,onClick:gi,ariaLabel:ie("Volume"),children:(0,te.Y)(W.A,{name:d||Oe?"speaker-muted-story":"speaker-story"})}),(0,te.FD)(ce.A,{className:"K0_xAdzf",trigger:bi,positionX:"right",onOpen:Rt,onClose:Lt,children:[rt&&(0,te.Y)(de.A,{icon:"copy",onClick:oi,children:ie("CopyLink")}),st&&(0,te.Y)(de.A,{icon:"save-story",onClick:ci,children:ie(Xe?"StorySave":"SaveToPosts")}),nt&&(0,te.Y)(de.A,{icon:"delete",onClick:di,children:ie(Xe?"ArchiveStory":"RemoveFromPosts")}),qe&&(0,te.Y)(de.A,{icon:"download",disabled:!We,onClick:fi,children:ie("lng_media_download")}),!it&&Xe&&(0,te.Y)(de.A,{icon:"eye-crossed-outline",onClick:Ai,children:ie("StealthMode")}),!it&&(0,te.Y)(de.A,{icon:"flag",onClick:ui,children:ie("lng_report_story")}),it&&(0,te.Y)(de.A,{icon:"delete",destructive:!0,onClick:hi,children:ie("Delete")})]}),(0,te.Y)(Q.A,{className:(0,me.A)(Wt,"WlLsjJ2Z"),round:!0,size:"tiny",color:"translucent-white",ariaLabel:ie("Close"),onClick:D,children:(0,te.Y)(W.A,{name:"close"})})]})]})]}),(0,te.FD)("div",{className:"YiuvOPgT",style:`width: ${A.width}px; height: ${A.height}px`,children:[(0,te.Y)("canvas",{ref:At,className:Xt}),Ve&&(0,te.Y)("img",{src:Ve,draggable:!1,alt:"",className:(0,me.A)(Kt,"lQfkulvp",ft)},`preview-${i}`),pt&&(0,te.Y)(Hi.A,{className:(0,me.A)(vt,xt)}),!_e&&Je&&(0,te.Y)("img",{src:Je,alt:"",className:(0,me.A)(Kt,gt),draggable:!1}),_e&&Je&&(0,te.FD)(zi.A,{ref:Be,className:(0,me.A)(Kt,gt),canPlay:he,muted:d,width:720,height:1280,draggable:!1,playsInline:!0,disablePictureInPicture:!0,isPriority:!0,onPause:fe,onWaiting:fe,disableRemotePlayback:!0,onTimeUpdate:ai,children:[(0,te.Y)("source",{src:Je,type:Ei.G,width:"720"}),je&&(0,te.Y)("source",{src:je,type:Ei.w,width:"480"})]},`video-${i}`),!Pe&&!oe&&(0,te.FD)(te.FK,{children:[(0,te.Y)("button",{type:"button",className:(0,me.A)(Zt,"SXpRZiax"),onClick:si,"aria-label":ie("Previous")}),(0,te.Y)("button",{type:"button",className:(0,me.A)(Zt,"twOBFwUE"),onClick:ni,"aria-label":ie("Next")})]}),Qe&&Je&&(0,te.Y)($i.A,{story:m,isActive:!0,isStoryPlaying:De},`area-overlay-${i}-${t}`),!ae&&(0,te.Y)("div",{className:Ut,children:(0,te.FD)("div",{className:Jt,children:[(0,te.Y)(Mt.A,{peer:a,withStory:!0,storyViewerMode:"disabled"}),(0,te.Y)("div",{className:Gt,children:(0,Dt.A)((0,Ft.F9)(ie,a)||"")})]})})]}),ut&&(0,te.Y)(hs,{story:m,className:kt}),yt&&(0,te.Y)("div",{tabIndex:0,role:"button",className:(0,me.A)("Jd1DYS6Y",St),onClick:()=>we(),"aria-label":ie("Close")}),Le&&(0,te.Y)("div",{className:(0,me.A)("sHNAfxzf",Nt)}),wt&&(0,te.Y)(as,{story:m,isExpanded:Se,onExpand:ke,onFold:we,className:Nt},`caption-${i}-${t}`),bt&&(0,te.Y)(ji.A,{type:"story",chatId:t,threadId:O.l3,storyId:i,isReady:!it,messageListType:"thread",isMobile:(0,Y.Ny)(),editableInputCssSelector:o.iKt,editableInputId:o.YVZ,inputId:"story-input-text",className:(0,me.A)("FXineBYO",Ct),inputPlaceholder:Ci,onForward:lt?mi:void 0,onFocus:re,onBlur:le})]})})),gs=(0,s.ph)((0,n.EK)((e,t)=>{let{peer:i}=t;const{storyViewer:{lastViewedByPeerId:s,origin:n,storyList:a}}=(0,c.nTw)(e);return{lastViewedId:i?.id?s?.[i.id]:void 0,origin:n,storyIdsForViewer:i?.id?a?.storyIdsByPeerId[i.id]:void 0}})(function(e){let{peer:t,peerStories:i,lastViewedId:a,storyIdsForViewer:o,origin:r}=e;const{openStoryViewer:c,loadPeerSkippedStories:d}=(0,n.ko)(),h=(0,T.A)(),u=(0,s.Kr)(()=>{if(!i)return;const{orderedIds:e,lastReadId:t,byId:s}=i,n=e[e.length-1]!==t,r=a&&o?.includes(a)?a??(n?t??-1:-1):-1;return s[s[r]?.id||o?.[0]||e[0]]},[a,i,o]),m=u&&"content"in u;(0,s.vJ)(()=>{u&&!m&&d({peerId:u.peerId})},[u,m]);const p=m?u.content.video:void 0,v=m?(0,l.EN)(u):void 0,g=(0,z.A)(v)||p?.thumbnail?.dataUri;if(t&&u&&!("isDeleted"in u))return(0,te.FD)("div",{className:$t,onClick:()=>{c({peerId:u.peerId,storyId:u.id,origin:r})},children:[g&&(0,te.Y)("img",{src:g,alt:"",className:Kt,draggable:!1}),m&&(0,te.Y)($i.A,{story:u}),(0,te.Y)("div",{className:Ut,children:(0,te.FD)("div",{className:Jt,children:[(0,te.Y)(Mt.A,{peer:t,withStory:!0,storyViewerMode:"disabled"}),(0,te.Y)("div",{className:Gt,children:(0,Dt.A)((0,Ft.F9)(h,t)||"")})]})})]})}));var As=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(As||{});const fs=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{peerId:t,storyId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o,storyList:r}}=(0,c.nTw)(e),{byPeerId:l,orderedPeerIds:{active:d}}=e.stories;return{byPeerId:l,peerIds:r?.peerIds??d,currentPeerId:t,currentStoryId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o}},e=>(0,c.gd2)(e))(function(e){let{peerIds:t,currentPeerId:i,currentStoryId:a,isOpen:d,isSinglePeer:h,isSingleStory:m,isPrivate:p,isArchive:v,byPeerId:g,isDeleteModalOpen:A,onDelete:f,onClose:b,onReport:C}=e;const{stopActiveReaction:y}=(0,n.ko)(),S=(0,s.li)(),[k,w]=(0,s.J0)(i),[N,I]=(0,s.J0)(a),P=(0,_.A)(i),F=(0,Bi.A)(v,!0),D=(0,Bi.A)(p,!0),T=(0,Bi.A)(h,!0),B=(0,Bi.A)(m,!0),R=oi(),{height:L,width:x}=(0,we.A)(),E=(0,s.li)(void 0),V=(0,s.li)(!1),{isMobile:U}=(0,Y.Ay)(),O=(0,s.li)({}),[K,J]=(0,s.Ul)(!1);function G(e,t){e&&(O.current[t]?O.current[t].current=e:O.current[t]={current:e})}(0,Ce.A)({isActive:d,onBack:b,shouldBeReplaced:!0});const j=(0,s.Kr)(()=>{if(k&&(T||B))return[k];const e=k?t.indexOf(k):-1;if(!k||-1===e)return[];const i=Math.max(e-4,0),s=Math.min(e+5,t.length);return t.slice(i,s)},[B,T,k,t]),z=(0,s.Kr)(()=>j.length&&k?j.indexOf(k):-1,[k,j]),H=(0,s.Kr)(()=>j.length&&i?j.indexOf(i):-1,[i,j]);(0,s.vJ)(()=>{U&&w(i)},[i,U]),(0,s.vJ)(()=>{k===i&&a!==N&&I(a)},[i,a,k,N]),(0,s.vJ)(()=>{if(!U)return P&&P!==i&&J(!0),()=>{J(!1)}},[P,i,J,U]),(0,s.vJ)(()=>()=>{a&&i&&y({containerId:(0,l.$_)(i,a)})},[a,i]);const $=H-z,q=z>H,W=(0,M.A)(()=>t.reduce((e,s,n)=>{if(s===k)e[s]=ai({scale:R.scale,slideAmount:$,isBackward:q,isActiveSlideSize:q});else{let a=!1;!q&&n>0&&t[n-1]===k&&(a=!0),q&&n<t.length-1&&t[n+1]===k&&(a=!0),e[s]=ai({scale:R.scale,slideAmount:$,isBackward:q,isActiveSlideSize:i===s&&!q,isMoveThroughActiveSlide:a})}return e},{}));(0,s.vJ)(()=>{if(!S.current||!d)return;let e=0;const t=()=>k?O.current[k]?.current:void 0,i=i=>{if(V.current)return void(V.current=!1);const s=t();if(s)if(e<-50){const e=document.getElementById(o.YVZ);e&&(0,r.RK)(()=>{(0,Mi.A)(e)})}else e>50?(b(),"wheel"===i.type&&((0,Ti.M6)(),setTimeout(Ti.v5,1500))):(0,r.RK)(()=>{s.style.setProperty("--slide-translate-y","0px")})};return(0,pe.wJ)(S.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(s,n,a)=>{let{dragOffsetX:o,dragOffsetY:l}=a;if(V.current)return;if(u.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=pe.h6||e>=x-pe.h6)return}if("mousemove"===s.type)return;const c=Math.abs(o),d=Math.abs(l),h=t();if(h&&(E.current===As.Vertical||Math.abs(d)>pe.no||d/c>pe.fG)){E.current=As.Vertical;const t=L;e=(0,ve.qE)(l,-t,t),e>0&&(0,r.RK)(()=>{h.style.setProperty("--slide-translate-y",e*(U?1:-1)+"px")}),"wheel"===s.type&&Math.abs(e)>100&&(i(s),V.current=!0)}},onRelease:i})},[d,b,x,L,U,k]),(0,s.Nf)(()=>{if(U)return;const e=W();Object.entries(O.current).forEach(t=>{let[s,{current:n}]=t;if(!n)return;if(!K())return n.classList.remove(Vt,_t,Ot),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(R.toActiveScale));let a=0;s===k&&(a=-1.75*R.fromActiveScale,n.classList.add(Ot)),s===i&&(a=1.75,n.classList.add(_t)),n.classList.add(Vt),n.style.setProperty("--slide-translate-x",`${e[s]||0}px`),n.style.setProperty("--slide-translate-y",`${a}rem`),n.style.setProperty("--slide-translate-scale",i===s?String(R.toActiveScale):s===k?String(R.fromActiveScale):"1")})},[i,K,k,R,U]);const Q=(0,M.A)(e=>{const t=e.target;t&&t.classList.contains(Ht)&&(k!==i?(w(i),I(a)):a!==N&&I(a),J(!1))});return U?(0,te.Y)("div",{className:Et,ref:S,children:(0,te.Y)("div",{className:zt,ref:e=>G(e,k),children:(0,te.Y)(vs,{peerId:k,storyId:N,onDelete:f,dimensions:R.activeSlide,isPrivateStories:D,isArchivedStories:F,isDeleteModalOpen:A,isSingleStory:m,getIsAnimating:K,onClose:b,onReport:C})})}):(0,te.FD)("div",{className:Et,ref:S,style:`--story-viewer-scale: ${R.scale}`,onTransitionEnd:Q,children:[(0,te.Y)("div",{className:xt,onClick:b}),j.length>1&&(0,te.Y)("div",{className:"xe67dhtF",style:`height: ${R.slide.height}px`}),j.map((e,t)=>e===k?function(e){const t=U?void 0:(0,Di.A)(`width: ${R.activeSlide.width}px`,`--slide-media-height: ${R.activeSlide.height}px`);return(0,te.Y)("div",{ref:t=>G(t,e),className:(0,me.A)(jt,Ht),style:t,children:(0,te.Y)(vs,{peerId:e,storyId:N,onDelete:f,dimensions:R.activeSlide,isPrivateStories:D,isArchivedStories:F,isDeleteModalOpen:A,isSingleStory:m,getIsAnimating:K,onClose:b,onReport:C})},e)}(k):function(e,t,i){const s=(0,Di.A)(`width: ${R.slide.width}px`,`height: ${R.slide.height}px`),a=(0,me.A)(jt,"Sef28wEh",`slide-${i}`);return(0,te.Y)("div",{ref:t=>G(t,e),className:a,style:s,children:(0,te.Y)(gs,{peer:(0,c.PVB)((0,n.mS)(),e),peerStories:g?.[e]})},e)}(e,0,t-z))]})}));function bs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;const[t,i]=(0,s.J0)(!0),[n,a]=(0,s.J0)(!0);return{isAtBeginning:t,isAtEnd:n,handleScroll:(0,M.A)(t=>{const{scrollHeight:s,scrollTop:n,clientHeight:o}=t.target;i(n<e),a(s-n-o<e)})}}var Cs=i(46222),ys=i(283),Ss=i(36393),ks=i(51083),ws=i(17751),Ns=i(17794);const Is={"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"},Ps=1.5*g.$,Ys=(0,s.ph)((0,n.EK)((e,t)=>{let{storyView:i}=t;return{peer:(0,c.PVB)(e,i.peerId),availableReactions:e.reactions.availableReactions}})(e=>{let{storyView:t,peer:i,availableReactions:a}=e;const{openChat:o,closeStoryViewer:r,unblockUser:c,blockUser:d,deleteContact:h,updateStoryView:u,focusMessage:m,openStoryViewer:p,closeStoryViewModal:g}=(0,n.ko)(),A=(0,T.A)(),f=(0,M.A)(()=>{const{type:e}=t;if("repost"===e)return g(),void p({peerId:t.peerId,storyId:t.storyId});r(),setTimeout(()=>{"user"===e?o({id:t.peerId}):"forward"===e&&m({chatId:t.peerId,messageId:t.messageId})},100)}),b=(0,s.Kr)(()=>{if(!(0,v.L8)(t.peerId))return;const{peerId:e,areStoriesBlocked:s,isUserBlocked:n}=t,a=i,{isContact:o}=a||{},r=(0,l.Yg)(a),m=[];return n||(s?m.push({handler:()=>{c({userId:e,isOnlyStories:!0}),u({userId:e,areStoriesBlocked:!1})},title:A("StoryShowBackTo",r),icon:"play-story"}):m.push({handler:()=>{d({userId:e,isOnlyStories:!0}),u({userId:e,areStoriesBlocked:!0})},title:A("StoryHideFrom",r),icon:"hand-stop"})),o?m.push({handler:()=>{h({userId:e})},title:A("DeleteContact"),icon:"delete-user",destructive:!0}):m.push({handler:()=>{n?(c({userId:e}),u({userId:e,isUserBlocked:!1})):(d({userId:e}),u({userId:e,isUserBlocked:!0}))},title:A(n?"Unblock":"BlockUser"),icon:n?"user":"delete-user",destructive:!n}),m},[A,t,i]),C="user"===t.type?"message-read":"forward"===t.type?"forward":"loop",y="forward"===t.type||"repost"===t.type,S=(0,s.Kr)(()=>{const e="repost"===t.type&&t.story.forwardInfo?.isModified,i=[(0,He.U)(A,1e3*t.date)];return e&&i.push(A("lng_edited")),i.join(" • ")},[A,t]);return(0,te.Y)(ci.A,{className:(0,me.A)("chat-item-clickable small-icon",Is.opacityFadeIn,(t.isUserBlocked||t.areStoriesBlocked)&&Is.blocked),onClick:f,rightElement:"user"===t.type&&t.reaction?(0,te.Y)(Ns.A,{reaction:t.reaction,className:Is.viewReaction,size:Ps,availableReactions:a,withIconHeart:!0}):void 0,contextActions:b,withPortalForMenu:!0,menuBubbleClassName:Is.menuBubble,children:(0,v.L8)(t.peerId)?(0,te.Y)(ws.A,{className:(0,me.A)(y&&Is.withColoredStatus),userId:t.peerId,noStatusOrTyping:!0,status:S,statusIcon:C,withStory:!0,forceShowSelf:!0}):(0,te.Y)(ks.A,{className:(0,me.A)(y&&Is.withColoredStatus),chatId:t.peerId,status:S,statusIcon:C,withStory:!0})},t.peerId)})),Fs=(0,s.ph)((0,n.EK)(e=>{const{appConfig:t}=e,{storyViewer:{viewModal:i}}=(0,c.nTw)(e),{storyId:s,views:n,nextOffset:a,isLoading:o}=i||{},r=s?(0,c.Msb)(e,e.currentUserId,s):void 0,l="story"===r?.["@type"]?r.expireDate:void 0;return{views:n,viewersExpireDate:l?l+t.storyViewersExpirePeriod:void 0,story:r&&"content"in r?r:void 0,nextOffset:a,isLoading:o,isCurrentUserPremium:(0,c.g29)(e)}})(function(e){let{story:t,viewersExpireDate:i,views:a,nextOffset:r,isLoading:l,isCurrentUserPremium:c}=e;const{loadStoryViewList:d,closeStoryViewModal:h,clearStoryViews:u}=(0,n.ko)(),[m,p,v]=(0,F.A)(!1),[g,A,f]=(0,F.A)(!0),[b,C]=(0,s.J0)(""),y=(0,T.A)(),S=Boolean(t),k=Boolean(i)&&i<(0,li.Fm)(),{viewsCount:w=0,reactionsCount:N=0}=t?.views||{},I=t?.isPublic&&w>o.XQO,P=N>o.$4F,Y=w>o.frj,D=I||P||Y;(0,s.vJ)(()=>{S||(C(""),v(),A())},[S]);const B=(0,fe.A)(()=>{u({isLoading:!0})},[],250,!0);(0,s.vJ)(()=>{B()},[m,g,b,B]);const R=(0,s.Kr)(()=>a?.sort(function(e){return(t,i)=>{if(e){const e="user"===t.type&&t.reaction,s="user"===i.type&&i.reaction;if(e&&!s)return-1;if(!e&&s)return 1}return i.date-t.date}}(g)),[g,a]),L=R?.length?1:Math.min(w,8),x=Boolean(R?.length)&&R.length<w&&k,E=(0,M.A)(()=>{t?.id&&void 0!==r&&d({peerId:t.peerId,storyId:t.id,offset:r,areReactionsFirst:g||void 0,areJustContacts:m||void 0,query:b})}),{handleScroll:V,isAtBeginning:_}=bs(),U=(0,M.A)(()=>{h()}),O=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.FD)(Q.A,{fluid:!0,size:"tiny",color:"translucent",className:(0,me.A)(!i&&"active",Is.sortButton,Is.topButton),faded:i,onClick:t,ariaLabel:y("SortBy"),children:[(0,te.Y)(W.A,{name:g?"heart-outline":"recent",className:Is.iconSort}),(0,te.Y)(W.A,{name:"down",className:Is.iconDown})]})},[g,y]);return(0,te.FD)(X.A,{isOpen:S,onClose:U,className:"component-theme-dark",contentClassName:Is.viewsList,isSlim:!0,children:[D&&(0,te.FD)("div",{className:Is.header,children:[I&&(0,te.FD)("div",{className:Is.contactFilter,children:[(0,te.Y)(Q.A,{className:(0,me.A)(!m&&Is.selected,Is.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:v,children:y("AllViewers")}),(0,te.Y)(Q.A,{className:(0,me.A)(m&&Is.selected,Is.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:p,children:y("Contacts")})]}),P&&(0,te.FD)(ce.A,{className:Is.sort,trigger:O,positionX:"right",children:[(0,te.FD)(de.A,{icon:"heart-outline",onClick:A,children:[y("SortByReactions"),g&&(0,te.Y)(W.A,{name:"check",className:Is.check})]}),(0,te.FD)(de.A,{icon:"recent",onClick:f,children:[y("SortByTime"),!g&&(0,te.Y)(W.A,{name:"check",className:Is.check})]})]}),Y&&(0,te.Y)(Ss.A,{className:Is.search,value:b,onChange:C})]}),(0,te.FD)("div",{className:(0,me.A)(Is.content,!_&&Is.topScrolled,"custom-scroll"),onScroll:V,children:[k&&!l&&!b&&Boolean(!R?.length)&&(0,te.Y)("div",{className:(0,me.A)(Is.info,Is.centeredInfo),children:(0,Dt.A)(y(c?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])}),!l&&Boolean(b.length)&&!R?.length&&(0,te.Y)("div",{className:Is.info,children:y("Story.ViewList.EmptyTextSearch")}),(0,te.FD)(Cs.A,{items:R,onLoadMore:E,children:[R?.map(e=>{const t="forward"===e.type?e.messageId:"repost"===e.type?e.storyId:"user";return(0,te.Y)(Ys,{storyView:e},`${e.peerId}-${e.date}-${t}`)}),l&&Array.from({length:L}).map((e,t)=>(0,te.Y)(ci.A,{className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0,children:(0,te.Y)(ys.A,{})},`placeholder-${t}`)),x&&(0,te.Y)("div",{className:(0,me.A)(Is.info,Is.bottomInfo),children:y("Story.ViewList.NotFullyRecorded")},"not-all-available")]})]}),(0,te.Y)("div",{className:(0,me.A)(Is.footer,"dialog-buttons"),children:(0,te.Y)(Q.A,{className:(0,me.A)("confirm-dialog-button",Is.close),isText:!0,onClick:U,children:y("Close")})})]})})),Ds=(0,s.ph)((0,n.EK)(e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:i,peerId:s,isPrivacyModalOpen:n,origin:a}}=(0,c.nTw)(e),o=s&&i?(0,c.Msb)(e,s,i):void 0,r=(0,c.xYJ)(e,"mediaViewerAnimations");return{isOpen:(0,c.gd2)(e),shouldSkipHistoryAnimations:t,peerId:s,storyId:i,story:o,origin:a,withAnimation:r,isPrivacyModalOpen:n}})(function(e){let{isOpen:t,peerId:i,storyId:a,story:l,origin:c,shouldSkipHistoryAnimations:d,withAnimation:h,isPrivacyModalOpen:u}=e;const{closeStoryViewer:v,closeStoryPrivacyEditor:g,reportStory:A}=(0,n.ko)(),f=(0,T.A)(),[b,y]=(0,s.J0)(void 0),[S,k,N]=(0,F.A)(!1),{bestImageData:I,thumbnail:P}=ri(l),Y=oi(),D=(0,_.A)(t),B=(0,_.A)(I),R=(0,_.A)(i),L=(0,_.A)(c),x=Boolean(h&&!d);(0,s.vJ)(()=>{t||(y(void 0),N())},[t]),(0,s.vJ)(()=>{if(!t)return;(0,p.FD)();const e=(0,U.w4)();return()=>{(0,p.wb)(),e()}},[t]);const E=(0,s.hb)(()=>{v()},[v]),V=(0,M.A)(e=>{y(e),k()}),O=(0,M.A)(()=>{N(),y(void 0)}),K=(0,M.A)(()=>{a&&A({storyId:a,peerId:i})});return(0,s.vJ)(()=>t?(0,m.A)(()=>{E()}):void 0,[E,t]),(0,s.vJ)(()=>{x&&!D&&t&&i&&P&&void 0!==c&&((0,s.VK)(250+o.xB5),function(e,t,i,s,n){const{mediaEl:a}=ni(t,e);if(!a)return;const{width:l,height:c}=w.A.get();let{width:d,height:h}=n;const u=l<=600;if(u){d=l-2*ii,h=c-ti-2*ii;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(h-=parseFloat(e))}const m=u?ii:(l-d)/2,p=u?ii:(c-(h+ti))/2,{top:v,left:g,width:A,height:f}=a.getBoundingClientRect(),b=g+A/2-(m+d/2),y=v+f/2-(p+h/2),S=A/d,k=f/h;(0,r.RK)(()=>{const e=si(s||i,!s);(0,C.ZM)(e,{top:`${p}px`,left:`${m}px`,width:`${d}px`,height:`${h}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${S}, ${k})`});const t=document.getElementById("StoryViewer");t.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{(0,C.ZM)(e,{transform:""}),setTimeout(()=>{(0,r.RK)(()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(i,c,P,I,Y.activeSlide)),x&&D&&!t&&R&&B&&void 0!==L&&((0,s.VK)(250+o.xB5),function(e,t,i){const{mediaEl:s}=ni(t,e),n=document.getElementById("StoryViewer").querySelector(`.${zt} .${Kt}, .${Ht} .${Kt}`);if(!n||!s)return;const{top:a,left:l,width:c,height:d}=n.getBoundingClientRect(),{top:h,left:u,width:m,height:p}=s.getBoundingClientRect(),v=u+m/2-(l+c/2),g=h+p/2-(a+d/2),A=m/c,f=p/d;(0,r.RK)(()=>{const e=si(i);(0,C.ZM)(e,{top:`${a}px`,left:`${l}px`,width:`${c}px`,height:`${d}px`});const t=si(s.src,void 0,!0),n=a+d/2-c/2;(0,C.ZM)(t,{top:`${n}px`,left:`${l}px`,width:`${c}px`,height:`${c}px`});const h=document.getElementById("StoryViewer");h.appendChild(e),document.body.appendChild(t),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{(0,C.ZM)(e,{transform:`translate3d(${v}px, ${g}px, 0) scale(${A}, ${f})`}),(0,C.ZM)(t,{transform:`translate3d(${v}px, ${g}px, 0) scale(${A})`,opacity:"1"}),setTimeout(()=>{(0,r.RK)(()=>{h.contains(e)&&h.removeChild(e),document.body.contains(t)&&document.body.removeChild(t),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(R,L,B))},[x,I,B,t,D,Y.activeSlide,P,i,R,c,L]),(0,te.FD)(se.A,{id:"StoryViewer",className:"bu_hGbaa",isOpen:t,shouldAnimateFirstRender:!0,noCloseTransition:d,children:[(0,te.Y)("div",{className:"OFh6u50Q",onClick:E}),(0,te.Y)(Q.A,{className:"Mye8Dwxa",round:!0,size:"smaller",color:"translucent-white",ariaLabel:f("Close"),onClick:E,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)(fs,{isOpen:t,isDeleteModalOpen:S,onReport:K,onClose:E,onDelete:V}),(0,te.Y)(gi,{isOpen:S,story:b,onClose:O}),(0,te.Y)(Fs,{}),(0,te.Y)(pi,{}),(0,te.Y)(Fi,{isOpen:u,onClose:g})]})}));var Ms=i(79582),Ts=i(63527),Bs=i(96374),Rs=i(79174),Ls=i(10328),xs=i(52745),Es=i(34431),Vs=i(38102),_s=i(45780);const Us=2.75*g.$,Os="ChatOrUserPicker-item",Ks=(0,s.ph)(e=>{let{isOpen:t,currentUserId:i,chatOrUserIds:a,search:r,searchPlaceholder:d,className:h,loadMore:u,onSearchChange:m,onSelectChatOrUser:p,onClose:v,onCloseAnimationEnd:g,isLowStackPriority:A}=e;const{loadTopics:f}=(0,n.ko)(),b=(0,T.A)(),C=(0,s.li)(),y=(0,s.li)(),S=(0,s.li)(),k=(0,s.li)(),[w,N]=(0,Bs.A)(u,a,Boolean(r)),[I,P]=(0,s.J0)(void 0),[Y,F]=(0,s.J0)(""),D=I?1:0,B=a.indexOf(w[0]),R=(0,M.A)(()=>{m("")});(0,Rs.A)(S,t&&0===D,R),(0,Rs.A)(k,t&&1===D);const L=(0,M.A)(e=>{if(I)return(0,c.pSx)(e,I)}),x=(0,Ts.A)(L),[E,V]=(0,s.Kr)(()=>{const e=(0,n.mS)(),t=e.chats.byId,i=e.chats.fullInfoById,s=t[I];if(!s||!x)return[void 0,void 0];const a=Y.toLowerCase(),o=x?Object.values(x).reduce((e,t)=>(!(0,l.__)(s,t,void 0,i[I])||a&&!t.title.toLowerCase().includes(a)||(e[t.id]=t),e),{}):x;return[Object.keys(o).map(Number),o]},[I,Y,x]),_=(0,M.A)(()=>{P(void 0),F("")}),U=(0,M.A)(e=>{m(e.currentTarget.value)}),O=(0,M.A)(e=>{F(e.currentTarget.value)}),K=(0,Ls.A)(C,t,e=>{if(w&&w.length>0){const t=(0,n.mS)().chats.byId,i=w[-1===e?0:e],s=t[i];s?.isForum?(x||f({chatId:i}),P(i)):p(i)}},`.${Os}`,!0),J=(0,Ls.A)(y,t,e=>{E?.length&&p(I,E[-1===e?0:e])},`.${Os}`,!0),G=(0,M.A)(e=>{const t=(0,n.mS)().chats.byId,i=t?.[e];i?.isForum?(x||f({chatId:e}),P(e),R()):p(e)}),j=(0,s.hb)((e,t)=>{const s=(0,n.mS)();let a=(0,c.PVB)(s,e);if(!a)return;const r=(0,c.k2W)(s,e);r&&(a=r);const d=a&&!(0,Ft.vj)(a)?a.isSelf:void 0,[h,u]=function(){if(!a)return;if(a.id===i)return[b("SavedMessagesInfo")];if((0,Ft.vj)(a))return[(0,l.sT)(b,a)];const e=(0,c.K0y)(s,a.id);return[(0,l.CD)(b,a,e),(0,me.A)((0,l.PF)(a,e,!0)&&"online")]}()||[];return(0,te.Y)(_s.A,{className:Os,title:(0,te.Y)("div",{className:"title-wrapper",children:(0,te.Y)(Es.A,{className:"item-title",peer:a,isMonoforum:Boolean(r),isSavedMessages:d})}),avatarElement:(0,te.Y)(Mt.A,{peer:a,asMessageBubble:Boolean(r),isSavedMessages:d,size:"medium"}),subtitle:h,subtitleClassName:u,ripple:!0,style:`top: ${(B+t)*o.xw7}px;`,onClick:()=>G(e)},e)},[i,b,B]);return(0,te.Y)(X.A,{isOpen:t,className:(0,me.A)("ChatOrUserPicker",h),onClose:v,onCloseAnimationEnd:g,isLowStackPriority:A,children:(0,te.Y)(ne.Ay,{activeKey:D,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",children:()=>1===D?(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"modal-header",dir:b.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:b("Back"),onClick:_,children:(0,te.Y)(W.A,{name:"arrow-left"})}),(0,te.Y)(Z.A,{ref:k,value:Y,onChange:O,onKeyDown:J,placeholder:d})]}),(0,te.FD)(Cs.A,{ref:y,className:"picker-list custom-scroll",items:E,withAbsolutePositioning:!0,maxHeight:56*(E?.length||0),onKeyDown:J,children:[!E&&(0,te.Y)(xs.A,{}),E?.map((e,t)=>(0,te.Y)(_s.A,{className:Os,onClick:()=>p(I,e),style:`top: ${56*(B+t)}px;`,avatarElement:(0,te.Y)(Vs.A,{size:Us,topic:V[e],className:"topic-icon",letterClassName:"topic-icon-letter"}),title:(0,Dt.A)(V[e].title)},`${I}_${e}`))]})]}):(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"modal-header",dir:b.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:b("Close"),onClick:v,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)(Z.A,{ref:S,value:r,onChange:U,onKeyDown:K,placeholder:d})]}),w?.length?(0,te.Y)(Cs.A,{ref:C,className:"picker-list custom-scroll",items:w,itemSelector:`.${Os}`,onLoadMore:N,withAbsolutePositioning:!0,maxHeight:a.length*o.xw7,onKeyDown:K,children:w.map(j)}):w&&!w.length?(0,te.Y)("p",{className:"no-results",children:b("lng_blocked_list_not_found")}):(0,te.Y)(xs.A,{})]})})})}),Js=(0,s.ph)((0,n.EK)(e=>{const{chats:{listIds:t,orderedPinnedIds:i},currentUserId:s}=e;return{activeListIds:t.active,archivedListIds:t.archived,pinnedIds:i.active,contactIds:e.contactList?.userIds,currentUserId:s}})(e=>{let{isOpen:t,currentUserId:i,activeListIds:a,archivedListIds:r,pinnedIds:d,contactIds:h,filter:u=o.K_A,className:m,searchPlaceholder:p,loadMore:v,onSelectRecipient:g,onClose:A,onCloseAnimationEnd:f,isLowStackPriority:b,isForwarding:C}=e;const[y,S]=(0,s.J0)(""),k=(0,s.Kr)(()=>{if(!t)return;let e=d||[];i&&(e=(0,bi.Am)([i,...e]));const s=(0,n.mS)(),o=[...a||[],...y&&r||[]].filter(e=>{const t=(0,c.hds)(s,e),i=(0,c.mBe)(s,e),n=t&&(0,l.ub)(t,"postMessages"),a=t&&(0,l.WX)(t);if(C&&a&&!n)return!1;if(i&&!(0,l.PL)(i))return!0;if(!t)return!1;if(t.isMonoforum&&(0,c.ODG)(s,e))return!1;const o=(0,c.AWZ)(s,e);return!o||(0,l.__)(t,void 0,void 0,o)}),m=(0,Ms.A)((0,Ft.PU)({ids:(0,bi.Am)([...i?[i]:[],...o,...h||[]]),query:y}),void 0,e,i);return(0,c.yMZ)(s,m,u)},[t,d,i,a,y,r,h,u,C]),w=(0,Bi.A)(k,!0);return(0,te.Y)(Ks,{isOpen:t,className:m,chatOrUserIds:w,currentUserId:i,searchPlaceholder:p,search:y,onSearchChange:S,loadMore:v,onSelectChatOrUser:g,onClose:A,onCloseAnimationEnd:f,isLowStackPriority:b})})),Gs=(0,s.ph)((0,n.EK)(e=>{const{messageIds:t,storyId:i}=(0,c.nTw)(e).forwardMessages,s=t&&t.length>0;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(i),isForwarding:s}})(e=>{let{isOpen:t,currentUserId:i,isManyMessages:a,isStory:o,isForwarding:r}=e;const{openChatOrTopicWithReplyInDraft:d,setForwardChatOrTopic:h,exitForwardMode:u,forwardToSavedMessages:m,forwardStory:p,showNotification:g}=(0,n.ko)(),A=(0,T.A)(),f=(0,_.A)(o,!0),[b,C,y]=(0,F.A)();(0,s.vJ)(()=>{t&&C()},[t,C]);const S=(0,s.hb)((e,t)=>{const s=e===i;if(o){p({toChatId:e});const t=(0,n.mS)();if((0,v.L8)(e))g({message:s?A("Conversation.StoryForwardTooltip.SavedMessages.One"):A("StorySharedTo",(0,l.u0)((0,c.mBe)(t,e)))});else{const i=(0,c.hds)(t,e);if(!i)return;g({message:A("StorySharedTo",(0,l.Js)(A,i))})}}else if(s){const e=A(a?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");m(),g({message:e})}else{const i=e,s=t?Number(t):void 0;r?h({chatId:i,topicId:s}):d({chatId:i,topicId:s})}},[i,a,o,A,r]),k=(0,s.hb)(()=>{u()},[u]);if(t||b)return(0,te.Y)(Js,{isOpen:t,className:f?"component-theme-dark":void 0,searchPlaceholder:A(r?"ForwardTo":"ReplyToDialog"),onSelectRecipient:S,onClose:k,onCloseAnimationEnd:y,isForwarding:r})})),js=(0,s.ph)(e=>{let{requestedDraft:t}=e;const i=Boolean(t&&!t.chatId),{openChatWithDraft:a,resetOpenChatWithDraft:o}=(0,n.ko)(),r=(0,T.A)(),[l,c,d]=(0,F.A)();(0,s.vJ)(()=>{i&&c()},[i,c]);const h=(0,s.hb)((e,i)=>{a({chatId:e,threadId:i,text:t.text,files:t.files})},[a,t]),u=(0,s.hb)(()=>{o()},[o]);if(i||l)return(0,te.Y)(Js,{isOpen:i,searchPlaceholder:r("ForwardTo"),filter:t?.filter,onSelectRecipient:h,onClose:u,onCloseAnimationEnd:d})}),zs=(0,s.ph)(e=>{let{requestedAttachBotInChat:t}=e;const{cancelAttachBotInChat:i,callAttachBot:a}=(0,n.ko)(),o=(0,T.A)(),r=Boolean(t),[l,c,d]=(0,F.A)();(0,s.vJ)(()=>{r&&c()},[r,c]);const{bot:h,filter:u,startParam:m}=t||{},p=(0,s.hb)(e=>{a({bot:h,chatId:e,startParam:m}),i()},[h,a,i,m]);if(r||l)return(0,te.Y)(Js,{isOpen:r,searchPlaceholder:o("Search"),filter:u,onSelectRecipient:p,onClose:i,onCloseAnimationEnd:d})});var Hs=i(99375);function $s(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const qs=(0,s.ph)((0,n.EK)(e=>({dialogs:(0,c.nTw)(e).dialogs,currentMessageList:(0,c.Xf0)(e)}))(e=>{let{dialogs:t,currentMessageList:i}=e;const{dismissDialog:a,sendMessage:o}=(0,n.ko)(),[r,l,c]=(0,F.A)(),d=(0,T.A)();var h,u,m;if((0,s.vJ)(()=>{t.length>0&&l()},[t,l]),t.length)return Boolean(t.length)&&("phoneNumber"in(h=t[t.length-1])?(u=h,(0,te.FD)(X.A,{isOpen:r,onClose:c,className:"confirm",title:d("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:a,children:[d("AreYouSureShareMyContactInfoBot"),(0,te.FD)("div",{className:"dialog-buttons mt-2",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:()=>{i&&(o({contact:u,messageList:i}),c())},children:d("OK")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:c,children:d("Cancel")})]})]})):(m=h,(0,te.FD)(X.A,{isOpen:r,onClose:c,onCloseAnimationEnd:a,className:"error",title:$s(m),children:[m.hasErrorKey?(0,Hs.Ay)(m):(0,Dt.A)(m.message,["simple_markdown","emoji","br"]),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{isText:!0,onClick:c,children:d("OK")})})]})))}));var Ws=i(17208);const Qs=(0,s.ph)((0,n.EK)(e=>(0,bi.Up)((0,c.nTw)(e),["notifications"]))(e=>{let{notifications:t}=e;if(t.length)return(0,te.Y)("div",{id:"Notifications",children:t.map(e=>(0,te.Y)(Ws.A,{notification:e},e.localId))})}));var Zs=i(24585);const Xs=(0,s.ph)(e=>{let{url:t}=e;const{toggleSafeLinkModal:i}=(0,n.ko)(),a=(0,_i.A)(),o=(0,s.hb)(()=>{t&&(window.open((0,Zs.Tc)(t),"_blank","noopener noreferrer"),i({url:void 0}))},[i,t]),r=(0,s.hb)(()=>{i({url:void 0})},[i]),l=(0,Bi.A)(t);return(0,te.Y)(vi.A,{isOpen:Boolean(t),onClose:r,title:a("OpenUrlTitle"),textParts:(0,Dt.A)(a("OpenUrlText",{url:l},{withNodes:!0,withMarkdown:!0})),confirmLabel:a("OpenUrlConfirm"),confirmHandler:o})});var en=i(47526);const tn=(0,s.ph)(e=>{let{modal:t}=e;const{closeMapModal:i}=(0,n.ko)(),{point:a,zoom:o}=t||{},r=(0,T.A)(),l=Boolean(a),c=(0,M.A)(()=>{i()}),[d,h,m,p]=(0,s.Kr)(()=>{if(!a)return[];const e=(0,en.zS)("google",a,o),t=(0,en.zS)("bing",a,o),i=(0,en.zS)("osm",a,o);return[e,t,(0,en.zS)("apple",a,o),i]},[a,o]),v=(0,M.A)(e=>{i(),window.open(e,"_blank","noopener")}),g=(0,M.A)(()=>{v(d)}),A=(0,M.A)(()=>{v(h)}),f=(0,M.A)(()=>{v(m)}),b=(0,M.A)(()=>{v(p)});return(0,te.FD)(X.A,{contentClassName:"VJDwJpsF",title:r("OpenMapWith"),isOpen:l,onClose:c,isSlim:!0,children:[(0,te.FD)("div",{className:"aYO2C2Hx",children:[(u.pz||u.MP)&&(0,te.Y)(Q.A,{fluid:!0,size:"smaller",onClick:f,children:"Apple Maps"}),(0,te.Y)(Q.A,{fluid:!0,size:"smaller",onClick:g,children:"Google Maps"}),(0,te.Y)(Q.A,{fluid:!0,size:"smaller",onClick:A,children:"Bing Maps"}),(0,te.Y)(Q.A,{fluid:!0,size:"smaller",onClick:b,children:"OpenStreetMap"})]}),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:c,children:r("Cancel")})})]})});var sn=i(19806);const nn=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(e=>{let{modal:t,currentUser:i}=e;const{closeUrlAuthModal:a,acceptBotUrlAuth:o,acceptLinkUrlAuth:r}=(0,n.ko)(),[c,d]=(0,s.J0)(!0),[h,u]=(0,s.J0)(!0),m=(0,Bi.A)(t,!1),{domain:p,botId:v,shouldRequestWriteAccess:g}=m?.request||{},A=v?(0,n.mS)().users.byId[v]:void 0,f=(0,T.A)(),b=(0,s.hb)(()=>{t?.url&&c?(t.button?o:r)({isWriteAllowed:h}):m?.url&&window.open((0,Zs.Tc)(m.url),"_blank","noopener"),a()},[t,c,a,o,r,h,m]),C=(0,s.hb)(()=>{a()},[a]),y=(0,s.hb)(e=>{d(e),u(e)},[d]);return(0,s.vJ)(()=>{p&&(d(!0),u(Boolean(g)))},[g,p]),(0,te.FD)(vi.A,{isOpen:Boolean(t?.url),onClose:C,title:f("OpenUrlTitle"),confirmLabel:f("OpenUrlTitle"),confirmHandler:b,children:[(0,Dt.A)(f("OpenUrlAlert2",m?.url),["links"]),p&&(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:c,label:(0,te.Y)(te.FK,{children:(0,Dt.A)(f("Conversation.OpenBotLinkLogin",[p,(0,l.Yg)(i)]),["simple_markdown"])}),onCheck:y}),g&&(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:h,label:(0,te.Y)(te.FK,{children:(0,Dt.A)(f("Conversation.OpenBotLinkAllowMessages",(0,l.Yg)(A)),["simple_markdown"])}),onCheck:u,disabled:!c})]})})),an=1e3*o.fRl,on=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function rn(e,t,i,s,n){const a=new Date(e,t,i),o=s&&(0,He.pU)(s),r=n&&(0,He.pU)(n);return!!(r&&a>r)||!!(o&&a<o)}function ln(e){return String(e).padStart(2,"0")}function cn(e,t,i){return`${e}-${t+1}-${i}`}const dn=(0,s.ph)(e=>{let{selectedAt:t,minAt:i,maxAt:n,isFutureMode:a,isPastMode:o,isOpen:r,withTimePicker:l,submitButtonLabel:c,secondButtonLabel:d,description:h,onClose:u,onSubmit:m,onDateChange:p,onSecondButtonClick:v}=e;const g=(0,T.A)(),A=new Date,f=(0,s.Kr)(()=>a&&!i?new Date:new Date(Math.max(i||0,0)),[a,i]),b=(0,s.Kr)(()=>o&&!n?new Date:new Date(Math.min(n||an,an)),[o,n]),C=(0,s.Kr)(()=>t?new Date(t):new Date,[t]),y=(0,_.A)(r),[S,k]=(0,F.A)(!1),[w,N]=(0,s.J0)(C),[I,P]=(0,s.J0)(new Date(w.getFullYear(),w.getMonth(),1)),[Y,D]=(0,s.J0)(ln(C.getHours())),[M,B]=(0,s.J0)(ln(C.getMinutes())),R=cn(w.getFullYear(),w.getMonth(),w.getDate()),L=I.getFullYear(),x=I.getMonth(),E=a&&w.getTime()<f.getTime()||o&&w.getTime()>b.getTime();(0,s.vJ)(()=>{!y&&r&&(N(C),P(new Date(C.getFullYear(),C.getMonth(),1)),l&&(D(ln(C.getHours())),B(ln(C.getMinutes()))))},[C,r,y,l]),(0,s.vJ)(()=>{a&&!S&&w.getTime()<f.getTime()&&(N(f),D(ln(f.getHours())),B(ln(f.getMinutes())))},[a,S,f,w]),(0,s.vJ)(()=>{o&&!S&&w.getTime()>b.getTime()&&(N(b),D(ln(b.getHours())),B(ln(b.getMinutes())))},[a,o,S,b,f,w]),(0,s.vJ)(()=>{if(t){const e=new Date(t);N(e),D(ln(e.getHours())),B(ln(e.getMinutes()))}},[t]);const V=o&&L>=A.getFullYear()&&x>=A.getMonth()||b&&L>=b.getFullYear()&&x>=b.getMonth(),U=a&&L<=A.getFullYear()&&x<=A.getMonth(),{prevMonthGrid:O,currentMonthGrid:K,nextMonthGrid:J}=(0,s.Kr)(()=>function(e,t){const i=[],s=[],n=[],a=new Date;a.setDate(1),a.setMonth(t),a.setFullYear(e);const o=a.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<o;e++)i.push(r-o+e+1);for(;a.getMonth()===t;){const e=a.getDate();s.push(e),a.setDate(e+1)}const l=(s.length+i.length)%7;if(l>0)for(let e=1;e<=7-l;e++)n.push(e);return{prevMonthGrid:i,currentMonthGrid:s,nextMonthGrid:n}}(L,x),[x,L]),G=(0,s.Kr)(()=>c||function(e,t){const i=(0,He.A)(t,e.code);return i===(0,He.A)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,He.fU)(e,t)):e("Conversation.ScheduleMessage.SendOn",[i,(0,He.fU)(e,t)])}(g,w),[g,w,c]),j=(0,s.hb)(()=>{m(a&&w<f?f:o&&w>b?b:w)},[a,o,f,b,m,w]),z=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return D(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),23)),s=new Date(w.getTime());s.setHours(i),N(s),p?.(s);const n=ln(i);D(n),e.target.value=n},[w,p]),H=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return B(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),59)),s=new Date(w.getTime());s.setMinutes(i),N(s),p?.(s);const n=ln(i);B(n),e.target.value=n},[w,p]);return(0,te.FD)(X.A,{isOpen:r,onClose:u,className:"CalendarModal",onEnter:j,children:[(0,te.Y)("div",{className:"container",children:(0,te.FD)("div",{className:"month-selector",children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:u,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.FD)("h4",{children:[g(`lng_month${x+1}`)," ",L]}),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",disabled:U,onClick:U?void 0:function(){P(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})},children:(0,te.Y)(W.A,{name:"previous"})}),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",disabled:V,onClick:V?void 0:function(){P(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t})},children:(0,te.Y)(W.A,{name:"next"})})]})}),(0,te.Y)("div",{className:"calendar-wrapper",children:(0,te.FD)("div",{className:"calendar-grid",children:[on.map(e=>(0,te.Y)("div",{className:"day-button faded weekday",children:(0,te.Y)("span",{children:g(e)})})),O.map(e=>(0,te.Y)("div",{className:"day-button disabled",children:(0,te.Y)("span",{children:e})})),K.map(e=>(0,te.Y)("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void N(e=>{const i=new Date(e);return i.setDate(t),i.setMonth(x),i.setFullYear(L),p?.(i),i});var t},className:(0,me.A)("day-button","div-button",rn(L,x,e,f,b)?"disabled":e?"clickable":"",R===cn(L,x,e)&&"selected"),children:Boolean(e)&&(0,te.Y)("span",{children:e})})),J.map(e=>(0,te.Y)("div",{className:"day-button disabled",children:(0,te.Y)("span",{children:e})}))]})}),l&&(0,te.FD)("div",{className:"timepicker",children:[(0,te.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:Y,onChange:z,onFocus:k}),":",(0,te.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:M,onChange:H,onFocus:k})]}),(0,te.FD)("div",{className:"footer",children:[h&&(0,te.Y)("div",{className:"description",children:h}),(0,te.FD)("div",{className:"footer",children:[(0,te.Y)(Q.A,{onClick:j,disabled:E,children:G}),d&&(0,te.Y)(Q.A,{onClick:v,isText:!0,children:d})]})]})]})}),hn=(0,s.ph)((0,n.EK)(e=>({selectedAt:(0,c.nTw)(e).historyCalendarSelectedAt}))(e=>{let{isOpen:t,selectedAt:i}=e;const{searchMessagesByDate:a,closeHistoryCalendar:o}=(0,n.ko)(),r=(0,s.hb)(e=>{a({timestamp:e.getTime()/1e3}),o()},[o,a]),l=(0,T.A)();return(0,te.Y)(dn,{isOpen:t,selectedAt:i,isPastMode:!0,submitButtonLabel:l("JumpToDate"),onClose:o,onSubmit:r})}));var un=i(64713);const mn=(0,s.ph)((0,n.EK)((e,t)=>{let{userId:i}=t;return{user:i?(0,c.mBe)(e,i):void 0,userStatus:i?(0,c.K0y)(e,i):void 0,phoneCodeList:e.countryList.phoneCodes}})(e=>{let{isOpen:t,userId:i,isByPhoneNumber:a,user:o,userStatus:r,phoneCodeList:c}=e;const{updateContact:d,importContact:h,closeNewContactDialog:m}=(0,n.ko)(),p=(0,T.A)(),v=(0,Bi.A)(o),g=(0,Bi.A)(a),A=(0,s.li)(),[f,b,C]=(0,F.A)(),[y,S]=(0,s.J0)(v?.firstName??""),[k,w]=(0,s.J0)(v?.lastName??""),[N,I]=(0,s.J0)(v?.phoneNumber??""),[P,Y]=(0,s.J0)(!0),D=Boolean(y&&(!a||N));(0,s.vJ)(()=>{t&&(b(),S(v?.firstName??""),w(v?.lastName??""),I(v?.phoneNumber??""),Y(!0))},[t,b,v?.firstName,v?.lastName,v?.phoneNumber]),(0,s.vJ)(()=>{!u.TF&&f&&setTimeout(()=>{A.current?.focus()},200)},[f]);const M=(0,s.hb)(e=>{S(e.target.value)},[]),B=(0,s.hb)(e=>{I((0,un.Ox)(c,e.target.value))},[c]),R=(0,s.hb)(e=>{w(e.target.value)},[]),L=(0,s.hb)(()=>{m(),S(""),w(""),I("")},[m]),x=(0,s.hb)(()=>{a||!i?h({firstName:y,lastName:k,phoneNumber:N}):d({userId:i,firstName:y,lastName:k,shouldSharePhoneNumber:P})},[y,h,a,k,N,P,d,i]);if(t||f)return(0,te.FD)(X.A,{className:"NewContactModal",title:p("NewContact"),isOpen:t,onClose:L,onCloseAnimationEnd:C,children:[v&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"NewContactModal__profile",dir:p.isRtl?"rtl":void 0,children:[(0,te.Y)(Mt.A,{size:"jumbo",peer:v,text:`${y} ${k}`}),(0,te.FD)("div",{className:"NewContactModal__profile-info",children:[(0,te.Y)("p",{className:"NewContactModal__phone-number",children:v?.phoneNumber?(0,un.Ox)(c,v.phoneNumber):p("MobileHidden")}),(0,te.Y)("span",{className:"NewContactModal__user-status",dir:"auto",children:(0,l.CD)(p,v,r)})]})]}),(0,te.Y)(Z.A,{ref:A,value:y,label:p("FirstName"),tabIndex:0,onChange:M}),(0,te.Y)(Z.A,{value:k,label:p("LastName"),tabIndex:0,onChange:R}),(0,te.Y)("p",{className:"NewContactModal__help-text",children:(0,Dt.A)(p("NewContact.Phone.Hidden.Text",v?.firstName||""),["emoji","simple_markdown"])}),(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:P,tabIndex:0,onCheck:Y,label:p("lng_new_contact_share")}),(0,te.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__negative",children:(0,Dt.A)(p("AddContact.SharedContactExceptionInfo",v?.firstName))})]}),g&&(0,te.FD)("div",{className:"NewContactModal__new-contact",dir:p.isRtl?"rtl":void 0,children:[(0,te.Y)(Mt.A,{size:"jumbo",text:`${y} ${k}`}),(0,te.FD)("div",{className:"NewContactModal__new-contact-fieldset",children:[(0,te.Y)(Z.A,{ref:A,value:N,inputMode:"tel",label:p("lng_contact_phone"),tabIndex:0,onChange:B}),(0,te.Y)(Z.A,{value:y,label:p("FirstName"),tabIndex:0,onChange:M}),(0,te.Y)(Z.A,{value:k,label:p("LastName"),tabIndex:0,onChange:R})]})]}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",disabled:!D,onClick:x,children:p("Done")}),(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:L,children:p("Cancel")})]})]})}));var pn=i(20179),vn=i(30708),gn=i(48894),An=i(71322),fn=i(32625),bn=i(10722);let Cn=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 yn={top:Cn.Top,bottom:Cn.Bottom,left:Cn.Left,right:Cn.Right,topLeft:Cn.TopLeft,topRight:Cn.TopRight,bottomLeft:Cn.BottomLeft,bottomRight:Cn.BottomRight},Sn=Object.keys(yn);let kn;const wn={x:0,y:0};var Nn=i(36838);const In=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).webApps,{botId:i}=(0,c.ES7)(e)||{},{modalState:s,openedWebApps:n}=t||{},a="minimized"===s;return{activeTabBot:i?(0,c.mBe)(e,i):void 0,isMinimizedState:a,openedWebApps:n}})(e=>{let{activeTabBot:t,isMinimizedState:i,openedWebApps:a}=e;const{changeWebAppModalState:o,closeWebAppModal:r}=(0,n.ko)(),l=(0,T.A)(),d=(0,_i.A)(),h=(0,s.li)(),u=(0,s.Kr)(()=>a&&Object.values(a),[a]),m=u?.length,p=(0,s.Kr)(()=>{if(!m)return[];const e=(0,n.mS)(),i=t?.id;return(0,bi.Am)([i,...u.map(e=>e.botId)]).map(t=>t&&(0,c.mBe)(e,t)).filter(Boolean).slice(0,3)},[m,t,u]),v=(0,M.A)(()=>{r()}),g=(0,M.A)(()=>{o({state:"maximized"})});if(i)return(0,te.FD)("div",{ref:h,className:(0,me.A)("kUZmBlnN"),children:[(0,te.Y)(Q.A,{className:"SMRJmUuE",round:!0,color:"translucent",size:"tiny",ariaLabel:l("Close"),onClick:v,children:(0,te.Y)(W.A,{className:"P0P4gW6a",name:"close"})}),(0,te.Y)(os.A,{className:"GP17QhNN",size:"mini",peers:p}),function(){const e=p.length>0&&p[0]?.firstName,t=m&&e&&m>1?d("MiniAppsMoreTabs",{botName:e,count:m-1},{pluralValue:m-1}):e;return(0,te.Y)("div",{className:"TZFjRaG4",children:t})}(),(0,te.Y)(Q.A,{className:(0,me.A)("Rax9j_TK","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:g,children:(0,te.Y)(W.A,{className:"sdbTXCxq",name:"expand-modal"})})]})}));var Pn=i(59852),Yn=i(84991);const Fn={container:"RFg0Ey2I","user-count-badge":"UZtJ6ZXb",userCountBadge:"UZtJ6ZXb","user-badge-icon":"pTiZFhsG",userBadgeIcon:"pTiZFhsG",name:"TzA5nqCC"},Dn=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;return{user:(0,c.mBe)(e,i)}})(function(e){let{user:t,isPopularApp:i}=e;const{requestMainWebView:s}=(0,n.ko)(),a=(0,_i.A)(),o=(0,M.A)(()=>{if(!t)return;const e=t?.id;if(!e)return;const i=(0,Pn.A)();s({botId:e,peerId:e,theme:i})});if(!t)return;const r=t?.firstName,l=t?.botActiveUsers,c=l&&i?(0,$e.Vw)(a,l):void 0;return(0,te.Y)("div",{className:Fn.container,onClick:o,children:(0,te.Y)(Yn.A,{className:(0,me.A)(Fn.avatarContainer,i&&"PopularAppGridItem"),textClassName:Fn.name,badgeClassName:Fn.userCountBadge,badgeIconClassName:Fn.userBadgeIcon,peer:t,text:r,badgeText:c,badgeIcon:"user-filled"})})})),Mn={root:"BJV09FsC",search:"bdi8G7GR","section-title":"ex3kxgWX",sectionTitle:"ex3kxgWX","section-content":"uIZzLhEh",sectionContent:"uIZzLhEh",showMoreLink:"h_Zs9ypA"},Tn=(0,ge.nF)(e=>e(),500,!0),Bn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(e=>{let{foundIds:t,recentBotIds:i}=e;const o=(0,T.A)(),r=(0,_i.A)(),[l,c]=(0,s.J0)(!1),{searchPopularBotApps:d}=(0,n.ko)(),h=(0,M.A)(()=>{c(e=>!e)}),[u,m]=(0,s.J0)(""),p=(0,s.Kr)(()=>t?(0,Ft.PU)({ids:t,query:u,type:"user"}):[],[t,u]),v=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&Tn(()=>{d()})},[]),g=(0,s.hb)(()=>{m("")},[]);return(0,te.FD)(Cs.A,{className:(0,me.A)(Mn.root,"custom-scroll"),items:p,onLoadMore:v,itemSelector:".PopularAppGridItem",noFastList:!0,preloadBackwards:30,children:[(0,te.Y)(Ss.A,{className:Mn.search,value:u,onChange:m,onReset:g,placeholder:r("SearchApps")}),i&&!u&&(0,te.FD)("div",{className:Mn.section,children:[(0,te.FD)("div",{className:Mn.sectionTitle,children:[(0,te.Y)("span",{children:o("SearchAppsMine")}),(0,te.Y)("span",{className:Mn.showMoreLink,onClick:h,children:o(l?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")})]}),(0,te.Y)("div",{className:Mn.sectionContent,children:i.map((e,t)=>{if(l||!(t>=5))return(0,te.Y)(Dn,{chatId:e})})})]}),(0,te.FD)("div",{className:Mn.section,children:[(0,te.Y)("div",{className:Mn.sectionTitle,children:r(u?"Apps":"PopularApps")}),(0,te.Y)("div",{className:Mn.sectionContent,children:p&&p.map(e=>(0,te.Y)(Dn,{chatId:e,isPopularApp:!u}))})]})]})})),Rn=3.675*g.$,Ln="jEAibDyh",xn="ablUg8HU",En="Wrl63uWL",Vn="vOFiAq3l",_n="KwI4XdkC",Un="oq6HKJur",On="a0AI_he5",Kn="MvCwTbk_",Jn=250,Gn=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),jn={ok:"OK",cancel:"Cancel",close:"Close"},zn=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=i?.activeWebAppKey?(0,c.wtp)(e,i.activeWebAppKey):void 0,{botId:n}=s||{},a=i?.modalState,o=n?e.attachMenu.bots[n]:void 0,r=n?(0,c.mBe)(e,n):void 0,l=n?(0,c.vGo)(e,n):void 0,d=l?.botInfo?.appSettings,h=e.currentUserId?(0,c.mBe)(e,e.currentUserId):void 0,u=(0,c.SJA)(e),{isPaymentModalOpen:m,status:p}=(0,c.nTw)(e).payment,{status:v,inputInvoice:g}=(0,c.nTw)(e).starsPayment,A=r?(0,c.XOs)(e,r.id):void 0,f=v||p;return{attachBot:o,bot:r,currentUser:h,theme:u,isPaymentModalOpen:m||Boolean(g),paymentStatus:f,modalState:a,botAppPermissions:A,botAppSettings:d}})(e=>{let{modal:t,webApp:i,bot:a,theme:r,isPaymentModalOpen:c,paymentStatus:d,registerSendEventCallback:h,registerReloadFrameCallback:m,isTransforming:p,modalState:v,isMultiTabSupported:g,onContextMenuButtonClick:A,botAppPermissions:f,botAppSettings:b,modalHeight:C}=e;const{closeActiveWebApp:y,sendWebViewData:S,toggleAttachBot:k,openTelegramLink:w,setWebAppPaymentSlug:N,switchBotInline:I,sharePhoneWithBot:P,updateWebApp:D,resetPaymentStatus:B,openChatWithInfo:R,showNotification:L,openEmojiStatusAccessModal:x,openLocationAccessModal:E,changeWebAppModalState:V,closeWebAppModal:_,openPreparedInlineMessageModal:U}=(0,n.ko)(),[O,K]=(0,s.J0)(),[J,G]=(0,s.J0)(),[z,H,$]=(0,F.A)(!1),[q,Z]=(0,s.J0)(),[ee,ie]=(0,s.J0)(!1),[se,ae]=(0,s.J0)(!1),[oe,re]=(0,s.J0)(),[le,ce]=(0,s.J0)(),{unlockPopupsAt:de,handlePopupOpened:he,handlePopupClosed:ue}=function(){const[e,t]=(0,s.J0)(0),i=(0,s.li)(0),n=(0,s.li)(0),a=(0,M.A)(()=>{const e=Date.now();e-n.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&t(e+2e3)}),o=(0,M.A)(()=>{e<Date.now()&&(n.current=Date.now())});return{unlockPopupsAt:e,handlePopupOpened:a,handlePopupClosed:o}}(),pe=(0,s.li)(),ve=(0,s.li)(),ge=(0,s.li)(),Ae="fullScreen"===v,fe="minimized"===v,be=(0,M.A)(()=>{setTimeout(()=>{V({state:"maximized"})},350)}),Ce=(0,s.li)();(0,s.vJ)(()=>{Ce.current=document.querySelector("#portals")},[]);const[,ye,Se]=(0,ke.Ay)(Ce,be),Ne=t?.activeWebAppKey?t.openedWebApps[t.activeWebAppKey]:void 0,{appName:Ie,backgroundColor:Pe}=Ne||{},{url:Ye,buttonText:Fe,isBackButtonVisible:De}=i||{},{placeholderPath:Me}=b||{},Te=Boolean(i?.isCloseModalOpen),Be=Boolean(i?.isRemoveModalOpen),Re=i&&(0,pn.rp)(i),Le=Ne&&(0,pn.rp)(Ne),xe=Ne&&i&&Le===Re,Ve=u.H$,_e=void 0!==f?.geolocation,Ue=Boolean(f?.geolocation),Oe=(0,M.A)(e=>{Re&&D({key:Re,update:e})}),Ke=(0,s.Kr)(()=>(0,Pn.A)(),[r]);(0,s.vJ)(()=>{ce(Ke.secondary_bg_color)},[Ke]);const Je=Ke.bg_color,[Ge,je]=(0,s.J0)(),ze="light"===r?b?.backgroundColor:b?.backgroundDarkColor;(0,s.vJ)(()=>{Oe({backgroundColor:Ge||ze||Je})},[Je,Ge,ze]);const He=Ke.bg_color,[$e,qe]=(0,s.J0)(),We="light"===r?b?.headerColor:b?.headerDarkColor;(0,s.vJ)(()=>{Oe({headerColor:$e||We||He})},[He,$e,We]);const Qe=(0,s.li)(),Xe=(0,T.A)(),et=(0,_i.A)(),tt=t?.isModalOpen||!1,it=Boolean(Fe),{reloadFrame:st,sendEvent:nt,sendFullScreenChanged:at,sendViewport:ot,sendSafeArea:rt,sendTheme:lt}=((e,t,i,a,r,c,d)=>{const{showNotification:h,setWebAppPaymentSlug:u,openInvoice:m,closeWebApp:p,openSuggestedStatusModal:v,updateWebApp:g,updateContentSettings:A}=(0,n.ko)(),f=(0,s.li)(!1),b=(0,s.li)(),C=(0,s.li)(!1),y=(0,s.li)(),S=(0,we.A)();(0,s.vJ)(()=>{if(!e.current||!t)return;const i=()=>{d?.()},s=e.current;return s.addEventListener("load",i),()=>{s.removeEventListener("load",i)}},[d,e,t]);const k=(0,s.hb)(t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")},[e]),w=(0,s.hb)(e=>{k({eventType:"fullscreen_changed",eventData:{is_fullscreen:e}})},[k]),N=(0,M.A)(t=>{if(!e.current)return;const i=e.current;i.src="about:blank",i.addEventListener("load",()=>{i.src=t},{once:!0})}),I=(0,s.hb)(e=>{if(f.current)return k({eventType:"reload_iframe"}),void(b.current=setTimeout(()=>{N(e)},500));N(e)},[k]),P=(0,s.hb)(t=>{if(!e.current)return;const{width:i,height:s}=e.current.getBoundingClientRect();k({eventType:"viewport_changed",eventData:{width:i,height:s,is_expanded:!0,is_state_stable:!t}})},[k,e]),Y=(0,s.hb)(()=>{e.current&&(k({eventType:"safe_area_changed",eventData:{left:0,right:0,top:0,bottom:0}}),k({eventType:"content_safe_area_changed",eventData:{left:0,right:0,top:i?Rn:0,bottom:0}}))},[k,i,e]),F=(0,s.hb)(()=>{k({eventType:"theme_changed",eventData:{theme_params:(0,Pn.A)()}})},[k]),D=(0,s.hb)(e=>{k({eventType:"set_custom_style",eventData:e})},[k]),T=(0,s.hb)(t=>{if(C.current)return;const i=e.current?.contentWindow;if(i===t.source)try{const e=JSON.parse(t.data),{eventType:i,eventData:s}=e;if("web_app_ready"===i&&d?.(),"web_app_close"===i&&c){const e=(0,l.rp)(c);p({key:e,skipClosingConfirmation:!0})}if("web_app_request_viewport"===i&&P(S.isResizing),"web_app_request_safe_area"===i&&Y(),"web_app_request_content_safe_area"===i&&Y(),"web_app_request_theme"===i&&F(),"iframe_ready"===i){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");D("* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}".replace(/%SCROLLBAR_COLOR%/g,e)),f.current=Boolean(s.reload_supported)}if("iframe_will_reload"===i&&clearTimeout(b.current),"web_app_data_send"===i){if(!a)return;C.current=!0}if("web_app_read_text_from_clipboard"===i&&k({eventType:"clipboard_text_received",eventData:{req_id:s.req_id,data:null}}),"web_app_open_scan_qr_popup"===i&&h({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===i&&(u({slug:s.slug}),m({type:"slug",slug:s.slug})),"web_app_open_link"===i){const e=s.url;window.open(e,"_blank","noreferrer")}if("web_app_biometry_get_info"===i&&k({eventType:"biometry_info_received",eventData:{available:!1}}),"web_app_device_storage_clear"===i||"web_app_device_storage_get_key"===i||"web_app_device_storage_save_key"===i){const{req_id:e}=s;k({eventType:"device_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_secure_storage_clear"===i||"web_app_secure_storage_get_key"===i||"web_app_secure_storage_restore_key"===i||"web_app_secure_storage_save_key"===i){const{req_id:e}=s;k({eventType:"secure_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_start_accelerometer"===i&&k({eventType:"accelerometer_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_gyroscope"===i&&k({eventType:"gyroscope_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_device_orientation"===i&&k({eventType:"device_orientation_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_add_to_home_screen"===i&&k({eventType:"home_screen_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_check_home_screen"===i&&k({eventType:"home_screen_checked",eventData:{status:"unsupported"}}),"web_app_set_emoji_status"===i){const{custom_emoji_id:e,duration:t}=s;if(!e||"string"!=typeof e)return void k({eventType:"emoji_status_failed",eventData:{error:"SUGGESTED_EMOJI_INVALID"}});if(t)try{BigInt(t)}catch(e){return void k({eventType:"emoji_status_failed",eventData:{error:"DURATION_INVALID"}})}if(!c)return void k({eventType:"emoji_status_failed",eventData:{error:"UNKNOWN_ERROR"}});v({webAppKey:(0,l.rp)(c),customEmojiId:e,duration:Number(t),botId:c.botId})}if("web_app_verify_age"===i){const{passed:e}=s,t=(0,n.mS)().appConfig.verifyAgeMin||o.lYi,i=s.age||0;e&&i>=t?(h({message:{key:"TitleAgeCheckSuccess"}}),A({isSensitiveEnabled:!0})):h({message:{key:"TitleAgeCheckFailed"}})}r(e)}catch(e){}},[a,k,r,D,c,F,P,Y,d,S.isResizing,e]);return(0,s.vJ)(()=>{const{width:e,height:t,isResizing:i}=S;y.current&&y.current.width===e&&y.current.height===t&&!y.current.isResizing||(y.current={width:e,height:t,isResizing:i},P(i))},[P,Y,S]),(0,s.vJ)(()=>{c?.plannedEvents?.length&&(c.plannedEvents.forEach(e=>{k(e)}),g({key:(0,l.rp)(c),update:{plannedEvents:[]}}))},[k,c]),(0,s.vJ)(()=>(window.addEventListener("message",T),()=>window.removeEventListener("message",T)),[T,e]),(0,s.vJ)(()=>{t&&e.current?.contentWindow?(P(),Y(),C.current=!1):y.current=void 0},[t,i,P,Y,e]),{sendEvent:k,sendFullScreenChanged:w,reloadFrame:I,sendViewport:P,sendSafeArea:Y,sendTheme:F}})(Qe,tt,Ae,it,function(e){const{eventType:t,eventData:i}=e;if("web_app_request_fullscreen"===t&&((0,Y.cB)()?V({state:"fullScreen"}):nt({eventType:"fullscreen_failed",eventData:{error:"UNSUPPORTED"}})),"web_app_exit_fullscreen"===t&&Ct(),"web_app_open_tg_link"===t){V({state:"minimized"});const e=o.jsp+i.path_full;w({url:e,shouldIgnoreCache:i.force_request})}if("web_app_setup_back_button"===t&&Oe({isBackButtonVisible:i.is_visible}),"web_app_setup_settings_button"===t&&Oe({isSettingsButtonVisible:i.is_visible}),"web_app_set_background_color"===t&&je((0,Pn.To)(i.color)?i.color:void 0),"web_app_set_header_color"===t){const e=i.color_key;qe(i.color||(e?Ke[e]:void 0))}if("web_app_set_bottom_bar_color"===t&&ce(i.color),"web_app_data_send"===t&&(y(),S({bot:a,buttonText:Fe,data:i.data})),"web_app_setup_main_button"===t){const e=i.color,t=i.text_color;K({isVisible:i.is_visible&&Boolean(i.text?.trim().length),isActive:i.is_active,text:i.text,color:e,textColor:t,isProgressVisible:i.is_progress_visible})}if("web_app_setup_secondary_button"===t){const e=i.color,t=i.text_color;G({isVisible:i.is_visible&&Boolean(i.text?.trim().length),isActive:i.is_active,text:i.text,color:e,textColor:t,isProgressVisible:i.is_progress_visible,position:i.position})}if("web_app_setup_closing_behavior"===t&&Oe({shouldConfirmClosing:!0}),"web_app_open_popup"===t){if(q||!i.message.trim().length||!i.buttons?.length||i.buttons.length>3||ee||se||de>Date.now())return void gt(void 0);Z(i),he()}if("web_app_switch_inline_query"===t){const e=i.chat_types?.map(l.Xj).filter(Boolean),t=!e?.length;I({botId:a.id,query:i.query,filter:e,isSamePeer:t}),y()}if("web_app_request_phone"===t){if(q||se||de>Date.now())return void wt();ie(!0),he()}if("web_app_request_write_access"===t){if(q||ee||de>Date.now())return void Pt();!async function(){if(!a)return;const e=await(0,Ze.px)("fetchBotCanSendMessage",{bot:a});e&&nt({eventType:"write_access_requested",eventData:{status:"allowed"}}),ae(!e)}(),he()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:s}=i;!async function(e,t,i){const s=await(0,Ze.px)("invokeWebViewCustomMethod",{bot:a,customMethod:t,parameters:i});nt({eventType:"custom_method_invoked",eventData:{req_id:e,...s}})}(s,e,JSON.stringify(t))}if("web_app_request_file_download"===t){if(oe||de>Date.now())return void It();!async function(e,t){await(0,Ze.px)("checkBotDownloadFileParams",{bot:a,url:e,fileName:t})?(re({url:e,fileName:t}),he()):nt({eventType:"file_download_requested",eventData:{status:"cancelled"}})}(i.url,i.file_name)}if("web_app_send_prepared_message"===t){if(!a||!Re)return;const{id:e}=i;U({botId:a.id,messageId:e,webAppKey:Re})}if("web_app_request_emoji_status_access"===t){if(!a)return;x({bot:a,webAppKey:Re})}"web_app_check_location"===t&&nt({eventType:"location_checked",eventData:{available:Ve,access_requested:_e,access_granted:Ue}}),"web_app_request_location"===t&&(async()=>{const e=await(0,u.Bu)(),{accessRequested:t,accessGranted:i,geolocation:s}=e;if(!i||!t)return nt({eventType:"location_requested",eventData:{available:!1}}),L({message:Xe("PermissionNoLocationPosition")}),void gt(void 0);Ve?_e?nt({eventType:"location_requested",eventData:{available:Boolean(f?.geolocation),latitude:s?.latitude,longitude:s?.longitude,altitude:s?.altitude,course:s?.heading,speed:s?.speed,horizontal_accuracy:s?.accuracy,vertical_accuracy:s?.altitudeAccuracy}}):E({bot:a,webAppKey:Re}):(L({message:Xe("PermissionNoLocationPosition")}),gt(void 0))})(),"web_app_open_location_settings"===t&&Mt()},i,H);(0,s.vJ)(()=>{xe&&h(nt)},[nt,h,xe]),(0,s.vJ)(()=>{xe&&m(st)},[st,m,xe]);const ct=z&&O?.isVisible&&O.text.trim().length>0,dt=z&&J?.isVisible&&J.text.trim().length>0,ht=(0,M.A)(()=>{Oe({isCloseModalOpen:!1})}),ut=(0,M.A)(()=>{Oe({shouldConfirmClosing:!1,isCloseModalOpen:!1}),setTimeout(()=>{y()},400)}),mt=(0,M.A)(()=>{Oe({isRemoveModalOpen:!1})}),pt=(0,M.A)(()=>{nt({eventType:"main_button_pressed"})}),vt=(0,M.A)(()=>{nt({eventType:"secondary_button_pressed"})}),gt=(0,M.A)(e=>{Z(void 0),ue(),nt({eventType:"popup_closed",eventData:{button_id:e}})}),At=(0,M.A)(()=>{gt()}),ft=(0,M.A)(()=>{lt()});(0,j.A)(()=>{setTimeout(()=>{ft()},400)},[r]);const bt=(0,M.A)(()=>{!(0,ke.j9)()&&xe&&ye?.()}),Ct=(0,M.A)(()=>{(0,ke.j9)()&&xe&&Se?.()}),yt=(0,M.A)(e=>{xe&&at(e)});(0,s.vJ)(()=>{Ae?(bt(),yt(!0)):(Ct(),yt(!1))},[Ae]);const St=(0,M.A)(e=>{nt({eventType:"visibility_changed",eventData:{is_visible:e}})});(0,s.vJ)(()=>{z&&St(Boolean(xe))},[xe,z]),(0,ki.A)(e=>{let[t]=e;"minimized"===v&&St(!1),v&&"minimized"===t&&St(!0)},[v]),(0,j.A)(e=>{let[t]=e;c!==t&&i?.slug&&!c&&d&&(nt({eventType:"invoice_closed",eventData:{slug:i.slug,status:d}}),N({slug:void 0}),B())},[c,d,nt,i?.slug]);const kt=(0,M.A)(()=>{k({botId:a.id,isEnabled:!1}),y()}),wt=(0,M.A)(()=>{ie(!1),ue(),nt({eventType:"phone_requested",eventData:{status:"cancelled"}})}),Nt=(0,M.A)(()=>{P({botId:a.id}),ie(!1),ue(),nt({eventType:"phone_requested",eventData:{status:"sent"}})}),It=(0,M.A)(e=>{e&&(re(void 0),ue()),nt({eventType:"file_download_requested",eventData:{status:"cancelled"}})}),Pt=(0,M.A)(()=>{nt({eventType:"write_access_requested",eventData:{status:"cancelled"}}),ae(!1),ue()}),Yt=(0,M.A)(async()=>{a&&(await(0,Ze.px)("allowBotSendMessages",{bot:a})?(nt({eventType:"write_access_requested",eventData:{status:"allowed"}}),ae(!1),ue()):Pt())}),Ft=(0,M.A)(()=>{oe&&(re(void 0),ue(),(0,Li.A)(oe.url,oe.fileName),nt({eventType:"file_download_requested",eventData:{status:"downloading"}}))});(0,s.vJ)(()=>{tt||(Z(void 0),ie(!1),ae(!1),K(void 0),G(void 0),Oe({isSettingsButtonVisible:!1,shouldConfirmClosing:!1,isBackButtonVisible:!1,isCloseModalOpen:!1,isRemoveModalOpen:!1}),$())},[tt]);const Mt=(0,M.A)(()=>{R({id:a.id})}),Tt=(0,Bi.A)(O?.color,!0),Bt=(0,Bi.A)(O?.textColor,!0),Rt=(0,Bi.A)(O&&Boolean(O.isActive),!0),Lt=(0,Bi.A)(O?.text,!0),xt=(0,Bi.A)(J?.position,!0),Et=(0,Bi.A)(J?.color,!0),Vt=(0,Bi.A)(J?.textColor,!0),_t=(0,Bi.A)(J&&Boolean(J.isActive),!0),Ut=(0,Bi.A)(J?.text,!0),[Ot,Kt]=(0,s.J0)(!1),[Jt,Gt]=(0,s.J0)(!0),[jt,zt]=(0,s.J0)(!0),[Ht,$t]=(0,s.J0)(!1),[qt,Wt]=(0,s.J0)(!1),[Qt,Zt]=(0,s.J0)(!1),[Xt,ei]=(0,s.J0)(0);(0,j.A)(()=>{setTimeout(()=>{ot(),rt()},p?0:400)},[qt,jt,Ht,Ht,J?.position,ot,p,C,rt]);const ti="top"===xt||"bottom"===xt,ii=ti&&Ht&&qt?2:Ht||qt?1:0,si=ti||Jt||jt?"vertical":"horizontal",ni=(0,s.li)(),ai=(0,s.li)(),oi=(0,s.li)(),ri=(0,s.li)(),li=(0,s.li)();(0,s.vJ)(()=>(Ae&&tt&&Boolean(Ie)?(Zt(!0),li.current&&clearTimeout(li.current),li.current=setTimeout(()=>{Zt(!1),li.current=void 0},3800)):(Zt(!1),li.current&&(clearTimeout(li.current),li.current=void 0)),()=>{li.current&&clearTimeout(li.current)}),[Ae,tt,Ie]),(0,s.vJ)(()=>{ni.current&&clearTimeout(ni.current),ai.current&&clearTimeout(ai.current),ct&&(ai.current=setTimeout(()=>{$t(!0)},35),Gt(!1),ni.current=setTimeout(()=>{Kt(!0)},Jn)),ct||($t(!1),ni.current=setTimeout(()=>{Gt(!0)},Jn))},[ct]),(0,s.vJ)(()=>{oi.current&&clearTimeout(oi.current),ri.current&&clearTimeout(ri.current),dt&&(ri.current=setTimeout(()=>{Wt(!0)},35),zt(!1),oi.current=setTimeout(()=>{Kt(!0)},Jn)),dt||(Wt(!1),oi.current=setTimeout(()=>{zt(!0)},Jn))},[dt]),(0,s.vJ)(()=>{qt||Ht||Kt(!1)},[Kt,qt,Ht]);const ci=(0,Di.A)(`background-color: ${Pe||"var(--color-background)"}`,p&&"pointer-events: none;"),di=(0,M.A)(()=>{De?nt({eventType:"back_button_pressed"}):(Ct(),at(!1),V({state:"maximized"}),_())}),hi=(0,M.A)(()=>{Ct()}),ui=(0,M.A)(e=>{A(e)}),mi=(0,me.A)("BvNtfigU",De&&"rC2wkMIk"),pi=Qt?Ie:Xe(De?"Back":"Close"),gi=ge?.current;return(0,s.vJ)(()=>{ei(ge?.current?.clientWidth||0)},[pi,gi]),(0,te.FD)("div",{ref:pe,className:(0,me.A)("LeeJZdwH",!xe&&Vn,g&&"ESsGT5OD"),children:[Ae&&(0,Y.cB)()&&(0,te.FD)("div",{className:"eYrhewMy",children:[(0,te.FD)("div",{ref:ve,className:Kn,onClick:di,children:[(0,te.Y)("div",{className:"JXsuZ01s",children:(0,te.Y)("div",{className:mi})}),(0,te.Y)("span",{className:"dpZR3YT7",style:`width: ${Xt}px;`,children:(0,te.Y)(ne.Ay,{activeKey:Qt?0:De?1:2,name:"slideFade",children:(0,te.Y)("div",{ref:ge,className:"dWDprnWa",children:pi})})})]}),(0,te.FD)("div",{className:"Tl4_05AQ",children:[(0,te.Y)("div",{className:(0,me.A)(Kn,"emOpAMBm"),tabIndex:0,role:"button","aria-label":et("WebAppCollapse"),onClick:hi,children:(0,te.Y)(W.A,{name:"down",className:On})}),(0,te.Y)("div",{className:(0,me.A)(Kn,"z4C5VD5o"),tabIndex:0,role:"button","aria-haspopup":"menu","aria-label":et("AriaMoreButton"),onClick:ui,children:(0,te.Y)(W.A,{name:"more",className:(0,me.A)(On,"T58ozRyW")})})]})]}),!fe&&(Me?(0,te.Y)("svg",{className:(0,me.A)(Ln,z&&En),viewBox:"0 0 512 512",children:(0,te.Y)("path",{className:"Gx1BIECZ",d:Me})}):function(){const e=(0,me.A)(Ln,"Ig_t1R7i",z&&En);return(0,te.FD)("div",{className:e,children:[(0,te.Y)("div",{className:xn}),(0,te.Y)("div",{className:xn}),(0,te.Y)("div",{className:xn}),(0,te.Y)("div",{className:xn})]})}()),(0,te.Y)("iframe",{className:(0,me.A)("OmY14FFl",Ot&&"liDRl1xT",!z&&En),style:ci,src:Ye,title:et("AriaMiniApp",{bot:a?.firstName}),sandbox:Gn,allow:"camera; microphone; geolocation; clipboard-write;",allowFullScreen:!0,ref:Qe}),!fe&&(0,te.FD)("div",{style:`background-color: ${le};`,className:(0,me.A)("mR_hsBdT","left"===xt&&"ntESqwQ_","right"===xt&&"q6IUFEL0","top"===xt&&"gb4iHJ9H","bottom"===xt&&"R_bh3GF8","horizontal"===si&&"oYaRA7u4",1===ii&&"YfQO314y",2===ii&&"gUldkEoy"),children:[(0,te.FD)(Q.A,{className:(0,me.A)("ypxiUCFQ",qt&&!jt&&_n,jt&&Vn),fluid:!0,style:`background-color: ${Et}; color: ${Vt}`,disabled:!_t&&!J?.isProgressVisible,nonInteractive:J?.isProgressVisible,onClick:vt,children:[!J?.isProgressVisible&&Ut,J?.isProgressVisible&&(0,te.Y)(Ee.A,{className:Un,color:"blue"})]}),(0,te.FD)(Q.A,{className:(0,me.A)("U_ggDKn1",Ht&&!Jt&&_n,Jt&&Vn),fluid:!0,style:`background-color: ${Tt}; color: ${Bt}`,disabled:!Rt&&!O?.isProgressVisible,nonInteractive:O?.isProgressVisible,onClick:pt,children:[!O?.isProgressVisible&&Lt,O?.isProgressVisible&&(0,te.Y)(Ee.A,{className:Un,color:"white"})]})]}),q&&(0,te.FD)(X.A,{isOpen:Boolean(q),title:q.title||" ",onClose:At,hasCloseButton:!0,className:(0,me.A)("YEOURXza",!q.title?.trim().length&&"gvljUzY9"),children:[q.message,(0,te.Y)("div",{className:"dialog-buttons mt-2",children:q.buttons.map(e=>(0,te.Y)(Q.A,{className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,onClick:()=>gt(e.id),children:e.text||Xe(jn[e.type])},e.id||e.type))})]}),(0,te.Y)(vi.A,{isOpen:ee,onClose:wt,title:Xe("ShareYouPhoneNumberTitle"),text:Xe("AreYouSureShareMyContactInfoBot"),confirmHandler:Nt,confirmLabel:Xe("ContactShare")}),(0,te.Y)(vi.A,{isOpen:se,onClose:Pt,title:Xe("lng_bot_allow_write_title"),text:Xe("lng_bot_allow_write"),confirmHandler:Yt,confirmLabel:Xe("lng_bot_allow_write_confirm")}),(0,te.Y)(vi.A,{isOpen:Boolean(oe),title:Xe("BotDownloadFileTitle"),textParts:et("BotDownloadFileDescription",{bot:a?.firstName,filename:oe?.fileName},{withNodes:!0,withMarkdown:!0}),confirmLabel:Xe("BotDownloadFileButton"),onClose:It,confirmHandler:Ft}),(0,te.Y)(vi.A,{isOpen:Te,onClose:ht,title:Xe("lng_bot_close_warning_title"),text:Xe("lng_bot_close_warning"),confirmHandler:ut,confirmIsDestructive:!0,confirmLabel:Xe("lng_bot_close_warning_sure")}),(0,te.Y)(vi.A,{isOpen:Be,onClose:mt,title:Xe("BotRemoveFromMenuTitle"),textParts:(0,Dt.A)(Xe("BotRemoveFromMenu",a?.firstName),["simple_markdown"]),confirmHandler:kt,confirmIsDestructive:!0})]})})),Hn="oHX2d8Or",$n="O4NxErFX",qn="dgdyQDsZ",Wn="xGefqS93",Qn="f7EicoVH",Zn="s6pBIYMI",Xn="txS0KiU0",ea="XpHR_yo0",ta="DoeOewUR",ia="YRMGpqUS",sa="b13oE9uA",na={width:300,height:40},aa={width:420,height:730},oa={width:300,height:300},ra=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=i?.activeWebAppKey?(0,c.wtp)(e,i.activeWebAppKey):void 0,{botId:n}=s||{},a=n?e.attachMenu.bots[n]:void 0,o=n?(0,c.mBe)(e,n):void 0,r=(0,c.meB)(e),l=(0,c.SJA)(e),{miniAppsCachedPosition:d,miniAppsCachedSize:h}=(0,vn.l)(e);return{attachBot:a,bot:o,chat:r,theme:l,cachedPosition:d,cachedSize:h}})(e=>{let{modal:t,chat:i,bot:a,attachBot:r,theme:l,cachedSize:c,cachedPosition:d}=e;const{closeActiveWebApp:h,closeWebAppModal:u,prolongWebView:m,toggleAttachBot:p,openChat:v,changeWebAppModalState:g,openWebAppTab:A,updateWebApp:f,openMoreAppsTab:b,closeMoreAppsTab:C,updateMiniAppCachedPosition:y,updateMiniAppCachedSize:S}=(0,n.ko)(),[k,N]=(0,s.Ul)(c||aa);function I(){return"fullScreen"===t?.modalState?w.A.get():"maximized"===t?.modalState?k():na}const{openedWebApps:P,activeWebAppKey:D,openedOrderedKeys:B,sessionKeys:R,isMoreAppsTabActive:L}=t||{},x=D?P?.[D]:void 0,{isBackButtonVisible:E,headerColor:V,backgroundColor:_,isSettingsButtonVisible:U}=x||{},O=(0,s.Kr)(()=>B?.map(e=>{const t=P[e];return{bot:(0,n.mS)().users.byId[t.botId],webApp:t,isOpen:Boolean(x&&e===(0,pn.rp)(x))}}),[B,P,x]),{isMobile:K}=(0,Y.Ay)(),J=t?.isModalOpen||!1,G="maximized"===t?.modalState,j="minimized"===t?.modalState,z="fullScreen"===t?.modalState,H=!K,$=(0,s.li)(),q=(0,s.li)(),Z=(0,s.li)(),ee=(0,M.A)(()=>$.current),ie=(0,M.A)(()=>$.current),se=(0,M.A)(()=>Z.current),{isContextMenuOpen:ne,contextMenuAnchor:ae,handleContextMenu:oe,handleContextMenuClose:re,handleContextMenuHide:le}=(0,bn.A)($),[he,ue]=(0,s.J0)(!1),ve=q.current,ge=$.current;(0,s.vJ)(()=>{ue(Boolean(H&&ve&&ge&&!z))},[H,ve,ge,z]),(0,s.vJ)(()=>{g({state:"maximized"})},[H]);const{isDragging:Ae,isResizing:fe,style:be,size:Ce,position:ye}=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{width:0,height:0},l=arguments.length>6?arguments[6]:void 0;const[c,d]=(0,s.J0)(l),[h,u]=(0,s.J0)(void 0),[m,p]=(0,s.Ul)({x:0,y:0}),[v,g]=(0,s.Ul)({width:0,height:0}),[A,f]=(0,s.Ul)({x:0,y:0}),b=m(),C=A(),y=e.current,S=t.current,[k,w]=(0,F.A)(!1),[N,I]=(0,F.A)(!1),[P,Y,D]=(0,F.A)(!1),[T,B,R]=(0,F.A)(!1),[L,x,E]=(0,F.A)(!1),[V,_]=(0,s.J0)(void 0);function U(){return{width:window.innerWidth,height:window.innerHeight}}const O=(0,M.A)(e=>{a||d({x:e.x,y:e.y})}),K=(0,M.A)(()=>a?wn:c),J=(0,M.A)(()=>{if(!h)return;const{width:e,height:t}=h,i=U();return{x:(i.width-e)/2,y:(i.height-t)/2}});(0,s.vJ)(()=>{y&&I()},[y]),(0,s.vJ)(()=>{if(!k&&h){const e=J();if(!e)return;O(e),w()}},[h,k,y]);const G=(0,M.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;if(e.target.closest(".no-drag")||!y)return;const{x:t,y:i}=(0,_e.A)(e),{left:s,top:n}=y.getBoundingClientRect();p({x:s,y:n}),f({x:t,y:i}),Y()}),j=(0,M.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;const t=e.target;if(!y||!t)return;const i=function(e){const t=t=>e.closest(t);if(t(o.cnh))for(const e of Sn)if(t(`.${e}`))return yn[e]}(t);if(void 0===i)return;_(i);const{x:s,y:n}=(0,_e.A)(e),{left:a,right:r,top:l,bottom:c}=y.getBoundingClientRect();p({x:a,y:l}),g({width:r-a,height:c-l}),f({x:s,y:n}),B()}),z=(0,M.A)(()=>{D()}),H=(0,M.A)(()=>{R()});(0,s.vJ)(()=>{i||D()},[i]);const $=(e,t)=>{const i=U(),s=i.width,n=i.height,a=h.width,o=h.height;let r=e,l=t;return r<0&&(r=0),l<0&&(l=0),r+a>s&&(r=s-a),l+o>n&&(l=n-o),{x:r,y:l}},q=(0,M.A)(()=>{if(a)return;const e=N||l?c:J();if(!h||!e)return;const t=$(e.x,e.y);O(t)}),W=(0,M.A)(e=>{const t=e,i=U(),s=n.width,a=n.height;return t.width=Math.min(i.width,Math.max(s,t.width)),t.height=Math.min(i.height,Math.max(a,t.height)),t});(0,s.vJ)(()=>{if(T)return;const e=W({width:n.width,height:n.height});e&&u(e)},[n,T]);const Q=(0,M.A)(()=>{if(!h||T)return;const e=W(h);e&&u(e)});(0,s.vJ)(()=>{T||q()},[h,T]),(0,s.vJ)(()=>{const e=()=>{x(),Q(),q(),kn&&(clearTimeout(kn),kn=void 0),kn=window.setTimeout(()=>{kn=void 0,E()},250)};return window.addEventListener("resize",e),()=>{clearTimeout(kn),kn=void 0,window.removeEventListener("resize",e)}},[q]);const Z=(0,M.A)(e=>{if(!P||!y)return;const{x:t,y:i}=(0,_e.A)(e),s=t-C.x,n=i-C.y,a=b.x+s,o=b.y+n;h&&d($(a,o))}),X=(0,M.A)(e=>{if(!T||!y||void 0===V)return;const{x:t,y:i}=(0,_e.A)(e),s=v(),n=Math.min(Math.max(0,t),U().width),a=Math.min(Math.max(0,i),U().height),o=n-C.x,l=a-C.y,c=b.x+s.width-r.width,h=b.y+s.height-r.height,m={x:b.x,y:b.y,width:s.width,height:s.height};V!==Cn.Left&&V!==Cn.TopLeft&&V!==Cn.BottomLeft||(m.width=Math.max(s.width-o,r.width),m.x=Math.min(m.x+o,c)),V!==Cn.Right&&V!==Cn.TopRight&&V!==Cn.BottomRight||(m.width=Math.max(s.width+o,r.width)),V!==Cn.Top&&V!==Cn.TopLeft&&V!==Cn.TopRight||(m.height=Math.max(s.height-l,r.height),m.y=Math.min(m.y+l,h)),V!==Cn.Bottom&&V!==Cn.BottomLeft&&V!==Cn.BottomRight||(m.height=Math.max(s.height+l,r.height)),u({width:m.width,height:m.height}),d({x:m.x,y:m.y})});(0,s.vJ)(()=>{let e;return S&&i&&(e=(0,pe.wJ)(S,{onCapture:G,onDrag:Z,onRelease:z,onClick:z,onDoubleClick:z})),e},[i,S]),(0,s.vJ)(()=>{const e=[];if(y&&i)for(const t of Sn){const i=y.querySelector(`.resizeHandle.${t}`);if(i){const t=(0,pe.wJ)(i,{onCapture:j,onDrag:X,onRelease:H,onClick:H,onDoubleClick:H});t&&e.push(t)}}return()=>{e.forEach(e=>e())}},[i,y]);const ee=P?"cursor: grabbing !important; ":"",te=K();if(!k||!h||!te)return{isDragging:!1,style:ee};const ie=(0,Di.A)(`left: ${te.x}px;`,`top: ${te.y}px;`,!a&&`max-width: ${h.width}px;`,!a&&`max-height: ${h.height}px;`,"position: fixed;",(P||T||L)&&"transition: none !important;",ee);return{position:c,size:h,isDragging:P,isResizing:T,style:ie}}($,q,he,I(),z,function(){if("maximized"===t?.modalState)return oa}(),d),Se=ye?.x,ke=ye?.y;(0,s.vJ)(()=>{Ae||void 0===Se||void 0===ke||y({position:{x:Se,y:ke}})},[Ae,Se,ke]),(0,s.vJ)(()=>{!Ae&&Ce&&G&&S({size:Ce})},[Ae,G,Ce]);const we=Ce||I(),Ne=we.width,Ie=we.height;(0,s.vJ)(()=>{fe&&N({width:Ne,height:Ie})},[Ie,Ne,fe,N]);const Pe=(0,T.A)(),Ye=(0,_i.A)(),{queryId:Fe}=x||{},De=P?Object.values(P).length:0;(0,fn.A)(()=>{P&&Object.keys(P).forEach(e=>{const t=P[e];t.queryId&&m({botId:t.botId,queryId:t.queryId,peerId:t.peerId||i.id,replyInfo:t.replyInfo})})},Fe?45e3:void 0,!0);const Me=(0,s.li)(null),Te=(0,s.li)(null),Be=(0,M.A)(e=>{Me.current=e}),Re=(0,M.A)(e=>{Me.current&&Me.current(e)}),Le=(0,M.A)(e=>{Te.current=e}),xe=(0,M.A)(e=>{Te.current&&Te.current(e)}),Ee=(0,M.A)(()=>{Re({eventType:"settings_button_pressed"})}),Ve=(0,M.A)(()=>{xe(x.url)}),Ue=(0,M.A)(()=>{u()}),Oe=(0,M.A)(()=>{C()}),Ke=(0,M.A)(()=>{De>1?h():u()}),Je=(0,M.A)(()=>{if(r){const e=(0,pn.rp)(x);f({key:e,update:{isRemoveModalOpen:!0}})}else p({botId:a.id,isEnabled:!0})}),Ge=(0,M.A)(()=>{E?Re({eventType:"back_button_pressed"}):Ue()}),je=(0,M.A)(()=>{g({state:"minimized"})}),ze=(0,M.A)(()=>{g({state:"fullScreen"})}),He=(0,M.A)(()=>{b()}),$e=(0,M.A)(e=>{A({webApp:e.webApp})}),We=(0,M.A)(()=>{v({id:a.id})}),Qe=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{className:(0,me.A)(H?"gkji2_RB":"kKPD09tc",i&&"active"),round:!0,ripple:!K,size:H?"tiny":"smaller",color:"translucent",onClick:t,ariaLabel:"More actions",children:(0,te.Y)(W.A,{name:"more"})})},[K,H]);function Ze(){return(0,te.FD)(te.FK,{children:[i&&a&&i.id!==a.id&&(0,te.Y)(de.A,{icon:"bots",onClick:We,children:Pe("BotWebViewOpenBot")}),(0,te.Y)(de.A,{icon:"reload",onClick:Ve,children:Pe("WebApp.ReloadPage")}),U&&(0,te.Y)(de.A,{icon:"settings",onClick:Ee,children:Pe("Settings")}),a?.isAttachBot&&(0,te.Y)(de.A,{icon:r?"stop":"install",onClick:Je,destructive:Boolean(r),children:Pe(r?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")})]})}function Xe(){return(0,te.Y)(qe.A,{isOpen:ne,anchor:ae,ref:Z,className:(0,me.A)(H?Xn:"web-app-more-menu","with-menu-transitions"),getTriggerElement:ee,getMenuElement:se,getRootElement:ie,autoClose:!0,onClose:re,onCloseAnimationEnd:le,children:Ze()})}const et=(0,me.A)("RuJ3d9N6",E&&"IWA50OWU"),tt=(0,s.Kr)(()=>{if(L)return"color-text";if(!V)return;const{r:e,g:t,b:i}=(0,An.E2)(V),s=(0,gn.LS)([e,t,i]);return("dark"===l?255-s:s)>128?"color-text":"color-background"},[V,l,L]);function it(e){return(0,te.Y)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,te.Y)("path",{className:"bOuMHiVw","fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 16V0C16 12 12 16 0 16H16Z"})})}const st=(0,s.li)();function nt(e){return(0,me.A)(o.jQ1,e)}return(0,Nn.A)(st,!J||j||!st.current),(0,te.FD)(X.A,{dialogRef:$,className:(0,me.A)("XWfkIDLY",H&&"gBVR7Hec",j&&"dJ1Ld_PX",z&&"ciSTWz16"),dialogStyle:H?be:void 0,dialogContent:he&&!j?(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:nt("top")}),(0,te.Y)("div",{className:nt("bottom")}),(0,te.Y)("div",{className:nt("left")}),(0,te.Y)("div",{className:nt("right")}),(0,te.Y)("div",{className:nt("topLeft")}),(0,te.Y)("div",{className:nt("topRight")}),(0,te.Y)("div",{className:nt("bottomLeft")}),(0,te.Y)("div",{className:nt("bottomRight")})]}):void 0,isOpen:J,isLowStackPriority:!0,onClose:Ue,header:(0,te.Y)("div",{ref:q,children:H?G?(0,te.FD)("div",{className:(0,me.A)("modal-header","multiTab"),style:(0,Di.A)(tt&&`--color-header-text: var(--${tt})`),children:[(0,te.Y)(Q.A,{className:"GE5AkJOU",round:!0,color:"translucent",size:"tiny",ariaLabel:Pe(E?"Back":"Close"),onClick:Ge,children:(0,te.Y)("div",{className:et})}),(0,te.FD)("div",{className:"X18WbDa5",ref:st,children:[O?.map(e=>e.isOpen?function(){const e=(0,Di.A)(tt&&`--color-header-text: var(--${tt})`,V&&`--active-tab-background: ${V}`);return(0,te.FD)("div",{className:Hn,style:e,children:[it(Qn),(0,te.FD)("div",{className:$n,children:[(0,te.FD)("div",{className:"z39ojrWc",children:[(0,te.Y)(Mt.A,{size:"mini",peer:a}),(0,te.Y)(Qe,{onTrigger:oe,isOpen:ne})]}),r?.shortName??a?.firstName,(0,te.Y)("div",{className:qn}),(0,te.Y)(Q.A,{className:Wn,round:!0,color:"translucent",size:"tiny",ariaLabel:Pe("Close"),onClick:Ke,children:(0,te.Y)(W.A,{className:ta,name:"close"})})]}),it(Zn)]})}():(0,te.Y)(Mt.A,{className:"tI6TE6HP",size:"mini",peer:e.bot,onClick:()=>$e(e)})),L&&(0,te.FD)("div",{className:Hn,children:[it(Qn),(0,te.FD)("div",{className:$n,children:[(0,te.Y)("div",{className:"Obu3ui67",children:(0,te.Y)(W.A,{className:sa,name:"add"})}),Ye("OpenApp"),(0,te.Y)("div",{className:qn}),(0,te.Y)(Q.A,{className:Wn,round:!0,color:"translucent",size:"tiny",ariaLabel:Pe("Close"),onClick:Oe,children:(0,te.Y)(W.A,{className:ta,name:"close"})})]}),it(Zn)]})]}),Xe(),(0,te.FD)("div",{className:"qK4q0Sat",children:[!L&&(0,te.Y)(Q.A,{className:(0,me.A)("cEuW1_hJ","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:He,children:(0,te.Y)(W.A,{className:sa,name:"add"})}),!L&&(0,te.Y)(Q.A,{className:(0,me.A)(ea,"otlJULGy","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:ze,children:(0,te.Y)(W.A,{className:ia,name:"expand-modal"})}),(0,te.Y)(Q.A,{className:(0,me.A)(ea,"no-drag"),round:!0,color:"translucent",size:"tiny",onClick:je,children:(0,te.Y)(W.A,{className:ia,name:"collapse-modal"})})]})]}):(0,te.Y)(In,{}):(0,te.FD)("div",{className:"modal-header",style:(0,Di.A)(V&&`background-color: ${V}`,tt&&`--color-header-text: var(--${tt})`),children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:Pe(E?"Back":"Close"),onClick:Ge,children:(0,te.Y)("div",{className:et})}),(0,te.Y)("div",{className:"modal-title",children:r?.shortName??a?.firstName}),!L&&(0,te.Y)(ce.A,{className:(0,me.A)(H?Xn:"web-app-more-menu","with-menu-transitions"),trigger:Qe,positionX:H?"left":"right",children:Ze()})]})}),style:`background-color: ${_||"var(--color-background)"}`,noBackdrop:!0,noBackdropClose:!0,children:[z&&Xe(),P&&R?.map(e=>(0,te.Y)(zn,{modal:t,registerSendEventCallback:Be,registerReloadFrameCallback:Le,webApp:P[e],isTransforming:Ae||fe,onContextMenuButtonClick:oe,isMultiTabSupported:H,modalHeight:Ie},e)),L&&(0,te.Y)(Bn,{})]})})),la=(0,s.ph)(e=>{let{bot:t,type:i,shouldRequestWriteAccess:a}=e;const{cancelBotTrustRequest:o,markBotTrusted:r}=(0,n.ko)(),[c,d]=(0,s.J0)(a||!1),h=(0,T.A)(),u=(0,s.hb)(()=>{r({botId:t.id,isWriteAllowed:c})},[r,c,t]),m=(0,s.hb)(()=>{o()},[]),p=h("game"===i?"AppName":"BotOpenPageTitle"),v=(0,s.Kr)(()=>{switch(i){case"game":return h("BotPermissionGameAlert",(0,l.Yg)(t));case"webApp":return h("BotOpenPageMessage",(0,l.Yg)(t));default:return h("BotWebViewStartPermission")}},[t,i,h]);return(0,te.FD)(vi.A,{isOpen:Boolean(t),onClose:m,title:p,confirmHandler:u,children:[(0,Dt.A)(v,["simple_markdown"]),a&&(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:c,label:(0,Dt.A)(h("WebApp.AddToAttachmentAllowMessages",t?.firstName),["simple_markdown"]),onCheck:d})]})}),ca=(0,s.ph)(e=>{let{modal:t}=e;const{confirmAttachBotInstall:i,cancelAttachBotInstall:a}=(0,n.ko)(),r=t?.bot,[l,c]=(0,s.J0)(!1),d=(0,T.A)(),h=(0,s.hb)(()=>{i({isWriteAllowed:Boolean(r?.shouldRequestWriteAccess)})},[i,r]);(0,s.vJ)(()=>{r&&c(!1)},[r]);const u=(0,s.Kr)(()=>{const e=d("lng_mini_apps_disclaimer_button").split("{link}"),t=d("lng_mini_apps_disclaimer_link");return[e[0],(0,te.Y)("a",{href:o.Pje,target:"_blank",rel:"noopener noreferrer",children:t}),e[1]]},[d]);return(0,te.FD)(vi.A,{isOpen:Boolean(r),onClose:a,title:d("lng_mini_apps_disclaimer_title"),confirmHandler:h,isConfirmDisabled:!l,children:[(0,Dt.A)(d("lng_mini_apps_disclaimer_text",r?.shortName),["simple_markdown"]),(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:l,label:u,onCheck:c}),(0,Dt.A)(d("WebBot.Account.Desclaimer.Desc",r?.shortName),["simple_markdown"])]})}),da=(0,s.ph)(e=>{let{folder:t}=e;const{closeDeleteChatFolderModal:i,deleteChatFolder:a,openDeleteChatFolderModal:o}=(0,n.ko)(),r=(0,T.A)(),l=Boolean(t),c=(0,_.A)(t)||t,d=c?.hasMyInvites,h=(0,s.hb)(()=>{i(),d?o({folderId:c.id,isConfirmedForChatlist:!0}):a({id:c.id})},[d,c]);return(0,te.Y)(vi.A,{isOpen:l,onClose:i,text:r(d?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:r("Delete"),confirmHandler:h,confirmIsDestructive:!0})});var ha=i(64520),ua=i(17142),ma=i(66833),pa=i(87412),va=i(38777);const ga={root:"Wn7D2H1e",text:"IQ1U2TrZ",header:"F6qqXRvD",description:"ILLaH6qQ",icon:"DzGwbpu5","font-icon":"Pa9h5mh3",fontIcon:"Pa9h5mh3"},Aa=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(An.E2),fa=(0,s.ph)(e=>{let{icon:t,isFontIcon:i,title:s,text:n,index:a,count:o,section:r,onClick:l}=e;const c=a/o*Aa.length,d=Aa[Math.floor(c)],h=Aa[Math.ceil(c)]??d,{r:u,g:m,b:p}=(0,An.dD)(d,h,.5),v=(0,M.A)(()=>{l?.(r)});return(0,te.FD)(ci.A,{buttonClassName:ga.root,onClick:v,inactive:!l,children:[i?(0,te.Y)(W.A,{name:t,className:ga.fontIcon,style:`--item-color: rgb(${u},${m},${p})`}):(0,te.Y)("img",{src:t,className:ga.icon,alt:"",style:`--item-color: rgb(${u},${m},${p})`,draggable:!1}),(0,te.FD)("div",{className:ga.text,children:[(0,te.Y)("div",{className:ga.title,children:(0,Dt.A)(s,["br"])}),(0,te.Y)("div",{className:ga.description,children:n})]})]})});var ba=i(57446);const Ca="cqNhvdib",ya="wDzTWXzO",Sa=(0,s.ph)(e=>{let{length:t,active:i,onSelectSlide:n}=e;const a=Math.max(0,Math.min(t-8,i-4)),o=a===t-8-1,r=a===t-8,l=0===a,c=1===a,d=Math.min(t,8),h=(0,s.hb)(()=>{n(i+1)},[i,n]),m=(0,s.hb)(()=>{n(i-1)},[i,n]),p=Math.min(8,t);return(0,te.FD)("div",{children:[!u.TF&&(0,te.Y)(Q.A,{className:(0,me.A)(Ca,0===i&&ya),color:"translucent",disabled:0===i,round:!0,onClick:m,children:(0,te.Y)(W.A,{name:"previous"})}),(0,te.Y)("div",{className:"HmY1pYD9",style:`--start-from: ${a}; --length: ${t}; --count: ${p};`,children:Array(t).fill(void 0).map((e,t)=>{const s=t,h=t===a+d-1&&!r&&!o,u=t===a+d-2&&!o&&!r||t===a+d-1&&o,m=t===a&&!l&&!c,p=t===a+1&&!l&&!c||t===a&&c,v=t<a||t>=a+d;return(0,te.Y)("div",{onClick:()=>n(t),className:(0,me.A)("Ac0pMX9w",s===i&&"NYDxCNdz",(u||p)&&"yDo_8Y7X",(h||m||v)&&"bhODNwmU",v&&"O9pyrgj0")})})}),!u.TF&&(0,te.Y)(Q.A,{className:(0,me.A)(Ca,i===t-1&&ya,"hIgQCprt"),color:"translucent",round:!0,disabled:i===t-1,onClick:h,children:(0,te.Y)(W.A,{name:"next"})})]})}),ka="Hy5kWx0p",wa=(0,s.ph)(e=>{let{leftValue:t,rightValue:i,className:s,floatingBadgeIcon:n,rightStyle:a}=e;const o=(0,T.A)();return(0,te.FD)("div",{className:(0,me.A)("u84X0r2z",s),children:[n&&(0,te.FD)("div",{className:"hPi4fICJ",children:[(0,te.Y)(W.A,{name:n,className:"XkiOXdMP"}),(0,te.Y)("div",{className:"iC3LJrvy",dir:o.isRtl?"rtl":void 0,children:t}),(0,te.Y)("div",{className:"jufjjcX9",children:(0,te.Y)("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none",children:(0,te.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,te.FD)("div",{className:(0,me.A)(ka,"scGr4JS9"),children:[(0,te.Y)("div",{className:"OejVAPj6 YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitFree")}),!n&&(0,te.Y)("div",{className:"RJosx238 YaiSoFKE",children:t})]}),(0,te.FD)("div",{className:(0,me.A)(ka,"nPaUalQf"),style:a,children:[(0,te.Y)("div",{className:"COQdFBQk YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitPremium")}),(0,te.Y)("div",{className:"BEq3jFlz YaiSoFKE YaiSoFKE",children:i})]})]})}),Na=[91,160,255],Ia=[197,100,243],Pa=(0,s.ph)(e=>{let{title:t,description:i,leftValue:n,rightValue:a,colorStepProgress:o}=e;const r=(0,s.Kr)(()=>Na.map((e,t)=>(0,ve.Cc)(e,Ia[t],o)),[o]);return(0,te.FD)("div",{className:"ZXp65Wgy",children:[(0,te.Y)("div",{className:"W1xG3pjS",children:t}),(0,te.Y)("div",{className:"b_CBXIkT",children:i}),(0,te.Y)(wa,{leftValue:n,rightValue:a,rightStyle:`background: rgb(${r.join(",")})`})]})});var Ya=i(67054),Fa=i(18104);const Da=e=>{let{size:t,realIndex:i,canPlay:n,sticker:a,index:o,maxLength:r,onClick:l,onEnded:c}=e;const d=(0,z.A)(`sticker${a.id}`),h=(0,z.A)(`sticker${a.id}?size=f`),u=0===o,[m,p,v]=(0,F.A)(u),g=t-.6*t,A=3*g,f=3.2*g,b=o/r*(2*Math.PI),C=u?1:.66,y=Math.cos(b)*A-2.8*g,S=Math.sin(b)*f,k=(0,M.A)(()=>{l(i)}),w=(0,M.A)(()=>{v(),c(i)});return(0,s.vJ)(()=>{u&&p()},[u,p]),(0,te.FD)(te.FK,{children:[u&&(0,te.Y)(Fa.A,{className:"Stdz4UIW ogaoEAcn",tgsUrl:h,play:n,isLowPriority:!0,noLoop:!0,size:.8*t,style:`--x: calc(${y}px - 10%); --y: ${S}px;`}),(0,te.Y)(Fa.A,{className:"ogaoEAcn",tgsUrl:d,play:n&&m,noLoop:!0,size:.6*t,style:`--x: ${y}px; --y: ${S}px; --opacity: ${C}`,onClick:k,onEnded:w})]})},Ma=(0,s.ph)((0,n.EK)(e=>({stickers:e.stickers.premium.stickers}))(e=>{let{stickers:t,isActive:i}=e;const n=(0,s.li)(),[a,o]=(0,s.J0)(0),[r,l]=(0,s.J0)(0),c=t?.slice(0,15),d=(0,M.A)(e=>{o(-e)}),h=(0,M.A)(e=>{0===(0,Ya.A)(c.length,e+a)&&setTimeout(()=>{o(e=>(0,Ya.A)(c.length,e+1))},150)});return(0,s.vJ)(()=>{const e=n.current;e&&l(e.closest(".modal-dialog").clientWidth)},[]),(0,te.Y)("div",{className:"O1fqNCy0",ref:n,children:Boolean(r)&&c?.map((e,t)=>(0,te.Y)(Da,{size:r,sticker:e,realIndex:t,index:(t+a+c.length)%c.length,maxLength:c.length,onClick:d,onEnded:h,canPlay:i}))})}));var Ta=i(38691),Ba=i(88554);const Ra={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"},La={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},xa={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"},Ea=Object.keys(Ra),Va=Mt.R.giant+.25*g.$,_a=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(e=>{let{currentUser:t}=e;const i=(0,s.li)(),n=(0,T.A)(),a=(0,Ta.A)();(0,s.Nf)(()=>{i.current&&(0,Ba.$)({canvas:i.current,size:Va*a,segmentsCount:8,color:"purple",readSegmentsCount:0,readSegmentColor:"transparent",dpr:a})},[a]);const{handleScroll:o,isAtBeginning:r}=bs(),l=Va;return(0,te.FD)("div",{className:"mFElmm7a",children:[(0,te.FD)("div",{className:"Jjbochk6",children:[(0,te.Y)(Mt.A,{forPremiumPromo:!0,peer:t,size:"giant"}),(0,te.Y)("canvas",{className:"ChteQ9C3",ref:i,style:`max-width: ${l}px; max-height: ${l}px`})]}),(0,te.Y)("div",{className:"d2ayix6L",children:n("UpgradedStories")}),(0,te.FD)("div",{className:(0,me.A)("ensyCeMe",!r&&"iN1T0a2Y","custom-scroll"),onScroll:o,children:[Ea.map((e,t)=>(0,te.Y)(fa,{title:n(Ra[e]),text:n(La[e]),icon:xa[e],isFontIcon:!0,index:t,count:Ea.length,section:e},e)),(0,te.Y)("div",{className:"DFbZJafh",children:n("lng_premium_stories_about_mobile")})]})]})})),Ua={root:"Ot0dA1yZ",wrapper:"yxSAGAc1",down:"Jcy6cDoc",frame:"Vn81yTTJ",video:"rrVJClLL"},Oa=i.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg",Ka=(0,s.ph)(e=>{let{videoId:t,isReverseAnimation:i,isDown:s,videoThumbnail:n,index:a,isActive:o}=e;const r=(0,z.A)(`document${t}`),l=(0,Vi.A)(n.dataUri),c=(0,Oi.A)(r);return(0,te.Y)("div",{className:Ua.root,children:(0,te.FD)("div",{className:(0,me.A)(Ua.wrapper,i&&Ua.reverse,s&&Ua.down),id:`premium_feature_preview_video_${a}`,children:[(0,te.Y)("img",{src:Oa,alt:"",className:Ua.frame,draggable:!1}),(0,te.Y)("canvas",{ref:l,className:Ua.video}),(0,te.Y)(zi.A,{canPlay:o,className:(0,me.A)(Ua.video,c),src:r,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})]})})}),Ja="a7IoUtQG",Ga="gubS9KP1",ja="iZLwcL8v",za="A7YHY8qF",Ha={double_limits:"PremiumPreviewLimits",infinite_reactions:"PremiumPreviewReactions2",premium_stickers:"PremiumPreviewStickers",animated_emoji:"PremiumPreviewEmoji",no_ads:"PremiumPreviewNoAds",voice_to_text:"PremiumPreviewVoiceToText",profile_badge:"PremiumPreviewProfileBadge",faster_download:"PremiumPreviewDownloadSpeed",more_upload:"PremiumPreviewUploads",advanced_chat_management:"PremiumPreviewAdvancedChatManagement",animated_userpics:"PremiumPreviewAnimatedProfiles",emoji_status:"PremiumPreviewEmojiStatus",translations:"PremiumPreviewTranslations",stories:"PremiumPreviewStories",saved_tags:"PremiumPreviewTags2",last_seen:"PremiumPreviewLastSeen",message_privacy:"PremiumPreviewMessagePrivacy",effects:"Premium.MessageEffects",todo:"PremiumPreviewTodo"},$a={double_limits:"PremiumPreviewLimitsDescription",infinite_reactions:"PremiumPreviewReactions2Description",premium_stickers:"PremiumPreviewStickersDescription",no_ads:"PremiumPreviewNoAdsDescription",animated_emoji:"PremiumPreviewEmojiDescription",voice_to_text:"PremiumPreviewVoiceToTextDescription",profile_badge:"PremiumPreviewProfileBadgeDescription",faster_download:"PremiumPreviewDownloadSpeedDescription",more_upload:"PremiumPreviewUploadsDescription",advanced_chat_management:"PremiumPreviewAdvancedChatManagementDescription",animated_userpics:"PremiumPreviewAnimatedProfilesDescription",emoji_status:"PremiumPreviewEmojiStatusDescription",translations:"PremiumPreviewTranslationsDescription",stories:"PremiumPreviewStoriesDescription",saved_tags:"PremiumPreviewTagsDescription2",last_seen:"PremiumPreviewLastSeenDescription",message_privacy:"PremiumPreviewMessagePrivacyDescription",effects:"Premium.MessageEffectsInfo",todo:"PremiumPreviewTodoDescription"},qa={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle",recommendedChannels:"SimilarChannelsLimitTitle",moreAccounts:"ConnectedAccountsLimitTitle"},Wa={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle",recommendedChannels:"SimilarChannelsLimitSubtitle",moreAccounts:"ConnectedAccountsLimitSubtitle"},Qa=(0,s.ph)(e=>{let{promo:t,initialSection:i,isPremium:n,limits:a,premiumPromoOrder:l,subscriptionOption:c,onBack:d,onClickSubscribe:h}=e;const u=(0,T.A)(),m=(0,_i.A)(),p=(0,s.li)(),[v,g]=(0,s.J0)(o.O2i.indexOf(i)),[A,f]=(0,s.J0)(0),[b,C,y]=(0,F.A)(),[S,k]=(0,s.J0)(!0),[w,N]=(0,s.J0)(!1),I=(0,_.A)(i),P=(0,s.Kr)(()=>l?l.filter(e=>o.O2i.includes(e)):o.O2i,[l]),Y=(0,s.Kr)(()=>{if(!c)return;const{amount:e,months:t,currency:i}=c,s=Math.floor(e/t);return n?m("OK"):m("SubscribeToPremium",{price:(0,ua.vv)(m,s,i)},{withNodes:!0})},[n,m,c]),D=(0,M.A)(()=>{h(i)});function B(e){const{scrollTop:t,clientHeight:i,scrollHeight:s}=e.currentTarget;k(t<=20),N(t>=s-i-20)}(0,s.vJ)(()=>{const e=p.current;if(!e||I===i)return;const t=P.indexOf(i);g(t),C(),(0,ba.A)(e,e.clientWidth*t,0).then(y)},[v,P,i,I]);const R=(0,M.A)(async e=>{const t=p.current;t&&(g(e),C(),await(0,ba.A)(t,t.clientWidth*e,800),y())}),L=P[v],x="double_limits"!==L&&"stories"!==L;return(0,te.FD)("div",{className:"oyUTEj8I",children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",className:(0,me.A)("njYoMrKM",x&&"SB4pczOo"),color:x?"translucent-white":"translucent",onClick:d,ariaLabel:u("Back"),children:(0,te.Y)(W.A,{name:"arrow-left"})}),(0,te.Y)("div",{className:"dIVBSdWi"}),(0,te.Y)("div",{className:(0,me.A)("sJubG84j","no-scrollbar"),onScroll:function(e){const t=e.currentTarget,{clientWidth:i,scrollLeft:s}=t,n=Math.round(s),a=n%i/i,o=Math.ceil((n+1)/i);f(o);const l=t.querySelector("#premium_feature_preview_video_"+(o-1)),c=t.querySelector(`#premium_feature_preview_video_${o}`);if((0,r.RK)(()=>{t.style.setProperty("--scroll-progress",a.toString()),t.style.setProperty("--abs-scroll-progress",Math.abs(a).toString()),l&&(0,qi.dH)(l,"reverse",!1),c&&(0,qi.dH)(c,"reverse",!0)}),b)return;const d=Math.round(n/i);g(d)},ref:p,children:P.map((e,i)=>{if("double_limits"===e)return(0,te.FD)("div",{className:(0,me.A)(Ga,"U7ePgVBR"),children:[(0,te.Y)("h2",{className:(0,me.A)("mz2Hmd83",S&&"AgmNOqi7"),children:u(Ha.double_limits)}),(0,te.Y)("div",{className:(0,me.A)("n_rowVPI","custom-scroll"),onScroll:B,children:o.M$8.map((e,t)=>{const i=a?.[e][0].toString(),s=a?.[e][1].toString();return(0,te.Y)(Pa,{title:u(qa[e]),description:u(Wa[e],s),leftValue:i,rightValue:s,colorStepProgress:t/(o.M$8.length-1)})})})]});if("premium_stickers"===e)return(0,te.FD)("div",{className:Ga,children:[(0,te.Y)("div",{className:Ja,children:(0,te.Y)(Ma,{isActive:v===i})}),(0,te.Y)("h1",{className:ja,children:u(Ha.premium_stickers)}),(0,te.Y)("div",{className:za,children:(0,Dt.A)(u($a.premium_stickers),["br"])})]});if("stories"===e)return(0,te.Y)("div",{className:(0,me.A)(Ga,"J1M6fEdo"),children:(0,te.Y)(_a,{})});const s=t.videoSections.indexOf(e);if(-1===s)return;const n="todo"===t.videoSections[s];return(0,te.FD)("div",{className:Ga,children:[(0,te.Y)("div",{className:Ja,children:(0,te.Y)(Ka,{isActive:v===i,videoId:t.videos[s].id,videoThumbnail:t.videos[s].thumbnail,isDown:o.jhT.includes(e),index:i,isReverseAnimation:i===A})}),(0,te.Y)("h1",{className:ja,children:n?m(Ha[t.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):u(Ha[t.videoSections[s]])}),(0,te.Y)("div",{className:za,children:(0,Dt.A)(n?m($a[t.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):u($a[t.videoSections[s]]),["br"])})]})})}),(0,te.FD)("div",{className:(0,me.A)("yN2611rA",(w||0!==v)&&"rCHMABcD"),children:[(0,te.Y)(Sa,{length:o.O2i.length,active:v,onSelectSlide:R}),Boolean(Y)&&(0,te.Y)(Q.A,{className:(0,me.A)("EPfM7AgT"),isShiny:!n,withPremiumGradient:!n,onClick:n?d:D,children:Y})]})]})}),Za=(0,s.ph)(e=>{let{option:t,checked:i,fullMonthlyAmount:n,onChange:a,className:o,isGiveaway:r}=e;const l=(0,T.A)(),{months:c,amount:d,currency:h}=t,u="users"in t?t.users:void 0,m=Math.floor(d/c),p=u?u>1:void 0,v=(0,s.Kr)(()=>n&&n>m?Math.ceil(100-m/(n/100)):void 0,[n,m]),g=(0,s.hb)(e=>{e.target.checked&&a(c)},[c,a]);return(0,te.FD)("label",{className:(0,me.A)(r?"PkseWxFK":"qZA6S2kc",i&&!r&&"EJOQwnRj",o),dir:l.isRtl?"rtl":void 0,children:[(0,te.Y)("input",{className:"WOEkhx6R",type:"radio",name:"subscription_option",value:c,checked:i,onChange:g}),(0,te.FD)("div",{className:"BHUCScsU",children:[(0,te.FD)("div",{className:"DfYCMUkL",children:[Boolean(v)&&(0,te.FD)("span",{className:(0,me.A)("ublijP0j","uqDlP3Zt"),title:l("GiftDiscount"),children:[" ","",v,"%"]}),l("Months",c)]}),(0,te.Y)("div",{className:"poxOXJ2o",children:r||p?`${(0,ua.Ad)(d,h,l.code)} x ${u}`:l("PricePerMonth",(0,ua.Ad)(m,h,l.code))}),(0,te.Y)("div",{className:"IGMrERf_",children:(0,ua.Ad)(d,h,l.code)})]})]})}),Xa="yKm9hKQP",eo=i.p+"PremiumAds.a758f19ece91fe91318e.svg",to=i.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",io=i.p+"PremiumChats.89d9d315638e283ca895.svg",so=i.p+"PremiumEffects.4eab9caad8e9c276842d.svg",no=i.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",ao=i.p+"PremiumFile.884dd3865acfe594fc61.svg",oo=i.p+"PremiumLastSeen.9575a548770d23785846.svg",ro=i.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",lo=i.p+"PremiumMessagePrivacy.950cab3e87c60c5733a6.svg",co=i.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",ho=i.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",uo=i.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",mo=i.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",po=i.p+"PremiumTags.3b187054cc90f8e16cb7.svg",vo=i.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",go=i.p+"PremiumVideo.288cb61931e33d913f0a.svg",Ao=i.p+"PremiumVoice.b3a2893dbe481108ab94.svg",fo=8*g.$,bo={stories:uo,double_limits:ro,infinite_reactions:co,premium_stickers:mo,animated_emoji:no,no_ads:eo,voice_to_text:Ao,profile_badge:to,faster_download:ho,more_upload:ao,advanced_chat_management:io,animated_userpics:go,emoji_status:uo,translations:vo,saved_tags:po,last_seen:oo,message_privacy:lo,effects:so,todo:to},Co=(0,s.ph)((0,n.EK)(e=>{const{premiumModal:t}=(0,c.nTw)(e),i=t?.fromUserId?(0,c.mBe)(e,t.fromUserId):void 0,s=i?.emojiStatus?(0,c.O8F)(e,i.emojiStatus.documentId):void 0,n=s?(0,c.ycM)(e,s.stickerSetInfo):void 0;return{currentUserId:e.currentUserId,promo:t?.promo,isSuccess:t?.isSuccess,isGift:t?.isGift,monthsAmount:t?.monthsAmount,gift:t?.gift,fromUser:i,fromUserStatusEmoji:s,fromUserStatusSet:n,toUser:t?.toUserId?(0,c.mBe)(e,t.toUserId):void 0,initialSection:t?.initialSection,isPremium:(0,c.g29)(e),limitChannels:(0,ha.B)(e,"channels"),limitFolders:(0,ha.B)(e,"dialogFilters"),limitPins:(0,ha.B)(e,"dialogFolderPinned"),limitLinks:(0,ha.B)(e,"channelsPublic"),limits:e.appConfig.limits,premiumSlug:e.appConfig.premiumInvoiceSlug,premiumBotUsername:e.appConfig.premiumBotUsername,premiumPromoOrder:e.appConfig.premiumPromoOrder}})(e=>{let{isOpen:t,currentUserId:i,fromUser:a,fromUserStatusEmoji:r,fromUserStatusSet:c,promo:d,initialSection:h,isPremium:u,limitChannels:m,limitLinks:p,limitFolders:v,limitPins:g,limits:A,premiumSlug:f,premiumBotUsername:b,isSuccess:C,isGift:y,toUser:S,monthsAmount:k,premiumPromoOrder:w,gift:N}=e;const I=(0,s.li)(),{closePremiumModal:P,openInvoice:Y,requestConfetti:F,openTelegramLink:D,loadStickers:B,openStickerSet:R}=(0,n.ko)(),L=(0,T.A)(),x=(0,_i.A)(),[E,V]=(0,s.J0)(!0),[_,U]=(0,s.J0)(h),[O,K]=(0,s.J0)();(0,s.vJ)(()=>{t?h&&U(h):(V(!0),U(void 0))},[t,h]);const J=(0,M.A)(e=>{U(e)}),G=(0,M.A)(()=>{U(void 0)}),z=(0,M.A)(e=>{I.current&&(f?Y({type:"slug",slug:f}):b&&(D({url:`${o.jsp}${b}?start=${e||"promo"}`}),P()))}),H=(0,M.A)(()=>{O?z(String(O.months)):z()}),$=(0,M.A)(e=>{const t=d?.options.find(t=>t.months===e);K(t)}),q=(0,M.A)(()=>{const e=I.current;if(e&&t){const{top:t,left:i,width:s,height:n}=e.querySelector(".modal-content").getBoundingClientRect();F({top:t,left:i,width:s,height:n,withStars:!0})}});(0,s.vJ)(()=>{C&&q()},[C,q]),(0,j.A)(e=>{let[t]=e;t!==u&&q()},[u,q]);const Z=(0,s.Kr)(()=>w?w.filter(e=>o.O2i.includes(e)):o.O2i,[w]);(0,s.vJ)(()=>{r&&!c&&B({stickerSetInfo:r.stickerSetInfo})},[B,r,c]),(0,s.vJ)(()=>{const[e]=d?.options??[];K(e)},[d]);const ee=(0,M.A)(()=>{c&&R({stickerSetInfo:c})}),ie=(0,s.Kr)(()=>{const e=d?.options.find(e=>1===e.months);if(e)return Number(e.amount)},[d]),se=(0,s.Kr)(()=>{if(!O)return;const{amount:e,months:t,currency:i}=O,s=Math.floor(e/t);return(0,ua.vv)(x,s,i)},[O,x]);if(d&&(!r||c))return(0,te.Y)(X.A,{className:"sfbpMFHM",onClose:P,isOpen:t,dialogRef:I,children:(0,te.Y)(ne.Ay,{name:"slide",activeKey:_?1:0,className:"ELNkgPve",children:_?(0,te.Y)(Qa,{initialSection:_,onBack:G,promo:d,onClickSubscribe:z,isPremium:u,limits:A,premiumPromoOrder:w,subscriptionOption:O}):(0,te.FD)("div",{className:(0,me.A)("ZpOIPrhp","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;V(t<=150)},children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",className:"XyN3eWog",color:"translucent",onClick:()=>P(),ariaLabel:L("Close"),children:(0,te.Y)(W.A,{name:"close"})}),function(){if(N){const e=(0,ma.yQ)(N);return(0,te.Y)(va.A,{model:"sticker",sticker:e,color:"purple",title:ae(),description:(0,Dt.A)(oe(),["simple_markdown","emoji"]),className:"lzalivui"})}return r?(0,te.FD)(te.FK,{children:[(0,te.Y)(pa.A,{className:"mQwvY9LA",onClick:ee,documentId:r.id,isBig:!0,size:fo}),(0,te.Y)("h2",{className:(0,me.A)("y71v6ECL",c&&"xw_GbDj7"),children:ae()}),(0,te.Y)("div",{className:"cUcKXV3j",children:(0,Dt.A)(oe(),["simple_markdown","emoji"])})]}):(0,te.Y)(va.A,{model:"swaying-star",color:"purple",title:ae(),description:(0,Dt.A)(oe(),["simple_markdown","emoji"]),className:"z0zfJObh"})}(),!u&&!y&&(0,te.Y)("div",{className:"xZC_Oajr",children:d?.options.map(e=>(0,te.Y)(Za,{className:"gygsbDbE",option:e,onChange:$,fullMonthlyAmount:ie,checked:O?.months===e.months},e.amount))}),(0,te.Y)("div",{className:(0,me.A)("Bc_F0RKb",E&&"ltXo0Xi7"),children:(0,te.Y)("h2",{className:"xysPdANX",children:L("TelegramPremium")})}),(0,te.FD)("div",{className:(0,me.A)("c3Ee2oSo",u&&"yWEHoJOL"),children:[Z.map((e,t)=>{const i="todo"===e;return(0,te.Y)(fa,{title:i?x(Ha[e]):L(Ha[e]),text:"double_limits"===e?L($a[e],[m,v,g,p,4]):i?x($a[e]):L($a[e]),icon:bo[e],index:t,count:Z.length,section:e,onClick:J},e)}),(0,te.FD)("div",{className:(0,me.A)(Xa,"l1WlNpmu"),dir:L.isRtl?"rtl":void 0,children:[(0,te.Y)("p",{children:(0,Dt.A)(L("AboutPremiumDescription"),["simple_markdown"])}),(0,te.Y)("p",{children:(0,Dt.A)(L("AboutPremiumDescription2"),["simple_markdown"])})]}),function(){if(d&&(!y||a?.id!==i))return(0,te.Y)("div",{className:Xa,dir:L.isRtl?"rtl":void 0,children:(0,Xi.fd)({text:d.statusText,entities:d.statusEntities})})}()]}),!u&&O&&(0,te.Y)("div",{className:"nCnlO9UZ",children:(0,te.Y)(Q.A,{className:"c1tMxuFH",isShiny:!0,withPremiumGradient:!0,onClick:H,children:L("SubscribeToPremium",se)})})]})})});function ae(){if(N)return x("PremiumGiftHeader");if(y)return(0,Dt.A)(a?.id===i?L("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,l.Yg)(S),k]):L("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,l.Yg)(a),k]),["simple_markdown","emoji"]);if(c&&a){const e=L("lng_premium_emoji_status_title").replace("{user}",(0,l.Yg)(a)),[t,i]=e.split("{link}"),s=c.thumbCustomEmojiId?(0,te.Y)(pa.A,{className:"Y0jTcadE",documentId:c.thumbCustomEmojiId}):void 0,n=(0,te.FD)("span",{className:"FLzl2ng5",onClick:ee,children:[s,(0,Dt.A)(c.title)]});return[(0,Dt.A)(t),n,(0,Dt.A)(i)]}return(0,Dt.A)(a?L("TelegramPremiumUserDialogTitle",(0,l.Yg)(a)):L(u?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])}function oe(){return N&&"starGiftUnique"!==N.type&&N.perUserTotal?x("DescriptionGiftPremiumRequired2",{count:N.perUserTotal},{pluralValue:N.perUserTotal}):y?a?.id===i?L("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Yg)(S)):L("TelegramPremiumUserGiftedPremiumDialogSubtitle"):L(c?"TelegramPremiumUserStatusDialogSubtitle":a?"TelegramPremiumUserDialogSubtitle":u?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle")}}));var yo=i(24956),So=i(31722);const ko="ItemPickerItem",wo=(0,s.ph)(e=>{let{className:t,isSearchable:i,searchInputId:n,items:a,filterValue:o,notFoundText:l,isLoading:c,noScrollRestore:d,filterPlaceholder:h,isViewOnly:u,itemInputType:m,itemClassName:p,withDefaultPadding:v,forceRenderAllItems:g,onFilterChange:A,onDisabledClick:f,onLoadMore:b,...C}=e;const y=(0,T.A)(),S=(0,s.li)(),k=C.allowMultiple,w=k?C.lockedSelectedValues:void 0,N=k?C.lockedUnselectedValues:void 0;(0,s.vJ)(()=>{if(!i)return;const e=window.setTimeout(()=>{(0,r.YS)(()=>{S.current?.focus()})},500);return()=>{window.clearTimeout(e)}},[i]);const I=(0,s.Kr)(()=>k?C.selectedValues:C.selectedValue?[C.selectedValue]:Ci.p,[k,C.selectedValue,C.selectedValues]),P=(0,s.Kr)(()=>new Set(w),[w]),Y=(0,s.Kr)(()=>new Set(N),[N]),F=(0,s.Kr)(()=>{if(o)return a.map(e=>e.value);const e=[],t=[],i=[];return a.forEach(s=>{P.has(s.value)?e.push(s):Y.has(s.value)?i.push(s):t.push(s)}),e.concat(t,i).map(e=>e.value)},[o,a,P,Y]),D=(0,M.A)(e=>{if(k){const t=I.slice(),i=t.indexOf(e);return i>=0?t.splice(i,1):t.push(e),void C.onSelectedValuesChange?.(t)}C.onSelectedValueChange?.(e)}),[B,R]=(0,Bs.A)(b,F,Boolean(g||o)),L=(0,M.A)(e=>{const{value:t}=e.currentTarget;A?.(t)}),x=(0,s.hb)(e=>{const t=a.find(t=>t.value===e);if(!t)return;const{label:i,subLabel:s,isLoading:n}=t,o=Y.has(e),r=P.has(e),l=o||r,c=I.includes(e);return(0,te.Y)(_s.A,{className:(0,me.A)(ko,p),title:i,subtitle:s,disabled:l,inactive:u,ripple:!0,inputElement:l?(0,te.Y)(W.A,{name:"lock-badge"}):"radio"===m?(0,te.Y)(yo.A,{checked:c,disabled:l,isLoading:n,onlyInput:!0}):"checkbox"===m?(0,te.Y)(sn.A,{checked:c,disabled:l,isLoading:n,onlyInput:!0}):void 0,onClick:()=>D(e),onDisabledClick:f&&(()=>f(e,r))},e)},[a,Y,P,I,u,f,m,p]);return(0,te.FD)("div",{className:(0,me.A)(So.A.container,t),children:[i&&(0,te.Y)("div",{className:(0,me.A)(So.A.header,"custom-scroll"),dir:y.isRtl?"rtl":void 0,children:(0,te.Y)(Z.A,{id:n,ref:S,value:o,onChange:L,placeholder:h||y("Search")})}),B?.length?(0,te.Y)(Cs.A,{className:(0,me.A)(So.A.pickerList,v&&So.A.padded,"custom-scroll"),items:B,itemSelector:`.${ko}`,onLoadMore:R,noScrollRestore:d,children:B.map(e=>x(e))}):c||!B||B.length?(0,te.Y)(xs.A,{}):(0,te.Y)("p",{className:So.A.noResults,children:l||y("SearchEmptyViewTitle")})]})}),No={root:"wzzA3MFh",pickerSelector:"xhujrq9i",pickerTitle:"YuRK4e7S",picker:"YF9nLkCK",footer:"ATCZ2Q5G"},Io=(0,s.ph)(e=>{let{isOpen:t,onClose:i,onSubmit:a,countryList:o,selectionLimit:r}=e;const{showNotification:l}=(0,n.ko)(),c=(0,T.A)(),[d,h]=(0,s.J0)([]),u=(0,_.A)(d)===d,m=(0,s.Kr)(()=>o?o.filter(e=>!e.isHidden&&"FT"!==e.iso2).map(e=>{let{iso2:t,defaultName:i}=e;return{value:t,label:i}}):[],[o]),p=(0,M.A)(e=>{r&&e.length>r?l({message:c("BoostingSelectUpToWarningCountries",r)}):h(e)}),v=(0,M.A)(()=>{a(d),i()});return(0,te.FD)(X.A,{className:No.root,isOpen:t,onClose:i,onEnter:v,children:[(0,te.Y)("div",{className:No.container,children:(0,te.FD)("div",{className:No.pickerSelector,children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:i,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("h4",{className:No.pickerTitle,children:c("BoostingSelectCountry")})]})}),(0,te.Y)("div",{className:(0,me.A)(No.main,"custom-scroll"),children:(0,te.Y)(wo,{className:No.picker,items:m,selectedValues:d,onSelectedValuesChange:p,noScrollRestore:u,allowMultiple:!0,itemInputType:"checkbox"})}),(0,te.Y)("div",{className:No.footer,children:(0,te.Y)(Q.A,{onClick:v,children:c("SelectCountries.OK")})})]})});var Po=i(1526),Yo=i(96530),Fo=i(11124),Do=i(34642);const Mo=(0,s.ph)(e=>{let{isOpen:t,giveawayChatId:i,selectionLimit:a,initialSelectedIds:o,onSelectedIdsConfirmed:r,onClose:c}=e;const{showNotification:d}=(0,n.ko)(),h=(0,T.A)(),[u,m]=(0,s.J0)(void 0),[p,v]=(0,s.J0)(""),[g,A,f]=(0,F.A)(),[b,C]=(0,s.J0)(o);(0,s.vJ)(()=>{C(o)},[o]);const y=(0,s.Kr)(()=>{const e=(0,n.mS)(),t=e.chats.byId,{active:s,archived:a}=e.chats.listIds,o=(s||[]).concat(a||[]);return(0,bi.Am)(o).map(e=>t[e]).filter(e=>e&&((0,l.WX)(e)||(0,l.Vs)(e))&&e.id!==i).map(e=>e.id)},[i]),S=(0,s.Kr)(()=>{const e=y?(0,Ft.PU)({ids:y,query:p,type:"chat"}):[];return(0,Ms.A)(e,!1,b)},[y,p,b]),k=(0,M.A)(e=>{const t=(0,n.mS)().chats.byId,i=e.filter(e=>!b.includes(e)).find(e=>{const i=t[e];return i&&!(0,l.gA)(i)});b?.length>=a?d({message:h("BoostingSelectUpToWarningChannelsPlural",a)}):i?(m(i),A()):C(e)}),w=(0,M.A)(()=>{u&&C((0,bi.Am)([...b,u])),f()}),N=(0,M.A)(()=>{r(b),c()});return(0,te.FD)(Do.A,{isOpen:t,onClose:c,title:h("RequestPeer.ChooseChannelTitle"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:h("Save"),onConfirm:N,onEnter:N,children:[(0,te.Y)(yi.A,{itemIds:S,selectedIds:b,filterValue:p,filterPlaceholder:h("Search"),onSelectedIdsChange:k,onFilterChange:v,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"}),(0,te.Y)(vi.A,{title:h("BoostingGiveawayPrivateChannel"),text:h("BoostingGiveawayPrivateChannelWarning"),confirmLabel:h("Add"),isOpen:g,onClose:f,confirmHandler:w})]})}),To=(0,s.ph)(e=>{let{option:t,checked:i,name:s,text:n,img:a,isLink:o,onChange:r,onClickAction:l,className:c,userNames:d,selectedMemberIds:h}=e;const u=(0,T.A)();let m=u(n);o&&h?.length&&(m=h.length>2?h.length.toString():d);const p=(0,M.A)(e=>{e.target.checked&&r(t)}),v=(0,M.A)(()=>{l?.()});return(0,te.FD)("label",{className:(0,me.A)("w3OGYFKn",c),dir:u.isRtl?"rtl":void 0,role:"button",tabIndex:0,children:[(0,te.Y)("input",{className:"xy4AclZa",type:"radio",name:"giveaway_option",value:t,checked:i,onChange:p,onClick:e=>e.stopPropagation()}),(0,te.FD)("div",{className:"TTgSI7Xh",children:[(0,te.Y)("img",{className:"lGhZJbMF",src:a,alt:"",draggable:!1}),(0,te.FD)("div",{className:"sEt7TF59",children:[(0,te.Y)("h3",{className:"u4NzVBBi",children:u(s)}),o?(0,te.FD)("div",{className:"y7XfPOoG",onClick:v,children:[(0,te.Y)("span",{children:m}),(0,te.Y)(W.A,{name:"next"})]}):(0,te.Y)("span",{className:"kt2ZKZ6j",children:m})]})]})]})}),Bo=(0,s.ph)((0,n.EK)((e,t)=>{let{giveawayChatId:i}=t;const s=i?(0,c.AWZ)(e,i):void 0;return s?{members:s.members,adminMembersById:s.adminMembersById}:{members:void 0,adminMembersById:void 0}})(e=>{let{isOpen:t,selectionLimit:i,members:a,adminMembersById:o,initialSelectedIds:r,onSelectedIdsConfirmed:c,onClose:d}=e;const{showNotification:h}=(0,n.ko)(),u=(0,T.A)(),[m,p]=(0,s.J0)(""),[v,g]=(0,s.J0)(r);(0,s.vJ)(()=>{g(r)},[r]);const A=(0,s.Kr)(()=>{const e=(0,n.mS)(),{byId:t,statusesById:i}=e.users;if(!a?.length)return[];const s=o&&new Set(Object.keys(o)),r=(0,l.UB)(a.map(e=>{let{userId:t}=e;return t}),t,i);return s?r.filter(e=>!s.has(e)):r},[o,a]),f=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=A?(0,Ft.PU)({ids:A,query:m,type:"user"}):[];return(0,Ms.A)((0,bi.Am)(t).filter(t=>{const i=e[t];return!i||!(0,l.tv)(i)}))},[A,m]),b=(0,M.A)(e=>{e.length>i?h({message:u("BoostingSelectUpToWarningUsers",i)}):g(e)}),C=(0,M.A)(()=>{c(v),d()});return(0,te.Y)(Do.A,{isOpen:t,onClose:d,title:u("BoostingAwardSpecificUsers"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:u("Save"),onConfirm:C,onEnter:C,children:(0,te.Y)(yi.A,{itemIds:f,selectedIds:v,filterValue:m,filterPlaceholder:u("Search"),onSelectedIdsChange:b,onFilterChange:p,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"})})})),Ro="rZRDMqUL",Lo="JjDLNrKG",xo="p5Hn4Q6E",Eo="rniPcuiP",Vo="G9H3tm6D",_o="xKl2UeV8",Uo="HLx3wTBD",Oo="Ftr7zf2v",Ko="Ce0Ob2tg",Jo="rDFQAfTt",Go="LZ3vPzak",jo="Z9QJQ6IS",zo="ldn4mh2T";var Ho=i(72078),$o=i(68153),qo=i(65741),Wo=i(45318);const Qo=i.p+"PremiumStar.39c1ff364d35554f4b80.svg",Zo={3:$o,6:Ho,12:qo},Xo=(0,s.ph)((0,n.EK)(e=>{const{giveawayModal:t}=(0,c.nTw)(e),i=t?.chatId,s=i?(0,c.hds)(e,i):void 0,n=s&&(0,l.WX)(s);return{chatId:i,gifts:t?.gifts,selectedMemberList:t?.selectedMemberIds,selectedChannelList:t?.selectedChannelIds,giveawayBoostPerPremiumLimit:e.appConfig.giveawayBoostsPerPremium,isStarsGiftEnabled:e.appConfig.isStarsGiftEnabled,userSelectionLimit:e.appConfig.giveawayAddPeersMax,countrySelectionLimit:e.appConfig.giveawayCountriesMax,countryList:e.countryList.general,prepaidGiveaway:t?.prepaidGiveaway,isChannel:n,starsGiftOptions:t?.starOptions}})(e=>{let{chatId:t,gifts:i,isOpen:a,isChannel:r,selectedMemberList:c,selectedChannelList:d,giveawayBoostPerPremiumLimit:h=o.CQG,countryList:u,prepaidGiveaway:m,countrySelectionLimit:p=o.y67,userSelectionLimit:v=o.qbC,isStarsGiftEnabled:g,starsGiftOptions:A}=e;const f=(0,s.li)(),{closeGiveawayModal:b,openInvoice:C,openPremiumModal:y,launchPrepaidGiveaway:S,launchPrepaidStarsGiveaway:k}=(0,n.ko)(),w=(0,T.A)(),[N,I,P]=(0,F.A)(),[Y,D,B]=(0,F.A)(),[R,L,x]=(0,F.A)(),[E,V,_]=(0,F.A)(),[U,O,K]=(0,F.A)(),J=[{name:"Premium.Title",text:"BoostingWinnersRandomly",value:"premium_giveaway",img:Ho,actions:"createPremiumGiveaway",isLink:!0,onClickAction:()=>{V()}}];g&&J.push({name:"TelegramStars",text:"BoostingWinnersRandomly",value:"stars_giveaway",img:Wo,actions:"createStarsGiveaway",isLink:!1});const[G,j]=(0,s.J0)(Date.now()+2592e5),[z,H]=(0,s.J0)(!0),[$,q]=(0,s.J0)(5),[ie,se]=(0,s.J0)(J[0].value),[ne,ae]=(0,s.J0)(),[oe,re]=(0,s.J0)("all"),[le,ce]=(0,s.J0)(),[de,he]=(0,s.J0)([]),[ue,pe]=(0,s.J0)([]),[ve,ge]=(0,s.J0)([]),[Ae,fe]=(0,s.J0)(!1),[be,Ce]=(0,s.J0)(!1),[ye,Se]=(0,s.J0)(void 0),[ke,we]=(0,s.J0)(void 0),[Ne,Ie]=(0,s.J0)(void 0),Pe="premium_giveaway"===ie,Ye="stars_giveaway"===ie,Fe=Pe&&!de.length?$:de.length,De=Fe*h,Me=ne?.yearlyBoosts,Te=(0,s.Kr)(()=>[{value:"all",label:w(r?"BoostingAllSubscribers":"BoostingAllMembers"),subLabel:ve&&ve.length>0?w("Giveaway.ReceiverType.Countries",ve.length):w("BoostingFromAllCountries")},{value:"new",label:w(r?"BoostingNewSubscribers":"BoostingNewMembers"),subLabel:ve&&ve.length>0?w("Giveaway.ReceiverType.Countries",ve.length):w("BoostingFromAllCountries")}],[r,w,ve]),Be=w("Months",le),Re="starsGiveaway"===m?.type,Le="giveaway"===m?.type,xe=(0,s.Kr)(()=>i?.find(e=>e.months===le&&e.users===Fe),[i,le,Fe]),Ee=(0,s.Kr)(()=>A?.find(e=>Re&&e.stars===Ne?.stars),[Ne,A,Re]),Ve=(0,s.Kr)(()=>i?.filter(e=>e.users===Fe&&e.currency!==o.OUy),[i,Fe]),_e=(0,s.Kr)(()=>{const e=Ve?.reduce((e,t)=>t.amount<e.amount?t:e,Ve[0]);return e&&Math.floor(e.amount/e.months)},[Ve]),Ue=(0,s.Kr)(()=>(0,bi.Am)(i?.filter(e=>e.currency!==o.OUy)?.map(e=>e.users)||[]).sort((e,t)=>e-t),[i]),Oe=(0,s.Kr)(()=>(0,bi.Am)(ne?.winners?.map(e=>e.users)||[]).sort((e,t)=>e-t),[ne]);(0,s.vJ)(()=>{a&&i?.length&&!Re&&ce(i?.[0].months)},[a,i,Re]),(0,s.vJ)(()=>{a&&A?.length&&!Le&&ae(A?.[0])},[a,A,Le]),(0,s.vJ)(()=>{a&&Re&&(q(m.quantity),Ie(m))},[a,Re,m]),(0,s.vJ)(()=>{a&&Le&&(q(m.quantity),we(m),ce(m.months))},[a,Le,m]),(0,s.vJ)(()=>{c&&he(c)},[c]),(0,s.vJ)(()=>{d&&pe(d)},[d]);const Ke=(0,M.A)(()=>{y()}),Je=(0,M.A)(()=>{Ie(void 0),we(void 0),ae(void 0),ce(void 0),q(5),b()}),Ge=(0,M.A)(()=>{C(Pe?de?.length?{type:"giftcode",boostChannelId:t,userIds:de,currency:xe.currency,amount:xe.amount,option:xe}:{type:"giveaway",chatId:t,additionalChannelIds:ue,isOnlyForNewSubscribers:"new"===oe,countries:ve,areWinnersVisible:Ae,prizeDescription:ye,untilDate:G/1e3,currency:xe.currency,amount:xe.amount,option:xe}:{type:"starsgiveaway",chatId:t,additionalChannelIds:ue,isOnlyForNewSubscribers:"new"===oe,countries:ve,areWinnersVisible:Ae,prizeDescription:ye,untilDate:G/1e3,currency:ne.currency,amount:ne.amount,stars:ne.stars,users:$}),Je()}),je=(0,M.A)(()=>{Re?k({chatId:t,giveawayId:Ne.id,paymentPurpose:{additionalChannelIds:ue,countries:ve,prizeDescription:ye,areWinnersVisible:Ae,untilDate:G/1e3,stars:Ne.stars,currency:Ee.currency,amount:Ee.amount,users:Ne.quantity}}):S({chatId:t,giveawayId:ke.id,paymentPurpose:{additionalChannelIds:ue,countries:ve,prizeDescription:ye,areWinnersVisible:Ae,untilDate:G/1e3,currency:xe.currency,amount:xe.amount}}),x(),Je()}),ze=(0,M.A)(e=>{q(e)}),$e=(0,M.A)(e=>{q(e)}),qe=(0,M.A)(e=>{Se(e.target.value)}),We=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;return de?.map(t=>(0,l.Yg)(e[t])).join(", ")},[de]),Qe=(0,M.A)(e=>{re(e)}),Ze=(0,M.A)(e=>{se(e),he([]),q(5)}),Xe=(0,M.A)(e=>{j(e.getTime()),P()}),et=(0,M.A)(e=>{ge(e)}),tt=(0,M.A)(e=>{he(e),e.length||se("premium_giveaway")}),it=(0,M.A)(e=>{pe(e)}),st=(0,M.A)(e=>{fe(e.target.checked)}),nt=(0,M.A)(e=>{Ce(e.target.checked)}),at=(0,M.A)(()=>{D()}),ot=(0,M.A)(e=>{ae(e)});function rt(){return(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:Ro,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingChannelsGroupsIncludedGiveaway")}),(0,te.Y)(ci.A,{inactive:!0,className:"chat-item-clickable contact-list-item",children:(0,te.Y)(ks.A,{chatId:t,status:w(r?"BoostingChannelWillReceiveBoost":"BoostingGroupWillReceiveBoost",De||Me,"i")})}),ue?.map(e=>(0,te.Y)(ci.A,{ripple:!0,className:"chat-item-clickable contact-list-item",onClick:()=>function(e){const t=ue.filter(t=>t!==e);pe(t)}(e),rightElement:(0,te.Y)(W.A,{name:"close",className:"UZdErfVI"}),children:(0,te.Y)(ks.A,{chatId:e.toString()})},e)),ue.length<9&&(0,te.Y)(ci.A,{icon:"add",ripple:!0,onClick:O,className:"sOXvh85b",iconClassName:"aGbyR60s",children:w("BoostingAddChannelOrGroup")})]}),(0,te.FD)("div",{className:Ro,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingEligibleUsers")}),(0,te.Y)("div",{className:Lo,children:(0,te.Y)(ee.A,{name:"subscribers",options:Te,selected:oe,onChange:Qe,onClickAction:at,subLabelClassName:"txXJxVFu",isLink:!0})})]}),(0,te.Y)("div",{className:Eo,children:(0,Dt.A)(w(r?"BoostGift.LimitSubscribersInfo":"lng_giveaway_users_about_group"))}),(0,te.FD)("div",{className:Ro,children:[(0,te.FD)("div",{className:jo,children:[(0,te.Y)("h2",{className:Go,children:w("BoostingGiveawayAdditionalPrizes")}),(0,te.Y)(fi.A,{label:w("BoostingGiveawayAdditionalPrizes"),checked:be,onChange:nt})]}),be&&(0,te.FD)("div",{className:"eQVP0Nx8",children:[(0,te.Y)("h2",{className:Go,children:$}),(0,te.Y)(Z.A,{className:"qMYNwiUZ",value:ye,onChange:qe,label:w("BoostingGiveawayEnterYourPrize")})]})]}),be?Ye||Re?void 0:(0,te.Y)("div",{className:Eo,children:ye?.length?(0,Dt.A)(w("BoostingGiveawayAdditionPrizeCountNameHint",ke?[ke.quantity,ye,Be]:[Fe,ye,Be],void 0,le),["simple_markdown"]):(0,Dt.A)(w("BoostingGiveawayAdditionPrizeCountHint",ke?[ke.quantity,Be]:[Fe,Be],void 0,le),["simple_markdown"])}):(0,te.Y)("div",{className:Eo,children:(0,Dt.A)(w("BoostingGiveawayAdditionPrizeHint"))}),(0,te.Y)("div",{className:Ro,children:(0,te.FD)("div",{className:jo,children:[(0,te.Y)("h2",{className:Go,children:w("BoostingGiveawayShowWinners")}),(0,te.Y)(fi.A,{label:w("BoostingGiveawayAdditionalPrizes"),checked:Ae,onChange:st})]})}),(0,te.Y)("div",{className:Eo,children:(0,Dt.A)(w("BoostingGiveawayShowWinnersHint"))}),(0,te.FD)("div",{className:(0,me.A)(Ro,(ke||Ne||Ye)&&Jo),children:[(0,te.Y)("h2",{className:xo,children:w("BoostingDateWhenGiveawayEnds")}),(0,te.FD)(Q.A,{ariaLabel:w("BoostGift.DateEnds"),className:(0,me.A)("GeKqKRgP","expire-limit"),isText:!0,onClick:I,children:[(0,te.Y)("h3",{className:Go,children:w("BoostGift.DateEnds")}),(0,He.L2)(G,w.code)]})]})]})}return(0,te.FD)(X.A,{className:"P0kLOw15",onClose:Je,isOpen:a,dialogRef:f,onEnter:ke||Ne?L:Ge,children:[(0,te.FD)("div",{className:(0,me.A)("SqiN63Ef","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;H(t<=150)},children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",className:"OX6_HqAd",color:"translucent",onClick:Je,ariaLabel:w("Close"),children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("img",{className:"Me2hCsMs",src:Qo,alt:"",draggable:!1}),(0,te.Y)("h2",{className:"UVDnB0Wq",children:(0,Dt.A)(w("BoostingBoostsViaGifts"))}),(0,te.Y)("div",{className:"v5yGzV6v",children:(0,Dt.A)(w(r?"BoostingGetMoreBoost":"BoostingGetMoreBoostsGroup"))}),(0,te.Y)("div",{className:(0,me.A)("U6XNIToQ",z&&"tDZc21ZC"),children:(0,te.Y)("h2",{className:"v6hiGpEn",children:w("BoostingBoostsViaGifts")})}),ke||Ne?(0,te.FD)("div",{className:"q1y2qUTn",children:[(0,te.Y)("div",{children:Ne?(0,te.Y)("img",{className:zo,src:Wo,alt:""}):(0,te.Y)("img",{className:zo,src:Zo[ke.months]||Zo[3],alt:""})}),(0,te.FD)("div",{className:"IsT38nlq",children:[(0,te.Y)("h3",{className:Go,children:Ne?w("Giveaway.Stars.Prepaid.Title",Ne?.stars):w("BoostingTelegramPremiumCountPlural",ke.quantity)}),(0,te.Y)("p",{className:"TsGuei3B",children:Ne?w("Giveaway.Stars.Prepaid.Desc",Ne?.quantity):w("PrepaidGiveawayMonths",ke?.months)})]}),(0,te.Y)("div",{className:Vo,children:(0,te.FD)("div",{className:(0,me.A)(_o,Uo),children:[(0,te.Y)(W.A,{name:"boost",className:Oo}),(0,te.Y)("div",{className:Ko,dir:w.isRtl?"rtl":void 0,children:Ne?Ne?.boosts:ke.quantity*(h??o.CQG)})]})})]}):(0,te.Y)("div",{className:(0,me.A)(Ro,"sQ5PkKEs"),children:(0,te.Y)("div",{className:Lo,children:J.map(e=>(0,te.Y)(To,{name:e.name,text:e.text,option:e.value,img:e.img,onChange:Ze,checked:ie===e.value,isLink:e.isLink,userNames:We,selectedMemberIds:de,onClickAction:e.onClickAction},e.name))})}),Pe&&!de?.length&&(0,te.FD)(te.FK,{children:[!ke&&!Ne&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:Ro,children:[(0,te.FD)("div",{className:Vo,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingQuantityPrizes")}),(0,te.FD)("div",{className:(0,me.A)(_o,Uo),children:[(0,te.Y)(W.A,{name:"boost",className:Oo}),(0,te.Y)("div",{className:Ko,dir:w.isRtl?"rtl":void 0,children:De})]})]}),(0,te.Y)(Fo.A,{rangeCount:Fe,marks:Ue,onChange:ze})]}),(0,te.Y)("div",{className:Eo,children:(0,Dt.A)(w("BoostingChooseHowMany"))})]}),rt()]}),Ye&&(0,te.FD)(te.FK,{children:[!Ne&&!ke&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:Ro,children:[(0,te.FD)("div",{className:Vo,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingStarsOptions")}),(0,te.FD)("div",{className:(0,me.A)(_o,Uo),children:[(0,te.Y)(W.A,{name:"boost",className:Oo}),(0,te.Y)("div",{className:Ko,dir:w.isRtl?"rtl":void 0,children:Me})]})]}),(0,te.Y)(Po.A,{className:"cLhNkYPB",options:A,selectedStarCount:$,selectedStarOption:ne,onClick:ot})]}),(0,te.Y)("div",{className:(0,me.A)(Eo,"bzRAETfR"),children:(0,Dt.A)(w("BoostGift.Stars.Info"))}),(0,te.FD)("div",{className:Ro,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingStarsQuantityPrizes")}),(0,te.Y)(Fo.A,{rangeCount:$,marks:Oe,onChange:$e}),(0,te.Y)("div",{className:Eo,children:(0,Dt.A)(w("BoostingStarsQuantityPrizesInfo"))})]})]}),rt()]}),!ke&&!Ne&&Pe&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:Ro,children:[(0,te.Y)("h2",{className:xo,children:w("BoostingDurationOfPremium")}),(0,te.Y)("div",{className:Lo,children:Ve?.map(e=>(0,te.Y)(Za,{isGiveaway:!0,option:e,fullMonthlyAmount:_e,checked:e.months===le,onChange:ce},e.months))})]}),(0,te.Y)("div",{className:(0,me.A)(Eo,Jo),children:function(){const e=w("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return(0,te.FD)("p",{className:"eNQ_nrKr",children:[e[1],(0,te.Y)(Yo.A,{isPrimary:!0,onClick:Ke,children:e[2]}),e[3]]})}()})]}),ie&&(0,te.Y)("div",{className:"hD_AEzjd",children:(0,te.Y)(Q.A,{className:"ILuhBsJG",onClick:ke||Ne?L:Ge,children:w("BoostingStartGiveaway")})})]}),(0,te.Y)(dn,{isOpen:N,isFutureMode:!0,withTimePicker:!0,onClose:P,onSubmit:Xe,selectedAt:G,submitButtonLabel:w("Save")}),(0,te.Y)(Io,{isOpen:Y,onClose:B,countryList:u,onSubmit:et,selectionLimit:p}),(0,te.Y)(Bo,{isOpen:E,onClose:_,onSelectedIdsConfirmed:tt,initialSelectedIds:de,selectionLimit:v,giveawayChatId:t}),(0,te.Y)(Mo,{isOpen:U,onClose:K,initialSelectedIds:ue,onSelectedIdsConfirmed:it,selectionLimit:o.cgU,giveawayChatId:t}),(0,te.Y)(vi.A,{title:w("BoostingStartGiveawayConfirmTitle"),text:w("BoostingStartGiveawayConfirmText"),confirmLabel:w("Start"),isOpen:R,onClose:x,confirmHandler:je})]})})),er={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders",savedDialogsPinned:"LimitReachedPinSavedDialogs"},tr={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked",savedDialogsPinned:"LimitReachedPinSavedDialogsLocked"},ir={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium",savedDialogsPinned:"LimitReachedPinSavedDialogsPremium"},sr={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"},nr={uploadMaxFileparts:(e,t)=>8e3===t?e("FileSize.GB","4"):4e3===t?e("FileSize.GB","2"):(0,$e.v7)(e,t*o.dK5)},ar=(0,s.ph)((0,n.EK)((e,t)=>{let{limit:i}=t;const{limits:s}=e.appConfig,n=(0,c.g29)(e);return{defaultValue:i?s?.[i][0]:void 0,premiumValue:i?s?.[i][1]:void 0,canBuyPremium:!(0,c.n_C)(e),isPremium:n}})(e=>{let{defaultValue:t,premiumValue:i,limit:a,isPremium:o,canBuyPremium:r}=e;const{closeLimitReachedModal:l,openPremiumModal:c}=(0,n.ko)(),d=(0,T.A)(),[h,u,m]=(0,F.A)(),p=(0,s.hb)(()=>{c(),u()},[c,u]);(0,s.vJ)(()=>{!a&&h&&m()},[h,a,m]);const v=d("LimitReached"),g=a&&nr[a],A=function(e){let{lang:t,limitType:i,isPremium:s,canBuyPremium:n,defaultValue:a,premiumValue:o,valueFormatter:r}=e;if(!i)return;const l=r?r(t,a):a,c=r?r(t,o):o;return s?t(ir[i],c):n?t(er[i],"channelsPublic"===i?c:[l,c]):t(tr[i],l)}({lang:d,limitType:a,isPremium:o,canBuyPremium:r,defaultValue:t,premiumValue:i,valueFormatter:g}),f=a&&sr[a],b=r&&!o;return(0,te.FD)(X.A,{onClose:u,onCloseAnimationEnd:l,isOpen:Boolean(a)&&!h,title:v,className:"QAs_iFxO",children:[!b&&(0,te.FD)("div",{className:"Q5d_7bB4",children:[(0,te.Y)("i",{className:(0,me.A)("rbnU7JVX",f,"icon")}),(0,te.Y)("div",{className:"ArEy3hhB",children:g?.(d,o?i:t)||(o?i:t)})]}),b&&(0,te.Y)(wa,{className:"k0O6Rnjh",leftValue:g?.(d,t)||t?.toString(),rightValue:g?.(d,i)||i?.toString(),floatingBadgeIcon:f}),(0,te.Y)("div",{children:(0,Dt.A)(A||"",["simple_markdown","br"])}),(0,te.FD)("div",{className:"RVM_RSap",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary",children:d(b?"Cancel":"OK")}),b&&(0,te.FD)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",children:[d("IncreaseLimit"),(0,te.Y)(W.A,{name:"double-badge",className:"esB1OhAF"})]})]})]})}));var or=i(93809),rr=i(81954),lr=i(5912);const cr=350+o.xB5,dr=.5*g.$;function hr(e,t,i,n){const a=(0,s.li)([]),[o,r]=(0,s.J0)(0),{observe:l,freeze:c,unfreeze:d}=(0,lr.BL)({rootRef:e},e=>{const t=a.current;e.forEach(e=>{const s=Number(e.target.id.replace(`${i}-`,""));t[s]=e.isIntersecting});const s=t.reduce((e,t,i)=>t&&i<e?i:e,1/0);s!==1/0&&r(s)}),{observe:h,freeze:u,unfreeze:m}=(0,lr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:p}=(0,lr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:v}=(0,lr.BL)({rootRef:t});return(0,j.A)(()=>{n?(c(),u()):setTimeout(()=>{m(),d()},cr)},[c,u,n,d,m]),{activeSetIndex:o,observeIntersectionForSet:l,observeIntersectionForShowingItems:h,observeIntersectionForPlayingItems:p,observeIntersectionForCovers:v,selectStickerSet:(0,M.A)(t=>{r(s=>{const n=document.getElementById(`${i}-${t}`),a=1===Math.abs(s-t);return(0,rr.Ay)({container:e.current,element:n,position:"start",margin:dr,maxDistance:a?200:80}),t})})}}var ur=i(37479),mr=i(87094),pr=i(94519),vr=i(47483);const gr=(0,s.ph)(e=>{let{stickerSet:t,size:i=o.TBj,noPlay:a,forcePlayback:r,observeIntersection:d,sharedCanvasRef:h}=e;const{loadStickers:m}=(0,n.ko)(),p=(0,s.li)(),{hasThumbnail:v,hasVideoThumb:g,hasAnimatedThumb:A,hasStaticThumb:f,thumbCustomEmojiId:b}=t,{customEmoji:C}=(0,vr.A)(b),y=C?.shouldUseTextColor,S=(0,mr.A)(p,void 0,!y),k=(0,ur.A)(S),w=(0,lr.Vz)(p,d),N=w&&!a,I=!v||g&&!u.OF&&!A&&!f,P=I&&t.stickers?.[0]&&(0,l.Mw)(t.stickers[0],"preview"),Y=(0,z.A)(P,!w),F=(v&&!P||A)&&`stickerSet${t.id}`,D=(0,z.A)(F,!w),M=b||D||Y,T=(0,Oi.A)(M),B=(0,pr.A)(p,h);return(0,s.vJ)(()=>{w&&!t.stickers?.length&&m({stickerSetInfo:t})},[w,m,t]),(0,te.Y)("div",{ref:p,className:(0,me.A)("m6XpTzQX","sticker-set-cover"),style:`--_size: ${i}px`,children:M?b?(0,te.Y)(pa.A,{documentId:b,size:i,observeIntersectionForPlaying:d,noPlay:a}):A?(0,te.Y)(Fa.A,{className:T,tgsUrl:D,size:i,play:N,isLowPriority:!(0,c.CzR)((0,n.mS)(),t),sharedCanvas:h?.current||void 0,sharedCanvasCoords:B,forceAlways:r}):g&&!I?(0,te.Y)(zi.A,{className:(0,me.A)("OZHqKbDL",T),src:D,canPlay:N,style:k,isPriority:r,loop:!0,disablePictureInPicture:!0}):(0,te.Y)("img",{src:D||Y,style:k,className:(0,me.A)("enA6c8gc",T),alt:"",draggable:!1}):(0,$e.Qh)(t.title,2)})});var Ar=i(54464),fr=i(85118),br=i(82855);const Cr=[{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}],yr=(0,s.ph)(e=>{let{sticker:t,size:i,noPlay:a,title:o,className:r,noContextMenu:l,isSavedMessages:c,isStatusPicker:d,canViewSet:h,observeIntersection:m,observeIntersectionForShowing:p,isSelected:v,isCurrentUserPremium:g,shouldIgnorePremium:A,noShowPremium:f,sharedCanvasRef:b,withTranslucentThumb:C,forcePlayback:y,onClick:S,clickArg:k,onFaveClick:w,onUnfaveClick:N,onRemoveRecentClick:I,onContextMenuOpen:P,onContextMenuClose:Y,onContextMenuClick:F,isEffectEmoji:D,withSparkles:B}=e;const{openStickerSet:R,openPremiumModal:L,setEmojiStatus:x}=(0,n.ko)(),E=(0,s.li)(),V=(0,s.li)(),_=(0,T.A)(),U=t.shouldUseTextColor,O=(0,mr.A)(E,void 0,!U),{id:K,stickerSetInfo:J}=t,G=!t.isFree&&D||t.hasEffect,j=t.isCustomEmoji||D,z=!g&&G&&!A,H=(0,lr.Vz)(E,m),$=H,q=H&&!a,Z=(0,lr.Vz)(E,p),{isContextMenuOpen:X,contextMenuAnchor:ee,handleBeforeContextMenu:ie,handleContextMenu:se,handleContextMenuClose:ne,handleContextMenuHide:ae}=(0,bn.A)(E),oe=Boolean(!l&&ee),re=(0,M.A)(()=>E.current),le=(0,M.A)(()=>E.current.closest(".custom-scroll, .no-scrollbar")),ce=(0,M.A)(()=>d?V.current:E.current.querySelector(".sticker-context-menu .bubble")),he=(0,M.A)(()=>({withPortal:d,shouldAvoidNegativePosition:!0}));(0,s.vJ)(()=>{X?P?.():Y?.()},[X,Y,P]),(0,s.vJ)(()=>{H||ne()},[ne,H]);const ue=(0,M.A)(e=>{e.stopPropagation(),e.preventDefault(),I(t)}),pe=(0,M.A)(()=>{I(t)}),ve=(0,M.A)(()=>{N(t)}),ge=(0,M.A)(()=>{w(t)}),Ae=(0,M.A)(()=>{S?.(k,!0)}),fe=(0,M.A)(()=>{S?.(k,void 0,!0)}),be=(0,M.A)(()=>{R({stickerSetInfo:J})}),Ce=(0,M.A)(function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e.preventDefault(),e.stopPropagation(),ne(),F?.(),x({emojiStatus:{type:"regular",documentId:t.id,until:(0,li.Fm)()+i}})}),ye=!u.TF&&I,Se=(0,me.A)("StickerButton",S&&"interactive",v&&"selected",j&&"custom-emoji",D&&"effect-emoji",r),ke=(0,s.Kr)(()=>{if(!oe||l||j&&!d)return[];const e=[];return j?(Cr.forEach(t=>{e.push((0,te.Y)(de.A,{onClick:Ce,clickArg:t.arg,children:_(t.title,t.value,"i")}))}),e):(N&&e.push((0,te.Y)(de.A,{icon:"favorite",onClick:ve,children:_("Stickers.RemoveFromFavorites")})),w&&e.push((0,te.Y)(de.A,{icon:"favorite",onClick:ge,children:_("Stickers.AddToFavorites")})),!z&&S&&(c||e.push((0,te.Y)(de.A,{onClick:Ae,icon:"muted",children:_("SendWithoutSound")})),e.push((0,te.Y)(de.A,{onClick:fe,icon:"calendar",children:_(c?"SetReminder":"ScheduleMessage")}))),h&&e.push((0,te.Y)(de.A,{onClick:be,icon:"stickers",children:_("ViewPackPreview")})),I&&e.push((0,te.Y)(de.A,{icon:"delete",onClick:pe,children:_("DeleteFromRecent")})),e)},[oe,l,j,d,N,w,z,S,h,I,Ce,_,ve,ge,c,fe,Ae,be,pe]);return(0,te.FD)("div",{ref:E,className:Se,title:o||t?.emoji,"data-sticker-id":K,onMouseDown:e=>{(0,Ar.u)(e),ie(e)},onClick:()=>{X||(z?L(D?{initialSection:"effects"}:{initialSection:"premium_stickers"}):S?.(k))},onContextMenu:se,children:[B&&(0,te.Y)(fr.A,{preset:"button"}),Z&&(0,te.Y)(br.A,{containerRef:E,sticker:t,isSmall:!0,size:i,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!$,noPlay:!q,noVideoOnMobile:!0,withSharedAnimation:!0,sharedCanvasRef:b,withTranslucentThumb:C,customColor:O,forceAlways:y}),!f&&z&&(0,te.Y)("div",{className:"sticker-locked",children:(0,te.Y)(W.A,{name:"lock-badge"})}),!f&&G&&!z&&(0,te.Y)("div",{className:"sticker-premium",children:(0,te.Y)(W.A,{name:"star"})}),ye&&(0,te.Y)(Q.A,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:ue,children:(0,te.Y)(W.A,{name:"close"})}),Boolean(ke.length)&&(0,te.Y)(qe.A,{ref:V,isOpen:X,anchor:ee,getTriggerElement:re,getRootElement:le,getMenuElement:ce,getLayout:he,className:"sticker-context-menu",autoClose:!0,withPortal:d,onClose:ne,onCloseAnimationEnd:ae,children:ke})]})});var Sr=i(93545),kr=i(58443),wr=i(64489);const Nr=(0,s.ph)(e=>{let{reaction:t,availableReactions:i,isSelected:n,loadAndPlay:a,observeIntersection:r,sharedCanvasRef:c,sharedCanvasHqRef:d,forcePlayback:h,onClick:u,onContextMenu:m}=e;const p=(0,s.li)(),v="custom"===t.type,g=(0,s.Kr)(()=>i?.find(e=>(0,l.a0)(e.reaction,t)),[i,t]),A=g?.staticIcon?.thumbnail?.dataUri,f=g?.selectAnimation?.id,b=(0,pr.A)(p,c),C=(0,z.A)(g?.selectAnimation?(0,l.mr)(g.selectAnimation,"full"):void 0,!f),{isContextMenuOpen:y,handleBeforeContextMenu:S,handleContextMenu:k,handleContextMenuClose:w,handleContextMenuHide:N}=(0,bn.A)(p,"paid"!==t.type,void 0,void 0,void 0,!0);(0,s.vJ)(()=>{y&&(m?.(t),w(),N())},[w,m,N,y,t]);const I="paid"===t.type?kr.w.StarReaction:C,P=(0,M.A)(()=>{u(t)}),Y=(0,Oi.A)(C),F=(0,me.A)("AVrrYEbM",n&&"QkdO_lz1",!v&&"sticker-reaction");return(0,te.Y)("div",{ref:p,className:F,onClick:P,title:g?.title,"data-sticker-id":v?t.documentId:void 0,onMouseDown:S,onContextMenu:k,children:v?(0,te.Y)(pa.A,{ref:p,documentId:t.documentId,size:o.g0Q,noPlay:!a,observeIntersectionForPlaying:r,sharedCanvasRef:c,sharedCanvasHqRef:d,withTranslucentThumb:!0,forceAlways:h}):(0,te.Y)(wr.A,{tgsUrl:I,thumbDataUri:A,play:a,noLoop:!1,size:o.g0Q,isLowPriority:!0,className:Y,sharedCanvas:c.current||void 0,sharedCanvasCoords:b,forceAlways:h})})});var Ir=i(38027);const Pr=(0,s.ph)((0,n.EK)(e=>{const t=e.collectibleEmojiStatuses?.statuses;return{collectibleStatuses:t}})(e=>{let{stickerSet:t,loadAndPlay:i,index:a,idPrefix:r,isNearActive:d,favoriteStickers:h,availableReactions:u,isSavedMessages:m,isStatusPicker:p,isReactionPicker:v,isCurrentUserPremium:g,shouldHideHeader:A,withDefaultTopicIcon:f,selectedReactionIds:b,withDefaultStatusIcon:C,isChatEmojiSet:y,isChatStickerSet:S,isTranslucent:k,noContextMenus:w,forcePlayback:N,observeIntersection:I,observeIntersectionForPlayingItems:P,observeIntersectionForShowingItems:D,onReactionSelect:B,onReactionContext:R,onStickerSelect:L,onStickerUnfave:x,onStickerFave:E,onStickerRemoveRecent:V,onContextMenuOpen:_,onContextMenuClose:U,onContextMenuClick:O,collectibleStatuses:K}=e;const{clearRecentStickers:J,clearRecentCustomEmoji:G,clearRecentReactions:j,openPremiumModal:z,toggleStickerSet:H,loadStickers:$}=(0,n.ko)(),q=(0,s.li)(),Z=(0,s.li)(),X=(0,s.li)(),ee=(0,T.A)(),{width:ie}=(0,we.A)(),[se,ne,ae]=(0,F.A)(),{isMobile:oe}=(0,Y.Ay)(),[re,le]=(0,s.J0)(Yr(ie)),ce=(0,lr.Vz)(q,I??D),de=(0,Oi.A)(ce),he=d||ce,ue=oe?8:4,pe=oe?8:10,ve=oe?8:4,ge=t.id===o.sR2,Ae=t.id===o.j1l,fe=t.id===o.tRH,be=t.id===o.EPW,Ce=t.isEmoji,ye=!ge&&(0,c.Q31)(t),Se=(0,M.A)(()=>{v?j():Ce?G():J(),ae()}),ke=(0,M.A)(()=>{ye&&!g?z({initialSection:"animated_emoji"}):H({stickerSetId:t.id})}),Ne=(0,M.A)(()=>{L?.({mediaType:"sticker",id:o.MyF,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Ie=(0,M.A)(()=>{L?.({mediaType:"sticker",id:o.zNY,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Pe=Ce?o.g0Q:o.bkT,Ye=Ce?pe:ue,Fe=Ce?ve:ue,De=(0,M.A)(e=>e?Math.floor((e+Ye)/(Pe+Ye)):Yr(ie)),Me=(0,M.A)(e=>{le(De(e.contentRect.width))});(0,Sr.A)(q,Me),(0,s.vJ)(()=>{q.current&&le(De(q.current.clientWidth))},[De]),(0,s.vJ)(()=>{he&&!t.stickers?.length&&!t.reactions?.length&&t.accessHash&&$({stickerSetInfo:{id:t.id,accessHash:t.accessHash}})},[he,$,t]);const Te=!m&&!g&&ye&&!y,Be=t.installedDate&&!t.isArchived,Re=!Be&&t.id!==o.sR2&&t.id!==o.EPW&&t.id!==o.hfH&&t.id!==o.Kp3&&!y&&!S,[Le,,xe]=(0,F.A)(Re),Ee=3*re-1,Ve=f||C?t.count+1:t.count,_e=Pe+Fe,Ue=Math.ceil(Math.min(Ee,Ve)/re)*_e-Fe,Oe=Le?Ue:Math.ceil(Ve/re)*_e-Fe,Ke=(0,s.Kr)(()=>h?new Set(h.map(e=>{let{id:t}=e;return t})):void 0,[h]),Je=(0,s.Kr)(()=>K?new Set(K.map(e=>{let{documentId:t}=e;return t})):void 0,[K]),Ge=!A&&!ge&&!Ae&&Ce&&!be&&!y&&(!Be||!g&&!m),je=(0,s.Kr)(()=>ee(Te?Be?"lng_emoji_premium_restore":"Unlock":"Add"),[Te,ee,Be]);return(0,te.FD)("div",{ref:q,id:`${r}-${a}`,className:(0,me.A)("symbol-set",Te&&"symbol-set-locked"),children:[!A&&(0,te.FD)("div",{className:"symbol-set-header",children:[(0,te.FD)("p",{className:(0,me.A)("symbol-set-title",Ge&&"symbol-set-title-external"),children:[Te&&(0,te.Y)(W.A,{name:"lock-badge",className:"symbol-set-locked-icon"}),(0,te.Y)("span",{className:"symbol-set-name",children:t.title}),(y||S)&&(0,te.Y)("span",{className:"symbol-set-chat",children:ee(y?"GroupEmoji":"GroupStickers")}),Ge&&Boolean(t.stickers)&&(0,te.Y)("span",{className:"symbol-set-amount",children:ee(Ce?"EmojiCount":"Stickers",t.stickers.length,"i")})]}),ge&&(0,te.Y)(W.A,{className:"symbol-set-remove",name:"close",onClick:ne}),Ge&&(0,te.Y)(Q.A,{className:"symbol-set-add-button",withPremiumGradient:ye&&!g,onClick:ke,pill:!0,size:"tiny",fluid:!0,children:je})]}),(0,te.FD)("div",{className:(0,me.A)("symbol-set-container shared-canvas-container",de,t.id===o.hfH&&"effect-emojis"),style:`height: ${Oe}px;`,children:[(0,te.Y)("canvas",{ref:Z,className:"shared-canvas",style:Re?`height: ${Ue}px;`:void 0}),(ge||fe||Re)&&(0,te.Y)("canvas",{ref:X,className:"shared-canvas"}),f&&(0,te.Y)(Q.A,{className:"StickerButton custom-emoji",color:"translucent",onClick:Ne,children:(0,te.Y)("img",{src:Ir,alt:"Reset",className:"sticker-media",draggable:!1})},"default-topic-icon"),C&&(0,te.Y)(Q.A,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:Ie,children:(0,te.Y)(W.A,{name:"star"})},"default-status-icon"),he&&t.reactions?.map(e=>{const s=(0,l.Jj)(e),n=s?b?.includes(s):void 0;return(0,te.Y)(Nr,{reaction:e,isSelected:n,loadAndPlay:i,availableReactions:u,observeIntersection:P,onClick:B,onContextMenu:R,sharedCanvasRef:Z,sharedCanvasHqRef:X,forcePlayback:N},`${t.id}_${s}`)}),he&&t.stickers?.slice(0,Le?Ee:t.stickers.length).map((e,s)=>{const a=(ge||fe)&&(0,c.CzR)((0,n.mS)(),e.stickerSetInfo),r=Re&&s>=Ee||a?X:Z,l=e.isCustomEmoji?e.id:e.emoji,d=l?b?.includes(l):void 0,h=e.id===o.j1l||Je?.has(e.id);return(0,te.Y)(yr,{sticker:e,size:Pe,observeIntersection:P,observeIntersectionForShowing:D,noPlay:!i,isSavedMessages:m,isStatusPicker:p,canViewSet:!0,noContextMenu:w,isCurrentUserPremium:g,shouldIgnorePremium:y,sharedCanvasRef:r,withTranslucentThumb:k,onClick:L,clickArg:e,isSelected:d,onUnfaveClick:fe&&Ke?.has(e.id)?x:void 0,onFaveClick:Ke?.has(e.id)?void 0:E,onRemoveRecentClick:ge?V:void 0,onContextMenuOpen:_,onContextMenuClose:U,onContextMenuClick:O,forcePlayback:N,isEffectEmoji:t.id===o.hfH,noShowPremium:g&&(t.id===o.Kp3||t.id===o.hfH),withSparkles:h},e.id)}),Le&&Ve>Ee&&(0,te.FD)(Q.A,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:xe,children:["+",Ve-Ee]},"more")]}),ge&&(0,te.Y)(vi.A,{text:ee(v?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:se,onClose:ae,confirmHandler:Se,confirmIsDestructive:!0})]},t.id)}));function Yr(e){return e>440?8:e<362?6:7}const Fr="p7c8y0LH",Dr="zTGriBHY",Mr="Qn3lBUNs",Tr="HMspKpNp",Br="YKO0Obwy",Rr="BZfaP1GD",Lr=2.5*g.$,xr="custom-emoji-set",Er=new Set([o.sR2,o.tRH,o.EPW]),Vr=new Set([o.sR2,o.tRH,o.EPW]),_r=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i,isStatusPicker:s,isReactionPicker:n}=t;const{stickers:{setsById:a},customEmojis:{byId:o,featuredIds:r,statusRecent:{emojis:l}},recentCustomEmojis:d,reactions:{availableReactions:h,recentReactions:u,topReactions:m,defaultTags:p}}=e,v=Boolean(i&&(0,c.nZ4)(e,i)),g=i?(0,c.AWZ)(e,i):void 0,A=e.collectibleEmojiStatuses?.statuses;return{customEmojisById:o,recentCustomEmojiIds:s?void 0:d,recentStatusEmojis:s?l:void 0,collectibleStatuses:s?A:void 0,stickerSetsById:a,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,c.BWX)(e),isSavedMessages:v,isCurrentUserPremium:(0,c.g29)(e),customEmojiFeaturedIds:r,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:n?m:void 0,recentReactions:n?u:void 0,chatEmojiSetId:g?.emojiSet?.id,isWithPaidReaction:n&&g?.isPaidReactionAvailable,availableReactions:n?h:void 0,defaultTagReactions:n?p:void 0}})(e=>{let{className:t,pickerListClassName:i,isHidden:a,loadAndPlay:r,addedCustomEmojiIds:d,customEmojisById:h,recentCustomEmojiIds:m,selectedReactionIds:p,recentStatusEmojis:v,collectibleStatuses:g,stickerSetsById:A,chatEmojiSetId:f,topReactions:b,recentReactions:C,availableReactions:y,idPrefix:S=xr,customEmojiFeaturedIds:k,canAnimate:w,isReactionPicker:N,isStatusPicker:I,isTranslucent:P,isSavedMessages:F,isCurrentUserPremium:D,withDefaultTopicIcons:B,defaultTopicIconsId:R,defaultStatusIconsId:L,defaultTagReactions:x,isWithPaidReaction:E,onCustomEmojiSelect:V,onReactionSelect:_,onReactionContext:U,onContextMenuOpen:O,onContextMenuClose:K,onContextMenuClick:J}=e;const G=(0,s.li)(),j=(0,s.li)(),z=(0,s.li)(),H=(0,s.li)(),{isMobile:$}=(0,Y.Ay)(),{handleScroll:q,isAtBeginning:Z}=bs(),X=(0,s.Kr)(()=>I?v:Object.values((0,bi._E)(h,m)),[h,I,m,v]),ee=(0,s.Kr)(()=>{const e=g?.map(e=>e.documentId);return h&&e?.map(e=>h[e]).filter(Boolean)},[h,g]),ie=`${S}-custom-emoji`,{activeSetIndex:se,observeIntersectionForSet:ae,observeIntersectionForPlayingItems:oe,observeIntersectionForShowingItems:re,observeIntersectionForCovers:le,selectStickerSet:ce}=hr(G,j,ie,a),de=(0,Qi.A)(r||void 0,o.jhd),he=(0,T.A)(),ue=(0,_i.A)(),pe=Boolean(d),ve=(0,s.Kr)(()=>{const e=[];if(N&&F&&x?.length&&e.push({id:o.G3A,accessHash:"",title:he("PremiumPreviewTags"),reactions:x,count:x.length,isEmoji:!0}),N&&!F){const t=b?.slice(0,16)||[];E&&t.unshift({type:"paid"}),t?.length&&e.push({id:o.G3A,accessHash:"",title:he("Reactions"),reactions:t,count:t.length,isEmoji:!0});const i=(C||[]).filter(e=>!t.some(t=>(0,l.a0)(t,e))).slice(0,32),s=(y||[]).filter(e=>{let{isInactive:t}=e;return!t}).map(e=>{let{reaction:t}=e;return t}).filter(e=>!t.some(t=>(0,l.a0)(t,e))&&!i.some(t=>(0,l.a0)(t,e)));if(s?.length||i?.length){const t=!i?.length,n=i.concat(s);e.push({id:t?o.EPW:o.sR2,accessHash:"",title:he(t?"PopularReactions":"RecentStickers"),reactions:n,count:n.length,isEmoji:!0})}}else if(I){const t=A[L];if(t?.stickers?.length){const i=(0,bi.Xd)(t.stickers.slice(0,7).concat(X||[]),"id");e.push({...t,stickers:i,count:i.length,id:o.sR2,title:he("RecentStickers"),isEmoji:!0})}ee?.length&&e.push({id:o.j1l,accessHash:"",count:ee.length,stickers:ee,title:ue("CollectibleStatusesCategory"),isEmoji:!0})}else if(B){const t=A[R];t.stickers?.length&&e.push({...t,id:o.sR2,title:he("RecentStickers")})}else X?.length&&e.push({id:o.sR2,accessHash:"0",title:he("RecentStickers"),stickers:X,count:X.length,isEmoji:!0});const t=[...d||[]];f&&t.unshift(f);const i=(0,bi.Am)(t.concat(k||[])),s=Object.values((0,bi._E)(A,i));return[...e,...s]},[d,N,I,B,X,k,A,b,y,he,C,L,R,F,x,f,E,ee,ue]),ge=(0,s.Kr)(()=>pe&&0===ve.filter(e=>e.stickers?.length).length,[ve,pe]),Ae=(0,or.A)([],o.jhd),fe=pe&&Ae&&!ge;(0,Nn.A)(j,$||!fe),(0,s.vJ)(()=>{if(!pe)return;const e=j.current;if(!e)return;const t=se*Lr-(e.offsetWidth/2-Lr/2);(0,ba.A)(e,t)},[pe,se]);const be=(0,M.A)(e=>{V(e)}),Ce=(0,me.A)("StickerPicker","Qk9PEGRE",t),ye=(0,me.A)(Mr,"no-scrollbar",!Z&&Tr),Se=(0,me.A)(Fr,"U0BL1VvK",u.TF?"no-scrollbar":"custom-scroll",i,Dr),ke=!fe&&!ge;return(0,te.Y)(ne.Ay,{className:Ce,name:"fade",activeKey:ke?0:1,shouldCleanup:!0,children:fe||ge?!fe&&ge?(0,te.Y)("div",{className:Rr,children:he("NoStickers")}):(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{ref:j,className:ye,children:(0,te.FD)("div",{className:"shared-canvas-container",children:[(0,te.Y)("canvas",{ref:z,className:"shared-canvas"}),(0,te.Y)("canvas",{ref:H,className:"shared-canvas"}),ve.map(function(e,t){const i=e.stickers?.[0],s=(0,me.A)(Br,t===se&&"WYeuJNQx"),a=t<o.j41,r=(0,c.CzR)((0,n.mS)(),e);if(e.id!==o.G3A){if(Vr.has(e.id)||e.hasThumbnail||!i){const i=e.id===o.sR2||e.id===o.EPW,n=Er.has(e.id);return(0,te.Y)(Q.A,{className:s,ariaLabel:e.title,round:!0,faded:n,color:"translucent",onClick:()=>ce(i?0:t),children:i?(0,te.Y)(W.A,{name:"recent"}):(0,te.Y)(gr,{stickerSet:e,noPlay:!w||!de,forcePlayback:!0,observeIntersection:le,sharedCanvasRef:a?r?H:z:void 0})},e.id)}return(0,te.Y)(yr,{sticker:i,size:o.TBj,title:e.title,className:s,noPlay:!w||!de,observeIntersection:le,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?r?H:z:void 0,withTranslucentThumb:P,onClick:ce,clickArg:t,forcePlayback:!0},e.id)}})]})}),(0,te.Y)("div",{ref:G,onScroll:q,className:Se,children:ve.map((e,t)=>{const i=e.id===o.G3A||e.id===o.sR2&&(B||I),s=e.id===f;return(0,te.Y)(Pr,{stickerSet:e,loadAndPlay:Boolean(w&&de),index:t,idPrefix:ie,observeIntersection:ae,observeIntersectionForPlayingItems:oe,observeIntersectionForShowingItems:re,isNearActive:se>=t-1&&se<=t+1,isSavedMessages:F,isStatusPicker:I,isReactionPicker:N,shouldHideHeader:i,withDefaultTopicIcon:B&&e.id===o.sR2,withDefaultStatusIcon:I&&e.id===o.sR2,isChatEmojiSet:s,isCurrentUserPremium:D,selectedReactionIds:p,availableReactions:y,isTranslucent:P,onReactionSelect:_,onReactionContext:U,onStickerSelect:be,onContextMenuOpen:O,onContextMenuClose:K,onContextMenuClick:J,forcePlayback:!0},e.id)})})]}):(0,te.Y)(xs.A,{})})}));var Ur=i(3325);const Or=(0,s.ph)((0,n.EK)(e=>({areFeaturedStickersLoaded:Boolean(e.customEmojis.featuredIds?.length),isTranslucent:(0,c.cwE)(e)}))(e=>{let{isOpen:t,statusButtonRef:i,areFeaturedStickersLoaded:a,isTranslucent:o,onEmojiStatusSelect:r,onClose:l}=e;const{loadFeaturedEmojiStickers:c}=(0,n.ko)(),d=(0,s.li)(),[h,u,m]=(0,F.A)();(0,s.vJ)(()=>{d.current=i.current.getBoundingClientRect().right},[t,i]),(0,s.vJ)(()=>{t&&!a&&c()},[a,t,c]);const p=(0,s.hb)(e=>{r(e),l()},[l,r]);return(0,te.Y)(Ur.A,{children:(0,te.Y)(qe.A,{isOpen:t,noCompact:!0,positionX:"right",bubbleClassName:"hRzvfaRb",onClose:l,transformOriginX:d.current,noCloseOnBackdrop:h,children:(0,te.Y)(_r,{idPrefix:"status-emoji-set-",loadAndPlay:t,isHidden:!t,isStatusPicker:!0,isTranslucent:o,onContextMenuOpen:u,onContextMenuClose:m,onCustomEmojiSelect:p,onContextMenuClick:l})})})}));var Kr=i(10187);const Jr=6*g.$,Gr=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;return{currentUser:(0,c.mBe)(e,e.currentUserId),bot:i?.botId?(0,c.mBe)(e,i.botId):void 0}})(e=>{let{modal:t,currentUser:i,bot:a}=e;const{setEmojiStatus:o,closeSuggestedStatusModal:r,sendWebAppEvent:c}=(0,n.ko)(),d=(0,_i.A)(),h=Boolean(t),u=(0,Bi.A)(t),m=(0,s.Kr)(()=>{if(i&&u)return{...i,emojiStatus:{type:"regular",documentId:u.customEmojiId}}},[i,u]),p=(0,s.Kr)(()=>{if(!u||!a)return;const e=(0,l.Yg)(a);return u.duration?d("BotSuggestedStatusFor",{bot:e,duration:(0,He.A$)(d,u.duration)},{withNodes:!0,withMarkdown:!0}):d("BotSuggestedStatus",{bot:e},{withNodes:!0,withMarkdown:!0})},[a,d,u]),v=(0,M.A)(()=>{const e=u?.webAppKey;e&&c({webAppKey:e,event:{eventType:"emoji_status_failed",eventData:{error:"USER_DECLINED"}}}),r()}),g=(0,M.A)(()=>{if(!u)return;const e=u.duration?(0,li.Fm)()+u.duration:void 0;o({referrerWebAppKey:u.webAppKey,emojiStatus:{type:"regular",documentId:u.customEmojiId,until:e}}),r()});return(0,te.FD)(X.A,{isOpen:h,contentClassName:"C9sWDINB",hasAbsoluteCloseButton:!0,isSlim:!0,onClose:v,children:[u&&(0,te.Y)(pa.A,{className:"gdG3oY21",documentId:u.customEmojiId,size:Jr,loopLimit:1,forceAlways:!0}),(0,te.FD)("div",{children:[(0,te.Y)("h3",{className:"KVpsce1g",children:d("BotSuggestedStatusTitle")}),(0,te.Y)("p",{className:"p7S4AH8A",children:p})]}),m&&(0,te.Y)(Kr.A,{mockPeer:m,withEmojiStatus:!0}),(0,te.Y)(Q.A,{onClick:g,children:d("GeneralConfirm")})]})}));var jr=i(55317),zr=i(20333);const Hr="j6xEoljc";function $r(e,t){return e.find(e=>!e.chatId)||e.filter(e=>t&&e.chatId!==t).sort((e,t)=>e.date-t.date)[0]}const qr=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=i&&(0,c.hds)(e,i?.chatId),n=s&&(0,c.AWZ)(e,s.id),a=i?.myBoosts&&$r(i.myBoosts,i.chatId);return{chat:s,chatFullInfo:n,prevBoostedChat:a?.chatId?(0,c.hds)(e,a?.chatId):void 0,isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{modal:t,chat:i,chatFullInfo:a,prevBoostedChat:o,isCurrentUserPremium:r}=e;const{applyBoost:c,closeBoostModal:d,requestConfetti:h,openPremiumModal:u,loadFullChat:m}=(0,n.ko)(),[p,v,g]=(0,F.A)(),[A,f,b]=(0,F.A)(),[C,y,S]=(0,F.A)(),k=i&&(0,l.WX)(i),w=Boolean(t),N=(0,T.A)(),I=(0,_i.A)();(0,s.vJ)(()=>{i&&!a&&m({chatId:i.id})},[i,a]);const P=(0,s.Kr)(()=>{if(i)return(0,l.Js)(N,i)},[i,N]),Y=(0,s.Kr)(()=>{if(o)return(0,l.Js)(N,o)},[o,N]),{isStatusLoaded:D,isBoosted:B,boost:R,title:L,leftText:x,rightText:E,value:V,progress:_,descriptionText:U,canBoostMore:O}=(0,s.Kr)(()=>{if(!t?.boostStatus||!i)return{isStatusLoaded:!1,title:N("Loading")};const{hasMyBoost:e}=t.boostStatus,s=t?.myBoosts&&$r(t.myBoosts,i.id),n=t?.myBoosts&&(o=t.myBoosts,r=i.id,!o.every(e=>e.chatId===r));var o,r;const{boosts:c,currentLevel:d,hasNextLevel:h,levelProgress:u,remainingBoosts:m,isMaxLevel:p}=(0,jr.z)(t.boostStatus,!0),v=e,g=N("BoostsLevel",d),A=h?N("BoostsLevel",d+1):void 0,f=N("ChannelBoost.MoreBoosts",m),b=N(k?"BoostChannel":"BoostGroup"),C=(a?.boostsToUnrestrict||0)-(a?.boostsApplied||0);let y;if(p)y=N("BoostsMaxLevelReached");else if(C>0&&!(0,l.SJ)(i)){const e=N("GroupBoost.BoostToUnrestrict.Times",C);y=N("GroupBoost.BoostToUnrestrict",[e,P])}else y=N("ChannelBoost.MoreBoostsNeeded.Text",[P,f]);return{isStatusLoaded:!0,title:b,leftText:g,rightText:A,value:c.toString(),progress:u,remainingBoosts:m,descriptionText:y,boost:s,isBoosted:v,canBoostMore:n&&!p}},[i,P,t,N,a,k]),K=!t?.myBoosts?.length&&r,J=R?.chatId&&R.chatId!==t?.chatId,G=(0,M.A)(()=>{g(),c({chatId:i.id,slots:[R.slot]}),h({})}),j=(0,M.A)(()=>{u(),S(),d()}),z=(0,M.A)(()=>{if(!R)return r?void d():void y();O?R.cooldownUntil?f():J?v():G():d()}),H=(0,M.A)(()=>{d()});return(0,te.FD)(X.A,{isOpen:w,title:L,className:"IK2mBqbm",contentClassName:"pUyNTysT",onClose:d,children:[D?(0,te.FD)(te.FK,{children:[(0,te.Y)(zr.A,{leftText:x,rightText:E,progress:_,floatingBadgeText:V,floatingBadgeIcon:"boost"}),B&&(0,te.Y)("div",{className:(0,me.A)(Hr,"hAA6B1lc"),children:N("ChannelBoost.YouBoostedChannelText",P)}),(0,te.Y)("div",{className:Hr,children:(0,Dt.A)(U,["simple_markdown","emoji"])}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",disabled:K,onClick:z,children:O?(0,te.FD)(te.FK,{children:[(0,te.Y)(W.A,{name:"boost"}),N(k?"ChannelBoost.BoostChannel":"GroupBoost.BoostGroup")]}):N("OK")}),(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:H,children:N("Cancel")})]})]}):(0,te.Y)(xs.A,{className:"zjXCH3pT"}),J&&Y&&(0,te.FD)(X.A,{isOpen:p,className:"GIFAjZPY",contentClassName:"Jxyz9TaL",onClose:g,children:[(0,te.FD)("div",{className:"OKp6HS1U",children:[(0,te.FD)("div",{className:"NU9itcIm",children:[(0,te.Y)(Mt.A,{peer:o,size:"large"}),(0,te.Y)(W.A,{name:"boostcircle",className:"upXvhNRY"})]}),(0,te.Y)(W.A,{name:"next",className:"WSJdWV7L"}),(0,te.Y)(Mt.A,{peer:i,size:"large"})]}),(0,te.Y)("div",{children:(0,Dt.A)(N("ChannelBoost.ReplaceBoost",[Y,P]),["simple_markdown","emoji"])}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:G,children:N("Replace")}),(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:g,children:N("Cancel")})]})]}),Boolean(R?.cooldownUntil)&&(0,te.Y)(vi.A,{isOpen:A,isOnlyConfirm:!0,confirmLabel:N("OK"),title:N("ChannelBoost.Error.BoostTooOftenTitle"),onClose:b,confirmHandler:b,children:(0,Dt.A)(N("ChannelBoost.Error.BoostTooOftenText",(0,He.A$)(I,R.cooldownUntil-(0,li.Fm)())),["simple_markdown","emoji"])}),!r&&(0,te.Y)(vi.A,{isOpen:C,confirmLabel:N("Common.Yes"),title:N("PremiumNeeded"),onClose:S,confirmHandler:j,children:(0,Dt.A)(N("PremiumNeededForBoosting"),["simple_markdown","emoji"])})]})}));var Wr=i(47058),Qr=i(70046);const Zr="xVLGjLub",Xr=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const{message:s}=i||{},n=s&&(0,c.O5q)(e,s.chatId,s.messageId),a=n&&(0,c.Y7C)(e,n);return{currentUserId:e.currentUserId,messageSender:a}})(e=>{let{currentUserId:t,modal:i,messageSender:a}=e;const{closeGiftCodeModal:r,applyGiftCode:l,focusMessage:c}=(0,n.ko)(),d=(0,T.A)(),h=Boolean(i),u=!(i?.info.toId&&i?.info.toId!==t||i?.info.usedAt),m=(0,M.A)(()=>{i&&i.info.giveawayMessageId&&(c({chatId:i.info.fromId,messageId:i.info.giveawayMessageId}),r())}),p=(0,M.A)(()=>{u?l({slug:i.slug}):r()}),v=(0,s.Kr)(()=>{if(!i)return;const{slug:e,info:t}=i,s=t.fromId||a?.id,n=(0,te.FD)(te.FK,{children:[(0,te.Y)("img",{src:Qo,alt:"",className:"Mtx4SWww"}),(0,te.Y)("p",{className:Zr,children:(0,Dt.A)(d("lng_gift_link_about"),["simple_markdown"])}),(0,te.Y)(Wr.A,{title:"BoostingGiftLink",link:`${o.jsp}/giftcode/${e}`})]}),r=[[d("BoostingFrom"),s?{chatId:s}:d("BoostingNoRecipient")],[d("BoostingTo"),t.toId?{chatId:t.toId}:d("BoostingNoRecipient")],[d("BoostingGift"),d("BoostingTelegramPremiumFor",d("Months",t.months,"i"))]];return t.isFromGiveaway&&r.push([d("BoostingReason"),(0,te.Y)("span",{className:(0,me.A)(t.giveawayMessageId&&"IzcASdzD"),onClick:m,children:t.isFromGiveaway&&!t.toId?d("BoostingIncompleteGiveaway"):d("BoostingGiveaway")})]),r.push([d("BoostingDate"),(0,He.L2)(1e3*t.date,d.code,!0)]),{header:n,tableData:r,footer:(0,te.Y)("span",{className:Zr,children:(0,Dt.A)(t.usedAt?d("BoostingUsedLinkDate",(0,He.L2)(1e3*t.usedAt,d.code,!0)):d("BoostingSendLinkToAnyone"),["simple_markdown"])})}},[d,a?.id,i]);if(v)return(0,te.Y)(Qr.A,{isOpen:h,title:d("lng_gift_link_title"),tableData:v.tableData,header:v.header,footer:v.footer,buttonText:d(u?"BoostingUseLink":"Close"),onButtonClick:p,onClose:r})}));function el(e,t){return e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)}const tl=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const{selfDestructAccountDays:s}=i||{};return{selfDestructAccountDays:s}})(e=>{let{modal:t,selfDestructAccountDays:i}=e;const{closeGiftCodeModal:a,closeDeleteAccountModal:r,setAccountTTL:l}=(0,n.ko)(),c=(0,_i.A)(),d=Boolean(t),[h,u]=(0,s.J0)(),m=(0,M.A)(e=>30*Number(e)),p=(0,s.Kr)(()=>{if(i)return el(o.WF4,i/30).toString()},[i]);(0,s.vJ)(()=>{p&&u(p)},[p]);const v=(0,s.Kr)(()=>o.WF4.map(e=>({value:String(e),label:c("Months",{count:e},{pluralValue:1})})),[c]),g=(0,M.A)(e=>{u(e)}),A=(0,M.A)(()=>{h&&l({days:m(h)})}),f=(0,M.A)(()=>{r()});return(0,te.FD)(X.A,{isOpen:d,title:c("SelfDestructTitle"),onClose:a,className:"X6K5oA8U",children:[(0,te.Y)("p",{children:c("SelfDestructSessionsDescription")}),(0,te.Y)(ee.A,{className:"dialog-checkbox-group",name:"quick-reaction-settings",options:v,selected:h,onChange:g,withIcon:!0}),(0,te.FD)("div",{className:"dialog-buttons mt-2",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:A,children:c("Save")}),(0,te.Y)(Q.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:f,children:c("Cancel")})]})]})})),il={root:"OviJR58x",content:"BlpqzGYt",header:"b9RUzfpF",iconWrapper:"l1X5kBUM",icon:"qOoRnv_Y",mainText:"s2SOQSml",description:"wiKBjcl2"},sl=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig;return{verifyAgeBotUsername:t.verifyAgeBotUsername,verifyAgeMin:t.verifyAgeMin||o.lYi}})(e=>{let{modal:t,verifyAgeBotUsername:i,verifyAgeMin:s}=e;const{closeAgeVerificationModal:a,openChatByUsername:o}=(0,n.ko)(),r=(0,_i.A)(),l=Boolean(t),c=(0,M.A)(()=>{i&&o({shouldStartMainApp:!0,username:i}),a()}),d=(0,M.A)(()=>{a()});return(0,te.FD)(X.A,{isOpen:l,onClose:d,className:il.root,children:[(0,te.FD)("div",{className:il.content,children:[(0,te.Y)("div",{className:il.header,children:(0,te.Y)("div",{className:il.iconWrapper,children:(0,te.Y)(W.A,{name:"user",className:il.icon})})}),(0,te.Y)("h2",{className:il.title,children:r("TitleAgeVerificationModal")}),(0,te.Y)("p",{className:il.mainText,children:r("TextAgeVerificationModal",{count:s},{withMarkdown:!0,withNodes:!0,pluralValue:s})}),(0,te.Y)("p",{className:il.description,children:r("DescriptionAgeVerificationModal")})]}),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{onClick:c,children:r("ButtonAgeVerification")})})]})}));var nl=i(34132),al=i(24713);const ol={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"},rl=(0,s.ph)(e=>{let{invite:t,folder:i}=e;const{closeChatlistModal:a,joinChatlistInvite:o}=(0,n.ko)(),r=(0,_i.A)(),l=(0,T.A)(),[c,d]=(0,s.J0)(t.missingPeerIds),h=Boolean(t.missingPeerIds.length),u=0===t.alreadyPeerIds.length,m=h?t.missingPeerIds.length:0,p=c.length?c.length.toString():void 0,v=u?r("FolderLinkSubtitleNew"):m?r("FolderLinkSubtitleAdd",{chats:r("FolderLinkSubtitleAddCount",{count:m},{pluralValue:m}),title:(0,Xi.fd)({text:i.title.text,entities:i.title.entities,noCustomEmojiPlayback:i.noTitleAnimations})},{withNodes:!0,withMarkdown:!0}):r("FolderLinkSubtitleAlready"),g=(0,s.hb)(()=>{a(),c.length&&o({invite:t,peerIds:c})},[t,c]),A=(0,s.hb)(()=>{const e=c.length===t.missingPeerIds.length;d(e?[]:t.missingPeerIds)},[t.missingPeerIds,c.length]);return(0,te.FD)("div",{className:ol.content,children:[(0,te.Y)("div",{className:ol.description,children:(0,Dt.A)(v,["simple_markdown","emoji"])}),(0,te.FD)("div",{className:(0,me.A)(ol.pickerWrapper,"custom-scroll"),children:[Boolean(t.missingPeerIds.length)&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:ol.pickerHeader,children:[(0,te.Y)("div",{className:ol.pickerHeaderInfo,children:l("FolderLinkHeaderChatsJoin",c.length,"i")}),(0,te.Y)("div",{className:ol.selectionToggle,role:"button",tabIndex:0,onClick:A,children:c.length===t.missingPeerIds.length?l("DeselectAll"):l("SelectAll")})]}),(0,te.Y)(yi.A,{itemIds:t.missingPeerIds,onSelectedIdsChange:d,selectedIds:c,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,te.Y)("div",{className:ol.pickerHeader,children:(0,te.Y)("div",{className:ol.pickerHeaderInfo,children:l("FolderLinkHeaderAlready")})}),(0,te.Y)(yi.A,{itemIds:t.alreadyPeerIds,lockedSelectedIds:t.alreadyPeerIds,selectedIds:t.alreadyPeerIds,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,te.Y)(Q.A,{onClick:g,children:(0,te.FD)("div",{className:ol.buttonText,children:[!c.length&&l("OK"),Boolean(c.length)&&(0,te.FD)(te.FK,{children:[l("FolderLinkButtonJoinPlural",c.length,"i"),(0,te.Y)(al.A,{className:ol.buttonBadge,text:p,isAlternateColor:!0})]})]})})]})}),ll=(0,s.ph)(e=>{let{folder:t,suggestedPeerIds:i=Ci.p}=e;const{closeChatlistModal:a,leaveChatlist:o}=(0,n.ko)(),r=(0,T.A)(),[l,c]=(0,s.J0)([]),d=l.length?l.length.toString():void 0,h=(0,s.hb)(()=>{const e=l.length===i.length;c(e?[]:i)},[i,l.length]),u=(0,s.hb)(()=>{a(),o({folderId:t.id,peerIds:l})},[t.id,l]);return(0,te.FD)("div",{className:ol.content,children:[Boolean(i?.length)&&(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:ol.description,children:(0,Dt.A)(r("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])}),(0,te.FD)("div",{className:(0,me.A)(ol.pickerWrapper,"custom-scroll"),children:[(0,te.FD)("div",{className:ol.pickerHeader,children:[(0,te.Y)("div",{className:ol.pickerHeaderInfo,children:r("FolderLinkHeaderChatsQuit",l.length,"i")}),(0,te.Y)("div",{className:ol.selectionToggle,role:"button",tabIndex:0,onClick:h,children:l.length===i.length?r("DeselectAll"):r("SelectAll")})]}),(0,te.Y)(yi.A,{itemIds:i,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]})]}),(0,te.Y)(Q.A,{onClick:u,children:(0,te.FD)("div",{className:ol.buttonText,children:[!l.length&&r("FolderLinkButtonRemove"),Boolean(l.length)&&(0,te.FD)(te.FK,{children:[r("FolderLinkButtonRemoveChats"),(0,te.Y)(al.A,{className:ol.buttonBadge,text:d,isAlternateColor:!0})]})]})})]})}),cl=(0,s.ph)(e=>{let{invite:t}=e;const{closeChatlistModal:i,joinChatlistInvite:a}=(0,n.ko)(),o=(0,_i.A)(),r=(0,T.A)(),[l,c]=(0,s.J0)(t.peerIds),d=(0,s.Kr)(()=>{const e=(0,n.mS)().chats.byId;return t.peerIds.filter(t=>!e[t].isNotJoined)},[t.peerIds]),h=l.length-d.length,u=h?h.toString():void 0,m=(0,s.hb)(()=>{i(),a({invite:t,peerIds:l})},[t,l]),p=(0,s.hb)(()=>{const e=l.length===t.peerIds.length;c(e?d:t.peerIds)},[t.peerIds,d,l.length]);return(0,te.FD)("div",{className:ol.content,children:[(0,te.Y)("div",{className:ol.description,children:o("FolderLinkSubtitleNew")}),(0,te.FD)("div",{className:(0,me.A)(ol.pickerWrapper,"custom-scroll"),children:[(0,te.FD)("div",{className:ol.pickerHeader,children:[(0,te.Y)("div",{className:ol.pickerHeaderInfo,children:r("FolderLinkHeaderChatsJoin",h,"i")}),(0,te.Y)("div",{className:ol.selectionToggle,role:"button",tabIndex:0,onClick:p,children:l.length===t.peerIds.length?r("DeselectAll"):r("SelectAll")})]}),(0,te.Y)(yi.A,{itemIds:t.peerIds,lockedSelectedIds:d,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,te.Y)(Q.A,{onClick:m,disabled:!l.length,children:(0,te.FD)("div",{className:ol.buttonText,children:[o("FolderLinkAddFolder"),(0,te.Y)(al.A,{className:ol.buttonBadge,text:u,isAlternateColor:!0})]})})]})}),dl=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const{invite:s,removal:n}=i||{},a=n?.folderId||(s&&"folderId"in s?s.folderId:void 0);return{folder:a?(0,c.$aQ)(e,a):void 0}})(e=>{let{modal:t,folder:i}=e;const{closeChatlistModal:a}=(0,n.ko)(),o=(0,T.A)(),r=Boolean(t),l=(0,_.A)(t)||t,c=(0,_.A)(i)||i,d=(0,s.Kr)(()=>{if(l){if(l.invite){const e=l.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?o("FolderLinkTitleAddChats"):o("FolderLinkTitleAlready"):o("FolderLinkTitleAdd")}return l.removal?o("FolderLinkTitleRemove"):void 0}},[o,l]),h=(0,s.Kr)(()=>c?(0,Xi.fd)({text:c.title.text,entities:c.title.entities,noCustomEmojiPlayback:c.noTitleAnimations}):l?.invite&&"title"in l.invite?(0,Xi.fd)({text:l.invite.title.text,entities:l.invite.title.entities,noCustomEmojiPlayback:l.invite.noTitleAnimations}):void 0,[c,l]),u=(0,s.Kr)(()=>{if(l?.invite)return"missingPeerIds"in l.invite?l.invite.missingPeerIds.length:void 0},[l]),m=(0,s.hb)(()=>{if(l){if(l.invite){const e=l.invite;return"alreadyPeerIds"in e?(0,te.Y)(rl,{invite:e,folder:c}):(0,te.Y)(cl,{invite:e})}return l.removal?(0,te.Y)(ll,{folder:c,suggestedPeerIds:l.removal.suggestedPeerIds}):void 0}},[c,l]);return(0,te.FD)(X.A,{isOpen:r,title:d,onClose:a,isSlim:!0,hasCloseButton:!0,children:[h&&(p=h,(0,te.Y)("div",{className:ol.foldersWrapper,children:(0,te.FD)("div",{className:ol.folders,children:[(0,te.Y)(nl.A,{className:ol.folder,title:o("FolderLinkPreviewLeft")}),(0,te.Y)(nl.A,{className:ol.folder,isActive:!0,badgeCount:u,isBadgeActive:!0,title:p}),(0,te.Y)(nl.A,{className:ol.folder,title:o("FolderLinkPreviewRight")})]})})),m()]});var p}));var hl=i(29886);const ul={content:"MZ0RCecx",title:"ar8XeydN",participantCount:"un00TXYY",participants:"YvkZ6c2D",participant:"DHJSBDeE",buttons:"KFtrPtNr"},ml=(0,s.ph)(e=>{let{modal:t}=e;const{acceptChatInvite:i,closeChatInviteModal:a,showNotification:o}=(0,n.ko)(),r=(0,s.li)(),d=(0,T.A)(),h=(0,hl.A)(t),{hash:u,inviteInfo:m}=t||h||{},{about:p,isBroadcast:v,participantIds:g,participantsCount:A,photo:f,isRequestNeeded:b}=m||{},C=(0,M.A)(()=>{a()}),y=(0,M.A)(()=>{i({hash:u}),b&&o({message:d(v?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),C()}),S=v?"ProfileJoinChannel":"JoinGroup",k=v?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup",w=(0,s.Kr)(()=>{if(m)return(0,l.nr)(m)},[m]),N=(0,s.Kr)(()=>{if(!g)return;const e=(0,n.mS)();return g.map(t=>(0,c.mBe)(e,t)).filter(Boolean)},[g]);return(0,Nn.A)(r,!t||!N),(0,te.FD)(X.A,{isOpen:Boolean(t),contentClassName:ul.content,isSlim:!0,onClose:C,onEnter:y,children:[w&&(0,te.Y)(Mt.A,{size:"jumbo",photo:f,peer:w,withVideo:!0}),w&&(0,te.Y)(Es.A,{className:ul.title,peer:w}),p&&(0,te.Y)("p",{className:ul.about,children:p}),(0,te.Y)("p",{className:ul.participantCount,children:d(v?"Subscribers":"Members",A,"i")}),N&&(0,te.Y)("div",{ref:r,className:(0,me.A)(ul.participants,"no-scrollbar"),children:N.map(e=>(0,te.Y)(Yn.A,{className:ul.participant,peer:e,text:(0,l.Yg)(e)}))}),(0,te.FD)("div",{className:(0,me.A)("dialog-buttons",ul.buttons),children:[(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:y,children:d(b?k:S)}),(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:C,children:d("Cancel")})]})]})});var pl=i(84685),vl=i(89873),gl=i(5463);const Al="La4sUYaq",fl="Bn5kz5br",bl=(0,s.ph)((0,n.EK)(e=>({minLevelToRestrictAds:e.appConfig.channelRestrictAdsLevelMin}))(e=>{let{modal:t,minLevelToRestrictAds:i}=e;const{closeAboutAdsModal:a}=(0,n.ko)(),o=(0,s.li)(),r=Boolean(t),l=(0,Bi.A)(t),{canReport:c,randomId:d,additionalInfo:h,sponsorInfo:u}=l||{},m=c,p=(0,Bi.A)(m),v=(0,T.A)(),g=(0,s.Kr)(()=>(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{children:v("SponsoredMessageInfoScreen.Title")}),(0,te.Y)("p",{children:(0,Dt.A)(v("SponsoredMessageInfoDescription1"),["br"])}),(0,te.Y)("p",{children:(0,Dt.A)(v("SponsoredMessageInfoDescription2"),["br"])}),(0,te.Y)("p",{children:(0,Dt.A)(v("SponsoredMessageInfoDescription3"),["br"])}),(0,te.Y)("p",{children:(0,te.Y)(pl.A,{url:v("SponsoredMessageAlertLearnMoreUrl"),text:v("SponsoredMessageAlertLearnMoreUrl")})}),(0,te.Y)("p",{children:(0,Dt.A)(v("SponsoredMessageInfoDescription4"),["br"])})]}),[v]),{isContextMenuOpen:A,contextMenuAnchor:f,handleContextMenu:b,handleContextMenuClose:C,handleContextMenuHide:y}=(0,bn.A)(o,!p),S=(0,M.A)(()=>{a(),C(),y()}),k=(0,s.Kr)(()=>{if(r)return{header:(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:Al,children:v("AboutRevenueSharingAds")}),(0,te.Y)("p",{className:(0,me.A)(fl,"hbsLlXSH"),children:v("RevenueSharingAdsAlertSubtitle")}),(0,te.Y)(Q.A,{ref:o,round:!0,size:"smaller",color:"translucent",className:"JdN5pGTw",onClick:b,children:(0,te.Y)(W.A,{name:"more"})})]}),listItemData:[["lock",v("RevenueSharingAdsInfo1Title"),(0,Dt.A)(v("RevenueSharingAdsInfo1Subtitle"),["simple_markdown"])],["revenue-split",v("RevenueSharingAdsInfo2Title"),(0,Dt.A)(v("RevenueSharingAdsInfo2Subtitle"),["simple_markdown"])],["nochannel",v("RevenueSharingAdsInfo3Title"),(0,Dt.A)(v("RevenueSharingAdsInfo3Subtitle",i),["simple_markdown"])]],footer:(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:Al,children:(0,Dt.A)(v("RevenueSharingAdsInfo4Title"),["simple_markdown"])}),(0,te.FD)("p",{className:fl,children:[(0,Dt.A)(v("RevenueSharingAdsInfo4Subtitle2",""),["simple_markdown"]),(0,te.Y)(pl.A,{url:v("PromoteUrl"),text:v("LearnMoreArrow")})]})]})}},[r,v,b,i]);return p?(0,te.FD)(te.FK,{children:[(0,te.Y)(gl.A,{isOpen:r,listItemData:k?.listItemData,headerIconName:"channel",withSeparator:!0,header:k?.header,footer:k?.footer,buttonText:v("RevenueSharingAdsUnderstood"),onClose:S}),f&&d&&(0,te.Y)(vl.A,{isOpen:A,anchor:f,triggerRef:o,randomId:d,additionalInfo:h,canReport:c,sponsorInfo:u,shouldSkipAbout:!0,onItemClick:S,onClose:C,onCloseAnimationEnd:y})]}):(0,te.FD)(X.A,{isOpen:r,className:"LFkgLoAk",contentClassName:"TZE15Pt_",onClose:S,children:[g,(0,te.Y)(Q.A,{onClick:S,children:v("RevenueSharingAdsUnderstood")})]})})),Cl="t9iZUzOj",yl=(0,s.ph)(e=>{let{isOpen:t,onClose:i}=e;const n=(0,T.A)(),a=(0,_i.A)(),o=(0,s.Kr)(()=>{const e=n("LearnMore");return a("ChannelEarnLearnCoinAbout",{link:(0,te.FD)(pl.A,{url:n("MonetizationInfoTONLink"),text:e,children:[e,(0,te.Y)(W.A,{name:"next"})]})},{withNodes:!0})},[a,n]),r=(0,s.Kr)(()=>a("MonetizationInfoTONTitle",void 0,{withNodes:!0,specialReplacement:{"💎":(0,te.Y)(W.A,{className:"ATkOSqJ7",name:"toncoin"})}}),[a]),l=(0,s.Kr)(()=>{if(t)return{header:(0,te.Y)("h3",{className:Cl,children:n("lng_channel_earn_learn_title")}),listItemData:[["channel",n("lng_channel_earn_learn_in_subtitle"),(0,Dt.A)(n("lng_channel_earn_learn_in_about"),["simple_markdown"])],["revenue-split",n("lng_channel_earn_learn_split_subtitle"),(0,Dt.A)(n("Monetization.Intro.Split.Text"),["simple_markdown"])],["cash-circle",n("lng_channel_earn_learn_out_subtitle"),(0,Dt.A)(n("lng_channel_earn_learn_out_about"),["simple_markdown"])]],footer:(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:Cl,children:r}),(0,te.Y)("p",{className:"mjveZmdr",children:o})]})}},[t,n,r,o]);if(l)return(0,te.Y)(gl.A,{isOpen:t,listItemData:l.listItemData,headerIconName:"cash-circle",withSeparator:!0,header:l.header,footer:l.footer,buttonText:n("RevenueSharingAdsUnderstood"),onClose:i})});var Sl=i(15535);const kl="oofoCYlu",wl=(0,s.ph)((0,n.EK)(e=>{const{twoFaSettings:{hint:t}}=e;return{passwordHint:t}})(e=>{let{modal:t,passwordHint:i}=e;const{closeMonetizationVerificationModal:a,clearMonetizationVerificationError:o,processMonetizationRevenueWithdrawalUrl:r}=(0,n.ko)(),l=Boolean(t),c=(0,Bi.A)(t),d=(0,_i.A)(),[h,u]=(0,s.J0)(!1),m=(0,M.A)(e=>{c&&r({peerId:c.chatId,currentPassword:e})}),p=(0,M.A)(()=>{o()}),v=(0,M.A)(()=>{a()});return(0,te.Y)(X.A,{isOpen:l,hasCloseButton:!0,title:d("CheckPasswordTitle"),className:"WqeWhMAS",contentClassName:kl,onClose:v,children:(0,te.Y)("div",{className:(0,me.A)(kl,"settings-content password-form custom-scroll"),children:(0,te.Y)("div",{className:"settings-item pt-0",children:(0,te.Y)(Sl.A,{shouldShowSubmit:!0,placeholder:d("CheckPasswordPlaceholder"),error:c?.errorKey&&d.withRegular(c.errorKey),description:d("CheckPasswordDescription"),onClearError:p,isLoading:c?.isLoading,hint:i,isPasswordVisible:h,shouldResetValue:l,onChangePasswordVisibility:u,onSubmit:m})})})})})),Nl={content:"MKdSUg2P",chatItem:"qEIwBtp0"},Il=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.mBe)(e,e.currentUserId),i=(0,c.g29)(e);return{currentUser:t,stickerSet:e.defaultStatusIconsId?(0,c.ycM)(e,e.defaultStatusIconsId):void 0,isPremium:i,isAccountFrozen:(0,c.trm)(e)}})(e=>{let{modal:t,currentUser:i,stickerSet:a,isPremium:o,isAccountFrozen:r}=e;const{closeEmojiStatusAccessModal:c,toggleUserEmojiStatusPermission:d,sendWebAppEvent:h,openPremiumModal:u,loadDefaultStatusIcons:m}=(0,n.ko)(),p=Boolean(t),v=(0,T.A)(),g=(0,_i.A)(),A=(0,s.li)(),[f,b]=(0,s.J0)(0);(0,s.vJ)(()=>{!p||a?.stickers||r||m()},[p,a,r]);const C=(0,s.Kr)(()=>{if(i&&a?.stickers)return{...i,emojiStatus:{type:"regular",documentId:a.stickers[f].id}}},[i,a,f]),y=a?.stickers?.length;(0,fn.A)(()=>{y&&b(e=>(e+1)%y)},y?3200:void 0);const S=(0,M.A)(()=>(0,te.Y)(Kr.A,{withEmojiStatus:!0,className:Nl.chatItem,itemClassName:Nl.itemName,mockPeer:C})),k=(0,M.A)(()=>{t?.bot?.id&&(c(),t?.webAppKey&&(o?(h({webAppKey:t.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"allowed"}}}),d({botId:t.bot.id,isEnabled:!0,isBotAccessEmojiGranted:!0})):(u(),h({webAppKey:t.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}))))}),w=(0,M.A)(()=>{t?.bot?.id&&(c(),t?.webAppKey&&h({webAppKey:t.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}),o&&d({botId:t.bot.id,isEnabled:!1}))}),N=(0,M.A)(()=>{if(t?.bot)return g("EmojiStatusAccessText",{name:(0,l.Yg)(t?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,te.FD)(X.A,{className:(0,me.A)("confirm"),contentClassName:Nl.content,isOpen:p,onClose:w,children:[S(),(0,te.FD)("div",{children:[N(),(0,te.FD)("div",{className:"dialog-buttons mt-2",ref:A,children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:k,color:"primary",children:v("lng_bot_allow_write_confirm")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:w,children:g("Cancel")})]})]})]})})),Pl=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(e=>{let{modal:t,currentUser:i}=e;const{closeLocationAccessModal:a,toggleUserLocationPermission:o,sendWebAppEvent:r}=(0,n.ko)(),c=Boolean(t),d=(0,T.A)(),h=(0,_i.A)(),m=(0,s.li)(),p=(0,M.A)(async()=>{const e=await(0,u.Bu)(),{geolocation:i}=e;t?.bot?.id&&(a(),t?.webAppKey&&(o({botId:t.bot.id,isAccessGranted:!0}),r({webAppKey:t.webAppKey,event:{eventType:"location_requested",eventData:{available:!0,latitude:i?.latitude,longitude:i?.longitude,altitude:i?.altitude,course:i?.heading,speed:i?.speed,horizontal_accuracy:i?.accuracy,vertical_accuracy:i?.accuracy}}})))}),v=(0,M.A)(()=>{t?.bot?.id&&(a(),t?.webAppKey&&(o({botId:t.bot.id,isAccessGranted:!1}),r({webAppKey:t.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}})))}),g=(0,M.A)(()=>{if(t?.bot)return(0,te.FD)("div",{className:"CGPoDaLo",children:[(0,te.Y)(Mt.A,{size:"large",peer:i}),(0,te.Y)(W.A,{name:"next",className:"pzERgD5x"}),(0,te.Y)(Mt.A,{size:"large",peer:t.bot})]})}),A=(0,M.A)(()=>{if(t?.bot)return h("LocationPermissionText",{name:(0,l.Yg)(t?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,te.FD)(X.A,{className:(0,me.A)("confirm"),isOpen:c,onClose:v,children:[g(),(0,te.FD)("div",{children:[A(),(0,te.FD)("div",{className:"dialog-buttons mt-2",ref:m,children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",children:d("lng_bot_allow_write_confirm")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:v,children:h("Cancel")})]})]})]})})),Yl="qJDgUtjV",Fl=(0,s.ph)(e=>{let{modal:t}=e;const{reportSponsored:i,closeReportAdModal:a,openPreviousReportAdModal:o}=(0,n.ko)(),l=(0,T.A)(),c=Boolean(t),d=(0,s.li)(),h=(0,M.A)((e,s)=>{const{chatId:n,randomId:a}=t;i({peerId:n,randomId:a,option:s})}),[u,m]=(0,s.Kr)(()=>{if(!t)return[void 0,0];const e=t.sections.length-1;return[t.sections[e],e]},[t]),p=(0,M.A)(()=>{m?o():a()}),v=(0,s.Kr)(()=>{if(!t)return;const e=l("lng_report_sponsored_reported_learn").split("{link}");return[e[0],(0,te.Y)(pl.A,{text:l("lng_report_sponsored_reported_link"),url:l("ReportAd.Help_URL")}),e[1]]},[l,t]),g=(0,s.Kr)(()=>{if(!t)return;const e=Boolean(u?.subtitle);return(0,te.FD)("div",{className:"modal-header-condensed",children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l(m?"Back":"Close"),onClick:p,children:(0,te.Y)(W.A,{name:m?"arrow-left":"close"})}),(0,te.FD)("div",{className:(0,me.A)("modal-title","ZAdG13Ah",e&&"lVVyV0py"),children:[(0,te.Y)("h3",{className:"mMmY6YR4",children:l("ReportAd")}),e&&(0,te.Y)("span",{className:"gSkAFc4u",children:u.subtitle})]})]})},[l,t,m,u?.subtitle]);(0,s.vJ)(()=>{if(!t)return;const e=document.querySelector(`.${ne.uo} > .${Yl}`);if(!e)return;const i=e.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${i+56}px`})},[t]);const A=(0,M.A)(()=>{const e=document.querySelector(`.${ne.VY} > .${Yl}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${t+56}px`})})});return(0,te.Y)(X.A,{isOpen:c,hasCloseButton:!0,className:"njPBcVYr",header:g,onClose:a,children:(0,te.FD)(ne.Ay,{name:"slide",className:"HjsGIG6e",ref:d,activeKey:m,onStart:A,children:[(0,te.FD)("div",{className:Yl,children:[(0,te.Y)("h3",{className:"jrA2dOiw",children:u?.title}),u?.options.map(e=>(0,te.Y)(ci.A,{narrow:!0,secondaryIcon:"next",className:"aFbjDzNo",buttonClassName:"VbE0HzDs",clickArg:e.option,onClick:h,children:(0,te.Y)("div",{className:"oWujoaSC",children:e.text})}))]}),(0,te.Y)("p",{className:"k71Zrc_P",children:v})]})})});var Dl=i(94079);const Ml="kq9LwNTZ",Tl=(0,s.ph)(e=>{let{modal:t}=e;const{reportMessages:i,reportStory:a,closeReportModal:o,openPreviousReportModal:l}=(0,n.ko)(),c=(0,T.A)(),d=Boolean(t),h=(0,s.li)(),[u,m]=(0,s.J0)(""),p=(0,M.A)((e,s)=>{const{messageIds:n,subject:o,peerId:r,chatId:l}=t;if(n)switch(o){case"message":i({chatId:l,messageIds:n,option:s});break;case"story":a({storyId:n[0],peerId:r,option:s})}}),[v,g]=(0,s.Kr)(()=>{if(!t)return[void 0,0];const e=t.sections.length-1;return[t?.sections[e],e]},[t]),A=(0,M.A)(()=>{l()}),f=(0,M.A)(()=>{o()}),b=(0,s.Kr)(()=>{if(!t)return;const e=Boolean(v?.subtitle);return(0,te.FD)("div",{className:"modal-header-condensed",children:[g?(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Back"),onClick:A,children:(0,te.Y)(W.A,{name:"arrow-left"})}):(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Close"),onClick:f,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.FD)("div",{className:(0,me.A)("modal-title","Lj_ezEWU",e&&"OYFbu8fQ"),children:[(0,te.Y)("h3",{className:(0,me.A)("QawchdxB",g&&"CV7kzv9H"),children:v?.options?c("story"===t?.subject?"ReportStory":"Report"):v?.title}),e&&(0,te.Y)("span",{className:"OUFckTb7",children:v.subtitle})]})]})},[c,t,g,v?.options,v?.subtitle,v?.title]),C=(0,M.A)(e=>{m(e.target.value)});(0,s.vJ)(()=>{if(!t)return;const e=document.querySelector(`.${ne.uo} > .${Ml}`);if(!e)return;const i=e.scrollHeight;(0,r.RK)(()=>{h.current.style.height=`${i}px`})},[t]);const y=(0,M.A)(()=>{const e=document.querySelector(`.${ne.VY} > .${Ml}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{h.current.style.height=`${t+20}px`})})}),S=(0,M.A)(()=>{m(""),o()}),k=(0,M.A)(()=>{const{messageIds:e,subject:s,peerId:n,chatId:o}=t;switch(s){case"message":i({chatId:o,messageIds:e,option:v?.option,description:u});break;case"story":a({storyId:e?.[0],peerId:n,option:v?.option,description:u})}S()});return(0,te.Y)(X.A,{isOpen:d,header:b,onClose:S,contentClassName:"tNysQgHL",className:(0,me.A)("E1bGWeON","story"===t?.subject&&"component-theme-dark"),children:(0,te.Y)(ne.Ay,{name:"slide",className:"n2VxPirU",ref:h,activeKey:g,onStart:y,children:(0,te.FD)("div",{className:Ml,children:[v?.options?(0,te.Y)("h3",{className:"GSfUuTet",children:v?.title}):void 0,v?.options?.map(e=>(0,te.Y)(ci.A,{narrow:!0,nonInteractive:!0,secondaryIcon:"next",className:"RoxwMzvA",buttonClassName:"Z6skYdvb",clickArg:e.option,onClick:p,children:(0,te.Y)("div",{className:"FU8m6NUU",children:e.text})})),v?.option?(0,te.FD)("div",{className:"KpptZ3Mk",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Report,size:100,className:"kO8JC4gK",nonInteractive:!0,forceAlways:!0,noLoop:!1}),(0,te.Y)(Dl.A,{id:"option",className:"yc3szGcx",label:v.isOptional?c("Report2CommentOptional"):c("Report2Comment"),onChange:C,value:u,maxLength:512,maxLengthIndicator:(512-u.length).toString(),noReplaceNewlines:!0}),(0,te.Y)(Q.A,{onClick:k,disabled:v.isOptional?void 0:!u.length,children:c("ReportSend")})]}):void 0]})})})});var Bl=i(65632),Rl=i(90596);const Ll=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=(0,c.SJA)(e),{isBlurred:n,patternColor:a,background:o,backgroundColor:r}=(0,c.Gyz)(e,s)||{};return{theme:s,isBackgroundBlurred:n,patternColor:a,customBackground:o,backgroundColor:r,bot:i?(0,c.mBe)(e,i?.botId):void 0,currentUserId:e.currentUserId}})(e=>{let{modal:t,theme:i,isBackgroundBlurred:a,patternColor:o,customBackground:r,backgroundColor:c,bot:d}=e;const{closePreparedInlineMessageModal:h,sendWebAppEvent:u,openSharePreparedMessageModal:m}=(0,n.ko)(),p=(0,_i.A)(),v=Boolean(t),{webAppKey:g,message:A,botId:f}=t||{},b=(0,s.li)(),C=(0,Bl.A)(i,r),y=(0,M.A)(()=>{g&&f&&A&&(m({webAppKey:g,message:A}),h())}),S=(0,M.A)(()=>{h(),g&&u({webAppKey:g,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),k=(0,s.Kr)(()=>{if(t)return(0,te.FD)("div",{className:"P1fPh6h8",children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:p("Close"),onClick:S,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("h3",{className:(0,me.A)("modal-title","E42tgAwD"),children:p("BotShareMessage")})]})},[p,t]),w=(0,s.Kr)(()=>{if(f&&A&&g)return(0,l.i7)(f,A)},[f,A,g]),N=(0,me.A)("_6w75ldP","lElCwweL",r&&"CZkpv8n0",c&&"VJAYrDF_",r&&a&&"m8xzfVvU");return(0,te.FD)(X.A,{dialogRef:b,isOpen:v,header:k,onClose:S,className:"Rzj2LMLf",contentClassName:"Ve4u2KVI",children:[(0,te.FD)("div",{className:(0,me.A)("McJgXCtB","MessageList"),inert:!0,style:(0,Di.A)(`--pattern-color: ${o}`,c&&`--theme-background-color: ${c}`),children:[(0,te.Y)("div",{className:N,style:C?`--custom-background: ${C}`:void 0}),w&&(0,te.Y)(Rl.A,{message:w,threadId:O.l3,messageListType:"thread",noComments:!0,noReplies:!0,appearanceOrder:0,isJustAdded:!1,isFirstInGroup:!0,isLastInGroup:!0,isLastInList:!1,isFirstInDocumentGroup:!1,isLastInDocumentGroup:!1},f)]}),(0,te.FD)("div",{className:"pNSCKAVN",children:[(0,te.Y)("p",{className:"xWnXsG7q",children:p("WebAppShareMessageInfo",{user:(0,l.Yg)(d)})}),(0,te.Y)(Q.A,{onClick:y,children:p("BotShareMessageShare")})]})]})}));var xl=i(20247),El=i(48227);const Vl=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{isPaymentMessageConfirmDialogOpen:i}=t;return{isPaymentMessageConfirmDialogOpen:i,starsBalance:e.stars?.balance.amount||0,isStarsBalanceModalOpen:Boolean(t.starsBalanceModal)}})(e=>{let{modal:t,isPaymentMessageConfirmDialogOpen:i,isStarsBalanceModalOpen:a,starsBalance:o}=e;const{closeSharePreparedMessageModal:r,sendInlineBotResult:l,sendWebAppEvent:d,showNotification:h,updateSharePreparedMessageModalSendArgs:u}=(0,n.ko)(),m=(0,T.A)(),p=Boolean(t),[v,g,A]=(0,F.A)();(0,s.vJ)(()=>{p&&g()},[p,g]);const{message:f,filter:b,webAppKey:C,pendingSendArgs:y}=t||{},{starsForSendMessage:S}=y||{},{closeConfirmDialog:k,dialogHandler:w,shouldAutoApprove:N,setAutoApprove:I,handleWithConfirmation:P}=(0,xl.A)(S||0,a,o),Y=(0,M.A)(()=>{r(),C&&d({webAppKey:C,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),D=(0,M.A)((e,t)=>{if(f&&C){const i=(0,n.mS)(),s=(0,c.PVB)(i,e);l({chatId:e,threadId:t||O.l3,id:f.result.id,queryId:f.result.queryId}),S||h({message:m("BotSharedToOne",(0,Ft.F9)(m,s))}),d({webAppKey:C,event:{eventType:"prepared_message_sent"}}),r(),u({args:void 0})}}),B=(0,M.A)((e,t)=>{u({args:{peerId:e,threadId:t}})}),R=(0,M.A)(()=>{y&&P(D,y.peerId,y.threadId)}),L=(0,M.A)(()=>{k(),u({args:void 0})});(0,s.vJ)(()=>{y&&R()},[y]);const x=(0,n.mS)(),E=y?(0,c.PVB)(x,y.peerId):void 0,V=E?(0,Ft.F9)(m,E):void 0;if(p||v)return(0,te.FD)(te.FK,{children:[(0,te.Y)(Js,{isOpen:p,searchPlaceholder:m("Search"),filter:b,onSelectRecipient:B,onClose:Y,onCloseAnimationEnd:A,isLowStackPriority:!0}),(0,te.Y)(El.A,{isOpen:i,onClose:L,userName:V,messagePriceInStars:S||0,messagesCount:1,shouldAutoApprove:N,setAutoApprove:I,confirmHandler:w})]})}));var _l=i(19408);const Ul={content:"iGABsB4C",modalHeader:"Ofq4u4pq",section:"k44LZ99u",form:"VhNBPaMY",label:"anDcU5bi",input:"kYxuUcwe",description:"A_JjwhXv",timeInputIcon:"pHne2E6K",offerButton:"d_PCM2tC",currencySelector:"genSNudF",currencyIcon:"fT5aRs0H"},Ol=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=e.stars?.balance,n=i?(0,c.PVB)(e,i.chatId):void 0,a=i?(0,_l.GA)(e,i.chatId,O.l3):void 0,{appConfig:o}=e,r=o.starsSuggestedPostAmountMax,l=o.starsSuggestedPostAmountMin,d=o.starsSuggestedPostAgeMin,h=o.starsSuggestedPostFutureMin,u=o.starsSuggestedPostFutureMax,m=o.tonSuggestedPostAmountMax,p=o.tonSuggestedPostAmountMin,v=!!i&&(0,c.ODG)(e,i.chatId);return{peer:n,starBalance:s,tonBalance:e.ton?.balance?.amount,currentDraft:a,maxStarsAmount:r,minStarsAmount:l,tonMaxAmount:m,tonMinAmount:p,ageMinSeconds:d,futureMin:h,futureMax:u,isMonoforumAdmin:v}})(e=>{let{modal:t,starBalance:i,tonBalance:a,peer:r,currentDraft:l,maxStarsAmount:c,minStarsAmount:d,tonMaxAmount:h,tonMinAmount:u,ageMinSeconds:m,futureMin:p,futureMax:v,isMonoforumAdmin:g}=e;const{closeSuggestMessageModal:A,updateDraftSuggestedPostInfo:f,openStarsBalanceModal:b}=(0,n.ko)(),[C,y,S]=(0,F.A)(),k=l?.suggestedPostInfo,w=l?.replyInfo,N=Boolean(w),[I,P]=(0,s.J0)(k?.price?.amount||void 0),[Y,D]=(0,s.J0)(k?.price?.currency||o.OUy),[B,R]=(0,s.J0)(k?.scheduleDate?1e3*k.scheduleDate:void 0);(0,s.vJ)(()=>{const e=k?.price,t=e?.currency===o.ykW?(0,ua.wD)(e.amount):e?.amount;P(t),D(k?.price?.currency||o.OUy),R(k?.scheduleDate?1e3*k.scheduleDate:void 0)},[k]);const L=(0,_i.A)(),x=(0,T.A)(),E=Y===o.OUy,V=Math.floor(Date.now()/1e3),_=1e3*(V+p),U=1e3*(V+v),O=1e3*(V+2*p),K=(0,M.A)(e=>{const t=e.target.value,i=parseFloat(t),s=""===t||Number.isNaN(i)?void 0:Math.min(Math.max(i,0),z);P(s)}),J=(0,M.A)(e=>{R(e.getTime()),S()}),G=(0,M.A)(()=>{R(void 0),S()}),j=E?d:(0,ua.wD)(u),z=E?c:(0,ua.wD)(h),H=Boolean(I)&&I<j,$=(0,M.A)(()=>{const e=I?E?I:(0,ua.tT)(I):0;if(!H){if(!g)if(E){if(e>(i?.amount||0))return void b({topup:{balanceNeeded:e}})}else if(e>(a||0))return void b({currency:o.ykW});f({price:{currency:Y,amount:e,nanos:0},scheduleDate:B?Math.max(B/1e3,(0,li.Fm)()+p+60):void 0}),A()}});return(0,te.Y)(X.A,{headerClassName:Ul.modalHeader,isOpen:Boolean(t),onClose:A,isSlim:!0,isLowStackPriority:!0,hasCloseButton:!0,contentClassName:Ul.content,title:L(N?"TitleSuggestedChanges":"TitleSuggestMessage"),children:(0,te.FD)("div",{className:Ul.form,children:[(0,te.FD)("div",{className:Ul.section,children:[(0,te.FD)("div",{className:Ul.currencySelector,children:[(0,te.FD)(Q.A,{className:Ul.currencyButton,color:E?"primary":"translucent",pill:!0,fluid:!0,size:"tiny",noFastClick:!0,onClick:()=>D(o.OUy),children:[(0,te.Y)(W.A,{name:"star",className:Ul.currencyIcon}),L("CurrencyStars")]}),(0,te.FD)(Q.A,{className:Ul.currencyButton,fluid:!0,color:E?"translucent":"primary",pill:!0,size:"tiny",noFastClick:!0,onClick:()=>D(o.ykW),children:[(0,te.Y)(W.A,{name:"toncoin",className:Ul.currencyIcon}),L("CurrencyTon")]})]}),(0,te.Y)(Z.A,{label:L("InputPlaceholderPrice"),className:(0,me.A)(Ul.input),value:I?.toString(),onChange:K,inputMode:"numeric",tabIndex:0,teactExperimentControlled:E}),(0,te.Y)("div",{className:Ul.description,children:void 0!==I&&I>0&&I<j?L("DescriptionSuggestedPostMinimumOffer",{amount:E?(0,xi.Kk)(L,j):(0,xi.QH)(L,j)},{withNodes:!0,withMarkdown:!0}):L(E?"SuggestMessagePriceDescriptionStars":"SuggestMessagePriceDescriptionTon")})]}),(0,te.FD)("div",{className:Ul.section,children:[(0,te.FD)("div",{className:(0,me.A)(Ul.input,"input-group","touched"),children:[(0,te.Y)("input",{type:"text",className:(0,me.A)("form-control",C&&"focus"),value:B?(0,He.e0)(B/1e3,L,x):L("SuggestMessageAnytime"),autoComplete:"off",onClick:y,onFocus:y,readOnly:!0}),(0,te.Y)("label",{children:L("InputTitleSuggestMessageTime")}),(0,te.Y)(W.A,{name:"down",className:Ul.timeInputIcon})]}),(0,te.Y)("div",{className:Ul.description,children:L("SuggestMessageTimeDescription",{hint:L("SuggestMessageDateTimeHint"),duration:(0,He.A$)(L,m,!0)})})]}),(0,te.Y)(dn,{isOpen:C,isFutureMode:!0,withTimePicker:!0,minAt:_,maxAt:U,onClose:S,onSubmit:J,selectedAt:B||O,submitButtonLabel:L("Save"),secondButtonLabel:L("SuggestMessageAnytime"),onSecondButtonClick:G,description:L("SuggestMessageDateTimeHint")}),(0,te.Y)(Q.A,{className:Ul.offerButton,onClick:$,disabled:H,children:N?L("ButtonUpdateTerms"):I?L("ButtonOfferAmount",{amount:E?(0,xi.U2)(L,I,{asFont:!0}):(0,xi.Ms)(L,I)},{withNodes:!0,withMarkdown:!0}):L("ButtonOfferFree")})]})})})),Kl="xqyFGV8R",Jl=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=i&&(0,c.O5q)(e,i.chatId,i.messageId),n=s?(0,c.Y7C)(e,s):void 0,a=i&&(0,c.ODG)(e,i.chatId),{appConfig:o}=e,r=o.starsSuggestedPostCommissionPermille,l=o.tonSuggestedPostCommissionPermille,d=o.starsSuggestedPostAgeMin,h=o.starsSuggestedPostFutureMin,u=o.starsSuggestedPostFutureMax,m=s?.suggestedPostInfo?.scheduleDate;return{minAge:d,futureMin:h,futureMax:u,message:s,sender:n,isAdmin:a,commissionPermille:r,tonCommissionPermille:l,scheduleDate:m}})(e=>{let{modal:t,message:i,sender:a,isAdmin:r,commissionPermille:l,tonCommissionPermille:c,minAge:d,futureMin:h,futureMax:u,scheduleDate:m}=e;const{closeSuggestedPostApprovalModal:p,approveSuggestedPost:v}=(0,n.ko)(),g=(0,_i.A)(),A=(0,T.A)(),[f,b,C]=(0,F.A)(),y=Math.floor(Date.now()/1e3),S=1e3*(y+h),k=1e3*(y+u),w=y+2*h,[N,I]=(0,s.J0)(w),P=(0,M.A)(()=>{p()}),Y=(0,M.A)(e=>{t&&(v({chatId:t.chatId,messageId:t.messageId,scheduleDate:e}),p())}),D=(0,M.A)(e=>{const t=Math.floor(e.getTime()/1e3);I(t)}),B=(0,M.A)(e=>{const t=Math.floor(e.getTime()/1e3);C(),Y(t)}),R=(0,M.A)(()=>{C(),Y()}),L=(0,M.A)(()=>{m?Y(m):b()});if(!t||!i)return;const x=a?(0,Ft.em)(A,a):"";return(0,te.FD)(te.FK,{children:[(0,te.Y)(vi.A,{isOpen:Boolean(t)&&!f,onClose:P,title:g("SuggestedPostConfirmTitle"),confirmHandler:L,confirmLabel:g(m?"ButtonPublish":"Next"),children:(()=>{const e=i?.suggestedPostInfo?.price,t=e?.amount,s=e?.currency||o.OUy,n=g("SuggestedPostConfirmMessage",{peer:x},{withNodes:!0,withMarkdown:!0}),a=(0,Dt.A)(n);if(!t)return a;const h=(s===o.ykW?c:l)/10,u=t/100*h,p=s===o.ykW?(0,xi.QH)(g,(0,ua.wD)(u)):(0,xi.Kk)(g,u),v=d,f=(0,He.A$)(g,v,!0);if(m){const e=(0,He.e0)(m,g,A),t=r?"SuggestedPostConfirmDetailsWithTimeAdmin":"SuggestedPostConfirmDetailsWithTimeUser";return(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{children:a}),(0,te.Y)("div",{className:Kl,children:(0,Dt.A)(g(t,{amount:p,commission:h,duration:f,time:e},{withNodes:!0,withMarkdown:!0}))})]})}const b=r?"SuggestedPostConfirmDetailsAdmin":"SuggestedPostConfirmDetailsUser";return(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{children:a}),(0,te.Y)("div",{className:Kl,children:(0,Dt.A)(g(b,{amount:p,commission:h,duration:f},{withNodes:!0,withMarkdown:!0}))})]})})()}),(0,te.Y)(dn,{isOpen:f,isFutureMode:!0,withTimePicker:!0,minAt:S,maxAt:k,onClose:C,onSubmit:B,onDateChange:D,selectedAt:1e3*N,submitButtonLabel:g("ButtonPublishAtTime",{time:(0,He.e0)(N,g,A)}),secondButtonLabel:g("PublishNow"),onSecondButtonClick:R,description:g("SuggestMessageDateTimeHint")})]})})),Gl=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],jl=[...Gl,"sendPlain"];function zl(e){const[t,i]=(0,s.J0)({}),[n,a]=(0,s.J0)(!1),[o,r]=(0,s.J0)(!1);(0,s.vJ)(()=>{i(e||{}),a(!1),setTimeout(()=>{r(!1)},250)},[e]);const l=(0,s.hb)(s=>{const{name:n}=s.target,o=n;function r(e){return!e||void 0}const l=t;let c={...l,[o]:r(l[o]),..."sendStickers"===o&&{sendGifs:r(l[o])}};const d=()=>{const e=Gl.map(e=>c[e]);e.some(e=>!e)?c={...c,sendMedia:void 0}:e.every(Boolean)&&(c={...c,sendMedia:!0})};"sendMedia"!==o?d():c={...c,...Gl.reduce((e,t)=>Object.assign(e,{[t]:c.sendMedia}),{})},"embedLinks"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==o&&d();const h=jl.every(e=>c[e]);c={...c,sendMessages:!!h||void 0},i(c),a(!e||Object.keys(c).some(t=>{const i=t;return Boolean(e[i])!==Boolean(c[i])}))},[e,t]),c=(0,s.hb)(()=>{i(e||{}),a(!1)},[e]);return{permissions:t,isLoading:o,havePermissionChanged:n,handlePermissionChange:l,setIsLoading:r,resetPermissions:c}}const Hl=["sendPhotos","sendVideos","sendStickers","sendAudios","sendDocs","sendVoices","sendRoundvideos","embedLinks","sendPolls"],$l=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=i?(0,c.hds)(e,i):void 0,n=s&&(0,c.AWZ)(e,s.id);return{chat:s,hasLinkedChat:Boolean(n?.linkedChatId)}})(e=>{let{chat:t,isMediaDropdownOpen:i,setIsMediaDropdownOpen:a,hasLinkedChat:o,permissions:r,handlePermissionChange:c,className:d,shiftedClassName:h,dropdownClassName:u,withCheckbox:m,getControlIsDisabled:p,permissionGroup:v}=e;const{showNotification:g}=(0,n.ko)(),{isForum:A}=t||{},f=(0,_i.A)(),b=(0,s.Kr)(()=>t&&(0,l.gA)(t),[t]),C=o||b,S=(0,s.Kr)(()=>Hl.reduce((e,t)=>(r[t]||(e+=1),e),0),[r]),k=(0,M.A)(e=>{(0,y.A)(e),a(!i)}),w=(0,M.A)(()=>{g({message:f("ChatPermissionNotAvailable")})});return(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendPlain",checked:!r.sendPlain,label:f("UserRestrictionsSend"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendPlain")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendMedia",checked:!r.sendMedia,label:f("UserRestrictionsSendMedia"),labelText:`${S}/${Hl.length}`,blocking:!0,permissionGroup:v,rightIcon:i?"up":"down",onChange:c,onClickLabel:k,disabled:p&&p("sendMedia")})}),(0,te.Y)("div",{className:u,children:(0,te.FD)("div",{className:d,children:[(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendPhotos",checked:!r.sendPhotos,label:f("SendMediaPermissionPhotos"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendPhotos")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendVideos",checked:!r.sendVideos,label:f("SendMediaPermissionVideos"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendVideos")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendStickers",checked:!r.sendStickers&&!r.sendGifs,label:f("SendMediaPermissionStickersGifs"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendStickers")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendAudios",checked:!r.sendAudios,label:f("SendMediaPermissionAudios"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendAudios")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendDocs",checked:!r.sendDocs,label:f("SendMediaPermissionFiles"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendDocs")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendVoices",checked:!r.sendVoices,label:f("SendMediaPermissionVoices"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendVoices")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendRoundvideos",checked:!r.sendRoundvideos,label:f("SendMediaPermissionRoundVideos"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendRoundvideos")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"embedLinks",checked:!r.embedLinks,label:f("SendMediaPermissionWebPages"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("embedLinks")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"sendPolls",checked:!r.sendPolls,label:f("SendMediaPermissionPolls"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("sendPolls")})})]})}),(0,te.FD)("div",{className:h,children:[(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"inviteUsers",checked:!r.inviteUsers,label:f("UserRestrictionsInviteUsers"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("inviteUsers")})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),onClick:C?w:void 0,children:(0,te.Y)(sn.A,{name:"pinMessages",checked:!r.pinMessages,label:f("UserRestrictionsPinMessages"),disabled:p?p("pinMessages"):C,blocking:!0,permissionGroup:v,onChange:c})}),(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),onClick:C?w:void 0,children:(0,te.Y)(sn.A,{name:"changeInfo",checked:!r.changeInfo,label:f("UserRestrictionsChangeInfo"),blocking:!0,permissionGroup:v,disabled:p?p("changeInfo"):C,onChange:c})}),A&&(0,te.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,te.Y)(sn.A,{name:"manageTopics",checked:!r.manageTopics,label:f("UserRestrictionsCreateTopics"),blocking:!0,permissionGroup:v,onChange:c,disabled:p&&p("manageTopics")})})]})]})}));var ql=i(77561);const Wl="yGhFKTl5",Ql="goI3MITH",Zl=(0,s.ph)((0,n.EK)(e=>{const{deleteMessageModal:t}=(0,c.nTw)(e),i=t?.messageIds,s=t?.chatId,{canDeleteForAll:n}=(0,c.jyG)(e,i),a=s?(0,c.hds)(e,s):void 0,o=a&&(0,c.AWZ)(e,a.id),r=o?.linkedChatId,d=Boolean(a)&&(0,l.WX)(a),h=Boolean(a)&&(0,l.Vs)(a),u=t?.isSchedule,m=t?.onConfirm,p=a&&(0,v.L8)(a.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(a))):void 0,g=Boolean(a&&!(0,l.DX)(a.id)&&(0,c.yps)(e,a.id)),A=o?.adminMembersById,f=a&&(0,l.ub)(a,"banUsers"),b=a?.isCreator,C=a?(0,c.ALW)(e,a):void 0,y=a&&(0,l.yn)(a)&&!n||C,S=a&&((0,l.Vs)(a)||d);return{chat:a,isChannel:d,isSuperGroup:h,messageIds:i,currentUserId:e.currentUserId,canDeleteForAll:!u&&n,contactName:p,willDeleteForCurrentUserOnly:y,willDeleteForAll:S,adminMembersById:A,chatBot:g,canBanUsers:f,linkedChatId:r,isSchedule:u,isCreator:b,onConfirm:m}})(e=>{let{isOpen:t,chat:i,isChannel:a,isSuperGroup:o,isSchedule:r,currentUserId:l,messageIds:d,isCreator:h,canDeleteForAll:u,contactName:m,willDeleteForCurrentUserOnly:p,willDeleteForAll:v,chatBot:g,adminMembersById:A,canBanUsers:f,linkedChatId:b,onConfirm:C}=e;const{closeDeleteMessageModal:y,deleteMessages:S,reportChannelSpam:k,deleteChatMember:w,deleteScheduledMessages:N,exitMessageSelectMode:I,updateChatMemberBannedRights:P,deleteParticipantHistory:Y}=(0,n.ko)(),F=(0,_.A)(t),D=(0,T.A)(),B=(0,_i.A)(),{permissions:R,havePermissionChanged:L,handlePermissionChange:x,resetPermissions:E}=zl(i?.defaultBannedRights),[V,U]=(0,s.J0)([]),[O,K]=(0,s.J0)([]),[J,G]=(0,s.J0)([]),[j,z]=(0,s.J0)(!1),[H,$]=(0,s.J0)(!1),[q,Z]=(0,s.J0)(!0),ee=(0,s.Kr)(()=>{if(a||!d||!i)return Ci.p;const e=(0,n.mS)(),t=(0,c.SpN)(e,i.id,d);return t?(0,bi.Am)(t).filter(e=>e?.id!==i?.id&&e?.id!==b&&e?.id!==i?.linkedMonoforumId):Ci.p},[i,a,b,d]),ie=(0,M.A)(()=>ee.map(e=>({value:e.id,label:(0,Ft.F9)(B,e)||"",leftElement:(0,te.Y)(Mt.A,{size:"small",peer:e})}))),se=(0,s.Kr)(()=>ee.filter(e=>e.id!==b&&e.id!==i?.linkedMonoforumId&&e.id!==l),[ee,l,b,i?.linkedMonoforumId]),ne=(0,s.Kr)(()=>ee.filter(e=>e.id!==l&&e.id!==b&&e.id!==i?.linkedMonoforumId),[ee,l,b,i?.linkedMonoforumId]),ae=(0,s.Kr)(()=>{const e=ee.some(e=>e.id===l);return!f||e||i?.isMonoforum?Ci.p:ee.filter(e=>{const t=A?.[e.id];return h||!t})},[ee,h,l,f,A,i?.isMonoforum]),oe=(0,s.Kr)(()=>Boolean(se.length||ne.length||ae.length),[se,ne,ae])&&!u&&!r&&o,re=(0,s.Kr)(()=>!ee||r?{}:(0,bi.pA)(ee,e=>[e.id,(0,Ft.F9)(B,e)]),[r,B,ee]),le=(0,s.Kr)(()=>[{value:d&&ee.length>=2?"spam":ee?.[0]?.id,label:D("ReportSpamTitle"),nestedOptions:d&&ee.length>=2?[...ie().filter(e=>e.value!==b&&e.value!==i?.linkedMonoforumId&&e.value!==l)]:void 0}],[d,ee,D,b,i?.linkedMonoforumId,l]),ce=(0,s.Kr)(()=>[{value:d&&ee.length>=2?"delete_all":ee?.[0]?.id,label:d&&ee.length>=2?D("DeleteAllFromUsers"):D("DeleteAllFrom",Object.values(re)[0]),nestedOptions:d&&ee.length>=2?[...ie().filter(e=>e.value!==b&&e.value!==i?.linkedMonoforumId&&e.value!==l)]:void 0}],[d,ee,D,re,b,i?.linkedMonoforumId,l]),de=(0,s.Kr)(()=>[{value:d&&ee.length>=2?"ban":ee?.[0]?.id,label:d&&ee.length>=2?D(H?"DeleteRestrictUsers":"DeleteBanUsers"):H?D("KickFromSupergroup"):D("DeleteBan",Object.values(re)[0]),nestedOptions:d&&ee.length>=2?[...ie()]:void 0}],[H,D,d,ee,re]),he=(0,M.A)(()=>{$(e=>!e)}),ue=(0,M.A)((e,t)=>{if(!i)return Ci.p;const s=(0,n.mS)();return t.filter(t=>{const n=(0,c.LM$)(s,i.id,t);return n&&e.includes(n.id)})}),pe=(0,M.A)(e=>{Object.entries(e).forEach(e=>{let[t,s]=e;s.length&&k({participantId:t,chatId:i.id,messageIds:s})})}),ve=(0,M.A)(e=>{S({messageIds:e,shouldDeleteForAll:!0})}),ge=(0,M.A)(e=>{i&&e.forEach(e=>{Y({peerId:e,chatId:i.id})})}),Ae=(0,M.A)(e=>{e.forEach(e=>{w({chatId:i.id,userId:e})})}),fe=(0,M.A)(e=>{e.forEach(e=>{P({chatId:i.id,userId:e,bannedRights:R})})}),be=(0,M.A)(()=>{if(i&&d){if(C?.(),r)N({messageIds:d});else if(oe){if(J?.length){const e=(0,n.mS)(),t=J.filter(e=>!Number.isNaN(Number(e))),s=d.reduce((s,n)=>{const a=(0,c.LM$)(e,i.id,n);return a&&t.includes(a.id)&&(s[a.id]||(s[a.id]=[]),s[a.id].push(Number(n))),s},{});pe(s)}if(V?.length){const e=V.filter(e=>!Number.isNaN(Number(e)));ge(e)}if(O?.length&&!L){const e=O.filter(e=>!Number.isNaN(Number(e)));Ae(e);const t=ue(e,d);ve(t)}if(O?.length&&L){const e=O.filter(e=>!Number.isNaN(Number(e)));fe(e)}J?.length&&V?.length&&O?.length||S({messageIds:d,shouldDeleteForAll:q})}else S({messageIds:d,shouldDeleteForAll:q});y(),I()}}),Ce=(0,M.A)(()=>{y()});return(0,s.vJ)(()=>{!t&&F&&(G([]),U([]),K([]),Z(!0),z(!1),$(!1),E())},[t,F,E]),(0,te.Y)(X.A,{isOpen:t,onClose:Ce,onEnter:be,className:"SeaF_shb",children:(0,te.FD)("div",{className:"_YNfwDqt",children:[(0,te.FD)("div",{className:oe&&"axa67kqo",dir:D.isRtl?"rtl":void 0,children:[oe&&(0,te.Y)(os.A,{size:"small",peers:ee}),(0,te.Y)("h3",{className:(0,me.A)(oe?"U4IFhV0a":"qd6OFHiG"),children:D("Chat.DeleteMessagesConfirmation",d?.length)})]}),oe&&(0,te.FD)(te.FK,{children:[(0,te.Y)("p",{className:Wl,children:D("DeleteAdditionalActions")}),(0,te.FD)("div",{className:"b6847Kh3",children:[(0,te.Y)(ql.A,{options:le,onChange:G,selected:J,nestedCheckbox:d&&ee.length>=2}),se?.length>0&&(0,te.Y)(ql.A,{options:ce,onChange:U,selected:V,nestedCheckbox:d&&ee.length>=2}),ae?.length>0&&(0,te.Y)(ql.A,{options:de,onChange:K,selected:O,nestedCheckbox:d&&ee.length>=2})]}),(0,te.FD)("div",{className:(0,me.A)("iv0u9Zw6",H&&"qCQftA04"),children:[(0,te.Y)("h3",{className:(0,me.A)(Wl,"t3KOsBfm"),children:D("UserRestrictionsCanDoUsers",ee.length)}),(0,te.Y)($l,{withCheckbox:!0,chatId:i?.id,isMediaDropdownOpen:j,setIsMediaDropdownOpen:z,handlePermissionChange:x,permissions:R,className:(0,me.A)("czTjjKim",j&&"Ifpyv7Jp")})]}),O?.length&&f?(0,te.FD)(ci.A,{narrow:!0,buttonClassName:Ql,onClick:he,children:[D(H?"DeleteToggleBanUsers":"DeleteToggleRestrictUsers"),(0,te.Y)(W.A,{name:H?"up":"down",className:(0,me.A)(Ql,"ml-2")})]}):$(!1)]}),(u||g||!oe)&&(0,te.FD)(te.FK,{children:[(0,te.Y)("p",{children:d&&d.length>1?B("AreYouSureDeleteFewMessages"):B("AreYouSureDeleteSingleMessage")}),p&&(0,te.Y)("p",{children:D("lng_delete_for_me_chat_hint",1,"i")}),v&&(0,te.Y)("p",{children:D("lng_delete_for_everyone_hint",1,"i")})]}),u&&(0,te.Y)(sn.A,{className:"dialog-checkbox",label:m?(0,Dt.A)(D("DeleteMessagesOptionAlso",m)):D("Conversation.DeleteMessagesForEveryone"),checked:q,onCheck:Z}),(0,te.FD)("div",{className:(0,me.A)("dialog-buttons",j?"JTT_DIRv":"L4YzeG91"),children:[(0,te.Y)(Q.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:be,children:oe?D("DeleteProceedBtn"):B("Delete")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:Ce,children:D("Cancel")})]})]})})})),Xl=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,v.L8)(i),n=(0,c.nZ4)(e,i),a=(0,c.hds)(e,i),o=Boolean(a)&&(0,l.WX)(a),r=Boolean(a)&&(0,l.yn)(a),d=Boolean(a)&&(0,l.Vs)(a);return{isPrivateChat:s,isChatWithSelf:n,isChannel:o,isGroup:r,isSuperGroup:d,canPinForAll:s&&!n||d||r,contactName:a&&(0,v.L8)(a.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(a))):void 0}})(e=>{let{isOpen:t,chatId:i,messageId:a,isChannel:o,isGroup:r,isSuperGroup:l,canPinForAll:c,contactName:d,onClose:h}=e;const{pinMessage:u}=(0,n.ko)(),[m,p]=(0,s.J0)(!0),v=(0,M.A)(()=>{u({chatId:i,messageId:a,isUnpin:!1,isOneSide:!m,isSilent:!m}),h()}),g=(0,T.A)();return(0,te.FD)(X.A,{isOpen:t,onClose:h,className:"pin",title:g("PinMessageAlertTitle"),children:[(0,te.Y)("p",{children:g(o?"PinMessageAlertChannel":r||l?"PinMessageAlert":"PinMessageAlertChat")}),c&&(0,te.Y)(sn.A,{className:"dialog-checkbox",label:d?(0,Dt.A)(g("Conversation.PinMessagesFor",d)):g("Conversation.PinMessageAlert.PinAndNotifyMembers"),checked:m,onCheck:p}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:v,children:g("DialogPin")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:h,children:g("Cancel")})]})]})})),ec=(0,s.ph)(e=>{let{isOpen:t,pinnedMessagesCount:i=0,onClose:s,onUnpin:n}=e;const a=(0,T.A)();return(0,te.FD)(X.A,{isOpen:t,onClose:s,className:"unpin-all",title:a("Chat.PanelUnpinAllMessages"),children:[(0,te.Y)("p",{children:a("Chat.UnpinAllMessagesConfirmation",i,"i")}),(0,te.FD)("div",{className:"dialog-buttons mt-2",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:n,children:a("DialogUnpin")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:s,children:a("Cancel")})]})]})});var tc=i(2178);const ic=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{shouldWarnAboutFiles:i}=(0,vn.l)(e),s=(0,c.meB)(e),{type:n,chatId:a}=(0,c.Xf0)(e)||{},o="scheduled"===n,{canDelete:r}=(0,c.jyG)(e),l=Boolean(!o&&(0,c.mDG)(e)),d=(0,c.ori)(e),{messageIds:h}=t.selectedMessages||{},u=!!a&&(0,c.o45)(e,a,h),m=!(o||!a)&&(0,c.Y8y)(e,a,h),p=!(!h||!a)&&(0,c.h5w)(e,a,h),v=t.isShareMessageModalShown,g=Boolean(v||t.requestedDraft||t.requestedAttachBotInChat||t.requestedAttachBotInstall||t.reportModal||t.deleteMessageModal);return{chat:s,isSchedule:o,selectedMessagesCount:(0,c.ZZ2)(e),canDeleteMessages:r,canReportMessages:l,canDownloadMessages:d,canForwardMessages:m,selectedMessageIds:h,hasProtectedMessage:u,isAnyModalOpen:g,shouldWarnAboutFiles:i,hasIpRevealingMedia:p}})(e=>{let{chat:t,canPost:i,isActive:a,messageListType:o,isSchedule:r,selectedMessagesCount:l,canDeleteMessages:c,canReportMessages:d,canDownloadMessages:h,canForwardMessages:u,hasProtectedMessage:m,isAnyModalOpen:p,selectedMessageIds:v,shouldWarnAboutFiles:g,hasIpRevealingMedia:A}=e;const{exitMessageSelectMode:f,openForwardMenuForSelectedMessages:b,downloadSelectedMessages:C,copySelectedMessages:y,showNotification:S,reportMessages:k,openDeleteMessageModal:w,setSharedSettingOption:N}=(0,n.ko)(),I=(0,T.A)();(e=>{function t(e){e.preventDefault(),(0,n.ko)().copySelectedMessages()}(0,tc.v)((0,s.Kr)(()=>e?{"Mod+C":t}:void 0,[e]))})(a);const[P,Y,D]=(0,F.A)(),[B,R]=(0,s.J0)(!1),L=(0,M.A)(()=>{f()}),x=(0,M.A)(()=>{v&&t&&w({chatId:t.id,messageIds:v,isSchedule:r})});(0,s.vJ)(()=>a&&!p?(0,Ri.A)({onBackspace:c?x:void 0,onDelete:c?x:void 0,onEsc:L}):void 0,[a,x,L,p,c]);const E=(0,M.A)(()=>{y(),S({message:I("Share.Link.Copied")}),f()}),V=(0,M.A)(()=>{C(),f()}),U=(0,M.A)(()=>{g&&A?Y():V()}),O=(0,M.A)(()=>{N({shouldWarnAboutFiles:!B}),D(),V()}),K=(0,_.A)(l||void 0,!0),J=I("VoiceOver.Chat.MessagesSelected",a?l:K,"i"),G=(0,M.A)(()=>{v&&t&&(k({chatId:t.id,messageIds:v}),f())}),j=(0,me.A)("MessageSelectToolbar",i&&"with-composer",a&&"shown"),z=(e,t,i,s)=>(0,te.Y)("div",{role:"button",tabIndex:0,className:(0,me.A)("div-button","item",s&&"destructive"),onClick:i,title:t,"aria-label":t,children:(0,te.Y)(W.A,{name:e})});return(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:j,children:(0,te.FD)("div",{className:"MessageSelectToolbar-inner",children:[(0,te.Y)(Q.A,{color:"translucent",round:!0,onClick:L,ariaLabel:"Exit select mode",children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("span",{className:"MessageSelectToolbar-count",title:J,children:J}),Boolean(l)&&(0,te.FD)("div",{className:"MessageSelectToolbar-actions",children:["scheduled"!==o&&u&&z("forward",I("Chat.ForwardActionHeader"),b),d&&z("flag",I("Conversation.ReportMessages"),G),h&&!m&&z("download",I("lng_media_download"),U),!m&&z("copy",I("lng_context_copy_selected_items"),E),c&&z("delete",I("EditAdminGroupDeleteMessages"),x,!0)]})]})}),(0,te.FD)(vi.A,{isOpen:P,onClose:D,confirmHandler:O,children:[I("lng_launch_svg_warning"),(0,te.Y)(sn.A,{className:"dialog-checkbox",checked:B,label:I("lng_launch_exe_dont_ask"),onCheck:R})]})]})})),sc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).seenByModal||{};return t&&i?{seenByDates:(0,c.O5q)(e,t,i)?.seenByDates}:{seenByDates:void 0}})(function(e){let{isOpen:t,seenByDates:i}=e;const{openChat:a,closeSeenByModal:o}=(0,n.ko)(),r=(0,T.A)(),l=(0,Bi.A)(i,!0),c=(0,s.Kr)(()=>{if(!l)return;const e=Object.keys(l);return e.sort((e,t)=>l[t]-l[e]),e},[l]),d=(0,M.A)(e=>{o(),setTimeout(()=>{a({id:e})},100)}),h=(0,M.A)(()=>{o()});return(0,te.FD)(X.A,{isOpen:t,onClose:o,className:(0,me.A)("slqA9gR2","narrow"),title:`Seen by ${c?.length} users`,children:[(0,te.Y)("div",{dir:r.isRtl?"rtl":void 0,children:c&&c.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>d(e),children:(0,te.Y)(ws.A,{userId:e,noStatusOrTyping:!0,status:(0,He.U)(r,1e3*l[e]),statusIcon:"message-read"})},e))}),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:h,children:r("Close")})})]})}));var nc=i(32581);const ac="MQxuEIRA",oc="AEAN1Au4",rc="F7owtTHj",lc=X.U+o.xB5,cc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,isReadDate:i}=(0,c.nTw)(e).privacySettingsNoticeModal||{};return{user:t?(0,c.mBe)(e,t):void 0,isReadDate:i}})(e=>{let{isOpen:t,isReadDate:i,user:s}=e;const a=(0,T.A)(),{updateGlobalPrivacySettings:o,openPremiumModal:r,closePrivacySettingsNoticeModal:c,showNotification:d,setPrivacyVisibility:h,loadUser:u}=(0,n.ko)(),m=(0,l.u0)(s),p=(0,M.A)(()=>{o({shouldHideReadMarks:!1}),c(),setTimeout(()=>{d({message:a("PremiumReadSet")})},lc)}),v=(0,M.A)(()=>{h({privacyKey:"lastSeen",visibility:"everybody",onSuccess:()=>u({userId:s.id})}),c(),setTimeout(()=>{d({message:a("PremiumLastSeenSet")})},lc)}),g=(0,M.A)(()=>{c(),setTimeout(()=>{r({initialSection:"last_seen"})},lc)}),A=(0,M.A)(()=>{c()});return(0,te.Y)(X.A,{isSlim:!0,isOpen:t,onClose:A,children:(0,te.FD)("div",{className:"tauadiDm",dir:a.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{className:"i6iFv9YE",color:"translucent",round:!0,size:"smaller",onClick:A,ariaLabel:"Close",children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)(wr.A,{tgsUrl:i?kr.w.ReadTime:kr.w.LastSeen,size:84,className:"i4wZg_0J",nonInteractive:!0,noLoop:!0}),(0,te.Y)("h2",{className:ac,children:a(i?"PremiumReadHeader1":"PremiumLastSeenHeader1")}),(0,te.Y)("p",{className:oc,children:(0,Dt.A)(a(i?"PremiumReadText1":"PremiumLastSeenText1Locked",m),["simple_markdown"])}),(0,te.Y)(Q.A,{onClick:i?p:v,className:rc,children:a(i?"PremiumReadButton1":"PremiumLastSeenButton1")}),(0,te.Y)(nc.A,{className:"sXXb5yOS",children:a("PremiumOr")}),(0,te.Y)("h2",{className:ac,children:a("PremiumReadHeader2")}),(0,te.Y)("p",{className:oc,children:(0,Dt.A)(a(i?"PremiumReadText2":"PremiumLastSeenText2",m),["simple_markdown"])}),(0,te.Y)(Q.A,{withPremiumGradient:!0,onClick:g,className:rc,children:a("PremiumLastSeenButton2")})]})})})),dc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).reactorModal||{},s=t&&i?(0,c.O5q)(e,t,i):void 0;return{chatId:t,messageId:i,reactions:s?.reactions,reactors:s?.reactors,seenByDates:s?.seenByDates,availableReactions:e.reactions.availableReactions}})(e=>{let{isOpen:t,reactors:i,reactions:o,chatId:r,messageId:c,seenByDates:d,availableReactions:h}=e;const{loadReactors:u,closeReactorListModal:m,openChat:p}=(0,n.ko)(),v=(0,n.mS)().chats.byId,g=(0,n.mS)().users.byId,A=(0,T.A)(),f=(0,_i.A)(),[b,C,y]=(0,F.A)(!1),[S,k]=(0,s.J0)(void 0),w=i&&o&&i.count>=10&&o.results.length>1,N=(0,s.li)();(0,s.vJ)(()=>{t&&!b&&(N.current=void 0),b&&!t&&(y(),k(void 0))},[b,t,y]);const I=(0,M.A)(()=>{N.current&&p({id:N.current}),m()}),P=(0,M.A)(()=>{C()}),Y=(0,M.A)(e=>{N.current=e,P()}),D=(0,M.A)(()=>{u({chatId:r,messageId:c})}),B=(0,s.Kr)(()=>{const e=[];return i?.reactions?.forEach(t=>{let{reaction:i}=t;e.some(e=>(0,l.a0)(e,i))||e.push(i)}),e},[i]),R=(0,s.Kr)(()=>{if(S)return i?.reactions.filter(e=>{let{reaction:t}=e;return(0,l.a0)(t,S)}).map(e=>{let{peerId:t}=e;return t});const e=Object.keys(d||{});return(0,bi.Am)(i?.reactions.map(e=>{let{peerId:t}=e;return t}).concat(e||[])||[])},[S,i,d]),[L,x]=(0,Bs.A)(D,R,i&&void 0===i.nextOffset);return(0,s.vJ)(()=>{x?.({direction:a.TN.Backwards})},[x]),(0,te.FD)(X.A,{isOpen:t&&!b,onClose:P,className:"ReactorListModal narrow",title:A("Reactions"),onCloseAnimationEnd:I,children:[w&&(0,te.FD)("div",{className:"Reactions",dir:A.isRtl?"rtl":void 0,children:[(0,te.FD)(Q.A,{className:(0,me.A)(!S&&"chosen"),size:"tiny",ripple:!0,onClick:()=>k(void 0),children:[(0,te.Y)(W.A,{name:"heart"}),Boolean(i?.count)&&(0,$e.Vw)(f,i.count)]}),B.map(e=>{const t=o?.results.find(t=>(0,l.a0)(t.reaction,e))?.count;return(0,te.FD)(Q.A,{className:(0,me.A)((0,l.a0)(S,e)&&"chosen"),size:"tiny",ripple:!0,onClick:()=>k(e),children:[(0,te.Y)(Ns.A,{reaction:e,className:"reaction-filter-emoji",availableReactions:h}),Boolean(t)&&(0,$e.Vw)(f,t)]},(0,l.Jj)(e))})]}),(0,te.Y)("div",{dir:A.isRtl?"rtl":void 0,className:"reactor-list-wrapper",children:L?.length?(0,te.Y)(Cs.A,{className:"reactor-list custom-scroll",items:L,onLoadMore:x,children:L?.flatMap(e=>{const t=g[e]||v[e],s=i?.reactions.filter(t=>t.peerId===e),n=[],a=d?.[e];return s?.forEach(i=>{S&&!(0,l.a0)(i.reaction,S)||n.push((0,te.FD)(ci.A,{className:"chat-item-clickable reactors-list-item",onClick:()=>Y(e),children:[(0,te.Y)(Mt.A,{peer:t,size:"medium"}),(0,te.FD)("div",{className:"info",children:[(0,te.Y)(Es.A,{peer:t,withEmojiStatus:!0}),(0,te.FD)("span",{className:"status",dir:"auto",children:[(0,te.Y)(W.A,{name:"heart-outline",className:"status-icon"}),(0,He.U)(A,1e3*i.addedDate)]})]}),i.reaction&&(0,te.Y)(Ns.A,{className:"reactors-list-emoji",reaction:i.reaction,availableReactions:h})]},`${e}-${(0,l.Jj)(i.reaction)}`))}),S||s?.length||n.push((0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>Y(e),children:(0,te.Y)(ws.A,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:a?(0,He.U)(A,1e3*a):void 0,statusIcon:"message-read"})},`${e}-seen-by`)),n})}):(0,te.Y)(xs.A,{})}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:P,children:A("Close")})]})})),hc=(0,s.ph)((0,n.EK)((e,t)=>{let{activeEmojiInteraction:i}=t;const s=void 0!==i.animatedEffect&&(0,c.Nr8)(e,i.animatedEffect);return{effectAnimationId:s?s.id:void 0}})(e=>{let{effectAnimationId:t,activeEmojiInteraction:i}=e;const{stopActiveEmojiInteraction:a}=(0,n.ko)(),[o,r]=(0,F.A)(!1),[l,c]=(0,F.A)(!1),d=(0,s.li)(),h=(0,M.A)(()=>{r(),d.current&&clearTimeout(d.current),setTimeout(()=>{a({id:i.id})},250)}),m=(0,M.A)(e=>{e.target?.closest(".AnimatedEmoji")||h()});(0,s.vJ)(()=>(document.addEventListener("touchstart",m),document.addEventListener("touchmove",m),document.addEventListener("mousedown",m),document.addEventListener("wheel",m),()=>{document.removeEventListener("touchstart",m),document.removeEventListener("touchmove",m),document.removeEventListener("mousedown",m),document.removeEventListener("wheel",m)}),[m]),(0,s.Nf)(()=>{const e=(0,s.VK)();d.current=setTimeout(()=>{h(),e()},3e3)},[h]);const p=t&&`sticker${t}`,v=(0,z.A)(p,!t);if(!i.startSize)return;const g=(i.startSize||0)/309;return(0,te.Y)("div",{className:(0,me.A)("EmojiInteractionAnimation",o&&"hiding",l&&"playing",i.isReversed&&"reversed"),style:`--scale: ${g}; --start-x: ${i.x}px; --start-y: ${i.y}px;`,children:(0,te.Y)(Fa.A,{size:309,tgsUrl:v,play:!0,quality:u.Ni?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:c},`effect_${t}`)})})),uc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).chatLanguageModal||{},s=(0,c.wmb)(e);return{chatId:t,messageId:i,activeTranslationLanguage:t?i?(0,c.Rny)(e,t,i):(0,c.qZq)(e,t):void 0,currentLanguageCode:s}})(e=>{let{isOpen:t,chatId:i,messageId:a,activeTranslationLanguage:r,currentLanguageCode:l}=e;const{requestMessageTranslation:c,closeChatLanguageModal:d,setSettingOption:h,requestChatTranslation:u}=(0,n.ko)(),[m,p]=(0,s.J0)(""),v=(0,T.A)(),g=(0,M.A)(e=>{i&&(a?c({chatId:i,id:a,toLanguageCode:e}):(h({translationLanguage:e}),u({chatId:i,toLanguageCode:e})),d())}),A=(0,M.A)(e=>{p(e.target.value)}),f=(0,s.Kr)(()=>o.N89.map(e=>({langCode:e,translatedName:new Intl.DisplayNames([l],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})),[l]);(0,s.vJ)(()=>{t||p("")},[t]);const b=(0,s.Kr)(()=>m.trim()?f.filter(e=>{let{langCode:t,translatedName:i,originalName:s}=e;return i.toLowerCase().includes(m.toLowerCase())||s.toLowerCase().includes(m.toLowerCase())||t.toLowerCase().includes(m.toLowerCase())}):f,[f,m]);return(0,te.FD)(X.A,{className:"aMjNU9gm",isSlim:!0,isOpen:t,hasCloseButton:!0,title:v("Language"),onClose:d,children:[(0,te.Y)(Z.A,{value:m,onChange:A,placeholder:v("Search"),teactExperimentControlled:!0},"search"),(0,te.Y)("div",{className:(0,me.A)("r3YNWDQr","custom-scroll"),children:b.map(e=>{let{langCode:t,originalName:i,translatedName:s}=e;return(0,te.FD)(ci.A,{className:(0,me.A)("T3An6Hoz","no-icon"),secondaryIcon:r===t?"check":void 0,disabled:r===t,multiline:!0,narrow:!0,onClick:()=>g(t),children:[(0,te.Y)("span",{className:(0,me.A)("title","dQ9wwFu1"),children:(0,Dt.A)(i,["highlight"],{highlight:m})}),(0,te.Y)("span",{className:(0,me.A)("subtitle","m_J41YYl"),children:(0,Dt.A)(s,["highlight"],{highlight:m})})]},t)})})]})}));var mc=i(85982),pc=i(24899);const vc={content:"WEJIbFQj",closeButton:"_vwPuDEM",icon:"BUiGM8qZ",title:"Q3NhXpNI",description:"frZbGQ0G"},gc=(0,s.ph)((0,n.EK)(e=>{const{countryList:t}=e;return{phoneCodeList:t.phoneCodes}})(e=>{let{modal:t,phoneCodeList:i}=e;const{closeCollectibleInfoModal:a,openChat:o,openUrl:r,showNotification:l}=(0,n.ko)(),c=(0,T.A)(),d="username"===t?.type,h=(0,M.A)(()=>{a()}),u=(0,M.A)(()=>{o({id:t.peerId}),h()}),m=(0,M.A)(()=>{r({url:t.url}),h()}),p=(0,M.A)(()=>{const e=d?(0,pc.A)(t.collectible):(0,un.Ox)(i,t.collectible);(0,mc.eM)(e),l({message:c(d?"UsernameCopied":"PhoneCopied")}),h()}),v=(0,s.Kr)(()=>{if(!t)return;const e=d?"FragmentUsernameTitle":"FragmentPhoneTitle",s=d?(0,pc.A)(t.collectible):(0,un.Ox)(i,t.collectible);return c(e,s)},[t,d,i,c]),g=(0,s.Kr)(()=>{if(!t)return;const e=d?"FragmentUsernameMessage":"FragmentPhoneMessage",i=(0,He.U)(c,1e3*t.purchaseDate),s=(0,ua.Ad)(t.amount,t.currency,c.code),n=(0,ua.Ad)(t.cryptoAmount,t.cryptoCurrency,c.code);return c(e,[i,`${n} (${s})`])},[t,d,c]);return(0,te.FD)(X.A,{isOpen:Boolean(t),isSlim:!0,contentClassName:vc.content,onClose:a,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",className:vc.closeButton,ariaLabel:c("Close"),onClick:h,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:vc.icon,children:(0,te.Y)(wr.A,{tgsUrl:d?kr.w.Mention:kr.w.Fragment,size:60})}),(0,te.Y)("h3",{className:vc.title,children:v&&(0,Dt.A)(v,["simple_markdown"])}),(0,te.Y)(Kr.A,{className:vc.chip,peerId:t?.peerId,forceShowSelf:!0,clickArg:t?.peerId,onClick:u}),(0,te.Y)("p",{className:vc.description,children:g&&(0,Dt.A)(g,["simple_markdown"])}),(0,te.FD)("div",{className:"dialog-buttons dialog-buttons-centered",children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",onClick:m,children:c("FragmentUsernameOpen")}),(0,te.Y)(Q.A,{isText:!0,className:"confirm-dialog-button",onClick:p,children:c(d?"FragmentUsernameCopy":"FragmentPhoneCopy")})]})]})}));var Ac=i(31460),fc=i(24680),bc=i(57309);function Cc(e){return(t,i)=>{const s=(0,c.nTw)(t),{byId:n}=t.chats,{byId:a}=t.users,{fetchingStatus:o,resultsByType:r,chatId:l}=s.globalSearch,{shouldWarnAboutFiles:d}=(0,vn.l)(t),h="audio"!==e?e:i?.isVoice?"voice":"audio",{byChatId:u}=t.messages,m=r?.[h]?.foundIds,p=s.activeDownloads;return{theme:(0,c.SJA)(t),isLoading:void 0===m||!!o&&Boolean(o.chats||o.messages),chatsById:n,usersById:a,globalMessagesByChatId:u,foundIds:m,searchChatId:l,activeDownloads:p,isChatProtected:l?(0,c.hds)(t,l)?.isProtected:void 0,shouldWarnAboutFiles:d}}}var yc=i(55429),Sc=i(65240),kc=i(42827);const wc=(0,ge.nF)(e=>e(),500,!0),Nc=(0,s.ph)((0,n.EK)(Cc("audio"))(e=>{let{theme:t,isVoice:i,searchQuery:r,isLoading:c,chatsById:d,usersById:h,globalMessagesByChatId:u,foundIds:m,activeDownloads:p}=e;const{searchMessagesGlobal:v,focusMessage:g,openAudioPlayer:A}=(0,n.ko)(),f=(0,T.A)(),b=i?"voice":"audio",C=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&wc(()=>{v({type:b})})},[b,v,r]),y=(0,s.Kr)(()=>m&&u?m.map(e=>{const[t,i]=(0,bc.a)(e);return u[t]?.byId[i]}).filter(Boolean):Ci.p,[u,m]),S=(0,s.hb)(e=>{g({chatId:e.chatId,messageId:e.id})},[g]),k=(0,s.hb)((e,t)=>{A({chatId:t,messageId:e})},[A]),w=(0,or.A)([r],o.jhd)&&!c;return(0,te.Y)(ne.Ay,{slideClassName:"LeftSearch--content",name:"fade",activeKey:w?1:0,shouldCleanup:!0,children:(0,te.FD)(Cs.A,{className:"search-content documents-list custom-scroll",items:w?y:void 0,onLoadMore:C,noFastList:!0,children:[!w&&(0,te.Y)(xs.A,{}),w&&(!m||0===m.length)&&(0,te.Y)(kc.A,{withSticker:!0,text:f("ChatList.Search.NoResults"),description:f("ChatList.Search.NoResultsDescription")}),w&&m&&m.length>0&&y.map((e,i)=>{const s=(0,n.mS)(),o=0===i||(0,He.$$)(e.date)!==(0,He.$$)(y[i-1].date),r=(0,Me.iS)(s,e);return(0,te.FD)(te.FK,{children:[o&&(0,te.Y)("p",{className:"section-heading",dir:f.isRtl?"rtl":void 0,children:(0,He.i6)(f,new Date(1e3*e.date))},e.date),(0,te.Y)("div",{className:"ListItem small-icon",children:(0,te.Y)(Sc.Ay,{theme:t,message:e,origin:a.d9.Search,senderTitle:(0,yc.N)(f,e,d,h),date:e.date,className:"scroll-item",onPlay:k,onDateClick:S,canDownload:!d[e.chatId]?.isProtected&&!e.isProtected,isDownloading:(0,l.$r)(p,r)},e.id)},e.id)]})})]})})}));var Ic=i(27109),Pc=i(47067);const Yc=e=>{const t=(0,s.li)(),i=(0,s.hb)(i=>{"Enter"===i.key&&t.current===document.activeElement&&e()},[e]);return(0,s.vJ)(()=>(window.addEventListener("keydown",i,!1),()=>window.removeEventListener("keydown",i,!1)),[i]),t};var Fc=i(97967),Dc=i(97046);const Mc=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i);return{chat:s,user:(0,c.mBe)(e,i),isPinned:(0,c.D3D)(e,i),isMuted:s&&(0,Ic.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),canChangeFolder:Boolean(e.chatFolders.orderedIds?.length)}})(e=>{let{chatId:t,withUsername:i,chat:r,user:l,isPinned:c,isMuted:d,canChangeFolder:h,withOpenAppButton:u,onClick:m}=e;const{requestMainWebView:p,updateChatMutedState:g}=(0,n.ko)(),A=(0,T.A)(),[f,b,C]=(0,F.A)(),[y,S,k]=(0,F.A)(),[w,N,I]=(0,F.A)(),[P,Y,D]=(0,F.A)(),B=(0,s.hb)(()=>{N(),S()},[N,S]),R=(0,s.hb)(()=>{Y(),b()},[Y,b]),L=(0,M.A)(()=>{g({chatId:t,mutedUntil:o.Os5})}),x=(0,Pc.A)({chat:r,user:l,isPinned:c,isMuted:d,canChangeFolder:h,handleMute:R,handleUnmute:L,handleChatFolderChange:B},!0),E=(0,M.A)(()=>{m(t)}),V=(0,M.A)(e=>{e.stopPropagation();const i=(0,Pn.A)();p({botId:t,peerId:t,theme:i})}),_=Yc(E);return(0,te.FD)(ci.A,{className:"chat-item-clickable search-result",onClick:E,contextActions:x,buttonRef:_,children:[(0,v.L8)(t)?(0,te.Y)(ws.A,{userId:t,withUsername:i,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,te.Y)(ks.A,{chatId:t,withUsername:i,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),u&&l?.hasMainMiniApp&&(0,te.Y)(Q.A,{className:"ChatBadge miniapp",pill:!0,fluid:!0,size:"tiny",onClick:V,children:A("BotOpen")}),P&&(0,te.Y)(Dc.A,{isOpen:f,onClose:C,onCloseAnimationEnd:D,chatId:t}),w&&(0,te.Y)(Fc.A,{isOpen:y,onClose:k,onCloseAnimationEnd:I,chatId:t})]})})),Tc=(0,ge.nF)(e=>e(),500,!0),Bc=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(e=>{let{searchQuery:t,isLoading:i,foundIds:r,recentBotIds:l}=e;const{searchPopularBotApps:c,openChatWithInfo:d}=(0,n.ko)(),h=(0,s.li)(),u=(0,T.A)(),[m,p]=(0,s.J0)(!1),v=(0,s.Kr)(()=>{if(!r)return[];const e=new Set(l),i=r.filter(t=>!e.has(t));return(0,Ft.PU)({ids:i,query:t,type:"user"})},[r,l,t]),g=(0,M.A)(e=>{d({id:e,shouldReplaceHistory:!0})}),A=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&Tc(()=>{c()})},[]),f=(0,M.A)(()=>{p(e=>!e)}),b=(0,or.A)([t],o.jhd)&&!i;return(0,te.Y)(ne.Ay,{ref:h,slideClassName:"LeftSearch--content",name:"fade",activeKey:b?1:0,shouldCleanup:!0,children:(0,te.FD)(Cs.A,{className:"search-content custom-scroll",items:b?v:void 0,onLoadMore:A,noFastList:!0,children:[!b&&(0,te.Y)(xs.A,{}),b&&!v?.length&&(0,te.Y)(kc.A,{withSticker:!0,text:u("ChatList.Search.NoResults"),description:u("ChatList.Search.NoResultsDescription")}),b&&!t&&Boolean(l?.length)&&(0,te.FD)("div",{className:"search-section",children:[(0,te.FD)("h3",{className:"section-heading",children:[l.length>5&&(0,te.Y)(Yo.A,{className:"Link",onClick:f,children:u(m?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),u("SearchAppsMine")]}),l.map((e,t)=>{if(m||!(t>=5))return(0,te.Y)(Mc,{chatId:e,onClick:g,withOpenAppButton:!0})})]}),b&&Boolean(v?.length)&&(0,te.FD)("div",{className:"search-section",children:[(0,te.Y)("h3",{className:"section-heading",children:u("SearchAppsPopular")}),v.map(e=>(0,te.Y)(Mc,{chatId:e,onClick:g,withOpenAppButton:!0}))]})]})})}));var Rc=i(35749),Lc=i(2338);function xc(e,t,i,s,n){if(!i)return(0,A.C)(e,t,void 0,s);const a=(0,l.y2)(t);return(0,te.FD)("span",{className:"media-preview",children:[(0,te.Y)("img",{src:i,alt:"",className:(0,me.A)("media-preview--image",n&&"round",a&&"media-preview-spoiler"),draggable:!1}),(0,l.zX)(t)&&(0,te.Y)(W.A,{name:"play"}),(0,A.C)(e,t,!0,s)]})}const Ec=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i);if(!s)return{};const n=(0,l.e7)(s);return{chat:s,privateChatUser:n?(0,c.mBe)(e,n):void 0}})(e=>{let{message:t,searchQuery:i,chatId:s,chat:a,privateChatUser:o}=e;const{focusMessage:r}=(0,n.ko)(),{isMobile:c}=(0,Y.Ay)(),d=(0,Lc.A)(t),h=(0,l.fP)(t)?void 0:d,u=(0,Rc.A)(t,"micro"),m=(0,z.A)(u),p=Boolean((0,l.lk)(t)),v=(0,M.A)(()=>{r({chatId:s,messageId:t.id,shouldReplaceHistory:!0})}),g=(0,_i.A)(),A=(0,T.A)(),f=Yc(v);if(!a)return;const b=o||a;return(0,te.FD)(ci.A,{className:"ChatMessage chat-item-clickable",ripple:!c,onClick:v,buttonRef:f,children:[(0,te.Y)(Mt.A,{peer:b,isSavedMessages:o?.isSelf}),(0,te.FD)("div",{className:"info",children:[(0,te.FD)("div",{className:"info-row",children:[(0,te.Y)(Es.A,{peer:b,withEmojiStatus:!0,isSavedMessages:s===o?.id&&o?.isSelf}),(0,te.Y)("div",{className:"message-date",children:(0,te.Y)(Yo.A,{className:"date",children:(0,He.be)(A,1e3*t.date)})})]}),(0,te.Y)("div",{className:"subtitle",children:(0,te.Y)("div",{className:"message",dir:"auto",children:xc(g,t,m||h,i,p)})})]})]})})),Vc=(0,s.ph)(e=>{let{searchDate:t,onSelect:i}=e;const n=(0,s.Kr)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,He.A)(t)}]}const t=[],i=new Date,s=i.getFullYear(),n=i.getTime()>new Date(`${s}-${e}`).getTime()?s:s-1;for(let i=0;i<8;i++){const s=new Date(`${n-i}-${e}`);t.push({date:s,text:(0,He.A)(s)})}return t}(t),[t]);return(0,te.Y)("section",{className:"DateSuggest custom-scroll custom-scroll-x",children:n.map(e=>{let{date:t,text:s}=e;return(0,te.FD)("div",{onClick:()=>i(t),className:"date-item",children:[(0,te.Y)(W.A,{name:"calendar"}),(0,te.Y)("span",{children:s})]},s)})})}),_c=2*g.$,Uc=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i,topicId:s}=t;return{topic:(0,c.S0q)(e,i,s)}})(e=>{let{topicId:t,topic:i,onClick:n}=e;const a=(0,s.hb)(()=>{n(t)},[t,n]),o=Yc(a);if(i)return(0,te.FD)(ci.A,{className:"chat-item-clickable search-result",onClick:a,buttonClassName:"topic-item",buttonRef:o,children:[(0,te.Y)(Vs.A,{size:_c,topic:i,className:"topic-icon",letterClassName:"topic-icon-letter"}),(0,te.Y)("div",{dir:"auto",className:"fullName",children:(0,Dt.A)(i.title)})]})})),Oc=(0,ge.nF)(e=>e(),500,!0),Kc=(0,s.ph)((0,n.EK)(e=>{const{byId:t}=e.chats,{currentUserId:i,messages:{byChatId:s}}=e,{fetchingStatus:n,resultsByType:a,foundTopicIds:o,chatId:r}=(0,c.nTw)(e).globalSearch,{foundIds:l}=a?.text||{};return{currentUserId:i,foundIds:l,globalMessagesByChatId:s,chatsById:t,fetchingStatus:n,foundTopicIds:o,searchChatId:r}})(e=>{let{searchQuery:t,dateSearchQuery:i,foundIds:o,globalMessagesByChatId:r,chatsById:l,fetchingStatus:c,foundTopicIds:d,searchChatId:h,onSearchDateSelect:u,onReset:m}=e;const{searchMessagesGlobal:p,openThread:v}=(0,n.ko)(),g=(0,_i.A)(),{isMobile:f}=(0,Y.Ay)(),b=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&Oc(()=>{p({type:"text"})})},[t]),C=(0,s.hb)(e=>{h&&(v({chatId:h,threadId:e,shouldReplaceHistory:!0}),f||m())},[h,f,m]),y=(0,s.Kr)(()=>o&&0!==o.length?o.map(e=>{const[t,i]=(0,bc.a)(e);return r?.[t]?.byId[i]}).filter(Boolean).sort((e,t)=>t.date-e.date):Ci.p,[o,r]),S=c&&!c.chats&&!c.messages&&!y.length&&!d?.length;return(0,te.Y)("div",{className:"LeftSearch--content",children:(0,te.FD)(Cs.A,{className:"search-content custom-scroll chat-list",items:y,onLoadMore:b,noFastList:!0,children:[i&&(0,te.Y)("div",{className:"chat-selection no-scrollbar",children:(0,te.Y)(Vc,{searchDate:i,onSelect:u})}),S&&(0,te.Y)(kc.A,{withSticker:!0,text:g("ChatListSearchNoResults"),description:g("ChatListSearchNoResultsDescription")}),Boolean(d?.length)&&(0,te.FD)("div",{className:"pb-2",children:[(0,te.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("SearchResultTopics")}),d.map(e=>(0,te.Y)(Uc,{chatId:h,topicId:e,onClick:C}))]}),Boolean(y.length)&&(0,te.FD)("div",{className:"pb-2",children:[(0,te.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("SearchMessages")}),y.map(function(e){const i=(0,A.C)(g,e),s=l[e.chatId];if(i&&s)return(0,te.Y)(Ec,{chatId:e.chatId,message:e,searchQuery:t})})]})]})})}));var Jc=i(49763),Gc=i(81949);const jc=(0,s.ph)(e=>{let{sponsoredPeer:t,observeIntersection:i}=e;const o=(0,s.li)(),{clickSponsored:r,viewSponsored:l,openChat:c}=(0,n.ko)(),d=(0,_i.A)(),{peerId:h,randomId:u,additionalInfo:m,sponsorInfo:p}=t;(0,lr.mv)(o,i,e=>{1===e.intersectionRatio&&l({randomId:u})});const g=(0,M.A)(()=>{r({randomId:u}),c({id:h})}),{isContextMenuOpen:A,contextMenuAnchor:f,handleBeforeContextMenu:b,handleContextMenu:C,handleContextMenuClose:y,handleContextMenuHide:S}=(0,bn.A)(o),{handleClick:k,handleMouseDown:w}=(0,es.Q)(e=>{e.stopPropagation(),C(e)}),N=Yc(g);return(0,te.FD)(ci.A,{ref:o,className:"chat-item-clickable search-result",onClick:g,onMouseDown:b,onContextMenu:C,buttonRef:N,children:[(0,v.L8)(h)?(0,te.Y)(ws.A,{userId:h,withUsername:!0,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,te.Y)(ks.A,{chatId:h,withUsername:!0,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),(0,te.FD)(Gc.A,{className:"search-sponsored-badge",onMouseDown:w,onClick:k,children:[d("SponsoredPeerBadge"),(0,te.Y)(W.A,{name:"more"})]}),f&&(0,te.Y)(vl.A,{isOpen:A,anchor:f,triggerRef:o,randomId:u,additionalInfo:m,canReport:!0,sponsorInfo:p,onClose:y,onCloseAnimationEnd:S})]})}),zc=(0,ge.nF)(e=>e(),6e4,!0),Hc=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.topPeers,i=e.users.byId,{recentlyFoundChatIds:s}=e;return{topUserIds:t,usersById:i,recentlyFoundChatIds:s}})(e=>{let{topUserIds:t,usersById:i,recentlyFoundChatIds:a,onReset:o}=e;const{loadTopUsers:r,openChat:c,addRecentlyFoundChatId:d,clearRecentlyFoundChats:h}=(0,n.ko)(),u=(0,s.li)();(0,s.vJ)(()=>{zc(()=>{r()})},[r]),(0,Nn.A)(u,!t);const m=(0,s.hb)(e=>{c({id:e,shouldReplaceHistory:!0}),o(),setTimeout(()=>{d({id:e})},250)},[c,d,o]),p=(0,s.hb)(()=>{h()},[h]),v=(0,T.A)();return(0,te.FD)("div",{className:"RecentContacts custom-scroll",children:[t&&(0,te.Y)("div",{className:"top-peers-section",dir:v.isRtl?"rtl":void 0,children:(0,te.Y)("div",{ref:u,className:"top-peers",children:t.map(e=>(0,te.FD)("div",{className:"top-peer-item",onClick:()=>m(e),dir:v.isRtl?"rtl":void 0,children:[(0,te.Y)(Mt.A,{peer:i[e]}),(0,te.Y)("div",{className:"top-peer-name",children:(0,Dt.A)((0,l.u0)(i[e])||" ")})]},e))})}),a&&(0,te.FD)("div",{className:"search-section pt-1",children:[(0,te.FD)("h3",{className:(0,me.A)("section-heading mt-0 recent-chats-header",!t&&"without-border"),dir:v.isRtl?"rtl":void 0,children:[v("Recent"),(0,te.Y)(Q.A,{className:"clear-recent-chats",round:!0,size:"smaller",color:"translucent",ariaLabel:v("Clear"),onClick:p,isRtl:v.isRtl,children:(0,te.Y)(W.A,{name:"close"})})]}),a.map(e=>(0,te.Y)(Mc,{chatId:e,withOpenAppButton:!0,onClick:m}))]})]})})),$c=(0,ge.nF)(e=>e(),500,!1),qc=(0,s.ph)((0,n.EK)((e,t)=>{let{isChannelList:i}=t;const{userIds:s}=e.contactList||{},{currentUserId:n,messages:a}=e;if(!s)return{};const{fetchingStatus:r,globalResults:l,localResults:d,resultsByType:h,sponsoredPeer:u}=(0,c.nTw)(e).globalSearch,{peerIds:m}=l||{},{peerIds:p}=d||{},{byChatId:v}=a,g=h?.[i?"channels":"text"]?.foundIds,{similarChannelIds:A}=(0,c.dg4)(e,o.rBM)||{};return{currentUserId:n,contactIds:s,accountPeerIds:p,globalPeerIds:m,foundIds:g,globalMessagesByChatId:v,fetchingStatus:r,sponsoredPeer:u,suggestedChannelIds:A}})(e=>{let{isChannelList:t,searchQuery:i,searchDate:r,dateSearchQuery:c,currentUserId:d,contactIds:h,accountPeerIds:u,globalPeerIds:m,foundIds:p,globalMessagesByChatId:v,fetchingStatus:g,suggestedChannelIds:f,sponsoredPeer:b,onReset:C,onSearchDateSelect:y}=e;const{openChat:S,addRecentlyFoundChatId:k,searchMessagesGlobal:w,setGlobalSearchChatId:N,loadChannelRecommendations:I}=(0,n.ko)(),P=(0,s.li)(),F=(0,s.li)(),D=(0,_i.A)(),{isMobile:T}=(0,Y.Ay)(),[B,R]=(0,s.J0)(!1),[L,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)("all"),_=(0,s.li)();(0,ye.A)(()=>{t&&I({})});const U=(0,s.hb)(e=>{let{direction:i}=e;i===a.TN.Backwards&&$c(()=>{w({type:t?"channels":"text",context:E})})},[i,E]),O=(0,s.hb)(e=>{S({id:e,shouldReplaceHistory:!0}),e!==d&&k({id:e}),T||C()},[S,d,T,k,C]),K=(0,s.hb)(e=>{N({id:e})},[N]);function J(e){return D("users"===e?"PrivateChatsSearchContext":"groups"===e?"GroupChatsSearchContext":"channels"===e?"ChannelsSearchContext":"AllChatsSearchContext")}const{isContextMenuOpen:G,contextMenuAnchor:j,handleContextMenu:z,handleContextMenuClose:H,handleContextMenuHide:$}=(0,bn.A)(_),q=(0,M.A)(()=>_.current),Q=(0,M.A)(()=>_.current.querySelector(".chatResultsContextMenu .bubble")),Z=(0,M.A)(()=>_.current.querySelector(".menuTrigger")),X=(0,M.A)(e=>{z(e)}),ee=(0,me.A)("icon","iconPlaceholder"),ie=(0,s.Kr)(()=>{if(!t&&(!i||i.startsWith("@")&&i.length<2))return Ci.p;const e=(0,n.mS)().chats.byId,s=((0,Jc.YA)(o.DSF)??[]).filter(i=>{if(!t)return!0;const s=e[i];return s&&(0,l.WX)(s)}),a=(0,Ft.PU)({ids:s,query:i,type:"chat"});if(t)return a;const r=[...d?[d]:[],...h||[]],c=[...(0,Ft.PU)({ids:r,query:i,type:"user"}),...a];return(0,bi.Am)([...(0,Ms.A)(c,void 0,d?[d]:void 0),...(0,Ms.A)(u||[])])},[i,d,h,u,t]);(0,Nn.A)(F,!ie.length||t,!0);const se=(0,s.Kr)(()=>{if(!i||i.length<4||!m)return Ci.p;const e=(0,n.mS)().chats.byId,s=m.filter(i=>{if(!t)return!0;const s=e[i];return s&&(0,l.WX)(s)});return(0,Ms.A)(s,!0)},[m,t,i]),ae=(0,s.Kr)(()=>{if(!i&&!r||!p||0===p.length)return Ci.p;const e=(0,n.mS)().chats.byId;return p.map(i=>{const[s,n]=(0,bc.a)(i),a=e[s];if(a&&(!t||(0,l.WX)(a)))return v?.[s]?.byId[n]}).filter(Boolean)},[i,r,p,t,v]);(0,s.vJ)(()=>{i&&w({type:t?"channels":"text",context:E,shouldResetResultsByType:!0,shouldCheckFetchingMessagesStatus:!0})},[E]);const oe=(0,s.hb)(()=>{R(!B)},[B]),re=(0,s.hb)(()=>{x(!L)},[L]),le=ae,ce="all"===E&&g&&!g.chats&&!g.messages&&!ie.length&&!se.length&&!le.length,he=g?.messages,ue=!i&&!r&&!t,{observe:pe}=(0,lr.BL)({rootRef:P,throttleMs:200,isDisabled:!ue});if(ue)return(0,te.Y)(Hc,{onReset:C});const ve="all"!==E||Boolean(le.length);return(0,te.FD)(Cs.A,{ref:P,className:"LeftSearch--content custom-scroll",items:le,onLoadMore:U,noScrollRestoreOnTop:!0,noFastList:!0,children:[c&&(0,te.Y)("div",{className:"chat-selection no-scrollbar",children:(0,te.Y)(Vc,{searchDate:c,onSelect:y})}),ce&&(0,te.Y)(kc.A,{withSticker:!0,text:D("ChatListSearchNoResults"),description:D("ChatListSearchNoResultsDescription")}),Boolean(ie.length)&&!t&&(0,te.Y)("div",{className:"chat-selection no-scrollbar",dir:D.isRtl?"rtl":void 0,ref:F,children:ie.map(e=>(0,te.Y)(Kr.A,{peerId:e,className:"left-search-local-suggestion",onClick:K,clickArg:e}))}),Boolean(ie.length)&&(0,te.FD)("div",{className:"search-section",children:[(0,te.FD)("h3",{className:"section-heading",dir:D.isRtl?"auto":void 0,children:[ie.length>5&&(0,te.Y)(Yo.A,{className:"Link",onClick:oe,children:D(B?"ChatListSearchShowLess":"ChatListSearchShowMore")}),D(t?"SearchResultMyChannels":"DialogListSearchSectionDialogs")]}),ie.map((e,t)=>{if(B||!(t>=5))return(0,te.Y)(Mc,{withOpenAppButton:!0,chatId:e,onClick:O})})]}),Boolean(se.length)&&(0,te.FD)("div",{className:"search-section",children:[(0,te.FD)("h3",{className:"section-heading",dir:D.isRtl?"auto":void 0,children:[se.length>5&&(0,te.Y)(Yo.A,{className:"Link",onClick:re,children:D(L?"ChatListSearchShowLess":"ChatListSearchShowMore")}),D("DialogListSearchSectionGlobal")]}),b&&(0,te.Y)(jc,{sponsoredPeer:b,observeIntersection:pe}),se.map((e,t)=>{if(L||!(t>=5))return(0,te.Y)(Mc,{chatId:e,withUsername:!0,onClick:O})})]}),Boolean(f?.length)&&!i&&(0,te.FD)("div",{className:"search-section",children:[(0,te.Y)("h3",{className:"section-heading",dir:D.isRtl?"auto":void 0,children:D("SearchResultRecommendedChannels")}),f.map(e=>(0,te.Y)(Mc,{chatId:e,withUsername:!0,onClick:O}))]}),(0,te.FD)("div",{className:"menuOwner",ref:_,children:[(0,te.Y)(qe.A,{isOpen:G,anchor:j,getTriggerElement:Z,getRootElement:q,getMenuElement:Q,className:"chatResultsContextMenu",onClose:H,onCloseAnimationEnd:$,autoClose:!0,children:(0,te.FD)(te.FK,{children:[(0,te.Y)(de.A,{icon:"all"===E?"check":void 0,customIcon:"all"!==E?(0,te.Y)("i",{className:ee}):void 0,onClick:()=>V("all"),children:J("all")}),(0,te.Y)(de.A,{icon:"users"===E?"check":void 0,customIcon:"users"!==E?(0,te.Y)("i",{className:ee}):void 0,onClick:()=>V("users"),children:J("users")}),(0,te.Y)(de.A,{icon:"groups"===E?"check":void 0,customIcon:"groups"!==E?(0,te.Y)("i",{className:ee}):void 0,onClick:()=>V("groups"),children:J("groups")}),(0,te.Y)(de.A,{icon:"channels"===E?"check":void 0,customIcon:"channels"!==E?(0,te.Y)("i",{className:ee}):void 0,onClick:()=>V("channels"),children:J("channels")})]})}),ve&&(0,te.FD)("div",{className:"search-section",children:[(0,te.FD)("h3",{className:"section-heading",dir:D.isRtl?"auto":void 0,children:[!t&&(0,te.FD)(Yo.A,{className:"Link menuTrigger dropDownLink",onClick:X,children:[D("SearchContextCaption",{type:J(E)},{withNodes:!0}),(0,te.FD)(ne.Ay,{name:"fade",shouldCleanup:!0,activeKey:Number(he),className:"iconContainer",slideClassName:"iconContainerSlide",children:[he&&(0,te.Y)(xs.A,{}),!he&&(0,te.Y)(W.A,{name:"down"})]})]}),D("SearchMessages")]}),le.map(function(e){const t=(0,n.mS)().chats.byId,s=(0,A.C)(D,e),a=t[e.chatId];if(s&&a)return(0,te.Y)(Ec,{chatId:e.chatId,message:e,searchQuery:i})})]})]})]})}));var Wc=i(55723);const Qc="documents",Zc=(0,ge.nF)(e=>e(),500,!0),Xc=(0,s.ph)((0,n.EK)(Cc(Qc))(e=>{let{searchQuery:t,isLoading:i,chatsById:r,usersById:c,globalMessagesByChatId:d,foundIds:h,activeDownloads:u,shouldWarnAboutFiles:m}=e;const{searchMessagesGlobal:p,focusMessage:v}=(0,n.ko)(),g=(0,s.li)(),A=(0,T.A)(),{observe:f}=(0,lr.BL)({rootRef:g,throttleMs:500}),b=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&Zc(()=>{p({type:Qc})})},[t]),C=(0,s.Kr)(()=>h&&d?h.map(e=>{const[t,i]=(0,bc.a)(e),s=d[t]?.byId[i];return s&&(0,l.zC)(s)?s:void 0}).filter(Boolean):Ci.p,[d,h]),y=(0,s.hb)(e=>{v({chatId:e.chatId,messageId:e.id})},[v]),S=(0,or.A)([t],o.jhd)&&!i;return(0,te.Y)(ne.Ay,{ref:g,slideClassName:"LeftSearch--content",name:"fade",activeKey:S?1:0,shouldCleanup:!0,children:(0,te.FD)(Cs.A,{className:"search-content documents-list custom-scroll",items:S?C:void 0,onLoadMore:b,noFastList:!0,children:[!S&&(0,te.Y)(xs.A,{}),S&&(!h||0===h.length)&&(0,te.Y)(kc.A,{withSticker:!0,text:A("ChatList.Search.NoResults"),description:A("ChatList.Search.NoResultsDescription")}),S&&h&&h.length>0&&C.map((e,t)=>{const i=0===t||(0,He.$$)(e.date)!==(0,He.$$)(C[t-1].date);return(0,te.FD)(te.FK,{children:[i&&(0,te.Y)("p",{className:"section-heading",dir:A.isRtl?"rtl":void 0,children:(0,He.i6)(A,new Date(1e3*e.date))},e.date),(0,te.Y)("div",{className:"ListItem small-icon",children:(0,te.Y)(Wc.A,{document:(0,l.zC)(e),message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,yc.N)(A,e,r,c),className:"scroll-item",isDownloading:(0,l.$r)(u,e.content.document),shouldWarnAboutFiles:m,observeIntersection:f,onDateClick:y})},e.id)]})})]})})}));var ed=i(37378);const td="links",id=(0,ge.nF)(e=>e(),500,!0),sd=(0,s.ph)((0,n.EK)(Cc(td))(e=>{let{searchQuery:t,isLoading:i,chatsById:r,usersById:l,globalMessagesByChatId:c,foundIds:d,isChatProtected:h}=e;const{searchMessagesGlobal:u,focusMessage:m}=(0,n.ko)(),p=(0,s.li)(),v=(0,T.A)(),{observe:g}=(0,lr.BL)({rootRef:p,throttleMs:500}),A=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&id(()=>{u({type:td})})},[t]),f=(0,s.Kr)(()=>d&&c?d.map(e=>{const[t,i]=(0,bc.a)(e);return c[t]?.byId[i]}).filter(Boolean):Ci.p,[c,d]),b=(0,s.hb)(e=>{m({chatId:e.chatId,messageId:e.id})},[m]),C=(0,or.A)([t],o.jhd)&&!i;return(0,te.Y)(ne.Ay,{ref:p,slideClassName:"LeftSearch--content",name:"fade",activeKey:C?1:0,shouldCleanup:!0,children:(0,te.FD)(Cs.A,{className:"search-content documents-list custom-scroll",items:C?f:void 0,onLoadMore:A,noFastList:!0,children:[!C&&(0,te.Y)(xs.A,{}),C&&(!d||0===d.length)&&(0,te.Y)(kc.A,{withSticker:!0,text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),C&&d&&d.length>0&&f.map((e,t)=>{const i=0===t||(0,He.$$)(e.date)!==(0,He.$$)(f[t-1].date);return(0,te.FD)(te.FK,{children:[i&&(0,te.Y)("p",{className:"section-heading",dir:v.isRtl?"rtl":void 0,children:(0,He.i6)(v,new Date(1e3*e.date))},e.date),(0,te.Y)("div",{className:"ListItem small-icon",dir:v.isRtl?"rtl":void 0,children:(0,te.Y)(ed.A,{message:e,senderTitle:(0,yc.N)(v,e,r,l),isProtected:h||e.isProtected,observeIntersection:g,onMessageClick:b},e.id)},e.id)]})})]})})}));var nd=i(81524);const ad="media",od=(0,ge.nF)(e=>e(),500,!0),rd=(0,s.ph)((0,n.EK)(Cc(ad))(e=>{let{searchQuery:t,isLoading:i,globalMessagesByChatId:r,foundIds:l,isChatProtected:c}=e;const{searchMessagesGlobal:d,openMediaViewer:h}=(0,n.ko)(),u=(0,s.li)(),m=(0,T.A)(),{observe:p}=(0,lr.BL)({rootRef:u,throttleMs:500}),v=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&od(()=>{d({type:ad})})},[d,t]),g=(0,s.Kr)(()=>l&&r?l.map(e=>{const[t,i]=(0,bc.a)(e);return r[t]?.byId[i]}).filter(Boolean):Ci.p,[r,l]),A=(0,s.hb)((e,t)=>{h({chatId:t,messageId:e,origin:a.TQ.SearchResult})},[h]),f=(0,or.A)([t],o.jhd)&&!i,b=f&&l&&l.length>0&&!t,C=f&&l&&l.length>0&&t,y=(0,me.A)("search-content custom-scroll",C&&"chat-list");return(0,te.Y)(ne.Ay,{ref:u,slideClassName:"LeftSearch--content LeftSearch--media",name:"fade",activeKey:f?1:0,shouldCleanup:!0,children:(0,te.FD)(Cs.A,{className:y,items:f?g:void 0,itemSelector:t?".ListItem":".Media",onLoadMore:v,noFastList:!0,children:[!f&&(0,te.Y)(xs.A,{}),f&&(!l||0===l.length)&&(0,te.Y)(kc.A,{withSticker:!0,text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),b&&(0,te.Y)("div",{className:"media-list",dir:m.isRtl?"rtl":void 0,children:g.map(e=>(0,te.Y)(nd.A,{idPrefix:"search-media",message:e,isProtected:c||e.isProtected,observeIntersection:p,onClick:A},`${e.chatId}-${e.id}`))}),C&&g.map(e=>(0,te.Y)(Ec,{chatId:e.chatId,message:e},e.id))]})})}));var ld=i(537);const cd={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"},dd=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),starsBalance:e.stars?.balance?.amount||0}))(e=>{let{searchQuery:t,searchFlood:i,onSearch:a,isLoading:r,isCurrentUserPremium:l,starsBalance:c}=e;const d=(0,_i.A)(),h=i?.queryIsFree,u=i?.query,m=(0,ld.A)([t?.slice(0,18).trimEnd()]),p=(0,M.A)(()=>{a()});(0,s.vJ)(()=>{h&&t&&u===t&&a()},[h,t,u,a]);const v=(0,M.A)(()=>{const e=i?.starsAmount||0;c<e?f({topup:{balanceNeeded:e}}):a()}),{checkSearchPostsFlood:g,openPremiumModal:A,openStarsBalanceModal:f}=(0,n.ko)(),b=(0,M.A)(()=>{g({})}),C=(0,M.A)(()=>{A()}),y=(0,li.Fm)(),S=0===i?.remains||i?.waitTill&&i.waitTill>y;return(0,te.Y)(ne.Ay,{name:"fade",activeKey:l?r?2:S?0:1:3,children:l?r?(0,te.Y)("div",{className:cd.container,children:(0,te.Y)("div",{className:(0,me.A)(cd.content,cd.loadingScreen),children:(0,te.Y)(xs.A,{})})}):S?(()=>{const e=i?.waitTill,s=i?.starsAmount||o._tP,n=i?.totalDaily||o.M3$;return(0,te.Y)("div",{className:cd.container,children:(0,te.FD)("div",{className:cd.content,children:[(0,te.Y)(wr.A,{className:cd.sticker,size:120,tgsUrl:kr.w.Search,previewUrl:kr.d.Search,nonInteractive:!0,noLoop:!1}),(0,te.Y)("div",{className:cd.limitTitle,children:d("PublicPostsLimitReached")}),(0,te.Y)("div",{className:cd.limitDescription,children:d("HintPublicPostsSearchQuota",{count:n},{pluralValue:n})}),(0,te.Y)(Q.A,{className:cd.paidSearchButton,color:"primary",disabled:!t,noForcedUpperCase:!0,onClick:v,children:d("PublicPostsSearchForStars",{stars:(0,xi.U2)(d,s,{asFont:!0})},{withNodes:!0})}),Boolean(e)&&(0,te.Y)("div",{className:cd.freeSearchUnlock,children:(0,te.Y)(di.A,{langKey:"UnlockTimerPublicPostsSearch",endsAt:e+2,onEnd:b})})]})})})():(()=>{const e=i?.remains||0;return(0,te.Y)("div",{className:cd.container,children:(0,te.FD)("div",{className:cd.content,children:[(0,te.Y)(wr.A,{className:cd.sticker,size:120,tgsUrl:kr.w.Search,previewUrl:kr.d.Search,nonInteractive:!0,noLoop:!1}),(0,te.Y)("div",{className:cd.title,children:d("GlobalSearch")}),(0,te.Y)("div",{className:cd.description,children:d("DescriptionPublicPostsSearch")}),(0,te.Y)(Q.A,{className:cd.searchButton,color:"primary",noForcedUpperCase:!0,disabled:!t,onClick:p,children:(0,te.Y)(ne.Ay,{name:"fade",activeKey:m,children:(0,te.FD)("div",{className:cd.searchButtonContent,children:[(0,te.Y)(W.A,{name:"search",className:(0,me.A)(cd.searchIcon,t&&cd.searchIconWithNext)}),d("ButtonSearchPublicPosts",{query:t?(0,te.Y)("span",{className:cd.searchQuery,children:t}):""},{withNodes:!0}),t&&(0,te.Y)(W.A,{name:"next",className:cd.nextIcon})]})})}),(0,te.Y)("div",{className:cd.remainingSearches,children:d("RemainingPublicPostsSearch",{count:e},{pluralValue:e})})]})})})():(0,te.Y)("div",{className:cd.container,children:(0,te.FD)("div",{className:cd.content,children:[(0,te.Y)("div",{className:cd.premiumTitle,children:d("GlobalSearch")}),(0,te.Y)("div",{className:cd.premiumDescription,children:d("PublicPostsPremiumFeatureDescription")}),(0,te.Y)(Q.A,{className:cd.subscribePremiumButton,color:"primary",noForcedUpperCase:!0,onClick:C,children:d("PublicPostsSubscribeToPremium")}),(0,te.Y)("div",{className:cd.premiumSubtitle,children:d("PublicPostsPremiumFeatureSubtitle")})]})})})})),hd=(0,ge.nF)(e=>e(),500,!0),ud=(0,s.ph)((0,n.EK)(e=>{const{messages:{byChatId:t}}=e,{resultsByType:i,searchFlood:s,fetchingStatus:n}=(0,c.nTw)(e).globalSearch,a=i?.publicPosts,{foundIds:o}=a||{},r=Boolean(n?.publicPosts&&!a),l=!a&&!r,d=a&&!o?.length,{animationLevel:h}=(0,vn.l)(e);return{foundIds:o,globalMessagesByChatId:t,searchFlood:s,shouldShowSearchLauncher:l,isNothingFound:d,isLoading:r,animationLevel:h}})(e=>{let{searchQuery:t,foundIds:i,globalMessagesByChatId:o,searchFlood:r,shouldShowSearchLauncher:l,isNothingFound:c,isLoading:d,animationLevel:h}=e;const{searchMessagesGlobal:u}=(0,n.ko)(),m=(0,_i.A)(),p=(0,M.A)(()=>{t&&u({type:"publicPosts",shouldResetResultsByType:!0})}),v=(0,s.hb)(e=>{let{direction:t}=e;t===a.TN.Backwards&&hd(()=>{u({type:"publicPosts"})})},[]),g=(0,s.Kr)(()=>i&&0!==i.length?i.map(e=>{const[t,i]=(0,bc.a)(e);return o?.[t]?.byId[i]}).filter(Boolean):Ci.p,[i,o]);return(0,te.Y)(ne.Ay,{name:(0,Ac.P)("slideOptimized",h,void 0,m.isRtl),activeKey:l||d?0:1,children:l||d?(0,te.Y)(dd,{searchQuery:t,searchFlood:r,onSearch:p,isLoading:d}):(0,te.Y)("div",{className:"LeftSearch--content",children:(0,te.FD)(Cs.A,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:v,noFastList:!0,children:[c&&(0,te.Y)(kc.A,{text:m("ChatListSearchNoResults"),description:m("ChatListSearchNoResultsDescription"),withSticker:!0}),Boolean(g.length)&&(0,te.FD)("div",{className:"pb-2",children:[(0,te.Y)("h3",{className:"section-heading",dir:m.isRtl?"auto":void 0,children:m("PublicPosts")}),g.map(function(e){const i=(0,n.mS)().chats.byId,s=(0,A.C)(m,e),a=i[e.chatId];if(s&&a)return(0,te.Y)(Ec,{chatId:e.chatId,message:e,searchQuery:t},`${e.chatId}-${e.id}`)})]})]},t)})})})),md=[{type:a.$C.ChatList,key:"SearchTabChats"},{type:a.$C.ChannelList,key:"SearchTabChannels"},{type:a.$C.BotApps,key:"SearchTabApps"},{type:a.$C.PublicPosts,key:"SearchTabPublicPosts"},{type:a.$C.Media,key:"SearchTabMedia"},{type:a.$C.Links,key:"SearchTabLinks"},{type:a.$C.Files,key:"SearchTabFiles"},{type:a.$C.Music,key:"SearchTabMusic"},{type:a.$C.Voice,key:"SearchTabVoice"}],pd=[{type:a.$C.ChatList,key:"SearchTabMessages"},...md.slice(3)],vd=(0,s.ph)((0,n.EK)(e=>{const{currentContent:t,chatId:i}=(0,c.nTw)(e).globalSearch,{animationLevel:s}=(0,vn.l)(e);return{currentContent:t,chatId:i,animationLevel:s}})(e=>{let{searchQuery:t,searchDate:i,isActive:o,currentContent:r=a.$C.ChatList,chatId:l,animationLevel:c,onReset:d}=e;const{setGlobalSearchContent:h,setGlobalSearchDate:u,checkSearchPostsFlood:m}=(0,n.ko)(),p=(0,_i.A)(),[v,g]=(0,s.J0)(r),A=(0,s.Kr)(()=>(0,He.Rm)(t),[t]);(0,s.vJ)(()=>{o&&m({})},[o]);const f=(0,s.Kr)(()=>(l?pd:md).map(e=>({...e,title:p(e.key)})),[l,p]),b=(0,M.A)(e=>{const t=f[e];h({content:t.type}),g(e)}),C=(0,M.A)(e=>{u({date:e.getTime()/1e3})});(0,Ce.A)({isActive:o,onBack:d});const y=(0,s.li)(),S=(0,Ls.A)(y,o,void 0,".ListItem-button",!0);return(0,te.FD)("div",{className:"LeftSearch",ref:y,onKeyDown:S,children:[(0,te.Y)(fc.A,{activeTab:v,tabs:f,onSwitchTab:b}),(0,te.Y)(ne.Ay,{name:(0,Ac.P)("slideOptimized",c,void 0,p.isRtl),renderCount:f.length,activeKey:r,children:(()=>{switch(r){case a.$C.ChatList:case a.$C.ChannelList:return l?(0,te.Y)(Kc,{searchQuery:t,dateSearchQuery:A,onReset:d,onSearchDateSelect:C}):(0,te.Y)(qc,{isChannelList:r===a.$C.ChannelList,searchQuery:t,searchDate:i,dateSearchQuery:A,onReset:d,onSearchDateSelect:C});case a.$C.Media:return(0,te.Y)(rd,{searchQuery:t});case a.$C.Links:return(0,te.Y)(sd,{searchQuery:t});case a.$C.Files:return(0,te.Y)(Xc,{searchQuery:t});case a.$C.Music:return(0,te.Y)(Nc,{searchQuery:t},"audio");case a.$C.Voice:return(0,te.Y)(Nc,{isVoice:!0,searchQuery:t},"voice");case a.$C.BotApps:return(0,te.Y)(Bc,{searchQuery:t},"botApps");case a.$C.PublicPosts:return(0,te.Y)(ud,{searchQuery:t},"publicPosts");default:return}})()})]})}));var gd=i(42215);const Ad={currentPassword:"",password:"",hint:"",email:""},fd=(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 Ad;default:return e}};var bd=i(60406),Cd=i(31880),yd=i(58968),Sd=i(74984);const kd=(0,s.ph)((0,n.EK)(e=>({maxChats:(0,ha.d)(e,"dialogFiltersChats")}))(e=>{let{mode:t,state:i,dispatch:a,isActive:r,onReset:l,onSaveFilter:c,maxChats:d}=e;const h=(0,T.A)(),{openLimitReachedModal:u}=(0,n.ko)(),{chatFilter:m}=i,{selectedChatIds:p,selectedChatTypes:v}=(0,s.Kr)(()=>(0,Cd.a)(i,t,!0),[t,i]),g="included"===t?yd.V2:yd.LS,[A,f]=(0,s.J0)(!1),b=(0,Sd.Rh)(o.DSF),C=(0,Sd.Rh)(o._E9),y=i.folder.isChatList;(0,s.vJ)(()=>{r||f(!1)},[r]);const S=(0,s.Kr)(()=>{const e=[...b||[],...C||[]];return(0,bi.Am)([...(0,Ft.PU)({ids:e,query:m,type:"chat"})])},[b,C,m]),k=(0,M.A)(e=>{a({type:"setChatFilter",payload:e}),f(!0)}),w=(0,M.A)(e=>{if("included"===t){if(e.length>=d)return void u({limit:"dialogFiltersChats"});a({type:"setIncludeFilters",payload:{...i.includeFilters,includedChatIds:e}})}else a({type:"setExcludeFilters",payload:{...i.excludeFilters,excludedChatIds:e}});f(!0)}),N=(0,M.A)(e=>{const i={};e.forEach(e=>{i[e]=!0}),a("included"===t?{type:"setIncludeFilters",payload:{includedChatIds:p,...i}}:{type:"setExcludeFilters",payload:{excludedChatIds:p,...i}}),f(!0)});return(0,Ce.A)({isActive:r,onBack:l}),S?(0,te.FD)("div",{className:"Picker settings-folders-chat-list",children:[(0,te.Y)(yi.A,{categories:y?void 0:g,itemIds:S,selectedIds:p,selectedCategories:v,filterValue:m,filterPlaceholder:h("Search"),categoryPlaceholderKey:"FilterChatTypes",searchInputId:"new-group-picker-search",isSearchable:!0,withDefaultPadding:!0,withPeerTypes:!0,allowMultiple:!0,itemInputType:"checkbox",onSelectedIdsChange:w,onSelectedCategoriesChange:N,onFilterChange:k}),(0,te.Y)(wi.A,{isShown:A,onClick:c,ariaLabel:h("Save"),children:(0,te.Y)(W.A,{name:"check"})})]}):(0,te.Y)(xs.A,{})})),wd=[0,1,2,3,4,5,6],Nd="Please provide a title for this folder.",Id="ChatList.Filter.Error.Empty",Pd=(0,s.ph)((0,n.EK)((e,t)=>{let{state:i}=t;const{listIds:s}=e.chats,{byId:n,invites:a}=e.chatFolders,o=Object.values(n).reduce((e,t)=>e+(t.isChatList?1:0),0),r=(0,c.g29)(e);return{loadedActiveChatIds:s.active,loadedArchivedChatIds:s.archived,invites:i.folderId?a[i.folderId]||Ci.p:void 0,isRemoved:void 0!==i.folderId&&!n[i.folderId],maxInviteLinks:(0,ha.d)(e,"chatlistInvites"),maxChatLists:(0,ha.d)(e,"chatlistJoined"),chatListCount:o,isCurrentUserPremium:r}})(e=>{let{state:t,dispatch:i,onAddIncludedChats:a,onAddExcludedChats:r,onShareFolder:l,onOpenInvite:d,isActive:h,onReset:u,isRemoved:m,onBack:p,loadedActiveChatIds:g,isOnlyInvites:A,loadedArchivedChatIds:f,invites:b,maxInviteLinks:C,maxChatLists:y,chatListCount:S,onSaveFolder:k,isCurrentUserPremium:w}=e;const{loadChatlistInvites:N,openLimitReachedModal:I,showNotification:P,openPremiumModal:Y}=(0,n.ko)(),F="create"===t.mode,D=t.folder.isChatList,[M,B]=(0,s.J0)(!1),[R,L]=(0,s.J0)(!1);(0,s.vJ)(()=>{m&&u()},[m,u]),(0,s.vJ)(()=>{h&&t.folderId&&t.folder.isChatList&&N({folderId:t.folderId})},[h,t.folder.isChatList,t.folderId]);const{selectedChatIds:x,selectedChatTypes:E}=(0,s.Kr)(()=>(0,Cd.a)(t,"included"),[t]),{selectedChatIds:V,selectedChatTypes:_}=(0,s.Kr)(()=>(0,Cd.a)(t,"excluded"),[t]);(0,s.vJ)(()=>{B(!1),L(!1)},[t.folderId]);const[U,O]=(0,s.Kr)(()=>{const e=new Set([...g||[],...f||[]]),t=(0,bi.$h)(x,e),i=(0,bi.$h)(V,e);return[M?t:t.slice(0,5-E.length),R?i:i.slice(0,5-_.length)]},[V,x,E,_,R,M,g,f]),K=(0,T.A)();(0,Ce.A)({isActive:h,onBack:p});const J=(0,s.hb)(e=>{const{currentTarget:t}=e;i({type:"setTitle",payload:t.value.trim()})},[i]),G=(0,s.hb)(()=>{i({type:"setIsLoading",payload:!0}),k(()=>{setTimeout(()=>{u()},500)})},[i,k,u]),j=(0,s.hb)(()=>{b?(0,c.w5O)((0,n.mS)(),t.folderId)?S>=y&&!t.folder.isChatList?I({limit:"chatlistJoined"}):b.length<C?t.isTouched?k(l):l():I({limit:"chatlistInvites"}):P({message:K("ChatList.Filter.InviteLink.IncludeExcludeError")}):F&&k(l)},[b,t.folderId,t.isTouched,S,C,F,k,l,K,y,t.folder.isChatList]),z=(0,s.hb)((e,i)=>{t.isTouched?k(()=>d(i)):d(i)},[k,d,t.isTouched]);function H(e){const t="included"===e?E:_,i="included"===e?U:O,s="included"===e?M:R,n=("included"===e?x:V).length-i.length,a="included"===e?()=>B(!0):()=>L(!0);return(0,te.FD)(te.FK,{children:[t.map(t=>function(e,t){const i="included"===t?yd.V2.find(t=>{let{type:i}=t;return i===e}):yd.LS.find(t=>{let{type:i}=t;return i===e});if(i)return(0,te.Y)(ci.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,te.Y)(ws.A,{avatarSize:"small",customPeer:i})},i.type)}(t,e)),i.map(e=>(0,te.Y)(ci.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,v.L8)(e)?(0,te.Y)(ws.A,{avatarSize:"small",userId:e}):(0,te.Y)(ks.A,{avatarSize:"small",chatId:e})})),!s&&n>0&&(0,te.Y)(ci.A,{className:"settings-folders-list-item",narrow:!0,onClick:a,icon:"down",children:K("FilterShowMoreChats",n,"i")},"load-more")]})}return(0,te.FD)("div",{className:"settings-fab-wrapper",children:[(0,te.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header",children:[(0,te.Y)(wr.A,{size:o.fwn,tgsUrl:kr.w.FoldersNew,play:String(t.folderId),className:"settings-content-icon"}),F&&(0,te.Y)("p",{className:"settings-item-description mb-3",dir:K.isRtl?"rtl":void 0,children:K("FilterIncludeInfo")}),(0,te.Y)(Z.A,{className:"mb-0",label:K("FilterNameHint"),value:t.folder.title.text,maxLength:o.kGl,onChange:J,error:t.error&&t.error===Nd?Nd:void 0})]}),!A&&(0,te.FD)("div",{className:"settings-item",children:[t.error&&t.error===Id&&(0,te.Y)("p",{className:"settings-item-description color-danger mb-2",dir:K.isRtl?"rtl":void 0,children:K(t.error)}),(0,te.Y)("h4",{className:"settings-item-header mb-3",dir:K.isRtl?"rtl":void 0,children:K("FilterInclude")}),(0,te.Y)(ci.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:a,children:K("FilterAddChats")}),H("included")]}),!A&&!D&&(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.Y)("h4",{className:"settings-item-header mb-3",dir:K.isRtl?"rtl":void 0,children:K("FilterExclude")}),(0,te.Y)(ci.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:r,children:K("FilterAddChats")}),H("excluded")]}),(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.FD)("h4",{className:"settings-item-header mb-3 color-picker-title",dir:K.isRtl?"rtl":void 0,children:[K("FilterColorTitle"),(0,te.Y)("div",{className:(0,me.A)("color-picker-selected-color",w&&void 0!==t.folder.color&&-1!==t.folder.color?(0,Zi.a)({color:t.folder.color}):"color-picker-item-disabled"),children:(0,Xi.fd)({text:t.folder.title.text,entities:t.folder.title.entities,noCustomEmojiPlayback:t.folder.noTitleAnimations})})]}),(0,te.FD)("div",{className:"color-picker",children:[wd.map(e=>(0,te.Y)("button",{type:"button",onClick:()=>{w?i({type:"setColor",payload:e}):Y()},className:(0,me.A)("color-picker-item",(0,Zi.a)({color:e}),!w&&"color-picker-item-hover-disabled",e===t.folder.color&&w&&"color-picker-item-active")},e)),(0,te.Y)("button",{type:"button",onClick:()=>{w?i({type:"setColor",payload:void 0}):Y()},className:(0,me.A)("color-picker-item","color-picker-item-none",(void 0===t.folder.color||-1===t.folder.color||!w)&&"color-picker-item-active"),children:w?(0,te.Y)(W.A,{name:"close",className:"color-picker-item-none-icon"}):(0,te.Y)(W.A,{name:"lock-badge",className:"color-picker-item-none-icon"})})]}),(0,te.Y)("p",{className:"settings-item-description mb-0",dir:K.isRtl?"rtl":void 0,children:K("FilterColorHint")})]}),(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.Y)("h4",{className:"settings-item-header mb-3",dir:K.isRtl?"rtl":void 0,children:K("FolderLinkScreen.Title")}),(0,te.Y)(ci.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:j,children:K("ChatListFilter.CreateLinkNew")}),b?.map(e=>(0,te.FD)(ci.A,{className:"settings-folders-list-item",icon:"link",narrow:!0,multiline:!0,onClick:z,clickArg:e.url,children:[(0,te.Y)("span",{className:"title",dir:"auto",children:e.title||e.url}),(0,te.Y)("span",{className:"subtitle",children:K("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i")})]}))]})]}),(0,te.Y)(wi.A,{isShown:Boolean(t.isTouched),disabled:t.isLoading,onClick:G,ariaLabel:"edit"===t.mode?"Save changes":"Create folder",children:t.isLoading?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})}));var Yd=i(80401);const Fd=(0,ge.nF)(e=>e(),6e4,!0),Dd=(0,s.ph)((0,n.EK)(e=>{const{orderedIds:t,byId:i,recommended:s,areTagsEnabled:n}=e.chatFolders;return{folderIds:t,foldersById:i,isPremium:(0,c.g29)(e),recommendedChatFolders:s,maxFolders:(0,ha.d)(e,"dialogFilters"),areTagsEnabled:n}})(e=>{let{isActive:t,onCreateFolder:i,onEditFolder:a,onReset:r,folderIds:c,foldersById:d,isPremium:h,recommendedChatFolders:u,maxFolders:m,areTagsEnabled:p}=e;const{loadRecommendedChatFolders:v,addChatFolder:g,openLimitReachedModal:A,openDeleteChatFolderModal:f,sortChatFolders:b,toggleDialogFilterTags:C,openPremiumModal:y}=(0,n.ko)(),[S,k]=(0,s.J0)({orderedFolderIds:c,dragOrderIds:c,draggedIndex:void 0}),w=(0,_.A)(c);(0,s.vJ)(()=>{w!==c&&k({orderedFolderIds:c,dragOrderIds:c,draggedIndex:void 0})},[w,c,S.orderedFolderIds?.length]),(0,s.vJ)(()=>{Fd(()=>{v()})},[v]);const N=(0,s.hb)(()=>{Object.keys(d).length>=m-1?A({limit:"dialogFilters"}):i()},[d,m,i,A]),I=(0,_i.A)();(0,Ce.A)({isActive:t,onBack:r});const P=(0,Sd.g5)(),Y=(0,s.Kr)(()=>{if(c)return c.length<=1?Ci.p:c.map(e=>{const t=d[e];return e===o.DSF?{id:e,title:{text:I("FilterAllChats"),entities:[]}}:{id:t.id,title:t.title,subtitle:(0,l.A5)(I,t,P[t.id]),isChatList:t.isChatList,color:t.color,noTitleAnimations:t.noTitleAnimations}})},[c,d,I,P]),F=(0,s.hb)(e=>{Object.keys(d).length>=m-1?A({limit:"dialogFilters"}):g({folder:e})},[d,m,g,A]),D=(0,s.hb)(()=>{h&&C({isEnabled:!p})},[p,h,C]),M=(0,s.hb)((e,t)=>{const i=Math.round(e.y/56),s=S.orderedFolderIds?.indexOf(t)||0,n=S.orderedFolderIds?.filter(e=>e!==t);n&&(0,ve.Bt)(s+i,0,c?.length||0)&&(n.splice(s+i+(h?0:1),0,t),k(e=>({...e,draggedIndex:s,dragOrderIds:n})))},[c?.length,h,S.orderedFolderIds]),T=(0,s.hb)(()=>{k(e=>(b({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0}))},[b]),B=(0,s.Kr)(()=>!h||Object.keys(d).length<m-1,[d,h,m]);return(0,te.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header",children:[(0,te.Y)(wr.A,{size:o.fwn,tgsUrl:kr.w.FoldersAll,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:I("CreateNewFilterInfo")}),B&&(0,te.FD)(Q.A,{className:"settings-button with-icon",color:"primary",pill:!0,fluid:!0,onClick:N,isRtl:I.isRtl,children:[(0,te.Y)(W.A,{name:"add"}),I("CreateNewFilter")]})]}),(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.Y)("h4",{className:"settings-item-header mb-3",dir:I.isRtl?"rtl":void 0,children:I("Filters")}),(0,te.Y)("div",{className:"settings-sortable-container",style:`height: ${56*(c?.length||0)}px`,children:Y?.length?Y.map((e,i)=>{const s=i>m-1,n=S.draggedIndex===i,r=56*(S.orderedFolderIds?.indexOf(e.id)??0),l=56*(S.dragOrderIds?.indexOf(e.id)??0),c=void 0!==e?.color&&-1!==e.color&&h;return e.id===o.DSF?(0,te.Y)(Yd.A,{id:e.id,onDrag:M,onDragEnd:T,style:`top: ${n?r:l}px;`,knobStyle:(I.isRtl?"left":"right")+": 0.375rem;",isDisabled:!h||!t,children:(0,te.FD)(ci.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0,allowSelection:!0,children:[(0,te.Y)("span",{className:"title",children:(0,Xi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,te.Y)("span",{className:"subtitle",children:I("FoldersAllChatsDesc")})]},e.id)},e.id):(0,te.Y)(Yd.A,{id:e.id,onDrag:M,onDragEnd:T,style:`top: ${n?r:l}px;`,knobStyle:`${I.isRtl?"left":"right"}: ${c?"3.5rem":"3rem"};`,isDisabled:s||!t,children:(0,te.FD)(ci.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{f({folderId:e.id})},destructive:!0,title:I("Delete"),icon:"delete"}],onClick:()=>{s?A({limit:"dialogFilters"}):a(d[e.id])},children:[(0,te.FD)("span",{className:"title",children:[(0,Xi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations}),s&&(0,te.Y)(W.A,{name:"lock-badge",className:"settings-folders-blocked-icon"})]}),(0,te.FD)("span",{className:"subtitle",children:[e.isChatList&&(0,te.Y)(W.A,{name:"link",className:"mr-1"}),e.subtitle]}),c&&(0,te.Y)("div",{className:(0,me.A)("settings-folders-color-circle",(0,Zi.a)({color:e.color}))})]})},e.id)}):Y&&!Y.length?(0,te.Y)("p",{className:"settings-item-description my-4",dir:"auto",children:I("SettingsFoldersEmpty")}):(0,te.Y)(xs.A,{})})]}),u&&Boolean(u.length)&&(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.Y)("h4",{className:"settings-item-header mb-3",dir:I.isRtl?"rtl":void 0,children:I("FilterRecommended")}),u.map(e=>(0,te.Y)(ci.A,{narrow:!0,onClick:()=>F(e),children:(0,te.FD)("div",{className:"settings-folders-recommended-item",children:[(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:(0,Xi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,te.Y)("span",{className:"subtitle",children:e.description})]}),(0,te.Y)(Q.A,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:I.isRtl,children:I("Add")})]})}))]}),(0,te.Y)("div",{className:"settings-item pt-3",children:(0,te.FD)("div",{className:"settings-item-relative",children:[(0,te.Y)(sn.A,{label:I("ShowFolderTags"),subLabel:I("ShowFolderTagsHint"),checked:h&&p,onChange:D,onClickLabel:e=>{h||(e.preventDefault(),y())}}),!h&&(0,te.Y)(W.A,{name:"lock-badge",className:"settings-folders-lock-icon"})]})})]})}));var Md=i(4438);const Td=(0,s.ph)((0,n.EK)(e=>{const{folderId:t,url:i,isLoading:s}=(0,c.nTw)(e).shareFolderScreen||{},n=t?(0,c.$aQ)(e,t):void 0,a=t?e.chatFolders.invites[t]?.find(e=>e.url===i):void 0;return{folderId:t,folder:n,url:i,isLoading:s,peerIds:a?.peerIds}})(e=>{let{isActive:t,onReset:i,folderId:a,folder:r,peerIds:d,url:h,isLoading:u}=e;const{createChatlistInvite:m,deleteChatlistInvite:p,editChatlistInvite:v,showNotification:g}=(0,n.ko)(),A=(0,_i.A)(),f=(0,T.A)(),[b,C]=(0,s.J0)(!1);(0,Ce.A)({isActive:t,onBack:i}),(0,s.vJ)(()=>{u||C(!1)},[u]),(0,s.vJ)(()=>{!h&&a&&t&&m({folderId:a})},[a,t,h]);const y=(0,M.A)(()=>{h&&a&&(p({folderId:a,url:h}),i())}),S=(0,s.Kr)(()=>(r?.includedChatIds||[]).concat(r?.pinnedChatIds||[]),[r?.includedChatIds,r?.pinnedChatIds]),[k,w]=(0,s.Kr)(()=>{const e=(0,n.mS)();return(0,bi.jB)(S,t=>(0,c.hXb)(e,t))},[S]),[N,I]=(0,s.J0)(d||[]),P=(0,s.li)(!0);(0,ki.A)(e=>{let[t]=e;t!==h&&(P.current=!0),P.current&&(P.current=!1,h?d&&I(d):I(k))},[h,k,d]);const Y=(0,M.A)(e=>{const t=(0,n.mS)(),i=(0,c.mBe)(t,e),s=(0,c.hds)(t,e);i&&(0,l.tv)(i)?g({message:f("FolderLinkScreen.AlertTextUnavailableBot")}):i?g({message:f("FolderLinkScreen.AlertTextUnavailableUser")}):s&&(0,l.WX)(s)?g({message:f("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):g({message:f("FolderLinkScreen.AlertTextUnavailablePublicGroup")})}),F=(0,M.A)(e=>{I(e),C(!0)}),D=(0,M.A)(()=>{a&&h&&b&&v({folderId:a,peerIds:N,url:h})}),B=N.length,R=!B||u;return(0,te.FD)("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker",children:[(0,te.FD)("div",{className:"settings-content-header",children:[(0,te.Y)(Md.A,{size:o.fwn,tgsUrl:kr.w.FoldersShare,className:"settings-content-icon"}),r&&(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:A("FolderLinkTitleDescription",{folder:(0,Xi.fd)({text:r.title.text,entities:r.title.entities,noCustomEmojiPlayback:r.noTitleAnimations}),chats:A("FolderLinkTitleDescriptionChats",{count:B},{pluralValue:B})},{withMarkdown:!0,withNodes:!0})})]}),(0,te.Y)(Wr.A,{className:"settings-item",link:h||f("Loading"),withShare:!0,onRevoke:y,isDisabled:!B||b}),(0,te.Y)("div",{className:"settings-item settings-item-picker",children:(0,te.Y)(yi.A,{itemIds:S,lockedUnselectedIds:w,onSelectedIdsChange:F,selectedIds:N,onDisabledClick:Y,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})}),(0,te.Y)(wi.A,{isShown:u||b,disabled:R,onClick:D,ariaLabel:"Save changes",children:u?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})})),Bd=(0,s.ph)(e=>{let{currentScreen:t,shownScreen:i,state:o,dispatch:r,isActive:l,onReset:c}=e;const{openShareChatFolderModal:d,editChatFolder:h,addChatFolder:u,openSettingsScreen:m}=(0,n.ko)(),p=(0,s.hb)(()=>{t!==a.VS.FoldersCreateFolder&&t!==a.VS.FoldersEditFolder&&t!==a.VS.FoldersEditFolderFromChatList&&t!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{r({type:"reset"})},200),t!==a.VS.FoldersIncludedChats&&t!==a.VS.FoldersExcludedChats?c():"create"===o.mode?m({screen:a.VS.FoldersCreateFolder}):m({screen:a.VS.FoldersEditFolder})},[o.mode,r,t,c]),v="create"===o.mode,g=(0,s.hb)(e=>{const{title:{text:t}}=e.folder;if(!t)return r({type:"setError",payload:Nd}),!1;const{selectedChatIds:i,selectedChatTypes:s}=(0,Cd.a)(e,"included");return i.length||Object.keys(s).length?(v?u({folder:e.folder}):h({id:e.folderId,folderUpdate:e.folder}),r({type:"setError",payload:void 0}),r({type:"setIsTouched",payload:!1}),!0):(r({type:"setError",payload:Id}),!1)},[r,v]),A=(0,s.hb)(e=>{g(o)&&e?.()},[g,o]),f=(0,s.hb)(()=>{r({type:"saveFilters"}),p()},[r,p]),b=(0,s.hb)(()=>{r({type:"reset"}),m({screen:a.VS.FoldersCreateFolder})},[r]),C=(0,s.hb)(e=>{r({type:"editFolder",payload:e}),m({screen:a.VS.FoldersEditFolder})},[r]),y=(0,s.hb)(()=>{r({type:"editIncludeFilters"}),m({screen:t===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersIncludedChatsFromChatList:a.VS.FoldersIncludedChats})},[t,r]),S=(0,s.hb)(()=>{r({type:"editExcludeFilters"}),m({screen:t===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersExcludedChatsFromChatList:a.VS.FoldersExcludedChats})},[t,r]),k=(0,s.hb)(()=>{d({folderId:o.folderId,noRequestNextScreen:!0}),r({type:"setIsChatlist",payload:!0}),m({screen:a.VS.FoldersShare})},[r,o.folderId]),w=(0,s.hb)(e=>{d({folderId:o.folderId,url:e,noRequestNextScreen:!0}),m({screen:a.VS.FoldersShare})},[o.folderId]);switch(t){case a.VS.Folders:return(0,te.Y)(Dd,{onCreateFolder:b,onEditFolder:C,isActive:l||[a.VS.FoldersCreateFolder,a.VS.FoldersEditFolder,a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(i),onReset:c});case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,te.Y)(Pd,{state:o,dispatch:r,onAddIncludedChats:y,onAddExcludedChats:S,onShareFolder:k,onOpenInvite:w,onReset:p,isActive:l||[a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(i),isOnlyInvites:t===a.VS.FoldersEditFolderInvites,onBack:c,onSaveFolder:A});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:return(0,te.Y)(kd,{mode:"included",state:o,dispatch:r,onReset:p,onSaveFilter:f,isActive:l});case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,te.Y)(kd,{mode:"excluded",state:o,dispatch:r,onReset:p,onSaveFilter:f,isActive:l});case a.VS.FoldersShare:return(0,te.Y)(Td,{isActive:l,onReset:p});default:return}});var Rd=i(70934),Ld=i(3178);const xd=(0,s.ph)(e=>{let{isActive:t,error:i,isLoading:n,shouldDisablePasswordManager:a,expectedPassword:o,placeholder:r,hint:l,submitLabel:c,onSubmit:d,onClearError:h,onReset:u}=e;const[m,p]=(0,s.J0)(""),[v,g]=(0,s.J0)(!1),A=(0,_i.A)(),f=(0,s.hb)(e=>{o&&e!==o?p(A("SettingsPasswordEqual")):d(e)},[d,o,A]),b=(0,s.hb)(()=>{h&&h(),p("")},[h]);return(0,Ce.A)({isActive:t,onBack:u}),(0,te.FD)("div",{className:"settings-content password-form custom-scroll",children:[(0,te.Y)("div",{className:"settings-content-header no-border",children:(0,te.Y)(Ld.A,{isBig:!0,isPasswordVisible:v})}),(0,te.Y)("div",{className:"settings-item settings-group",children:(0,te.Y)(Sl.A,{error:m||i,hint:l,placeholder:r||A("CurrentPasswordPlaceholder"),shouldDisablePasswordManager:a,submitLabel:c,onClearError:b,isLoading:n,isPasswordVisible:v,shouldResetValue:t,onChangePasswordVisibility:g,onSubmit:f})})]})}),Ed=(0,s.ph)(e=>{let{isActive:t,onReset:i}=e;const n=(0,T.A)(),a=(0,s.hb)(()=>{i(!0)},[i]);return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(Md.A,{size:o.BYH,tgsUrl:kr.w.Congratulations,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Congratulations!"}),(0,te.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,te.Y)("div",{className:"settings-item settings-group",children:(0,te.Y)(Q.A,{onClick:a,children:n("Back")})})]})});var Vd=i(89704);const _d=(0,s.ph)(e=>{let{isActive:t,onReset:i}=e;const{openSettingsScreen:s}=(0,n.ko)(),o=(0,T.A)();return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Lock,previewUrl:Vd,size:160,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Local passcode is enabled."})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{icon:"edit",onClick:()=>s({screen:a.VS.PasscodeChangePasscodeCurrent}),children:o("Passcode.Change")}),(0,te.Y)(ci.A,{icon:"password-off",onClick:()=>s({screen:a.VS.PasscodeTurnOff}),children:o("Passcode.TurnOff")})]})]})}),Ud=(0,s.ph)(e=>{let{isActive:t,onReset:i,onStart:s}=e;const n=(0,_i.A)();return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Lock,previewUrl:Vd,size:o.BYH,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description",dir:"auto",children:n("SettingsPasscodeStart1",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:n("SettingsPasscodeStart2",void 0,{withNodes:!0,renderTextFilters:["br"]})})]}),(0,te.Y)("div",{className:"settings-item settings-group",children:(0,te.Y)(Q.A,{onClick:s,children:n("EnablePasscode")})})]})}),Od=(0,s.ph)((0,n.EK)(e=>({...e.passcode}))(e=>{let{passcode:t,currentScreen:i,shownScreen:o,error:r,isActive:l,isLoading:c,onSetPasscode:d,onReset:h}=e;const{setPasscode:u,clearPasscode:m,setPasscodeError:p,clearPasscodeError:v,openSettingsScreen:g}=(0,n.ko)(),A=(0,T.A)(),f=(0,s.hb)(()=>{d(""),g({screen:a.VS.PasscodeNewPasscode})},[d]),b=(0,s.hb)(e=>{d(e),g({screen:a.VS.PasscodeNewPasscodeConfirm})},[d]),C=(0,s.hb)(()=>{u({passcode:t}),d(""),g({screen:a.VS.PasscodeCongratulations})},[d,t]),y=(0,s.hb)(e=>{d(""),(0,Rd.UQ)(e).then(()=>{g({screen:a.VS.PasscodeChangePasscodeNew})},()=>{p({error:A("PasscodeController.Error.Current")})})},[A,d]),S=(0,s.hb)(e=>{d(e),g({screen:a.VS.PasscodeChangePasscodeConfirm})},[d]),k=(0,s.hb)(e=>{(0,Rd.UQ)(e).then(()=>{m(),g({screen:a.VS.Privacy})},()=>{p({error:A("PasscodeController.Error.Current")})})},[A]);switch(i){case a.VS.PasscodeDisabled:return(0,te.Y)(Ud,{onStart:f,isActive:l||[a.VS.PasscodeNewPasscode,a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeNewPasscode:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,placeholder:A("EnterNewPasscode"),submitLabel:A("Continue"),onSubmit:b,isActive:l||[a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeNewPasscodeConfirm:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:A("ReEnterYourPasscode"),submitLabel:A("Continue"),isLoading:c,onSubmit:C,isActive:l||[a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeCongratulations:return(0,te.Y)(Ed,{isActive:l,onReset:h});case a.VS.PasscodeEnabled:return(0,te.Y)(_d,{isActive:l||[a.VS.PasscodeChangePasscodeCurrent,a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations,a.VS.PasscodeTurnOff].includes(o),onReset:h});case a.VS.PasscodeChangePasscodeCurrent:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,error:r,onClearError:v,placeholder:A("PasscodeController.Current.Placeholder"),onSubmit:y,isActive:l||[a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeChangePasscodeNew:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,placeholder:A("PleaseEnterNewFirstPassword"),onSubmit:S,isActive:l||[a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeChangePasscodeConfirm:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:A("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:c,onSubmit:C,isActive:l||[a.VS.PasscodeCongratulations].includes(o),onReset:h});case a.VS.PasscodeTurnOff:return(0,te.Y)(xd,{shouldDisablePasswordManager:!0,error:r?A(r):void 0,onClearError:v,placeholder:A("PasscodeController.Current.Placeholder"),onSubmit:k,isActive:l,onReset:h});default:return}})),Kd=[50,100,500,1e3,2e3,5e3,1e4];function Jd(e,t){const i=e.findIndex(e=>t<=e),s=e[i-1]||1,n=e[i]||e[e.length-1];return i+(t-s)/(n-s)}function Gd(e,t){const i=Math.floor(t),s=e[i-1]||1,n=s+((e[i]||e[e.length-1])-s)*(t-i);return n<100?Math.round(n):10*Math.round(n/10)}const jd=(0,s.ph)(e=>{let{min:t=0,max:i,value:n,disabled:a,readOnly:o,bold:r,className:l,defaultValue:c,onChange:d,canChangeChargeForMessages:h}=e;const u=(0,_i.A)(),m=(0,s.Kr)(()=>{const e=[];for(let t=0;t<Kd.length;t++)if(Kd[t]<i&&e.push(Kd[t]),Kd[t]>=i){e.push(i);break}return e},[i]),p=(0,M.A)(e=>{const t=Number(e.currentTarget.value);d(Gd(m,t))}),v=(0,me.A)(l,"RangeSlider",a&&"disabled",o&&"readOnly",r&&"bold");return(0,te.FD)("div",{className:v,children:[(0,te.FD)("div",{className:"slider-top-row",dir:u.isRtl?"rtl":void 0,children:[(0,te.Y)("span",{className:"value-min",dir:"auto",children:u.number(t)}),(0,te.FD)("span",{className:"settings-range-value",children:[!h&&(0,te.Y)(W.A,{name:"lock-badge"}),(0,xi.Kk)(u,Gd(m,Jd(m,n)))]}),(0,te.Y)("span",{className:"value-max",dir:"auto",children:u.number(i)})]}),(0,te.FD)("div",{className:"slider-main",children:[(0,te.Y)("div",{className:"slider-fill-track",style:`width: ${Jd(m,n)/m.length*100}%`}),(0,te.Y)("input",{min:0,max:m.length,defaultValue:Jd(m,c),step:"any",type:"range",className:"RangeSlider__input",onChange:p})]})]})}),zd=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.starsUsdWithdrawRateX1000,i=t?t/1e3:1,s=e.appConfig.starsPaidMessageCommissionPermille;return{starsPaidMessageCommissionPermille:s?s/1e3:100,starsUsdWithdrawRate:i,starsPaidMessageAmountMax:e.appConfig.starsPaidMessageAmountMax||o.$$v}})(function(e){let{starsUsdWithdrawRate:t,starsPaidMessageAmountMax:i,starsPaidMessageCommissionPermille:s,canChangeChargeForMessages:a,isGroupChat:r,chargeForMessages:l,onChange:c}=e;const{openPremiumModal:d}=(0,n.ko)(),h=(0,_i.A)(),u=(0,M.A)(e=>{c?.(e)}),m=(0,M.A)(()=>{d({initialSection:"message_privacy"})});return(0,te.FD)(te.FK,{children:[(0,te.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("SectionTitleStarsForForMessages")}),(0,te.Y)(jd,{defaultValue:l,min:o.BSg,max:i,value:l,onChange:u,canChangeChargeForMessages:a,readOnly:!a}),!a&&(0,te.Y)(Q.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:m,children:(0,te.FD)("span",{className:"settings-unlock-button-title",children:[h("UnlockButtonTitle"),(0,te.Y)(W.A,{name:"lock-badge",className:"settings-unlock-button-icon"})]})}),a&&(0,te.Y)("p",{className:"settings-item-description-larger",dir:h.isRtl?"rtl":void 0,children:h(r?"SetPriceGroupDescription":"SectionDescriptionStarsForForMessages",{percent:(0,$e.l9)(100*s),amount:(0,ua.Ad)(l*t*s,"USD",h.code)},{withNodes:!0})})]})}));var Hd=i(9267);const $d=(0,s.ph)(function(e){let{premiumSection:t}=e;const{openPremiumModal:i}=(0,n.ko)(),s=(0,T.A)(),a=(0,M.A)(()=>i({initialSection:t}));return(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{leftElement:(0,te.Y)(Hd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:a,children:s("PrivacyLastSeenPremium")}),(0,te.Y)("p",{className:"settings-item-description-larger premium-info",dir:s.isRtl?"rtl":void 0,children:s("lng_messages_privacy_premium_about")})]})}),qd=(0,s.ph)(function(e){let{label:t,isChecked:i}=e;const s=(0,T.A)(),{showNotification:a}=(0,n.ko)();return(0,te.FD)("div",{className:(0,me.A)("sBptmiga",i&&"U_6O1ebL"),onClick:()=>a({message:s("OptionPremiumRequiredMessage")}),children:[(0,te.Y)("span",{children:t}),(0,te.Y)(W.A,{name:"lock-badge",className:"jWxrRbkh"})]})}),Wd=(0,s.ph)((0,n.EK)(e=>{const{settings:{privacy:t}}=e,i=(0,c.Iv$)(e),s=e.settings.privacy.noPaidMessages?.allowUserIds.length||0;return{shouldNewNonContactPeersRequirePremium:(0,c.BSN)(e),shouldChargeForMessages:Boolean(i),nonContactPeersPaidStars:i||o.wZe,isCurrentUserPremium:(0,c.g29)(e),canLimitNewMessagesWithoutPremium:e.appConfig.canLimitNewMessagesWithoutPremium,canChargeForMessages:e.appConfig.starsPaidMessagesAvailable,noPaidReactionsForUsersCount:s,privacy:t}})(function(e){let{isActive:t,canLimitNewMessagesWithoutPremium:i,canChargeForMessages:o,shouldNewNonContactPeersRequirePremium:r,shouldChargeForMessages:l,nonContactPeersPaidStars:c,isCurrentUserPremium:d,noPaidReactionsForUsersCount:h,onReset:u,privacy:m}=e;const{updateGlobalPrivacySettings:p,openSettingsScreen:v,showNotification:g}=(0,n.ko)(),A=(0,T.A)(),f=(0,_i.A)(),b=d||i,C=d&&o,[y,S]=(0,s.J0)(c),[k,w]=(0,s.J0)(!1),N=(0,s.Kr)(()=>l?"charge_for_messages":r?"contacts_and_premium":"everybody",[l,r]);(0,ki.A)(e=>{let[t]=e;k||void 0===t||"everybody"===N||N===t||("everybody"===m.chatInvite?.visibility&&g({message:f("CheckPrivacyInviteText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyGroupChats}},actionText:{key:"Review"},duration:8e3}),"everybody"===m.phoneCall?.visibility&&g({message:f("CheckPrivacyCallsText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyPhoneCall}},actionText:{key:"Review"},duration:8e3}),w(!0))},[N,l,m,f,k]);const I=(0,s.Kr)(()=>[{value:"everybody",label:A("P2PEverybody")},{value:"contacts_and_premium",label:b?A("PrivacyMessagesContactsAndPremium"):(0,te.Y)(qd,{label:A("PrivacyMessagesContactsAndPremium"),isChecked:"contacts_and_premium"===N}),hidden:!b,isCanCheckedInDisabled:!0},{value:"charge_for_messages",label:C?f("PrivacyChargeForMessages"):(0,te.Y)(qd,{label:f("PrivacyChargeForMessages"),isChecked:"charge_for_messages"===N}),hidden:!C,isCanCheckedInDisabled:!0}],[A,f,b,C,N]),P=(0,M.A)(e=>{p({shouldNewNonContactPeersRequirePremium:"contacts_and_premium"===e,nonContactPeersPaidStars:"charge_for_messages"===e?y:null})}),Y=(0,fe.A)(e=>{p({nonContactPeersPaidStars:e})},[p],300,!0),F=(0,s.hb)(e=>{S(e),Y(e)},[S,Y]);(0,Ce.A)({isActive:t,onBack:u});const D=(0,s.Kr)(()=>f(l?"PrivacyDescriptionChargeForMessages":"PrivacyDescriptionMessagesContactsAndPremium"),[l,f]);return(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:A("PrivacyMessagesTitle")}),(0,te.Y)(ee.A,{name:"privacy-messages",options:I,onChange:P,selected:N}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:A.isRtl?"rtl":void 0,children:D})]}),"charge_for_messages"===N&&(0,te.Y)("div",{className:"settings-item fluid-container",children:(0,te.Y)(zd,{canChangeChargeForMessages:C,chargeForMessages:y,onChange:F})}),C&&"charge_for_messages"===N&&function(){const e=h?A("Users",h,"i"):f("SubtitlePrivacyAddUsers");return(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:f("RemoveFeeTitle")}),(0,te.Y)(ci.A,{narrow:!0,icon:"delete-user",onClick:()=>{v({screen:a.VS.PrivacyNoPaidMessages})},children:(0,te.FD)("div",{className:"multiline-item full-size",children:[(0,te.Y)("span",{className:"title",children:f("ExceptionTitlePrivacyChargeForMessages")}),(0,te.Y)("span",{className:"subtitle",children:e})]})})]})}(),!d&&"charge_for_messages"!==N&&(0,te.Y)($d,{premiumSection:"message_privacy"})]})}));function Qd(e){const t=e.platform.toLowerCase(),i=e.deviceModel.toLowerCase(),s=e.systemVersion.toLowerCase();return i.includes("xbox")?"xbox":i.includes("chrome")&&!i.includes("chromebook")?"chrome":i.includes("brave")?"brave":i.includes("vivaldi")?"vivaldi":i.includes("safari")?"safari":i.includes("firefox")?"firefox":i.includes("opera")?"opera":i.includes("samsungbrowser")?"samsung":t.includes("android")?"android":i.includes("iphone")||i.includes("ipad")||t.includes("ios")||t.includes("macos")||s.includes("macos")?"apple":t.includes("ubuntu")||s.includes("ubuntu")?"ubuntu":t.includes("linux")||s.includes("linux")?"linux":t.includes("windows")||s.includes("windows")?"windows":"unknown"}const Zd={SettingsActiveSession:"M84mrPgu",settingsActiveSession:"M84mrPgu",iconDevice:"Add8P_K4",iconDevice__android:"onkXVGY4",iconDeviceAndroid:"onkXVGY4",iconDevice__apple:"xw13aT8u",iconDeviceApple:"xw13aT8u",iconDevice__brave:"HESrGUdv",iconDeviceBrave:"HESrGUdv",iconDevice__chrome:"Vpej7wm7",iconDeviceChrome:"Vpej7wm7",iconDevice__edge:"ueWE77x9",iconDeviceEdge:"ueWE77x9",iconDevice__firefox:"_lMTmvya",iconDeviceFirefox:"_lMTmvya",iconDevice__linux:"cDVfvyG_",iconDeviceLinux:"cDVfvyG_",iconDevice__opera:"nWqlTxZt",iconDeviceOpera:"nWqlTxZt",iconDevice__safari:"ldFLp1Gf",iconDeviceSafari:"ldFLp1Gf",iconDevice__samsung:"VHNORBGL",iconDeviceSamsung:"VHNORBGL",iconDevice__ubuntu:"QBVivtdu",iconDeviceUbuntu:"QBVivtdu",iconDevice__unknown:"GbjIgrwU",iconDeviceUnknown:"GbjIgrwU",iconDevice__vivaldi:"yieVnjoI",iconDeviceVivaldi:"yieVnjoI",iconDevice__windows:"_0dnTFOE",iconDeviceWindows:"_0dnTFOE",iconDevice__xbox:"fbCjjDpU",iconDeviceXbox:"fbCjjDpU",title:"c6edjhlh",note:"lRqTZAYn",date:"oLnN6crs",box:"wVEXuPlZ",actionHeader:"olQS2T1n",actionName:"KuX1APpO",headerButton:"VT8pZfMu"};function Xd(e){return[e.region,e.country].filter(Boolean).join(", ")}const eh=(0,s.ph)((0,n.EK)((e,t)=>{let{hash:i}=t;return{session:i?e.activeSessions.byHash[i]:void 0}})(e=>{let{isOpen:t,session:i,onClose:a}=e;const{changeSessionSettings:o,terminateAuthorization:r}=(0,n.ko)(),l=(0,_i.A)(),c=(0,Bi.A)(i,!0),d=(0,s.hb)(()=>{o({hash:i.hash,areSecretChatsEnabled:!i.areSecretChatsEnabled})},[o,i]),h=(0,s.hb)(()=>{o({hash:i.hash,areCallsEnabled:!i.areCallsEnabled})},[o,i]),u=(0,s.hb)(()=>{r({hash:i.hash}),a()},[a,i,r]);if(c)return(0,te.FD)(X.A,{header:(0,te.FD)("div",{className:"modal-header-condensed",dir:l.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Close"),onClick:a,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:l("SessionPreviewTitle")}),(0,te.Y)(Q.A,{color:"danger",onClick:u,className:(0,me.A)("modal-action-button",Zd.headerButton),children:l("SessionPreviewTerminateSession")})]}),isOpen:t,hasCloseButton:!0,onClose:a,className:Zd.SettingsActiveSession,children:[(0,te.Y)("div",{className:(0,me.A)(Zd.iconDevice,c&&Zd[`iconDevice__${Qd(c)}`])}),(0,te.Y)("h3",{className:Zd.title,dir:"auto",children:c?.deviceModel}),(0,te.Y)("div",{className:Zd.date,"aria-label":l("PrivacySettingsLastSeen"),children:(0,He.L2)(1e3*c.dateActive,l.code)}),(0,te.FD)("dl",{className:Zd.box,children:[(0,te.Y)("dt",{children:l("SessionPreviewApp")}),(0,te.FD)("dd",{children:[c?.appName," ",c?.appVersion,","," ",c?.platform," ",c?.systemVersion]}),c?.ip&&(0,te.FD)(te.FK,{children:[(0,te.Y)("dt",{children:l("SessionPreviewIp")}),(0,te.Y)("dd",{children:c.ip})]}),(0,te.Y)("dt",{children:l("SessionPreviewLocation")}),(0,te.Y)("dd",{children:c&&Xd(c)})]}),(0,te.Y)("p",{className:Zd.note,children:l("SessionPreviewIpDesc")}),(0,te.Y)("h4",{className:Zd.actionHeader,children:l("AuthSessionsViewAcceptTitle")}),(0,te.FD)(ci.A,{onClick:d,children:[(0,te.Y)("span",{className:Zd.actionName,children:l("SessionPreviewAcceptSecret")}),(0,te.Y)(fi.A,{id:"accept_secrets",label:"On",checked:c.areSecretChatsEnabled})]}),(0,te.FD)(ci.A,{onClick:h,children:[(0,te.Y)("span",{className:Zd.actionName,children:l("SessionPreviewAcceptCalls")}),(0,te.Y)(fi.A,{id:"accept_calls",label:"On",checked:c.areCallsEnabled})]})]})}));function th(e){return[e.region,e.country].filter(Boolean).join(", ")}const ih=(0,s.ph)((0,n.EK)(e=>e.activeSessions)(e=>{let{isActive:t,onReset:i,byHash:a,orderedHashes:o,ttlDays:r}=e;const{terminateAuthorization:l,terminateAllAuthorizations:c,changeSessionTtl:d}=(0,n.ko)(),h=(0,T.A)(),u=(0,_i.A)(),[m,p,v]=(0,F.A)(),[g,A]=(0,s.J0)(),[f,b,C]=(0,F.A)(),y=(0,s.Kr)(()=>{if(void 0!==r)return r<=7?"7":r<=30?"30":r<=93?"90":r<=183?"183":r>183?"365":void 0},[r]),S=(0,s.Kr)(()=>{const e=[{label:u("Weeks",{count:1},{pluralValue:1}),value:"7"},{label:u("Months",{count:1},{pluralValue:1}),value:"30"},{label:u("Months",{count:3},{pluralValue:3}),value:"90"},{label:u("Months",{count:6},{pluralValue:6}),value:"183"}];return r&&r>=365&&e.push({label:u("Years",{count:1},{pluralValue:1}),value:"365"}),e},[u,r]),k=(0,s.hb)(e=>{l({hash:e})},[l]),w=(0,s.hb)(()=>{v(),c()},[v,c]),N=(0,s.hb)(e=>{A(e),b()},[b]),I=(0,s.hb)(()=>{A(void 0),C()},[C]),P=(0,s.hb)(e=>{d({days:Number(e)})},[d]),Y=(0,s.Kr)(()=>{const e=o.find(e=>a[e].isCurrent);return e?a[e]:void 0},[a,o]),D=(0,s.Kr)(()=>o.filter(e=>!a[e].isCurrent),[a,o]),M=Boolean(D.length);return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content custom-scroll SettingsActiveSessions",children:[Y&&(R=Y,(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("AuthSessionsCurrentSession")}),(0,te.Y)(ci.A,{narrow:!0,inactive:!0,icon:`device-${Qd(R)}`,iconClassName:"icon-device",children:(0,te.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,te.Y)("span",{className:"title",dir:"auto",children:R.deviceModel}),(0,te.FD)("span",{className:"subtitle black tight",children:[R.appName," ",R.appVersion,","," ",R.platform," ",R.systemVersion]}),(0,te.FD)("span",{className:"subtitle",children:[R.ip," ","-"," ",th(R)]})]})}),M&&(0,te.Y)(ci.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:p,children:u("TerminateAllSessions")})]})),M&&(B=D,(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("OtherSessions")}),B.map(function(e){const t=a[e];return(0,te.Y)(ci.A,{ripple:!0,narrow:!0,contextActions:[{title:u("SessionTerminate"),icon:"stop",destructive:!0,handler:()=>{k(t.hash)}}],icon:`device-${Qd(t)}`,iconClassName:"icon-device",onClick:()=>{N(t.hash)},children:(0,te.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,te.Y)("span",{className:"date",children:(0,He.be)(h,1e3*t.dateActive)}),(0,te.Y)("span",{className:"title",children:t.deviceModel}),(0,te.FD)("span",{className:"subtitle black tight",children:[t.appName," ",t.appVersion,","," ",t.platform," ",t.systemVersion]}),(0,te.FD)("span",{className:"subtitle",children:[t.ip," ",th(t)]})]})},t.hash)})]})),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("TerminateOldSessionHeader")}),(0,te.Y)("p",{className:"settings-item-description-larger",children:u("IfInactiveFor")}),(0,te.Y)(ee.A,{name:"session_ttl",options:S,selected:y,onChange:P})]}),M&&(0,te.Y)(vi.A,{isOpen:m,onClose:v,text:u("AreYouSureSessions"),confirmLabel:u("TerminateAllSessions"),confirmHandler:w,confirmIsDestructive:!0,areButtonsInColumn:!0}),(0,te.Y)(eh,{isOpen:f,hash:g,onClose:I})]});var B,R})),sh="YRYk96ki",nh=(0,s.ph)((0,n.EK)((e,t)=>{let{hash:i}=t;const s=i?e.activeWebSessions.byHash[i]:void 0;return{session:s,bot:s?e.users.byId[s.botId]:void 0}})(e=>{let{isOpen:t,session:i,bot:a,onClose:o}=e;const{terminateWebAuthorization:r}=(0,n.ko)(),l=(0,T.A)(),c=(0,Bi.A)(i,!0),d=(0,Bi.A)(a,!0),h=(0,s.hb)(()=>{r({hash:i.hash}),o()},[o,i,r]);if(c)return(0,te.FD)(X.A,{header:(0,te.FD)("div",{className:"modal-header-condensed",dir:l.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Close"),onClick:o,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:l("WebSessionsTitle")}),(0,te.Y)(Q.A,{color:"danger",onClick:h,className:(0,me.A)("modal-action-button","lUf0RJ2h"),children:l("AuthSessions.LogOut")})]}),isOpen:t,hasCloseButton:!0,onClose:o,className:"Wd0fmiSY",children:[(0,te.Y)(Mt.A,{className:"OhZHdRsP",peer:d,size:"large"}),d&&(0,te.Y)(Es.A,{className:"EQ7__xGn",peer:d}),(0,te.Y)("div",{className:sh,children:c?.domain}),(0,te.FD)("dl",{className:"kmCTIfvf",children:[(0,te.Y)("dt",{children:l("AuthSessions.View.Browser")}),(0,te.Y)("dd",{children:c?.browser}),(0,te.Y)("dt",{children:l("SessionPreview.Ip")}),(0,te.Y)("dd",{children:c?.ip}),(0,te.Y)("dt",{children:l("SessionPreview.Location")}),(0,te.Y)("dd",{children:c?.region})]}),(0,te.Y)("p",{className:sh,children:l("AuthSessions.View.LocationInfo")})]})})),ah={avatar:"v0wP46TR","clear-help":"WnnxcARX",clearHelp:"WnnxcARX",subtitle:"uEUfjByC"},oh=(0,s.ph)((0,n.EK)(e=>{const{byHash:t,orderedHashes:i}=e.activeWebSessions;return{byHash:t,orderedHashes:i}})(e=>{let{isActive:t,byHash:i,orderedHashes:a,onReset:o}=e;const{terminateWebAuthorization:r,terminateAllWebAuthorizations:l}=(0,n.ko)(),c=(0,T.A)(),[d,h,u]=(0,F.A)(),[m,p]=(0,s.J0)(),[v,g,A]=(0,F.A)(),f=(0,s.hb)(e=>{r({hash:e})},[r]),b=(0,s.hb)(()=>{u(),l()},[u,l]),C=(0,s.hb)(e=>{p(e),g()},[g]),y=(0,s.hb)(()=>{p(void 0),A()},[A]);var S;if((0,s.vJ)(()=>{a.length||o()},[o,a]),(0,Ce.A)({isActive:t,onBack:o}),a.length)return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h,children:c("AuthSessions.LogOutApplications")}),(0,te.Y)("p",{className:(0,me.A)("settings-item-description",ah.clearHelp),children:c("ClearOtherWebSessionsHelp")})]}),(S=a,(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:c("WebSessionsTitle")}),S.map(function(e){const t=i[e],s=(0,n.mS)().users.byId[t.botId];return(0,te.FD)(ci.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{f(t.hash)}}],onClick:()=>C(t.hash),children:[(0,te.Y)(Mt.A,{className:ah.avatar,peer:s,size:"tiny"}),(0,te.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,te.Y)("span",{className:"date",children:(0,He.be)(c,1e3*t.dateActive)}),s&&(0,te.Y)(Es.A,{className:ah.title,peer:s}),(0,te.FD)("span",{className:(0,me.A)("subtitle","black","tight",ah.platform),children:[t.domain,",",t.browser,",",t.platform]}),(0,te.FD)("span",{className:(0,me.A)("subtitle",ah.subtitle),children:[t.ip," ",t.region]})]})]},t.hash)})]})),(0,te.Y)(vi.A,{isOpen:d,onClose:u,title:c("AuthSessions.LogOutApplications"),text:c("AreYouSureWebSessions"),confirmHandler:b,confirmIsDestructive:!0}),(0,te.Y)(nh,{isOpen:v,hash:m,onClose:y})]})})),rh=(0,s.ph)(e=>{let{stickerSet:t,noPlay:i,className:s,observeIntersection:n,onClick:a}=e;const r=(0,T.A)(),l=t?.stickers?.[0],c=(0,M.A)(()=>{l&&a(l)});if(t?.stickers)return(0,te.FD)(ci.A,{className:(0,me.A)("StickerSetCard","small-icon",s),style:"height: 56px;",inactive:!l,onClick:c,children:[function(){if(t)return t.hasThumbnail||!l?(0,te.Y)(Q.A,{ariaLabel:t.title,color:"translucent",isRtl:r.isRtl,children:(0,te.Y)(gr,{stickerSet:t,size:o.RCH,noPlay:i,observeIntersection:n})}):(0,te.Y)(yr,{sticker:l,size:o.RCH,title:t.title,noPlay:i,observeIntersection:n,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("div",{className:"title",children:t.title}),(0,te.Y)("div",{className:"subtitle",children:r("StickerPack.StickerCount",t.count,"i")})]})]})}),lh=(0,s.ph)((0,n.EK)(e=>({...(0,bi.Up)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,canPlayAnimatedEmojis:(0,c.BWX)(e)}))(e=>{let{isActive:t,customEmojiSetIds:i,stickerSetsById:a,shouldSuggestCustomEmoji:o,canPlayAnimatedEmojis:r,onReset:l}=e;const{openStickerSet:c,setSettingOption:d}=(0,n.ko)(),h=(0,T.A)(),u=(0,s.li)(),{observe:m}=(0,lr.BL)({rootRef:u});(0,Ce.A)({isActive:t,onBack:l});const p=(0,s.hb)(e=>{c({stickerSetInfo:e.stickerSetInfo})},[c]),v=(0,s.hb)(e=>{d({shouldSuggestCustomEmoji:e})},[d]),g=(0,s.Kr)(()=>i&&Object.values((0,bi.Up)(a,i)),[i,a]);return(0,te.Y)("div",{className:"settings-content custom-scroll",children:g&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:h("SuggestAnimatedEmoji"),checked:o,onCheck:v}),(0,te.Y)("div",{className:"mt-4",ref:u,children:g.map(e=>(0,te.Y)(rh,{stickerSet:e,observeIntersection:m,onClick:p,noPlay:!r},e.id))}),(0,te.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Dt.A)(h("EmojiBotInfo"),["links"])})]})})})),ch=(0,s.ph)((0,n.EK)(e=>(0,bi.Up)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"]))(e=>{let{isActive:t,onReset:i,canAutoLoadPhotoFromContacts:a,canAutoLoadPhotoInPrivateChats:r,canAutoLoadPhotoInGroups:l,canAutoLoadPhotoInChannels:c,canAutoLoadVideoFromContacts:d,canAutoLoadVideoInPrivateChats:h,canAutoLoadVideoInGroups:u,canAutoLoadVideoInChannels:m,canAutoLoadFileFromContacts:p,canAutoLoadFileInPrivateChats:v,canAutoLoadFileInGroups:g,canAutoLoadFileInChannels:A,autoLoadFileMaxSizeMb:f}=e;const{setSettingOption:b}=(0,n.ko)(),C=(0,_i.A)();(0,Ce.A)({isActive:t,onBack:i});const y=(0,s.hb)(e=>C("AutodownloadSizeLimitUpTo",{limit:C("FileSizeMB",{count:o.$gx[e]})}),[C]),S=(0,s.hb)(e=>{b({autoLoadFileMaxSizeMb:o.$gx[e]})},[b]);function k(){const e=o.$gx.indexOf(f);return(0,te.Y)("div",{className:"pt-5",children:(0,te.Y)(We.A,{label:C("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:y,onChange:S})})}function w(e,t,i,s,n,a){return(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0,children:e}),(0,te.Y)(sn.A,{label:C("AutoDownloadSettingsContacts"),checked:i,onCheck:e=>b({[`canAutoLoad${t}FromContacts`]:e})}),(0,te.Y)(sn.A,{label:C("AutoDownloadSettingsPrivateChats"),checked:s,onCheck:e=>b({[`canAutoLoad${t}InPrivateChats`]:e})}),(0,te.Y)(sn.A,{label:C("AutoDownloadSettingsGroupChats"),checked:n,onCheck:e=>b({[`canAutoLoad${t}InGroups`]:e})}),(0,te.Y)(sn.A,{label:C("AutoDownloadSettingsChannels"),checked:a,onCheck:e=>b({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&k()]})}return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[w(C("AutoDownloadPhotosTitle"),"Photo",a,r,l,c),w(C("AutoDownloadVideosTitle"),"Video",d,h,u,m),w(C("AutoDownloadFilesTitle"),"File",p,v,g,A)]})})),dh={root:"Ys1i4ssl",item:"skaVPMTF"},hh=["af","als","am","an","ar","arz","as","ast","av","az","azb","ba","bar","bcl","be","bg","bh","bn","bo","bpy","br","bs","bxr","ca","cbk","ce","ceb","ckb","co","cs","cv","cy","da","de","diq","dsb","dty","dv","el","eml","en","eo","es","et","eu","fa","fi","fr","frr","fy","ga","gd","gl","gn","gom","gu","gv","he","hi","hif","hr","hsb","ht","hu","hy","ia","id","ie","ilo","io","is","it","ja","jbo","jv","ka","kk","km","kn","ko","krc","ku","kv","kw","ky","la","lb","lez","li","lmo","lo","lrc","lt","lv","mai","mg","mhr","min","mk","ml","mn","mr","mrj","ms","mt","mwl","my","myv","mzn","nah","nap","nds","ne","new","nl","nn","no","oc","or","os","pa","pam","pfl","pl","pms","pnb","ps","pt","qu","rm","ro","ru","rue","sa","sah","sc","scn","sco","sd","sh","si","sk","sl","so","sq","sr","su","sv","sw","ta","te","tg","th","tk","tl","tr","tt","tyv","ug","uk","ur","uz","vec","vep","vi","vls","vo","wa","war","wuu","xal","xmf","yi","yo","yue","zh"],uh=o.N89.filter(e=>hh.includes(e)),mh=(0,s.ph)((0,n.EK)(e=>{const{doNotTranslate:t}=e.settings.byKey;return{doNotTranslate:t}})(e=>{let{isActive:t,doNotTranslate:i,onReset:a}=e;const{setSettingOption:o}=(0,n.ko)(),r=(0,T.A)().code||"en",[l,c]=(0,s.J0)([]),[d,h]=(0,s.J0)(""),u=(0,s.Kr)(()=>{const e=uh.map(e=>({langCode:e,translatedName:new Intl.DisplayNames([r],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})).filter(Boolean).map(e=>{let{langCode:t,translatedName:i,originalName:s}=e;return{label:i,subLabel:s,value:t}});if(!d.trim()){const t=e.find(e=>e.value===r),i=e.filter(e=>e.value!==r);return t?[t,...i]:e}return e?.filter(e=>e.label.toLowerCase().includes(d.toLowerCase()))},[r,d]);(0,ki.A)(e=>{let[s,n]=e;if(s===t&&n?.find(e=>e===r))return;const[a]=(0,bi.jB)(u,e=>i.includes(e.value));c([...a.map(e=>e.value)])},[t,i,l.length,r,u]);const m=(0,M.A)(e=>{c(e),o({doNotTranslate:e})});return(0,Ce.A)({isActive:t,onBack:a}),(0,te.Y)("div",{className:(0,me.A)(dh.root,"settings-content infinite-scroll"),children:(0,te.Y)("div",{className:(0,me.A)(dh.item),children:(0,te.Y)(wo,{className:dh.picker,items:u,selectedValues:l,onSelectedValuesChange:m,filterValue:d,onFilterChange:h,isSearchable:!0,allowMultiple:!0,withDefaultPadding:!0,itemInputType:"checkbox",searchInputId:"lang-picker-search"})})})})),ph=(0,s.ph)(e=>{let{chatId:t,usernames:i,onEditUsername:a}=e;const{showNotification:o,toggleUsername:r,toggleChatUsername:l,sortUsernames:c,sortChatUsernames:d}=(0,n.ko)(),h=(0,T.A)(),[u,m]=(0,s.J0)(),p=(0,s.Kr)(()=>i.map(e=>{let{username:t}=e;return t}),[i]),v=(0,_.A)(p),[g,A]=(0,s.J0)({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0});(0,s.vJ)(()=>{v!==p&&A({orderedUsernames:p,dragOrderUsernames:p,draggedIndex:void 0})},[v,p]);const f=(0,s.hb)(e=>{(0,mc.eM)(`@${e}`),o({message:h("UsernameCopied")})},[h,o]),b=(0,s.hb)(e=>{e.isEditable?a(e.username):m(e)},[a]),C=(0,s.hb)(()=>{m(void 0)},[]),y=(0,s.hb)(()=>{u&&(t?l({chatId:t,username:u.username,isActive:!u.isActive}):r({username:u.username,isActive:!u.isActive}),C())},[t,C,l,r,u]),S=(0,s.hb)((e,t)=>{const i=Math.round(e.y/56),s=g.orderedUsernames?.indexOf(t)||0,n=g.orderedUsernames?.filter(e=>e!==t);n&&(0,ve.Bt)(s+i,0,p.length)&&(n.splice(s+i,0,t),A(e=>({...e,draggedIndex:s,dragOrderUsernames:n})))},[g.orderedUsernames,p.length]),k=(0,s.hb)(()=>{A(e=>(t?d({chatId:t,usernames:e.dragOrderUsernames}):c({usernames:e.dragOrderUsernames}),{...e,orderedUsernames:e.dragOrderUsernames,draggedIndex:void 0}))},[t,d,c]);return(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"PaO1MMi5",children:[(0,te.Y)("h4",{className:"wSswdVkR",dir:h.isRtl?"rtl":void 0,children:h("lng_usernames_subtitle")}),(0,te.Y)("div",{className:"lAeeBh9K",style:`height: ${56*i.length}px`,children:i.map((e,t)=>{const i=g.draggedIndex===t,s=56*(g.orderedUsernames?.indexOf(e.username)??0),n=56*(g.dragOrderUsernames?.indexOf(e.username)??0),a=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return(0,te.Y)(Yd.A,{id:e.username,onDrag:S,onDragEnd:k,style:`top: ${i?s:n}px;`,knobStyle:(h.isRtl?"left":"right")+": 3rem;",isDisabled:!e.isActive,children:(0,te.FD)(ci.A,{className:(0,me.A)("drag-item no-icon","l04OwRBg"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{f(e.username)},title:h("Copy"),icon:"copy"}],onClick:()=>{b(e)},children:[(0,te.FD)("span",{className:"title",children:["@",e.username]}),(0,te.Y)("span",{className:"subtitle",children:h(a)})]},e.username)},e.username)})}),(0,te.Y)("p",{className:"oiJc22Aj",dir:h.isRtl?"rtl":void 0,children:h("lng_usernames_description")})]}),(0,te.Y)(vi.A,{isOpen:Boolean(u),onClose:C,title:h(u?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:h(u?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:h(u?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:y,confirmIsDestructive:!u?.isActive})]})});var vh=i(11116);const gh=/https:\/\/t\.me\/?/i,Ah=(0,ge.sg)(e=>e(),250,!1),fh=(0,s.ph)(e=>{let{currentUsername:t,asLink:i,isLoading:a,isUsernameAvailable:r,checkedUsername:l,onChange:c}=e;const{checkUsername:d,checkPublicLink:h}=(0,n.ko)(),[u,m]=(0,s.J0)(t||""),p=(0,T.A)(),v=i?"SetUrl":"Username",g=p(i?"SetUrlPlaceholder":"Username"),A=(0,_.A)(r),f=t!==u?r??A:void 0,b=u&&t!==u&&l!==u,[C,y]=(0,s.Kr)(()=>u.length?u.length<vh.tX?[void 0,p(`${v}InvalidShort`)]:u.length>vh.Tk?[void 0,p(`${v}InvalidLong`)]:vh.Ny.test(u)?void 0===f||b?[]:[f?p(`${v}Available`,g):void 0,!1===f?p(`${v}InUse`):void 0]:[void 0,p(`${v}Invalid`)]:[],[u,f,b,p,v,g]);(0,s.vJ)(()=>{m(t||"")},[i,t]);const S=(0,s.hb)(e=>{const s=e.target.value.trim();if(i&&!s.match(gh))return void(s.length||(m(""),c?.("")));const n=s.replace(gh,"");m(n),(""===n||(0,vh.BU)(n,!0))&&(c?.(n),Ah(()=>{n!==t&&(i?h:d)({username:n})}))},[i,h,d,t,c]);return(0,te.Y)(Z.A,{value:`${i?o.jsp:""}${u}`,onChange:S,label:b?p("Checking"):g,error:y,success:C,readOnly:a,teactExperimentControlled:!0})});var bh=i(43434);const Ch=(0,ge.nF)(e=>e(),6e4,!0),yh="Please provide your first name",Sh=(0,s.ph)((0,n.EK)(e=>{const{currentUserId:t}=e,{progress:i,isUsernameAvailable:s,checkedUsername:n,error:a}=(0,c.nTw)(e).profileEdit||{},o=t?(0,c.mBe)(e,t):void 0,r=(0,ha.d)(e,"aboutLength"),{firstName:d,lastName:h,usernames:u}=o||{},m=t?(0,c.vGo)(e,t):void 0;return{currentAvatarHash:o&&(0,l.cP)(o),currentFirstName:d,currentLastName:h,currentBio:m?.bio,progress:i,isUsernameAvailable:s,checkedUsername:n,editUsernameError:a,maxBioLength:r,usernames:u}})(e=>{let{isActive:t,currentAvatarHash:i,currentFirstName:r,currentLastName:l,currentBio:c,progress:d,checkedUsername:h,editUsernameError:u,isUsernameAvailable:m,maxBioLength:p,usernames:v,onReset:g}=e;const{loadCurrentUser:A,updateProfile:f}=(0,n.ko)(),b=(0,T.A)(),C=(0,s.Kr)(()=>v?.find(e=>{let{isEditable:t}=e;return t}),[v]),y=C?.username||"",[S,k]=(0,s.J0)(!1),[w,N]=(0,s.J0)(!1),[I,P]=(0,s.J0)(),[Y,F]=(0,s.J0)(),[D,M]=(0,s.J0)(r||""),[B,R]=(0,s.J0)(l||""),[L,x]=(0,s.J0)(c||""),[E,V]=(0,s.J0)(y),U=(0,z.A)(i,!1,O.qZ.BlobUrl),K=d===a.DV.InProgress,J=!1===E,G=(0,_.A)(m),j=m??G,H=v&&v.length>1,$=(0,s.Kr)(()=>!J&&(Boolean(Y)||w||S&&!0===j),[J,Y,w,S,j]);(0,Ce.A)({isActive:t,onBack:g}),(0,s.vJ)(()=>{Ch(()=>{A()})},[A]),(0,s.vJ)(()=>{F(void 0)},[U]),(0,s.vJ)(()=>{M(r||""),R(l||""),x(c||"")},[r,l,c]),(0,s.vJ)(()=>{V(y||"")},[y]),(0,s.vJ)(()=>{d===a.DV.Complete&&(N(!1),k(!1),P(void 0))},[d]);const q=(0,s.hb)(e=>{F(e)},[]),Q=(0,s.hb)(e=>{M(e.target.value),N(!0)},[]),X=(0,s.hb)(e=>{R(e.target.value),N(!0)},[]),ee=(0,s.hb)(e=>{x(e.target.value),N(!0)},[]),ie=(0,s.hb)(e=>{V(e),k(y!==e)},[y]),se=(0,s.hb)(()=>{const e=D.trim(),t=B.trim(),i=L.trim();E&&(e.length?f({photo:Y,...w&&{firstName:e,lastName:t,bio:i},...S&&{username:E}}):P(yh))},[Y,D,B,L,w,E,S,f]);return(0,te.FD)("div",{className:"settings-fab-wrapper",children:[(0,te.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.FD)("div",{className:"settings-input",children:[(0,te.Y)(bh.A,{currentAvatarBlobUrl:U,onChange:q,title:"Edit your profile photo",disabled:K}),(0,te.Y)(Z.A,{value:D,onChange:Q,label:b("FirstName"),disabled:K,error:I===yh?I:void 0}),(0,te.Y)(Z.A,{value:B,onChange:X,label:b("LastName"),disabled:K}),(0,te.Y)(Dl.A,{value:L,onChange:ee,label:b("UserBio"),disabled:K,maxLength:p,maxLengthIndicator:p?(p-L.length).toString():void 0})]}),(0,te.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:(0,Dt.A)(b("lng_settings_about_bio"),["br","simple_markdown"])})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0,children:b("Username")}),(0,te.Y)("div",{className:"settings-input",children:(0,te.Y)(fh,{currentUsername:y,isLoading:K,isUsernameAvailable:m,checkedUsername:h,onChange:ie})}),u===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,te.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:b("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,te.Y)(pl.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,te.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:(0,Dt.A)(b("UsernameHelp"),["br","simple_markdown"])}),E&&(0,te.FD)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:[b("lng_username_link"),(0,te.Y)("br",{}),(0,te.FD)("span",{className:"username-link",children:[o.jsp,E]})]})]}),H&&(0,te.Y)(ph,{usernames:v,onEditUsername:V})]}),(0,te.Y)(wi.A,{isShown:$,onClick:se,disabled:K,ariaLabel:b("Save"),children:K?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})}));var kh=i(61182),wh=i(4350),Nh=i(93855),Ih=i(15006);const Ph=(0,s.ph)((0,n.EK)(e=>{const{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}=(0,vn.l)(e);return{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}})(e=>{let{isActive:t,shouldForceHttpTransport:i,shouldAllowHttpTransport:a,shouldCollectDebugLogs:r,shouldDebugExportedSenders:l,onReset:c}=e;const{requestConfetti:d,setSharedSettingOption:h,requestWave:m}=(0,n.ko)(),p=(0,s.li)(),[v,g]=(0,s.J0)(!1),A=(0,T.A)(),f=(0,Nh.A)();(0,Ce.A)({isActive:t,onBack:c});const b=(0,M.A)(()=>{const e=new File([(0,kh.F8)()],o.lFE,{type:"text/plain"}),t=URL.createObjectURL(e);(0,Li.A)(t,o.lFE)}),C=(0,M.A)(e=>{m({startX:e.clientX,startY:e.clientY})}),y=(0,M.A)(()=>{d({withStars:!0})}),S=(0,M.A)(()=>{const e=p.current;e&&(0,Ih.U)(e)&&(g(!0),setTimeout(()=>{g(!1)},1500))}),k=(0,s.Kr)(()=>{if(!Object.values(f).length)return;let e=1;for(;f[e];)e+=1;return(0,wh.Nv)(e,!0,!0)},[f]);return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),(0,te.Y)("p",{className:"settings-item-description pt-3",dir:"auto",children:A("lng_settings_experimental_about")})]}),(0,te.Y)("div",{className:"settings-item",children:(0,te.Y)(ci.A,{href:k,icon:"add-user",children:(0,te.Y)("div",{className:"title",children:"Login on Test Server"})})}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{onClick:y,icon:"animations",children:(0,te.Y)("div",{className:"title",children:"Launch some confetti!"})}),(0,te.Y)(ci.A,{onClick:C,icon:"story-expired",disabled:!u.J6,children:(0,te.Y)("div",{className:"title",children:"Start wave"})}),(0,te.Y)(ci.A,{ref:p,onClick:S,icon:"spoiler",disabled:!u.bW,style:v?"visibility: hidden":"",children:(0,te.Y)("div",{className:"title",children:"Vaporize this button"})})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:"Allow HTTP Transport",checked:Boolean(a),onCheck:()=>h({shouldAllowHttpTransport:!a})}),(0,te.Y)(sn.A,{label:"Force HTTP Transport",disabled:!a,checked:Boolean(i),onCheck:()=>h({shouldForceHttpTransport:!i})})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:A("DebugMenuEnableLogs"),checked:Boolean(r),onCheck:()=>h({shouldCollectDebugLogs:!r})}),(0,te.Y)(sn.A,{label:"Enable exported senders debug",checked:Boolean(l),onCheck:()=>h({shouldDebugExportedSenders:!l})}),(0,te.Y)(ci.A,{onClick:b,icon:"bug",children:(0,te.Y)("div",{className:"title",children:"Download log"})})]})]})}));var Yh=i(6e4),Fh=i(84382);const Dh=(0,s.ph)((0,n.EK)(e=>{const{theme:t,shouldUseSystemTheme:i,messageSendKeyCombo:s,messageTextSize:n,timeFormat:a}=(0,vn.l)(e);return{messageSendKeyCombo:s,messageTextSize:n,timeFormat:a,theme:t,shouldUseSystemTheme:i}})(e=>{let{isActive:t,messageTextSize:i,messageSendKeyCombo:o,timeFormat:r,theme:l,shouldUseSystemTheme:c,onReset:d}=e;const{setSharedSettingOption:h,openSettingsScreen:m}=(0,n.ko)(),p=(0,_i.A)(),{isMobile:v}=(0,Y.Ay)(),g=v&&(u.pz||u.Ni),A=[{label:p("SettingsTimeFormat12"),value:"12h"},{label:p("SettingsTimeFormat24"),value:"24h"}],f=[{label:p("EmptyChatAppearanceLight"),value:"light"},{label:p("EmptyChatAppearanceDark"),value:"dark"},{label:p("EmptyChatAppearanceSystem"),value:"auto"}],b=g?void 0:[{value:"enter",label:p("SettingsSendEnter"),subLabel:p("SettingsSendEnterDescription")},{value:"ctrl-enter",label:p(u.MP||u.pz?"SettingsSendCmdenter":"SettingsSendCtrlenter"),subLabel:p("SettingsSendPlusEnterDescription")}],C=(0,s.hb)(e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,u.pz?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),h({messageTextSize:e})},[]),y=(0,s.hb)(e=>{const t="auto"===e?(0,Fh.V)():e;h({theme:t}),h({shouldUseSystemTheme:"auto"===e})},[]),S=(0,s.hb)(e=>{h({timeFormat:e}),h({wasTimeFormatSetManually:!0}),(0,Yh.bV)(e)},[]),k=(0,s.hb)(e=>{h({messageSendKeyCombo:e})},[]);return(0,Ce.A)({isActive:t,onBack:d}),(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0,children:p("Settings")}),(0,te.Y)(We.A,{label:p("TextSize"),min:12,max:20,value:i,onChange:C}),(0,te.Y)(ci.A,{icon:"photo",narrow:!0,onClick:()=>m({screen:a.VS.GeneralChatBackground}),children:p("ChatBackground")})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0,children:p("Theme")}),(0,te.Y)(ee.A,{name:"theme",options:f,selected:c?"auto":l,onChange:y})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0,children:p("SettingsTimeFormat")}),(0,te.Y)(ee.A,{name:"timeformat",options:A,selected:r,onChange:S})]}),b&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0,children:p("SettingsKeyboard")}),(0,te.Y)(ee.A,{name:"keyboard-send-settings",options:b,onChange:k,selected:o})]})]})}));var Mh=i(52844),Th=i(74824);const Bh=(0,s.ph)(e=>{let{wallpaper:t,theme:i,isSelected:n,onClick:r}=e;const{slug:l,document:c}=t,d=`wallpaper${c.id}`,h=c.previewBlobUrl,u=(0,z.A)(`${d}?size=m`),m=(0,Vi.A)(c.thumbnail?.dataUri,Boolean(u),!0),{transitionClassNames:p}=(0,Ke.A)(Boolean(u||h),void 0,void 0,"slow"),v=(0,s.li)(!1),[g,A]=(0,s.J0)(!1),{mediaData:f,loadProgress:b}=(0,H.A)(d,!g),C=!1===(0,_.A)(g),{shouldRender:y,transitionClassNames:S}=(0,Ke.A)(g&&!f||l===a.Vw,void 0,C,"slow"),k=(0,s.li)();k.current=i;const w=(0,s.hb)(()=>{(async()=>{const e=await(0,J.sZ)(f);await Th.save(o.nfi,k.current,e),r(l)})()},[f,r,l]);(0,s.vJ)(()=>{f&&v.current&&(w(),v.current=!1)},[f,w]);const N=(0,s.hb)(()=>{f?w():(v.current=!0,A(e=>!e))},[f,w]),I=(0,me.A)("WallpaperTile",n&&"selected");return(0,te.Y)("div",{className:I,onClick:N,children:(0,te.FD)("div",{className:"media-inner",children:[(0,te.Y)("canvas",{ref:m,className:"thumbnail"}),(0,te.Y)("img",{src:u||h,className:(0,me.A)("full-media",p),alt:"",draggable:!1}),y&&(0,te.Y)("div",{className:(0,me.A)("spinner-container",S),children:(0,te.Y)(he.A,{progress:b,onClick:N})})]})})}),Rh=(0,ge.nF)(e=>e(),6e4,!0),Lh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{background:i,isBlurred:s}=(0,c.Gyz)(e,t)||{},{loadedWallpapers:n}=e.settings;return{background:i,isBlurred:s,loadedWallpapers:n,theme:t}})(e=>{let{isActive:t,onReset:i,background:r,isBlurred:l,loadedWallpapers:c,theme:d}=e;const{loadWallpapers:h,uploadWallpaper:u,setThemeSettings:m,openSettingsScreen:p}=(0,n.ko)(),v=(0,s.li)();v.current=d,(0,s.vJ)(()=>{Rh(()=>{h()})},[h]);const g=(0,s.hb)(e=>{const{files:t}=e.target,i=(0,J.kc)(t);i?.length&&u(i[0])},[u]),A=(0,s.hb)(()=>{(0,Mh.p)("image/jpeg",g,!0)},[g]),f=(0,s.hb)(()=>{p({screen:a.VS.GeneralChatBackgroundColor})},[]),b=(0,s.hb)(()=>{m({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?o.MkD:o.be8})},[m,d]),C=(0,s.hb)(e=>{m({theme:v.current,background:e});const t=c&&c.find(t=>t.slug===e);t?.document.thumbnail&&(0,gn.rX)(t.document.thumbnail.dataUri).then(e=>{const t=(0,gn.Yi)(e),i=`#${(0,gn.v2)(e)}`;m({theme:v.current,backgroundColor:i,patternColor:t})})},[c,m]),y=(0,s.hb)(e=>{m({theme:v.current,isBlurred:e.target.checked})},[m]),S=(0,T.A)();(0,Ce.A)({isActive:t,onBack:i});const k=c?.[0]&&c[0].slug===a.Vw;return(0,te.FD)("div",{className:"SettingsGeneralBackground settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{icon:"camera-add",className:"mb-0",disabled:k,onClick:A,children:S("UploadImage")}),(0,te.Y)(ci.A,{icon:"colorize",className:"mb-0",onClick:f,children:S("SetColor")}),(0,te.Y)(ci.A,{icon:"favorite",onClick:b,children:S("ThemeResetToDefaults")}),(0,te.Y)(sn.A,{label:S("BackgroundBlurred"),checked:Boolean(l),onChange:y})]}),c?(0,te.Y)("div",{className:"settings-wallpapers",children:c.map(e=>(0,te.Y)(Bh,{wallpaper:e,theme:d,isSelected:r===e.slug,onClick:C},e.slug))}):(0,te.Y)(xs.A,{})]})})),xh=(0,gn.bM)((0,gn.xp)("e6ebee")),Eh=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Vh(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 _h(e,t){let{colorPosition:i,huePosition:s}=e;return[s/(t.hueRect.width-1),i[0]/(t.colorRect.width-1),1-i[1]/(t.colorRect.height-1)]}const Uh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{backgroundColor:i}=(0,c.Gyz)(e,t)||{};return{backgroundColor:i,theme:t}})(e=>{let{isActive:t,onReset:i,theme:a,backgroundColor:o}=e;const{setThemeSettings:r}=(0,n.ko)(),l=(0,s.li)();l.current=a;const c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(),u=(0,s.li)(!0),[m,p]=(0,s.J0)(function(e){return e&&e.startsWith("#")?(0,gn.bM)((0,gn.xp)(e.replace("#",""))):xh}(o)),v=(0,s.li)(m);(0,s.vJ)(()=>{v.current=m},[m]);const[g,A,f]=(0,F.A)(),[b,C]=(0,s.J0)(""),[y,S]=(0,s.J0)(""),k=(0,s.li)(),w=(0,s.li)();(0,s.vJ)(()=>{const e={offsetLeft:d.current.offsetLeft,...(0,bi.Up)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:h.current.offsetLeft,...(0,bi.Up)(h.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+c.current.scrollTop),e.height-1)],{huePosition:s}=Vh(v.current,k.current);return p(_h({colorPosition:i,huePosition:s},k.current)),A(),!0}function s(e){const{colorPosition:i}=Vh(v.current,k.current),s=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return p(_h({colorPosition:i,huePosition:s},k.current)),A(),!0}k.current={colorRect:e,hueRect:t},(0,pe.wJ)(d.current,{onCapture:i,onDrag:i,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,pe.wJ)(h.current,{onCapture:s,onDrag:s,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})},[A,f]);const{colorPosition:N=[0,0],huePosition:I=0}=k.current?Vh(m,k.current):{},P=(0,gn.v2)((0,gn.Zf)(m)),Y=m[0],D=(0,gn.v2)((0,gn.Zf)([Y,1,1]));(0,s.vJ)(()=>{const e=(0,gn.Zf)(m),t=`#${(0,gn.v2)(e)}`;if(C(e.join(", ")),S(t),!u.current){const i=(0,gn.Yi)(e);r({theme:l.current,background:void 0,backgroundColor:t,patternColor:i})}u.current=!1},[m,r]),(0,s.vJ)(()=>{!function(e,t,i,s){let n,a,o;i.current&&s.current?(n=s.current.colorRect.width,a=s.current.colorRect.height,o=i.current):(n=e.offsetWidth,a=e.offsetHeight,o=e.getContext("2d"),e.width=n,e.height=a,i.current=o);const r=o.createImageData(n,a),l=r.data,c=(0,gn.Zf)([t,1,1]);let d=0;for(let e=0;e<a;e++){const t=1-e/(a-1),i=[255*t,255*t,255*t],s=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<n;e++){const t=e/(n-1);l[d++]=i[0]+(s[0]-i[0])*t,l[d++]=i[1]+(s[1]-i[1])*t,l[d++]=i[2]+(s[2]-i[2])*t,l[d++]=255}}o.putImageData(r,0,0)}(d.current.firstChild,Y,w,k)},[Y]),(0,s.vJ)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const i=e.getContext("2d"),s=i.createImageData(t,1),n=s.data;let a=0;for(let e=0;e<t;e++){const i=e/(t-1),s=(0,gn.Zf)([i,1,1]);n[a++]=s[0],n[a++]=s[1],n[a++]=s[2],n[a++]=255}i.putImageData(s,0,0)}(h.current.firstChild)},[]);const M=(0,s.hb)(e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map(e=>Number(e.trim()));p((0,gn.bM)(e))}e.currentTarget.value=t},[]),T=(0,s.hb)(e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&p((0,gn.bM)((0,gn.xp)(t.replace("#","")))),e.currentTarget.value=t},[]),B=(0,s.hb)(e=>{p((0,gn.bM)((0,gn.xp)(e.currentTarget.dataset.color.replace("#",""))))},[]),R=(0,me.A)("SettingsGeneralBackgroundColor settings-content custom-scroll",g&&"is-dragging");return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{ref:c,className:R,children:[(0,te.FD)("div",{className:"settings-item pt-3",children:[(0,te.FD)("div",{ref:d,className:"color-picker",children:[(0,te.Y)("canvas",{}),(0,te.Y)("div",{className:"handle",style:`transform: translate(${N[0]}px, ${N[1]}px); background-color: #${P};`})]}),(0,te.FD)("div",{ref:h,className:"hue-picker",children:[(0,te.Y)("canvas",{}),(0,te.Y)("div",{className:"handle",style:`transform: translateX(${I}px); background-color: #${D};`})]}),(0,te.FD)("div",{className:"tools",children:[(0,te.Y)(Z.A,{value:y,label:"HEX",onChange:T}),(0,te.Y)(Z.A,{value:b,label:"RGB",onChange:M})]})]}),(0,te.Y)("div",{className:"predefined-colors",children:Eh.map(e=>(0,te.Y)("div",{className:(0,me.A)("predefined-color",e===`#${P}`?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:B}))})]})})),Oh=(0,s.ph)(e=>{let{currentScreen:t,editedFolderId:i,onReset:o}=e;const{signOut:r,openDeleteChatFolderModal:l,openSettingsScreen:c}=(0,n.ko)(),{isMobile:d}=(0,Y.Ay)(),[h,u]=(0,s.J0)(!1),m=function(e,t){const i=(0,s.li)(0),n=(0,s.li)();return(0,s.hb)(()=>{if(i.current++,5===i.current)return i.current=0,void t();n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current=0},300)},[5,t])}(0,()=>{c({screen:a.VS.Experimental})}),p=(0,s.hb)(()=>{u(!0)},[]),v=(0,s.hb)(()=>{u(!1)},[]),g=(0,s.hb)(()=>{i&&l({folderId:i})},[i,l]),A=(0,s.hb)(()=>{v(),r({forceInitApi:!0})},[v,r]),f=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{round:!0,ripple:!d,size:"smaller",color:"translucent",className:i?"active":"",onClick:t,ariaLabel:"More actions",children:(0,te.Y)(W.A,{name:"more"})})},[d]),b=(0,T.A)(),C=(0,_i.A)();return(0,te.FD)("div",{className:"left-header",children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:o,ariaLabel:b("AccDescrGoBack"),children:(0,te.Y)(W.A,{name:"arrow-left"})}),function(){switch(t){case a.VS.EditProfile:return(0,te.Y)("h3",{children:b("lng_settings_information")});case a.VS.General:return(0,te.Y)("h3",{children:b("General")});case a.VS.QuickReaction:return(0,te.Y)("h3",{children:b("DoubleTapSetting")});case a.VS.CustomEmoji:return(0,te.Y)("h3",{children:b("Emoji")});case a.VS.Notifications:return(0,te.Y)("h3",{children:b("Notifications")});case a.VS.DataStorage:return(0,te.Y)("h3",{children:b("DataSettings")});case a.VS.Privacy:return(0,te.Y)("h3",{children:b("PrivacySettings")});case a.VS.Language:return(0,te.Y)("h3",{children:b("Language")});case a.VS.DoNotTranslate:return(0,te.Y)("h3",{children:b("DoNotTranslate")});case a.VS.Stickers:return(0,te.Y)("h3",{children:b("StickersName")});case a.VS.Experimental:return(0,te.Y)("h3",{children:b("lng_settings_experimental")});case a.VS.GeneralChatBackground:return(0,te.Y)("h3",{children:b("ChatBackground")});case a.VS.GeneralChatBackgroundColor:return(0,te.Y)("h3",{children:b("SetColor")});case a.VS.PrivacyPhoneNumber:return(0,te.Y)("h3",{children:b("PrivacyPhone")});case a.VS.PrivacyLastSeen:return(0,te.Y)("h3",{children:b("PrivacyLastSeen")});case a.VS.PrivacyProfilePhoto:return(0,te.Y)("h3",{children:b("Privacy.ProfilePhoto")});case a.VS.PrivacyBio:return(0,te.Y)("h3",{children:b("PrivacyBio")});case a.VS.PrivacyBirthday:return(0,te.Y)("h3",{children:b("PrivacyBirthday")});case a.VS.PrivacyGifts:return(0,te.Y)("h3",{children:C("PrivacyGifts")});case a.VS.PrivacyForwarding:return(0,te.Y)("h3",{children:b("PrivacyForwards")});case a.VS.PrivacyVoiceMessages:return(0,te.Y)("h3",{children:b("PrivacyVoiceMessages")});case a.VS.PrivacyMessages:return(0,te.Y)("h3",{children:b("PrivacyMessages")});case a.VS.PrivacyGroupChats:return(0,te.Y)("h3",{children:b("AutodownloadGroupChats")});case a.VS.PrivacyPhoneCall:return(0,te.Y)("h3",{children:b("Calls")});case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:return(0,te.Y)("h3",{children:b("AlwaysShareWith")});case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,te.Y)("h3",{children:b("NeverShareWith")});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:return(0,te.Y)("h3",{children:b("AlwaysAllow")});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return(0,te.Y)("h3",{children:b("NeverAllow")});case a.VS.PrivacyNoPaidMessages:return(0,te.Y)("h3",{children:C("RemoveFeeTitle")});case a.VS.Performance:return(0,te.Y)("h3",{children:C("MenuAnimations")});case a.VS.ActiveSessions:return(0,te.Y)("h3",{children:b("SessionsTitle")});case a.VS.ActiveWebsites:return(0,te.Y)("h3",{children:b("OtherWebSessions")});case a.VS.PrivacyBlockedUsers:return(0,te.Y)("h3",{children:b("BlockedUsers")});case a.VS.TwoFaDisabled:case a.VS.TwoFaEnabled:return(0,te.Y)("h3",{children:b("TwoStepVerification")});case a.VS.TwoFaNewPassword:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:return(0,te.Y)("h3",{children:b("PleaseEnterCurrentPassword")});case a.VS.TwoFaNewPasswordConfirm:return(0,te.Y)("h3",{children:b("PleaseReEnterPassword")});case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaChangePasswordHint:return(0,te.Y)("h3",{children:b("PasswordHint")});case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaRecoveryEmail:return(0,te.Y)("h3",{children:b("RecoveryEmailTitle")});case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaRecoveryEmailCode:return(0,te.Y)("h3",{children:"Recovery Email Code"});case a.VS.TwoFaCongratulations:return(0,te.Y)("h3",{children:b("TwoStepVerificationPasswordSet")});case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,te.Y)("h3",{children:b("PleaseEnterCurrentPassword")});case a.VS.PasscodeDisabled:case a.VS.PasscodeEnabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeCongratulations:return(0,te.Y)("h3",{children:b("Passcode")});case a.VS.PasscodeTurnOff:return(0,te.Y)("h3",{children:b("PasscodeController.Disable.Title")});case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:return(0,te.Y)("h3",{children:b("PasscodeController.Change.Title")});case a.VS.PasscodeChangePasscodeConfirm:return(0,te.Y)("h3",{children:b("PasscodeController.ReEnterPasscode.Placeholder")});case a.VS.Folders:return(0,te.Y)("h3",{children:b("Filters")});case a.VS.FoldersCreateFolder:return(0,te.Y)("h3",{children:b("FilterNew")});case a.VS.FoldersShare:return(0,te.Y)("h3",{children:b("FolderLinkScreen.Title")});case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,te.FD)("div",{className:"settings-main-header",children:[(0,te.Y)("h3",{children:b("FilterEdit")}),Boolean(i)&&(0,te.Y)(ce.A,{className:"settings-more-menu",trigger:f,positionX:"right",children:(0,te.Y)(de.A,{icon:"delete",destructive:!0,onClick:g,children:b("Delete")})})]});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,te.Y)("h3",{children:b(t===a.VS.FoldersIncludedChats||t===a.VS.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude")});default:return(0,te.FD)("div",{className:"settings-main-header",children:[(0,te.Y)("h3",{onClick:m,children:b("SETTINGS")}),(0,te.Y)(Q.A,{round:!0,ripple:!d,size:"smaller",color:"translucent",onClick:()=>c({screen:a.VS.EditProfile}),ariaLabel:b("lng_settings_information"),children:(0,te.Y)(W.A,{name:"edit"})}),(0,te.Y)(ce.A,{className:"settings-more-menu",trigger:f,positionX:"right",children:(0,te.Y)(de.A,{icon:"logout",onClick:p,children:b("LogOutTitle")})})]})}}(),(0,te.Y)(vi.A,{isOpen:h,onClose:v,text:b("lng_sure_logout"),confirmLabel:b("AccountSettings.Logout"),confirmHandler:A,confirmIsDestructive:!0})]})}),Kh=(0,s.ph)((0,n.EK)(e=>{const{canTranslate:t,canTranslateChats:i,doNotTranslate:s}=e.settings.byKey,{language:n,languages:a}=(0,vn.l)(e);return{isCurrentUserPremium:(0,c.g29)(e),languages:a,language:n,canTranslate:t,canTranslateChats:i,doNotTranslate:s}})(e=>{let{isActive:t,isCurrentUserPremium:i,languages:o,language:r,canTranslate:l,canTranslateChats:c,doNotTranslate:d,onReset:h}=e;const{loadLanguages:m,setSettingOption:p,setSharedSettingOption:v,openPremiumModal:g,openSettingsScreen:A}=(0,n.ko)(),[f,b]=(0,s.J0)(r),[C,y,S]=(0,F.A)(),k=i&&c,w=(0,T.A)();(0,s.vJ)(()=>{o?.length||m()},[o]);const N=(0,M.A)(e=>{b(e),y(),(0,Yh.wT)(e,()=>{S(),v({language:e})})}),I=(0,s.Kr)(()=>{if(!o)return;const e=(window.navigator.language||"en").toLowerCase(),t=e.substr(0,2);return o.map(e=>{let{langCode:t,nativeName:i,name:s}=e;return{value:t,label:i,subLabel:s,isLoading:t===f&&C}}).sort(i=>!e||i.value!==e&&i.value!==t?0:-1)},[C,o,f]),P=(0,M.A)(e=>{p({canTranslate:e})}),Y=(0,M.A)(e=>{p({canTranslateChats:e})}),D=(0,M.A)(()=>{i||g({initialSection:"translations"})}),B=(0,s.Kr)(()=>{if(u.CM&&d.length)return 1===d.length?new Intl.DisplayNames([r],{type:"language"}).of(d[0]):w("Languages",d.length)},[d,w,r]),R=(0,M.A)(()=>{A({screen:a.VS.DoNotTranslate})});return(0,Ce.A)({isActive:t,onBack:h}),(0,te.FD)("div",{className:"settings-content settings-language custom-scroll",children:[u.CM&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:w("ShowTranslateButton"),checked:l,onCheck:P}),(0,te.Y)(sn.A,{label:w("ShowTranslateChatButton"),checked:k,disabled:!i,rightIcon:i?void 0:"lock",onClickLabel:D,onCheck:Y}),(l||k)&&(0,te.FD)(ci.A,{narrow:!0,onClick:R,children:[w("DoNotTranslate"),(0,te.Y)("span",{className:"settings-item__current-value",children:B})]}),(0,te.Y)("p",{className:"settings-item-description mb-0 mt-1",children:w("lng_translate_settings_about")})]}),(0,te.FD)("div",{className:"settings-item settings-item-picker",children:[(0,te.Y)("h4",{className:"settings-item-header",children:w("Localization.InterfaceLanguage")}),I?(0,te.Y)(wo,{items:I,selectedValue:f,forceRenderAllItems:!0,onSelectedValueChange:N,itemInputType:"radio",className:"settings-picker"}):(0,te.Y)(xs.A,{})]})]})}));var Jh=i(86046),Gh=i(44784),jh=i(70195);const zh=(0,s.ph)((0,n.EK)(e=>{const{currentUserId:t}=e,i=(0,c.hc)(e),s=e.stars?.balance,n=e.ton?.balance;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,c.n_C)(e),isGiveawayAvailable:i,starsBalance:s,tonBalance:n}})(e=>{let{isActive:t,currentUserId:i,sessionCount:r,canBuyPremium:l,isGiveawayAvailable:c,starsBalance:d,tonBalance:h,onReset:u}=e;const{loadMoreProfilePhotos:m,openPremiumModal:p,openSupportChat:v,openUrl:g,openGiftRecipientPicker:A,openStarsBalanceModal:f,openSettingsScreen:b}=(0,n.ko)(),[C,y,S]=(0,F.A)(!1),k=(0,_i.A)();(0,s.vJ)(()=>{i&&m({peerId:i,isPreload:!0})},[i]),(0,Ce.A)({isActive:t,onBack:u});const w=(0,M.A)(()=>{v(),S()});return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-main-menu self-profile",children:[i&&(0,te.Y)(jh.A,{peerId:i,canPlayVideo:Boolean(t),forceShowSelf:!0}),i&&(0,te.Y)(Gh.A,{chatOrUserId:i,isInSettings:!0})]}),(0,te.FD)("div",{className:"settings-main-menu",children:[(0,te.Y)(ci.A,{icon:"settings",narrow:!0,onClick:()=>b({screen:a.VS.General}),children:k("TelegramGeneralSettingsViewController")}),(0,te.Y)(ci.A,{icon:"animations",narrow:!0,onClick:()=>b({screen:a.VS.Performance}),children:k("MenuAnimations")}),(0,te.Y)(ci.A,{icon:"unmute",narrow:!0,onClick:()=>b({screen:a.VS.Notifications}),children:k("Notifications")}),(0,te.Y)(ci.A,{icon:"data",narrow:!0,onClick:()=>b({screen:a.VS.DataStorage}),children:k("DataSettings")}),(0,te.Y)(ci.A,{icon:"lock",narrow:!0,onClick:()=>b({screen:a.VS.Privacy}),children:k("PrivacySettings")}),(0,te.Y)(ci.A,{icon:"folder",narrow:!0,onClick:()=>b({screen:a.VS.Folders}),children:k("Filters")}),(0,te.FD)(ci.A,{icon:"active-sessions",narrow:!0,onClick:()=>b({screen:a.VS.ActiveSessions}),children:[k("SessionsTitle"),r>0&&(0,te.Y)("span",{className:"settings-item__current-value",children:r})]}),(0,te.FD)(ci.A,{icon:"language",narrow:!0,onClick:()=>b({screen:a.VS.Language}),children:[k("Language"),(0,te.Y)("span",{className:"settings-item__current-value",children:k.languageInfo.nativeName})]}),(0,te.Y)(ci.A,{icon:"stickers",narrow:!0,onClick:()=>b({screen:a.VS.Stickers}),children:k("MenuStickers")})]}),(0,te.FD)("div",{className:"settings-main-menu",children:[l&&(0,te.Y)(ci.A,{leftElement:(0,te.Y)(Hd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),narrow:!0,onClick:()=>p(),children:k("TelegramPremium")}),(0,te.FD)(ci.A,{leftElement:(0,te.Y)(Hd.A,{className:"icon ListItem-main-icon",type:"gold",size:"big"}),narrow:!0,onClick:()=>f({}),children:[k("MenuStars"),Boolean(d)&&(0,te.Y)("span",{className:"settings-item__current-value",children:(0,Jh.ZF)(k,d)})]}),(0,te.FD)(ci.A,{leftElement:(0,te.Y)(W.A,{className:"icon ListItem-main-icon",name:"toncoin"}),narrow:!0,onClick:()=>f({currency:o.ykW}),children:[k("MenuTon"),Boolean(h)&&(0,te.Y)("span",{className:"settings-item__current-value",children:(0,ua.UL)(h.amount,h.currency)})]}),c&&(0,te.Y)(ci.A,{icon:"gift",narrow:!0,onClick:()=>A(),children:k("MenuSendGift")})]}),(0,te.FD)("div",{className:"settings-main-menu",children:[(0,te.Y)(ci.A,{icon:"ask-support",narrow:!0,onClick:y,children:k("AskAQuestion")}),(0,te.Y)(ci.A,{icon:"help",narrow:!0,onClick:()=>g({url:o.r9K}),children:k("MenuTelegramFaq")}),(0,te.Y)(ci.A,{icon:"privacy-policy",narrow:!0,onClick:()=>g({url:o.pkx}),children:k("MenuPrivacyPolicy")})]}),(0,te.Y)(vi.A,{isOpen:C,confirmLabel:k("OK"),title:k("AskAQuestion"),textParts:k("MenuAskText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:w,onClose:S})]})}));var Hh=i(5560),$h=i(56133);const qh=(0,s.ph)((0,n.EK)(e=>({hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume,notifyDefaults:e.settings.notifyDefaults}))(e=>{let{isActive:t,onReset:i,notifyDefaults:a,hasContactJoinedNotifications:o,hasPushNotifications:r,hasWebNotifications:l,notificationSoundVolume:c}=e;const{loadNotificationSettings:d,updateContactSignUpNotification:h,updateNotificationSettings:u,updateWebNotificationSettings:m}=(0,n.ko)();(0,s.vJ)(()=>{d()},[d]);const p=(0,$h.A)(500,!0),v=(0,Hh.M2)(),g=v&&!(0,Hh.Ac)(),A=Boolean(a?.channels?.mutedUntil),f=Boolean(a?.groups?.mutedUntil),b=Boolean(a?.users?.mutedUntil),C=(0,s.hb)((e,t,i)=>{const s=Boolean(a?.[t]?.mutedUntil),n=Boolean(a?.[t]?.shouldShowPreviews);u({peerType:t,isMuted:"mute"===i?!e.target.checked:s,shouldShowPreviews:"showPreviews"===i?e.target.checked:n})},[a]),y=(0,s.hb)(e=>{const t=e.target.checked;m({hasWebNotifications:t,...!t&&{hasPushNotifications:!1}})},[m]),S=(0,s.hb)(e=>{m({hasPushNotifications:e.target.checked})},[m]),k=(0,s.hb)(e=>{C(e,"users","mute")},[C]),w=(0,s.hb)(e=>{C(e,"users","showPreviews")},[C]),N=(0,s.hb)(e=>{C(e,"groups","mute")},[C]),I=(0,s.hb)(e=>{C(e,"groups","showPreviews")},[C]),P=(0,s.hb)(e=>{C(e,"channels","mute")},[C]),Y=(0,s.hb)(e=>{C(e,"channels","showPreviews")},[C]),F=(0,s.hb)(e=>{h({isSilent:!e.target.checked})},[h]),D=(0,s.hb)(e=>{m({notificationSoundVolume:e}),p(()=>(0,Hh.BA)(void 0,e))},[p,m]),M=(0,_i.A)();return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:M.isRtl?"rtl":void 0,children:M("NotificationsWeb")}),(0,te.Y)(sn.A,{label:M("NotificationsWeb"),subLabel:M(l?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:l,disabled:!v,onChange:y}),(0,te.Y)(sn.A,{label:M("NotificationsOffline"),disabled:!l||!g,subLabel:M(g?r?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled":"SettingsOfflineNotificationUnsupported"),checked:r,onChange:S}),(0,te.Y)("div",{className:"settings-item-slider",children:(0,te.Y)(We.A,{label:M("NotificationsSound"),min:0,max:10,disabled:!v,value:c,onChange:D})})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:M.isRtl?"rtl":void 0,children:M("AutodownloadPrivateChats")}),(0,te.Y)(sn.A,{label:M("NotificationsForPrivateChats"),subLabel:M(b?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!b,onChange:k}),(0,te.Y)(sn.A,{label:M("MessagePreview"),disabled:b,subLabel:M(a?.users?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(a?.users?.shouldShowPreviews),onChange:w})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:M.isRtl?"rtl":void 0,children:M("FilterGroups")}),(0,te.Y)(sn.A,{label:M("NotificationsForGroups"),subLabel:M(f?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!f,onChange:N}),(0,te.Y)(sn.A,{label:M("MessagePreview"),disabled:f,subLabel:M(a?.groups?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(a?.groups?.shouldShowPreviews),onChange:I})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:M.isRtl?"rtl":void 0,children:M("FilterChannels")}),(0,te.Y)(sn.A,{label:M("NotificationsForChannels"),subLabel:M(A?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!A,onChange:P}),(0,te.Y)(sn.A,{label:M("MessagePreview"),disabled:A,subLabel:M(a?.channels?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(a?.channels?.shouldShowPreviews),onChange:Y})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:M.isRtl?"rtl":void 0,children:M("PhoneOther")}),(0,te.Y)(sn.A,{label:M("ContactJoined"),checked:o,onChange:F})]})]})}));var Wh=i(20714),Qh=i(22986);const Zh=["SettingsPerformanceSliderLow","SettingsPerformanceSliderMedium","SettingsPerformanceSliderHigh"],Xh=["SettingsPerformanceSliderLow","SettingsPerformanceSliderCustom","SettingsPerformanceSliderHigh"],eu=[["SettingsPerformanceInterfaceAnimations",[{key:"pageTransitions",label:"SettingsPerformancePageTransitions"},{key:"messageSendingAnimations",label:"SettingsPerformanceSending"},{key:"mediaViewerAnimations",label:"SettingsPerformanceMediaViewer"},{key:"messageComposerAnimations",label:"SettingsPerformanceComposer"},{key:"contextMenuAnimations",label:"SettingsPerformanceContextAnimation"},{key:"contextMenuBlur",label:"SettingsPerformanceContextBlur",disabled:!u.Fy},{key:"rightColumnAnimations",label:"SettingsPerformanceRightColumn"},{key:"snapEffect",label:"SettingsPerformanceThanos"}]],["SettingsPerformanceStickers",[{key:"animatedEmoji",label:"SettingsPerformanceAnimatedEmoji"},{key:"loopAnimatedStickers",label:"SettingsPerformanceLoopStickers"},{key:"reactionEffects",label:"SettingsPerformanceReactionEffects"},{key:"stickerEffects",label:"SettingsPerformanceStickerEffects"}]],["SettingsPerformanceMediaAutoplay",[{key:"autoplayGifs",label:"SettingsPerformanceAutoplayGif"},{key:"autoplayVideos",label:"SettingsPerformanceAutoplayVideo"}]]],tu=(0,s.ph)((0,n.EK)(e=>({performanceSettings:(0,c.Cw0)(e)}))(function(e){let{isActive:t,performanceSettings:i,onReset:a}=e;const{setSharedSettingOption:r,updatePerformanceSettings:l}=(0,n.ko)();(0,Ce.A)({isActive:t,onBack:a});const c=(0,_i.A)(),[d,h]=(0,s.J0)({}),m=(0,s.Kr)(()=>eu.reduce((e,t,s)=>{let[,n]=t;return e[s]=n.every(e=>{let{key:t}=e;return i[t]}),e},{}),[i]),p=(0,s.Kr)(()=>(0,Qh.T)(i,Wh.LH)?o.zP3:(0,Qh.T)(i,Wh.PI)?o.dnp:(0,Qh.T)(i,Wh.tS)?o.zHL:o.M8B,[i]),v=(0,s.Kr)(()=>(p===o.M8B?Xh:Zh).map(e=>c(e)),[p,c]),g=(0,s.hb)((e,t)=>{e.preventDefault();const i=Number(t);h(e=>({...e,[i]:!e[i]}))},[]),A=(0,s.hb)(e=>{const t=e===o.dnp?Wh.PI:e===o.zHL?Wh.tS:Wh.LH;r({animationLevel:e,wasAnimationLevelSetManually:!0}),l(t)},[]),f=(0,s.hb)(e=>{const{name:t,checked:i}=e.target,s=eu.find(e=>{let[i]=e;return i===t});if(!s)return;const n=s[1].reduce((e,t)=>{let{key:s}=t;return e[s]=i,e},{});l(n)},[]),b=(0,s.hb)(e=>{const{name:t,checked:i}=e.target;l({[t]:i})},[]);return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:c("SettingsPerformanceSliderTitle")}),(0,te.Y)("p",{className:"settings-item-description",dir:c.isRtl?"rtl":void 0,children:c("SettingsPerformanceSliderSubtitle")}),(0,te.Y)(We.A,{options:v,value:p===o.M8B?o.zHL:p,onChange:A})]}),(0,te.FD)("div",{className:"settings-item-simple settings-item__with-shifted-dropdown",children:[(0,te.Y)("h3",{className:"settings-item-header",dir:"auto",children:c("SettingsPerformanceGranularTitle")}),eu.map((e,t)=>{let[s,n]=e;return(0,te.FD)("div",{className:"settings-dropdown-section",children:[(0,te.Y)("div",{className:"ListItem with-checkbox",children:(0,te.Y)(sn.A,{name:s,value:t.toString(),checked:m[t],label:c(s),rightIcon:d[t]?"up":"down",onChange:f,onClickLabel:g})}),Boolean(d[t])&&(0,te.Y)("div",{className:"DropdownList DropdownList--open",children:n.map(e=>{let{key:t,label:s,disabled:n}=e;if("snapEffect"!==t||u.bW)return(0,te.Y)(sn.A,{name:t,checked:i[t],label:c(s),disabled:n,onChange:b},t)})})]},s)})]})]})})),iu=(0,s.ph)((0,n.EK)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:i,canChangeSensitive:s,shouldArchiveAndMuteNewNonContact:n,shouldNewNonContactPeersRequirePremium:a,nonContactPeersPaidStars:o},privacy:r,accountDaysTtl:l},blocked:d,passcode:{hasPasscode:h},appConfig:u}=e,{canDisplayChatInTitle:m}=(0,vn.l)(e),p=Boolean(o),v=(0,c.trm)(e),g=(0,c.g29)(e);return{isCurrentUserPremium:g,hasPassword:t,hasPasscode:Boolean(h),blockedCount:d.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:i,canDisplayAutoarchiveSetting:u.canDisplayAutoarchiveSetting||g,shouldArchiveAndMuteNewNonContact:n,canChangeSensitive:s,shouldNewNonContactPeersRequirePremium:a,shouldChargeForMessages:p,needAgeVideoVerification:Boolean(u.needAgeVideoVerification),privacy:r,canDisplayChatInTitle:m,canSetPasscode:(0,c.Ntz)(e),isCurrentUserFrozen:v,accountDaysTtl:l}})(e=>{let{isActive:t,isCurrentUserPremium:i,hasPassword:r,hasPasscode:l,blockedCount:c,webAuthCount:d,isSensitiveEnabled:h,canChangeSensitive:u,canDisplayAutoarchiveSetting:m,shouldArchiveAndMuteNewNonContact:p,shouldNewNonContactPeersRequirePremium:v,shouldChargeForMessages:g,canDisplayChatInTitle:A,canSetPasscode:f,needAgeVideoVerification:b,privacy:C,onReset:y,isCurrentUserFrozen:S,accountDaysTtl:k}=e;const{openDeleteAccountModal:w,loadPrivacySettings:N,loadBlockedUsers:I,updateContentSettings:P,loadGlobalPrivacySettings:Y,updateGlobalPrivacySettings:F,loadWebAuthorizations:D,setSharedSettingOption:B,openSettingsScreen:R,loadAccountDaysTtl:L,openAgeVerificationModal:x}=(0,n.ko)();(0,s.vJ)(()=>{S||(I(),N(),D())},[S]),(0,s.vJ)(()=>{t&&!S&&(Y(),L())},[t,S,Y]);const E=(0,T.A)(),V=(0,_i.A)();(0,Ce.A)({isActive:t,onBack:y});const _=(0,s.hb)(e=>{F({shouldArchiveAndMuteNewNonContact:e})},[F]),U=(0,s.hb)(e=>{B({canDisplayChatInTitle:e})},[]),O=(0,s.hb)(e=>{P({isSensitiveEnabled:e})},[P]),K=(0,s.hb)(()=>{x()},[x]),J=(0,M.A)(()=>{k&&w({days:k})}),G=(0,s.Kr)(()=>{if(k)return el(o.WF4,k/30).toString()},[k]);function j(e){if(!e)return E("Loading");const{visibility:t,shouldAllowPremium:i,botsPrivacy:s}=e,n="everybody"===t,a="allow"===s&&!n,o=e.blockChatIds.length+e.blockUserIds.length,r=e.allowChatIds.length+e.allowUserIds.length,l=[];o&&l.push(`-${o}`),r&&!n&&l.push(`+${r}`);const c=[a?V("PrivacyValueBots"):"",V.conjunction(l)].filter(Boolean).join(" ");if(a&&!n)return c;if(i)return E(c?"ContactsAndPremium":"PrivacyPremium");switch(t){case"everybody":return`${E("P2PEverybody")} ${c}`;case"contacts":return`${E("P2PContacts")} ${c}`;case"nobody":return`${E("P2PNobody")} ${c}`}}return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.FD)(ci.A,{icon:"delete-user",narrow:!0,onClick:()=>R({screen:a.VS.PrivacyBlockedUsers}),children:[E("BlockedUsers"),(0,te.Y)("span",{className:"settings-item__current-value",children:c||""})]}),f&&(0,te.Y)(ci.A,{icon:"key",narrow:!0,onClick:()=>R({screen:l?a.VS.PasscodeEnabled:a.VS.PasscodeDisabled}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("Passcode")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:E(l?"PasswordOn":"PasswordOff")})]})}),(0,te.Y)(ci.A,{icon:"lock",narrow:!0,onClick:()=>R({screen:r?a.VS.TwoFaEnabled:a.VS.TwoFaDisabled}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("TwoStepVerification")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:E(r?"PasswordOn":"PasswordOff")})]})}),d>0&&(0,te.FD)(ci.A,{icon:"web",narrow:!0,onClick:()=>R({screen:a.VS.ActiveWebsites}),children:[E("PrivacySettings.WebSessions"),(0,te.Y)("span",{className:"settings-item__current-value",children:d})]})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:E("PrivacyTitle")}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyPhoneNumber}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyPhoneTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.phoneNumber)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyLastSeen}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("LastSeenTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.lastSeen)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyProfilePhoto}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyProfilePhotoTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.profilePhoto)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyBio}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyBio")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.bio)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyBirthday}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyBirthday")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.birthday)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyGifts}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:V("PrivacyGifts")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.gifts)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyForwarding}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyForwardsTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.forwards)})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyPhoneCall}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("WhoCanCallMe")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.phoneCall)})]})}),(0,te.Y)(ci.A,{narrow:!0,allowDisabledClick:!0,rightElement:i&&(0,te.Y)(Hd.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyVoiceMessages}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyVoiceMessagesTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.voiceMessages)})]})}),(0,te.Y)(ci.A,{narrow:!0,rightElement:i&&(0,te.Y)(Hd.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyMessages}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("PrivacyMessagesTitle")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:g?V("PrivacyPaidMessagesValue"):E(v?"PrivacyMessagesContactsAndPremium":"P2PEverybody")})]})}),(0,te.Y)(ci.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyGroupChats}),children:(0,te.FD)("div",{className:"multiline-item",children:[(0,te.Y)("span",{className:"title",children:E("WhoCanAddMe")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:j(C.chatInvite)})]})})]}),u&&(0,te.FD)("div",{className:"settings-item fluid-container",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:E("lng_settings_sensitive_title")}),(0,te.Y)(sn.A,{label:E("lng_settings_sensitive_disable_filtering"),subLabel:E("lng_settings_sensitive_about"),checked:Boolean(h),disabled:!u||!h&&b,onCheck:O}),!h&&b&&(0,te.Y)(Q.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:K,children:(0,te.Y)("span",{className:"settings-unlock-button-title",children:V("ButtonAgeVerification")})})]}),m&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:E("NewChatsFromNonContacts")}),(0,te.Y)(sn.A,{label:E("ArchiveAndMute"),subLabel:E("ArchiveAndMuteInfo"),checked:Boolean(p),onCheck:_})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:E("lng_settings_window_system")}),(0,te.Y)(sn.A,{label:E("lng_settings_title_chat_name"),checked:Boolean(A),onCheck:U})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0,children:V("DeleteMyAccount")}),(0,te.FD)(ci.A,{narrow:!0,onClick:J,children:[V("DeleteAccountIfAwayFor"),(0,te.Y)("span",{className:"settings-item__current-value",children:V("Months",{count:G},{pluralValue:1})})]})]})]})})),su=(0,s.ph)((0,n.EK)(e=>{const{users:{byId:t},blocked:{ids:i},contactList:s,currentUserId:n}=e;return{usersById:t,blockedIds:i,contactIds:s?.userIds,localContactIds:(0,c.nTw)(e).userSearch.localUserIds,currentUserId:n}})(e=>{let{usersById:t,blockedIds:i,contactIds:a,localContactIds:o,currentUserId:r,isOpen:c,onClose:d}=e;const{setUserSearchQuery:h,blockUser:u}=(0,n.ko)(),m=(0,T.A)(),[p,v]=(0,s.J0)("");(0,s.vJ)(()=>{h({query:p})},[p,h]);const g=(0,s.Kr)(()=>{const e=(0,bi.Am)([...a||[],...o||[]].filter(e=>e!==r&&!i.includes(e)));return(0,Ft.PU)({ids:e,query:p,type:"user"}).sort((e,i)=>{const s=(0,l.Yg)(t[e])||"",n=(0,l.Yg)(t[i])||"";return s.localeCompare(n)})},[i,a,r,p,o,t]),A=(0,s.hb)(e=>{u({userId:e}),d()},[d]);return(0,te.Y)(Ks,{isOpen:c,chatOrUserIds:g,searchPlaceholder:m("BlockedUsers.BlockUser"),search:p,onSearchChange:v,onSelectChatOrUser:A,onClose:d})})),nu=(0,s.ph)((0,n.EK)(e=>{const{chats:{byId:t},users:{byId:i},blocked:{ids:s},countryList:{phoneCodes:n}}=e;return{chatsByIds:t,usersByIds:i,blockedIds:s,phoneCodeList:n}})(e=>{let{isActive:t,onReset:i,chatsByIds:a,usersByIds:r,blockedIds:c,phoneCodeList:d}=e;const{unblockUser:h}=(0,n.ko)(),u=(0,T.A)(),[m,p,g]=(0,F.A)(),A=(0,s.hb)(e=>{h({userId:e})},[h]);(0,Ce.A)({isActive:t,onBack:i});const f=(0,s.Kr)(()=>c.reduce((e,t)=>{const i=(0,v.L8)(t)?r[t]:void 0,s=i&&!i.phoneNumber&&(0,l.Kl)(i);return s&&(e[t]=s),e},{}),[c,r]);return(0,te.FD)("div",{className:"settings-fab-wrapper",children:[(0,te.FD)("div",{className:"settings-content infinite-scroll",children:[(0,te.Y)("div",{className:"settings-item no-border",children:(0,te.Y)("p",{className:"settings-item-description-larger mt-0 mb-2",dir:u.isRtl?"rtl":void 0,children:u("BlockedUsersInfo")})}),(0,te.Y)("div",{className:"chat-list custom-scroll",children:c?.length?(0,te.Y)("div",{className:"scroll-container settings-item",children:c.map((e,t)=>function(e,t){const i=(0,v.L8)(e),s=r[e],n=a[e],l=s||n,c=(0,me.A)("Chat chat-item-clickable blocked-list-item small-icon",i?"private":"group"),h=f[e];return(0,te.FD)(ci.A,{className:c,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{A(e)}}],style:`top: ${(0+t)*o.yq1}px;`,children:[(0,te.Y)(Mt.A,{size:"medium",peer:l}),(0,te.FD)("div",{className:"contact-info",dir:"auto",children:[l&&(0,te.Y)(Es.A,{peer:l}),s?.phoneNumber&&(0,te.Y)("div",{className:"contact-phone",dir:"auto",children:(0,un.Ox)(d,s.phoneNumber)}),h&&(0,te.FD)("div",{className:"contact-username",dir:"auto",children:["@",h]})]})]},`blocked_${e}`)}(e,t))}):c&&!c.length?(0,te.Y)("div",{className:"no-results",dir:"auto",children:u("NoBlocked")}):(0,te.Y)(xs.A,{},"loading")})]}),(0,te.Y)(wi.A,{isShown:!0,className:"block-user-button",onClick:p,ariaLabel:u("BlockContact"),children:(0,te.Y)(W.A,{name:"add"})}),(0,te.Y)(su,{isOpen:m,onClose:g})]})}));function au(e){switch(e){case a.VS.PrivacyPhoneNumber:case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case a.VS.PrivacyLastSeen:case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyLastSeenDeniedContacts:return"lastSeen";case a.VS.PrivacyProfilePhoto:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case a.VS.PrivacyBio:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBioDeniedContacts:return"bio";case a.VS.PrivacyBirthday:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyBirthdayDeniedContacts:return"birthday";case a.VS.PrivacyGifts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyGiftsDeniedContacts:return"gifts";case a.VS.PrivacyForwarding:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyForwardingDeniedContacts:return"forwards";case a.VS.PrivacyVoiceMessages:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case a.VS.PrivacyGroupChats:case a.VS.PrivacyGroupChatsAllowedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return"chatInvite";case a.VS.PrivacyPhoneCall:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:return"phoneCall";case a.VS.PrivacyPhoneP2P:case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return"phoneP2P";case a.VS.PrivacyAddByPhone:return"addByPhone";case a.VS.PrivacyNoPaidMessages:return"noPaidMessages"}}const ou=(0,s.ph)((0,n.EK)(e=>{const{settings:{byKey:{disallowedGifts:t}}}=e;return{disallowedGifts:t,isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{disallowedGifts:t,isCurrentUserPremium:i}=e;const{showNotification:s,updateGlobalPrivacySettings:a}=(0,n.ko)(),o=(0,_i.A)(),r=(0,M.A)(()=>{s({message:o("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),l=(0,M.A)(()=>{i?a({disallowedGifts:{...t,shouldDisallowLimitedStarGifts:!t?.shouldDisallowLimitedStarGifts||void 0}}):r()}),c=(0,M.A)(()=>{i?a({disallowedGifts:{...t,shouldDisallowUnlimitedStarGifts:!t?.shouldDisallowUnlimitedStarGifts||void 0}}):r()}),d=(0,M.A)(()=>{i?a({disallowedGifts:{...t,shouldDisallowUniqueStarGifts:!t?.shouldDisallowUniqueStarGifts||void 0}}):r()}),h=(0,M.A)(()=>{i?a({disallowedGifts:{...t,shouldDisallowPremiumGifts:!t?.shouldDisallowPremiumGifts||void 0}}):r()});return(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftTitle")}),(0,te.FD)(ci.A,{onClick:l,children:[(0,te.Y)("span",{children:o("PrivacyGiftLimitedEdition")}),(0,te.Y)(fi.A,{id:"limited_edition",label:o(t?.shouldDisallowLimitedStarGifts?"PrivacyDisableLimitedEditionStarGifts":"PrivacyEnableLimitedEditionStarGifts"),disabled:!i,checked:!i||!t?.shouldDisallowLimitedStarGifts})]}),(0,te.FD)(ci.A,{onClick:c,children:[(0,te.Y)("span",{children:o("PrivacyGiftUnlimited")}),(0,te.Y)(fi.A,{id:"unlimited",label:o(t?.shouldDisallowUnlimitedStarGifts?"PrivacyDisableUnlimitedStarGifts":"PrivacyEnableUnlimitedStarGifts"),disabled:!i,checked:!i||!t?.shouldDisallowUnlimitedStarGifts})]}),(0,te.FD)(ci.A,{onClick:d,children:[(0,te.Y)("span",{children:o("PrivacyGiftUnique")}),(0,te.Y)(fi.A,{id:"unique",label:o(t?.shouldDisallowUniqueStarGifts?"PrivacyDisableUniqueStarGifts":"PrivacyEnableUniqueStarGifts"),disabled:!i,checked:!i||!t?.shouldDisallowUniqueStarGifts})]}),(0,te.FD)(ci.A,{onClick:h,children:[(0,te.Y)("span",{children:o("PrivacyGiftPremiumSubscription")}),(0,te.Y)(fi.A,{id:"premium_subscription",label:o(t?.shouldDisallowPremiumGifts?"PrivacyDisablePremiumGifts":"PrivacyEnablePremiumGifts"),disabled:!i,checked:!i||!t?.shouldDisallowPremiumGifts})]}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftInfo")})]})})),ru=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),shouldHideReadMarks:Boolean((0,c.KIM)(e))}))(e=>{let{isCurrentUserPremium:t,shouldHideReadMarks:i,visibility:s}=e;const{updateGlobalPrivacySettings:a,openPremiumModal:o}=(0,n.ko)(),r=(0,T.A)(),l="nobody"===s||"contacts"===s,c=(0,M.A)(e=>a({shouldHideReadMarks:e})),d=(0,M.A)(()=>{o({initialSection:"last_seen"})});return(0,te.FD)(te.FK,{children:[l&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:r("HideReadTime"),checked:i,onCheck:c}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:r.isRtl?"rtl":void 0,children:(0,Dt.A)(r("HideReadTimeInfo"),["br"])})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{leftElement:(0,te.Y)(Hd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:d,children:r(t?"PrivacyLastSeenPremiumForPremium":"PrivacyLastSeenPremium")}),(0,te.Y)("p",{className:"settings-item-description-larger premium-info",dir:r.isRtl?"rtl":void 0,children:r(t?"PrivacyLastSeenPremiumInfoForPremium":"PrivacyLastSeenPremiumInfo")})]})]})}));var lu=i(91356);const cu=(0,s.ph)(e=>{let{currentUserId:t,hasCurrentUserFullInfo:i,currentUserFallbackPhoto:a}=e;const{loadFullUser:o,uploadProfilePhoto:r,deleteProfilePhoto:l,showNotification:c}=(0,n.ko)(),d=(0,T.A)(),[h,u,m]=(0,F.A)(!1),p=(0,s.li)();(0,s.vJ)(()=>{i||o({userId:t})},[i,t,o]);const v=(0,s.hb)(e=>{r({file:e,isFallback:!0}),c({message:d("Privacy.ProfilePhoto.PublicPhotoSuccess")})},[d,c,r]),g=(0,s.hb)(()=>{m(),l({photo:a})},[m,l,a]),A=(0,s.hb)(()=>{p.current?.click()},[]);return(0,te.FD)("div",{className:"settings-item",children:[(0,te.FD)(ci.A,{narrow:!0,icon:"camera-add",onClick:A,children:[(0,te.Y)(lu.A,{onChange:v,inputRef:p}),d(a?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")]}),a&&(0,te.FD)(ci.A,{narrow:!0,leftElement:(0,te.Y)(Mt.A,{photo:a,size:"mini",className:"Qvhl9Jjv"}),onClick:u,destructive:!0,children:[d(a.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),(0,te.Y)(vi.A,{isOpen:h,onClose:m,text:d("Privacy.ResetPhoto.Confirm"),confirmLabel:d("Delete"),confirmHandler:g,confirmIsDestructive:!0})]}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:d.isRtl?"rtl":void 0,children:d("Privacy.ProfilePhoto.PublicPhotoInfo")})]})});function du(e){let{screen:t,privacy:i,isPremiumRequired:o}=e;const{setPrivacyVisibility:r,openSettingsScreen:l}=(0,n.ko)(),c=(0,T.A)(),d=(0,_i.A)(),h=(0,s.Kr)(()=>{const e=t!==a.VS.PrivacyAddByPhone,i=[{value:"everybody",label:c("P2PEverybody")},{value:"contacts",label:o?(0,te.Y)(qd,{label:c("P2PContacts")}):c("P2PContacts"),hidden:o}];return e&&i.push({value:"nobody",label:o?(0,te.Y)(qd,{label:c("P2PNobody")}):c("P2PNobody"),hidden:o}),i},[c,t,o]),u=(0,s.Kr)(()=>t===a.VS.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==i?.visibility,shouldShowAllowed:"everybody"!==i?.visibility},[i,t]),m=au(t),p=(0,s.Kr)(()=>{switch(t){case a.VS.PrivacyGifts:return d("PrivacyGiftsInfo");case a.VS.PrivacyLastSeen:return c("CustomHelp");case a.VS.PrivacyAddByPhone:return c("everybody"===i?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");case a.VS.PrivacyVoiceMessages:return c("PrivacyVoiceMessagesInfo");default:return}},[c,d,t,i]),v=(0,s.Kr)(()=>{switch(t){case a.VS.PrivacyPhoneNumber:return c("PrivacyPhoneTitle");case a.VS.PrivacyAddByPhone:return c("PrivacyPhoneTitle2");case a.VS.PrivacyLastSeen:return c("LastSeenTitle");case a.VS.PrivacyProfilePhoto:return c("PrivacyProfilePhotoTitle");case a.VS.PrivacyBio:return c("PrivacyBioTitle");case a.VS.PrivacyBirthday:return c("PrivacyBirthdayTitle");case a.VS.PrivacyGifts:return d("PrivacyGiftsTitle");case a.VS.PrivacyForwarding:return c("PrivacyForwardsTitle");case a.VS.PrivacyVoiceMessages:return c("PrivacyVoiceMessagesTitle");case a.VS.PrivacyGroupChats:return c("WhoCanAddMe");case a.VS.PrivacyPhoneCall:return c("WhoCanCallMe");case a.VS.PrivacyPhoneP2P:return c("PrivacyP2P");default:return}},[c,d,t]),g=(0,M.A)((e,t,i,s)=>{const n=e?.length||0,a=t?.length||0,o="allow"===s;if(!n&&!a&&!o)return c(i?"PrivacyPremium":"EditAdminAddUsers");if(i)return c("ContactsAndPremium");const r=n>0?c("Users",n):void 0,l=a>0?c("Chats",a):void 0;return[o?d("PrivacyValueBots"):"",d.conjunction([r,l].filter(Boolean))].filter(Boolean).join(" ")}),A=(0,s.Kr)(()=>g(i?.allowUserIds,i?.allowChatIds,i?.shouldAllowPremium,i?.botsPrivacy),[i]),f=(0,s.Kr)(()=>g(i?.blockUserIds,i?.blockChatIds),[i]),b=(0,s.hb)(e=>{r({privacyKey:m,visibility:e})},[m]),C=(()=>{switch(t){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberAllowedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenAllowedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoAllowedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioAllowedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayAllowedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsAllowedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingAllowedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallAllowedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PAllowedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesAllowedContacts;default:return a.VS.PrivacyGroupChatsAllowedContacts}})(),y=(()=>{switch(t){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberDeniedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenDeniedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoDeniedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioDeniedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayDeniedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsDeniedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingDeniedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallDeniedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PDeniedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesDeniedContacts;default:return a.VS.PrivacyGroupChatsDeniedContacts}})();return(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:v}),(0,te.Y)(ee.A,{name:`visibility-${m}`,options:h,onChange:b,selected:i?.visibility}),p&&(0,te.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:p})]}),!o&&(u.shouldShowAllowed||u.shouldShowDenied)&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:c("PrivacyExceptions")}),u.shouldShowAllowed&&(0,te.Y)(ci.A,{narrow:!0,icon:"add-user",onClick:()=>{l({screen:C})},children:(0,te.FD)("div",{className:"multiline-item full-size",children:[(0,te.Y)("span",{className:"title",children:c("AlwaysAllow")}),(0,te.Y)("span",{className:"subtitle",children:A})]})}),u.shouldShowDenied&&(0,te.Y)(ci.A,{narrow:!0,icon:"delete-user",onClick:()=>{l({screen:y})},children:(0,te.FD)("div",{className:"multiline-item full-size",children:[(0,te.Y)("span",{className:"title",children:c("NeverAllow")}),(0,te.Y)("span",{className:"subtitle",children:f})]})})]}),o&&(0,te.Y)($d,{})]})}const hu=(0,s.ph)((0,n.EK)((e,t)=>{let i,s,{screen:n}=t;const{currentUserId:o,settings:{privacy:r,byKey:{shouldDisplayGiftsButton:l}}}=e,d=(0,c.vGo)(e,o);switch(n){case a.VS.PrivacyPhoneNumber:i=r.phoneNumber,s=r.addByPhone;break;case a.VS.PrivacyLastSeen:i=r.lastSeen;break;case a.VS.PrivacyProfilePhoto:i=r.profilePhoto;break;case a.VS.PrivacyBio:i=r.bio;break;case a.VS.PrivacyBirthday:i=r.birthday;break;case a.VS.PrivacyGifts:i=r.gifts;break;case a.VS.PrivacyPhoneP2P:case a.VS.PrivacyPhoneCall:i=r.phoneCall,s=r.phoneP2P;break;case a.VS.PrivacyForwarding:i=r.forwards;break;case a.VS.PrivacyVoiceMessages:i=r.voiceMessages;break;case a.VS.PrivacyGroupChats:i=r.chatInvite}return i?{primaryPrivacy:i,secondaryPrivacy:s,currentUserId:o,hasCurrentUserFullInfo:Boolean(d),currentUserFallbackPhoto:d?.fallbackPhoto,isPremiumRequired:n===a.VS.PrivacyVoiceMessages&&!(0,c.g29)(e),shouldDisplayGiftsButton:l,isCurrentUserPremium:(0,c.g29)(e)}:{currentUserId:o,hasCurrentUserFullInfo:Boolean(d),currentUserFallbackPhoto:d?.fallbackPhoto}})(e=>{let{screen:t,isActive:i,primaryPrivacy:o,secondaryPrivacy:r,currentUserId:l,hasCurrentUserFullInfo:c,currentUserFallbackPhoto:d,isPremiumRequired:h,onReset:u,shouldDisplayGiftsButton:m,isCurrentUserPremium:p}=e;const{updateGlobalPrivacySettings:v,showNotification:g}=(0,n.ko)(),A=(0,_i.A)();(0,Ce.A)({isActive:i,onBack:u});const f=(0,M.A)(()=>{p?v({shouldDisplayGiftsButton:!m}):g({message:A("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),b=(0,s.Kr)(()=>{switch(t){case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneP2P;case a.VS.PrivacyPhoneNumber:return"nobody"===o?.visibility?a.VS.PrivacyAddByPhone:void 0;default:return}},[o,t]);return(0,te.FD)("div",{className:"settings-content custom-scroll",children:[t===a.VS.PrivacyGifts&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.FD)(ci.A,{onClick:f,children:[(0,te.Y)("span",{children:A("PrivacyDisplayGiftsButton")}),(0,te.Y)(fi.A,{id:"gift",disabled:!p,label:A(m?"HideGiftsButton":"DisplayGiftsButton"),checked:m})]}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:A.isRtl?"rtl":void 0,children:A("PrivacyDisplayGiftIconInChats",{icon:(0,te.Y)(W.A,{name:"gift",className:"gift-icon"}),gift:A("PrivacyDisplayGift")},{withNodes:!0})})]}),(0,te.Y)(du,{screen:t,privacy:o,isPremiumRequired:h}),t===a.VS.PrivacyProfilePhoto&&"everybody"!==o?.visibility&&(0,te.Y)(cu,{currentUserId:l,hasCurrentUserFullInfo:c,currentUserFallbackPhoto:d}),t===a.VS.PrivacyLastSeen&&(0,te.Y)(ru,{visibility:o?.visibility}),t===a.VS.PrivacyGifts&&(0,te.Y)(ou,{}),Boolean(b)&&(0,te.Y)(du,{screen:b,privacy:r})]})})),uu=[yd.lw];function mu(e,t){const{privacy:i}=e.settings;switch(t){case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyPhoneNumberDeniedContacts:return i.phoneNumber;case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyLastSeenDeniedContacts:return i.lastSeen;case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:return i.profilePhoto;case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBioDeniedContacts:return i.bio;case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyBirthdayDeniedContacts:return i.birthday;case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyGiftsDeniedContacts:return i.gifts;case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:return i.phoneCall;case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return i.phoneP2P;case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyForwardingDeniedContacts:return i.forwards;case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:return i.voiceMessages;case a.VS.PrivacyGroupChatsDeniedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:return i.chatInvite;case a.VS.PrivacyNoPaidMessages:return i.noPaidMessages}}const pu=(0,s.ph)((0,n.EK)((e,t)=>{let{screen:i}=t;return{currentUserId:e.currentUserId,settings:mu(e,i)}})(e=>{let{isAllowList:t,withPremiumCategory:i,withMiniAppsCategory:a,screen:r,isActive:c,currentUserId:d,settings:h,usersOnly:u=!1,onReset:m}=e;const{setPrivacySettings:p}=(0,n.ko)(),v=(0,T.A)(),g=(0,_i.A)(),A=(0,s.Kr)(()=>({isCustomPeer:!0,type:"bots",title:g("PrivacyValueBots"),avatarIcon:"bots",isAvatarSquare:!0,peerColorId:6}),[g]),f=(0,s.Kr)(()=>[A],[A]),b=(0,s.Kr)(()=>h?t?[...h.allowUserIds,...h.allowChatIds]:[...h.blockUserIds,...h.blockChatIds]:[],[t,h]),C=(0,s.Kr)(()=>h?h.shouldAllowPremium?[yd.lw.type]:"allow"===h.botsPrivacy&&t?[A.type]:[]:[],[h,t,A]),[y,S]=(0,s.J0)(""),[k,w]=(0,s.J0)(!1),[N,I]=(0,s.J0)(b),[P,Y]=(0,s.J0)(C);(0,s.vJ)(()=>{c||(I(b),Y(C))},[c,C,b]);const F=(0,Sd.Rh)(o.DSF),D=(0,Sd.Rh)(o._E9),M=(0,s.Kr)(()=>{const e=(0,n.mS)().chats.byId,t=(0,n.mS)().users.byId,i=(0,bi.Am)([...F||[],...D||[]]).filter(i=>{const s=e[i],n=t[i],a=n&&(0,l.PL)(n),r=s&&(0,l.WX)(s);return(!u||n)&&i!==d&&i!==o.zv8&&!r&&!a}),s=(0,Ft.PU)({ids:i,query:y});return y?s:(0,bi.Am)([...b,...i])},[F,D,b,y,d,u]),B=(0,s.hb)(e=>{Y(e),w(!0)},[]),R=(0,s.hb)(e=>{I(e),w(!0)},[]),L=(0,s.hb)(()=>{p({privacyKey:au(r),isAllowList:Boolean(t),updatedIds:N,isPremiumAllowed:P.includes(yd.lw.type)||void 0,botsPrivacy:a?P.includes(A.type)?"allow":"disallow":"none"}),m()},[t,a,P,N,m,r,A]);return(0,Ce.A)({isActive:c,onBack:m}),(0,te.FD)("div",{className:"NewChat-inner step-1",children:[(0,te.Y)(yi.A,{categories:i?uu:a&&t?f:void 0,itemIds:M||[],selectedIds:N,selectedCategories:P,filterValue:y,filterPlaceholder:v(t?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),categoryPlaceholderKey:"PrivacyUserTypes",searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:R,onSelectedCategoriesChange:B,onFilterChange:S,allowMultiple:!0,itemInputType:"checkbox",withDefaultPadding:!0,withStatus:!0}),(0,te.Y)(wi.A,{isShown:k,onClick:L,ariaLabel:v(t?"AlwaysAllow":"NeverAllow"),children:(0,te.Y)(W.A,{name:"check"})})]})})),vu=(0,s.ph)((0,n.EK)(e=>{const{config:t,reactions:i}=e;return{availableReactions:i.availableReactions,selectedReaction:t?.defaultReaction}})(e=>{let{isActive:t,availableReactions:i,selectedReaction:a,onReset:o}=e;const{setDefaultReaction:r}=(0,n.ko)();(0,Ce.A)({isActive:t,onBack:o});const l=(0,s.Kr)(()=>(i||[]).filter(e=>!e.isInactive).map(e=>({label:(0,te.FD)(te.FK,{children:[(0,te.Y)(Ns.A,{reaction:e.reaction,availableReactions:i}),e.title]}),value:e.reaction.emoticon})),[i]),c=(0,s.hb)(e=>{r({reaction:{type:"emoji",emoticon:e}})},[r]);return(0,te.Y)("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction",children:(0,te.Y)(ee.A,{name:"quick-reaction-settings",options:l,selected:"emoji"===a?.type?a.emoticon:void 0,onChange:c,withIcon:!0})})})),gu=1.5*g.$,Au=(0,s.ph)((0,n.EK)(e=>({...(0,bi.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)}))(e=>{let{isActive:t,addedSetIds:i,customEmojiSetIds:o,stickerSetsById:r,defaultReaction:l,shouldSuggestStickers:c,shouldUpdateStickerSetOrder:d,availableReactions:h,canPlayAnimatedEmojis:u,onReset:m}=e;const{setSettingOption:p,openStickerSet:v,openSettingsScreen:g}=(0,n.ko)(),A=(0,T.A)(),f=(0,s.li)(),{observe:b}=(0,lr.BL)({rootRef:f}),C=(0,s.hb)(e=>{v({stickerSetInfo:e.stickerSetInfo})},[v]),y=(0,s.hb)(e=>{p({shouldUpdateStickerSetOrder:e})},[p]),S=(0,s.hb)(e=>{p({shouldSuggestStickers:e})},[p]),k=(0,s.Kr)(()=>i&&Object.values((0,bi.Up)(r,i)),[i,r]);return(0,Ce.A)({isActive:t,onBack:m}),(0,te.FD)("div",{className:"settings-content custom-scroll",children:[(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(sn.A,{label:A("SuggestStickers"),checked:c,onCheck:S}),(0,te.FD)(ci.A,{narrow:!0,onClick:()=>g({screen:a.VS.CustomEmoji}),icon:"smile",children:[A("StickersList.EmojiItem"),o&&(0,te.Y)("span",{className:"settings-item__current-value",children:o.length})]}),l&&(0,te.FD)(ci.A,{className:"SettingsDefaultReaction",narrow:!0,onClick:()=>g({screen:a.VS.QuickReaction}),children:[(0,te.Y)(Ns.A,{reaction:l,className:"current-default-reaction",size:gu,availableReactions:h}),(0,te.Y)("div",{className:"title",children:A("DoubleTapSetting")})]})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:A("InstalledStickers.DynamicPackOrder")}),(0,te.Y)(sn.A,{label:A("InstalledStickers.DynamicPackOrder"),checked:d,onCheck:y}),(0,te.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:A("InstalledStickers.DynamicPackOrderInfo")})]}),k&&(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:A("ChooseStickerMyStickerSets")}),(0,te.Y)("div",{ref:f,children:k.map(e=>(0,te.Y)(rh,{stickerSet:e,observeIntersection:b,onClick:C,noPlay:!u},e.id))}),(0,te.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Dt.A)(A("StickersBotInfo"),["links"])})]})]})})),fu=(0,s.ph)(e=>{let{isActive:t,onReset:i}=e;const{openSettingsScreen:s}=(0,n.ko)(),r=(0,T.A)(),l=(0,M.A)(()=>{s({screen:a.VS.Privacy})});return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(Md.A,{size:o.r2x,tgsUrl:kr.w.Congratulations,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:r("TwoStepVerificationPasswordSetInfo")})]}),(0,te.Y)("div",{className:"settings-item settings-group",children:(0,te.Y)(Q.A,{onClick:l,children:r("TwoStepVerificationPasswordReturnSettings")})})]})});var bu=i(79577);const Cu=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).recoveryEmail;return{animatedEmoji:(0,c.oei)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength,recoveryEmail:t}})(e=>{let{animatedEmoji:t,codeLength:i,isLoading:n,error:a,clearError:o,onSubmit:r,isActive:l,onReset:c,recoveryEmail:d}=e;const h=(0,s.li)(),{isMobile:m}=(0,Y.Ay)(),p=m?550:400,[v,g]=(0,s.J0)("");(0,s.vJ)(()=>{u.TF||setTimeout(()=>{h.current.focus()},p)},[p]);const A=(0,T.A)();(0,Ce.A)({isActive:l,onBack:c});const f=(0,s.hb)(e=>{a&&o&&o();const t=e.target.value.slice(0,i);t.length===i&&r(t),g(t),e.target.value=t},[o,i,a,r]);return(0,te.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(bu.A,{sticker:t,size:160,className:"settings-content-icon"}),d&&(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:A("TwoStepAuth.ConfirmEmailDescription",d)})]}),(0,te.FD)("div",{className:"settings-item settings-group",children:[(0,te.Y)(Z.A,{value:v,ref:h,inputMode:"decimal",label:A("YourEmailCode"),error:a,onChange:f}),n&&(0,te.Y)(xs.A,{})]})]})})),yu=(0,s.ph)(e=>{let{isActive:t,onReset:i}=e;const{openSettingsScreen:s}=(0,n.ko)(),o=(0,T.A)();return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Lock,previewUrl:Vd,size:160,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:(0,Dt.A)(o("EnabledPasswordText"),["br"])})]}),(0,te.FD)("div",{className:"settings-item",children:[(0,te.Y)(ci.A,{icon:"edit",onClick:()=>s({screen:a.VS.TwoFaChangePasswordCurrent}),children:o("ChangePassword")}),(0,te.Y)(ci.A,{icon:"password-off",onClick:()=>s({screen:a.VS.TwoFaTurnOff}),children:o("TurnPasswordOff")}),(0,te.Y)(ci.A,{icon:"email",onClick:()=>s({screen:a.VS.TwoFaRecoveryEmailCurrentPassword}),children:o("SetRecoveryEmail")})]})]})}),Su=(0,s.ph)((0,n.EK)((e,t)=>{let{icon:i}=t;return{animatedEmoji:(0,c.oei)(e,"email"===i?"💌":"💡")}})(e=>{let{animatedEmoji:t,type:i="text",isLoading:n,error:a,placeholder:o,shouldConfirm:r,clearError:l,onSubmit:c,isActive:d,onReset:h}=e;const m=(0,s.li)(),{isMobile:p}=(0,Y.Ay)(),v=p?550:400,[g,A]=(0,s.J0)(""),[f,b,C]=(0,F.A)(!1);(0,s.vJ)(()=>{u.TF||setTimeout(()=>{m.current.focus()},v)},[v]);const y=(0,s.hb)(e=>{a&&l&&l(),A(e.target.value)},[l,a]),S=(0,s.hb)(()=>{c()},[c]),k=(0,s.hb)(()=>{C(),c()},[c,C]),w=(0,T.A)();return(0,Ce.A)({isActive:d,onBack:h}),(0,te.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(bu.A,{sticker:t,size:160,className:"settings-content-icon"}),"email"===i&&(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:w("RecoveryEmailSubtitle")})]}),(0,te.FD)("div",{className:"settings-item settings-group",children:[(0,te.FD)("form",{action:"",onSubmit:e=>{e.preventDefault(),m.current&&c(g)},children:[(0,te.Y)(Z.A,{ref:m,value:g,inputMode:i,label:o,error:a,onChange:y}),g?(0,te.Y)(Q.A,{type:"submit",isLoading:n,ripple:!0,children:w("Continue")}):(0,te.Y)(Q.A,{isText:!0,isLoading:n,ripple:!0,onClick:r?b:S,children:w("YourEmailSkip")})]}),r&&(0,te.FD)(X.A,{className:"narrow",isOpen:f,title:w("YourEmailSkipWarning"),onClose:C,children:[(0,Dt.A)(w("YourEmailSkipWarningText"),["br","simple_markdown"]),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:k,children:w("YourEmailSkip")}),(0,te.Y)(Q.A,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:C,children:w("Cancel")})]})]})]})]})})),ku=(0,s.ph)(e=>{let{isActive:t,onReset:i,onStart:s}=e;const n=(0,T.A)();return(0,Ce.A)({isActive:t,onBack:i}),(0,te.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,te.FD)("div",{className:"settings-content-header no-border",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Lock,previewUrl:Vd,size:160,className:"settings-content-icon"}),(0,te.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:n("SetAdditionalPasswordInfo")})]}),(0,te.Y)("div",{className:"settings-item settings-group",children:(0,te.Y)(Q.A,{onClick:s,children:n("EditAdminTransferSetPassword")})})]})}),wu=(0,s.ph)((0,n.EK)(e=>({...e.twoFaSettings}))(e=>{let{currentScreen:t,shownScreen:i,state:o,hint:r,isLoading:l,errorKey:c,waitingEmailCodeLength:d,dispatch:h,isActive:u,onReset:m}=e;const{updatePassword:p,checkPassword:v,clearTwoFaError:g,updateRecoveryEmail:A,provideTwoFaEmailCode:f,clearPassword:b,openSettingsScreen:C}=(0,n.ko)(),y=(0,_i.A)(),S=(0,T.A)();(0,s.vJ)(()=>{d&&(t===a.VS.TwoFaNewPasswordEmail?C({screen:a.VS.TwoFaNewPasswordEmailCode}):t===a.VS.TwoFaRecoveryEmail&&C({screen:a.VS.TwoFaRecoveryEmailCode}))},[t,d,C]);const k=(0,s.hb)(()=>{h({type:"reset"}),C({screen:a.VS.TwoFaNewPassword})},[h,C]),w=(0,s.hb)(e=>{h({type:"setPassword",payload:e}),C({screen:a.VS.TwoFaNewPasswordConfirm})},[h,C]),N=(0,s.hb)(()=>{C({screen:a.VS.TwoFaNewPasswordHint})},[C]),I=(0,s.hb)(e=>{h({type:"setHint",payload:e}),C({screen:a.VS.TwoFaNewPasswordEmail})},[h,C]),P=(0,s.hb)(e=>{h({type:"setEmail",payload:e}),p({...o,email:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[h,o,p,C]),Y=(0,s.hb)(e=>{h({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{C({screen:a.VS.TwoFaChangePasswordNew})}})},[v,h,C]),F=(0,s.hb)(e=>{h({type:"setPassword",payload:e}),C({screen:a.VS.TwoFaChangePasswordConfirm})},[h,C]),D=(0,s.hb)(()=>{C({screen:a.VS.TwoFaChangePasswordHint})},[C]),M=(0,s.hb)(e=>{h({type:"setHint",payload:e}),p({...o,hint:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[h,o,p,C]),B=(0,s.hb)(e=>{b({currentPassword:e,onSuccess:()=>{C({screen:a.VS.Privacy})}})},[b,C]),R=(0,s.hb)(e=>{h({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{C({screen:a.VS.TwoFaRecoveryEmail})}})},[v,h,C]),L=(0,s.hb)(e=>{h({type:"setEmail",payload:e}),A({...o,email:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[h,o,A,C]),x=(0,s.hb)(e=>{f({code:e})},[f]);switch(t){case a.VS.TwoFaDisabled:return(0,te.Y)(ku,{onStart:k,isActive:u||[a.VS.TwoFaNewPassword,a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaNewPassword:return(0,te.Y)(xd,{placeholder:S("PleaseEnterPassword"),submitLabel:S("Continue"),onSubmit:w,isActive:u||[a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaNewPasswordConfirm:return(0,te.Y)(xd,{expectedPassword:o.password,placeholder:S("PleaseReEnterPassword"),submitLabel:S("Continue"),onSubmit:N,isActive:u||[a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaNewPasswordHint:return(0,te.Y)(Su,{icon:"hint",placeholder:S("PasswordHintPlaceholder"),onSubmit:I,isActive:u||[a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaNewPasswordEmail:return(0,te.Y)(Su,{icon:"email",type:"email",isLoading:l,error:c&&y.withRegular(c),clearError:g,placeholder:S("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:P,isActive:u||[a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaNewPasswordEmailCode:return(0,te.Y)(Cu,{isLoading:l,error:c&&y.withRegular(c),clearError:g,onSubmit:x,isActive:u||i===a.VS.TwoFaCongratulations,onReset:m});case a.VS.TwoFaCongratulations:return(0,te.Y)(fu,{isActive:u,onReset:m});case a.VS.TwoFaEnabled:return(0,te.Y)(yu,{isActive:u||[a.VS.TwoFaChangePasswordCurrent,a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaTurnOff,a.VS.TwoFaRecoveryEmailCurrentPassword,a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaChangePasswordCurrent:return(0,te.Y)(xd,{isLoading:l,error:c&&y.withRegular(c),onClearError:g,hint:r,onSubmit:Y,isActive:u||[a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaChangePasswordNew:return(0,te.Y)(xd,{placeholder:S("PleaseEnterNewFirstPassword"),onSubmit:F,isActive:u||[a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaChangePasswordConfirm:return(0,te.Y)(xd,{expectedPassword:o.password,placeholder:S("PleaseReEnterPassword"),onSubmit:D,isActive:u||[a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaChangePasswordHint:return(0,te.Y)(Su,{isLoading:l,error:c&&y.withRegular(c),clearError:g,icon:"hint",placeholder:S("PasswordHintPlaceholder"),onSubmit:M,isActive:u||i===a.VS.TwoFaCongratulations,onReset:m});case a.VS.TwoFaTurnOff:return(0,te.Y)(xd,{isLoading:l,error:c&&y.withRegular(c),onClearError:g,hint:r,onSubmit:B,isActive:u,onReset:m});case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,te.Y)(xd,{isLoading:l,error:c&&y.withRegular(c),onClearError:g,hint:r,onSubmit:R,isActive:u||[a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaRecoveryEmail:return(0,te.Y)(Su,{icon:"email",type:"email",placeholder:S("RecoveryEmailTitle"),onSubmit:L,isActive:u||[a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(i),onReset:m});case a.VS.TwoFaRecoveryEmailCode:return(0,te.Y)(Cu,{isLoading:l,error:c&&y.withRegular(c),clearError:g,onSubmit:x,isActive:u||i===a.VS.TwoFaCongratulations,onReset:m});default:return}})),Nu=Object.keys(a.VS).length/2,Iu=[a.VS.TwoFaDisabled,a.VS.TwoFaNewPassword,a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations,a.VS.TwoFaEnabled,a.VS.TwoFaChangePasswordCurrent,a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaTurnOff,a.VS.TwoFaRecoveryEmailCurrentPassword,a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode],Pu=[a.VS.PasscodeDisabled,a.VS.PasscodeEnabled],Yu=[a.VS.Folders,a.VS.FoldersCreateFolder,a.VS.FoldersEditFolder,a.VS.FoldersEditFolderFromChatList,a.VS.FoldersEditFolderInvites,a.VS.FoldersIncludedChats,a.VS.FoldersIncludedChatsFromChatList,a.VS.FoldersExcludedChats,a.VS.FoldersExcludedChatsFromChatList,a.VS.FoldersShare],Fu=[a.VS.PrivacyBlockedUsers,a.VS.ActiveWebsites],Du=[a.VS.PrivacyPhoneNumberAllowedContacts,a.VS.PrivacyPhoneNumberDeniedContacts],Mu=[a.VS.PrivacyLastSeenAllowedContacts,a.VS.PrivacyLastSeenDeniedContacts],Tu=[a.VS.PrivacyProfilePhotoAllowedContacts,a.VS.PrivacyProfilePhotoDeniedContacts],Bu=[a.VS.PrivacyBioAllowedContacts,a.VS.PrivacyBioDeniedContacts],Ru=[a.VS.PrivacyBirthdayAllowedContacts,a.VS.PrivacyBirthdayDeniedContacts],Lu=[a.VS.PrivacyGiftsAllowedContacts,a.VS.PrivacyGiftsDeniedContacts],xu=[a.VS.PrivacyPhoneCallAllowedContacts,a.VS.PrivacyPhoneCallDeniedContacts],Eu=[a.VS.PrivacyPhoneP2PAllowedContacts,a.VS.PrivacyPhoneP2PDeniedContacts],Vu=[a.VS.PrivacyForwardingAllowedContacts,a.VS.PrivacyForwardingDeniedContacts],_u=[a.VS.PrivacyVoiceMessagesAllowedContacts,a.VS.PrivacyVoiceMessagesDeniedContacts],Uu=[a.VS.PrivacyGroupChatsAllowedContacts,a.VS.PrivacyGroupChatsDeniedContacts],Ou=[a.VS.PrivacyNoPaidMessages],Ku=(0,s.ph)(e=>{let{isActive:t,currentScreen:i,foldersState:o,foldersDispatch:r,onReset:l,animationLevel:d,shouldSkipTransition:h}=e;const{closeShareChatFolderModal:u,openSettingsScreen:m}=(0,n.ko)(),p=(0,s.li)(),[v,g]=(0,gd.A)(fd,Ad),[A,f]=(0,s.J0)("");(0,bd.A)({containerRef:p,selector:".settings-content"},[i]);const b=(0,M.A)(e=>{const t=(0,c.nTw)((0,n.mS)()).shareFolderScreen?.isFromSettings;i===a.VS.FoldersShare&&u(),!0===e||void 0!==t&&!t?l(!0):(i!==a.VS.FoldersCreateFolder&&i!==a.VS.FoldersEditFolder&&i!==a.VS.FoldersEditFolderFromChatList&&i!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{r({type:"reset"})},200),i!==a.VS.FoldersIncludedChats&&i!==a.VS.FoldersExcludedChats?l():"create"===o.mode?m({screen:a.VS.FoldersCreateFolder}):m({screen:a.VS.FoldersEditFolder}))});function C(e,s){const n={[a.VS.PrivacyPhoneNumber]:Du.includes(s),[a.VS.PrivacyLastSeen]:Mu.includes(s),[a.VS.PrivacyProfilePhoto]:Tu.includes(s),[a.VS.PrivacyBio]:Bu.includes(s),[a.VS.PrivacyBirthday]:Ru.includes(s),[a.VS.PrivacyGifts]:Lu.includes(s),[a.VS.PrivacyPhoneCall]:xu.includes(s),[a.VS.PrivacyPhoneP2P]:Eu.includes(s),[a.VS.PrivacyForwarding]:Vu.includes(s),[a.VS.PrivacyVoiceMessages]:_u.includes(s),[a.VS.PrivacyGroupChats]:Uu.includes(s),[a.VS.PrivacyMessages]:Ou.includes(s)},l=Iu.includes(s),c=Pu.includes(s),d=Yu.includes(s),h=Fu.includes(s)||l||c||Object.keys(n).map(Number).includes(s)||Object.values(n).includes(!0);switch(i){case a.VS.Main:return(0,te.Y)(zh,{isActive:t,onReset:b});case a.VS.EditProfile:return(0,te.Y)(Sh,{isActive:t&&e,onReset:b});case a.VS.General:return(0,te.Y)(Dh,{isActive:e||s===a.VS.GeneralChatBackgroundColor||s===a.VS.GeneralChatBackground||s===a.VS.QuickReaction||s===a.VS.CustomEmoji||h||d,onReset:b});case a.VS.QuickReaction:return(0,te.Y)(vu,{isActive:e,onReset:b});case a.VS.CustomEmoji:return(0,te.Y)(lh,{isActive:e,onReset:b});case a.VS.Notifications:return(0,te.Y)(qh,{isActive:e,onReset:b});case a.VS.DataStorage:return(0,te.Y)(ch,{isActive:e,onReset:b});case a.VS.Privacy:return(0,te.Y)(iu,{isActive:e||h,onReset:b});case a.VS.Language:return(0,te.Y)(Kh,{isActive:e||s===a.VS.DoNotTranslate,onReset:b});case a.VS.DoNotTranslate:return(0,te.Y)(mh,{isActive:e,onReset:b});case a.VS.Stickers:return(0,te.Y)(Au,{isActive:e,onReset:b});case a.VS.Experimental:return(0,te.Y)(Ph,{isActive:e,onReset:b});case a.VS.GeneralChatBackground:return(0,te.Y)(Lh,{isActive:e||s===a.VS.GeneralChatBackgroundColor,onReset:b});case a.VS.GeneralChatBackgroundColor:return(0,te.Y)(Uh,{isActive:e,onReset:b});case a.VS.ActiveSessions:return(0,te.Y)(ih,{isActive:e,onReset:b});case a.VS.ActiveWebsites:return(0,te.Y)(oh,{isActive:e,onReset:b});case a.VS.PrivacyBlockedUsers:return(0,te.Y)(nu,{isActive:e,onReset:b});case a.VS.PrivacyPhoneNumber:case a.VS.PrivacyLastSeen:case a.VS.PrivacyProfilePhoto:case a.VS.PrivacyBio:case a.VS.PrivacyBirthday:case a.VS.PrivacyGifts:case a.VS.PrivacyPhoneCall:case a.VS.PrivacyForwarding:case a.VS.PrivacyVoiceMessages:case a.VS.PrivacyGroupChats:return(0,te.Y)(hu,{screen:i,isActive:e||n[i],onReset:b});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:case a.VS.PrivacyNoPaidMessages:return(0,te.Y)(pu,{isAllowList:!0,usersOnly:i===a.VS.PrivacyNoPaidMessages,withPremiumCategory:i===a.VS.PrivacyGroupChatsAllowedContacts,withMiniAppsCategory:i===a.VS.PrivacyGiftsAllowedContacts,screen:i,isActive:e||n[i],onReset:b});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,te.Y)(pu,{screen:i,isActive:e,onReset:b});case a.VS.PrivacyMessages:return(0,te.Y)(Wd,{isActive:e,onReset:b});case a.VS.Folders:case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:case a.VS.FoldersShare:return(0,te.Y)(Bd,{currentScreen:i,shownScreen:s,state:o,dispatch:r,isActive:e,onReset:b});case a.VS.TwoFaDisabled:case a.VS.TwoFaNewPassword:case a.VS.TwoFaNewPasswordConfirm:case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaCongratulations:case a.VS.TwoFaEnabled:case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:case a.VS.TwoFaChangePasswordHint:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:case a.VS.TwoFaRecoveryEmail:case a.VS.TwoFaRecoveryEmailCode:return(0,te.Y)(wu,{currentScreen:i,state:v,dispatch:g,shownScreen:s,isActive:e,onReset:b});case a.VS.PasscodeDisabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:case a.VS.PasscodeChangePasscodeConfirm:case a.VS.PasscodeCongratulations:case a.VS.PasscodeEnabled:case a.VS.PasscodeTurnOff:return(0,te.Y)(Od,{currentScreen:i,passcode:A,onSetPasscode:f,shownScreen:s,isActive:e,onReset:b});case a.VS.Performance:return(0,te.Y)(tu,{isActive:e,onReset:b});default:return}}return(0,te.Y)(ne.Ay,{ref:p,id:"Settings",name:(0,Ac.P)("layers",d,h),activeKey:i,renderCount:Nu,shouldWrap:!0,withSwipeControl:!0,children:function(e,t,s,n){return(0,te.FD)(te.FK,{children:[(0,te.Y)(Oh,{currentScreen:i,onReset:b,editedFolderId:o.folderId}),C(e,n)]})}})}),Ju=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{byId:i,statusesById:s}=e.users;return{usersById:i,userStatusesById:s,contactIds:t}})(e=>{let{isActive:t,filter:i,usersById:o,userStatusesById:r,contactIds:c,onReset:d}=e;const{openChat:h,openNewContactDialog:u}=(0,n.ko)(),m=(0,T.A)(),{isMobile:p}=(0,Y.Ay)();(0,Ce.A)({isActive:t,onBack:d});const v=(0,s.hb)(e=>{h({id:e,shouldReplaceHistory:!0})},[h]),g=(0,s.Kr)(()=>{if(!c)return;const e=(0,Ft.PU)({ids:c,query:i,type:"user"});return(0,l.UB)(e,o,r)},[c,i,o,r]),[A,f]=(0,Bs.A)(void 0,g,Boolean(i));return(0,te.FD)(Cs.A,{items:A,onLoadMore:f,className:"chat-list custom-scroll",children:[A?.length?A.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable contact-list-item",onClick:()=>v(e),children:(0,te.Y)(ws.A,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:a.G9.ChatList,ripple:!p})},e)):A&&!A.length?(0,te.Y)("p",{className:"no-results",dir:"auto",children:i.length?"No contacts matched your search.":"Contact list is empty."},"no-results"):(0,te.Y)(xs.A,{},"loading"),(0,te.Y)(wi.A,{isShown:!0,onClick:u,ariaLabel:m("CreateNewContact"),children:(0,te.Y)(W.A,{name:"add-user-filled"})},"create-new-contact")]})})),Gu=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{query:i,fetchingStatus:s,globalResults:n,localResults:a}=(0,c.nTw)(e).globalSearch,{peerIds:o}=n||{},{peerIds:r}=a||{};return{localContactIds:t,searchQuery:i,isSearching:s?.chats,globalPeerIds:o,localPeerIds:r}})(e=>{let{isChannel:t,isActive:i,selectedMemberIds:a,localContactIds:o,searchQuery:r,isSearching:c,localPeerIds:d,globalPeerIds:h,onSelectedMemberIdsChange:u,onNextStep:m,onReset:p}=e;const{setGlobalSearchQuery:v}=(0,n.ko)(),g=(0,T.A)();(0,Ce.A)({isActive:i,onBack:p});const A=(0,s.hb)(e=>{v({query:e})},[]),f=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=o?(0,Ft.PU)({ids:o,query:r,type:"user"}):[];return(0,Ms.A)((0,bi.Am)([...t,...d||[],...h||[]]).filter(t=>{const i=e[t];return i&&!i.isSelf&&(i.canBeInvitedToGroup||!(0,l.tv)(i))}),!1,a)},[o,r,d,h,a]),b=(0,s.hb)(()=>{v({query:""}),m()},[m]);return(0,te.FD)("div",{className:"NewChat step-1",children:[(0,te.FD)("div",{className:"left-header",children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:p,ariaLabel:"Return to Chat List",children:(0,te.Y)(W.A,{name:"arrow-left"})}),(0,te.Y)("h3",{children:g("GroupAddMembers")})]}),(0,te.FD)("div",{className:"NewChat-inner step-1",children:[(0,te.Y)(yi.A,{itemIds:f,selectedIds:a,filterValue:r,filterPlaceholder:g("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:c,isSearchable:!0,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox",withDefaultPadding:!0,onSelectedIdsChange:u,onFilterChange:A}),(0,te.Y)(wi.A,{isShown:!0,onClick:b,ariaLabel:t?"Continue To Channel Info":"Continue To Group Info",children:(0,te.Y)(W.A,{name:"arrow-right"})})]})]})})),ju=(0,s.ph)((0,n.EK)(e=>{const{progress:t,error:i}=(0,c.nTw)(e).chatCreation||{};return{creationProgress:t,creationError:i,maxGroupSize:e.config?.maxGroupSize}})(e=>{let{isChannel:t,isActive:i,memberIds:o,maxGroupSize:r,creationProgress:c,creationError:d,onReset:h}=e;const{createGroupChat:u,createChannel:m}=(0,n.ko)(),p=(0,T.A)();(0,Ce.A)({isActive:i,onBack:h});const[v,g]=(0,s.J0)(""),[A,f]=(0,s.J0)(""),[b,C]=(0,s.J0)(),[y,S]=(0,s.J0)(),k="Chat title can't be empty",w="Channel title can't be empty",N=c===a.n7.InProgress;(0,s.vJ)(()=>{if(t)return;if(!o.length||o.length>4)return void g("");const e=(0,n.mS)(),i=e.users.byId,s=[e.currentUserId,...o].map(e=>(0,l.u0)(i[e])).filter(Boolean),a=s.slice(0,-1).join(", ")+p("CreateGroup.PeersTitleLastDelimeter")+s[s.length-1];g(a)},[t,o,p]);const I=(0,s.hb)(e=>{const{value:t}=e.currentTarget,i=t.replace(/^\s+/,"");g(i),i!==t&&(e.currentTarget.value=i)},[]),P=(0,s.hb)(e=>{f(e.currentTarget.value)},[]),Y=(0,s.hb)(()=>{v.length?r&&o.length>=r?S("Sorry, creating supergroups is not yet supported"):u({title:v,photo:b,memberIds:o}):S(k)},[v,o,r,u,b]),F=(0,s.hb)(()=>{v.length?m({title:v,about:A,photo:b,memberIds:o,isChannel:!0}):S(w)},[v,m,A,b,o,w]);(0,s.vJ)(()=>{c===a.n7.Complete&&h(!0)},[c,h]);const D=d&&p(d)||(y!==k&&y!==w?y:void 0);return(0,te.FD)("div",{className:"NewChat",children:[(0,te.FD)("div",{className:"left-header",children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>h(),ariaLabel:"Return to member selection",children:(0,te.Y)(W.A,{name:"arrow-left"})}),(0,te.Y)("h3",{children:p(t?"NewChannel":"NewGroup")})]}),(0,te.FD)("div",{className:"NewChat-inner step-2",children:[(0,te.Y)(bh.A,{onChange:C,title:p("AddPhoto")}),(0,te.Y)(Z.A,{value:v,onChange:I,label:p(t?"EnterChannelName":"GroupName"),error:y===k||y===w?y:void 0}),t&&(0,te.FD)(te.FK,{children:[(0,te.Y)(Z.A,{value:A,onChange:P,label:p("DescriptionOptionalPlaceholder")}),(0,te.Y)("p",{className:"note",children:p("DescriptionInfo")})]}),D&&(0,te.Y)("p",{className:"error",children:D}),o.length>0&&(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:"chat-members-heading",children:p("GroupInfo.ParticipantCount",o.length,"i")}),(0,te.Y)("div",{className:"chat-members-list custom-scroll",children:o.map(e=>(0,te.Y)(ci.A,{inactive:!0,className:"chat-item-clickable",children:(0,te.Y)(ws.A,{userId:e})}))})]})]}),(0,te.Y)(wi.A,{isShown:0!==v.length,onClick:t?F:Y,disabled:N,ariaLabel:t?p("ChannelIntro.CreateChannel"):"Create Group",children:N?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"arrow-right"})})]})})),zu=Object.keys(a.Bn).length/2,Hu=(0,s.ph)(e=>{let{isActive:t,isChannel:i=!1,content:o,animationLevel:r,onReset:l}=e;const{openLeftColumnContent:c,setGlobalSearchQuery:d}=(0,n.ko)(),[h,u]=(0,s.J0)([]),m=(0,s.hb)(()=>{c({contentKey:i?a.Bn.NewChannelStep2:a.Bn.NewGroupStep2})},[i]),p=(0,M.A)(e=>{const t=e.length>h.length;u(e),t&&d({query:""})});return(0,te.Y)(ne.Ay,{id:"NewChat",name:(0,Ac.P)("layers",r),renderCount:zu,activeKey:o,children:e=>{switch(o){case a.Bn.NewChannelStep1:case a.Bn.NewGroupStep1:return(0,te.Y)(Gu,{isChannel:i,isActive:t,selectedMemberIds:h,onSelectedMemberIdsChange:p,onNextStep:m,onReset:l});case a.Bn.NewChannelStep2:case a.Bn.NewGroupStep2:return(0,te.Y)(ju,{isChannel:i,isActive:e&&t,memberIds:h,onReset:l});default:return}}})});var $u=i(34458),qu=i(11462),Wu=i(24920),Qu=i(75343),Zu=i(40175),Xu=i(41118),em=i(90054);const tm=(0,s.ph)(e=>{let{isActive:t,isForumPanelOpen:i,archiveSettings:s,isStoryRibbonShown:a,onReset:r,onTopicSearch:l,foldersDispatch:c}=e;const{updateArchiveSettings:d}=(0,n.ko)(),h=(0,T.A)();(0,Ce.A)({isActive:t,onBack:r});const u=(0,M.A)(()=>{d({isHidden:!1})}),{shouldDisableDropdownMenuTransitionRef:m,handleDropdownMenuTransitionEnd:p}=(0,Wu.A)(i),{shouldRender:v,transitionClassNames:g}=(0,Ke.A)(!i,void 0,void 0,!1),{shouldRenderForumPanel:A,handleForumPanelAnimationEnd:f,handleForumPanelAnimationStart:b,isAnimationStarted:C}=(0,qu.A)(i),y=i&&C,{shouldRender:S,transitionClassNames:k,isClosing:w}=(0,Ke.A)(a,void 0,void 0,"",!1,$u.UG+o.xB5);return(0,te.FD)("div",{className:"ArchivedChats",children:[(0,te.FD)("div",{className:(0,me.A)("left-header",!S&&"left-header-shadow"),children:[h.isRtl&&(0,te.Y)("div",{className:"DropdownMenuFiller"}),(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:"Return to chat list",className:(0,me.A)(h.isRtl&&"rtl",y&&h.isRtl&&"right-aligned",m.current&&h.isRtl&&"disable-transition"),onTransitionEnd:p,children:(0,te.Y)(W.A,{name:"arrow-left"})}),v&&(0,te.Y)("h3",{className:g,children:h("ArchivedChats")}),(0,te.Y)("div",{className:"story-toggler-wrapper",children:(0,te.Y)(Zu.A,{canShow:!0,isArchived:!0})}),s.isHidden&&(0,te.Y)(ce.A,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:h.isRtl?p:void 0,children:(0,te.Y)(de.A,{icon:"archive-from-main",onClick:u,children:h("lng_context_archive_to_list")})})]}),(0,te.FD)("div",{className:(0,me.A)("chat-list-wrapper",S&&"with-story-ribbon",k),children:[S&&(0,te.Y)(Qu.A,{isArchived:!0,className:"left-header-shadow",isClosing:w}),(0,te.Y)(Xu.A,{folderType:"archived",isActive:t,isForumPanelOpen:y,isMainList:!0,foldersDispatch:c,archiveSettings:s})]}),A&&(0,te.Y)(em.A,{isOpen:i,onTopicSearch:l,onOpenAnimationStart:b,onCloseAnimationEnd:f})]})}),im=(0,s.ph)((0,n.EK)(e=>{const{byId:t,orderedIds:i}=e.chatFolders;return{foldersById:t,folderOrderedIds:i}})(e=>{let{isOpen:t,chatId:i,foldersById:a,folderOrderedIds:r,onClose:l,onCloseAnimationEnd:c}=e;const{editChatFolders:d}=(0,n.ko)(),h=(0,T.A)(),u=(0,s.Kr)(()=>a?Object.keys(a).reduce((e,t)=>{const{includedChatIds:s,pinnedChatIds:n}=a[Number(t)];return(s.includes(i)||n?.includes(i))&&e.push(t),e},[]):[],[i,a]),[m,p]=(0,s.J0)(u),v=(0,s.Kr)(()=>r?.filter(e=>e!==o.DSF).map(e=>{const t=a?a[e]:void 0;return{label:t?(0,Xi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}):"",value:String(e)}})||[],[r,a]),g=(0,s.hb)(()=>{const e=u.filter(e=>!m.includes(e)).map(Number),t=m.filter(e=>!u.includes(e)).map(Number);d({chatId:i,idsToRemove:e,idsToAdd:t}),l()},[i,d,u,l,m]);if(a&&r)return(0,te.FD)(X.A,{isOpen:t,onClose:l,onCloseAnimationEnd:c,onEnter:g,className:(0,me.A)("_fJBBCCE","delete"),contentClassName:"EG5lPWY1",title:h("FilterAddTo"),children:[(0,te.Y)("div",{className:(0,me.A)("heYMHiUt","custom-scroll"),children:(0,te.Y)(ql.A,{options:v,selected:m,onChange:p})}),(0,te.Y)("div",{className:"_jtqAaUU",children:(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:g,children:h("FilterAddTo")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:h("Cancel")})]})})]})}));var sm=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(sm||{});const nm=(0,s.ph)(e=>{let{isOpen:t,chatId:i,topicId:a,onClose:r,onCloseAnimationEnd:l}=e;const[c,d]=(0,s.J0)(sm.Forever),{updateChatMutedState:h,updateTopicMutedState:u}=(0,n.ko)(),m=(0,T.A)(),p=(0,s.Kr)(()=>[{label:m("MuteFor.Hours",1),value:sm.OneHour},{label:m("MuteFor.Hours",4),value:sm.FourHours},{label:m("MuteFor.Hours",8),value:sm.EightHours},{label:m("MuteFor.Days",1),value:sm.OneDay},{label:m("MuteFor.Days",3),value:sm.ThreeDays},{label:m("MuteFor.Forever"),value:sm.Forever}],[m]),v=(0,s.hb)(()=>{let e;e=c===sm.Forever?o.xEh:Math.floor(Date.now()/1e3)+Number(c),a?u({chatId:i,topicId:a,mutedUntil:e}):h({chatId:i,mutedUntil:e}),r()},[i,c,r,a]);return(0,te.FD)(X.A,{isOpen:t,onClose:r,onCloseAnimationEnd:l,onEnter:v,className:"delete",title:m("Notifications"),children:[(0,te.Y)(ee.A,{className:"dialog-checkbox-group",name:"muteFor",options:p,selected:c,onChange:d}),(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(Q.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v,children:m("Common.Done")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:r,children:m("Cancel")})]})]})});var am=i(99515),om=i(24531);const rm=(0,s.ph)((0,n.EK)((e,t)=>{let{fromSticker:i,stickerSetShortName:s}=t;const n=(0,c.Xf0)(e),{chatId:a,threadId:o}=n||{},r=a&&(0,c.hds)(e,a),d=a?(0,c.AWZ)(e,a):void 0,h=a&&(0,c.yps)(e,a),u=a?(0,c.nZ4)(e,a):void 0,m=r?(0,l.Q_)(r,d,Boolean(h),u):void 0,p=a&&o?(0,c.Vw0)(e,a,o):void 0,v=Boolean(!p?.isCommentsInfo&&p?.fromChannelId),g=a&&o?(0,c.S0q)(e,a,o):void 0,A=Boolean(r&&o&&(0,l.__)(r,g,v,d)&&m?.canSendStickers),f=i?i.stickerSetInfo:s?{shortName:s}:void 0,b=f?(0,c.ycM)(e,f):void 0,C=a?(0,c.WA9)(e,a):void 0;return{canScheduleUntilOnline:Boolean(a)&&(0,c.RBq)(e,a),canSendStickers:A,isSavedMessages:u,shouldSchedule:!C&&(0,c.PIP)(e),stickerSet:b,isCurrentUserPremium:(0,c.g29)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:n}})(e=>{let{isOpen:t,fromSticker:i,stickerSetShortName:a,stickerSet:r,canSendStickers:l,canScheduleUntilOnline:c,shouldSchedule:d,isSavedMessages:h,isCurrentUserPremium:u,shouldUpdateStickerSetOrder:m,currentMessageList:p,onClose:v}=e;const{loadStickers:g,toggleStickerSet:A,sendMessage:f,showNotification:b}=(0,n.ko)(),C=(0,s.li)(),y=(0,s.li)(),S=(0,T.A)(),{isMobile:k}=(0,Y.Ay)(),w=(0,_.A)(r),N=r||w,I=Boolean(!N?.isArchived&&N?.installedDate),P=N?.isEmoji,[F,D]=(0,om.A)(c),{handleScroll:M,isAtBeginning:B}=bs(),{observe:R}=(0,lr.BL)({rootRef:C,throttleMs:200,isDisabled:!t});(0,s.vJ)(()=>{t&&!N?.stickers&&g({stickerSetInfo:i?i.stickerSetInfo:{shortName:a}})},[t,i,g,a,N]);const L=(0,s.hb)((e,t,i)=>{p&&(e={...e,isPreloadedGlobally:!0},d||i?F(i=>{f({messageList:p,sticker:e,isSilent:t,scheduledAt:i}),v()}):(f({messageList:p,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:m&&I}),v()))},[p,d,F,v,m,I]),x=(0,s.hb)(()=>{N&&(A({stickerSetId:N.id}),v())},[v,N,A]),E=(0,s.hb)(()=>{if(!N)return;const{shortName:e}=N,t=P?"addemoji":"addstickers",i=`${o.jsp}${t}/${e}`;(0,mc.eM)(i),b({message:S("LinkCopied")})},[P,S,N,b]),V=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{round:!0,ripple:!k,size:"smaller",color:"translucent",className:i?"active":"",onClick:t,ariaLabel:"More actions",children:(0,te.Y)(W.A,{name:"more"})})},[k]);return(0,te.FD)(X.A,{className:(0,me.A)("StickerSetModal",P&&"custom-emoji"),isOpen:t,onClose:v,header:function(){const e=(0,me.A)("modal-header",!B&&"with-top-border");return(0,te.FD)("div",{className:e,dir:S.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:S("Close"),onClick:v,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:N?(0,Dt.A)(N.title,["emoji","links"]):S("AccDescrStickerSet")}),(0,te.Y)(ce.A,{className:"stickers-more-menu with-menu-transitions",trigger:V,positionX:"right",children:(0,te.Y)(de.A,{icon:"copy",onClick:E,children:S("StickersCopy")})})]})}(),children:[N?.stickers?(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{ref:C,className:"stickers custom-scroll",onScroll:M,children:(0,te.FD)("div",{className:"shared-canvas-container stickers-grid",children:[(0,te.Y)("canvas",{ref:y,className:"shared-canvas"}),N.stickers.map(e=>(0,te.Y)(yr,{sticker:e,size:P?o.$nk:o.GhT,observeIntersection:R,onClick:l&&!P?L:void 0,clickArg:e,isSavedMessages:h,isCurrentUserPremium:u,sharedCanvasRef:y}))]})}),(0,te.Y)("div",{className:"button-wrapper",children:(0,te.Y)(Q.A,{fluid:!0,color:I?"danger":"primary",onClick:x,children:(()=>{if(!N)return S("Loading");const e=P?"Emoji":"Sticker";return S(I?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,N.count,"i")})()})})]}):(0,te.Y)(xs.A,{}),D]})})),lm={root:"nZYT4vJ3",sets:"JzkmXjFF"},cm=(0,s.ph)((0,n.EK)(e=>({canPlayAnimatedEmojis:(0,c.BWX)(e)}))(e=>{let{customEmojiSetIds:t,canPlayAnimatedEmojis:i,onClose:a}=e;const{openStickerSet:o}=(0,n.ko)(),r=(0,T.A)(),l=(0,s.Kr)(()=>t?.map(e=>(0,n.mS)().stickers.setsById[e]),[t]),c=(0,s.li)(),{observe:d}=(0,lr.BL)({rootRef:c,isDisabled:!l}),h=(0,_.A)(l),u=l||h,m=(0,M.A)(e=>{o({stickerSetInfo:e.stickerSetInfo})});return(0,te.Y)(X.A,{isOpen:Boolean(l),className:lm.root,onClose:a,hasCloseButton:!0,title:r("lng_custom_emoji_used_sets"),children:(0,te.Y)("div",{className:(0,me.A)(lm.sets,"custom-scroll"),ref:c,teactFastList:!0,children:u?.map(e=>(0,te.Y)(rh,{className:lm.setCard,stickerSet:e,onClick:m,observeIntersection:d,noPlay:!i},e.id))})})}));var dm=i(54314),hm=i(60859);const um={settings:{icon:"bots",label:"BotSettings"},help:{icon:"help",label:"BotHelp"}},mm=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i,threadId:s}=t;const n=(0,c.hds)(e,i),a=(0,c._ls)(e,i);if(!n||a)return{};const o=(0,v.L8)(n.id),r=o?(0,c.mBe)(e,i):void 0,d=r&&(0,l.Gh)(r),h=s===O.l3,u=(0,c.nZ4)(e,i),{chatId:m,threadId:p}=(0,c.Xf0)(e)||{},g=h&&!r&&((0,l.WX)(n)||(0,l.YE)(n))&&!(0,l.SJ)(n),A=(0,l.DX)(i)?void 0:(0,c.yps)(e,i),f=o?(0,c.vGo)(e,i):void 0,b=o?void 0:(0,c.AWZ)(e,i),C=f||b,y=(0,c.X2D)(e,i),S=(0,c.S0q)(e,i,s),k=n.isForum&&(n.isCreator||!(0,l.Sq)(n,"manageTopics")||(0,l.ub)(n,"manageTopics")),w=S&&(0,l.l1)(n,S),N=(0,c.e5V)(e,i),I=(0,c.jGY)(e,i)&&C?.isTranslationDisabled,P=(0,l.cG)(i,s,e.currentUserId)?(0,c.hds)(e,String(s)):void 0,Y=(0,c.trm)(e);return{chat:n,isMuted:(0,Ic.If)(n,(0,c.K52)(e),(0,c.P5N)(e,n.id)),isPrivate:o,isTopic:n?.isForum&&!h,isForum:n?.isForum,isForumAsMessages:n?.isForumAsMessages,canAddContact:d,canDeleteChat:(0,l.IC)(n),canReportChat:g,canGift:y,hasLinkedChat:Boolean(b?.linkedChatId),botCommands:A?f?.botInfo?.commands:void 0,botPrivacyPolicyUrl:A?f?.botInfo?.privacyPolicyUrl:void 0,isChatInfoShown:(0,c.nTw)(e).isChatInfoShown&&m===i&&p===s,canCreateTopic:k,canEditTopic:w,canManage:N,isRightColumnShown:(0,c.gjV)(e),canTranslate:I,isBlocked:f?.isBlocked,isBot:Boolean(A),isChatWithSelf:u,savedDialog:P,disallowedGifts:f?.disallowedGifts,isAccountFrozen:Y}})(e=>{let{chatId:t,threadId:i,isOpen:a,withExtraActions:r,anchor:l,isChannel:c,botCommands:d,botPrivacyPolicyUrl:h,withForumActions:u,isTopic:m,isForum:p,isForumAsMessages:v,isChatInfoShown:g,canStartBot:A,canSubscribe:f,canReportChat:b,canSearch:C,canCall:y,canMute:S,canViewStatistics:k,canViewMonetization:w,canViewBoosts:N,pendingJoinRequests:I,canLeave:P,canEnterVoiceChat:D,canCreateVoiceChat:B,chat:R,isPrivate:L,isMuted:x,canDeleteChat:E,canGift:V,hasLinkedChat:_,canAddContact:U,canCreateTopic:O,canEditTopic:K,canManage:J,isRightColumnShown:G,canTranslate:j,isBlocked:z,isBot:H,isChatWithSelf:$,savedDialog:q,canShowBoostModal:W,disallowedGifts:Q,isAccountFrozen:Z,channelMonoforumId:X,onJoinRequestsClick:ee,onSubscribeChannel:ie,onSearchClick:se,onAsMessagesClick:ne,onClose:ae,onCloseAnimationEnd:oe}=e;const{updateChatMutedState:re,enterMessageSelectMode:le,sendBotCommand:ce,restartBot:he,requestMasterAndJoinGroupCall:ue,createGroupCall:me,openLinkedChat:pe,openAddContactDialog:ve,openFrozenAccountModal:ge,requestMasterAndRequestCall:Ae,toggleStatistics:fe,openMonetizationStatistics:be,openBoostStatistics:Ce,openGiftModal:ye,openThreadWithInfo:Se,openCreateTopicPanel:ke,openEditTopicPanel:we,openChat:Ne,openUrl:Ie,toggleManagement:Pe,togglePeerTranslations:Ye,blockUser:Fe,unblockUser:De,setViewForumAsMessages:Me,openBoostModal:Te,reportMessages:Be,showNotification:Re}=(0,n.ko)(),Le=(0,T.A)(),xe=(0,_i.A)(),{isMobile:Ee}=(0,Y.Ay)(),[Ve,_e]=(0,s.J0)(!0),[Ue,Oe]=(0,s.J0)(!1),[Je,Ge]=(0,s.J0)(!1),[je,ze]=(0,s.J0)(!1),[He,$e,We]=(0,F.A)(),{x:Qe,y:Ze}=l;(0,Ke.A)(a,oe,void 0,!1);const Xe=(0,Qi.A)(!(g||!p)||void 0,200),et=(0,s.Kr)(()=>{if(Q)return Object.values(Q).every(Boolean)},[Q]),tt=(0,M.A)(()=>{ze(!1),ae()}),it=(0,M.A)(()=>{Z?ge():(_e(!1),Be({chatId:t,messageIds:[]})),ae()}),st=(0,M.A)(()=>{Z?(ge(),ae()):Ge(!0),_e(!1)}),nt=(0,M.A)(()=>{_e(!1),ae()}),at=(0,M.A)(()=>{Se({chatId:t,threadId:i}),Oe(!G),nt()}),ot=(0,M.A)(()=>{Ge(!1),ae()}),rt=(0,M.A)(()=>{Z?ge():ce({command:"/start"})}),lt=(0,M.A)(()=>{Z?ge():he({chatId:t})}),ct=(0,M.A)(()=>{Z?ge():re({chatId:t,mutedUntil:o.Os5}),nt()}),dt=(0,M.A)(()=>{Z?(ge(),nt()):($e(),ze(!0)),_e(!1)}),ht=(0,M.A)(()=>{Z?ge():(ke({chatId:t}),Oe(!G)),nt()}),ut=(0,M.A)(()=>{Z?ge():(Pe({force:!0}),Oe(!G)),nt()}),mt=(0,M.A)(()=>{Z?ge():(we({chatId:t,topicId:Number(i)}),Oe(!G)),nt()}),pt=(0,M.A)(()=>{Ne({id:void 0}),Me({chatId:t,isEnabled:!1}),nt()}),vt=(0,M.A)(()=>{Z?ge():B?me({chatId:t}):ue({chatId:t}),nt()}),gt=(0,M.A)(()=>{pe({id:t}),nt()}),At=(0,M.A)(()=>{et&&R?Re({message:xe("SendDisallowError")}):(ye({forUserId:t}),Z?ge():ye({forUserId:t}),nt())}),ft=(0,M.A)(()=>{Z?ge():ve({userId:t}),nt()}),bt=(0,M.A)(()=>{Z?ge():ie(),nt()}),Ct=(0,M.A)(()=>{Z?ge():Ae({userId:t,isVideo:!0}),nt()}),yt=(0,M.A)(()=>{Z?ge():Ae({userId:t}),nt()}),St=(0,M.A)(()=>{se(),nt()}),kt=(0,M.A)(()=>{fe(),Oe(!G),nt()}),wt=(0,M.A)(()=>{be({chatId:t}),Oe(!G),nt()}),Nt=(0,M.A)(()=>{Z?ge():N?(Ce({chatId:t}),Oe(!G)):Te({chatId:t}),nt()}),It=(0,M.A)(()=>{Ye({chatId:t,isEnabled:!0}),nt()}),Pt=(0,M.A)(()=>{Z?ge():le(),nt()}),Yt=(0,M.A)(()=>{ne(),nt()}),Ft=(0,M.A)(()=>{Z?ge():Fe({userId:t}),nt()}),Dt=(0,M.A)(()=>{Z?ge():De({userId:t}),nt()}),Mt=(0,M.A)(()=>{Ne({id:X}),nt()});(0,s.vJ)(Ti.M6,[]);const Tt=(0,s.Kr)(()=>{const e=d?.map(e=>{let{command:t}=e;const i=um[t];if(i)return(0,te.Y)(de.A,{icon:i.icon,onClick:()=>{ce({command:`/${t}`}),nt()},children:Le(i.label)},t)}),t=d?.some(e=>{let{command:t}=e;return"privacy"===t});return[...e||[],H&&(0,te.Y)(de.A,{icon:"privacy-policy",onClick:()=>{t&&!h?ce({command:"/privacy"}):Ie({url:h||Le("BotDefaultPrivacyPolicy")}),nt()},children:Le("BotPrivacyPolicy")})].filter(Boolean)},[d,Le,h,H]),Bt=(0,s.Kr)(()=>{if(R)return Le(q?"Delete":L?"DeleteChatUser":E?"GroupInfo.DeleteAndExit":c?"LeaveChannel":"Group.LeaveGroup")},[E,R,c,L,q,Le]);return(0,te.Y)(Ur.A,{children:(0,te.FD)("div",{className:"HeaderMenuContainer",children:[(0,te.FD)(qe.A,{isOpen:Ve,positionX:"right",style:`left: ${Qe}px;top: ${Ze}px;`,onClose:nt,shouldCloseFast:Ue,children:[Ee&&C&&(0,te.Y)(de.A,{icon:"search",onClick:St,children:Le("Search")}),u&&O&&(0,te.FD)(te.FK,{children:[(0,te.Y)(de.A,{icon:"comments",onClick:ht,children:Le("lng_forum_create_topic")}),(0,te.Y)(hm.A,{})]}),X&&(0,te.Y)(de.A,{icon:"message",onClick:Mt,children:xe("ChannelSendMessage")}),Xe&&(0,te.Y)(de.A,{icon:"info",onClick:at,children:Le(m?"lng_context_view_topic":"lng_context_view_group")}),J&&!K&&(0,te.Y)(de.A,{icon:"edit",onClick:ut,children:Le("Edit")}),K&&(0,te.Y)(de.A,{icon:"edit",onClick:mt,children:Le("lng_forum_topic_edit")}),Ee&&!u&&p&&!m&&(0,te.Y)(de.A,{icon:"forums",onClick:pt,children:Le("Chat.ContextViewAsTopics")}),u&&Boolean(I)&&(0,te.FD)(de.A,{icon:"user",onClick:ee,children:[Le(c?"SubscribeRequests":"MemberRequests"),(0,te.Y)("div",{className:"right-badge",children:I})]}),u&&!m&&!v&&(0,te.Y)(de.A,{icon:"message",onClick:Yt,children:Le("lng_forum_view_as_messages")}),r&&A&&(0,te.Y)(de.A,{icon:"bots",onClick:rt,children:Le("BotStart")}),r&&f&&(0,te.Y)(de.A,{icon:c?"channel":"group",onClick:bt,children:Le(c?"ProfileJoinChannel":"ProfileJoinGroup")}),W&&!N&&(0,te.Y)(de.A,{icon:"boost-outline",onClick:Nt,children:Le(c?"BoostingBoostChannelMenu":"BoostingBoostGroupMenu")}),U&&(0,te.Y)(de.A,{icon:"add-user",onClick:ft,children:Le("AddContact")}),Ee&&y&&(0,te.Y)(de.A,{icon:"phone",onClick:yt,children:Le("Call")}),y&&(0,te.Y)(de.A,{icon:"video-outlined",onClick:Ct,children:Le("VideoCall")}),S&&(x?(0,te.Y)(de.A,{icon:"unmute",onClick:ct,children:Le("ChatsUnmute")}):(0,te.FD)(de.A,{icon:"mute",onClick:dt,children:[Le("ChatsMute"),"..."]})),(D||B)&&(0,te.Y)(de.A,{icon:"voice-chat",onClick:vt,children:Le(B?"StartVoipChat":"VoipGroupJoinCall")}),_&&(0,te.Y)(de.A,{icon:c?"comments":"channel",onClick:gt,children:Le(c?"ViewDiscussion":"lng_profile_view_channel")}),!u&&(0,te.Y)(de.A,{icon:"select",onClick:Pt,children:Le("ReportSelectMessages")}),N&&(0,te.Y)(de.A,{icon:"boost-outline",onClick:Nt,children:Le("Boosts")}),k&&(0,te.Y)(de.A,{icon:"stats",onClick:kt,children:Le("Statistics")}),c&&w&&(0,te.Y)(de.A,{icon:"cash-circle",onClick:wt,children:Le("lng_channel_earn_title")}),j&&(0,te.Y)(de.A,{icon:"language",onClick:It,children:Le("lng_context_translate")}),b&&(0,te.Y)(de.A,{icon:"flag",onClick:it,children:Le("ReportPeer.Report")}),Tt,V&&(0,te.Y)(de.A,{icon:"gift",onClick:At,children:Le("ProfileSendAGift")}),H&&(0,te.Y)(de.A,{icon:z?"bots":"hand-stop",onClick:z?lt:Ft,children:Le(z?"BotRestart":"Bot.Stop")}),L&&!$&&!H&&(0,te.Y)(de.A,{icon:z?"user":"hand-stop",onClick:z?Dt:Ft,children:Le(z?"Unblock":"BlockUser")}),P&&(0,te.FD)(te.FK,{children:[(0,te.Y)(hm.A,{}),(0,te.Y)(de.A,{destructive:!0,icon:"delete",onClick:st,children:Bt})]})]}),R&&(0,te.Y)(dm.A,{isOpen:Je,onClose:ot,chat:q||R,isSavedDialog:Boolean(q)}),S&&He&&R?.id&&(0,te.Y)(Dc.A,{isOpen:je,onClose:tt,onCloseAnimationEnd:We,chatId:R.id})]})})}));var pm=i(92915),vm=i(81642),gm=i(18653);const Am={root:"vv5ppXel",active:"FVgqrSSK",info:"DboxqiZd",topRow:"Ymu2m1PR",meta:"A2rsvUBm",subtitle:"qUzmwaIn"},fm=(0,s.ph)(e=>{let{isActive:t,message:i,senderPeer:s,messageChat:n,shouldShowChat:a,query:o,className:r,onClick:l}=e;const c=(0,_i.A)(),d=i.forwardInfo?.hiddenUserName,h=a?n:s,u=a&&s?(0,Ft.Q5)(c,i.chatId,s):void 0,m=(0,M.A)(()=>{l(i)});return(0,te.FD)("div",{role:"button",tabIndex:0,className:(0,me.A)(Am.root,t&&Am.active,r),onClick:m,children:[(0,te.Y)(Mt.A,{className:Am.avatar,peer:h,text:d,size:"medium"}),(0,te.FD)("div",{className:Am.info,children:[(0,te.FD)("div",{className:Am.topRow,children:[h&&(0,te.Y)(Es.A,{peer:h,withEmojiStatus:!0})||d,(0,te.Y)(vm.A,{className:Am.meta,message:i})]}),(0,te.FD)("div",{className:Am.subtitle,dir:"auto",children:[u&&(0,te.FD)(te.FK,{children:[(0,te.Y)("span",{className:"sender-name",children:(0,Dt.A)(u)}),(0,te.Y)("span",{className:"colon",children:":"})]}),(0,te.Y)(gm.A,{message:i,highlight:o,truncateLength:200})]})]})]})}),bm={root:"FTMljUuX",header:"OvmjSMwA",active:"DEIUzXQd",avatar:"mp1PmoMq",input:"z2K8Q7ib",mobile:"u0fb78AA",focused:"dqF8dYNx",withDropdown:"AqhBggrp",adaptSearchBorders:"Q9RZQaTu",dropdown:"MFGvbICO",dropdownHidden:"Alee0CKy",results:"RtfTOE72",placeholder:"O1HoZFge",separator:"_Yy43QLl",savedTags:"BcvAfv1E",wrap:"JkESCST6",searchTags:"rO3pH3LI",savedSearchTag:"qA4gov4D",hash:"q5NOmUAM",searchTypes:"rVYZG__K",searchType:"nE1Xwoo7",selectedType:"i29dP8iT",footer:"jyS1l9yn","keyboard-visible":"ao05jKHW",keyboardVisible:"ao05jKHW",counter:"NmmL_cO3",mobileNavigation:"dLO1hlHU",navigationButton:"Z4vLAlsu",navigationDisabled:"IqA7R2xO",jumpIn:"n9kXbTu6"},Cm={isCustomPeer:!0,avatarIcon:"channel-filled",titleKey:"SearchPublicPosts"},ym="MiddleSearchResult",Sm=(0,ge.sg)(e=>e(),200,!1),km=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.Xf0)(e);if(!t)return{};const{chatId:i,threadId:s}=t,n=(0,c.hds)(e,i);if(!n)return{};const{requestedQuery:a,savedTag:o,results:r,fetchingQuery:d,isHashtag:h,type:u}=(0,c.TCk)(e)||{},{totalCount:m,foundIds:p,query:v}=r||{},g=e.currentUserId,A=(0,c.nZ4)(e,i),f=(0,l.cG)(i,s,g),b=A&&!f?e.savedReactionTags?.byKey:void 0;return{chat:n,monoforumChat:(0,c.k2W)(e,i),requestedQuery:a,totalCount:m,threadId:s,foundIds:p,isHistoryCalendarOpen:Boolean((0,c.nTw)(e).historyCalendarSelectedAt),savedTags:b,savedTag:o,isCurrentUserPremium:(0,c.g29)(e),isSavedMessages:A,fetchingQuery:d,isHashtagQuery:h,currentUserId:g,searchType:u,lastSearchQuery:v}})(e=>{let{isActive:t,chat:i,monoforumChat:a,threadId:d,requestedQuery:h,savedTags:p,savedTag:v,totalCount:g,lastSearchQuery:A,foundIds:f,isHistoryCalendarOpen:b,isCurrentUserPremium:C,isSavedMessages:y,fetchingQuery:S,isHashtagQuery:k,searchType:w="chat",currentUserId:N}=e;const{updateMiddleSearch:I,resetMiddleSearch:P,performMiddleSearch:D,focusMessage:B,closeMiddleSearch:R,openHistoryCalendar:L,openPremiumModal:x,loadSavedReactionTags:E}=(0,n.ko)(),V=(0,s.li)(),_=(0,s.li)(),U=(0,s.li)(),O=(0,s.li)(!1),{isMobile:K}=(0,Y.Ay)(),J=(0,T.A)(),G=(0,_i.A)(),[j,z]=(0,s.J0)(h||""),[H,$]=(0,s.J0)(0),q=f&&H>0,Z=f&&H<f.length-1,[X,ee]=(0,s.J0)(!t),ie=(0,s.li)(),se=(0,s.li)(!0),[ne,ae,oe]=(0,F.A)(),[re,le]=(0,s.J0)(!0),[ce,de]=(0,s.J0)(!1);!function(e,t){const i=(0,M.A)(i=>{e.every(e=>e.current&&!e.current.contains(i.target))&&t(i)});(0,s.vJ)(()=>(document.addEventListener("click",i),()=>{document.removeEventListener("click",i)}),[i])}([V],(0,M.A)(e=>{se.current||e.target.closest(".Modal")||oe()}));const he=Boolean(j&&f||k),ue=k&&!j,pe=Boolean(j&&f&&!f.length&&!ce&&!ue),ve=t&&(re||!K)&&(ne||"myChats"===w||"channels"===w)&&Boolean(he||pe||ue||p),Ae=Boolean(j&&!ue||v),fe="chat"===w&&Boolean(f?.length),be=(0,M.A)(()=>{R()}),ye=(0,M.A)(()=>{(0,r.YS)(()=>{_.current?.focus()})}),Se=(0,M.A)(()=>{_.current?.blur()});(0,s.vJ)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),i=()=>{const{activeElement:i}=document;if(i&&i===_.current){const{pageTop:i,height:s}=e;(0,r.RK)(()=>{t.style.transform=`translateY(${i}px)`,t.style.height=`${s}px`,document.documentElement.scrollTop=i})}else(0,r.RK)(()=>{t.style.transform="",t.style.height=""})};return e.addEventListener("resize",i),()=>{e.removeEventListener("resize",i)}},[]),(0,s.vJ)(()=>{$(-1)},[A]),(0,s.Nf)(()=>{u.pz&&Array.from(document.querySelectorAll("input")).forEach(e=>{e.disabled=Boolean(t&&e!==_.current)})},[t]),(0,s.vJ)(()=>{t?(ee(!1),clearTimeout(ie.current)):(_.current.blur(),le(!0),$(0),z(""),ie.current=window.setTimeout(()=>ee(!0),200))},[t]),(0,s.vJ)(()=>{h&&i?.id&&(z(h),I({chatId:i.id,threadId:d,update:{requestedQuery:void 0}}),de(!0),(0,r.Uz)(()=>{const e=_.current;e&&((0,Mi.A)(e,!0,!0),ae())}))},[i?.id,h,d]),(0,ki.A)(e=>{let[i]=e;t!==i&&!j&&A&&z(A)},[t,A,j]),(0,ki.A)(e=>{let[i]=e;t&&i!==b&&(b?(Se(),oe()):ye())},[b,t]);const ke=(0,M.A)(()=>{j?.length||v?(z(""),de(!1),P(),ye()):be()});(0,s.vJ)(()=>t?(0,m.A)(ke):void 0,[t,be]);const we=(0,s.Kr)(()=>{if(p)return Object.values(p)},[p]),Ne=Boolean(we?.length),Ie=Ne&&!C;(0,s.vJ)(()=>{y&&t&&E()},[y,t]);const Pe=(0,M.A)(()=>{const e=i?.id;e&&Sm(()=>{O.current||D({chatId:e,threadId:d,query:j})})}),Ye=(0,M.A)(e=>{if(O.current=!1,e.startsWith("#")&&!k)return I({chatId:i.id,threadId:d,update:{isHashtag:!0}}),z(e.slice(1)),void Pe();z(e),e||(de(!1),P(),O.current=!0)});(0,s.vJ)(()=>{j&&Pe()},[j]),(0,s.vJ)(()=>{de(Boolean(S))},[S]),(0,s.vJ)(()=>{f?.length&&f.length-H<5&&Pe()},[H,f?.length]),(0,s.vJ)(()=>{if(t)return se.current=!0,window.addEventListener("touchend",e),window.addEventListener("mouseup",e),window.addEventListener("touchstart",i),window.addEventListener("mousedown",i),()=>{i(),window.removeEventListener("touchstart",i),window.removeEventListener("mousedown",i)};function e(){_.current?.focus(),ae(),(0,ge.IJ)(()=>{se.current=!1})}function i(){window.removeEventListener("touchend",e),window.removeEventListener("mouseup",e),(0,ge.IJ)(()=>{se.current=!1})}},[t]),(0,Ce.A)({isActive:t,onBack:be});const[Fe,De,Me=0]=(0,Bs.A)(Pe,f),Te=(0,s.Kr)(()=>{if(!j&&!v||!Fe?.length)return Ci.p;const e=(0,n.mS)();return Fe.map(t=>{const[i,s]=(0,bc.a)(t),n=(0,c.O5q)(e,i,s);if(!n)return;const a=y||(0,l.DX)(i)||i===o.Ckz?(0,c.Szq)(e,n):void 0,r=(0,c.Y7C)(e,n);return{searchResultKey:t,message:n,messageChat:(0,c.hds)(e,n.chatId),senderPeer:a||r}}).filter(Boolean)},[j,v,Fe,y]),Be=(0,M.A)(e=>{const t=(0,bc.D)(e),i=f?.indexOf(t)||0;$(i+Me),"chat"===w&&le(!1),B({chatId:e.chatId,messageId:e.id,threadId:k?void 0:d}),oe()}),Re=(0,M.A)(()=>{le(e=>!e),ae()}),Le=(0,Ls.A)(U,he,e=>{const t=Te?.[-1===e?0:e];t&&(Be(t.message),$(e+Me))},`.${ym}`,!0),xe=(0,M.A)(e=>{I({chatId:i.id,threadId:d,update:e}),Pe()}),Ee=(0,M.A)(e=>{Ie?x({initialSection:"saved_tags"}):xe({savedTag:e})}),Ve=(0,M.A)(()=>{xe({savedTag:void 0})}),_e=(0,M.A)(()=>{k?xe({isHashtag:!1}):v&&Ve()}),Ue=(0,M.A)(e=>{xe({type:e}),le(!0)}),Oe=(0,M.A)(()=>{if("chat"===w&&(oe(),Se(),f)){const e=H+1,[t,i]=(0,bc.a)(f[e]);B({chatId:t,messageId:i,threadId:d}),$(e)}}),Ke=(0,M.A)(()=>{if("chat"===w&&(oe(),Se(),f)){const e=H-1,[t,i]=(0,bc.a)(f[e]);B({chatId:t,messageId:i,threadId:d}),$(e)}});function Je(e,t){const s=!t&&w===e;switch(e){case"chat":return(0,te.Y)(Kr.A,{className:(0,me.A)(bm.searchType,s&&bm.selectedType),peerId:i?.id,title:J("SearchThisChat"),clickArg:"chat",onClick:t?_e:Ue});case"myChats":return(0,te.Y)(Kr.A,{className:(0,me.A)(bm.searchType,s&&bm.selectedType),peerId:N,forceShowSelf:!0,title:J("SearchMyMessages"),clickArg:"myChats",onClick:t?_e:Ue});case"channels":return(0,te.Y)(Kr.A,{className:(0,me.A)(bm.searchType,s&&bm.selectedType),customPeer:Cm,title:J("SearchPublicPosts"),clickArg:"channels",onClick:t?_e:Ue})}}function Ge(){return(0,te.FD)("div",{className:(0,me.A)(bm.dropdown,!ve&&bm.dropdownHidden),children:[!K&&(0,te.Y)("div",{className:bm.separator}),Ne&&!k&&(0,te.Y)("div",{className:(0,me.A)(bm.savedTags,!K&&bm.wrap,"no-scrollbar"),children:we.map(e=>{const t=(0,l.a0)(e.reaction,v);return(0,te.Y)(pm.A,{containerId:"local-search",reaction:e.reaction,tag:e,withCount:!0,isDisabled:Ie,isChosen:t,onClick:t?Ve:Ee},(0,l.Jj)(e.reaction))})}),k&&(0,te.FD)("div",{className:(0,me.A)(bm.searchTypes,"no-scrollbar"),children:[Je("chat"),Je("myChats"),Je("channels")]}),he&&(0,te.FD)(Cs.A,{ref:U,className:(0,me.A)(bm.results,"custom-scroll"),items:Te,itemSelector:`.${ym}`,preloadBackwards:0,onLoadMore:De,onKeyDown:Le,children:[pe&&(0,te.Y)("span",{className:bm.placeholder,children:J("NoResultFoundFor",j)},"nothing"),ue&&(0,te.Y)("span",{className:bm.placeholder,children:J("HashtagSearchPlaceholder")},"enterhash"),Te?.map((e,t)=>{let{message:i,senderPeer:s,messageChat:n,searchResultKey:a}=e;return(0,te.Y)(fm,{teactOrderKey:-i.date,className:ym,query:j,message:i,senderPeer:s,messageChat:n,shouldShowChat:k,isActive:H-Me===t,onClick:Be},a)})]})]})}return(0,te.FD)("div",{id:"MiddleSearch",className:(0,me.A)(bm.root,t&&bm.active,!t&&X&&"visually-hidden",ne&&bm.focused,K&&bm.mobile),ref:V,children:[(0,te.FD)("div",{className:bm.header,children:[!K&&(0,te.Y)(Mt.A,{className:bm.avatar,peer:a||i,size:"medium",isSavedMessages:y}),(0,te.FD)(Ss.A,{ref:_,value:j,className:(0,me.A)(bm.input,ve&&bm.withDropdown,ve&&!K&&bm.adaptSearchBorders),canClose:!K,isLoading:ce,resultsItemSelector:`.${bm.results} .${ym}`,hasUpButton:fe&&!K,hasDownButton:fe&&!K,placeholder:J(k?"SearchHashtagsHint":"Search"),teactExperimentControlled:!0,onChange:Ye,onStartBackspace:_e,onReset:ke,withBackIcon:K,onFocus:ae,focused:ne,onUpClick:Z?Oe:void 0,onDownClick:q?Ke:void 0,children:[(0,te.FD)("div",{className:bm.searchTags,children:[v&&(0,te.Y)(pm.A,{containerId:"local-search-tags",className:bm.savedSearchTag,reaction:v,tag:p[(0,l.Jj)(v)],onClick:Ve}),k&&(0,te.Y)("div",{className:bm.hash,children:"#"})]}),!K&&Ge()]}),!K&&(0,te.Y)("div",{className:bm.icons,children:(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>L({selectedAt:(0,He.CS)(Date.now())}),ariaLabel:J("JumpToDate"),children:(0,te.Y)(W.A,{name:"calendar"})})})]}),K&&Ge(),K&&(0,te.FD)("div",{className:bm.footer,children:[(0,te.Y)(Q.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>L({selectedAt:(0,He.CS)(Date.now())}),ariaLabel:J("JumpToDate"),children:(0,te.Y)(W.A,{name:"calendar"})}),(0,te.Y)("div",{className:bm.counter,children:Ae&&(f?.length?J("Of",[Math.max(H+1,1),g]):f&&!f.length&&J("NoResult"))}),"chat"===w&&Boolean(f?.length)&&(0,te.Y)(Q.A,{className:bm.viewStyle,size:"smaller",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:Re,children:J(re?"SearchAsChat":"SearchAsList")}),fe&&!ve&&(0,te.FD)("div",{className:bm.mobileNavigation,children:[(0,te.Y)(Q.A,{className:(0,me.A)(bm.navigationButton,!Z&&bm.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Oe,nonInteractive:!Z,ariaLabel:G("AriaSearchOlderResult"),children:(0,te.Y)(W.A,{name:"up"})}),(0,te.Y)(Q.A,{className:(0,me.A)(bm.navigationButton,!q&&bm.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Ke,nonInteractive:!q,ariaLabel:G("AriaSearchNewerResult"),children:(0,te.Y)(W.A,{name:"down"})})]})]})]})}));var wm=i(80539),Nm=i(58734),Im=i(73172);const Pm=2.5*g.$,Ym=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{setsById:s,added:n,recent:a,favorite:o,effect:r}=e.stickers,l=(0,c.nZ4)(e,i),d=(0,c.hds)(e,i),h=(0,v.L8)(i)?void 0:(0,c.AWZ)(e,i)?.stickerSet?.id;return{chat:d,effectStickers:r?.stickers,effectEmojis:r?.emojis,recentStickers:a.stickers,favoriteStickers:o.stickers,stickerSetsById:s,addedSetIds:n.setIds,canAnimate:(0,c.ML4)(e),isSavedMessages:l,isCurrentUserPremium:(0,c.g29)(e),chatStickerSetId:h}})(e=>{let{chat:t,threadId:i,className:a,isHidden:r,isTranslucent:l,loadAndPlay:c,canSendStickers:d,recentStickers:h,favoriteStickers:m,effectStickers:p,effectEmojis:v,addedSetIds:g,stickerSetsById:A,chatStickerSetId:f,canAnimate:b,isSavedMessages:C,isCurrentUserPremium:y,noContextMenus:S,idPrefix:k,onStickerSelect:w,isForEffects:N}=e;const{loadRecentStickers:I,addRecentSticker:P,unfaveSticker:Y,faveSticker:F,removeRecentSticker:D}=(0,n.ko)(),B=(0,s.li)(),R=(0,s.li)(),L=(0,s.li)(),{handleScroll:x,isAtBeginning:E}=bs(),V=(0,Im.A)(t?.id,i),_=`${k}-sticker-set`,{activeSetIndex:U,observeIntersectionForSet:O,observeIntersectionForPlayingItems:K,observeIntersectionForShowingItems:J,observeIntersectionForCovers:G,selectStickerSet:j}=hr(B,R,_,r),z=(0,T.A)(),H=Boolean(g),$=(0,s.Kr)(()=>{if(N&&p){const e=[];return v?.length&&e.push({id:o.hfH,accessHash:"0",title:"",stickers:v,count:v.length,isEmoji:!0}),p?.length&&e.push({id:o.Kp3,accessHash:"0",title:z("StickerEffects"),stickers:p,count:p.length}),e}if(!g)return Ci.p;const e=[];m.length&&e.push({id:o.tRH,accessHash:"0",title:z("FavoriteStickers"),stickers:m,count:m.length}),h.length&&e.push({id:o.sR2,accessHash:"0",title:z("RecentStickers"),stickers:h,count:h.length});const t=[...g||[]];f&&t.unshift(f);const i=Object.values((0,bi._E)(A,t));return[...e,...i]},[g,A,m,h,f,z,p,N,v]),q=(0,s.Kr)(()=>H&&0===$.filter(e=>e.stickers?.length).length,[$,H]);(0,s.vJ)(()=>{c&&(I(),d&&V({type:"chooseSticker"}))},[d,c,I,V]);const Z=(0,or.A)([],o.jhd),X=H&&Z&&!q&&(d||N);(0,Nn.A)(R,!X||!R.current),(0,s.vJ)(()=>{if(!H)return;const e=R.current;if(!e)return;const t=U*Pm-(e.offsetWidth/2-Pm/2);(0,ba.A)(e,t)},[H,U]);const ee=(0,M.A)((e,t,i)=>{w(e,t,i,!0),P({sticker:e})}),ie=(0,M.A)(e=>{Y({sticker:e})}),se=(0,M.A)(e=>{F({sticker:e})}),ae=(0,M.A)(()=>{d&&V({type:"chooseSticker"})}),oe=(0,M.A)(e=>{D({sticker:e})});if(!t)return;const re=(0,me.A)("lq8BD6Hc",a),le=(0,me.A)(Mr,"no-scrollbar",!E&&Tr),ce=!X&&(d||N)&&!q;return(0,te.Y)(ne.Ay,{className:re,activeKey:ce?0:1,name:"fade",shouldCleanup:!0,children:X?(0,te.FD)(te.FK,{children:[!N&&(0,te.Y)("div",{ref:R,className:le,children:(0,te.FD)("div",{className:"shared-canvas-container",children:[(0,te.Y)("canvas",{ref:L,className:"shared-canvas"}),$.map(function(e,i){const s=e.stickers?.[0],n=(0,me.A)(Br,i===U&&"y02WwQk6"),a=i<o.j41;return e.id===o.sR2||e.id===o.tRH||e.id===o.eKB||e.hasThumbnail||!s?(0,te.Y)(Q.A,{className:n,ariaLabel:e.title,round:!0,faded:e.id===o.sR2||e.id===o.tRH,color:"translucent",onClick:()=>j(i),children:e.id===o.sR2?(0,te.Y)(W.A,{name:"recent"}):e.id===o.tRH?(0,te.Y)(W.A,{name:"favorite"}):e.id===o.eKB?(0,te.Y)(Mt.A,{peer:t,size:"small"}):(0,te.Y)(gr,{stickerSet:e,noPlay:!b||!c,observeIntersection:G,sharedCanvasRef:a?L:void 0,forcePlayback:!0})},e.id):(0,te.Y)(yr,{sticker:s,size:o.TBj,title:e.title,className:n,noPlay:!b||!c,observeIntersection:G,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?L:void 0,withTranslucentThumb:l,onClick:j,clickArg:i,forcePlayback:!0},e.id)})]})}),(0,te.Y)("div",{ref:B,onMouseMove:ae,onScroll:x,className:(0,me.A)(Fr,u.TF?"no-scrollbar":"custom-scroll",!N&&Dr),children:$.map((e,t)=>(0,te.Y)(Pr,{stickerSet:e,loadAndPlay:Boolean(b&&c),noContextMenus:S,index:t,idPrefix:_,observeIntersection:O,observeIntersectionForPlayingItems:K,observeIntersectionForShowingItems:J,isNearActive:U>=t-1&&U<=t+1,favoriteStickers:m,isSavedMessages:C,isCurrentUserPremium:y,isTranslucent:l,isChatStickerSet:e.id===f,onStickerSelect:ee,onStickerUnfave:ie,onStickerFave:se,onStickerRemoveRecent:oe,forcePlayback:!0,shouldHideHeader:e.id===o.hfH},e.id))})]}):d||N?q?(0,te.Y)("div",{className:Rr,children:z("NoStickers")}):(0,te.Y)(xs.A,{}):(0,te.Y)("div",{className:Rr,children:z("ErrorSendRestrictedStickersAll")})})})),Fm=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{availableReactions:s,topReactions:n}=e.reactions,{maxUniqueReactions:a}=e.appConfig,{enabledReactions:o,isPaidReactionAvailable:r}=(0,c.AWZ)(e,i)||{};return{enabledReactions:o,availableReactions:s,topReactions:n,reactionsLimit:a,isWithPaidReaction:r}})(e=>{let{loadAndPlay:t,enabledReactions:i,availableReactions:n,topReactions:a,selectedReactionIds:o,isWithPaidReaction:r,message:c,reactionsLimit:d,onReactionSelect:h,onReactionContext:u}=e;const m=(0,s.li)(),p=(0,s.li)(),{width:v}=(0,we.A)(),{isTouchScreen:A}=(0,Y.Ay)(),f=c?.reactions?.results,b=d&&f&&f.length>=d,C=(0,s.Kr)(()=>{if(b){const e=f.map(e=>{let{reaction:t}=e;return t});return r&&e.unshift({type:"paid"}),e}if(!i)return[];if("all"===i.type){const e=(n||[]).map(e=>{let{reaction:t}=e;return t});return r&&e.unshift({type:"paid"}),(0,l.fu)(e,a)}const e=i.allowed.slice();return r&&e.unshift({type:"paid"}),(0,l.fu)(e,a)},[n,i,a,b,f,r]),y=(0,s.Kr)(()=>{const e=Math.min(26.25*g.$,v),t=(v>600?.625:.5)*g.$,i=e-.5*g.$,s=Math.floor((i+t)/(36+t)),n=Math.ceil(C.length/s),a=36*n+(n-1)*t+.5*g.$*2;return Math.min(18*g.$,a)},[C.length,v]);return(0,te.Y)("div",{className:"MhpiTAwi",style:`height: ${y}px`,children:(0,te.Y)("div",{className:(0,me.A)("NIaqmosK",A?"no-scrollbar":"custom-scroll"),children:(0,te.FD)("div",{className:"symbol-set-container shared-canvas-container",children:[(0,te.Y)("canvas",{ref:m,className:"shared-canvas"}),(0,te.Y)("canvas",{ref:p,className:"shared-canvas"}),C.map(e=>{const i=(0,l.Jj)(e),s=i?o?.includes(i):void 0;return(0,te.Y)(Nr,{reaction:e,isSelected:s,loadAndPlay:t,availableReactions:n,onClick:h,onContextMenu:u,sharedCanvasRef:m,sharedCanvasHqRef:p},i)})]})})})})),Dm=16.375*g.$,Mm=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),i=e.availableEffectById,{chatId:s,messageId:n,storyPeerId:a,storyId:o,position:r,sendAsMessage:l,isForEffects:d}=t.reactionPicker||{},h=a&&o?(0,c.Msb)(e,a,o):void 0,u=s?(0,c.hds)(e,s):void 0,m=s?(0,c.AWZ)(e,s):void 0,p=s&&n?(0,c.O5q)(e,s,n):void 0,g=(0,v.L8)(s||a||""),A="some"===m?.enabledReactions?.type,{maxUniqueReactions:f}=e.appConfig,b="all"===m?.enabledReactions?.type&&m?.enabledReactions?.areCustomAllowed,C=p?.reactions?.results,y=Boolean(f&&C&&C.length>=f);return{message:p,story:h,position:r,shouldUseFullPicker:!(u?.isForbidden||A||y)&&(b||g),isTranslucent:(0,c.cwE)(e),isCurrentUserPremium:(0,c.g29)(e),sendAsMessage:l,isForEffects:d,chatId:s,availableEffectById:i}})(e=>{let{isOpen:t,message:i,story:a,position:o,isTranslucent:r,isCurrentUserPremium:c,shouldUseFullPicker:d,sendAsMessage:h,chatId:u,isForEffects:m,availableEffectById:p}=e;const{toggleReaction:v,closeReactionPicker:g,sendMessage:A,showNotification:f,sendStoryReaction:b,saveEffectInDraft:C,requestEffectInComposer:y,addLocalPaidReaction:S,openPaidReactionModal:k}=(0,n.ko)(),w=(0,T.A)(),N=(0,Bi.A)(i?.id,!0),I=(0,Bi.A)(i?.chatId,!0),P=(0,Bi.A)(a?.peerId,!0),F=(0,Bi.A)(a?.id),D=(0,Bi.A)(o,!0),B=(0,s.li)(),R=(0,s.Kr)(()=>{if(D)return F?D:{x:D.x+(d?-23:-21),y:D.y+(d?-64:-10)}},[F,D,d]),L=(0,M.A)(()=>B.current),x=(0,M.A)(()=>({withPortal:!0,isDense:!P,deltaX:!(0,Y.Ny)()&&B.current?-(B.current.offsetWidth-Dm)/2- -11.5:0})),E=(0,M.A)(e=>{if(!I||!N)return;const t=e.isCustomEmoji?{type:"custom",documentId:e.id}:{type:"emoji",emoticon:e.emoji};v({chatId:I,messageId:N,reaction:t,shouldAddToRecent:!0}),g()}),V=(0,M.A)(e=>{I&&N&&("paid"===e.type?S({chatId:I,messageId:N,count:1}):v({chatId:I,messageId:N,reaction:e,shouldAddToRecent:!0}),g())}),_=(0,M.A)(e=>{"paid"===e.type&&(k({chatId:I,messageId:N}),g())}),U=(0,M.A)(e=>{if("type"in e&&"paid"===e.type)return;const t="id"in e?{type:"custom",documentId:e.id}:e,i="type"in e&&"custom"===e.type?(0,n.mS)().customEmojis.byId[e.documentId]:"id"in e?e:void 0;if(i&&!i.isFree&&!c)return f({message:w("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:w("PremiumMore")}),void g();if(!h)return b({peerId:P,storyId:F,containerId:(0,l.$_)(P,F),reaction:t,shouldAddToRecent:!0}),void g();let s,a;if("type"in e&&"emoji"===e.type)s=e.emoticon;else{const e=(0,wm.Ay)((0,Nm.hB)(i));s=e.text,a=e.entities}A({text:s,entities:a,isReaction:!0}),g()}),K=(0,M.A)(e=>{const t=Object.values(p),i=t.find(t=>t.effectStickerId===e.id)?.id;u&&C({chatId:u,threadId:O.l3,effectId:i}),i&&y({}),g()}),J=(0,s.Kr)(()=>(i?.reactions?.results||[]).reduce((e,t)=>{let{chosenOrder:i,reaction:s}=t;return void 0!==i&&e.push((0,l.Jj)(s)),e},[]),[i?.reactions?.results]);return(0,te.Y)(qe.A,{isOpen:t,ref:B,className:(0,me.A)("gBh4WvBC","ReactionPicker"),bubbleClassName:(0,me.A)("qSfKwMzX",!d&&!F&&"dRNSqkOC",F&&"srpBMrqr"),withPortal:!0,noCompact:!0,anchor:R,positionY:a&&"bottom",getTriggerElement:Tm,getRootElement:Bm,getMenuElement:L,getLayout:x,backdropExcludedSelector:".Modal.confirm",onClose:g,children:m&&u?(0,te.Y)(Ym,{className:"",isHidden:!t,loadAndPlay:Boolean(t&&d),idPrefix:"message-effect",canSendStickers:!1,noContextMenus:!1,chatId:u,isTranslucent:r,onStickerSelect:K,isForEffects:m}):(0,te.FD)(te.FK,{children:[(0,te.Y)(_r,{chatId:I,idPrefix:"message-emoji-set-",isHidden:!t||!(d||F),loadAndPlay:Boolean(t&&d),isReactionPicker:!0,className:d||F?void 0:"KVwgF6DG",selectedReactionIds:J,isTranslucent:r,onCustomEmojiSelect:F?U:E,onReactionSelect:F?U:V,onReactionContext:_}),!d&&Boolean(I)&&(0,te.Y)(Fm,{chatId:I,loadAndPlay:t,onReactionSelect:F?U:V,onReactionContext:_,selectedReactionIds:J,message:i})]})})}));function Tm(){return document.querySelector("body")}function Bm(){return document.querySelector("body")}var Rm=i(39074),Lm=i(45761);const xm=document.createElement("div");var Em=i(41316),Vm=i(3225),_m=i(25498),Um=i(9442),Om=i(91525),Km=i(52988),Jm=i(27860);const Gm="SHoF85Vw",jm="Zo7u5epf",zm=15*g.$,Hm=(0,s.ph)(e=>{let{attachment:t,className:i,isSingle:n,shouldDisplayCompressed:a,shouldDisplayGrouped:r,index:l,onDelete:c,onToggleSpoiler:d}=e;const h=function(e,t){if(t&&e.quick){if(o.gex.has(e.mimeType))return"photo";if(o.fNs.has(e.mimeType))return"video"}return"file"}(t,a),u=(0,M.A)(()=>{d?.(l)}),m=(0,s.Kr)(()=>{switch(h){case"photo":return(0,te.Y)("img",{className:Gm,src:t.blobUrl,alt:"",draggable:!1});case"video":return(0,te.FD)(te.FK,{children:[Boolean(t.quick?.duration)&&(0,te.Y)("div",{className:"nI2M1SBH",children:(0,He.QO)(t.quick.duration)}),(0,te.Y)("video",{className:Gm,src:t.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})]});default:return(0,te.FD)(te.FK,{children:[(0,te.Y)(Km.A,{className:"B6f6GcvN",name:t.filename,extension:(0,Om.QC)(t.filename,t.mimeType),previewData:t.previewBlobUrl,size:t.size,smaller:!0}),c&&(0,te.Y)(W.A,{name:"delete",className:(0,me.A)(jm,"CYJwy9T_"),onClick:()=>c(l)})]})}},[t,h,l,c]),p="file"===h||!r,v=Boolean("file"!==h&&t.shouldSendAsSpoiler),g="file"!==h,A=(0,me.A)(i,"QucaiGVU",n&&"FjrnqGba",p&&"g0cTsM9d");return(0,te.FD)("div",{className:A,children:[m,(0,te.Y)(Jm.A,{isVisible:v,thumbDataUri:t.previewBlobUrl||t.blobUrl,width:zm,height:zm}),g&&(0,te.FD)("div",{className:"bX7LdgxW",children:[(0,te.Y)(W.A,{name:t.shouldSendAsSpoiler?"spoiler-disable":"spoiler",className:jm,onClick:u}),c&&(0,te.Y)(W.A,{name:"delete",className:jm,onClick:()=>c(l)})]})]})});var $m=i(25897),qm=i(6070),Wm=i(49068);function Qm(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=e[i?"scrollLeft":"scrollTop"],n=s+e[i?"offsetWidth":"offsetHeight"],a=t[i?"offsetLeft":"offsetTop"],o=a+t[i?"offsetWidth":"offsetHeight"];return a>s&&o<n}function Zm(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const o=e[a?"scrollLeft":"scrollTop"],r=o+e[a?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let h=!1;for(let e=0;e<c;e++){const t=l[e],c=t[a?"offsetLeft":"offsetTop"],u=c+t[a?"offsetWidth":"offsetHeight"];if(n?u>=o-i&&u<=r+i:c<=r+i&&u>=o-i)d.push(e),h=!0;else if(h&&!s)break}return{allElements:l,visibleIndexes:d}}function Xm(e,t,i){const s=i.current;if(!s||t<0)return;const{visibleIndexes:n,allElements:a}=Zm(s,e,8,!0,!0);if(!a.length||!a[t])return;const o=n[0];if(!n.includes(t)||t===o&&!Qm(s,a[o])){const e=t>n[n.length-1]?"start":"end";(0,rr.Ay)({container:s,element:a[t],position:e,margin:10})}}function ep(e){let{isActive:t,isHorizontal:i,shouldSaveSelectionOnUpdateItems:n,shouldRemoveSelectionOnReset:a,noArrowNavigation:o,items:r,shouldSelectOnTab:l,onSelect:c,onClose:d}=e;const[h,u]=(0,s.J0)(-1),m=(0,M.A)(e=>r?(0,Ya.A)(r.length,e):-1),p=(0,M.A)((e,t)=>{t.preventDefault(),u(t=>m(t+e))}),v=(0,M.A)(e=>{if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return!1;if(!t)return!1;if(r&&r.length&&h>-1){const t=r[h];if(t){if(!1===c(t))return!1;e.preventDefault()}}return!0});(0,s.vJ)(()=>{t||u(a?-1:0)},[t,a]);const g=!r||h>r.length-1;return(0,s.vJ)(()=>{n&&!g||u(a?-1:0)},[g,a,n]),(0,s.vJ)(()=>t?(0,Ri.A)({onEsc:d,onUp:o||i?void 0:e=>p(-1,e),onDown:o||i?void 0:e=>p(1,e),onLeft:o||!i?void 0:e=>p(-1,e),onRight:o||!i?void 0:e=>p(1,e),onTab:l?v:void 0,onEnter:v}):void 0,[o,p,v,t,i,d,l]),h}const tp=(0,s.ph)(e=>{let{isOpen:t,onClose:i,onInsertUserName:a,filteredUsers:o}=e;const r=(0,s.li)(),{shouldRender:l,transitionClassNames:c}=(0,Ke.A)(t,void 0,void 0,!1),d=(0,M.A)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(0,n.mS)().users.byId[e];i&&a(i,t)}),h=(0,M.A)((e,t)=>{e.preventDefault(),d(t)}),u=(0,M.A)(e=>{d(e.id,!0)}),m=ep({isActive:t,items:o,onSelect:u,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:i});(0,s.vJ)(()=>{Xm(".chat-item-clickable",m,r)},[m]),(0,s.vJ)(()=>{o&&!o.length&&i()},[o,i]);const p=(0,_.A)(o?.length?o:void 0,l),v=o&&!o.length?p:o;if(!l||v&&!v.length)return;const g=(0,me.A)("MentionTooltip composer-tooltip custom-scroll",c);return(0,te.Y)("div",{className:g,ref:r,children:v?.map((e,t)=>{let{id:i}=e;return(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item smaller-icon",onClick:h,clickArg:i,focus:m===t,children:(0,te.Y)(ws.A,{userId:i,avatarSize:"small",withUsername:!0})},i)})})});var ip=i(78407),sp=i(26440);const np="AT_d9l0W",ap="AnO3BgVv",op="caption-input-text",rp=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{currentUserId:s,recentEmojis:n,customEmojis:a,attachmentSettings:r}=e,l=(0,c.AWZ)(e,i),d=(0,c.nZ4)(e,i),{shouldSuggestCustomEmoji:h}=e.settings.byKey,{language:u}=(0,vn.l)(e),m=e.emojiKeywords[o.cUY],p=u!==o.cUY?e.emojiKeywords[u]:void 0;return{isChatWithSelf:d,currentUserId:s,groupChatMembers:l?.members,recentEmojis:n,baseEmojiKeywords:m?.keywords,emojiKeywords:p?.keywords,shouldSuggestCustomEmoji:h,customEmojiForEmoji:a.forEmoji.stickers,captionLimit:(0,ha.d)(e,"captionLength"),attachmentSettings:r}})(e=>{let{chatId:t,threadId:i,attachments:a,getHtml:c,editingMessage:d,canShowCustomSendMenu:h,captionLimit:u,isReady:p,isChatWithSelf:v,currentUserId:g,groupChatMembers:A,recentEmojis:f,baseEmojiKeywords:b,emojiKeywords:C,isForMessage:y,shouldSchedule:S,shouldSuggestCustomEmoji:k,customEmojiForEmoji:w,attachmentSettings:N,shouldForceCompression:I,shouldForceAsFile:P,isForCurrentMessageList:D,forceDarkTheme:B,onAttachmentsUpdate:R,onCaptionUpdate:L,onSend:x,onFileAppend:E,onClear:V,onSendSilent:U,onSendScheduled:O,onCustomEmojiSelect:K,onRemoveSymbol:G,onEmojiSelect:j,canScheduleUntilOnline:z,canSchedule:H,onSendWhenOnline:$,paidMessagesStars:q}=e;const Z=(0,s.li)(),ee=(0,s.li)(),{addRecentCustomEmoji:ie,addRecentEmoji:se,updateAttachmentSettings:ne}=(0,n.ko)(),ae=(0,T.A)(),oe=(0,_i.A)(),re=(0,s.li)(),le=(0,s.li)(),he=(0,s.li)(),ue=(0,_.A)(a),pe=a.length?a:ue,{isMobile:ve}=(0,Y.Ay)(),ge=d&&Boolean(d),Ae=d&&d?.groupedId,fe="file"!==(ge&&a?.length&&(0,l.ES)(a[0])),[Ce,Se,ke]=(0,F.A)(),we=N.shouldCompress,Ne=Boolean((we||I||Ae)&&!P),[Ie,Pe]=(0,s.J0)(N.shouldSendGrouped),Ye=N.isInvertedMedia,[Fe,De]=(0,s.J0)(N.shouldSendInHighQuality),[Me,Te]=(0,s.J0)(Fe),{handleScroll:Be,isAtBeginning:Re,isAtEnd:Le}=bs(),{handleScroll:xe,isAtBeginning:Ee}=bs(),Ve=Boolean(a.length),_e=Boolean(pe?.length),[Ue,Oe,Ke]=(0,F.A)(),Je=(0,s.li)();(0,s.vJ)(()=>{Ve||(ke(),ne({isInvertedMedia:void 0}))},[ke,Ve]);const[Ge,je]=(0,s.Kr)(()=>Boolean(pe?.every(e=>e.quick||e.audio))?[!0,!0]:[Boolean(pe?.some(e=>e.quick||e.audio)),!1],[pe]),[ze,He]=(0,s.Kr)(()=>Boolean(pe?.every(e=>e.shouldSendAsSpoiler))?[!0,!0]:[Boolean(pe?.some(e=>e.shouldSendAsSpoiler)),!1],[pe]),$e=(0,Em.A)(`#${o.e0F}`),{isEmojiTooltipOpen:qe,filteredEmojis:We,filteredCustomEmojis:Qe,insertEmoji:Ze,closeEmojiTooltip:Xe}=(0,_m.A)(Boolean(p&&(D||!y)&&_e),c,L,o.e0F,f,b,C),{isCustomEmojiTooltipOpen:et,insertCustomEmoji:tt,closeCustomEmojiTooltip:it}=(0,Vm.A)(Boolean(p&&(D||!y)&&_e&&k),c,L,$e,le,w),{isMentionTooltipOpen:st,closeMentionTooltip:nt,insertMention:at,mentionFilteredUsers:ot}=(0,Um.A)(Boolean(p&&D&&_e),c,L,$e,le,A,void 0,g);function rt(e){ne({isInvertedMedia:e})}(0,s.vJ)(()=>Ve?(0,m.A)(V):void 0,[Ve,V]),(0,s.vJ)(()=>{Ve&&(Pe(N.shouldSendGrouped),De(N.shouldSendInHighQuality))},[N,Ve]),(0,s.vJ)(()=>{Ve||ne({isInvertedMedia:void 0})},[ne,Ve]),(0,s.vJ)(()=>{Ve&&ve&&(0,Rm.DY)()},[ve,Ve]);const{isContextMenuOpen:lt,handleContextMenu:ct,handleContextMenuClose:dt,handleContextMenuHide:ht}=(0,bn.A)(re,!h||!Ve),ut=(0,M.A)((e,t)=>{Ve&&(((S||t)&&y&&!d?O:e?U:x)(Ne,Ie,Ye),ne({shouldCompress:Ne,shouldSendGrouped:Ie,isInvertedMedia:Ye,shouldSendInHighQuality:Fe}))}),mt=(0,M.A)(()=>{ut(!0)}),pt=(0,M.A)(()=>{ut()}),vt=(0,M.A)(()=>{ut(!1,!0)}),gt=(0,M.A)(async e=>{e.preventDefault(),Ke();const{dataTransfer:t}=e,i=await(0,Lm.A)(t.items);i?.length&&E(i,He)}),At=(0,M.A)(e=>{const{files:t}=e.target,i=(0,J.kc)(t);i?.length&&E(i,He)}),ft=(0,M.A)(()=>{(0,Mh.p)("*",e=>At(e))}),bt=(0,M.A)(e=>{R(a.filter((t,i)=>i!==e))}),Ct=(0,M.A)(()=>{R(a.map(e=>({...e,shouldSendAsSpoiler:!0})))}),yt=(0,M.A)(()=>{ne({shouldCompress:!we})}),St=(0,M.A)(()=>{const e=!Fe;De(e),ne({shouldSendInHighQuality:e})}),kt=(0,M.A)(()=>{R(a.map(e=>({...e,shouldSendAsSpoiler:void 0})))}),wt=(0,M.A)(e=>{R(a.map((t,i)=>i===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t))}),Nt=(0,M.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,Sr.A)(Z,Nt),(0,ye.A)(Nt),(0,s.vJ)(()=>{const e=re.current,t=document.getElementById(op);if(!e||!t)return;const{width:i}=e.getBoundingClientRect();(0,r.RK)(()=>{t.style.setProperty("--margin-for-scrollbar",`${i}px`)})},[ae,Ve]);const It=(0,s.Kr)(()=>e=>{let{onTrigger:t,isOpen:i}=e;return(0,te.Y)(Q.A,{round:!0,ripple:!ve,size:"smaller",color:"translucent",className:i?"active":"",onClick:t,ariaLabel:"More actions",children:(0,te.Y)(W.A,{name:"more"})})},[ve]),Pt=(0,be.A)(()=>{if(!_e)return;const e=u-(t=c(),xm.innerHTML=t,(0,wm.g4)(xm),xm.querySelectorAll("br").forEach(e=>{e.replaceWith("\n")}),xm.textContent?.trim().length||0);var t;return e<=100?e:void 0},[u,c,_e]),Yt=Ne&&je,[Ft,Dt,Mt,Tt]=(0,s.Kr)(()=>Yt&&pe?[pe.every(e=>o.gex.has(e.mimeType)),pe.every(e=>o.fNs.has(e.mimeType)),pe.every(e=>o.IH3.has(e.mimeType)),pe.some(e=>o.gex.has(e.mimeType))]:[!1,!1,!1],[pe,Yt]),Bt=(0,s.Kr)(()=>!!pe&&pe.some(e=>!o.IH3.has(e.mimeType)),[pe]);if((0,s.vJ)(()=>{if(Fe!==Me)return Je.current&&clearTimeout(Je.current),Je.current=window.setTimeout(()=>{Te(Fe)},200),()=>{Je.current&&(clearTimeout(Je.current),Je.current=void 0)}},[Fe,Me]),!pe)return;const Rt=pe.length>1,Lt=!(ge||!Ge||!(P||I||Ne)||Rt&&Ie);let xt="";const Et=pe.length;xt=ae(Ft?ge?"EditMessageReplacePhoto":"PreviewSender.SendPhoto":Dt?ge?"EditMessageReplaceVideo":"PreviewSender.SendVideo":Mt?ge?"EditMessageReplaceAudio":"PreviewSender.SendAudio":ge?"EditMessageReplaceFile":"PreviewSender.SendFile",Et,"i");const Vt=!Le||!Ee,_t=q?(0,xi.U2)(oe,Et*q,{className:"C1OOt81o",asFont:!0}):ae("Send");return(0,te.Y)(X.A,{isOpen:Ve,onClose:V,header:function(){if(pe)return(0,te.FD)("div",{className:"modal-header-condensed",dir:ae.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:V,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:xt}),fe&&!Ae&&(0,te.FD)(ce.A,{className:"attachmeneditingMessaget-modal-more-menu with-menu-transitions",trigger:It,positionX:"right",children:[Boolean(!d)&&(0,te.Y)(de.A,{icon:"add",onClick:ft,children:ae("Add")}),Ge&&(0,te.FD)(te.FK,{children:[Lt&&(Ye?(0,te.Y)(de.A,{icon:"move-caption-down",onClick:()=>rt(void 0),children:oe("ContextMoveTextDown")}):(0,te.Y)(de.A,{icon:"move-caption-up",onClick:()=>rt(!0),children:oe("ContextMoveTextUp")})),!P&&!I&&(Ne?(0,te.Y)(de.A,{icon:"document",onClick:yt,children:ae(Rt?"Attachment.SendAsFiles":"Attachment.SendAsFile")}):(0,te.Y)(de.A,{icon:"photo",onClick:yt,children:Rt?"Send All as Media":"Send as Media"})),Ne&&!d&&Tt&&(0,te.Y)(de.A,{icon:Me?"sd-photo":"hd-photo",onClick:St,children:oe(Me?"SendInStandardQuality":"SendInHighQuality")}),Ne&&Bt&&Boolean(!d)&&(ze?(0,te.Y)(de.A,{icon:"spoiler-disable",onClick:kt,children:ae("Attachment.DisableSpoiler")}):(0,te.Y)(de.A,{icon:"spoiler",onClick:Ct,children:ae("Attachment.EnableSpoiler")}))]}),Rt&&(Ie?(0,te.Y)(de.A,{icon:"grouped-disable",onClick:()=>Pe(!1),children:"Ungroup All Media"}):(0,te.Y)(de.A,{icon:"grouped",onClick:()=>Pe(!0),children:"Group All Media"}))]})]})}(),className:(0,me.A)("a27O2Qlr",Ue&&ap,!Re&&"Pc1k8G8s",ve&&"khvUZbGZ",Ce&&"ir5kkMy1",B&&"component-theme-dark"),noBackdropClose:!0,isLowStackPriority:!0,children:(0,te.FD)("div",{className:np,onDragEnter:Oe,onDrop:gt,onDragOver:function(e){e.preventDefault(),he.current&&(window.clearTimeout(he.current),he.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:i}=e;i.matches(`.${np}`)&&!t&&(he.current=window.setTimeout(Ke,150)),i&&i.closest(`.${ap}`)||(t&&e.stopPropagation(),Ke())},onClick:Ke,"data-attach-description":ae("Preview.Dragging.AddItems",10),"data-dropzone":!0,children:[(0,te.Y)("svg",{className:"d9O65j_I",children:(0,te.Y)("rect",{className:"jzCBDWMw",x:"0",y:"0",width:"100%",height:"100%",rx:"8"})}),(0,te.Y)("div",{className:(0,me.A)("_bxSIFgj","custom-scroll",Vt&&"RPVunBe2"),onScroll:Be,children:pe.map((e,t)=>(0,te.Y)(Hm,{attachment:e,shouldDisplayCompressed:Ne,shouldDisplayGrouped:Ie,isSingle:1===pe.length,index:t,onDelete:bt,onToggleSpoiler:wt},e.uniqueId||t))}),(0,te.FD)("div",{className:(0,me.A)("EtmiUn2k",Vt&&"FjjSKMYe"),children:[(0,te.Y)(tp,{isOpen:st,filteredUsers:ot,onInsertUserName:at,onClose:nt}),(0,te.Y)(Wm.A,{isOpen:qe,emojis:We,customEmojis:Qe,addRecentEmoji:se,addRecentCustomEmoji:ie,onEmojiSelect:Ze,onCustomEmojiSelect:Ze,onClose:Xe}),(0,te.Y)($m.A,{chatId:t,isOpen:et,addRecentCustomEmoji:ie,onCustomEmojiSelect:tt,onClose:it}),(0,te.FD)("div",{className:"Te7lIfpB",children:[(0,te.Y)(sp.A,{chatId:t,threadId:i,isMobile:ve,isReady:p,isSymbolMenuOpen:Ce,openSymbolMenu:Se,closeSymbolMenu:ke,onCustomEmojiSelect:K,onRemoveSymbol:G,onEmojiSelect:j,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:B}),(0,te.Y)(ip.A,{ref:le,id:op,chatId:t,threadId:i,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:p,isActive:Ve,getHtml:c,editableInputId:o.e0F,placeholder:ae("AddCaption"),onUpdate:L,onSend:pt,onScroll:xe,canAutoFocus:Boolean(p&&D&&a.length),captionLimit:Pt,shouldSuppressFocus:ve&&Ce,onSuppressedFocus:ke}),(0,te.FD)("div",{className:"wDqWK9MD",children:[(0,te.Y)(Q.A,{ref:re,className:"kNlWmBJI",size:"smaller",onClick:pt,onContextMenu:h?ct:void 0,children:S&&!d?ae("Next"):d?ae("Save"):_t}),h&&(0,te.Y)(qm.A,{isOpen:lt,canSchedule:H&&y,onSendSilent:v?void 0:mt,onSendSchedule:vt,onClose:dt,onCloseAnimationEnd:ht,isSavedMessages:v,onSendWhenOnline:$,canScheduleUntilOnline:z})]})]})]})]})})})),lp=12,cp=(0,s.ph)(e=>{let{isOpen:t,isQuiz:i,shouldBeAnonymous:n,maxOptionsCount:a=lp,onSend:o,onClear:l}=e;const c=(0,s.li)(),d=(0,s.li)(),[h,u]=(0,s.J0)(""),[p,v]=(0,s.J0)([""]),[g,A]=(0,s.J0)(!0),[f,b]=(0,s.J0)(!1),[C,y]=(0,s.J0)(i||!1),[S,k]=(0,s.J0)(""),[w,N]=(0,s.J0)(),[I,P]=(0,s.J0)(!1),Y=(0,T.A)(),F=(0,M.A)(e=>{k(e.target.value)}),D=(0,M.A)(e=>{t&&e.current&&e.current.focus()});(0,s.vJ)(()=>t?(0,m.A)(l):void 0,[t,l]),(0,s.vJ)(()=>{t||(u(""),v([""]),A(!0),b(!1),y(i||!1),k(""),N(void 0),P(!1))},[i,t]),(0,s.vJ)(()=>D(c),[D,t]);const B=(0,M.A)(function(){v([...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],""]),(0,r.Uz)(()=>{const e=d.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),R=(0,M.A)(()=>{if(P(!1),!t)return;const e=C&&(void 0===w||!p[w].trim()),i=p.map((e,t)=>{if(e=e.trim())return{text:{text:e},option:String(t),...t===w&&{correct:!0}}}).filter(Boolean),s=h.trim().substring(0,255);if(!s||i.length<2){if(u(s),i.length){const e=p.map(e=>e.trim().substring(0,100)).filter(Boolean);e.length<2?B(e):v(e)}else B();return void P(!0)}if(e)return void P(!0);const n={summary:{question:{text:s},answers:i,...!g&&{isPublic:!0},...f&&{multipleChoice:!0},...C&&{quiz:!0}}};if(C){const{text:e,entities:t}=S&&(0,wm.Ay)(S.substring(0,200))||{};n.quiz={correctAnswers:[String(w)],...e&&{solution:e},...t&&{solutionEntities:t}}}o(n)}),L=(0,M.A)((e,t)=>{const i=[...p];i[e]=t,i[i.length-1].trim().length&&i.length<a?B(i):v(i)}),x=(0,M.A)(e=>{const t=[...p];t.splice(e,1),v(t),void 0!==w&&(w===e?N(void 0):e<w&&N(w-1)),(0,r.Uz)(()=>{d.current&&d.current.classList.toggle("overflown",d.current.scrollHeight>320)})}),E=(0,M.A)(e=>{N(Number(e))}),V=(0,M.A)(e=>{A(e.target.checked)}),_=(0,M.A)(e=>{b(e.target.checked)}),U=(0,M.A)(e=>{y(e.target.checked)}),O=(0,M.A)(e=>{13===e.keyCode&&R()}),K=(0,M.A)(e=>{u(e.target.value)}),J=(0,M.A)(()=>{if(I&&!h.trim().length)return Y("lng_polls_choose_question")}),G=(0,M.A)(e=>{const t=p.map(e=>e.trim()).filter(e=>e.length);if(I&&t.length<2&&!p[e].trim().length)return Y("lng_polls_choose_answers")});function j(){return p.map((e,t)=>(0,te.FD)("div",{className:"option-wrapper",children:[(0,te.Y)(Z.A,{maxLength:100,label:t!==p.length-1||p.length===a?Y("OptionHint"):Y("CreatePoll.AddOption"),error:G(t),value:e,onChange:e=>L(t,e.currentTarget.value),onKeyPress:O}),t!==p.length-1&&(0,te.Y)(Q.A,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:Y("Delete"),onClick:()=>x(t),children:(0,te.Y)(W.A,{name:"close"})})]}))}return(0,te.FD)(X.A,{isOpen:t,onClose:l,header:(0,te.FD)("div",{className:"modal-header-condensed",children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:l,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:Y("NewPoll")}),(0,te.Y)(Q.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:R,children:Y("Create")})]}),className:"PollModal",children:[(0,te.Y)(Z.A,{ref:c,label:Y("AskAQuestion"),value:h,error:J(),onChange:K,onKeyPress:O}),(0,te.Y)("div",{className:"options-divider"}),(0,te.FD)("div",{className:"options-list custom-scroll",ref:d,children:[(0,te.Y)("h3",{className:"options-header",children:Y("PollOptions")}),I&&function(){const e=p.map(e=>e.trim()).filter(e=>e.length);return C&&(void 0===w||!e[w])&&(0,te.Y)("p",{className:"poll-error",children:Y("lng_polls_choose_correct")})}(),C?(0,te.Y)(ee.A,{name:"correctOption",options:j().map((e,t)=>({value:String(t),label:e,hidden:!p[t].trim()})),selected:String(w),onChange:E}):j()]}),(0,te.Y)("div",{className:"options-divider"}),(0,te.FD)("div",{className:"quiz-mode",children:[(0,te.FD)("div",{className:"dialog-checkbox-group",children:[!n&&(0,te.Y)(sn.A,{label:Y("PollAnonymous"),checked:g,onChange:V}),(0,te.Y)(sn.A,{label:Y("PollMultiple"),checked:f,disabled:C,onChange:_}),(0,te.Y)(sn.A,{label:Y("PollQuiz"),checked:C,disabled:f||void 0!==i,onChange:U})]}),C&&(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:"options-header",children:Y("lng_polls_solution_title")}),(0,te.Y)(Dl.A,{value:S,onChange:F,noReplaceNewlines:!0}),(0,te.Y)("div",{className:"note",children:Y("CreatePoll.ExplanationInfo")})]})]})]})});var dp=i(14235);const hp=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const{appConfig:s}=e;return{editingMessage:i?.messageId?(0,c.O5q)(e,i.chatId,i.messageId):void 0,maxItemsCount:s.todoItemsMax,maxTitleLength:s.todoTitleLengthMax,maxItemLength:s.todoItemLengthMax}})(e=>{let{modal:t,maxItemsCount:i,maxTitleLength:a,maxItemLength:o,editingMessage:l,onSend:c,onClear:d}=e;const{editTodo:h,closeTodoListModal:u,appendTodoList:p}=(0,n.ko)(),v=(0,s.li)(),g=(0,s.li)(),[A,f]=(0,s.J0)(""),[b,C]=(0,s.J0)([{id:(0,dp.t)(),text:""}]),[y,S]=(0,s.J0)(!0),[k,w]=(0,s.J0)(!0),[N,I]=(0,s.J0)(!1),P=(0,_i.A)(),Y=Boolean(t),F=(0,Bi.A)(t),D=F?.forNewTask&&!l?.isOutgoing,T=l?.content.todo?.todo,B=(0,s.Kr)(()=>D&&T?T.items.map(e=>({id:e.id,text:e.title.text,isDisabled:!0})):Ci.p,[D,T]),R=(0,M.A)(e=>{Y&&e.current&&e.current.focus()});(0,s.Nf)(()=>{if(T&&(f(T.title.text),S(T.othersCanAppend??!1),w(T.othersCanComplete??!1),!D)){const e=T.items.map(e=>({id:e.id,text:e.title.text}));e.length<i&&e.push({id:(0,dp.t)(),text:""}),C(e)}},[T,D,i]),(0,s.vJ)(()=>Y?(0,m.A)(d):void 0,[Y,d]),(0,s.vJ)(()=>{Y||(f(""),C([{id:(0,dp.t)(),text:""}]),S(!0),w(!0),I(!1))},[Y]),(0,s.vJ)(()=>{Y&&(0,r.YS)(()=>{if(F?.forNewTask){const e=g.current?.querySelectorAll("input"),t=e?.[e.length-1];t?.focus()}else R(v)})},[R,Y,F?.forNewTask]);const L=(0,M.A)(e=>{const t=(0,dp.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,M.A)(()=>{if(I(!1),!Y)return;const e=b.map(e=>{const t=e.text.trim();if(t)return{id:e.id,title:{text:t.substring(0,o)}}}).filter(Boolean),t=A.trim().substring(0,a);if(!t||0===e.length){if(f(t),e.length){const e=b.map(e=>({...e,text:e.text.trim().substring(0,o)})).filter(e=>e.text.length);0===e.length?L([]):C([...e,{id:(0,dp.t)(),text:""}])}else L([]);return void I(!0)}if(D&&l)return p({chatId:l.chatId,messageId:l.id,items:e}),void u();const i={todo:{title:{text:t},items:e,othersCanAppend:y,othersCanComplete:k}};l?h({chatId:l.chatId,todo:i,messageId:l.id}):c(i),u()}),E=(0,M.A)((e,t)=>{const s=[...b];s[e]={...s[e],text:t},s[s.length-1].text.trim().length&&s.length<i?L(s):C(s)}),V=(0,M.A)(e=>{const t=[...b];t.splice(e,1),C(t),(0,r.Uz)(()=>{g.current&&g.current.classList.toggle("overflown",g.current.scrollHeight>320)})}),_=(0,M.A)(e=>{S(e.target.checked)}),U=(0,M.A)(e=>{w(e.target.checked)}),O=(0,M.A)(e=>{"Enter"===e.key&&x()}),K=(0,M.A)(e=>{f(e.target.value)}),J=(0,M.A)(()=>{if(N&&!A.trim().length)return P("ToDoListErrorChooseTitle")}),G=(0,M.A)(e=>{const t=b.map(e=>e.text.trim()).filter(e=>e.length);if(N&&t.length<1&&!b[e].text.trim().length)return P("ToDoListErrorChooseTasks")}),j=i-b.length-(D&&T?T.items.length:0);return(0,te.FD)(X.A,{isOpen:Y,onClose:d,header:function(){const e=D?"TitleAppendToDoList":l?"TitleEditToDoList":"TitleNewToDoList";return(0,te.FD)("div",{className:"modal-header-condensed",children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("AriaToDoCancel"),onClick:d,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)("div",{className:"modal-title",children:P(e)}),(0,te.Y)(Q.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:x,children:P(D?"Add":l?"Save":"Create")})]})}(),className:"ToDoListModal",children:[!D&&(0,te.Y)(Z.A,{ref:v,label:P("InputTitle"),value:A,error:J(),onChange:K,onKeyPress:O}),D&&(0,te.Y)("div",{className:"readonly-title",children:A}),(0,te.Y)("div",{className:"options-divider"}),(0,te.FD)("div",{className:"options-list custom-scroll",ref:g,children:[(0,te.Y)("h3",{className:"items-header",children:P("TitleToDoList")}),function(){const e=[...B,...b];return e.map((t,s)=>{const n=s-B.length;return(0,te.FD)("div",{className:"item-wrapper",children:[(0,te.Y)(Z.A,{maxLength:100,label:s!==e.length-1||e.length===i?P("TitleTask"):P("TitleAddTask"),error:G(n),value:t.text,disabled:t.isDisabled,onChange:e=>E(n,e.currentTarget.value),onKeyPress:O}),s!==e.length-1&&!t.isDisabled&&(0,te.Y)(Q.A,{className:"item-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:P("Delete"),onClick:()=>V(n),children:(0,te.Y)(W.A,{name:"close"})})]})})}()]}),(0,te.Y)("div",{className:"items-count-hint",children:P("HintTodoListTasksCount2",{count:j},{pluralValue:j})}),(0,te.Y)("div",{className:"options-divider"}),!D&&(0,te.Y)("div",{className:"options-footer",children:(0,te.FD)("div",{className:"dialog-checkbox-group",children:[(0,te.Y)(sn.A,{label:P("AllowOthersAddTasks"),checked:y,onChange:_}),(0,te.Y)(sn.A,{label:P("AllowOthersMarkAsDone"),checked:k,onChange:U})]})})]})}));var up=i(36680),mp=i(52491);const pp=(0,s.ph)(e=>{let{emoji:t,focus:i,onClick:s}=e;const n=(0,M.A)(e=>{e.preventDefault(),s(t.native,t.id)}),a=(0,me.A)("EmojiButton",i&&"focus"),o=`./img-apple-64/${t.image}.png`,r=mp.On.has(o);return(0,te.Y)("div",{className:a,onMouseDown:n,title:`:${t.names[0]}:`,children:u.TL?t.native:(0,te.Y)("img",{src:o,className:r?void 0:"opacity-transition shown",alt:t.native,loading:"lazy","data-path":o,onLoad:r?void 0:mp.P_,draggable:!1})})}),vp=.625*g.$,gp=.25*g.$,Ap=.5*g.$,fp=.5*g.$,bp=(0,s.ph)(e=>{let{category:t,index:i,allEmojis:n,observeIntersection:a,shouldRender:r,onEmojiSelect:l}=e;const c=(0,s.li)();(0,lr.mv)(c,a);const d=(0,Oi.A)(r),h=(0,T.A)(),{isMobile:u}=(0,Y.Ay)(),m=u?Math.floor((w.A.get().width-fp+vp)/(o.g0Q+vp)):8,p=Math.ceil(t.emojis.length/m)*(o.g0Q+(u?Ap:gp));return(0,te.FD)("div",{ref:c,id:`emoji-category-${i}`,className:"symbol-set",children:[(0,te.Y)("div",{className:"symbol-set-header",children:(0,te.Y)("p",{className:"symbol-set-name",dir:"auto",children:h(t.id===o.sR2?"RecentStickers":`Emoji${i}`)})}),(0,te.Y)("div",{className:(0,me.A)("symbol-set-container",d),style:`height: ${p}px;`,dir:h.isRtl?"rtl":void 0,children:r&&t.emojis.map(e=>{const t=n[e];if(!t)return;const i="id"in t?t:t[1];return(0,te.Y)(pp,{emoji:i,onClick:l},i.id)})})]},t.id)}),Cp={recent:"recent",people:"smile",nature:"animals",foods:"eats",activity:"sport",places:"car",objects:"lamp",symbols:"language",flags:"flag"},yp=3.25*g.$,Sp=2.625*g.$,kp=[];let wp,Np,Ip;const Pp=(0,s.ph)((0,n.EK)(e=>(0,bi.Up)(e,["recentEmojis"]))(e=>{let{className:t,recentEmojis:n,onEmojiSelect:a}=e;const r=(0,s.li)(),l=(0,s.li)(),[c,d]=(0,s.J0)(),[h,m]=(0,s.J0)(),[p,v]=(0,s.J0)(0),{isMobile:g}=(0,Y.Ay)(),{handleScroll:A,isAtBeginning:f}=bs(),{observe:b}=(0,lr.BL)({rootRef:r,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-",""));kp[i]=e.isIntersecting});const t=kp.reduce((e,t,i)=>t&&i<e?i:e,1/0);t!==1/0&&v(t)}),C=(0,or.A)([],o.vVF),y=h&&C;(0,Nn.A)(l,!(g&&y)),(0,s.vJ)(()=>{if(!c)return;const e=l.current;if(!e)return;const t=p*Sp-e.offsetWidth/2+Sp/2;(0,ba.A)(e,t)},[c,p]);const S=(0,T.A)(),k=(0,s.Kr)(()=>{if(!c)return Ci.p;const e=[...c];return n?.length&&e.unshift({id:o.sR2,name:S("RecentStickers"),emojis:n}),e},[c,S,n]);(0,s.vJ)(()=>{setTimeout(()=>{const e=()=>{d(Ip.categories),m(Ip.emojis)};Ip?e():async function(){return wp||(wp=i.e(996).then(i.t.bind(i,20996,19)),Np=(await wp).default,Ip=(0,mp.cp)(Np)),wp}().then(e)},200)},[]);const w=(0,M.A)(e=>{v(e);const t=r.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,rr.Ay)({container:r.current,element:t,position:"start",margin:yp,maxDistance:100})}),N=(0,M.A)((e,t)=>{a(e,t)}),I=(0,me.A)("EmojiPicker",t),P=(0,me.A)("EmojiPicker-header",!f&&"with-top-border");return(0,te.Y)(ne.Ay,{className:I,activeKey:y?1:0,name:"fade",shouldCleanup:!0,children:y?(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{ref:l,className:P,dir:S.isRtl?"rtl":void 0,children:k.map(function(e,t){const i=Cp[e.id];return i&&(0,te.Y)(Q.A,{className:"symbol-set-button "+(t===p?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>w(t),ariaLabel:e.name,children:(0,te.Y)(W.A,{name:i})})})}),(0,te.Y)("div",{ref:r,onScroll:A,className:(0,me.A)("EmojiPicker-main",u.TF?"no-scrollbar":"custom-scroll"),children:k.map((e,t)=>(0,te.Y)(bp,{category:e,index:t,allEmojis:h,observeIntersection:b,shouldRender:p>=t-1&&p<=t+1,onEmojiSelect:N}))})]}):(0,te.Y)(xs.A,{})})})),Yp=(0,s.ph)(e=>{let{gif:t,isDisabled:i,className:n,observeIntersection:a,onClick:o,onUnsaveClick:r,isSavedMessages:c}=e;const d=(0,s.li)(),h=(0,T.A)(),m=(0,lr.Vz)(d,a)&&!i,p=!t.hasVideoPreview&&t.thumbnail&&(0,l.sC)(t,"pictogram"),v=(0,z.A)(p,!m),[g]=(0,s.J0)(t.thumbnail?.dataUri&&!v),A=(0,Vi.A)(t.thumbnail?.dataUri,!g),f=(0,l.Ct)(t)||(0,l.sC)(t,"full"),b=(0,z.A)(f,!m),C=Boolean(m&&b),{isBuffered:y,bufferingHandlers:S}=(0,Oe.A)(!0),k=m&&!y,w=m&&y,{isContextMenuOpen:N,contextMenuAnchor:I,handleBeforeContextMenu:P,handleContextMenu:Y,handleContextMenuClose:F,handleContextMenuHide:D}=(0,bn.A)(d),B=(0,M.A)(()=>d.current),R=(0,M.A)(()=>d.current.closest(".custom-scroll, .no-scrollbar")),L=(0,M.A)(()=>d.current.querySelector(".gif-context-menu .bubble")),x=(0,M.A)(()=>{!N&&o&&o({...t,blobUrl:b})}),E=(0,M.A)(e=>{e.stopPropagation(),e.preventDefault(),r(t)}),V=(0,M.A)(()=>{r?.(t)}),_=(0,M.A)(()=>{o({...t,blobUrl:b},!0)}),U=(0,M.A)(()=>{o({...t,blobUrl:b},void 0,!0)}),O=(0,M.A)(e=>{(0,Ar.u)(e),P(e)});(0,s.vJ)(()=>{i&&F()},[F,i]);const K=(0,me.A)("GifButton",t.width&&t.height&&t.width<t.height?"vertical":"horizontal",o&&"interactive",n);return(0,te.FD)("div",{ref:d,className:K,onMouseDown:O,onClick:x,onContextMenu:Y,children:[!u.TF&&r&&(0,te.Y)(Q.A,{className:"gif-unsave-button",color:"dark",pill:!0,noFastClick:!0,onClick:E,children:(0,te.Y)(W.A,{name:"close",className:"gif-unsave-button-icon"})}),g&&(0,te.Y)("canvas",{ref:A,className:"thumbnail"}),v&&!w&&(0,te.Y)("img",{src:v,alt:"",className:"preview",draggable:!1}),C&&(0,te.Y)(zi.A,{canPlay:!0,src:b,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none",...S}),k&&(0,te.Y)(Ee.A,{color:v||g?"white":"black"}),o&&void 0!==I&&(0,te.FD)(qe.A,{isOpen:N,anchor:I,getTriggerElement:B,getRootElement:R,getMenuElement:L,className:"gif-context-menu",autoClose:!0,onClose:F,onCloseAnimationEnd:D,children:[!c&&(0,te.Y)(de.A,{onClick:_,icon:"mute",children:h("SendWithoutSound")}),(0,te.Y)(de.A,{onClick:U,icon:"calendar",children:h(c?"SetReminder":"ScheduleMessage")}),r&&(0,te.Y)(de.A,{destructive:!0,icon:"delete",onClick:V,children:h("Delete")})]})]})}),Fp=(0,s.ph)((0,n.EK)(e=>{const{chatId:t}=(0,c.Xf0)(e)||{},i=Boolean(t)&&(0,c.nZ4)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:i}})(e=>{let{className:t,loadAndPlay:i,canSendGifs:a,savedGifs:r,isSavedMessages:l,onGifSelect:c}=e;const{loadSavedGifs:d,saveGif:h}=(0,n.ko)(),m=(0,s.li)(),{observe:p}=(0,lr.BL)({rootRef:m,debounceMs:300});(0,s.vJ)(()=>{i&&d()},[i,d]);const v=(0,M.A)(e=>{h({gif:e,shouldUnsave:!0})}),g=(0,or.A)([],o.jhd),A=a&&(!g||!r);return(0,te.Y)(ne.Ay,{ref:m,className:(0,me.A)("GifPicker",t,u.TF?"no-scrollbar":"custom-scroll"),slideClassName:"GifPickerGrid",activeKey:A?0:1,name:"fade",shouldCleanup:!0,children:a?g&&r&&r.length?r.map(e=>(0,te.Y)(Yp,{gif:e,observeIntersection:p,isDisabled:!i,onClick:a?c:void 0,onUnsaveClick:v,isSavedMessages:l},e.id)):g&&r?(0,te.Y)("div",{className:"picker-disabled",children:"No saved GIFs."}):(0,te.Y)(xs.A,{color:"yellow"}):(0,te.Y)("div",{className:"picker-disabled",children:"Sending GIFs is not allowed in this chat."})})}));let Dp=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 Mp={[Dp.Emoji]:"Emoji",[Dp.CustomEmoji]:"StickersList.EmojiItem",[Dp.Stickers]:"AccDescrStickers",[Dp.GIFs]:"GifsTab"},Tp={[Dp.Emoji]:"icon-smile",[Dp.CustomEmoji]:"icon-favorite",[Dp.Stickers]:"icon-stickers",[Dp.GIFs]:"icon-gifs"},Bp=(0,s.ph)(e=>{let{activeTab:t,onSwitchTab:i,onRemoveSymbol:s,onSearchOpen:n,isAttachmentModal:a,canSendPlainText:o,canSearch:r}=e;const l=(0,T.A)();function c(e){return(0,te.Y)(Q.A,{className:"symbol-tab-button "+(t===e?"activated":""),onClick:()=>i(e),ariaLabel:l(Mp[e]),round:!0,faded:!0,color:"translucent",children:(0,te.Y)("i",{className:(0,me.A)("icon",Tp[e])})})}const d=(0,M.A)(()=>{n(t===Dp.Stickers?"stickers":"gifs")});return(0,te.FD)("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:l.isRtl?"rtl":void 0,children:[t!==Dp.Emoji&&t!==Dp.CustomEmoji&&r&&(0,te.Y)(Q.A,{className:"symbol-search-button",ariaLabel:t===Dp.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:d,children:(0,te.Y)(W.A,{name:"search"})}),o&&c(Dp.Emoji),o&&c(Dp.CustomEmoji),!a&&c(Dp.Stickers),!a&&c(Dp.GIFs),(t===Dp.Emoji||t===Dp.CustomEmoji)&&(0,te.Y)(Q.A,{className:"symbol-delete-button",onClick:s,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent",children:(0,te.Y)(W.A,{name:"delete-left"})})]})});let Rp=!1;const Lp=(0,s.ph)((0,n.EK)(e=>({isLeftColumnShown:(0,c.nTw)(e).isLeftColumnShown,isBackgroundTranslucent:(0,c.cwE)(e),animationLevel:(0,vn.l)(e).animationLevel}))(e=>{let{chatId:t,threadId:i,isOpen:n,canSendStickers:a,canSendGifs:o,isMessageComposer:l,idPrefix:c,isAttachmentModal:d,canSendPlainText:h,className:m,onLoad:p,onClose:v,onEmojiSelect:g,onCustomEmojiSelect:A,onStickerSelect:f,onGifSelect:b,onRemoveSymbol:C,onSearchOpen:y,addRecentEmoji:S,addRecentCustomEmoji:k,isLeftColumnShown:w,isBackgroundTranslucent:N,animationLevel:I,...P}=e;const[F,D]=(0,s.J0)(Dp.Emoji),[B,R]=(0,s.J0)([]),[L,x]=(0,s.J0)([]),{isMobile:E}=(0,Y.Ay)(),[V,_]=(0,up.A)(n,v,void 0,E),{shouldRender:U,transitionClassNames:O}=(0,Ke.A)(n,v,!1,!1),K=(0,T.A)();!Rp&&n&&(Rp=!0),(0,s.vJ)(()=>{p()},[p]),(0,s.vJ)(()=>{h||D(2)},[h]),(0,s.Nf)(()=>{if(E&&n&&!d)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)}},[d,E,n]);const J=(0,s.li)(B);J.current=B,(0,s.vJ)(()=>{J.current.length&&!n&&(J.current.forEach(e=>{S({emoji:e})}),R([]))},[n,S]);const G=(0,M.A)((e,t)=>{R(e=>[...e,t]),g(e)}),j=(0,s.li)(L);j.current=L,(0,s.vJ)(()=>{j.current.length&&!n&&(j.current.forEach(e=>{k({documentId:e})}),R([]))},[n,k]);const z=(0,M.A)(e=>{x(t=>[...t,e.id]),A(e)}),H=(0,M.A)(e=>{v(),y(e)}),$=(0,M.A)((e,t,i,s)=>{f?.(e,t,i,!0,s)}),q=(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()},children:Rp&&(0,te.Y)(ne.Ay,{name:(0,Ac.P)("slide",I),activeKey:F,renderCount:Object.values(Mp).length,children:function(e,s){switch(F){case Dp.Emoji:return(0,te.Y)(Pp,{className:"picker-tab",onEmojiSelect:G});case Dp.CustomEmoji:return(0,te.Y)(_r,{className:"picker-tab",isHidden:!n||!e,idPrefix:c,loadAndPlay:n&&(e||s),chatId:t,isTranslucent:!E&&N,onCustomEmojiSelect:z});case Dp.Stickers:return(0,te.Y)(Ym,{className:"picker-tab",isHidden:!n||!e,loadAndPlay:!!a&&n&&(e||s),idPrefix:c,canSendStickers:a,noContextMenus:!l,chatId:t,threadId:i,isTranslucent:!E&&N,onStickerSelect:$});case Dp.GIFs:return(0,te.Y)(Fp,{className:"picker-tab",loadAndPlay:!!o&&n&&(e||s),canSendGifs:o,onGifSelect:b})}}})}),E&&(0,te.Y)(Q.A,{round:!0,faded:!0,color:"translucent",ariaLabel:K("Close"),className:"symbol-close-button",size:"tiny",onClick:v,children:(0,te.Y)(W.A,{name:"close"})}),(0,te.Y)(Bp,{activeTab:F,onSwitchTab:D,onRemoveSymbol:C,canSearch:l,onSearchOpen:H,isAttachmentModal:d,canSendPlainText:h})]});if(E){if(!U)return;const e=(0,me.A)("SymbolMenu mobile-menu",O,w&&"left-column-open",d&&"in-attachment-modal",l&&"in-middle-column");return d?(0,te.Y)("div",{className:e,children:q}):(0,te.Y)(Ur.A,{children:(0,te.Y)("div",{className:e,children:q})})}return(0,te.Y)(qe.A,{isOpen:n,onClose:v,withPortal:d,className:(0,me.A)("SymbolMenu",m),onCloseAnimationEnd:v,onMouseEnter:u.TF?void 0:V,onMouseLeave:u.TF?void 0:_,noCloseOnBackdrop:!u.TF,noCompact:!0,...d?P:{positionX:"left",positionY:"bottom"},children:q})}));var xp=i(91034);const Ep=(0,s.ph)(e=>{let{withAvatar:t,focus:i,command:s,description:n,peer:a,clickArg:o,onClick:r}=e;const l=(0,M.A)(()=>{r(o)});return(0,te.FD)(ci.A,{className:(0,me.A)("BotCommand chat-item-clickable scroll-item",t&&"with-avatar"),multiline:!0,onClick:l,focus:i,children:[t&&(0,te.Y)(Mt.A,{size:"small",peer:a}),(0,te.FD)("div",{className:"content-inner",children:[(0,te.FD)("span",{className:"title",children:["/",s]}),(0,te.Y)("span",{className:"subtitle",children:(0,Dt.A)(n)})]})]},s)}),Vp=(0,s.ph)((0,xp.A)(e=>{let{isOpen:t,chatId:i,withUsername:a,botCommands:o,quickReplies:r,quickReplyMessages:c,self:d,getHtml:h,onClick:u,onClose:m}=e;const{sendBotCommand:p,sendQuickReply:v}=(0,n.ko)(),g=(0,s.li)(),{shouldRender:A,transitionClassNames:f}=(0,Ke.A)(t,void 0,void 0,!1),b=(0,M.A)(e=>{let{botId:t,command:i}=e;const s=(0,n.mS)().users.byId[t];p({command:`/${i}${a&&s?`@${(0,l.Kl)(s)}`:""}`}),u()}),C=(0,M.A)(e=>{v({chatId:i,quickReplyId:e}),u()}),y=(0,s.Kr)(()=>{if(r?.length&&c)return r.map(e=>{const t=c[e.topMessageId];return{id:e.id,command:e.shortcut,description:t?.content.text?.text||""}})},[r,c]),S=(0,M.A)(e=>!!e.command.startsWith(h().slice(1))&&("id"in e?C(e.id):b(e),!0)),k=ep({isActive:t,items:(0,s.Kr)(()=>{if(o||y)return[].concat(y||[],o||[])},[o,y]),onSelect:S,onClose:m}),w=o&&!o.length||r&&!r.length;if((0,s.vJ)(()=>{w&&m()},[w,m]),(0,s.vJ)(()=>{Xm(".chat-item-clickable",k,g)},[k]),!A||w)return;const N=(0,me.A)("iaTB59vy","composer-tooltip custom-scroll",f);return(0,te.FD)("div",{className:N,ref:g,children:[y?.map((e,t)=>(0,te.Y)(Ep,{command:e.command,description:e.description,peer:d,withAvatar:!0,clickArg:e.id,onClick:C,focus:k===t},`quickReply_${e.id}`)),o?.map((e,t)=>(0,te.Y)(Ep,{command:e.command,description:e.description,peer:(0,n.mS)().users.byId[e.botId],withAvatar:!0,clickArg:e,onClick:b,focus:k+(y?.length||0)===t},`${e.botId}_${e.command}`))]})})),_p=(0,s.ph)(e=>{let{isOpen:t,botCommands:i,onClose:s}=e;const{sendBotCommand:a}=(0,n.ko)(),{isMobile:o}=(0,Y.Ay)(),[r,l]=(0,up.A)(t,s,void 0,o),c=(0,M.A)(e=>{a({command:`/${e}`}),s()});return(0,te.Y)(qe.A,{isOpen:t,positionX:"left",positionY:"bottom",onClose:s,className:"BotCommandMenu",onCloseAnimationEnd:s,onMouseEnter:u.TF?void 0:r,onMouseLeave:u.TF?void 0:l,noCloseOnBackdrop:!u.TF,noCompact:!0,children:i.map(e=>(0,te.Y)(Ep,{command:e.command,description:e.description,clickArg:e.command,onClick:c},e.command))})}),Up=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{stickers:s}=e.stickers.forEmoji;return{stickers:s,isSavedMessages:(0,c.nZ4)(e,i),isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{chatId:t,threadId:i,isOpen:n,onStickerSelect:a,onClose:r,stickers:l,isSavedMessages:c,isCurrentUserPremium:d}=e;const h=(0,s.li)(),{shouldRender:u,transitionClassNames:p}=(0,Ke.A)(n,void 0,void 0,!1),v=(0,_.A)(l,!0),g=l||v,A=(0,Im.A)(t,i),{observe:f}=(0,lr.BL)({rootRef:h,throttleMs:200});(0,s.vJ)(()=>n?(0,m.A)(r):void 0,[n,r]);const b=(0,me.A)("StickerTooltip composer-tooltip custom-scroll",p,!g?.length&&"hidden");return(0,te.Y)("div",{ref:h,className:b,onMouseMove:()=>{A({type:"chooseSticker"})},children:u&&g?g.map(e=>(0,te.Y)(yr,{sticker:e,size:o.bkT,observeIntersection:f,onClick:n?a:void 0,clickArg:e,isSavedMessages:c,canViewSet:!0,isCurrentUserPremium:d},e.id)):u?(0,te.Y)(xs.A,{}):void 0})})),Op={root:"_8sFuAomM",emojiButton:"crWzZ2jr"},Kp=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{stickers:s}=e.customEmojis.forEmoji;return{customEmoji:s,isSavedMessages:(0,c.nZ4)(e,i),isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{isOpen:t,addRecentCustomEmoji:i,onCustomEmojiSelect:a,onClose:r,customEmoji:l,isSavedMessages:c,isCurrentUserPremium:d,noPlay:h}=e;const{clearCustomEmojiForEmoji:u}=(0,n.ko)(),p=(0,s.li)(),{shouldRender:v,transitionClassNames:g}=(0,Ke.A)(t,void 0,void 0,!1),A=(0,_.A)(l,!0),f=l||A;(0,Nn.A)(p);const{observe:b}=(0,lr.BL)({rootRef:p,throttleMs:200,isDisabled:!t});(0,s.vJ)(()=>t?(0,m.A)(r):void 0,[t,r]);const C=(0,M.A)(e=>{t&&(a(e),i({documentId:e.id}),u())}),y=(0,me.A)(Op.root,"composer-tooltip custom-scroll-x",g,!f?.length&&Op.hidden);return(0,te.Y)("div",{ref:p,className:y,children:v&&f?f.map(e=>(0,te.Y)(yr,{sticker:e,className:Op.emojiButton,size:o.x6_,observeIntersection:b,onClick:C,clickArg:e,isSavedMessages:c,canViewSet:!0,isCurrentUserPremium:d,noPlay:h},e.id)):v?(0,te.Y)(xs.A,{}):void 0})}));var Jp=i(76283);const Gp=(0,s.ph)(e=>{let{isOpen:t,isOpenToBottom:i=!1,isSavedMessages:a,canSchedule:o,canScheduleUntilOnline:r,onSendSilent:l,onSendSchedule:c,onSendWhenOnline:d,onRemoveEffect:h,onClose:m,onCloseAnimationEnd:p,chatId:v,withEffects:g,hasCurrentEffect:A,effectReactions:f,allAvailableReactions:b,onToggleReaction:C,canBuyPremium:y,isCurrentUserPremium:S,isInSavedMessages:k,isInStoryViewer:w,canPlayAnimatedEmojis:N}=e;const{openEffectPicker:I}=(0,n.ko)(),[P,Y]=(0,up.A)(t,m),[D,B]=(0,s.J0)(!1),R=(0,T.A)(),L=(0,_i.A)(),[x,E,V]=(0,F.A)();(0,ki.A)(e=>{let[i]=e;t&&!i&&(V(),B(Boolean(r)))},[t,r]);const[_,U,O]=(0,F.A)(),K=(0,M.A)(e=>{E(),v&&I({chatId:v,position:e})});return(0,s.vJ)(()=>{t?setTimeout(()=>{U()},200):O()},[t,U,O]),(0,te.FD)(qe.A,{isOpen:t,autoClose:!0,positionX:"right",positionY:i?"top":"bottom",className:(0,me.A)("CustomSendMenu","fluid","with-menu-transitions",g&&"with-effects"),onClose:m,onCloseAnimationEnd:p,onMouseEnter:u.TF?void 0:P,onMouseLeave:u.TF?void 0:Y,noCloseOnBackdrop:!u.TF,children:[g&&!w&&(0,te.Y)(Jp.A,{allAvailableReactions:b,effectReactions:f,currentReactions:void 0,onToggleReaction:C,isPrivate:!0,isReady:_,canBuyPremium:y,isCurrentUserPremium:S,isInSavedMessages:k,isForEffects:!0,canPlayAnimatedEmojis:N,onShowMore:K,onClose:m,className:(0,me.A)(x&&"ReactionSelector-hidden")}),(0,te.FD)("div",{className:(0,me.A)("CustomSendMenu_items",x&&"CustomSendMenu_items-hidden"),dir:R.isRtl?"rtl":void 0,children:[l&&(0,te.Y)(de.A,{icon:"mute",onClick:l,children:R("SendWithoutSound")}),o&&c&&(0,te.Y)(de.A,{icon:"schedule",onClick:c,children:R(a?"SetReminder":"ScheduleMessage")}),o&&c&&D&&(0,te.Y)(de.A,{icon:"user-online",onClick:d,children:R("SendWhenOnline")}),g&&A&&(0,te.Y)(de.A,{icon:"delete",onClick:h,children:L("RemoveEffect")})]})]})});var jp=i(41510),zp=i(22802);const Hp={B:"bold",STRONG:"bold",I:"italic",EM:"italic",U:"underline",DEL:"strikethrough",CODE:"monospace",SPAN:"spoiler"},$p=document.createElement("div"),qp=(0,s.ph)(e=>{let{isOpen:t,anchorPosition:i,selectedRange:n,setSelectedRange:a,onClose:r}=e;const l=(0,s.li)(),c=(0,s.li)(),{shouldRender:d,transitionClassNames:u}=(0,Ke.A)(t),[p,v,g]=(0,F.A)(),[A,f]=(0,s.J0)(""),[b,C]=(0,s.J0)(!1),[S,k]=(0,s.J0)(),[w,N]=(0,s.J0)({}),I=(0,_i.A)();(0,s.vJ)(()=>t?(0,m.A)(r):void 0,[t,r]),(0,zp.A)(t,l,r,!0),(0,s.vJ)(()=>{p?c.current.focus():(f(""),C(!1))},[p]),(0,s.vJ)(()=>{d||(g(),N({}),k(void 0))},[g,d]),(0,s.vJ)(()=>{if(!t||!n)return;const e={};let{parentElement:i}=n.commonAncestorContainer;for(;i&&i.id!==o.CfG;){const t=Hp[i.tagName];t&&(e[t]=!0),i=i.parentElement}N(e)},[t,n,v]);const P=(0,M.A)(()=>{if(!n)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(n))}),Y=(0,M.A)(()=>{const e=window.getSelection();e&&a(e.getRangeAt(0))}),D=(0,M.A)(e=>{if(n)return $p.replaceChildren(n.cloneContents()),e&&$p.querySelectorAll(Nm._p).forEach(e=>{e.replaceWith(e.getAttribute("alt"))}),$p.innerHTML}),T=(0,M.A)(()=>{if(n)return n.commonAncestorContainer.parentElement});function B(){const e=c.current;if(!e)return;const{offsetWidth:t,scrollWidth:i,scrollLeft:s}=e;if(i<=t)return void k(void 0);let n="";s<i-t&&(n="mask-right"),s>0&&(n+=" mask-left"),k(n)}function R(e){if(w[e])return"active";if("monospace"===e||"strikethrough"===e){if(Object.keys(w).some(t=>t!==e&&Boolean(w[t])))return"disabled"}else if(w.monospace||w.strikethrough)return"disabled"}const L=(0,M.A)(()=>{if(w.spoiler){const e=T();if(!n||!e||e.dataset.entityType!==O.C7.Spoiler||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,spoiler:!1}))}const e=D();document.execCommand("insertHTML",!1,`<span class="spoiler" data-entity-type="${O.C7.Spoiler}">${e}</span>`),r()}),x=(0,M.A)(()=>{N(e=>(document.execCommand(e.bold?"removeFormat":"bold"),Object.keys(e).forEach(t=>{"italic"!==t&&"underline"!==t||!Boolean(e[t])||document.execCommand(t)}),Y(),{...e,bold:!e.bold}))}),E=(0,M.A)(()=>{document.execCommand("italic"),Y(),N(e=>({...e,italic:!e.italic}))}),V=(0,M.A)(()=>{document.execCommand("underline"),Y(),N(e=>({...e,underline:!e.underline}))}),_=(0,M.A)(()=>{if(w.strikethrough){const e=T();if(!n||!e||"DEL"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,strikethrough:!1}))}const e=D();document.execCommand("insertHTML",!1,`<del>${e}</del>`),r()}),U=(0,M.A)(()=>{if(w.monospace){const e=T();if(!n||!e||"CODE"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void N(e=>({...e,monospace:!1}))}const e=D(!0);document.execCommand("insertHTML",!1,`<code class="text-entity-code" dir="auto">${e}</code>`),r()}),K=(0,M.A)(()=>{const e=((0,Zs.Tc)(A)||"").split("%").map(encodeURI).join("%");if(b){const t=T();if(!t||"A"!==t.tagName)return;return t.href=e,void r()}const t=D(!0);P(),document.execCommand("insertHTML",!1,`<a href="${e}" class="text-entity-link" dir="auto">${t}</a>`),r()}),J=(0,M.A)(e=>{const t={k:v,b:x,u:V,i:E,m:U,s:_,p:L}[function(e){const t=e.key||e.code;return t.startsWith("Key")?t.slice(3).toLowerCase():t}(e)];!e.altKey&&(e.ctrlKey||e.metaKey)&&t&&(e.preventDefault(),e.stopPropagation(),t())});if((0,s.vJ)(()=>(t&&document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)),[t,J]),!d)return;const G=(0,me.A)("TextFormatter",u,p&&"link-control-shown"),j=(0,me.A)("TextFormatter-link-url-confirm",Boolean(A.length)&&"shown"),z=i?`left: ${i.x}px; top: ${i.y}px;--text-formatter-left: ${i.x}px;`:"";return(0,te.FD)("div",{ref:l,className:G,style:z,onKeyDown:function(e){if("Enter"===e.key&&p){if(!A.trim())return;K(),e.preventDefault()}},onMouseDown:y.A,children:[(0,te.FD)("div",{className:"TextFormatter-buttons",children:[(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingSpoilerAria"),className:R("spoiler"),onClick:L,children:(0,te.Y)(W.A,{name:"eye-crossed"})}),(0,te.Y)("div",{className:"TextFormatter-divider"}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingBoldAria"),className:R("bold"),onClick:x,children:(0,te.Y)(W.A,{name:"bold"})}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingItalicAria"),className:R("italic"),onClick:E,children:(0,te.Y)(W.A,{name:"italic"})}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingUnderlineAria"),className:R("underline"),onClick:V,children:(0,te.Y)(W.A,{name:"underlined"})}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingStrikethroughAria"),className:R("strikethrough"),onClick:_,children:(0,te.Y)(W.A,{name:"strikethrough"})}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingMonospaceAria"),className:R("monospace"),onClick:U,children:(0,te.Y)(W.A,{name:"monospace"})}),(0,te.Y)("div",{className:"TextFormatter-divider"}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("FormattingAddLinkAria"),onClick:v,children:(0,te.Y)(W.A,{name:"link"})})]}),(0,te.Y)("div",{className:"TextFormatter-link-control",children:(0,te.FD)("div",{className:"TextFormatter-buttons",children:[(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("Cancel"),onClick:g,children:(0,te.Y)(W.A,{name:"arrow-left"})}),(0,te.Y)("div",{className:"TextFormatter-divider"}),(0,te.Y)("div",{className:(0,me.A)("TextFormatter-link-url-input-wrapper",S),children:(0,te.Y)("input",{ref:c,className:"TextFormatter-link-url-input",type:"text",value:A,placeholder:I("FormattingEnterUrl"),autoComplete:"off",spellCheck:!h.Vq&&void 0,inputMode:"url",dir:"auto",onChange:function(e){f(e.target.value),B()},onScroll:B})}),(0,te.FD)("div",{className:j,children:[(0,te.Y)("div",{className:"TextFormatter-divider"}),(0,te.Y)(Q.A,{color:"translucent",ariaLabel:I("Save"),className:"color-primary",onClick:K,children:(0,te.Y)(W.A,{name:"check"})})]})]})})]})}),Wp=(0,s.ph)(e=>{let{emoji:t,focus:i,onClick:s,observeIntersection:n}=e;const a=(0,M.A)(e=>{e.preventDefault(),s?.(t)}),o=(0,me.A)("EmojiButton",i&&"focus");return(0,te.Y)("div",{className:o,onMouseDown:a,title:t.emoji,children:(0,te.Y)(pa.A,{documentId:t.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:n})})}),Qp=(0,s.ph)(e=>{let{isOpen:t,emojis:i,customEmojis:n,onClose:a,onEmojiSelect:o,onCustomEmojiSelect:r,addRecentEmoji:l,addRecentCustomEmoji:c}=e;const d=(0,s.li)(),{shouldRender:h,transitionClassNames:u}=(0,Ke.A)(t,void 0,void 0,!1),m=(0,Qi.A)(i.length?[...n,...i]:void 0,350)||[];(0,Nn.A)(d);const{observe:p}=(0,lr.BL)({rootRef:d,throttleMs:200,isDisabled:!t}),v=(0,M.A)(e=>{o(e.native),l({emoji:e.id})}),g=(0,M.A)(e=>{r(e),c({documentId:e.id})}),A=(0,M.A)(e=>{"native"in e?v(e):g(e)}),f=(0,M.A)((e,t)=>{o(e),l({emoji:t})}),b=(0,M.A)(e=>{r(e),c({documentId:e.id})}),C=ep({isActive:t,isHorizontal:!0,items:m,shouldRemoveSelectionOnReset:!0,onSelect:A,onClose:a});(0,ki.A)(e=>{let[t]=e;void 0!==t&&-1!==t&&function(e,t){const i=t.current;if(!i)return;const{visibleIndexes:s,allElements:n}=Zm(i,".EmojiButton",8,!0,!0,!0);if(!n.length||!n[e])return;const a=s[0];if(!s.includes(e)||e===a&&!Qm(i,n[a],!0)){const t="start"==(e>s[s.length-1]?"start":"end")?44*e:0;(0,ba.A)(i,t)}}(C,d)},[C]);const y=(0,me.A)("EmojiTooltip composer-tooltip custom-scroll-x",u);return(0,te.Y)("div",{ref:d,className:y,children:h&&m?m.map((e,t)=>"native"in e?(0,te.Y)(pp,{emoji:e,focus:C===t,onClick:f},e.id):(0,te.Y)(Wp,{emoji:e,focus:C===t,onClick:b,observeIntersection:p},e.id)):h?(0,te.Y)(xs.A,{}):void 0})}),Zp=(0,s.ph)(e=>{let t,{title:i,description:s,thumbnail:n,thumbUrl:a,focus:o,transitionClassNames:r="",onClick:c}=e;const d=(0,z.A)(n?(0,l.cy)(n):void 0);return a=a||d,a?t=(0,te.Y)("img",{src:a,className:r,alt:"",decoding:"async",draggable:!1}):i&&(t=(0,$e.Qh)(i,1)),(0,te.FD)(ci.A,{focus:o,className:(0,me.A)("BaseResult chat-item-clickable","string"==typeof t&&"with-text"),onMouseDown:Ar.u,onClick:c,children:[(0,te.Y)("span",{className:"thumb",children:"string"==typeof t?(0,Dt.A)(t):t}),(0,te.FD)("div",{className:"content-inner",children:[i&&(0,te.Y)("div",{className:"title",children:i}),s&&(0,te.Y)("div",{className:"description",children:s})]})]})}),Xp=(0,s.ph)(e=>{let{focus:t,inlineResult:i,onClick:s}=e;const{title:n,description:a}=i,o="url"in i?i.url:void 0,r="webThumbnail"in i?i.webThumbnail:void 0,l=(0,M.A)(()=>{s(i)});return(0,te.Y)(Zp,{focus:t,thumbnail:r,title:n||o,description:a,onClick:l})}),ev=(0,s.ph)(e=>{let{inlineResult:t,isSavedMessages:i,canSendGifs:s,observeIntersection:n,onClick:a}=e;const{gif:o}=t,r=(0,M.A)((e,i,s)=>{a(t,i,s)});if(o)return(0,te.Y)(Yp,{gif:o,observeIntersection:n,className:"chat-item-clickable",onClick:s?r:void 0,isSavedMessages:i})}),tv=(0,s.ph)(e=>{let t,i,s,{focus:n,isForGallery:a,inlineResult:o,onClick:r}=e;"photo"in o&&(t=o.photo),"thumbnail"in o&&(i=o.thumbnail),"webThumbnail"in o&&(s=o.webThumbnail);const c=(0,z.A)((0,l.cy)(s)),d=(0,z.A)(t&&(0,l.rI)(t,"pictogram")),h=(0,Oi.A)(d||c),u=(0,M.A)(()=>{r(o)});if(a)return(0,te.FD)("div",{className:"MediaResult chat-item-clickable",onClick:u,children:[(0,te.Y)("img",{src:t?.thumbnail?.dataUri||c,alt:"",draggable:!1}),(0,te.Y)("img",{src:d,className:(0,me.A)("full-media",h),alt:"",draggable:!1})]});const{title:m,description:p}=o;return(0,te.Y)(Zp,{focus:n,thumbnail:s,thumbUrl:d||i?.dataUri,transitionClassNames:h,title:m,description:p,onClick:u})}),iv=(0,s.ph)(e=>{let{inlineResult:t,isSavedMessages:i,observeIntersection:s,onClick:n,isCurrentUserPremium:a}=e;const{sticker:r}=t;if(r)return(0,te.Y)(yr,{sticker:r,size:o.mD0,observeIntersection:s,title:r.emoji,className:"chat-item-clickable",onClick:n,clickArg:t,isSavedMessages:i,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:a})}),sv=(0,ge.nF)(e=>e(),500,!0),nv=(0,s.ph)(e=>{let{isOpen:t,botId:i,isGallery:o,inlineBotResults:r,switchPm:l,switchWebview:c,isSavedMessages:d,canSendGifs:h,loadMore:m,onClose:p,onSelectResult:v,isCurrentUserPremium:g}=e;const{openChat:A,startBot:f,requestSimpleWebView:b}=(0,n.ko)(),C=(0,s.li)(),{shouldRender:y,transitionClassNames:S}=(0,Ke.A)(t,void 0,void 0,!1),k=(0,Bi.A)(o,y),{observe:w}=(0,lr.BL)({rootRef:C,debounceMs:200,isDisabled:!t}),N=(0,M.A)(e=>{let{direction:t}=e;t===a.TN.Backwards&&sv(m)}),I=ep({isActive:t,shouldRemoveSelectionOnReset:k,noArrowNavigation:k,items:r,onSelect:v,onClose:p});(0,s.vJ)(()=>{Xm(".chat-item-clickable",I,C)},[I]);const P=(0,M.A)(()=>{A({id:i}),f({botId:i,param:l.startParam})}),Y=(0,M.A)(()=>{const e=(0,Pn.A)();b({botId:i,url:c.url,buttonText:c.text,theme:e,isFromSwitchWebView:!0})}),F=(0,_.A)(r?.length?r:void 0,y),D=r?.length?r:F;if(!y||!(D?.length||l||c))return;const T=(0,me.A)("InlineBotTooltip composer-tooltip",u.TF?"no-scrollbar":"custom-scroll",k&&"gallery",S);return(0,te.FD)(Cs.A,{ref:C,className:T,items:D,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:N,sensitiveArea:160,children:[l&&(0,te.Y)(ci.A,{ripple:!0,className:"switch-pm scroll-item",onClick:P,children:(0,te.Y)("span",{className:"title",children:l.text})}),c&&(0,te.Y)(ci.A,{ripple:!0,className:"switch-pm scroll-item",onClick:Y,children:(0,te.Y)("span",{className:"title",children:c.text})}),Boolean(D?.length)&&D.map((e,t)=>{switch(e.type){case"gif":return(0,te.Y)(ev,{inlineResult:e,observeIntersection:w,onClick:v,isSavedMessages:d,canSendGifs:h},e.id);case"photo":return(0,te.Y)(tv,{isForGallery:k,inlineResult:e,onClick:v},e.id);case"sticker":return(0,te.Y)(iv,{inlineResult:e,observeIntersection:w,onClick:v,isSavedMessages:d,isCurrentUserPremium:g},e.id);case"video":case"file":case"game":return(0,te.Y)(tv,{focus:I===t,inlineResult:e,onClick:v},e.id);case"article":case"audio":case"voice":return(0,te.Y)(Xp,{focus:I===t,inlineResult:e,onClick:v},e.id);default:return}})]})}),av=(0,s.ph)(e=>{let{isOpen:t,chatId:i,selectedSendAsId:a,sendAsPeerIds:o,isCurrentUserPremium:r,onClose:l}=e;const{saveDefaultSendAs:c,showNotification:d}=(0,n.ko)(),h=(0,n.mS)().users.byId,m=(0,n.mS)().chats.byId,p=(0,T.A)(),v=(0,s.li)(),[g,A,f]=(0,up.A)(t,l,void 0);(0,s.vJ)(()=>{t&&f()},[t,f]);const b=(0,M.A)(e=>{l(),c({chatId:i,sendAsId:e})}),C=ep({isActive:t,items:o,onSelect:b,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:l});return(0,s.vJ)(()=>{Xm(".chat-item-clickable",C,v)},[C]),(0,s.vJ)(()=>{o&&!o.length&&l()},[o,l]),(0,te.FD)(qe.A,{isOpen:t,positionX:"left",positionY:"bottom",onClose:l,className:"SendAsMenu",onCloseAnimationEnd:l,onMouseEnter:u.TF?void 0:g,onMouseLeave:u.TF?void 0:A,noCloseOnBackdrop:!u.TF,noCompact:!0,children:[(0,te.Y)("div",{className:"send-as-title",dir:"auto",children:p("SendMessageAsTitle")}),h&&m&&o?.map((e,t)=>{let{id:i,isPremium:s}=e;const n=h[i],o=m[i],l=n||o,c=(0,me.A)(a===i&&"selected");return(0,te.FD)(ci.A,{className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!s||r?b(i):d({message:p("SelectSendAsPeerPremiumHint"),actionText:p("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:C===t,rightElement:!r&&s&&(0,te.Y)(W.A,{name:"lock-badge",className:"send-as-icon-locked"}),children:[(0,te.Y)(Mt.A,{size:"small",peer:l,className:c}),(0,te.FD)("div",{className:"info",children:[l&&(0,te.Y)(Es.A,{peer:l,noFake:!0}),(0,te.Y)("span",{className:"subtitle",children:n?p("VoipGroupPersonalAccount"):p("Subscribers",o?.membersCount,"i")})]})]},i)})]})}),ov=(0,s.ph)((0,n.EK)((e,t)=>{let{stickerSetId:i}=t;return{set:(0,c.ycM)(e,i),shouldPlay:(0,c.ML4)(e),isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{stickerSetId:t,observeIntersection:i,set:a,shouldPlay:r,isModalOpen:l,isCurrentUserPremium:c}=e;const{loadStickers:d,toggleStickerSet:h,openStickerSet:u}=(0,n.ko)(),m=(0,s.li)(),p=(0,T.A)(),v=a&&!a.isArchived&&Boolean(a.installedDate),g=Boolean(a?.stickers),A=(0,s.Kr)(()=>{if(!a)return[];const e=(a.stickers?.filter(e=>{let{hasEffect:t}=e;return t})??[]).slice(0,3),t=(a.covers||[]).map(e=>{let{id:t}=e;return t}),i=a.stickers?a.stickers.filter(e=>{let{id:i}=e;return!t.includes(i)}):[];return[...e,...a.covers||[],...i].slice(0,5)},[a]);(0,s.vJ)(()=>{!g&&A.length<5&&a&&d({stickerSetInfo:{shortName:a.shortName}})},[g,A.length,d,a,t]);const f=(0,s.hb)(()=>{h({stickerSetId:t})},[h,t]),b=(0,s.hb)(e=>{u({stickerSetInfo:e.stickerSetInfo})},[u]);if(!a)return;const C=A.length>0;return(0,te.FD)("div",{className:"sticker-set",dir:p.isRtl?"rtl":void 0,children:[(0,te.FD)("div",{className:"sticker-set-header",children:[(0,te.FD)("div",{className:"title-wrapper",children:[(0,te.Y)("h3",{className:"title",dir:"auto",children:a.title}),(0,te.Y)("p",{className:"count",dir:"auto",children:p("Stickers",a.count,"i")})]}),(0,te.Y)(Q.A,{className:v?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:f,children:p(v?"Stickers.Installed":"Stickers.Install")})]}),(0,te.FD)("div",{className:"sticker-set-main shared-canvas-container",children:[(0,te.Y)("canvas",{ref:m,className:"shared-canvas"}),!C&&(0,te.Y)(Ee.A,{}),C&&A.map(e=>(0,te.Y)(yr,{sticker:e,size:o.Rqe,observeIntersection:i,noPlay:!r||l,clickArg:e,onClick:b,noContextMenu:!0,isCurrentUserPremium:c,sharedCanvasRef:m}))]})]},a.id)})),rv=(0,ge.nF)(e=>e(),6e4,!0),lv=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.BmE)(e),{query:i,resultIds:s}=t||{},{featured:n}=e.stickers;return{query:i,featuredIds:n.setIds,resultIds:s,isModalOpen:Boolean((0,c.nTw)(e).openedStickerSetShortName)}})(e=>{let{isActive:t,query:i,featuredIds:a,resultIds:o,isModalOpen:r,onClose:l}=e;const{loadFeaturedStickers:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,T.A)(),{observe:u}=(0,lr.BL)({rootRef:d,throttleMs:200});return(0,s.vJ)(()=>{rv(()=>{c()})}),(0,Ce.A)({isActive:t,onBack:l}),(0,te.Y)("div",{ref:d,className:"StickerSearch custom-scroll",dir:h.isRtl?"rtl":void 0,children:function(){if(void 0!==i)return!i&&a?a.map(e=>(0,te.Y)(ov,{stickerSetId:e,observeIntersection:u,isModalOpen:r},e)):o?o.length?o.map(e=>(0,te.Y)(ov,{stickerSetId:e,observeIntersection:u,isModalOpen:r},e)):(0,te.Y)("p",{className:"helper-text",dir:"auto",children:"Nothing found."}):(0,te.Y)(xs.A,{})}()})})),cv=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.Wy7)(e),{query:i,results:s}=t||{},{chatId:n,threadId:a}=(0,c.Xf0)(e)||{},o=n?(0,c.hds)(e,n):void 0,r=n?(0,c.AWZ)(e,n):void 0,d=o?(0,c.ALW)(e,o):void 0,h=Boolean(n)&&(0,c.nZ4)(e,n),u=n&&a?(0,c.Vw0)(e,n,a):void 0,m=Boolean(!u?.isCommentsInfo&&u?.fromChannelId),p=n&&a?(0,c.S0q)(e,n,a):void 0;return{query:i,results:s,chat:o,chatFullInfo:r,isChatWithBot:d,isSavedMessages:h,canPostInChat:Boolean(o)&&Boolean(a)&&(0,l.__)(o,p,m,r),canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),currentMessageList:(0,c.Xf0)(e)}})(e=>{let{isActive:t,query:i,results:a,chat:o,chatFullInfo:r,isChatWithBot:c,canScheduleUntilOnline:d,isSavedMessages:h,canPostInChat:m,currentMessageList:p,onClose:v}=e;const{searchMoreGifs:g,sendMessage:A,setGifSearchQuery:f}=(0,n.ko)(),b=(0,s.li)(),[C,y]=(0,om.A)(d),{observe:S}=(0,lr.BL)({rootRef:b,debounceMs:300}),k=m&&(0,l.Q_)(o,r,c,h).canSendGifs,w=(0,s.hb)((e,t,i)=>{if(k){if(!p)return;i?C(i=>{A({messageList:p,gif:e,scheduledAt:i,isSilent:t})}):A({messageList:p,gif:e,isSilent:t})}u.TF&&f({query:void 0})},[k,p,C]),N=(0,s.hb)(()=>{g()},[g]),I=(0,T.A)();(0,Ce.A)({isActive:t,onBack:v});const P=Boolean(void 0!==i&&a&&a.length);return(0,te.FD)("div",{className:"GifSearch",dir:I.isRtl?"rtl":void 0,children:[(0,te.Y)(Cs.A,{ref:b,className:(0,me.A)("gif-container custom-scroll",P&&"grid"),items:a,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:N,children:function(){if(void 0!==i)return a?a.length?a.map(e=>(0,te.Y)(Yp,{gif:e,observeIntersection:S,onClick:k?w:void 0,isSavedMessages:h},e.id)):(0,te.Y)("p",{className:"helper-text",dir:"auto",children:I("NoGIFsFound")}):(0,te.Y)(xs.A,{})}()}),y]})}));var dv=i(75319),hv=i(71950);const uv="OAKzmAva",mv="BQ6HUOqN",pv="U96CW2I7",vv="vXi2JQlj",gv="bi3fL59p",Av="GUK4ajPK",fv="YH6jeZIh",bv="q1LnuIUn",Cv="PJZzyVLK",yv="C7NpG5Y9",Sv=(0,s.ph)(function(e){let{postStatistic:t}=e;const i=(0,T.A)(),s=(0,_i.A)();return(0,te.FD)("div",{className:fv,children:[t.reactionsCount>0&&(0,te.FD)("span",{className:bv,children:[(0,te.Y)(W.A,{name:"heart-outline",className:Cv}),(0,$e.Vw)(s,t.reactionsCount)]}),t.forwardsCount>0&&(0,te.FD)("span",{className:bv,children:[(0,te.Y)(W.A,{name:"forward",className:Cv}),(0,$e.Vw)(s,t.forwardsCount)]}),!t.forwardsCount&&!t.reactionsCount&&i("ChannelStats.SharesCount_ZeroValueHolder")]})});function kv(e,t,i,s){return i?(0,te.FD)("span",{children:[(0,te.Y)("img",{src:i,alt:"",draggable:!1,className:(0,me.A)(pv,s&&"yxjDeIct")}),(0,l.zX)(t)&&(0,te.Y)(W.A,{name:"play"}),(0,A.C)(e,t,!0)]}):(0,A.C)(e,t)}const wv=(0,s.ph)(e=>{let{postStatistic:t,message:i}=e;const a=(0,_i.A)(),{toggleMessageStatistics:o}=(0,n.ko)(),r=(0,Lc.A)(i),c=(0,Rc.A)(i,"micro"),d=(0,z.A)(c),h=Boolean((0,l.lk)(i)),u=(0,s.hb)(()=>{o({messageId:i.id})},[o,i.id]);return(0,te.FD)("div",{className:(0,me.A)(uv,Boolean(d||r)&&mv),onClick:u,children:[(0,te.FD)("div",{className:gv,children:[(0,te.Y)("div",{className:vv,children:kv(a,i,d||r,h)}),(0,te.Y)("div",{className:fv,children:a("ChannelStatsViewsCount",{count:t.viewsCount},{pluralValue:t.viewsCount})})]}),(0,te.FD)("div",{className:Av,children:[(0,te.Y)("div",{className:yv,children:(0,He.L2)(1e3*i.date,a.code)}),(0,te.Y)(Sv,{postStatistic:t})]})]})});function Nv(e,t,i){return(0,te.FD)("span",{children:[i?(0,te.Y)("span",{className:"TmJvv2A6",children:(0,te.Y)("img",{src:i,alt:"",draggable:!1,className:(0,me.A)(pv,"cdfiLmXo","BOfHPv20")})}):(0,te.Y)(Mt.A,{peer:t,size:"small",className:pv,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story")]})}const Iv=(0,s.ph)(function(e){let{chat:t,story:i,postStatistic:s}=e;const a=(0,T.A)(),{toggleStoryStatistics:o}=(0,n.ko)(),r=i&&"content"in i,c=r?i.content.video:void 0,d=r?(0,l.EN)(i):void 0,h=(0,z.A)(d),u=h||c?.thumbnail?.dataUri,m=(0,M.A)(()=>{o({storyId:s.storyId})});return(0,te.FD)("div",{className:(0,me.A)(uv,mv),onClick:m,children:[(0,te.FD)("div",{className:gv,children:[(0,te.Y)("div",{className:vv,children:Nv(a,t,h||u)}),(0,te.Y)("div",{className:fv,children:a("ChannelStats.ViewsCount",s.viewsCount,"i")})]}),(0,te.FD)("div",{className:Av,children:[(0,te.Y)("div",{className:yv,children:r&&Boolean(i.date)&&(0,He.L2)(1e3*i.date,a.code)}),(0,te.Y)(Sv,{postStatistic:s})]})]})}),Pv="T1l_4J8z",Yv="S1x1ovkC",Fv="WxL3i5PM",Dv="aUrozL5_",Mv="QQHwjG88",Tv="QGctP1Nk";let Bv,Rv;const Lv={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"},xv=Object.keys(Lv),Ev={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Vv=Object.keys(Ev),_v=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.gqw)(e,i),n=(0,c.hds)(e,i),a=(0,c.AWZ)(e,i)?.statisticsDcId,o="chatTypeSuperGroup"===n?.type,r=(0,c.zeq)(e,i),l=(0,c._bp)(e,i)?.byId;return{statistics:s,dcId:a,isGroup:o,chat:n,messagesById:r,storiesById:l}})(e=>{let{chatId:t,chat:a,statistics:o,dcId:r,isGroup:l,messagesById:c,storiesById:d}=e;const h=(0,T.A)(),u=(0,s.li)(),[m,p]=(0,s.J0)(!1),v=(0,s.li)(new Set),g=(0,s.li)(new Set),{loadStatistics:A,loadStatisticsAsyncGraph:f}=(0,n.ko)(),b=(0,D.A)();(0,s.vJ)(()=>{A({chatId:t,isGroup:l})},[t,A,l]);const C=(0,s.Kr)(()=>l?Vv:xv,[l]),y=(0,s.Kr)(()=>l?Ev:Lv,[l]);return(0,s.vJ)(()=>{o&&C.forEach(e=>{const i=o[e];(0,dv.R)(i)&&"async"===i.graphType&&f({name:e,chatId:t,token:i.token,isPercentage:"languagesGraph"===e})})},[C,t,o,f]),(0,s.vJ)(()=>{(async()=>{await async function(){return Bv||(Bv=i.e(4810).then(i.bind(i,24810)),Rv=await Bv),Bv}(),m?o&&u.current&&(C.forEach((e,t)=>{const i=o[e];if(!(0,dv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||v.current.has(e))return;if(n)return v.current.add(e),void g.current.add(e);const{zoomToken:a}=i;Rv.create(u.current.children[t],{title:h(y[e]),...a?{onZoom:e=>(0,Ze.px)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:h("Graph.ZoomOut")}:{},...i}),v.current.add(e),u.current.children[t].classList.remove(Tv)}),b()):p(!0)})()},[C,y,m,o,h,t,f,r,b]),(0,te.FD)("div",{className:(0,me.A)(Pv,"panel-content custom-scroll",m&&Dv),children:[o&&(0,te.Y)(hv.A,{statistics:o,type:l?"group":"channel",title:h("StatisticOverview")}),!v.current.size&&(0,te.Y)(xs.A,{}),(0,te.Y)("div",{ref:u,children:C.map(e=>{const t=v.current.has(e)&&!g.current.has(e);return(0,te.Y)("div",{className:(0,me.A)(Mv,!t&&Tv)})})}),Boolean(o?.recentPosts?.length)&&(0,te.FD)("div",{className:"suY9dEIz",children:[(0,te.Y)("h2",{className:"evQIkAqx",children:h("ChannelStats.Recent.Header")}),o.recentPosts.map(e=>{if("msgId"in e){const t=c[e.msgId];if(!t||!("content"in t))return;return(0,te.Y)(wv,{message:t,postStatistic:e},`statistic_message_${e.msgId}`)}if("storyId"in e&&a){const t=d?.[e.storyId];return(0,te.Y)(Iv,{chat:a,story:t,postStatistic:e},`statistic_story_${e.storyId}`)}})]})]})})),Uv="oXLpD4Y4",Ov="paQ2VBe_",Kv="WvFuOAIf",Jv=(0,s.ph)(e=>{let{data:t}=e;const i=(0,T.A)(),{openChatByUsername:a}=(0,n.ko)(),o=(0,s.Kr)(()=>t.chat?(0,l.Kl)(t.chat):void 0,[t.chat]),r=(0,s.hb)(()=>{a({username:o,messageId:t.messageId})},[t.messageId,a,o]);return(0,te.FD)("div",{className:(0,me.A)(Uv,"statistic-public-forward"),onClick:r,children:[(0,te.Y)(Mt.A,{size:"medium",peer:t.chat}),(0,te.FD)("div",{children:[(0,te.Y)("div",{className:Ov,children:t.title}),(0,te.Y)("div",{className:Kv,children:i("ChannelStats.ViewsCount",t.views,"i")})]})]})});let Gv,jv;const zv={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Hv=Object.keys(zv),$v=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.AWZ)(e,i)?.statisticsDcId,n=(0,c.nTw)(e);return{statistics:n.statistics.currentMessage,dcId:s,messageId:n.statistics.currentMessageId}})(function(e){let{chatId:t,isActive:o,statistics:r,dcId:l,messageId:c}=e;const d=(0,T.A)(),h=(0,s.li)(),[u,m]=(0,s.J0)(!1),p=(0,s.li)(new Set),v=(0,s.li)(new Set),{loadMessageStatistics:g,loadMessagePublicForwards:A,loadStatisticsAsyncGraph:f}=(0,n.ko)(),b=(0,D.A)();(0,s.vJ)(()=>{c&&g({chatId:t,messageId:c})},[t,g,c]),(0,s.vJ)(()=>{o&&!c||(p.current.clear(),v.current.clear(),m(!1))},[o,c]),(0,s.vJ)(()=>{r&&Hv.forEach(e=>{const i=r[e];(0,dv.R)(i)&&"async"===i.graphType&&f({name:e,chatId:t,token:i.token})})},[t,r,f]),(0,s.vJ)(()=>{(async()=>{await async function(){return Gv||(Gv=i.e(4810).then(i.bind(i,24810)),jv=await Gv),Gv}(),u?r&&h.current&&(Hv.forEach((e,t)=>{const i=r[e];if(!(0,dv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||p.current.has(e))return;if(n)return p.current.add(e),void v.current.add(e);const{zoomToken:a}=i;jv.create(h.current.children[t],{title:d(zv[e]),...a?{onZoom:e=>(0,Ze.px)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:l}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e)}),b()):m(!0)})()},[u,r,d,t,c,f,l,b]);const C=(0,M.A)(e=>{let{direction:i}=e;i===a.TN.Backwards&&c&&A({chatId:t,messageId:c})});return u&&r&&c?(0,te.FD)("div",{className:(0,me.A)(Pv,"custom-scroll",u&&Dv),children:[(0,te.Y)(hv.A,{statistics:r,type:"message",title:d("StatisticOverview")}),(!p.current.size||!r.publicForwardsData)&&(0,te.Y)(xs.A,{}),(0,te.Y)("div",{ref:h,children:Hv.map(e=>{const t=p.current.has(e)&&!v.current.has(e);return(0,te.Y)("div",{className:(0,me.A)(Mv,!t&&Tv)})})}),Boolean(r.publicForwards)&&(0,te.FD)("div",{className:Yv,children:[(0,te.Y)("h2",{className:Fv,children:d("Stats.Message.PublicShares")}),(0,te.Y)(Cs.A,{items:r.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:C,noFastList:!0,children:r.publicForwardsData.map(e=>(0,te.Y)(Jv,{data:e},e.messageId))})]})]},`${t}-${c}`):(0,te.Y)(xs.A,{})})),qv=(0,s.ph)(function(e){let{data:t,chatsById:i,usersById:s}=e;const a=(0,T.A)(),{openChat:o}=(0,n.ko)(),r=s[t.peerId],c=i[t.peerId],d=(0,M.A)(()=>{o({id:r.id})});return(0,te.FD)("div",{className:(0,me.A)(Uv,"statistic-public-forward"),onClick:d,children:[(0,te.Y)(Mt.A,{size:"medium",peer:r||c,withStorySolid:!0,forceUnreadStorySolid:!0}),(0,te.FD)("div",{children:[(0,te.Y)("div",{className:Ov,children:r?(0,l.Yg)(r):(0,l.Js)(a,c)}),(0,te.Y)("div",{className:Kv,children:t.viewsCount?a("ChannelStats.ViewsCount",t.viewsCount,"i"):a("NoViews")})]})]})});let Wv,Qv;const Zv={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Xv=Object.keys(Zv),eg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.AWZ)(e,i)?.statisticsDcId,n=(0,c.nTw)(e),a=n.statistics.currentStory,o=n.statistics.currentStoryId,{byId:r}=e.users,{byId:l}=e.chats;return{statistics:a,dcId:s,storyId:o,usersById:r,chatsById:l}})(function(e){let{chatId:t,isActive:a,statistics:o,dcId:r,storyId:l,chatsById:c,usersById:d}=e;const h=(0,T.A)(),u=(0,s.li)(),[m,p]=(0,s.J0)(!1),v=(0,s.li)(new Set),g=(0,s.li)(new Set),{loadStoryStatistics:A,loadStoryPublicForwards:f,loadStatisticsAsyncGraph:b}=(0,n.ko)(),C=(0,D.A)();(0,s.vJ)(()=>{l&&A({chatId:t,storyId:l})},[t,l]),(0,s.vJ)(()=>{a&&!l||(v.current.clear(),g.current.clear(),p(!1))},[a,l]),(0,s.vJ)(()=>{o&&Xv.forEach(e=>{const i=o[e];(0,dv.R)(i)&&"async"===i.graphType&&b({name:e,chatId:t,token:i.token})})},[t,o,b]),(0,s.vJ)(()=>{(async()=>{await async function(){return Wv||(Wv=i.e(4810).then(i.bind(i,24810)),Qv=await Wv),Wv}(),m?o&&u.current&&(Xv.forEach((e,t)=>{const i=o[e];if(!(0,dv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||v.current.has(e))return;if(n)return v.current.add(e),void g.current.add(e);const{zoomToken:a}=i;Qv.create(u.current.children[t],{title:h(Zv[e]),...a?{onZoom:e=>(0,Ze.px)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:h("Graph.ZoomOut")}:{},...i}),v.current.add(e)}),C()):p(!0)})()},[m,o,h,t,l,b,r,C]);const y=(0,M.A)(()=>{l&&f({chatId:t,storyId:l})});return m&&o&&l?(0,te.FD)("div",{className:(0,me.A)(Pv,"custom-scroll",m&&Dv),children:[(0,te.Y)(hv.A,{statistics:o,type:"story",title:h("StatisticOverview")}),!v.current.size&&(0,te.Y)(xs.A,{}),(0,te.Y)("div",{ref:u,children:Xv.map(e=>{const t=v.current.has(e)&&!g.current.has(e);return(0,te.Y)("div",{className:(0,me.A)(Mv,!t&&Tv)})})}),Boolean(o.publicForwards)&&(0,te.FD)("div",{className:Yv,children:[(0,te.Y)("h2",{className:Fv,children:h("Stats.Message.PublicShares")}),(0,te.Y)(Cs.A,{items:o.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:y,noFastList:!0,children:o.publicForwardsData.map(e=>"messageId"in e?(0,te.Y)(Jv,{data:e},`message_${e.messageId}`):(0,te.Y)(qv,{data:e,chatsById:c,usersById:d},`story_${e.storyId}`))})]})]},`${t}-${l}`):(0,te.Y)(xs.A,{})}));var tg=i(55573);const ig=(0,s.ph)((0,n.EK)((e,t)=>{let{answer:i}=t;const{voters:s,offsets:n}=(0,c.nTw)(e).pollResults;return{voters:s?.[i.option],offset:n?.[i.option]||""}})(e=>{let{chat:t,message:i,answer:a,answerVote:o,totalVoters:r,voters:l,offset:c}=e;const{loadPollOptionResults:d,openChat:h,closePollResults:u}=(0,n.ko)(),m=(0,_.A)(o.votersCount),[p,g]=(0,s.J0)(!0),A=Boolean(l),{option:f,text:b}=a,C=(0,T.A)();(0,s.vJ)(()=>{A&&m===o.votersCount||d({chat:t,messageId:i.id,option:f,offset:c,limit:4,shouldResetVoters:!0})},[o.votersCount,A]);const y=(0,s.hb)(()=>{g(!0),d({chat:t,messageId:i.id,option:f,offset:c,limit:50})},[t,d,i.id,c,f]);(0,s.vJ)(()=>{g(!1)},[l]);const S=(0,s.hb)(e=>{h({id:e}),u()},[u,h]);return(0,te.FD)("div",{className:"PollAnswerResults",children:[(0,te.FD)("div",{className:"poll-voters",children:[l?l.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable",onClick:()=>S(e),children:(0,v.L8)(e)?(0,te.Y)(ws.A,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):(0,te.Y)(ks.A,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0})},e)):(0,te.Y)(xs.A,{}),l&&function(){const e=o.votersCount-l.length;return o.votersCount>4&&e>0&&(0,te.Y)(tg.A,{count:e,itemName:"voter",isLoading:p,onClick:y})}()]}),(0,te.FD)("div",{className:"answer-head",dir:C.isRtl?"rtl":void 0,children:[(0,te.Y)("span",{className:"answer-title",dir:"auto",children:(0,Xi.fd)({text:b.text,entities:b.entities})}),(0,te.FD)("span",{className:"answer-percent",dir:C.isRtl?"auto":void 0,children:[(k=o.votersCount,w=r,w>0?(k/w*100).toFixed():0),"%"]})]})]});var k,w})),sg=(0,s.ph)((0,n.EK)(e=>{const{pollResults:{chatId:t,messageId:i}}=(0,c.nTw)(e),s=t?(0,c.hds)(e,t):void 0,n=t&&i?(0,c.O5q)(e,t,i):void 0;return{chat:s,message:n,poll:n&&(0,c.zcZ)(e,n)}})(e=>{let{isActive:t,chat:i,message:s,poll:n,onClose:a}=e;const o=(0,T.A)();if((0,Ce.A)({isActive:t,onBack:a}),!s||!n||!i)return(0,te.Y)(xs.A,{});const{summary:r,results:l}=n;if(!l.results)return;const c=(0,bi.dU)(l.results,"option");return(0,te.FD)("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0,children:[(0,te.Y)("h3",{className:"poll-question",dir:"auto",children:(0,Xi.fd)({text:r.question.text,entities:r.question.entities})}),(0,te.Y)("div",{className:"poll-results-list custom-scroll",children:r.answers.map(e=>(0,te.Y)(ig,{chat:i,message:s,answer:e,answerVote:c[e.option],totalVoters:l.totalVoters},`${n.id}-${e.option}`))})]})}));var ng=i(90603);const ag="xrnUE4e6",og="z7kF7tij",rg="T6wFpdQO",lg="CWsWIKQ1",cg="KBl0ycLl",dg="iJ1U9kDD",hg="Rk6PT_yc",ug="qlo3vSEw",mg="r06zwL42",pg=5*g.$,vg=(0,s.ph)((0,n.EK)(e=>{const{createTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,createTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{isActive:t,chat:i,createTopicPanel:a,isCurrentUserPremium:r,onClose:l}=e;const{createTopic:c,openPremiumModal:d}=(0,n.ko)(),[h,u]=(0,s.J0)(""),[m,p]=(0,s.J0)(0),[v,g]=(0,s.J0)(void 0),A=(0,T.A)(),f=Boolean(h),b=Boolean(a?.isLoading);(0,Ce.A)({isActive:t,onBack:l}),(0,s.vJ)(()=>{t||(u(""),g(void 0))},[t]);const C=(0,s.hb)(e=>{u(e.target.value)},[]),y=(0,s.hb)(()=>{p(e=>(0,Ya.A)((0,ng.e$)().length,e+1))},[]),S=(0,s.hb)(()=>{c({chatId:i.id,title:h,iconColor:(0,ng.e$)()[m],iconEmojiId:v})},[i,c,m,v,h]),k=(0,s.hb)(e=>{e.isFree||r||e.id===o.MyF?e.id!==o.MyF?g(e.id):g(void 0):d({initialSection:"animated_emoji"})},[r,d]),w=(0,s.Kr)(()=>({id:0,title:h,iconColor:(0,ng.e$)()[m],iconEmojiId:v}),[m,v,h]);if(i?.isForum)return(0,te.FD)("div",{className:ag,children:[(0,te.FD)("div",{className:(0,me.A)(og,"custom-scroll"),children:[(0,te.FD)("div",{className:(0,me.A)(rg,lg),children:[(0,te.Y)("span",{className:ug,children:A("CreateTopicTitle")}),(0,te.Y)(ne.Ay,{name:"zoomFade",activeKey:Number(w.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:dg,children:(0,te.Y)(Vs.A,{topic:w,className:(0,me.A)(hg,"K1CTKtBS"),onClick:y,size:pg,noLoopLimit:!0})}),(0,te.Y)(Z.A,{value:h,onChange:C,label:A("lng_forum_topic_title"),disabled:b,teactExperimentControlled:!0})]}),(0,te.Y)("div",{className:(0,me.A)(rg,cg),children:(0,te.Y)(_r,{idPrefix:"create-topic-icons-set-",isHidden:!t,loadAndPlay:t,onCustomEmojiSelect:k,className:mg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]}),(0,te.Y)(wi.A,{isShown:f,disabled:b,onClick:S,ariaLabel:A("Save"),children:b?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})})),gg=5*g.$,Ag=(0,s.ph)((0,n.EK)(e=>{const{editTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,topic:t?.chatId&&t?.topicId?(0,c.S0q)(e,t.chatId,t.topicId):void 0,editTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(e=>{let{isActive:t,chat:i,topic:a,editTopicPanel:r,isCurrentUserPremium:l,onClose:c}=e;const{editTopic:d,openPremiumModal:h}=(0,n.ko)(),[u,m]=(0,s.J0)(""),[p,v]=(0,s.J0)(void 0),g=(0,T.A)(),A=Boolean(r?.isLoading),f=a?.id===o.HxB;(0,Ce.A)({isActive:t,onBack:c}),(0,s.vJ)(()=>{t||(m(""),v(void 0))},[t]),(0,s.vJ)(()=>{(a?.title||a?.iconEmojiId)&&(m(a.title),v(a.iconEmojiId))},[a]);const b=(0,s.Kr)(()=>u!==a?.title||p!==a?.iconEmojiId,[p,u,a?.iconEmojiId,a?.title]),C=(0,s.hb)(e=>{const t=e.target.value;m(t)},[]),y=(0,s.hb)(()=>{d({chatId:i.id,title:u,topicId:a.id,iconEmojiId:p})},[i,d,p,u,a]),S=(0,s.hb)(e=>{e.isFree||l||e.id===o.MyF?e.id!==o.MyF?v(e.id):v("0"):h({initialSection:"animated_emoji"})},[l,h]),k=(0,s.Kr)(()=>({...a,title:u,iconEmojiId:p}),[p,u,a]);if(i?.isForum)return(0,te.FD)("div",{className:ag,children:[(0,te.FD)("div",{className:(0,me.A)(og,"custom-scroll"),children:[!a&&(0,te.Y)(xs.A,{}),a&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:(0,me.A)(rg,lg,f&&"YftUWqqw"),children:[(0,te.Y)("span",{className:ug,children:g(f?"CreateGeneralTopicTitle":"CreateTopicTitle")}),(0,te.Y)(ne.Ay,{name:"zoomFade",activeKey:Number(k.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:dg,children:(0,te.Y)(Vs.A,{topic:k,className:hg,size:gg,noLoopLimit:!0})}),(0,te.Y)(Z.A,{value:u,onChange:C,label:g("lng_forum_topic_title"),disabled:A,teactExperimentControlled:!0})]}),!f&&(0,te.Y)("div",{className:(0,me.A)(rg,cg),children:(0,te.Y)(_r,{idPrefix:"edit-topic-icons-set-",isHidden:!t,loadAndPlay:t,onCustomEmojiSelect:S,className:mg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]})]}),(0,te.Y)(wi.A,{isShown:b,disabled:A,onClick:y,ariaLabel:g("Save"),children:A?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})})),fg="Please provide name",bg=(0,s.ph)((0,n.EK)((e,t)=>{let{userId:i}=t;const s=(0,c.yps)(e,i),n=(0,c.vGo)(e,i),{progress:a}=(0,c.nTw)(e).management,o=(0,ha.d)(e,"aboutLength");return{userId:i,user:s,progress:a,currentBio:n?.bio,maxBioLength:o}})(e=>{let{userId:t,user:i,progress:o,currentBio:r,isActive:c,maxBioLength:d,onClose:h}=e;const{setBotInfo:u,uploadProfilePhoto:m,uploadContactProfilePhoto:p,startBotFatherConversation:v}=(0,n.ko)(),[g,A,f]=(0,F.A)(!1),[b,C,y]=(0,F.A)(!1),[S,k]=(0,s.J0)(),w=(0,T.A)(),N=(0,s.Kr)(()=>i?(0,l.Kl)(i):void 0,[i]);(0,Ce.A)({isActive:c,onBack:h});const I=i?(0,l.u0)(i):"",[P,Y]=(0,s.J0)(),[D,B]=(0,s.J0)(I||""),[R,L]=(0,s.J0)(r||""),x=i&&(0,l.cP)(i),E=(0,z.A)(x,!1,O.qZ.BlobUrl);(0,s.vJ)(()=>{f(),y()},[t]),(0,s.vJ)(()=>{B(I||""),L(r||"")},[I,r,i]),(0,s.vJ)(()=>{Y(void 0)},[E]),(0,s.vJ)(()=>{o===a.TD.Complete&&(f(),y(),k(void 0))},[o]);const V=(0,M.A)(e=>{B(e.target.value),A(),S===fg&&k(void 0)}),_=(0,M.A)(e=>{L(e.target.value),A()}),U=(0,M.A)(e=>{Y(e),C()}),K=(0,M.A)(()=>{const e=D.trim(),t=R.trim();e.length?(u({...g&&{bot:i,name:e,description:t}}),P&&m({file:P,...b&&{bot:i}})):k(fg)}),J=(0,M.A)(()=>{v({param:`${N}-intro`})}),G=(0,M.A)(()=>{v({param:`${N}-commands`})}),j=(0,M.A)(()=>{v({param:N})}),H=(0,s.li)(),$=(0,s.li)(!1),q=(0,M.A)(e=>{C(),p({userId:t,file:e,isSuggest:$.current})});if(!i)return;const Q=o===a.TD.InProgress;return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(bh.A,{currentAvatarBlobUrl:E,onChange:U,title:w("ChatSetPhotoOrVideo"),disabled:Q}),(0,te.Y)(Z.A,{id:"user-name",label:w("PaymentCheckoutName"),onChange:V,value:D,error:S===fg?S:void 0,teactExperimentControlled:!0}),(0,te.Y)(Dl.A,{value:R,onChange:_,label:w("DescriptionPlaceholder"),disabled:Q,maxLength:d,maxLengthIndicator:d?(d-R.length).toString():void 0})]}),(0,te.Y)("div",{className:"section",children:(0,te.FD)("div",{className:"dialog-buttons",children:[(0,te.Y)(ci.A,{icon:"bot-commands-filled",ripple:!0,onClick:J,children:(0,te.Y)("span",{children:w("BotEditIntro")})}),(0,te.Y)(ci.A,{icon:"bot-command",ripple:!0,onClick:G,children:(0,te.Y)("span",{children:w("BotEditCommands")})}),(0,te.Y)(ci.A,{icon:"bots",ripple:!0,onClick:j,children:(0,te.Y)("span",{children:w("BotChangeSettings")})}),(0,te.Y)("div",{className:"section-info section-info_push",children:(0,Dt.A)(w("BotManageInfo"),["links"])})]})})]}),(0,te.Y)(wi.A,{isShown:g||b,onClick:K,disabled:Q,ariaLabel:w("Save"),children:Q?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(lu.A,{onChange:q,inputRef:H})]})})),Cg="Channel title can't be empty",yg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{management:n}=(0,c.nTw)(e),{progress:a}=n,{invites:o}=n.byChatId[i]||{},r=e.appConfig.channelAutoTranslationLevelMin,d=s?.hasAutoTranslation,h=s?.level,u=!(!h||!r)&&h>=r;return{chat:s,chatFullInfo:(0,c.AWZ)(e,i),progress:a,canChangeInfo:(0,l.ub)(s,"changeInfo"),canInvite:(0,l.ub)(s,"inviteUsers"),exportedInvites:o,availableReactions:e.reactions.availableReactions,hasAutoTranslation:d,canToggleAutoTranslation:u}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i))})(e=>{let{chatId:t,chat:i,chatFullInfo:o,progress:r,canChangeInfo:d,canInvite:h,exportedInvites:u,isActive:m,availableReactions:p,onScreenSelect:v,onClose:g,hasAutoTranslation:A,canToggleAutoTranslation:f}=e;const{updateChat:b,closeManagement:C,leaveChannel:y,deleteChannel:S,openChat:k,loadExportedChatInvites:w,loadChatJoinRequests:N,toggleAutoTranslation:I}=(0,n.ko)(),P=i?.title||"",Y=o?.about||"",D=Boolean(o?.linkedChatId),[B,R,L]=(0,F.A)(),[x,E]=(0,s.J0)(!1),[V,_]=(0,s.J0)(P),[U,K]=(0,s.J0)(Y),[J,G]=(0,s.J0)(),[j,H]=(0,s.J0)(),$=i&&(0,l.cP)(i),q=(0,z.A)($,!1,O.qZ.BlobUrl),Q=(0,T.A)(),X=i&&(0,l.WX)(i),ee=(0,M.A)(()=>{I({chatId:t,isEnabled:!A})});(0,Ce.A)({isActive:m,onBack:g}),(0,s.vJ)(()=>{h&&(w({chatId:t}),w({chatId:t,isRevoked:!0}),N({chatId:t}))},[t,h]),(0,s.vJ)(()=>{r===a.TD.Complete&&(E(!1),H(void 0))},[r]);const ie=(0,s.Kr)(()=>Object.keys(o?.adminMembersById||{}).length,[o?.adminMembersById]),se=o?.kickedMembers?.length||0,ne=(0,M.A)(()=>{v(a.je.ChatPrivacyType)}),ae=(0,M.A)(()=>{v(a.je.Discussion)}),oe=(0,M.A)(()=>{v(a.je.Reactions)}),re=(0,M.A)(()=>{v(a.je.ChatAdministrators)}),le=(0,M.A)(()=>{v(a.je.Invites)}),ce=(0,M.A)(()=>{v(a.je.JoinRequests)}),de=(0,M.A)(e=>{G(e),E(!0)}),he=(0,M.A)(e=>{_(e.target.value),E(!0)}),ue=(0,M.A)(e=>{K(e.target.value),E(!0)}),me=(0,M.A)(()=>{const e=V.trim(),i=U.trim();e.length?b({chatId:t,title:e,about:i,photo:J}):H(Cg)}),pe=(0,M.A)(()=>{v(a.je.ChannelSubscribers)}),ve=(0,M.A)(()=>{v(a.je.ChannelRemovedUsers)}),ge=(0,M.A)(()=>{i.isCreator?S({chatId:i.id}):y({chatId:i.id}),L(),C(),k({id:void 0})}),Ae=(0,s.Kr)(()=>{if(!o?.enabledReactions)return Q("ReactionsOff");if("all"===o.enabledReactions.type)return Q("ReactionsAll");const e=o.enabledReactions.allowed.length,t=p?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[p,o?.enabledReactions,Q]),fe=(0,s.Kr)(()=>(0,l.gA)(i),[i]);if((0,c._ls)((0,n.mS)(),t)||i.isForbidden)return;const be=r===a.TD.InProgress;return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(bh.A,{currentAvatarBlobUrl:q,onChange:de,disabled:!d}),(0,te.FD)("div",{className:"settings-edit",children:[(0,te.Y)(Z.A,{id:"channel-title",label:Q("EnterChannelName"),onChange:he,value:V,error:j===Cg?j:void 0,disabled:!d}),(0,te.Y)(Dl.A,{id:"channel-about",label:Q("DescriptionPlaceholder"),onChange:ue,value:U,maxLength:255,maxLengthIndicator:(255-U.length).toString(),disabled:!d,noReplaceNewlines:!0})]}),i.isCreator&&(0,te.FD)(ci.A,{icon:"lock",multiline:!0,onClick:ne,children:[(0,te.Y)("span",{className:"title",children:Q("ChannelType")}),(0,te.Y)("span",{className:"subtitle",children:Q(fe?"TypePublic":"TypePrivate")})]}),(0,te.FD)(ci.A,{icon:"message",multiline:!0,onClick:ae,disabled:!d,children:[(0,te.Y)("span",{className:"title",children:Q("Discussion")}),(0,te.Y)("span",{className:"subtitle",children:Q(D?"DiscussionUnlink":"Add")})]}),h&&(0,te.FD)(ci.A,{icon:"link",onClick:le,multiline:!0,disabled:!u,children:[(0,te.Y)("span",{className:"title",children:Q("GroupInfo.InviteLinks")}),(0,te.Y)("span",{className:"subtitle",children:u?(0,$e.Sm)(u.length):Q("Loading")})]}),Boolean(i.joinRequests?.length)&&(0,te.FD)(ci.A,{icon:"add-user-filled",onClick:ce,multiline:!0,children:[(0,te.Y)("span",{className:"title",children:Q("SubscribeRequests")}),(0,te.Y)("span",{className:"subtitle",children:(0,$e.Sm)(i.joinRequests.length)})]}),(0,te.FD)(ci.A,{icon:"heart-outline",multiline:!0,onClick:oe,disabled:!d,children:[(0,te.Y)("span",{className:"title",children:Q("Reactions")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:Ae})]}),X&&(0,te.FD)(ci.A,{icon:"language",narrow:!0,ripple:!0,disabled:!f,onClick:ee,children:[(0,te.Y)("span",{children:Q("AutomaticTranslation")}),(0,te.Y)(fi.A,{id:"auto-translation",label:Q("AutomaticTranslation"),checked:A})]})]}),(0,te.FD)("div",{className:"section",children:[(0,te.FD)(ci.A,{icon:"admin",multiline:!0,onClick:re,children:[(0,te.Y)("span",{className:"title",children:Q("ChannelAdministrators")}),(0,te.Y)("span",{className:"subtitle",children:ie})]}),(0,te.FD)(ci.A,{icon:"group",multiline:!0,onClick:pe,children:[(0,te.Y)("span",{className:"title",dir:"auto",children:Q("ChannelSubscribers")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:(0,$e.Sm)(i.membersCount)})]}),(0,te.FD)(ci.A,{icon:"delete-user",multiline:!0,onClick:ve,children:[(0,te.Y)("span",{className:"title",children:Q("ChannelBlockedUsers")}),(0,te.Y)("span",{className:"subtitle",children:se})]})]}),(0,te.Y)("div",{className:"section",children:(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:R,children:i.isCreator?Q("ChannelDelete"):Q("LeaveChannel")})})]}),(0,te.Y)(wi.A,{isShown:x,onClick:me,disabled:be,ariaLabel:Q("Save"),children:be?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(vi.A,{isOpen:B,onClose:L,text:i.isCreator?Q("ChannelDeleteAlert"):Q("ChannelLeaveAlert"),confirmLabel:i.isCreator?Q("ChannelDelete"):Q("LeaveChannel"),confirmHandler:ge,confirmIsDestructive:!0})]})})),Sg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i);return{chat:s,currentUserId:e.currentUserId,isChannel:s&&(0,l.WX)(s),adminMembersById:(0,c.AWZ)(e,i)?.adminMembersById}})(e=>{let{isActive:t,chat:i,isChannel:o,currentUserId:r,adminMembersById:c,onScreenSelect:d,onChatMemberSelect:h,onClose:u}=e;const{toggleSignatures:m}=(0,n.ko)(),p=(0,T.A)();(0,Ce.A)({isActive:t,onBack:u});const v=Boolean(i?.areSignaturesShown),g=Boolean(i?.areProfilesShown),A=Boolean(i?.isCreator||i&&(0,l.ub)(i,"addAdmins")),f=o&&(0,l.ub)(i,"postMessages"),b=(0,s.Kr)(()=>{if(!c)return[];const[e,t]=(0,bi.jB)(Object.values(c),e=>e.isOwner);return[...e,...t]},[c]),C=(0,M.A)(e=>{h(e.userId,e.promotedByUserId===r),d(a.je.ChatAdminRights)}),y=(0,M.A)(()=>{m({chatId:i.id,areProfilesEnabled:g,areSignaturesEnabled:!v})}),S=(0,M.A)(()=>{m({chatId:i.id,areProfilesEnabled:!g,areSignaturesEnabled:v})}),k=(0,M.A)(()=>{d(a.je.GroupAddAdmins)}),w=(0,M.A)(e=>{if(e.isOwner)return p("ChannelCreator");const t=(0,n.mS)().users.byId,i=e.promotedByUserId?t[e.promotedByUserId]:void 0;return i?p("EditAdminPromotedBy",(0,l.Yg)(i)):p("ChannelAdmin")});return(0,te.Y)("div",{className:"Management",children:(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.Y)("div",{className:"section",children:(0,te.FD)(ci.A,{icon:"recent",multiline:!0,disabled:!0,children:[(0,te.Y)("span",{className:"title",children:p("EventLog")}),(0,te.Y)("span",{className:"subtitle",children:p(o?"EventLogInfoDetailChannel":"EventLogInfoDetail")})]})}),(0,te.FD)("div",{className:"section",dir:p.isRtl?"rtl":void 0,children:[(0,te.Y)("p",{className:"section-help",dir:"auto",children:p(o?"Channel.Management.AddModeratorHelp":"Group.Management.AddModeratorHelp")}),b.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable",onClick:()=>C(e),children:(0,te.Y)(ws.A,{userId:e.userId,status:w(e),forceShowSelf:!0})},e.userId)),(0,te.Y)(wi.A,{isShown:A,onClick:k,ariaLabel:p("Channel.Management.AddModerator"),children:(0,te.Y)(W.A,{name:"add-user-filled"})})]}),f&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)("div",{className:"ListItem narrow",children:(0,te.Y)(sn.A,{checked:v,label:p("ChannelSignMessages"),onChange:y})}),v&&(0,te.FD)(te.FK,{children:[(0,te.Y)("div",{className:"ListItem narrow",children:(0,te.Y)(sn.A,{checked:g,label:p("ChannelSignMessagesWithProfile"),onChange:S})}),(0,te.Y)("p",{className:"section-info section-info_push",children:p("ChannelSignProfilesInfo")})]})]})]})})})),kg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{isUsernameAvailable:n,checkedUsername:a,error:o}=(0,c.YK)(e,i);return{chat:s,isChannel:(0,l.WX)(s),progress:(0,c.nTw)(e).management.progress,error:o,isUsernameAvailable:n,checkedUsername:a,isProtected:s?.isProtected,maxPublicLinks:(0,ha.d)(e,"channelsPublic"),privateInviteLink:(0,c.AWZ)(e,i)?.inviteLink}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i)&&(0,c.YK)(e,i))})(e=>{let{chat:t,isActive:i,isChannel:r,progress:c,isUsernameAvailable:d,checkedUsername:h,error:u,isProtected:m,maxPublicLinks:p,privateInviteLink:v,onClose:g}=e;const{updatePublicLink:A,updatePrivateLink:f,toggleIsProtected:b,openLimitReachedModal:C,resetManagementError:y}=(0,n.ko)(),S=(0,s.Kr)(()=>t.usernames?.find(e=>{let{isEditable:t}=e;return t}),[t.usernames]),k=S?.username||"",w=(0,s.Kr)(()=>(0,l.gA)(t),[t]),[N,I]=(0,s.J0)(!1),[P,Y]=(0,s.J0)(w?"public":"private"),[D,M]=(0,s.J0)(),[B,R,L]=(0,F.A)(),[x,E,V]=(0,F.A)(),U=(0,_.A)(d),O=N&&Boolean("public"===P&&(D||k&&""===D)&&(d??U)||"private"===P&&w);(0,Ce.A)({isActive:i,onBack:g}),(0,s.vJ)(()=>{I(!1)},[k]),(0,s.vJ)(()=>{P&&!v&&f()},[P,v,f]);const K=(0,s.hb)(e=>{M(e),I(!0),u&&y({chatId:t.id})},[t.id,u]),J=(0,s.hb)((e,t)=>{if(Object.values((0,n.mS)().chats.byId).filter(e=>{let{isCreator:t,usernames:i}=e;return t&&i?.some(e=>e.isActive)}).length>=p&&"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)}Y(e),I(!0)},[p,C]),G=(0,s.hb)(e=>{b({chatId:t.id,isProtected:"protected"===e})},[t.id,b]),j=(0,s.hb)(()=>{w&&"private"===P?E():A({username:"public"===P&&D||""})},[w,E,P,A,D]),z=(0,s.hb)(()=>{A({username:"",shouldDisableUsernames:!0}),V()},[V,A]),H=(0,s.hb)(()=>{L(),f()},[L,f]),$=(0,T.A)(),q=r?"Channel":"Mega",Q=r?"Channel":"Group",Z=[{value:"private",label:$(`${q}Private`),subLabel:$(`${q}PrivateInfo`)},{value:"public",label:$(`${q}Public`),subLabel:$(`${q}PublicInfo`)}],X=[{value:"allowed",label:$("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:$("ChannelVisibility.Forwarding.Disabled")}],ie=c===a.TD.InProgress,se="public"===P&&t.usernames&&t.usernames.length>0;return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section",dir:$.isRtl?"rtl":void 0,children:[(0,te.Y)("h3",{className:"section-heading",children:$(`${Q}Type`)}),(0,te.Y)(ee.A,{selected:P,name:"channel-type",options:Z,onChange:J})]}),"private"===P?(0,te.Y)("div",{className:"section",dir:$.isRtl?"rtl":void 0,children:v?(0,te.FD)(te.FK,{children:[(0,te.Y)(Wr.A,{link:v,className:"invite-link"}),(0,te.Y)("p",{className:"section-info",dir:$.isRtl?"rtl":void 0,children:$(`${q}PrivateLinkHelp`)}),(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:R,children:$("RevokeLink")}),(0,te.Y)(vi.A,{isOpen:B,onClose:L,text:$("RevokeAlert"),confirmLabel:$("RevokeButton"),confirmHandler:H,confirmIsDestructive:!0})]}):(0,te.Y)(xs.A,{})}):(0,te.FD)("div",{className:"section no-border",children:[(0,te.Y)("div",{className:"settings-input",children:(0,te.Y)(fh,{asLink:!0,currentUsername:k,isLoading:ie,isUsernameAvailable:d,checkedUsername:h,onChange:K})}),u===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,te.Y)("p",{className:"section-info",dir:"auto",children:$("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,te.Y)(pl.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,te.Y)("p",{className:"section-info",dir:"auto",children:$(`${Q}.Username.CreatePublicLinkHelp`)})]}),se&&(0,te.Y)(ph,{chatId:t.id,usernames:t.usernames,onEditUsername:K}),(0,te.FD)("div",{className:"section",dir:$.isRtl?"rtl":void 0,children:[(0,te.Y)("h3",{className:"section-heading",children:$(r?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")}),(0,te.Y)(ee.A,{selected:m?"protected":"allowed",name:"forwarding-type",options:X,onChange:G}),(0,te.Y)("p",{className:"section-info section-info_push",children:$(r?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")})]})]}),(0,te.Y)(wi.A,{isShown:O,disabled:ie,ariaLabel:$("Save"),onClick:j,children:ie?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(vi.A,{isOpen:x,onClose:V,text:$("ChannelVisibility.Confirm.MakePrivate.Channel",k),confirmHandler:z,confirmIsDestructive:!0})]})})),wg=(0,s.ph)((0,n.EK)((e,t)=>{let{chat:i}=t;const{currentUserId:s}=e;return{currentUserId:s,chatMembers:(0,c.AWZ)(e,i.id)?.members}})(e=>{let{chat:t,currentUserId:i,chatMembers:a,isOpen:o,onClose:r}=e;const{loadMoreMembers:l,deleteChatMember:c}=(0,n.ko)(),d=(0,T.A)(),[h,u]=(0,s.J0)(""),m=(0,s.Kr)(()=>{const e=(a||[]).reduce((e,t)=>(t.isAdmin||t.isOwner||t.userId===i||e.push(t.userId),e),[]);return(0,Ft.PU)({ids:e,query:h,type:"user"})},[a,i,h]),p=(0,M.A)(()=>{l({chatId:t.id})}),v=(0,M.A)(e=>{c({chatId:t.id,userId:e}),r()});return(0,te.Y)(Ks,{isOpen:o,chatOrUserIds:m,searchPlaceholder:d("ChannelBlockUser"),search:h,onSearchChange:u,loadMore:p,onSelectChatOrUser:v,onClose:r})})),Ng=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{byId:n}=e.users;return{chat:s,usersById:n,canDeleteMembers:s&&((0,l.ub)(s,"banUsers")||s.isCreator),removedMembers:(0,c.AWZ)(e,i)?.kickedMembers||Ci.p,isChannel:s&&(0,l.WX)(s)}})(e=>{let{chat:t,usersById:i,canDeleteMembers:a,removedMembers:o,isChannel:r,onClose:c,isActive:d}=e;const{updateChatMemberBannedRights:h}=(0,n.ko)(),u=(0,T.A)(),[m,p,v]=(0,F.A)();(0,Ce.A)({isActive:d,onBack:c});const g=(0,s.hb)(e=>{if(!e.kickedByUserId)return;const t=i[e.kickedByUserId];return t?u("UserRemovedBy",(0,l.Yg)(t)):void 0},[u,i]),A=(0,s.hb)(e=>{if(t)return[{title:u("Unblock"),icon:"delete",destructive:!0,handler:()=>h({chatId:t.id,userId:e.userId,bannedRights:{}})}]},[u,t,h]);return(0,te.Y)("div",{className:"Management",children:(0,te.Y)("div",{className:"panel-content custom-scroll",children:(0,te.FD)("div",{className:"section",dir:u.isRtl?"rtl":void 0,children:[(0,te.Y)("p",{className:"section-help",children:u(r?"NoBlockedChannel2":"NoBlockedGroup2")}),o.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable",ripple:!0,contextActions:A(e),children:(0,te.Y)(ws.A,{userId:e.userId,status:g(e),forceShowSelf:!0})},e.userId)),a&&(0,te.Y)(wi.A,{isShown:!0,onClick:p,ariaLabel:u("Channel.EditAdmin.Permission.BanUsers"),children:(0,te.Y)(W.A,{name:"add-user-filled"})}),t&&a&&(0,te.Y)(wg,{chat:t,isOpen:m,onClose:v})]})})})})),Ig=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{linkedChatId:n}=(0,c.AWZ)(e,i)||{},{forDiscussionIds:a,byId:o}=e.chats;return{chat:s,chatsByIds:o,forDiscussionIds:a,linkedChat:n?(0,c.hds)(e,n):void 0,isChannel:s&&(0,l.WX)(s)}})(e=>{let{chat:t,onClose:i,isActive:r,chatId:c,chatsByIds:d,linkedChat:h,forDiscussionIds:u,isChannel:m,onScreenSelect:p}=e;const{loadGroupsForDiscussion:v,linkDiscussionGroup:g,unlinkDiscussionGroup:A,toggleJoinRequest:f,toggleJoinToSend:b}=(0,n.ko)(),[C,y]=(0,s.J0)(),[S,k,w]=(0,F.A)(),[N,I,P]=(0,F.A)(),[Y,D]=(0,s.J0)(Boolean(h?.isJoinToSend)),[B,R]=(0,s.J0)(Boolean(h?.isJoinRequest)),L=(0,T.A)(),x=h?.id;(0,Ce.A)({isActive:r,onBack:i}),(0,s.vJ)(()=>{v()},[v]),(0,s.vJ)(()=>{r&&(D(h?.isJoinToSend||!1),R(h?.isJoinRequest||!1))},[h,r]);const E=(0,s.hb)(()=>{w(),A({channelId:m?c:x}),m||p(a.je.Initial)},[w,A,m,c,x,p]),V=(0,s.hb)(()=>{P(),g({channelId:c,chatId:C})},[P,g,c,C]),_=(0,s.hb)(e=>{D(e),b({chatId:x,isEnabled:e}),e||R(!1)},[x,b]),U=(0,s.hb)(e=>{R(e),f({chatId:x,isEnabled:e})},[x,f]);const O=(0,M.A)(()=>{p(a.je.NewDiscussionGroup)});return(0,te.Y)("div",{className:"Management",children:(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.DiscussionGroups,size:o.Uyp,className:"section-icon"}),h&&(0,te.FD)("div",{children:[h&&(0,te.Y)(ci.A,{className:"chat-item-clickable",inactive:!0,children:(0,te.Y)(ks.A,{chatId:h.id})}),(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:k,children:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")}),(0,te.Y)(vi.A,{isOpen:S,onClose:w,header:(0,te.FD)("div",{className:"modal-header",children:[(0,te.Y)(Mt.A,{size:"tiny",peer:h}),(0,te.Y)("div",{className:"modal-title",children:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")})]}),textParts:(0,Dt.A)(L(m?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",h?.title),["br","simple_markdown"]),confirmLabel:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:E,confirmIsDestructive:!0})]}),!h&&(0,te.FD)("div",{children:[(0,te.Y)("p",{className:"section-help",dir:"auto",children:L("DiscussionChannelHelp")}),(0,te.FD)("div",{teactFastList:!0,children:[(0,te.Y)(ci.A,{icon:"group",ripple:!0,className:"create-item",withPrimaryColor:!0,teactOrderKey:0,onClick:O,children:L("DiscussionCreateGroup")},"create-group"),u?u.map((e,t)=>(0,te.Y)(ci.A,{teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{y(e),I()},children:(0,te.Y)(ks.A,{chatId:e})},e)):(0,te.Y)(kc.A,{teactOrderKey:0,text:"No discussion groups found"},"nothing-found")]}),(0,te.Y)("p",{className:"mt-4 mb-0 section-help",dir:"auto",children:L("DiscussionChannelHelp2")}),(0,te.Y)(vi.A,{isOpen:N,onClose:P,header:function(){if(!C)return;const e=d[C];return e?(0,te.FD)("div",{className:"modal-header",children:[(0,te.Y)(Mt.A,{size:"tiny",peer:e}),(0,te.Y)("div",{className:"modal-title",children:L("Channel.DiscussionGroup.LinkGroup")})]}):void 0}(),textParts:function(){if(!C)return;const e=d[C];return e?(0,l.gA)(e)?(0,Dt.A)(`Do you want to make **${e.title}** the discussion board for **${t?.title}**?`,["br","simple_markdown"]):(0,Dt.A)(`Do you want to make **${e.title}** the discussion board for **${t?.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"]):void 0}(),confirmLabel:L("DiscussionLinkGroup"),confirmHandler:V})]})]}),h&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)("h3",{className:"section-heading",children:L("ChannelSettingsJoinTitle")}),(0,te.Y)("div",{className:"ListItem narrow",children:(0,te.Y)(sn.A,{checked:Y,onCheck:_,label:L("ChannelSettingsJoinToSend")})}),Y&&(0,te.Y)("div",{className:"ListItem narrow",children:(0,te.Y)(sn.A,{checked:B,onCheck:U,label:L("ChannelSettingsJoinRequest")})}),(0,te.Y)("p",{className:"section-info section-info_push",children:L(Y?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")})]})]})})})),Pg="Group title can't be empty",Yg=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],Fg=Yg.length+1,Dg=(0,ge.sg)(e=>e(),500,!1),Mg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),n=(0,c.AWZ)(e,i),{management:a,limitReachedModal:o}=(0,c.nTw)(e),{progress:r}=a,d=Boolean(n?.linkedChatId),h=(0,l.yn)(s),{invites:u}=a.byChatId[i]||{},m=!d&&((0,l.ub)(s,"changeInfo")||s.isCreator);return{chat:s,chatFullInfo:n,progress:r,isBasicGroup:h,hasLinkedChannel:d,canChangeInfo:s.isCreator||(0,l.ub)(s,"changeInfo"),canBanUsers:s.isCreator||(0,l.ub)(s,"banUsers"),canInvite:s.isCreator||(0,l.ub)(s,"inviteUsers"),exportedInvites:u,isChannelsPremiumLimitReached:"channels"===o?.limit,availableReactions:e.reactions.availableReactions,canEditForum:m}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i))})(e=>{let{chatId:t,chat:i,chatFullInfo:o,progress:r,isBasicGroup:d,hasLinkedChannel:h,canChangeInfo:u,canBanUsers:m,canInvite:p,canEditForum:v,isActive:g,exportedInvites:A,isChannelsPremiumLimitReached:f,availableReactions:b,onScreenSelect:C,onClose:y}=e;const{togglePreHistoryHidden:S,updateChat:k,deleteChat:w,leaveChannel:N,deleteChannel:I,closeManagement:P,openChat:Y,loadExportedChatInvites:D,loadChatJoinRequests:B,toggleForum:R}=(0,n.ko)(),[L,x,E]=(0,F.A)(),V=i.title,_=o?.about||"",[U,K]=(0,s.J0)(!1),[J,G]=(0,s.J0)(V),[j,H]=(0,s.J0)(_),[$,q]=(0,s.J0)(),[Q,X]=(0,s.J0)(),[ee,ie]=(0,s.J0)(i.isForum),se=(0,l.cP)(i),ne=(0,z.A)(se,!1,O.qZ.BlobUrl),ae=(0,s.Kr)(()=>(0,l.gA)(i),[i]),oe=(0,T.A)(),re=(0,s.li)();(0,Ce.A)({isActive:g,onBack:y}),(0,s.vJ)(()=>{p&&(D({chatId:t}),D({chatId:t,isRevoked:!0}),B({chatId:t}))},[t,p]),(0,s.vJ)(()=>{ie(Boolean(i.isForum))},[i.isForum]),(0,s.vJ)(()=>{r===a.TD.Complete&&(K(!1),X(void 0))},[r]);const le=(0,M.A)(()=>{C(a.je.ChatPrivacyType)}),ce=(0,M.A)(()=>{C(a.je.Discussion)}),de=(0,M.A)(()=>{C(a.je.Reactions)}),he=(0,M.A)(()=>{C(a.je.GroupPermissions)}),ue=(0,M.A)(()=>{C(a.je.ChatAdministrators)}),me=(0,M.A)(()=>{C(a.je.Invites)}),pe=(0,M.A)(()=>{C(a.je.JoinRequests)}),ve=(0,M.A)(e=>{q(e),K(!0)}),ge=(0,M.A)(e=>{G(e.target.value),K(!0)}),Ae=(0,M.A)(e=>{H(e.target.value),K(!0)}),fe=(0,M.A)(()=>{const e=J.trim(),i=j.trim();e.length?k({chatId:t,title:e,about:i,photo:$}):X(Pg)}),be=(0,M.A)(()=>{C(a.je.GroupMembers)}),ye=(0,M.A)(()=>{if(!o)return;const{isPreHistoryHidden:e}=o;S({chatId:i.id,isEnabled:!e})}),Se=(0,M.A)(()=>{ie(e=>{const i=!e;return Dg(()=>{R({chatId:t,isEnabled:i})}),i})});(0,s.vJ)(()=>{if(!f)return;const e=re.current?.querySelector("input");e.checked=!o?.isPreHistoryHidden},[f,o?.isPreHistoryHidden]);const ke=(0,s.Kr)(()=>{if(!o?.enabledReactions)return oe("ReactionsOff");if("all"===o.enabledReactions.type)return oe("ReactionsAll");const e=o.enabledReactions.allowed.length,t=b?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[b,o?.enabledReactions,oe]),we=(0,s.Kr)(()=>{if(!i.defaultBannedRights)return 0;let e=Yg.filter(e=>!("manageTopics"===e&&!ee||i.defaultBannedRights[e])).length;const{sendStickers:t,sendGifs:s}=i.defaultBannedRights;return t||s||(e+=1),e},[i.defaultBannedRights,ee]),Ne=(0,s.Kr)(()=>Object.keys(o?.adminMembersById||{}).length,[o?.adminMembersById]),Ie=(0,M.A)(()=>{d?w({chatId:i.id}):i.isCreator?I({chatId:i.id}):N({chatId:i.id}),E(),P(),Y({id:void 0})});if((0,c._ls)((0,n.mS)(),t)||i.isForbidden)return;const Pe=r===a.TD.InProgress;return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(bh.A,{isForForum:ee,currentAvatarBlobUrl:ne,onChange:ve,disabled:!u}),(0,te.FD)("div",{className:"settings-edit",children:[(0,te.Y)(Z.A,{id:"group-title",label:oe("GroupName"),onChange:ge,value:J,error:Q===Pg?Q:void 0,disabled:!u}),(0,te.Y)(Dl.A,{id:"group-about",label:oe("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-j.length).toString(),onChange:Ae,value:j,disabled:!u,noReplaceNewlines:!0})]}),i.isCreator&&(0,te.FD)(ci.A,{icon:"lock",multiline:!0,onClick:le,children:[(0,te.Y)("span",{className:"title",children:oe("GroupType")}),(0,te.Y)("span",{className:"subtitle",children:oe(ae?"TypePublic":"TypePrivate")})]}),h&&(0,te.FD)(ci.A,{icon:"message",multiline:!0,onClick:ce,children:[(0,te.Y)("span",{className:"title",children:oe("LinkedChannel")}),(0,te.Y)("span",{className:"subtitle",children:oe("DiscussionUnlink")})]}),(0,te.FD)(ci.A,{icon:"permissions",multiline:!0,onClick:he,disabled:!m,children:[(0,te.Y)("span",{className:"title",children:oe("ChannelPermissions")}),(0,te.FD)("span",{className:"subtitle",dir:"auto",children:[we,"/",Fg-(ee?0:1)]})]}),(0,te.FD)(ci.A,{icon:"heart-outline",multiline:!0,onClick:de,disabled:!u,children:[(0,te.Y)("span",{className:"title",children:oe("Reactions")}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:ke})]}),(0,te.FD)(ci.A,{icon:"admin",multiline:!0,onClick:ue,children:[(0,te.Y)("span",{className:"title",children:oe("ChannelAdministrators")}),(0,te.Y)("span",{className:"subtitle",children:(0,$e.Sm)(Ne)})]}),p&&(0,te.FD)(ci.A,{icon:"link",onClick:me,multiline:!0,disabled:!A,children:[(0,te.Y)("span",{className:"title",children:oe("GroupInfo.InviteLinks")}),(0,te.Y)("span",{className:"subtitle",children:A?(0,$e.Sm)(A.length):oe("Loading")})]}),Boolean(i.joinRequests?.length)&&(0,te.FD)(ci.A,{icon:"add-user-filled",onClick:pe,multiline:!0,children:[(0,te.Y)("span",{className:"title",children:oe("MemberRequests")}),(0,te.Y)("span",{className:"subtitle",children:(0,$e.Sm)(i.joinRequests.length)})]}),v&&(0,te.FD)(te.FK,{children:[(0,te.FD)(ci.A,{icon:"forums",ripple:!0,onClick:Se,children:[(0,te.Y)("span",{children:oe("ChannelTopics")}),(0,te.Y)(fi.A,{id:"group-notifications",label:oe("ChannelTopics"),checked:ee,inactive:!0})]}),(0,te.Y)("div",{className:"section-info section-info_push",children:oe("ForumToggleDescription")})]})]}),(0,te.FD)("div",{className:"section",children:[(0,te.FD)(ci.A,{icon:"group",multiline:!0,onClick:be,children:[(0,te.Y)("span",{className:"title",children:oe("GroupMembers")}),(0,te.Y)("span",{className:"subtitle",children:(0,$e.Sm)(i.membersCount??0)})]}),!ae&&!h&&Boolean(o)&&(0,te.Y)("div",{className:"ListItem narrow",ref:re,children:(0,te.Y)(sn.A,{className:"align-checkbox-with-list-buttons",checked:!o.isPreHistoryHidden,label:oe("ChatHistory"),onChange:ye,subLabel:o.isPreHistoryHidden?oe("ChatHistoryHiddenInfo2"):oe("ChatHistoryVisibleInfo"),disabled:!m})})]}),(0,te.Y)("div",{className:"section",children:(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:x,children:oe("DeleteMega")})})]}),(0,te.Y)(wi.A,{isShown:U,onClick:fe,disabled:Pe,ariaLabel:oe("Save"),children:Pe?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(vi.A,{isOpen:L,onClose:E,textParts:(0,Dt.A)(d||!i.isCreator?oe("AreYouSureDeleteAndExit"):oe("AreYouSureDeleteThisChatWithGroup",i.title),["br","simple_markdown"]),confirmLabel:d||!i.isCreator?oe("DeleteMega"):oe("DeleteGroupForAll"),confirmHandler:Ie,confirmIsDestructive:!0})]})})),Tg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i,isPromotedByCurrentUser:s}=t;const n=(0,c.hds)(e,i),a=(0,c.AWZ)(e,i),{byId:o}=e.users,{currentUserId:r}=e,d=(0,l.WX)(n),h=!(n.isCreator||s);return{chat:n,usersById:o,currentUserId:r,isChannel:d,isForum:n.isForum,isFormFullyDisabled:h,defaultRights:n.adminRights,hasFullInfo:Boolean(a),adminMembersById:a?.adminMembersById}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i))})(e=>{let{isActive:t,isNewAdmin:i,selectedUserId:o,defaultRights:r,chat:c,usersById:d,currentUserId:h,adminMembersById:u,hasFullInfo:m,isChannel:p,isForum:v,isFormFullyDisabled:g,onClose:A,onScreenSelect:f}=e;const{updateChatAdmin:b}=(0,n.ko)(),[C,y]=(0,s.J0)({}),[S,k]=(0,s.J0)(Boolean(i)),[w,N]=(0,s.J0)(!1),[I,P,Y]=(0,F.A)(),[D,M]=(0,s.J0)(""),B=(0,T.A)();(0,Ce.A)({isActive:t,onBack:A});const R=(0,s.Kr)(()=>{const e=o?u?.[o]:void 0;if(!i||!e&&o){if(i){const e=(0,n.mS)().users.byId[o];return e?{userId:e.id,adminRights:r,customTitle:B("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return e}},[u,r,i,B,o]);(0,s.vJ)(()=>{m&&o&&!R&&f(a.je.ChatAdministrators)},[c,m,f,R,o]),(0,s.vJ)(()=>{y(R?.adminRights||{}),M((R?.customTitle||"").substr(0,16)),k(Boolean(i)),N(!1)},[r,i,R]);const L=(0,s.hb)(e=>{const{name:t}=e.target;y(e=>{return{...e,[t]:(i=e[t],!i||void 0)};var i}),k(!0)},[]),x=(0,s.hb)(()=>{o&&(N(!0),b({chatId:c.id,userId:o,adminRights:C,customTitle:D}))},[o,b,c.id,C,D]),E=(0,s.hb)(()=>{o&&(b({chatId:c.id,userId:o,adminRights:{}}),Y())},[c.id,Y,o,b]),V=(0,s.hb)(e=>!((0,l.yn)(c)||!g&&c.adminRights&&(c.isCreator||c.adminRights[e])),[c,g]),_=(0,s.Kr)(()=>{if(i||!R)return;if(R.isOwner)return B("ChannelCreator");const e=R.promotedByUserId?d[R.promotedByUserId]:void 0;return e?B("EditAdminPromotedBy",(0,l.Yg)(e)):B("ChannelAdmin")},[i,R,d,B]),U=(0,s.hb)(e=>{const{value:t}=e.target;M(t),k(!0)},[]);if(R)return(0,te.FD)("div",{className:"Management",children:[(0,te.Y)("div",{className:"panel-content custom-scroll",children:(0,te.FD)("div",{className:"section",children:[(0,te.Y)(ci.A,{inactive:!0,className:"chat-item-clickable",children:(0,te.Y)(ws.A,{userId:R.userId,status:_,forceShowSelf:!0})}),(0,te.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:B("EditAdminWhatCanDo")}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"changeInfo",checked:Boolean(C.changeInfo),label:B(p?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:V("changeInfo"),onChange:L})}),p&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"postMessages",checked:Boolean(C.postMessages),label:B("EditAdminPostMessages"),blocking:!0,disabled:V("postMessages"),onChange:L})}),p&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"editMessages",checked:Boolean(C.editMessages),label:B("EditAdminEditMessages"),blocking:!0,disabled:V("editMessages"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"deleteMessages",checked:Boolean(C.deleteMessages),label:B(p?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:V("deleteMessages"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"postStories",checked:Boolean(C.postStories),label:B("EditAdminPostStories"),blocking:!0,disabled:V("postStories"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"editStories",checked:Boolean(C.editStories),label:B("EditAdminEditStories"),blocking:!0,disabled:V("editStories"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"deleteStories",checked:Boolean(C.deleteStories),label:B("EditAdminDeleteStories"),blocking:!0,disabled:V("deleteStories"),onChange:L})}),!p&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"banUsers",checked:Boolean(C.banUsers),label:B("EditAdminBanUsers"),blocking:!0,disabled:V("banUsers"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"inviteUsers",checked:Boolean(C.inviteUsers),label:B("EditAdminAddUsers"),blocking:!0,disabled:V("inviteUsers"),onChange:L})}),!p&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"pinMessages",checked:Boolean(C.pinMessages),label:B("EditAdminPinMessages"),blocking:!0,disabled:V("pinMessages"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"addAdmins",checked:Boolean(C.addAdmins),label:B("EditAdminAddAdmins"),blocking:!0,disabled:V("addAdmins"),onChange:L})}),(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"manageCall",checked:Boolean(C.manageCall),label:B("StartVoipChatPermission"),blocking:!0,disabled:V("manageCall"),onChange:L})}),v&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"manageTopics",checked:Boolean(C.manageTopics),label:B("ManageTopicsPermission"),blocking:!0,disabled:V("manageTopics"),onChange:L})}),!p&&(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:"anonymous",checked:Boolean(C.anonymous),label:B("EditAdminSendAnonymously"),blocking:!0,disabled:V("anonymous"),onChange:L})}),g&&(0,te.Y)("p",{className:"section-info mb-4",dir:"auto",children:B("Channel.EditAdmin.CannotEdit")}),!p&&(0,te.Y)(Z.A,{id:"admin-title",label:B("EditAdminRank"),onChange:U,value:D,disabled:g,maxLength:16}),h!==o&&!g&&!i&&(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:P,children:B("EditAdminRemoveAdmin")})]})}),(0,te.Y)(wi.A,{isShown:S,onClick:x,ariaLabel:B("Save"),disabled:w,children:w?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),!i&&(0,te.Y)(vi.A,{isOpen:I,onClose:Y,text:"Are you sure you want to dismiss this admin?",confirmLabel:B("Channel.Admin.Dismiss"),confirmHandler:E,confirmIsDestructive:!0})]})}));var Bg=i(23459),Rg=i(285);const Lg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{statusesById:n}=e.users,{members:a,adminMembersById:o,areParticipantsHidden:r}=(0,c.AWZ)(e,i)||{},d=s&&(0,l.WX)(s),{userIds:h}=e.contactList||{},u=e.appConfig.hiddenMembersMinCount,m=s&&(s.isCreator||(0,l.ub)(s,"banUsers")),p=m&&!(0,l.yn)(s)&&void 0!==s.membersCount&&void 0!==u&&s.membersCount>=u,v=s&&((0,l.ub)(s,"inviteUsers")||!d&&!(0,l.Sq)(s,"inviteUsers")||s.isCreator),{query:g,fetchingStatus:A,globalUserIds:f,localUserIds:b}=(0,c.nTw)(e).userSearch;return{areParticipantsHidden:Boolean(s&&r),members:a,canAddMembers:v,adminMembersById:o,userStatusesById:n,isChannel:d,localContactIds:h,searchQuery:g,isSearching:A,globalUserIds:f,localUserIds:b,canDeleteMembers:m,currentUserId:e.currentUserId,canHideParticipants:p}})(e=>{let{chatId:t,noAdmins:i,members:o,canAddMembers:r,adminMembersById:c,userStatusesById:d,isChannel:h,isActive:u,globalUserIds:m,localContactIds:p,localUserIds:v,isSearching:g,searchQuery:A,currentUserId:f,canDeleteMembers:b,areParticipantsHidden:C,canHideParticipants:y,onClose:S,onScreenSelect:k,onChatMemberSelect:w}=e;const{openChat:N,setUserSearchQuery:I,closeManagement:P,toggleParticipantsHidden:Y,setNewChatMembersDialogState:F,toggleManagement:D}=(0,n.ko)(),B=(0,T.A)(),R=(0,s.li)(),L=(0,s.li)(),[x,E]=(0,s.J0)(),V=(0,s.Kr)(()=>i&&c?Object.keys(c):[],[c,i]),_=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;if(!o||!e)return[];const t=(0,l.UB)(o.map(e=>{let{userId:t}=e;return t}),e,d);return i?t.filter(e=>!V.includes(e)):t},[o,d,i,V]);(0,Bg.A)(_);const U=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=Boolean(A),s=t?p?(0,Ft.PU)({ids:p,query:A,type:"user"}):[]:_;return(0,Ms.A)((0,bi.Am)([...s,...t&&v||[],...t&&m||[]]).filter(t=>{const s=e[t];return!s||(h||s.canBeInvitedToGroup||!(0,l.tv)(s))&&(!i||!V.includes(t))}),!0)},[_,p,A,v,m,h,i,V]),[O,K]=(0,Bs.A)(void 0,U,Boolean(A)),J=(0,M.A)(e=>{i?(w(e,!0),k(a.je.ChatNewAdminRights)):(P(),N({id:e}))}),G=(0,M.A)(e=>{I({query:e.target.value})}),j=(0,Ls.A)(L,u,e=>{O&&O.length>0&&J(O[-1===e?0:e])},".ListItem-button",!0),z=(0,M.A)(()=>{E(void 0)}),H=(0,M.A)(()=>{Y({chatId:t,isEnabled:!C})}),$=(0,M.A)(()=>{D(),F({newChatMembersProgress:a.D7.InProgress})});return(0,Ce.A)({isActive:u,onBack:S}),(0,te.FD)("div",{className:"Management",children:[i&&(0,te.Y)("div",{className:"Management__filter",dir:B.isRtl?"rtl":void 0,children:(0,te.Y)(Z.A,{ref:R,value:A,onChange:G,placeholder:B("Search")})}),(0,te.FD)("div",{className:"panel-content custom-scroll",children:[y&&!h&&(0,te.FD)("div",{className:"section",children:[(0,te.FD)(ci.A,{icon:"group",ripple:!0,onClick:H,children:[(0,te.Y)("span",{children:B("ChannelHideMembers")}),(0,te.Y)(fi.A,{label:B("ChannelHideMembers"),checked:C})]}),(0,te.Y)("p",{className:"section-info",children:B(C?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff")})]}),(0,te.Y)("div",{className:"section",children:O?.length?(0,te.Y)(Cs.A,{className:"picker-list custom-scroll",items:U,onLoadMore:K,noScrollRestore:Boolean(A),ref:L,onKeyDown:j,children:O.map(e=>{return(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item",onClick:()=>J(e),contextActions:(t=e,t!==f&&b?[{title:B("lng_context_remove_from_group"),icon:"stop",handler:()=>{E(t)}}]:void 0),withPortalForMenu:!0,children:(0,te.Y)(ws.A,{userId:e,forceShowSelf:!0,withStory:!0})},e);var t})}):g||!O||O.length?(0,te.Y)(xs.A,{}):(0,te.Y)(kc.A,{teactOrderKey:0,text:h?"No subscribers found":"No members found"},"nothing-found")})]}),r&&(0,te.Y)(wi.A,{isShown:!0,onClick:$,ariaLabel:B("lng_channel_add_users"),children:(0,te.Y)(W.A,{name:"add-user-filled"})}),b&&(0,te.Y)(Rg.A,{isOpen:Boolean(x),userId:x,onClose:z})]})})),xg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),n=(0,c.AWZ)(e,i),{progress:a}=(0,c.nTw)(e).management,r=s?.paidMessagesStars,l=e.appConfig.starsPaidMessageCommissionPermille;return{chat:s,progress:a,currentUserId:e.currentUserId,removedUsersCount:n?.kickedMembers?.length||0,members:n?.members,arePaidMessagesAvailable:Boolean(n?.arePaidMessagesAvailable&&l),canChargeForMessages:Boolean(r&&l),groupPeersPaidStars:r||o.wZe}})(e=>{let{onScreenSelect:t,onChatMemberSelect:i,chat:o,progress:r,currentUserId:l,removedUsersCount:c,members:d,onClose:h,isActive:u,arePaidMessagesAvailable:m,canChargeForMessages:p,groupPeersPaidStars:v}=e;const{updateChatDefaultBannedRights:g,updatePaidMessagesPrice:A}=(0,n.ko)(),{permissions:f,havePermissionChanged:b,isLoading:C,handlePermissionChange:y,setIsLoading:S}=zl(o?.defaultBannedRights),k=(0,T.A)(),w=(0,_i.A)();(0,Ce.A)({isActive:u,onBack:h});const N=(0,s.hb)(()=>{t(a.je.GroupRemovedUsers)},[t]),I=(0,s.hb)(()=>{t(a.je.GroupUserPermissionsCreate)},[t]),P=(0,s.hb)(e=>{i(e.userId,e.promotedByUserId===l),t(a.je.GroupUserPermissions)},[l,i,t]),[Y,D]=(0,s.J0)(!1),[B,R,L]=(0,F.A)(),[x,E]=(0,s.J0)(p),[V,_]=(0,s.J0)(v);(0,s.vJ)(()=>{r===a.TD.Complete&&L()},[r]);const U=(0,M.A)(()=>{o&&(S(!0),g({chatId:o.id,bannedRights:f}))}),O=(0,M.A)(()=>{o&&A({chatId:o?.id,paidMessagesStars:x?V:0})}),K=(0,M.A)(()=>{B&&O(),b&&U()}),J=(0,s.Kr)(()=>d?d.filter(e=>{let{bannedRights:t}=e;return Boolean(t)}):[],[d]),G=(0,s.hb)(e=>{const{bannedRights:t}=e;if(!t||!o)return;const{defaultBannedRights:i}=o;return Object.keys(t).reduce((e,s)=>{const n=s;if(!t[n]||i?.[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)return e;const a=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";case"manageTopics":return"GroupPermission.NoManageTopics";case"sendPlain":return"UserRestrictionsNoSendText";case"sendDocs":return"UserRestrictionsNoSendDocs";case"sendRoundvideos":return"UserRestrictionsNoSendRound";case"sendVoices":return"UserRestrictionsNoSendVoice";case"sendAudios":return"UserRestrictionsNoSendMusic";case"sendVideos":return"UserRestrictionsNoSendVideos";case"sendPhotos":return"UserRestrictionsNoSendPhotos";default:return}}(n);if(!a)return e;const o=k(a);return`${e}${e.length?`, ${o}`:o}`},"")},[o,k]),j=(0,M.A)(()=>{E(!x),R()}),z=(0,M.A)(e=>{_(e),R()}),H=B||b,$=r===a.TD.InProgress||C;return(0,te.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 432px;--before-shift-height: 96px;",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section without-bottom-shadow",children:[(0,te.Y)("h3",{className:"section-heading",dir:"auto",children:w("ChannelPermissionsHeader")}),(0,te.Y)($l,{chatId:o?.id,isMediaDropdownOpen:Y,setIsMediaDropdownOpen:D,handlePermissionChange:y,permissions:f,dropdownClassName:"DropdownListTrap",className:(0,me.A)("DropdownList",Y&&"DropdownList--open"),shiftedClassName:(0,me.A)("part",Y&&"shifted")})]}),m&&(0,te.FD)("div",{className:(0,me.A)("section",Y&&"shifted"),children:[(0,te.FD)(ci.A,{onClick:j,children:[(0,te.Y)("span",{children:w("GroupMessagesChargePrice")}),(0,te.Y)(fi.A,{id:"charge_for_messages",label:w("GroupMessagesChargePrice"),checked:x})]}),(0,te.Y)("p",{className:"settings-item-description-larger",dir:w.isRtl?"rtl":void 0,children:w("RightsChargeStarsAbout")})]}),x&&(0,te.Y)("div",{className:(0,me.A)("section",Y&&"shifted"),children:(0,te.Y)(zd,{canChangeChargeForMessages:!0,isGroupChat:!0,chargeForMessages:V,onChange:z})}),(0,te.Y)("div",{className:(0,me.A)("section",Y&&"shifted"),children:(0,te.FD)(ci.A,{icon:"delete-user",multiline:!0,narrow:!0,onClick:N,children:[(0,te.Y)("span",{className:"title",children:w("ChannelBlockedUsers")}),(0,te.Y)("span",{className:"subtitle",children:c})]})}),(0,te.FD)("div",{className:(0,me.A)("section",Y&&"shifted"),children:[(0,te.Y)("h3",{className:"section-heading",dir:"auto",children:w("PrivacyExceptions")}),(0,te.Y)(ci.A,{icon:"add-user",onClick:I,children:w("ChannelAddException")}),J.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable exceptions-member",onClick:()=>P(e),children:(0,te.Y)(ws.A,{userId:e.userId,status:G(e),forceShowSelf:!0})},e.userId))]})]}),(0,te.Y)(wi.A,{isShown:H,onClick:K,ariaLabel:w("Save"),disabled:$,children:$?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})})),Eg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i,isPromotedByCurrentUser:s}=t;const n=(0,c.hds)(e,i),a=(0,c.AWZ)(e,i);return{chat:n,isFormFullyDisabled:!(n.isCreator||s),hasFullInfo:Boolean(a),members:a?.members}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i))})(e=>{let{chat:t,selectedChatMemberId:i,hasFullInfo:o,members:r,onScreenSelect:l,isFormFullyDisabled:c,onClose:d,isActive:h}=e;const{updateChatMemberBannedRights:u}=(0,n.ko)(),m=(0,s.Kr)(()=>{if(r)return r.find(e=>{let{userId:t}=e;return t===i})},[r,i]),{permissions:p,havePermissionChanged:v,isLoading:g,handlePermissionChange:A,setIsLoading:f}=zl(m?.bannedRights||t?.defaultBannedRights),[b,C,y]=(0,F.A)(),S=(0,_i.A)(),k=(0,T.A)();(0,Ce.A)({isActive:h,onBack:d}),(0,s.vJ)(()=>{o&&i&&!m&&l(a.je.GroupPermissions)},[t,o,l,m,i]);const w=(0,s.hb)(()=>{t&&i&&(f(!0),u({chatId:t.id,userId:i,bannedRights:p}))},[t,i,f,u,p]),N=(0,s.hb)(()=>{t&&i&&u({chatId:t.id,userId:i,bannedRights:{viewMessages:!0}})},[t,i,u]),I=(0,s.hb)(e=>!!c||!(!t||!t.defaultBannedRights)&&t.defaultBannedRights[e],[t,c]),[P,Y]=(0,s.J0)(!1);if(m)return(0,te.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 431px;--before-shift-height: 192px;",children:[(0,te.FD)("div",{className:"custom-scroll",children:[(0,te.FD)("div",{className:"section without-bottom-shadow",children:[(0,te.Y)(ci.A,{inactive:!0,className:"chat-item-clickable",children:(0,te.Y)(ws.A,{userId:m.userId,forceShowSelf:!0})}),(0,te.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:k("UserRestrictionsCanDo")}),(0,te.Y)($l,{chatId:t?.id,isMediaDropdownOpen:P,setIsMediaDropdownOpen:Y,handlePermissionChange:A,permissions:p,className:(0,me.A)("DropdownList",P&&"DropdownList--open"),dropdownClassName:"DropdownListTrap",shiftedClassName:(0,me.A)("part",P&&"shifted"),getControlIsDisabled:I})]}),!c&&(0,te.Y)("div",{className:(0,me.A)("section",P&&"shifted"),children:(0,te.Y)(ci.A,{icon:"delete-user",ripple:!0,destructive:!0,onClick:C,children:k("UserRestrictionsBlock")})})]}),(0,te.Y)(wi.A,{isShown:v,onClick:w,ariaLabel:k("Save"),disabled:g,children:g?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(vi.A,{isOpen:b,onClose:y,text:S("GroupManagementBanUserConfirm"),confirmLabel:"Remove",confirmHandler:N,confirmIsDestructive:!0})]})})),Vg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{byId:n,statusesById:a}=e.users,o=(0,c.AWZ)(e,i)?.members;return{members:o,usersById:n,userStatusesById:a,isChannel:s&&(0,l.WX)(s)}})(e=>{let{usersById:t,userStatusesById:i,members:n,isChannel:o,onScreenSelect:r,onChatMemberSelect:c,onClose:d,isActive:h}=e;(0,Ce.A)({isActive:h,onBack:d});const u=(0,s.Kr)(()=>{if(n&&t)return(0,l.UB)(n.filter(e=>!e.isOwner).map(e=>{let{userId:t}=e;return t}),t,i)},[n,t,i]),m=(0,s.hb)(e=>{c(e),r(a.je.GroupUserPermissions)},[c,r]);return(0,te.Y)("div",{className:"Management",children:(0,te.Y)("div",{className:"custom-scroll",children:(0,te.Y)("div",{className:"section",teactFastList:!0,children:u?u.map((e,t)=>(0,te.Y)(ci.A,{teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e),children:(0,te.Y)(ws.A,{userId:e,forceShowSelf:!0})},e)):(0,te.Y)(kc.A,{teactOrderKey:0,text:o?"No subscribers found":"No members found"},"nothing-found")})})})})),_g=[1,10,100],Ug={hour:36e5,day:864e5,week:6048e5},Og=Ug.hour,Kg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{editingInvite:s}=(0,c.nTw)(e).management.byChatId[i]||{};return{editingInvite:s}})(e=>{let{chatId:t,editingInvite:i,isActive:o,onClose:r,onScreenSelect:l}=e;const{editExportedChatInvite:c,exportChatInvite:d}=(0,n.ko)(),h=(0,T.A)(),[u,m,p]=(0,F.A)(),[v,g]=(0,s.J0)(!1),[A,f]=(0,s.J0)(""),[b,C]=(0,s.J0)(Date.now()+Og),[y,S]=(0,s.J0)("unlimited"),[k,w]=(0,s.J0)(10),[N,I]=(0,s.J0)("0"),[P,Y]=(0,s.J0)(!1);(0,Ce.A)({isActive:o,onBack:r}),(0,j.A)(e=>{let[t]=e;if(t!==i)if(i){const{title:e,usageLimit:t,expireDate:s,isRequestNeeded:n}=i;if(e&&f(e),t&&(I(_g.includes(t)?t.toString():"custom"),w(t)),s){const e=(0,li.Fm)()+Og;S("custom"),C(1e3*Math.max(s,e))}n&&g(!0)}else f(""),S("unlimited"),I("0"),C(1e3*(0,li.Fm)()+Og),w(10),g(!1)},[i]);const D=(0,s.hb)(e=>{g(e.target.checked)},[]),M=(0,s.hb)(e=>{f(e.target.value)},[]),B=(0,s.hb)(e=>{w(Number.parseInt(e.target.value,10))},[]),R=(0,s.hb)(e=>{C(e.getTime()),p()},[p]),L=(0,s.hb)(()=>{Y(!0);const e="custom"===N?k:Number(N);let s;switch(y){case"custom":s=(0,li.Fm)()+(b-Date.now())/1e3;break;case"hour":case"day":case"week":s=(0,li.Fm)()+Ug[y]/1e3;break;case"unlimited":s=0;break;default:s=void 0}i?c({link:i.link,chatId:t,title:A,isRequestNeeded:v,expireDate:s,usageLimit:e}):d({chatId:t,title:A,isRequestNeeded:v,expireDate:s,usageLimit:e}),l(a.je.Invites)},[t,b,k,c,i,d,v,y,N,A,l]);return(0,te.FD)("div",{className:"Management ManageInvite",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.Y)("div",{className:"section",children:(0,te.Y)(sn.A,{label:h("ApproveNewMembers"),subLabel:h("ApproveNewMembersDescription"),checked:v,onChange:D})}),(0,te.FD)("div",{className:"section",children:[(0,te.Y)(Z.A,{className:"link-name",placeholder:h("LinkNameHint"),value:A,onChange:M}),(0,te.Y)("p",{className:"section-help hint",children:h("LinkNameHelp")})]}),(0,te.FD)("div",{className:"section",children:[(0,te.Y)("div",{className:"section-heading",children:h("LimitByPeriod")}),(0,te.Y)(ee.A,{name:"expireOptions",options:[{value:"hour",label:h("Hours",1)},{value:"day",label:h("Days",1)},{value:"week",label:h("Weeks",1)},{value:"unlimited",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_expire_custom")}],onChange:S,selected:y}),"custom"===y&&(0,te.FD)(Q.A,{className:"expire-limit",isText:!0,onClick:m,children:[(0,He.Lu)(h,b)," ",(0,He.fU)(h,b)]}),(0,te.Y)("p",{className:"section-help hint",children:h("TimeLimitHelp")})]}),!v&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)("div",{className:"section-heading",children:h("LimitNumberOfUses")}),(0,te.Y)(ee.A,{name:"usageOptions",options:[..._g.map(e=>({value:e.toString(),label:e})),{value:"0",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_usage_custom")}],onChange:I,selected:N}),"custom"===N&&(0,te.Y)("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:k,onChange:B}),(0,te.Y)("p",{className:"section-help hint",children:h("UsesLimitHelp")})]}),(0,te.Y)(wi.A,{isShown:!0,onClick:L,disabled:P,ariaLabel:h(i?"SaveLink":"CreateLink"),children:(0,te.Y)(W.A,{name:"check"})})]}),(0,te.Y)(dn,{isOpen:u,isFutureMode:!0,withTimePicker:!0,onClose:p,onSubmit:R,selectedAt:b,submitButtonLabel:h("Save")})]})})),Jg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{inviteInfo:s}=(0,c.nTw)(e).management.byChatId[i]||{},{invite:n,importers:a,requesters:o}=s||{},r=(0,c.hds)(e,i);return{invite:n,importers:a,requesters:o,isChannel:r&&(0,l.WX)(r)}})(e=>{let{chatId:t,invite:i,importers:a,requesters:o,isChannel:r,isActive:l,onClose:c}=e;const{loadChatInviteImporters:d,loadChatInviteRequesters:h,openChat:u}=(0,n.ko)(),m=(0,T.A)(),{usage:p=0,usageLimit:v,link:g,adminId:A}=i||{},f=i?.expireDate&&1e3*(i.expireDate-(0,li.Fm)())+Date.now(),b=(i?.expireDate||0)-(0,li.Fm)()<0;return(0,s.vJ)(()=>{g&&(d({chatId:t,link:g}),h({chatId:t,link:g}))},[t,g,d,h]),(0,Ce.A)({isActive:l,onBack:c}),(0,te.Y)("div",{className:"Management ManageInviteInfo",children:(0,te.FD)("div",{className:"panel-content custom-scroll",children:[!i&&(0,te.Y)("p",{className:"section-help",children:m("Loading")}),i&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(Wr.A,{title:i.title,link:i.link,className:"invite-link"}),Boolean(f)&&(0,te.Y)("p",{className:"section-help",children:b?m("ExpiredLink"):m("LinkExpiresIn",`${(0,He.Lu)(m,f)} ${(0,He.fU)(m,f)}`)})]}),A&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)("p",{className:"section-heading",children:m("LinkCreatedeBy")}),(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:A}),children:(0,te.Y)(ws.A,{userId:A,status:(0,He.fS)(m,1e3*i.date,!0),forceShowSelf:!0})})]}),(()=>{if(a?.length||!o?.length)return a?(0,te.FD)("div",{className:"section",children:[(0,te.Y)("p",{className:"section-heading",children:a.length?m("PeopleJoined",p):m("NoOneJoined")}),(0,te.FD)("p",{className:"section-help",children:[!a.length&&(v?m("PeopleCanJoinViaLinkCount",v-p):m("NoOneJoinedYet")),a.map(e=>{const t=(0,He.fS)(m,1e3*e.date,!0),i=e.isFromChatList?`${t}${m("JoinedViaFolder")}`:t;return(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:e.userId}),children:(0,te.Y)(ws.A,{userId:e.userId,status:i,forceShowSelf:!0})})})]})]}):(0,te.Y)(Ee.A,{})})(),(()=>{if(!i?.isRevoked){if(!o&&a)return(0,te.Y)(Ee.A,{});if(o?.length)return(0,te.FD)("div",{className:"section",children:[(0,te.Y)("p",{className:"section-heading",children:m(r?"SubscribeRequests":"MemberRequests")}),(0,te.Y)("p",{className:"section-help",children:o.map(e=>(0,te.Y)(ci.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:e.userId}),children:(0,te.Y)(ws.A,{userId:e.userId,status:(0,He.fS)(m,1e3*e.date,!0),forceShowSelf:!0})}))})]})}})()]})]})})})),Gg="•";function jg(e,t){const{isPermanent:i,usage:s=0,date:n}=e,{isPermanent:a,usage:o=0,date:r}=t;return i||a?Number(i)-Number(a):s||o?o-s:r-n}const zg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{invites:s,revokedInvites:n}=(0,c.nTw)(e).management.byChatId[i]||{},a=(0,c.hds)(e,i);return{exportedInvites:s,revokedExportedInvites:n,chat:a,isChannel:a&&(0,l.WX)(a)}})(e=>{let{chatId:t,chat:i,exportedInvites:r,revokedExportedInvites:c,isActive:d,isChannel:h,onClose:u,onScreenSelect:m}=e;const{setEditingExportedInvite:p,showNotification:v,editExportedChatInvite:g,deleteExportedChatInvite:A,deleteRevokedExportedChatInvites:f,setOpenedInviteInfo:b}=(0,n.ko)(),C=(0,_i.A)(),y=(0,T.A)(),[S,k,w]=(0,F.A)(),[N,I,P]=(0,F.A)(),[Y,M]=(0,s.J0)(),[B,R,L]=(0,F.A)(),[x,E]=(0,s.J0)();(0,Ce.A)({isActive:d,onBack:u});const V=(0,s.Kr)(()=>{if(r)return r.some(e=>{let{expireDate:t}=e;return t&&t-(0,li.Fm)()<He.il/1e3})},[r]),_=(0,D.A)();(0,fn.A)(_,V?1e3:void 0);const U=(0,s.Kr)(()=>i&&(0,l.Kl)(i),[i]),O=r?.find(e=>{let{isPermanent:t}=e;return t}),K=U?`${o.jsp}${U}`:O?.link,J=(0,s.Kr)(()=>{const e=i?.hasUsername?r:r?.filter(e=>{let{isPermanent:t}=e;return!t});return e?.sort(jg)},[i?.hasUsername,r]),G=(0,s.hb)(e=>{const{link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o}=e;g({chatId:t,link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o,isRevoked:!0})},[t,g]),j=(0,s.hb)(e=>{M(e),I()},[I]),z=(0,s.hb)(()=>{Y&&(G(Y),M(void 0),P())},[P,G,Y]),H=(0,s.hb)(()=>{m(a.je.EditInvite)},[m]),$=(0,s.hb)(()=>{O&&j(O)},[j,O]),q=(0,s.hb)(()=>{f({chatId:t}),w()},[t,w,f]),Q=(0,s.hb)(e=>{b({chatId:t,invite:e}),m(a.je.InviteInfo)},[t,m,b]),Z=(0,s.hb)(e=>{A({chatId:t,link:e.link})},[t,A]),X=(0,s.hb)(e=>{E(e),R()},[R]),ee=(0,s.hb)(()=>{x&&(Z(x),E(void 0),L())},[L,Z,x]),ie=(0,s.hb)(e=>{(0,mc.eM)(e),v({message:y("LinkCopied")})},[y,v]),se=e=>{const{usage:t=0,usageLimit:i,expireDate:s,isPermanent:n,requested:a,isRevoked:o}=e;let r="";if(r=!o&&i&&t<i?y("CanJoin",i-t):t?y("PeopleJoined",t):y("NoOneJoined"),o)return r+=` ${Gg} ${y("Revoked")}`,r;if(a&&(r+=` ${Gg} ${y("JoinRequests",a)}`),void 0!==i&&t===i)r+=` ${Gg} ${y("LinkLimitReached")}`;else if(s){const e=s-(0,li.Fm)();r+=` ${Gg} `,r+=e>0?y("InviteLink.ExpiresIn",(0,He.zt)(C,e)):y("InviteLink.Expired")}else n&&(r+=` ${Gg} ${y("Permanent")}`);return r},ne=e=>{const{usage:t=0,usageLimit:i,isRevoked:s,expireDate:n}=e;return s?"link-status-icon-gray":i&&t<i?"link-status-icon-green":n&&1e3*(n-(0,li.Fm)())<=0?"link-status-icon-red":"link-status-icon-blue"},ae=e=>{const i=[];return i.push({title:y("Copy"),icon:"copy",handler:()=>ie(e.link)}),e.isPermanent||e.isRevoked||i.push({title:y("Edit"),icon:"edit",handler:()=>(e=>{p({chatId:t,invite:e}),m(a.je.EditInvite)})(e)}),e.isRevoked?i.push({title:y("DeleteLink"),icon:"delete",handler:()=>X(e),destructive:!0}):i.push({title:y("RevokeButton"),icon:"delete",handler:()=>j(e),destructive:!0}),i};return(0,te.FD)("div",{className:"Management ManageInvites",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.Invite,size:o.xMZ,className:"section-icon"}),(0,te.Y)("p",{className:"section-help",children:y(h?"PrimaryLinkHelpChannel":"PrimaryLinkHelp")})]}),K&&(0,te.Y)("div",{className:"section",children:(0,te.Y)(Wr.A,{className:"settings-input",link:K,withShare:!0,onRevoke:i?.usernames?void 0:$,title:y(i?.usernames?"PublicLink":"lng_create_permanent_link_title")})}),(0,te.FD)("div",{className:"section",teactFastList:!0,children:[(0,te.Y)(ci.A,{icon:"add",withPrimaryColor:!0,className:"create-item",onClick:H,children:y("CreateNewLink")},"create"),(!J||!J.length)&&(0,te.Y)(kc.A,{text:"No links found"},"nothing"),J?.map(e=>(0,te.FD)(ci.A,{leftElement:(0,te.Y)(W.A,{name:"link",className:`link-status-icon ${ne(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:ae(e),children:[(0,te.Y)("span",{className:"title invite-title",children:e.title||e.link}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:se(e)})]},e.link)),(0,te.Y)("p",{className:"section-help hint",children:y("ManageLinksInfoHelp")},"links-hint")]}),c&&Boolean(c.length)&&(0,te.FD)("div",{className:"section",teactFastList:!0,children:[(0,te.Y)("p",{className:"section-help",children:y("RevokedLinks")},"title"),(0,te.Y)(ci.A,{icon:"delete",destructive:!0,onClick:k,children:(0,te.Y)("span",{className:"title",children:y("DeleteAllRevokedLinks")})},"delete"),c?.map(e=>(0,te.FD)(ci.A,{leftElement:(0,te.Y)(W.A,{name:"link",className:`link-status-icon ${ne(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:ae(e),children:[(0,te.Y)("span",{className:"title",children:e.title||e.link}),(0,te.Y)("span",{className:"subtitle",dir:"auto",children:se(e)})]},e.link))]})]}),(0,te.Y)(vi.A,{isOpen:S,onClose:w,title:y("DeleteAllRevokedLinks"),text:y("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:y("DeleteAll"),confirmHandler:q}),(0,te.Y)(vi.A,{isOpen:N,onClose:P,title:y("RevokeLink"),text:y("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:y("RevokeButton"),confirmHandler:z}),(0,te.Y)(vi.A,{isOpen:B,onClose:L,title:y("DeleteLink"),text:y("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:y("Delete"),confirmHandler:ee})]})})),Hg=(0,s.ph)((0,n.EK)((e,t)=>{let{userId:i}=t;return{user:(0,c.mBe)(e,i)}})(e=>{let{userId:t,chatId:i,about:a,date:o,isChannel:r,user:c}=e;const{openChat:d,hideChatJoinRequest:h}=(0,n.ko)(),u=(0,me.x)("JoinRequest"),m=(0,T.A)(),p=(0,l.Yg)(c),v=1e3*(o-(0,li.Fm)())+Date.now(),g=(0,He.cK)(new Date(v))?(0,He.fU)(m,v):(0,He.F5)(m,v,!0,!1,!0),A=(0,s.hb)(()=>{h({chatId:i,userId:t,isApproved:!0})},[i,h,t]),f=(0,s.hb)(()=>{h({chatId:i,userId:t,isApproved:!1})},[i,h,t]);return(0,te.FD)("div",{className:u("&"),children:[(0,te.FD)("div",{className:u("top"),children:[(0,te.FD)("div",{className:u("user"),onClick:()=>{d({id:t})},children:[(0,te.Y)(Mt.A,{size:"medium",peer:c},t),(0,te.FD)("div",{className:u("user-info"),children:[(0,te.Y)("div",{className:u("user-name"),children:p}),(0,te.Y)("div",{className:u("user-subtitle"),children:a})]})]}),(0,te.Y)("div",{className:u("date"),children:g})]}),(0,te.FD)("div",{className:u("buttons"),children:[(0,te.Y)(Q.A,{className:u("button"),onClick:A,children:m(r?"ChannelAddToChannel":"ChannelAddToGroup")}),(0,te.Y)(Q.A,{className:u("button"),isText:!0,onClick:f,children:m("DismissRequest")})]})]})})),$g=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i);return{chat:s,isChannel:s&&(0,l.WX)(s)}})(e=>{let{chat:t,chatId:i,isActive:a,isChannel:r,onClose:l}=e;const{hideAllChatJoinRequests:c,loadChatJoinRequests:d}=(0,n.ko)(),[h,u,m]=(0,F.A)(),[p,g,A]=(0,F.A)(),f=(0,T.A)();(0,Ce.A)({isActive:a,onBack:l}),(0,s.vJ)(()=>{t?.joinRequests||(0,v.L8)(i)||d({chatId:i})},[t,i,d]);const b=(0,s.hb)(()=>{c({chatId:i,isApproved:!0}),m()},[c,i,m]),C=(0,s.hb)(()=>{c({chatId:i,isApproved:!1}),A()},[c,i,A]);return(0,te.FD)("div",{className:"Management ManageJoinRequests",children:[(0,te.FD)("div",{className:"custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(wr.A,{tgsUrl:kr.w.JoinRequest,size:o.OMf,className:"section-icon"}),Boolean(t?.joinRequests?.length)&&(0,te.FD)("div",{className:"bulk-actions",children:[(0,te.Y)(Q.A,{className:"bulk-action-button",onClick:u,children:"Accept all"}),(0,te.Y)(Q.A,{className:"bulk-action-button",onClick:g,isText:!0,children:"Dismiss all"})]})]}),(0,te.FD)("div",{className:"section",teactFastList:!0,children:[(0,te.Y)("p",{children:t?.joinRequests?t.joinRequests.length?f("JoinRequests",t.joinRequests.length):f("NoMemberRequests"):f("Loading")},"title"),!t?.joinRequests&&(0,te.Y)(Ee.A,{},"loading"),0===t?.joinRequests?.length&&(0,te.Y)("p",{className:"section-help",children:f(r?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")},"empty"),t?.joinRequests?.map(e=>{let{userId:t,about:s,date:n}=e;return(0,te.Y)(Hg,{userId:t,about:s,date:n,isChannel:r,chatId:i},t)})]})]}),(0,te.Y)(vi.A,{isOpen:h,onClose:m,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:b}),(0,te.Y)(vi.A,{isOpen:p,onClose:A,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:C})]})})),qg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const s=(0,c.hds)(e,i),{maxUniqueReactions:n}=e.appConfig,a=(0,c.AWZ)(e,i),o=a?.reactionsLimit||n,r=(0,l.WX)(s);return{enabledReactions:a?.enabledReactions,availableReactions:e.reactions.availableReactions,chat:s,maxUniqueReactions:n,reactionsLimit:o,isChannel:r}},(e,t)=>{let{chatId:i}=t;return Boolean((0,c.hds)(e,i))})(e=>{let{availableReactions:t,enabledReactions:i,chat:a,isActive:o,onClose:r,maxUniqueReactions:c,reactionsLimit:d,isChannel:h}=e;const{setChatEnabledReactions:u}=(0,n.ko)(),m=(0,T.A)(),[p,v]=(0,s.J0)(!1),[g,A]=(0,s.J0)(!1),[f,b]=(0,s.J0)(i),[C,y]=(0,s.J0)(d);(0,Ce.A)({isActive:o,onBack:r});const S=(0,s.Kr)(()=>[{value:"all",label:m("AllReactions")},{value:"some",label:m("SomeReactions")},{value:"none",label:m("NoReactions")}],[m]),k=(0,s.hb)(()=>{a&&(A(!0),u({chatId:a.id,enabledReactions:f,reactionsLimit:C}))},[a,f,u,C]);(0,s.vJ)(()=>{A(!1),v(!1),b(i),y(d)},[i,d]);const w=(0,s.Kr)(()=>t?.filter(e=>{let{isInactive:t}=e;return!t}),[t]);(0,s.vJ)(()=>{if(void 0===C||C===d){if("some"===f?.type&&"all"!==i?.type&&"some"!==i?.type&&0===f.allowed.length)return void v(!1);if(f?.type===i?.type){if("some"===f?.type&&"some"===i?.type){const e=f.allowed,t=i?.allowed;if(e.length!==t.length||e.reverse().some(e=>!t.find(t=>(0,l.a0)(e,t))))return void v(!0)}v(!1)}else v(!0)}else v(!0)},[C,d,f,i]);const N=(0,s.hb)(e=>{"all"===e?(b({type:"all"}),y(d)):"some"===e?(b({type:"some",allowed:"some"===i?.type?i.allowed:[]}),y(d)):(b(void 0),y(void 0))},[i,d]),I=(0,s.hb)(e=>{if(!a||!w)return;const{name:t,checked:i}=e.currentTarget;if("some"===f?.type){const e={emoticon:t};b(i?{type:"some",allowed:[...f.allowed,e]}:{type:"some",allowed:f.allowed.filter(t=>!(0,l.a0)(t,e))})}},[w,a,f]),P=(0,s.hb)(e=>{y(e)},[]),Y=(0,s.hb)(e=>m("PeerInfo.AllowedReactions.MaxCountValue",e),[m]),F=h&&("all"===f?.type||"some"===f?.type);return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"panel-content custom-scroll",children:[Boolean(C&&F)&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)("h3",{className:"section-heading",children:m("MaximumReactionsHeader")}),(0,te.Y)(We.A,{min:1,max:c,value:C,onChange:P,renderValue:Y,isCenteredLayout:!0}),(0,te.Y)("p",{className:"section-info section-info_push",children:m("ChannelReactions.MaxCount.Info")})]}),(0,te.FD)("div",{className:"section",children:[(0,te.Y)("h3",{className:"section-heading",children:m("AvailableReactions")}),(0,te.Y)(ee.A,{selected:f?.type||"none",name:"reactions",options:S,onChange:N}),(0,te.FD)("p",{className:"section-info section-info_push",children:["all"===f?.type&&m("EnableAllReactionsInfo"),"some"===f?.type&&m("EnableSomeReactionsInfo"),!f&&m("DisableReactionsInfo")]})]}),"some"===f?.type&&(0,te.FD)("div",{className:"section section-with-fab",children:[(0,te.Y)("h3",{className:"section-heading",children:m("OnlyAllowThisReactions")}),w?.map(e=>{let{reaction:i,title:s}=e;return(0,te.Y)("div",{className:"ListItem",children:(0,te.Y)(sn.A,{name:i.emoticon,checked:f?.allowed.some(e=>(0,l.a0)(i,e)),label:(0,te.FD)("div",{className:"Reaction",children:[(0,te.Y)(Ns.A,{reaction:i,availableReactions:t}),s]}),withIcon:!0,onChange:I})})})]})]}),(0,te.Y)(wi.A,{isShown:p,onClick:k,ariaLabel:m("Save"),disabled:g,children:g?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})})]})})),Wg="Please provide first name",Qg=(0,s.ph)((0,n.EK)((e,t)=>{let{userId:i}=t;const s=(0,c.mBe)(e,i),n=(0,c.hds)(e,i),a=(0,c.vGo)(e,i),{progress:o}=(0,c.nTw)(e).management,r=n&&(0,Ic.If)(n,(0,c.K52)(e),(0,c.P5N)(e,n.id)),l=a?.personalPhoto;return{user:s,progress:o,isMuted:r,personalPhoto:l,notPersonalPhoto:a?.profilePhoto||a?.fallbackPhoto}})(e=>{let{userId:t,user:i,progress:r,isMuted:c,onClose:d,isActive:h,personalPhoto:u,notPersonalPhoto:m}=e;const{updateContact:p,deleteContact:v,closeManagement:g,uploadContactProfilePhoto:A,updateChatMutedState:f}=(0,n.ko)(),[b,C,y]=(0,F.A)(),[S,k,w]=(0,F.A)(),[N,I,P]=(0,F.A)(),[Y,D]=(0,s.J0)(),[M,B,R]=(0,F.A)(),L=(0,T.A)();(0,Ce.A)({isActive:h,onBack:d});const x=i&&i.firstName||"",E=i&&i.lastName||"",[V,_]=(0,s.J0)(x),[U,O]=(0,s.J0)(E),[K,J]=(0,s.J0)(!c);(0,s.vJ)(()=>{J(!c)},[c]),(0,s.vJ)(()=>{P(),R(),y()},[y,t]),(0,s.vJ)(()=>{_(x),O(E)},[x,E,i]),(0,s.vJ)(()=>{r===a.TD.Complete&&(P(),D(void 0),y())},[y,r]);const G=(0,s.hb)(e=>{_(e.target.value),I(),Y===Wg&&D(void 0)},[Y]),j=(0,s.hb)(e=>{O(e.target.value),I()},[]),z=(0,s.hb)(e=>{J(e.target.checked),B(),I()},[]),H=(0,s.hb)(()=>{const e=V.trim(),i=U.trim();e.length?(p({userId:t,firstName:e,lastName:i}),M&&f({chatId:t,mutedUntil:K?o.Os5:o.xEh})):D(Wg)},[V,K,M,U,t]),$=(0,s.hb)(()=>{v({userId:t}),y(),g()},[y,g,v,t]),q=(0,s.li)(),Q=(0,s.li)(!1),X=(0,s.hb)(()=>{q.current?.click(),Q.current=!0},[]),ee=(0,s.hb)(()=>{q.current?.click(),Q.current=!1},[]),ie=(0,s.hb)(()=>{w(),I(),A({userId:t})},[w,A,t]),se=(0,s.hb)(e=>{I(),A({userId:t,file:e,isSuggest:Q.current})},[A,t]);if(!i)return;const ne=!(0,l.tv)(i)&&i.id!==o.zv8,ae=r===a.TD.InProgress;return(0,te.FD)("div",{className:"Management",children:[(0,te.FD)("div",{className:"custom-scroll",children:[(0,te.FD)("div",{className:"section",children:[(0,te.Y)(ws.A,{userId:i.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),(0,te.FD)("div",{className:"settings-edit",children:[(0,te.Y)(Z.A,{id:"user-first-name",label:L("UserInfo.FirstNamePlaceholder"),onChange:G,value:V,error:Y===Wg?Y:void 0}),(0,te.Y)(Z.A,{id:"user-last-name",label:L("UserInfo.LastNamePlaceholder"),onChange:j,value:U})]}),(0,te.Y)("div",{className:"ListItem narrow",children:(0,te.Y)(sn.A,{checked:K,label:L("Notifications"),subLabel:L(K?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:z})})]}),ne&&(0,te.FD)("div",{className:"section",children:[(0,te.Y)(ci.A,{icon:"camera-add",ripple:!0,onClick:X,children:(0,te.Y)("span",{className:"list-item-ellipsis",children:L("UserInfo.SuggestPhoto",i.firstName)})}),(0,te.Y)(ci.A,{icon:"camera-add",ripple:!0,onClick:ee,children:(0,te.Y)("span",{className:"list-item-ellipsis",children:L("UserInfo.SetCustomPhoto",i.firstName)})}),u&&(0,te.Y)(ci.A,{leftElement:(0,te.Y)(Mt.A,{photo:m,noPersonalPhoto:!0,peer:i,size:"mini",className:"personal-photo"}),ripple:!0,onClick:k,children:L("UserInfo.ResetCustomPhoto")}),(0,te.Y)("p",{className:"section-help",dir:"auto",children:L("UserInfo.CustomPhotoInfo",i.firstName)})]}),(0,te.Y)("div",{className:"section",children:(0,te.Y)(ci.A,{icon:"delete",ripple:!0,destructive:!0,onClick:C,children:L("DeleteContact")})})]}),(0,te.Y)(wi.A,{isShown:N,onClick:H,disabled:ae,ariaLabel:L("Save"),children:ae?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"check"})}),(0,te.Y)(vi.A,{isOpen:b,onClose:y,text:L("AreYouSureDeleteContact"),confirmLabel:L("DeleteContact"),confirmHandler:$,confirmIsDestructive:!0}),(0,te.Y)(vi.A,{isOpen:S,onClose:w,text:L("UserInfo.ResetToOriginalAlertText",i.firstName),confirmLabel:L("Reset"),confirmHandler:ie,confirmIsDestructive:!0}),(0,te.Y)(lu.A,{onChange:se,inputRef:q})]})})),Zg=(0,s.ph)((0,n.EK)((e,t)=>{let{chatId:i}=t;const{progress:s,error:n}=(0,c.nTw)(e).chatCreation||{};return{chat:(0,c.hds)(e,i),creationProgress:s,creationError:n}})(e=>{let{chat:t,onClose:i,isActive:o,creationProgress:r,creationError:l}=e;const{createChannel:c}=(0,n.ko)(),d=(0,_i.A)();(0,Ce.A)({isActive:o,onBack:i});const[h,u]=(0,s.J0)(d("NewDiscussionChatTitle",{name:t?.title})),[m,p]=(0,s.J0)(),[v,g]=(0,s.J0)(),A=r===a.n7.InProgress,f=(0,M.A)(e=>{const{value:t}=e.currentTarget,i=t.trimStart();u(i),i!==t&&(e.currentTarget.value=i)}),b=l&&d("NewChatTitleEmptyError")||(v!==d("NewChatTitleEmptyError")&&v!==d("NewChannelTitleEmptyError")?v:void 0),C=(0,M.A)(()=>{h.length?t&&c({discussionChannelId:t.id,title:h,photo:m,isSuperGroup:!0}):g(d("NewChatTitleEmptyError"))});return(0,te.Y)("div",{className:"Management",children:(0,te.Y)("div",{className:"panel-content custom-scroll",children:(0,te.FD)("div",{className:"NewChat",children:[(0,te.FD)("div",{className:"NewChat-inner step-2",children:[(0,te.Y)(bh.A,{onChange:p,title:d("AddPhoto")}),(0,te.Y)(Z.A,{value:h,onChange:f,label:d("GroupName"),error:v===d("NewChatTitleEmptyError")||v===d("NewChannelTitleEmptyError")?v:void 0}),b&&(0,te.Y)("p",{className:"error",children:b})]}),(0,te.Y)(wi.A,{isShown:0!==h.length,onClick:C,disabled:A,ariaLabel:d("DiscussionCreateGroup"),children:A?(0,te.Y)(Ee.A,{color:"white"}):(0,te.Y)(W.A,{name:"arrow-right"})})]})})})})),Xg=(0,s.ph)((0,n.EK)(e=>({managementType:(0,c.vn8)(e)}))(e=>{let{chatId:t,currentScreen:i,selectedChatMemberId:s,isPromotedByCurrentUser:n,onScreenSelect:o,onChatMemberSelect:r,onClose:l,isActive:c,managementType:d}=e;switch(i){case a.je.Initial:switch(d){case"bot":return(0,te.Y)(bg,{userId:t,onClose:l,isActive:c},t);case"user":return(0,te.Y)(Qg,{userId:t,onClose:l,isActive:c},t);case"group":return(0,te.Y)(Mg,{chatId:t,onScreenSelect:o,onClose:l,isActive:c||[a.je.ChatPrivacyType,a.je.Discussion,a.je.GroupPermissions,a.je.ChatAdministrators,a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(i)},t);case"channel":return(0,te.Y)(yg,{chatId:t,onScreenSelect:o,onClose:l,isActive:c||[a.je.ChannelSubscribers,a.je.ChatAdministrators,a.je.ChannelRemovedUsers,a.je.Discussion,a.je.ChatPrivacyType,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(i)},t)}break;case a.je.ChatPrivacyType:return(0,te.Y)(kg,{chatId:t,isActive:c,onClose:l});case a.je.Discussion:return(0,te.Y)(Ig,{chatId:t,onScreenSelect:o,isActive:c,onClose:l});case a.je.GroupPermissions:return(0,te.Y)(xg,{chatId:t,onScreenSelect:o,onChatMemberSelect:r,isActive:c||[a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions].includes(i),onClose:l});case a.je.ChannelRemovedUsers:case a.je.GroupRemovedUsers:return(0,te.Y)(Ng,{chatId:t,isActive:c,onClose:l});case a.je.GroupUserPermissionsCreate:return(0,te.Y)(Vg,{chatId:t,onChatMemberSelect:r,onScreenSelect:o,isActive:c||[a.je.GroupUserPermissions].includes(i),onClose:l});case a.je.GroupUserPermissions:return(0,te.Y)(Eg,{chatId:t,selectedChatMemberId:s,isPromotedByCurrentUser:n,onScreenSelect:o,isActive:c,onClose:l});case a.je.ChatAdministrators:return(0,te.Y)(Sg,{chatId:t,onScreenSelect:o,onChatMemberSelect:r,isActive:c||[a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(i),onClose:l});case a.je.NewDiscussionGroup:return(0,te.Y)(Zg,{chatId:t,onScreenSelect:o,isActive:c,onClose:l});case a.je.ChatNewAdminRights:case a.je.ChatAdminRights:return(0,te.Y)(Tg,{chatId:t,isNewAdmin:i===a.je.ChatNewAdminRights,selectedUserId:s,isPromotedByCurrentUser:n,onScreenSelect:o,isActive:c,onClose:l});case a.je.ChannelSubscribers:case a.je.GroupMembers:return(0,te.Y)(Lg,{chatId:t,isActive:c,onClose:l});case a.je.Invites:return(0,te.Y)(zg,{chatId:t,isActive:c,onClose:l,onScreenSelect:o});case a.je.EditInvite:return(0,te.Y)(Kg,{chatId:t,isActive:c,onClose:l,onScreenSelect:o});case a.je.GroupAddAdmins:return(0,te.Y)(Lg,{chatId:t,noAdmins:!0,isActive:c,onClose:l,onScreenSelect:o,onChatMemberSelect:r});case a.je.Reactions:return(0,te.Y)(qg,{chatId:t,isActive:c,onClose:l});case a.je.InviteInfo:return(0,te.Y)(Jg,{chatId:t,isActive:c,onClose:l});case a.je.JoinRequests:return(0,te.Y)($g,{chatId:t,isActive:c,onClose:l})}})),eA=/^4\d/,tA=/^5[1-5]/,iA=/^2[2-7]\d{2}/,sA=/^220[0-4]/;let nA=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 aA={[nA.Default]:"",[nA.Visa]:"visa",[nA.Mastercard]:"mastercard",[nA.Mir]:"mir"};function oA(e){return e=e.replace(/\s/g,""),eA.test(e)?nA.Visa:sA.test(e)?nA.Mir:tA.test(e)||iA.test(e)?nA.Mastercard:nA.Default}const rA={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},lA=(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{...rA};default:return e}};var cA=i(37960);const dA={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"},hA=(0,s.ph)(e=>{let{title:t,description:i,photo:o,invoice:r,shippingPrices:c,checkoutInfo:d,totalPrice:h,isTosAccepted:u,dispatch:m,onAcceptTos:p,tipAmount:v,needAddress:g,hasShippingOptions:A,savedCredentials:f,isPaymentFormUrl:b,botName:C}=e;const{setPaymentStep:y}=(0,n.ko)(),S=(0,T.A)(),k=(0,_i.A)(),w=Boolean(m),{termsUrl:N,suggestedTipAmounts:I,maxTipAmount:P}=r||{},{paymentMethod:Y,paymentProvider:F,shippingAddress:D,name:M,phone:B,shippingMethod:R}=d||{},L=(0,z.A)((0,l.cy)(o)),{ref:x}=(0,cA.A)({hasMediaData:Boolean(L)}),E=(0,s.hb)(e=>{m({type:"setTipAmount",payload:P?Math.min(e,P):e})},[m,P]),V=(0,s.hb)(()=>{y({step:f?.length?a.tn.SavedPayments:a.tn.PaymentInfo})},[f?.length,y]),_=(0,s.hb)(()=>{y({step:a.tn.ShippingInfo})},[y]),U=(0,s.hb)(()=>{y({step:a.tn.Shipping})},[y]);return(0,te.FD)("div",{className:dA.root,children:[(0,te.FD)("div",{className:dA.description,children:[L&&(0,te.Y)("img",{ref:x,className:dA.checkoutPicture,src:L,draggable:!1,width:o.dimensions?.width,height:o.dimensions?.height,alt:""}),!L&&o&&(0,te.Y)(Hi.A,{width:o.dimensions?.width,height:o.dimensions?.height,className:dA.checkoutPicture,forceAspectRatio:!0}),(0,te.FD)("div",{className:dA.text,children:[(0,te.Y)("h5",{className:dA.checkoutTitle,children:t}),i&&(0,te.Y)("div",{className:dA.checkoutDescription,children:(0,Dt.A)(i,["br","links","emoji"])})]})]}),(0,te.FD)("div",{className:dA.priceInfo,children:[r.prices.map(e=>uA(k,e.label,e.amount,r.currency)),c&&c.map(e=>uA(k,e.label,e.amount,r.currency)),I&&I.length>0&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:dA.priceInfoItem,children:[(0,te.Y)("div",{className:dA.priceInfoItemTitle,children:t}),(0,te.Y)("div",{children:(0,ua.vv)(k,v,r.currency)})]}),(0,te.Y)("div",{className:dA.tipsList,children:I.map(e=>(0,te.Y)("div",{className:(0,me.A)(dA.tipsItem,e===v&&dA.tipsItem_active),onClick:m?()=>E(e===v?0:e):void 0,children:(0,ua.vv)(k,e,r.currency,{shouldOmitFractions:!0})},e))})]}),void 0!==h&&uA(k,S("Checkout.TotalAmount"),h,r.currency,!0)]}),(0,te.FD)("div",{className:dA.invoiceInfo,children:[!b&&mA({title:Y||f?.[0].title,label:S("PaymentCheckoutMethod"),icon:"card",onClick:w?V:void 0}),F&&mA({title:F,label:S("PaymentCheckoutProvider"),customIcon:(0,me.A)(dA.provider,dA[F.toLowerCase()])}),(g||!w&&D)&&mA({title:D,label:S("PaymentShippingAddress"),icon:"location",onClick:w?_:void 0}),M&&mA({title:M,label:S("PaymentCheckoutName"),icon:"user"}),B&&mA({title:B,label:S("PaymentCheckoutPhoneNumber"),icon:"phone"}),(A||!w&&R)&&mA({title:R,label:S("PaymentCheckoutShippingMethod"),icon:"truck",onClick:w?U:void 0}),N&&(O=N,(0,te.Y)(sn.A,{label:function(e,t){const i=S("PaymentCheckoutAcceptRecurrent",C).split("*");return(0,te.FD)(te.FK,{children:[i[0],(0,te.Y)(pl.A,{url:e,text:i[1],isRtl:t}),i.slice(2)]})}(O,S.isRtl),name:"checkout_tos",checked:Boolean(u),className:dA.tosCheckbox,tabIndex:0,onCheck:p}))]})]});var O});function uA(e,t,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return(0,te.FD)("div",{className:(0,me.A)(dA.priceInfoItem,n&&dA.priceInfoItemMain),children:[(0,te.Y)("div",{className:dA.priceInfoItemTitle,children:t}),(0,te.Y)("div",{children:(0,ua.vv)(e,i,s)})]})}function mA(e){let{title:t,label:i,icon:s,customIcon:n,onClick:a}=e;const o=Boolean(t&&i!==t);return(0,te.FD)(ci.A,{className:dA.list,narrow:!0,multiline:o,icon:s,inactive:!a,onClick:a,leftElement:n&&(0,te.Y)("i",{className:(0,me.A)("icon",n)}),children:[(0,te.Y)("div",{className:dA.checkoutInfoItemInfoTitle,children:t||i}),t&&i!==t&&(0,te.Y)("p",{className:dA.checkoutInfoItemInfoData,children:i})]})}const pA=(0,s.ph)(e=>{let{url:t,noRedirect:i,onClose:a,onPaymentFormSubmit:r}=e;const{openTelegramLink:l}=(0,n.ko)(),c=(0,T.A)(),d=(0,s.hb)(e=>{try{const t=JSON.parse(e.data),{eventType:s,eventData:n}=t;switch(s){case"web_app_open_tg_link":if(!i){const e=o.jsp+n.path_full;l({url:e})}a();break;case"payment_form_submit":r&&r(n);break;default:a()}}catch(e){}},[a,i,l,r]);return(0,s.vJ)(()=>(window.addEventListener("message",d),()=>window.removeEventListener("message",d)),[d]),(0,te.Y)("div",{className:"ConfirmPayment",children:(0,te.Y)("iframe",{src:t,title:c("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"})})}),vA=(0,s.ph)((0,n.EK)(e=>{const{payment:t}=(0,c.nTw)(e);return{errorKey:t.error?.messageKey,passwordHint:e.twoFaSettings.hint,savedCredentials:"regular"===t.form?.type?t.form.savedCredentials:void 0}})(e=>{let{isActive:t,errorKey:i,state:a,savedCredentials:o,passwordHint:r,onPasswordChange:l}=e;const{clearPaymentError:c}=(0,n.ko)(),d=(0,T.A)(),h=(0,_i.A)(),[u,m]=(0,s.J0)(!1),p=(0,s.Kr)(()=>o?.length&&a.savedCredentialId?o.find(e=>{let{id:t}=e;return t===a.savedCredentialId})?.title:void 0,[o,a.savedCredentialId]);return(0,te.FD)("div",{className:"PaymentInfo",children:[(0,te.Y)(Ld.A,{isBig:!0,isPasswordVisible:u}),(0,te.Y)(Sl.A,{error:i&&h.withRegular(i),hint:r,description:d("PaymentConfirmationMessage",p),placeholder:d("Password"),onClearError:c,shouldShowSubmit:!1,shouldResetValue:t,isPasswordVisible:u,onChangePasswordVisibility:m,onInputChange:l})]})}));var gA=i(63173);function AA(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;(0,s.vJ)(()=>{u.TF||setTimeout(()=>{(0,r.YS)(()=>{e.current?.focus()})},t)},[e,t])}const fA=i.p+"mastercard.790db81f7978635f77d8.svg",bA=i.p+"mir.e3a390b90e2e3e292621.svg",CA=i.p+"visa.fb39984c9532c0336be9.svg",yA=(0,s.ph)(e=>{let{value:t,error:i,onChange:n}=e;const a=(0,T.A)(),o=(0,s.li)();AA(o);const[r,l]=(0,s.J0)(nA.Default);(0,s.vJ)(()=>{const e=oA(t);l(e)},[]);const c=(0,s.hb)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),i=oA(e.target.value);l(i),n(t)},[n]),d=function(e){switch(e){case nA.Mastercard:return(0,te.Y)("img",{src:fA,draggable:!1,alt:""});case nA.Visa:return(0,te.Y)("img",{src:CA,draggable:!1,alt:""});case nA.Mir:return(0,te.Y)("img",{src:bA,draggable:!1,alt:""});default:return}}(r);return(0,te.FD)("div",{className:"CardInput",children:[(0,te.Y)(Z.A,{ref:o,label:a("PaymentCardNumber"),onChange:c,value:t,inputMode:"numeric",className:r?"has-right-addon":"",error:i,tabIndex:0,maxLength:19,teactExperimentControlled:!0}),(0,te.Y)("span",{className:"right-addon",children:d})]})}),SA=(0,s.ph)(e=>{let{value:t,error:i,onChange:n}=e;const a=(0,T.A)(),o=(0,s.hb)(e=>{const i=e.target.value;t.endsWith("/")&&t.length>i.length?n(i):n(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t?.[0]&&Number(t[0])>12&&(t[0]="12"),t?.[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))},[n,t]);return(0,te.Y)(Z.A,{label:a("PaymentCardExpireDate"),onChange:o,value:t,error:i,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})}),kA=(0,s.ph)(e=>{let{state:t,canSaveCredentials:i,needCardholderName:n,needCountry:a,needZip:o,countryList:r,dispatch:l}=e;const c=(0,s.li)();(0,s.vJ)(()=>{c.current&&c.current.value!==t.billingCountry&&(c.current.value=t.billingCountry)},[t.billingCountry]);const d=(0,s.hb)(e=>{l({type:"changeCardNumber",payload:e})},[l]),h=(0,s.hb)(e=>{l({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[l]),u=(0,s.hb)(e=>{l({type:"changeExpiryDate",payload:e})},[l]),m=(0,s.hb)(e=>{const t=e.target.value.replace(/[^0-9]/g,"");l({type:"changeCvvCode",payload:t})},[l]),p=(0,s.hb)(e=>{l({type:"changeBillingCountry",payload:e.target.value})},[l]),v=(0,s.hb)(e=>{l({type:"changeBillingZip",payload:e.target.value})},[l]),g=(0,s.hb)(e=>{l({type:"changeSaveCredentials",payload:e.target.value})},[l]),A=(0,T.A)(),f=(0,_i.A)(),{formErrors:b={}}=t;return(0,te.Y)("div",{className:"PaymentInfo",children:(0,te.FD)("form",{children:[(0,te.Y)("h5",{children:A("PaymentCardTitle")}),(0,te.Y)(yA,{onChange:d,value:t.cardNumber,error:b.cardNumber&&f.withRegular(b.cardNumber)}),n&&(0,te.Y)(Z.A,{label:A("Checkout.NewCard.CardholderNamePlaceholder"),onChange:h,value:t.cardholder,inputMode:"text",tabIndex:0,error:b.cardholder&&f.withRegular(b.cardholder)}),(0,te.FD)("section",{className:"inline-inputs",children:[(0,te.Y)(SA,{value:t.expiry,onChange:u,error:b.expiry&&f.withRegular(b.expiry)}),(0,te.Y)(Z.A,{label:A("lng_payments_card_cvc"),onChange:m,value:t.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:b.cvv&&f.withRegular(b.cvv),teactExperimentControlled:!0})]}),a||o?(0,te.Y)("h5",{children:A("PaymentBillingAddress")}):void 0,(0,te.FD)("section",{className:"inline-inputs",children:[a&&(0,te.Y)(gA.A,{label:A("PaymentShippingCountry"),onChange:p,value:t.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:b.billingCountry&&f.withRegular(b.billingCountry),tabIndex:0,ref:c,children:r.map(e=>{let{defaultName:i,name:s}=e;return(0,te.Y)("option",{value:i,className:"county-item",selected:i===t.billingCountry,children:i||s})})}),o&&(0,te.Y)(Z.A,{label:A("PaymentShippingZipPlaceholder"),onChange:v,value:t.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:b.billingZip&&f.withRegular(b.billingZip)})]}),(0,te.Y)("div",{className:"checkbox",children:(0,te.Y)(sn.A,{label:A("PaymentCardSavePaymentInformation"),checked:!!i&&t.saveCredentials,tabIndex:0,subLabel:A(i?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"),onChange:g,disabled:!i})})]})})}),wA=(0,s.ph)(e=>{let{state:t,savedCredentials:i,dispatch:n,onNewCardClick:a}=e;const o=(0,T.A)(),r=(0,s.Kr)(()=>i?.length?i.map(e=>{let{id:t,title:i}=e;return{label:i,value:t}}):Ci.p,[i]),l=(0,s.hb)(e=>{n({type:"changeSavedCredentialId",payload:e})},[n]);return(0,te.Y)("div",{className:"PaymentInfo",children:(0,te.FD)("form",{children:[(0,te.Y)("h5",{children:o("PaymentCardTitle")}),(0,te.Y)(ee.A,{name:"saved-credentials",options:r,selected:t.savedCredentialId,onChange:l}),(0,te.Y)(Q.A,{isText:!0,onClick:a,children:o("PaymentCheckoutMethodNewCard")})]})})}),NA=(0,s.ph)(e=>{let{state:t,shippingOptions:i,currency:n,dispatch:a}=e;const o=(0,T.A)(),r=(0,_i.A)();(0,s.vJ)(()=>{i&&i.length&&!t.shipping&&a({type:"changeShipping",payload:i[0].id})},[i,t.shipping,a]);const l=(0,s.hb)(e=>{a({type:"changeShipping",payload:e})},[a]),c=(0,s.Kr)(()=>i.map(e=>{let{id:t,title:i,amount:s}=e;return{label:i,subLabel:(0,ua.vv)(r,s,n),value:t}}),[i,n,r]);return(0,te.Y)("div",{className:"Shipping",children:(0,te.FD)("form",{children:[(0,te.Y)("p",{children:o("PaymentShippingMethod")}),(0,te.Y)(ee.A,{name:"shipping-options",options:c,onChange:l,selected:t.shipping})]})})}),IA=(0,s.ph)(e=>{let{state:t,needEmail:i,needPhone:n,needName:a,needAddress:o,countryList:r,dispatch:l}=e;const c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)();(0,s.vJ)(()=>{h.current&&h.current.value!==t.countryIso2&&(h.current.value=t.countryIso2)},[t.countryIso2]);const u=(0,T.A)(),m=(0,_i.A)();AA(c);const p=(0,s.hb)(e=>{l({type:"changeAddress1",payload:e.target.value})},[l]),v=(0,s.hb)(e=>{l({type:"changeAddress2",payload:e.target.value})},[l]),g=(0,s.hb)(e=>{l({type:"changeCity",payload:e.target.value})},[l]),A=(0,s.hb)(e=>{l({type:"changeState",payload:e.target.value})},[l]),f=(0,s.hb)(e=>{l({type:"changeCountry",payload:r.find(t=>t.iso2===e.target.value)})},[r,l]),b=(0,s.hb)(e=>{l({type:"changePostCode",payload:e.target.value})},[l]),C=(0,s.hb)(e=>{l({type:"changeFullName",payload:e.target.value})},[l]),y=(0,s.hb)(e=>{l({type:"changeEmail",payload:e.target.value})},[l]),S=(0,s.hb)(e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,d.current&&(d.current.value=t),l({type:"changePhone",payload:t})},[l]),k=(0,s.hb)(e=>{l({type:"changeSaveInfo",payload:e.target.value})},[l]),{formErrors:w}=t;return(0,te.Y)("div",{className:"ShippingInfo",children:(0,te.FD)("form",{children:[o?(0,te.FD)("div",{children:[(0,te.Y)("h5",{children:u("PaymentShippingAddress")}),(0,te.Y)(Z.A,{ref:c,label:u("PaymentShippingAddress1Placeholder"),onChange:p,value:t.streetLine1,inputMode:"text",tabIndex:0,error:w.streetLine1&&m.withRegular(w.streetLine1)}),(0,te.Y)(Z.A,{label:u("PaymentShippingAddress2Placeholder"),onChange:v,value:t.streetLine2,inputMode:"text",tabIndex:0,error:w.streetLine2&&m.withRegular(w.streetLine2)}),(0,te.Y)(Z.A,{label:u("PaymentShippingCityPlaceholder"),onChange:g,value:t.city,inputMode:"text",tabIndex:0,error:w.city&&m.withRegular(w.city)}),(0,te.Y)(Z.A,{label:u("PaymentShippingStatePlaceholder"),onChange:A,value:t.state,inputMode:"text",error:w.state&&m.withRegular(w.state)}),(0,te.Y)(gA.A,{label:u("PaymentShippingCountry"),onChange:f,value:t.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:w.countryIso2&&m.withRegular(w.countryIso2),ref:h,tabIndex:0,children:r.map(e=>{let{defaultName:i,name:s,iso2:n}=e;return(0,te.Y)("option",{value:n,className:"county-item",selected:n===t.countryIso2,children:i||s})})}),(0,te.Y)(Z.A,{label:u("PaymentShippingZipPlaceholder"),onChange:b,value:t.postCode,inputMode:"text",tabIndex:0,error:w.postCode&&m.withRegular(w.postCode)})]}):void 0,a||i||n?(0,te.Y)("h5",{children:u("PaymentShippingReceiver")}):void 0,a&&(0,te.Y)(Z.A,{label:u("PaymentShippingName"),onChange:C,value:t.fullName,inputMode:"text",tabIndex:0,error:w.fullName&&m.withRegular(w.fullName)}),i&&(0,te.Y)(Z.A,{label:u("PaymentShippingEmailPlaceholder"),onChange:y,value:t.email,inputMode:"email",tabIndex:0,error:w.email&&m.withRegular(w.email)}),n&&(0,te.Y)(Z.A,{label:u("PaymentShippingPhoneNumber"),onChange:S,value:t.phone,inputMode:"tel",tabIndex:0,error:w.phone&&m.withRegular(w.phone),ref:d}),(0,te.Y)(sn.A,{label:u("PaymentShippingSave"),subLabel:u("PaymentShippingSaveInfo"),checked:Boolean(t.saveInfo),tabIndex:0,onChange:k})]})})}),PA="stripe",YA="smartglocal",FA=new Set([PA,YA]),DA=(0,s.ph)((0,n.EK)(e=>{const{form:t,step:i,shippingOptions:s,error:n,confirmPaymentUrl:a,inputInvoice:o,requestId:r,stripeCredentials:d,smartGlocalCredentials:h,temporaryPassword:u,isExtendedMedia:m,url:p}=(0,c.nTw)(e).payment,{invoice:v,nativeParams:g,nativeProvider:A}=t||{},f=e.countryList.general;let b=t?.nativeProvider;!b&&p&&(b=p.startsWith("https://payment.smart-glocal.com")?YA:void 0);const C=o&&"chatId"in o?(0,c.hds)(e,o.chatId):void 0,y=Boolean(v&&(!b||!FA.has(b))),{needCardholderName:S,needCountry:k,needZip:w}=g||{},N=t?.botId?(0,c.mBe)(e,t.botId):void 0,I=(0,l.Yg)(N);return{step:i,chat:C,shippingOptions:s,nativeProvider:b,isProviderError:y,form:t,invoice:v,needCardholderName:S,needCountry:k,needZip:w,error:n,confirmPaymentUrl:a??p,isPaymentFormUrl:Boolean(!A&&p),countryList:f,requestId:r,hasShippingOptions:Boolean(s?.length),smartGlocalToken:h?.token,stripeId:d?.id,passwordValidUntil:u?.validUntil,isExtendedMedia:m,botName:I}})(e=>{let{isOpen:t,onClose:i,step:o,shippingOptions:r,form:l,isProviderError:c,invoice:d,nativeProvider:h,needCardholderName:u,needCountry:m,needZip:p,confirmPaymentUrl:v,error:g,countryList:A,hasShippingOptions:f,requestId:b,smartGlocalToken:C,stripeId:y,passwordValidUntil:S,isExtendedMedia:k,isPaymentFormUrl:w,botName:N}=e;const{loadPasswordInfo:I,validateRequestedInfo:P,sendPaymentForm:Y,setPaymentStep:D,sendCredentialsInfo:B,clearPaymentError:R,validatePaymentPassword:L,setSmartGlocalCardInfo:x}=(0,n.ko)(),E=(0,T.A)(),V=(0,_i.A)(),[U,O,K]=(0,F.A)(),[J,G]=(0,gd.A)(lA,rA),[j,z]=(0,s.J0)(!1),[H,$]=(0,s.J0)(!1),[q,Z]=(0,s.J0)(""),ee=(0,_.A)(o,!0),ie=(0,_.A)(b),se=o!==a.tn.ConfirmPayment,ae=(0,s.hb)(e=>{D({step:e})},[D]);(0,s.vJ)(()=>{t&&(Z(""),I(),O())},[t,I,O]),(0,s.vJ)(()=>{!t&&U&&K()},[K,U,t]),(0,s.vJ)(()=>{(void 0!==o||g)&&z(!1)},[o,g,b]),(0,s.vJ)(()=>{o!==a.tn.Checkout||o!==ee||b===ie||J.savedCredentialId||J.cardNumber||ae(a.tn.PaymentInfo)},[J.cardNumber,J.savedCredentialId,ie,ee,b,ae,o]),(0,s.vJ)(()=>{g?.field&&G({type:"setFormErrors",payload:{[g.field]:g.messageKey}})},[g,G]),(0,s.vJ)(()=>{if(l?.savedInfo){const{name:e,phone:t,email:i,shippingAddress:s}=l.savedInfo,{countryIso2:n,...a}=s||{},o=n&&A.find(e=>{let{iso2:t}=e;return t===n}).defaultName;G({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:i,...o&&{country:o,countryIso2:n,...a}}})}},[l,G,A]),(0,s.vJ)(()=>{l?.savedCredentials?.length&&G({type:"changeSavedCredentialId",payload:l.savedCredentials[0].id})},[G,l?.savedCredentials]);const oe=(0,s.hb)(()=>{R()},[R]),re=(0,s.Kr)(()=>o!==a.tn.Checkout?0:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=arguments.length>3?arguments[3]:void 0;const s=t?TA(t,arguments.length>2?arguments[2]:void 0):[];let n=i;return n=e.concat(s||[]).reduce((e,t)=>e+t.amount,n),n}(d?.prices,r,J.shipping,J.tipAmount),[o,d?.prices,r,J.shipping,J.tipAmount]),le=(0,s.Kr)(()=>{if(o===a.tn.Checkout)return function(e,t,i){const s=function(e){const t=oA(e);return aA[t]||""}(e.cardNumber),n=s&&e.cardNumber?`${s} *${e.cardNumber.slice(-4)}`:void 0,a=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:o,fullName:r}=e,l=t?MA(t,e.shipping):void 0,c=l?.title;return{paymentMethod:n,paymentProvider:i,shippingAddress:a,name:r,phone:o,shippingMethod:c}}(J,r,h||"")},[o,J,r,h]),ce=(0,s.hb)(()=>{ae(a.tn.PaymentInfo)},[ae]),de=(0,s.hb)(()=>{R()},[R]),he=(0,s.hb)(()=>{Y({shippingOptionId:J.shipping,saveCredentials:J.saveCredentials,savedCredentialId:J.savedCredentialId,tipAmount:J.tipAmount})},[Y,J]),ue=(0,s.hb)(e=>{const{credentials:t}=e;x(t),he()},[he]),pe=(0,s.hb)(()=>{const{saveInfo:e}=J,t=function(e){const{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:a,postCode:o,fullName:r,phone:l,email:c}=e;return{name:r,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:a,postCode:o}}}(J);P({requestInfo:t,saveInfo:e})},[P,J]),ve=(0,s.hb)(()=>{const e=function(e){const{cardNumber:t,cardholder:i,expiry:s,cvv:n,billingCountry:a,billingZip:o}=e,[r,l]=s.split("/");return{data:{cardNumber:t,cardholder:i,expiryMonth:r,expiryYear:l,cvv:n,country:a,zip:o}}}(J);B({credentials:e})},[B,J]),ge=(0,M.A)(()=>{switch(o){case a.tn.ShippingInfo:z(!0),pe();break;case a.tn.Shipping:ae(a.tn.Checkout);break;case a.tn.SavedPayments:ae(a.tn.ConfirmPassword);break;case a.tn.ConfirmPassword:if(""===q)return;z(!0),L({password:q});break;case a.tn.PaymentInfo:z(!0),ve(),G({type:"changeSavedCredentialId",payload:""});break;case a.tn.Checkout:{if(w)return z(!0),void ae(a.tn.ConfirmPayment);if(l?.savedInfo&&!b&&!J.shipping)return z(!0),void pe();if(J.savedCredentialId&&(!S||S<=Date.now()/1e3-3))return void ae(a.tn.ConfirmPassword);if(!J.savedCredentialId&&(h===PA&&!y||h===YA&&!C))return void ae(a.tn.PaymentInfo);const{phone:e,email:t,fullName:i}=J,s=d?.isEmailRequested&&!t||d?.isPhoneRequested&&!e||d?.isNameRequested&&!i;if(d?.isShippingAddressRequested&&!b||s)return void ae(a.tn.ShippingInfo);if(d?.isShippingAddressRequested&&!J.shipping&&r?.length)return void ae(a.tn.Shipping);z(!0),he();break}}});(0,s.vJ)(()=>o===a.tn.ConfirmPassword?(0,Ri.A)({onEnter:ge}):void 0,[ge,o]);const Ae=(0,s.hb)(()=>{G({type:"resetState"}),$(!1),i()},[i,G]),fe=(0,s.hb)(()=>{ae(o===a.tn.ConfirmPassword?a.tn.SavedPayments:a.tn.Checkout)},[ae,o]),be=(0,s.Kr)(()=>{switch(o){case a.tn.Checkout:return E("PaymentCheckout");case a.tn.ShippingInfo:return E("PaymentShippingInfo");case a.tn.Shipping:return E("PaymentShippingMethod");case a.tn.SavedPayments:return E("PaymentCheckoutMethod");case a.tn.ConfirmPassword:return E("Checkout.PasswordEntry.Title");case a.tn.PaymentInfo:return E("PaymentCardInfo");case a.tn.ConfirmPayment:return E("Checkout.WebConfirmation.Title");default:return""}},[o,E]),Ce=o===a.tn.Checkout?E("Checkout.PayPrice",(0,ua.Ad)(re,d.currency,E.code)):V("PaymentInfoDone");if(c)return(0,te.FD)(X.A,{className:"error",isOpen:U,onClose:K,onCloseAnimationEnd:Ae,children:[(0,te.Y)("p",{children:V("PaymentsProvidesNotSupported",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{isText:!0,onClick:K,children:E("OK")})})]});const ye=function(){if(j)return!0;switch(o){case a.tn.Checkout:return Boolean(d?.termsUrl)&&!H;case a.tn.PaymentInfo:return Boolean(""===J.cardNumber||u&&""===J.cardholder||""===J.cvv||""===J.expiry);default:return!1}}();return(0,te.FD)(X.A,{className:(0,me.A)("PaymentModal",d?.isRecurring&&"recurring"),isOpen:U,onClose:K,onCloseAnimationEnd:Ae,children:[(0,te.FD)("div",{className:"header",dir:E.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:o===a.tn.Checkout?K:fe,ariaLabel:V("Close"),children:(0,te.Y)(W.A,{name:o===a.tn.Checkout?"close":"arrow-left"})}),(0,te.Y)("h3",{children:be})]}),void 0!==o?(0,te.Y)(ne.Ay,{name:"slide",activeKey:o,shouldCleanup:!0,cleanupOnlyKey:a.tn.ConfirmPayment,children:(0,te.Y)("div",{className:"content custom-scroll",children:function(e){switch(e){case a.tn.Checkout:return(0,te.Y)(hA,{title:l.title,description:l.description,photo:l.photo,dispatch:G,shippingPrices:J.shipping&&r?TA(r,J.shipping):void 0,totalPrice:re,invoice:d,checkoutInfo:le,isPaymentFormUrl:w,hasShippingOptions:f,tipAmount:J.tipAmount,needAddress:Boolean(d?.isShippingAddressRequested),savedCredentials:l.savedCredentials,isTosAccepted:H,onAcceptTos:$,botName:N});case a.tn.SavedPayments:return(0,te.Y)(wA,{state:J,savedCredentials:l.savedCredentials,dispatch:G,onNewCardClick:ce});case a.tn.ConfirmPassword:return(0,te.Y)(vA,{state:J,savedCredentials:l.savedCredentials,onPasswordChange:Z,isActive:e===o});case a.tn.PaymentInfo:return(0,te.Y)(kA,{state:J,dispatch:G,canSaveCredentials:Boolean(!l.isPasswordMissing&&l.canSaveCredentials),needCardholderName:u,needCountry:m,needZip:p,countryList:A});case a.tn.ShippingInfo:return(0,te.Y)(IA,{state:J,dispatch:G,needAddress:Boolean(d?.isShippingAddressRequested),needEmail:Boolean(d?.isEmailRequested||d?.isEmailSentToProvider),needPhone:Boolean(d?.isPhoneRequested||d?.isPhoneSentToProvider),needName:Boolean(d?.isNameRequested),countryList:A});case a.tn.Shipping:return(0,te.Y)(NA,{state:J,dispatch:G,shippingOptions:r||[],currency:d.currency});case a.tn.ConfirmPayment:return(0,te.Y)(pA,{url:v,noRedirect:k,onPaymentFormSubmit:ue,onClose:K});default:return}}(o)})}):(0,te.Y)("div",{className:"empty-content",children:(0,te.Y)(Ee.A,{color:"gray"})}),se&&(0,te.Y)("div",{className:"footer",children:(0,te.Y)(Q.A,{className:"button-text",type:"submit",onClick:ge,disabled:ye,isLoading:j,children:Ce})}),g&&!g.field&&function(){if(g)return(0,te.FD)(X.A,{className:"error",isOpen:Boolean(g),onClose:oe,children:[(0,te.Y)("h4",{children:g.descriptionKey?V.withRegular(g.descriptionKey):V("ErrorUnspecified")}),(0,te.Y)("div",{className:"dialog-buttons mt-2",children:(0,te.Y)(Q.A,{isText:!0,onClick:de,children:V("OK")})})]})}()]})}));function MA(e,t){return e.find(e=>{let{id:i}=e;return i===t})}function TA(e,t){const i=MA(e,t);return i?.prices}const BA=(0,s.ph)((0,n.EK)(e=>{const{receipt:t}=(0,c.nTw)(e).payment;return{receipt:t}})(e=>{let{isOpen:t,onClose:i,receipt:n}=e;const a=(0,_i.A)(),[o,r,l]=(0,F.A)();(0,s.vJ)(()=>{t&&r()},[t,r]);const c=(0,hl.A)(n),d=n||c,h=(0,s.Kr)(()=>{if(d)return function(e,t,i){if(!t)return{paymentMethod:e};const{shippingAddress:s}=t,n=s?.streetLine1?`${s.streetLine1}, ${s.city}, ${s.countryIso2}`:void 0,{phone:a,name:o}=t;return{paymentMethod:e,shippingAddress:n,name:o,phone:a,shippingMethod:i}}(d.credentialsTitle,d.info,d.shippingMethod)},[d]);return(0,te.Y)(X.A,{className:"PaymentModal PaymentModal-receipt",isOpen:o,onClose:l,onCloseAnimationEnd:i,children:d&&(0,te.FD)(te.FK,{children:[(0,te.FD)("div",{className:"header",dir:a.isRtl?"rtl":void 0,children:[(0,te.Y)(Q.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:l,ariaLabel:"Close",children:(0,te.Y)(W.A,{name:"close"})}),(0,te.FD)("h3",{children:[" ",a("PaymentReceipt")," "]})]}),(0,te.Y)("div",{className:"receipt-content custom-scroll",children:(0,te.Y)(hA,{shippingPrices:d.shippingPrices,totalPrice:d.totalAmount,tipAmount:d.tipAmount,invoice:d.invoice,checkoutInfo:h,title:d.title,description:d.description,photo:d.photo})})]})})})),RA="Qo4PtFZI",LA="wtfpombl",xA=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;return{chat:i?.chatId?(0,c.hds)(e,i.chatId):void 0}})(e=>{let{modal:t,chat:i}=e;const{sendInviteMessages:a,closeInviteViaLinkModal:o,openPremiumModal:r}=(0,n.ko)(),{missingUsers:c}=t||{},d=(0,T.A)(),[h,u]=(0,s.J0)([]),m=(0,s.Kr)(()=>c?.map(e=>e.id)||Ci.p,[c]),[p,v]=(0,s.Kr)(()=>{if(!c?.length)return[[],[]];const[e,t]=(0,bi.jB)(c,e=>e.isRequiringPremiumToMessage);return[e.map(e=>e.id),t.map(e=>e.id)]},[c]),g=(0,s.Kr)(()=>c?.filter(e=>e.isRequiringPremiumToInvite||e.isRequiringPremiumToMessage).map(e=>e.id),[c]),A=(0,s.Kr)(()=>{if(c)return!c.some(e=>e.isRequiringPremiumToInvite&&!e.isRequiringPremiumToMessage)},[c]),f=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;return g?.map(t=>e[t])},[g]);(0,s.vJ)(()=>{u(v)},[v]);const b=(0,M.A)(()=>o()),C=(0,s.hb)(()=>{a({chatId:i.id,userIds:h}),o()},[h,i]),y=(0,s.hb)(()=>{r()},[]),S=(0,s.Kr)(()=>{if(i)return Boolean(i?.isCreator||i?.adminRights?.inviteUsers)},[i]),k=(0,s.Kr)(()=>S?d(1===c?.length?"InviteBlockedOneMessage":"InviteBlockedManyMessage"):d("InviteRestrictedUsers2",c?.length),[S,d,c?.length]),w=(0,s.Kr)(()=>{if(!g?.length||!f?.length)return;const e=A?"InviteMessagePremiumBlocked":"InvitePremiumBlocked";let t=`${e}One`,i=[(0,l.Yg)(f[0])];return 2===g.length?(t=`${e}Two`,i=[(0,l.Yg)(f[0]),(0,l.Yg)(f[1])]):3===g.length?(t=`${e}Three`,i=[(0,l.Yg)(f[0]),(0,l.Yg)(f[1]),(0,l.Yg)(f[2])]):g.length>3&&(t=`${e}Many`,i=[(0,l.Yg)(f[0]),(0,l.Yg)(f[1]),(g.length-2).toString()]),d(t,i,void 0,f.length)},[g,A,d,f]),N=Boolean(f?.length),I=Boolean(v?.length);return(0,te.FD)(X.A,{isOpen:Boolean(m&&i),contentClassName:"n8eENbaR",onClose:b,isSlim:!0,children:[(0,te.Y)(Q.A,{round:!0,color:"translucent",size:"smaller",className:"smosGkw9",ariaLabel:d("Close"),onClick:b,children:(0,te.Y)(W.A,{name:"close"})}),w&&(0,te.FD)(te.FK,{children:[(0,te.Y)(os.A,{className:"Nc3SOtKd",peers:f,size:"large"}),(0,te.Y)("h3",{className:LA,children:d(S?"InvitePremiumBlockedTitle":"ChannelInviteViaLinkRestricted")}),(0,te.Y)("p",{className:RA,children:(0,Dt.A)(w,["simple_markdown"])}),(0,te.Y)(Q.A,{withPremiumGradient:!0,isShiny:!0,onClick:y,children:d("InvitePremiumBlockedSubscribe")})]}),N&&I&&(0,te.Y)(nc.A,{className:"UoMeVIyC",children:d("InvitePremiumBlockedOr")}),I&&(0,te.FD)(te.FK,{children:[(0,te.Y)("h3",{className:LA,children:d("InviteBlockedTitle")}),(0,te.Y)("p",{className:RA,children:k}),(0,te.Y)(yi.A,{className:"nEYyTS_m",itemIds:m,selectedIds:h,lockedUnselectedIds:p,lockedUnselectedSubtitle:d("InvitePremiumBlockedUser"),onSelectedIdsChange:u,isViewOnly:!S,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),S&&(0,te.Y)(Q.A,{className:"Ttkq3nqt",onClick:C,disabled:!h.length,children:d("SendInviteLink.ActionInvite")})]})]})}));var EA=i(84555);const VA=(0,s.ph)(e=>{let{modal:t}=e;const{closeOneTimeMediaModal:i}=(0,n.ko)(),s=(0,T.A)(),o=(0,Bi.A)(t?.message,!0),{shouldRender:r,transitionClassNames:d}=(0,Ke.A)(Boolean(t)),h=(0,M.A)(()=>{}),u=(0,M.A)(()=>{i()});if(!r||!o)return;const m=(0,l.Ie)(o),p=(0,c.SJA)((0,n.mS)()),v=s(m?"Chat.Voice.Single.Close":"Chat.Voice.Single.DeleteAndClose");return(0,te.FD)("div",{className:(0,me.A)("c3xMWwzW",d),children:[function(){if(!o?.content)return;const{voice:e,video:t}=o.content;return e?(0,te.Y)(Sc.Ay,{className:"VLiJWMs0",theme:p,message:o,origin:a.d9.OneTimeModal,autoPlay:!0,onPlay:h,onPause:u}):t?.isRound?(0,te.Y)(EA.A,{className:"ML2YEpGq",message:o,origin:"oneTimeModal",onStop:u}):void 0}(),(0,te.Y)("div",{className:"VWy1qXJL",children:(0,te.Y)(Q.A,{faded:!0,onClick:u,pill:!0,size:"smaller",color:"dark"===p?"dark":"secondary",className:"FfMrCmD9",children:v})})]})}),_A=(0,s.ph)(e=>{let{isOpen:t}=e;const i=(0,T.A)(),a=(0,_i.A)(),{closeWebAppsCloseConfirmationModal:o,closeWebAppModal:r}=(0,n.ko)(),[l,c]=(0,s.J0)(!1),d=(0,s.li)(),h=(0,s.hb)(()=>{o({shouldSkipInFuture:l})},[l]),u=(0,s.hb)(()=>{r({shouldSkipConfirmation:!0}),o({shouldSkipInFuture:l})},[l]),m=(0,s.hb)(e=>{-1===e&&u()},[u]),p=(0,Ls.A)(d,t,m,".Button");return(0,te.FD)(X.A,{className:(0,me.A)("confirm"),title:a("CloseMiniApps"),isOpen:t,onClose:h,children:[(0,te.Y)("p",{children:a("AreYouSureCloseMiniApps")}),(0,te.Y)(sn.A,{className:"dialog-checkbox",label:a("DoNotAskAgain"),checked:l,onCheck:c}),(0,te.FD)("div",{className:"dialog-buttons mt-2",ref:d,onKeyDown:p,children:[(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"danger",children:i("Confirm")}),(0,te.Y)(Q.A,{className:"confirm-dialog-button",isText:!0,onClick:h,children:i("Cancel")})]})]})}),UA=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.freezeUntilDate,i=e.appConfig.freezeAppealUrl,s=e.botFreezeAppealId?(0,c.mBe)(e,e.botFreezeAppealId):void 0;return{freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:s&&(0,l.Kl)(s)}})(e=>{let{modal:t,freezeUntilDate:i,freezeAppealUrl:a,botFreezeAppealUsername:o}=e;const{closeFrozenAccountModal:r,openUrl:l}=(0,n.ko)(),c=(0,_i.A)(),d=Boolean(t),h=(0,M.A)(()=>{r()}),u=(0,M.A)(()=>{r(),a&&l({url:a})}),m=(0,s.Kr)(()=>(0,te.FD)("div",{className:"cW2rtp6M",children:[(0,te.Y)(wr.A,{size:160,tgsUrl:kr.w.BannedDuck,noLoop:!0}),(0,te.Y)("div",{className:"qLSm0uyC",children:c("FrozenAccountModalTitle")})]}),[c]),p=(0,s.Kr)(()=>{if(d)return(0,te.FD)("div",{className:"Vj3QQ_JQ",children:[(0,te.Y)(Q.A,{className:"anvg3JaY",onClick:u,noForcedUpperCase:!0,children:c("ButtonAppeal")}),(0,te.Y)(Q.A,{isText:!0,onClick:h,noForcedUpperCase:!0,children:c("ButtonUnderstood")})]})},[c,d]);if(!i||!o)return;const v=new Date(1e3*i),g=(0,te.Y)(Yo.A,{onClick:u,isPrimary:!0,children:(0,pc.A)(o)}),A=[["hand-stop",c("FrozenAccountViolationTitle"),c("FrozenAccountViolationSubtitle")],["lock",c("FrozenAccountReadOnlyTitle"),c("FrozenAccountReadOnlySubtitle")],["frozen-time",c("FrozenAccountAppealTitle"),c("FrozenAccountAppealSubtitle",{botLink:g,date:(0,He.A)(v,c.code)},{withNodes:!0})]];return(0,te.Y)(gl.A,{isOpen:d,header:m,listItemData:A,footer:p,hasBackdrop:!0,onClose:h})})),OA="OvdHupR0",KA=(0,s.ph)((0,n.EK)((e,t)=>{let{modal:i}=t;const s=e.currentUserId,n=i?.userId?(0,c.mBe)(e,i.userId):void 0,a=i?.userId?(0,c.vGo)(e,i.userId):void 0,o=a?.starsRating,r=a?.starsMyPendingRating,l=a?.starsMyPendingRatingDate;return{user:n,currentUserId:s,starsRating:o,pendingRating:r,pendingRatingDate:l}})(e=>{let{modal:t,user:i,currentUserId:a,starsRating:o,pendingRating:r,pendingRatingDate:l}=e;const{closeProfileRatingModal:c}=(0,n.ko)(),d=(0,_i.A)(),h=Boolean(t),[u,m]=(0,s.J0)(!1),p=(0,M.A)(()=>{c()});(0,s.vJ)(()=>{h||m(!1)},[h]);const v=(0,M.A)(()=>{m(!0)}),g=(0,M.A)(()=>{m(!1)}),A=e=>{const t="added"===e,i=d(t?"RatingBadgeAdded":"RatingBadgeDeducted"),s=t?"Lr6JUU14":"OxZxdqcn";return(0,te.Y)("span",{className:(0,me.A)("JdeFDQBI",s),children:i})},f=(0,s.Kr)(()=>{if(!(t&&i&&o&&h))return;const e=u&&r?r:o,s=e.stars,n=e.currentLevelStars,c=e.nextLevelStars,m=e.level,p=m+1,A=m<0,f=!u&&r?r.level:o.level;let b=0;b=c&&c>n?Math.max(.03,(s-n)/(c-n)):1;const C=A?.5:Math.max(0,Math.min(1,b)),y=l?l-Math.floor(Date.now()/1e3):0,S=r?r.stars-o.stars:0,k=r&&l;let w="none";m>=0&&f>=0&&m!==f&&(w=m>f?"forward":"backward"),m<0&&f<0&&m!==f&&(w=m<f?"backward":"forward");const N=d("ActionFallbackUser");return(0,te.FD)("div",{className:"ChJT6ggP",children:[(0,te.Y)("div",{className:"IvsV0tkW",children:d("TitleRating")}),(0,te.Y)(zr.A,{leftText:A?void 0:d("RatingLevel",{level:m}),rightText:A?d("RatingNegativeLevel"):d("RatingLevel",{level:p}),floatingBadgeIcon:A?"warning":"crown-wear",floatingBadgeText:A?m.toString():`${d.number(s)} / ${d.number(c||s)}`,progress:C,isPrimary:m>=0,isNegative:m<0,animationDirection:w,className:(0,me.A)("XYpzs7CQ",k&&"UgviXkNW")}),(()=>{if(k)return(0,te.Y)(ne.Ay,{name:"fade",className:"_K5HhOM0",activeKey:u?1:0,shouldCleanup:!0,shouldRestoreHeight:!0,children:u?(0,te.Y)("p",{children:d("DescriptionFutureRating",{time:(0,He.A$)(d,y),points:Math.abs(S),link:(0,te.Y)("span",{className:"dcNVNCXo",onClick:g,children:d("LinkDescriptionRatingBack")})},{pluralValue:Math.abs(S),withNodes:!0})}):(0,te.Y)("p",{children:d("DescriptionPendingRating",{time:(0,He.A$)(d,y),points:Math.abs(S),link:(0,te.Y)("span",{className:"yY4hj8r_",onClick:v,children:d("LinkDescriptionRatingPreview")})},{pluralValue:Math.abs(S),withNodes:!0})})})})(),(0,te.Y)("p",{className:"ravQhVQQ",children:i?.id===a?d("RatingYourReflectsActivity"):d("RatingReflectsActivity",{name:(0,Ft.F9)(d,i)||N})})]})},[t,i,a,o,r,l,u,d,v,g,h]),b=[["gift",d("RatingGiftsFromTelegram"),(0,te.FD)("span",{className:OA,children:[A("added"),d("RatingGiftsFromTelegramDesc")]})],["user-stars",d("RatingGiftsAndPostsFromUsers"),(0,te.FD)("span",{className:OA,children:[A("added"),d("RatingGiftsAndPostsFromUsersDesc")]})],["refund",d("RatingRefundsAndConversions"),(0,te.FD)("span",{className:OA,children:[A("deducted"),d("RatingRefundsAndConversionsDesc")]})]],C=(0,s.Kr)(()=>{if(h)return(0,te.Y)("div",{className:"XtZPIDLP",children:(0,te.FD)(Q.A,{size:"smaller",onClick:p,children:[(0,te.Y)(W.A,{name:"understood",className:"Lwz8rpdL"}),d("ButtonUnderstood")]})})},[d,h,p]);return(0,te.Y)(gl.A,{isOpen:h,header:f,listItemData:b,footer:C,onClose:p})}))}}]);
//# sourceMappingURL=9451.9d9b6351a608fdc2dee4.js.map