TelegramPWA/dist/9451.f4f67251aef9823ca736.js
Alexander Zinchuk c02c68d44b [Build]
2026-04-08 02:36:20 +02:00

2 lines
723 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],{1411(e,t,i){i.r(t),i.d(t,{AboutAdsModal:()=>Nl,AboutMonetizationModal:()=>wl,AgeVerificationModal:()=>il,ArchivedChats:()=>gu,AttachBotInstallModal:()=>ua,AttachBotRecipientPicker:()=>qs,AttachmentModal:()=>wp,BirthdaySetupModal:()=>Cl,BoostModal:()=>$r,BotCommandMenu:()=>tv,BotTrustModal:()=>ma,CalendarModal:()=>vn,ChatCommandTooltip:()=>ev,ChatFolderModal:()=>Au,ChatInviteModal:()=>hl,ChatLanguageModal:()=>kc,ChatlistModal:()=>cl,CocoonModal:()=>Ff,CollectibleInfoModal:()=>Yc,ContactList:()=>nu,ContextMenuContainer:()=>bu.A,CountryPickerModal:()=>Cc,CreateTopic:()=>Mg,CustomEmojiSetsModal:()=>ku,CustomEmojiTooltip:()=>nv,CustomSendMenu:()=>ov,DeleteAccountModal:()=>el,DeleteFolderDialog:()=>pa,DeleteMessageModal:()=>tc,Dialogs:()=>Ws.A,DisableSharingAboutModal:()=>rf,DraftRecipientPicker:()=>$s,DropArea:()=>rv.A,EditRankModal:()=>vf,EditTopic:()=>Bg,EmojiInteractionAnimation:()=>Nc,EmojiStatusAccessModal:()=>Dl,EmojiTooltip:()=>uv,ForwardRecipientPicker:()=>Hs,FrozenAccountModal:()=>sf,GifSearch:()=>wv,GiftCodeModal:()=>Zr,GiveawayModal:()=>ir,HeaderMenuContainer:()=>Yu,HistoryCalendar:()=>gn,InlineBotTooltip:()=>bv,InviteViaLinkModal:()=>ZA,LeaveGroupModal:()=>If,LeftSearch:()=>Fd,LocationAccessModal:()=>Ml,Management:()=>gA,MapModal:()=>en,MediaViewer:()=>Mt,MentionTooltip:()=>Cp,MessageSelectToolbar:()=>ac,MessageStatistics:()=>dg,MiddleSearch:()=>_u,MinimizedWebAppModal:()=>Yn,MuteChatModal:()=>Cu,NewChat:()=>lu,NewContactModal:()=>Cn,OneTimeMediaModal:()=>ef,PasskeyModal:()=>ul,PaymentModal:()=>zA,PinMessageModal:()=>ic,PollModal:()=>Ip,PollResults:()=>Cg,PremiumLimitReachedModal:()=>lr,PremiumMainModal:()=>Io,PreparedMessageModal:()=>Vl,PrivacySettingsNoticeModal:()=>mc,ProfileRatingModal:()=>af,QuickChatPickerModal:()=>Yf,QuickPreviewModal:()=>Nf,RankModal:()=>Cf,ReactionPicker:()=>Hu,ReactorListModal:()=>Sc,ReceiptModal:()=>qA,ReportAdModal:()=>Bl,ReportModal:()=>Rl,SafeLinkModal:()=>Zs,SeenByModal:()=>oc,SendAsMenu:()=>yv,Settings:()=>su,SharePreparedMessageModal:()=>Ol,SponsoredContextMenuContainer:()=>bl.A,Statistics:()=>tg,StatusPickerMenu:()=>Or,StealthModeModal:()=>kf,StickerSearch:()=>kv,StickerSetModal:()=>Su,StickerTooltip:()=>iv,StoryStatistics:()=>gg,StoryViewer:()=>fs,SuggestMessageModal:()=>Gl,SuggestedPostApprovalModal:()=>zl,SuggestedStatusModal:()=>Jr,SymbolMenu:()=>Zp,TextFormatter:()=>hv,ToDoListModal:()=>Yp,TwoFaCheckModal:()=>Pf,UnpinAllMessagesModal:()=>sc,UrlAuthModal:()=>rn,VerificationMonetizationModal:()=>Yl,WebAppModal:()=>ha,WebAppsCloseConfirmationModal:()=>tf});var s=i(84051),n=i(13439),a=i(89925),o=i(31481),r=i(66644),l=i(90709),c=i(11597),d=i(53827),h=i(63495),m=i(96454),u=i(11778),p=i(14680),v=i(48899),g=i(76023),A=i(49086);function f({message:e,avatarOwner:t,profilePhotos:i,standaloneMedia:s,mediaIndex:n,sponsoredMessage:a}){return t&&i?{type:"avatar",avatarOwner:t,profilePhotos:i,mediaIndex:n}:s?{type:"standalone",media:s,mediaIndex:n}:e?{type:"message",message:e,mediaIndex:n}:a?{type:"sponsoredMessage",message:a,mediaIndex:n}:void 0}function C(e,t,i){if(!i)return;if("standalone"===i.type)return{media:i.media[i.mediaIndex],isSingle:1===i.media.length};if("avatar"===i.type){const e=i.profilePhotos?.photos[i.mediaIndex];return e?{media:e}:void 0}const{action:s,document:n,photo:a,video:o,paidMedia:r}=(0,l.r_)(i.message);if("chatEditPhoto"===s?.type||"suggestProfilePhoto"===s?.type)return{media:s.photo,isSingle:!0};if(n&&((0,l.Ml)(n)||(0,l.hr)(n)))return{media:n};const d=(0,c.Pn$)(e,i.message);if("full"===d?.webpageType){const{photo:e,video:t,document:i}=d,s=i&&((0,l.Ml)(i)||(0,l.hr)(i)),n=t||(s?i:void 0)||e;if(n)return{media:n,isSingle:!0}}if(r){const e=r.extendedMedia[i.mediaIndex||0];if(!("mediaType"in e)){const{photo:t,video:i}=e;return{media:t||i}}}const h=o||a;return h?{media:h}:void 0}var b=i(19822),y=i(83868),S=i(16460),N=i(41512),k=i(43503);function w(e,t){const i=document.createElement("div");i.classList.add("ghost");const s=new Image;if(s.draggable=!1,s.oncontextmenu=y.A,"string"==typeof e?s.src=e:e instanceof HTMLVideoElement?s.src=e.poster:s.src=e.src,i.appendChild(s),t===a.TQ.ProfileAvatar||t===a.TQ.SettingsAvatar){i.classList.add("ProfileInfo"),t===a.TQ.SettingsAvatar&&i.classList.add("self");const e=document.querySelector(t===a.TQ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&i.appendChild(e.cloneNode(!0))}return i}function I(e,t,i){let s,n;switch(e){case a.TQ.Album:case a.TQ.ScheduledAlbum:s=`.Transition_slide-active > .MessageList #album-media-${(0,l.GZ)(t.id,i)}`,n=".full-media";break;case a.TQ.PreviewMedia:s=`#preview-media${i}`,n="img";break;case a.TQ.SharedMedia:s=`#shared-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.SearchResult:s=`#search-media${(0,l.GZ)(t.id,i)}`,n="img";break;case a.TQ.MiddleHeaderAvatar:s=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",n=".avatar-media";break;case a.TQ.SettingsAvatar:s="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ProfileAvatar:s="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case a.TQ.ChannelAvatar:case a.TQ.SuggestedAvatar:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=".Avatar img";break;case a.TQ.StarsTransaction:s=".transaction-media-preview",n=0===i?`.stars-transaction-media-${i} :is(img, video)`:void 0;break;case a.TQ.SponsoredMessage:s=".Transition_slide-active > .MessageList .sponsored-media-preview",n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`;break;case a.TQ.ScheduledInline:case a.TQ.Inline:default:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=`${o.KFG} .full-media,${o.KFG} .thumbnail:not(.blurred-bg)`}const r=document.querySelector(s),c=n?r?.querySelectorAll(n):void 0;return{container:r,mediaEl:c?.[0]}}function P(e,t){switch(t){case a.TQ.Album:case a.TQ.ScheduledAlbum:case a.TQ.Inline:case a.TQ.ScheduledInline:case a.TQ.StarsTransaction:case a.TQ.PreviewMedia:e.classList.add("rounded-corners");break;case a.TQ.SharedMedia:case a.TQ.SettingsAvatar:case a.TQ.ProfileAvatar:case a.TQ.SearchResult:e.firstChild.style.objectFit="cover";break;case a.TQ.MiddleHeaderAvatar:case a.TQ.SuggestedAvatar:case a.TQ.ChannelAvatar:e.classList.add("circle")}}var Y=i(43874),F=i(82117),D=i(37661),M=i(30857),T=i(17712),B=i(59030),L=i(41733),R=i(22237);const x=(0,R.n5)(!1),E=x[1],V=x;function _(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function U(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){o.Oig&&console.log("[MV] PictureInPicture Error",e)}}var O=i(29886),K=i(73767),J=i(34780),G=i(23174),j=i(32587),z=i(87679);const H=new Map;var $=i(35297);var q=i(62587),W=i(69419);const Q=g.cf,Z=({media:e,isAvatar:t,origin:i,delay:n})=>{const o=t&&"photo"===e?.mediaType&&!e.isVideo,r=t&&"photo"===e?.mediaType&&e.isVideo,c="document"===e?.mediaType,d="video"===e?.mediaType&&!e.isRound||c&&(0,l.hr)(e),h="photo"===e?.mediaType||c&&(0,l.Ml)(e),m="video"===e?.mediaType&&e.isGif,u=i===a.TQ.SharedMedia,p=i===a.TQ.SearchResult,v=e&&(0,l.JU)(e),A=(0,s.Kr)(()=>t=>{if(e)return!o&&!r||t?r&&t?(0,l.Pg)(e):(0,l.VO)(e,t?"full":"preview"):(0,l.mU)(e)},[r,o,e]),f=(0,q.A)(e&&(u||p||c)&&(0,l.VO)(e,"pictogram"),void 0,G.qZ.BlobUrl,n),C=A(),b=(0,q.A)(C,void 0,G.qZ.BlobUrl,n),{mediaData:y,loadProgress:S}=(0,W.A)(A(!0),void 0,e&&(0,l.Cz)(e,"full"),n),N=e&&"blobUrl"in e?e.blobUrl:void 0;let k=!d&&(N||y)||b||f;const w=function(e){const t=(0,s.li)();let i=!1;(0,$.A)(()=>{if(i=!0,t.current=void 0,!e)return;const s=new Image;if(s.src=e,!s.width)return;const n=(0,z.PR)(s);(0,j.A)(n.getContext("2d"),0,0,n.width,n.height,2,2),t.current=n.toDataURL()},[e]);const n=function(e,t=!1,i){const n=(0,s.li)(e?H.get(e):void 0),a=(0,s.li)(),o=(0,M.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,z.PR)(s);(0,j.A)(t.getContext("2d"),0,0,t.width,t.height,2,2);const i=t.toDataURL();n.current=i,o(),H.size>=1e3&&H.clear(),H.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}(!k&&e&&(0,l.VD)(e));k||i===a.TQ.SearchResult||(k=w),r&&b&&(k=b);const I=N||y||(r||d?void 0:b||f||k),P=e&&(0,l.si)(e),Y=(0,s.Kr)(()=>t?r?g._e:g.cf:c?e.mediaSize||Q:h?(0,l.Xn)(e):d?(0,l.NZ)(e):Q,[t,c,h,d,r,e]);return{getMediaHash:A,media:e,isVideo:d,isPhoto:h,isGif:m,isDocument:c,bestImageData:k,bestData:I,dimensions:Y,contentType:v,isVideoAvatar:r,loadProgress:S,mediaSize:P}};var X=i(64493),ee=i(40664),te=i(22337),ie=i(1087),se=i(20021);const ne=(0,s.ph)(({isOpen:e,peerId:t,photo:i,onClose:a,onCloseAnimationEnd:o})=>{const{reportProfilePhoto:r}=(0,n.ko)(),[l,c]=(0,s.J0)("spam"),[d,h]=(0,s.J0)(""),m=(0,T.A)(()=>{r({chatId:t,photo:i,reason:l,description:d}),a()}),u=(0,T.A)(e=>{c(e)}),p=(0,T.A)(e=>{h(e.target.value)}),v=(0,B.A)(),g=(0,s.Kr)(()=>[{value:"spam",label:v("lng_report_reason_spam")},{value:"violence",label:v("lng_report_reason_violence")},{value:"pornography",label:v("lng_report_reason_pornography")},{value:"childAbuse",label:v("lng_report_reason_child_abuse")},{value:"copyright",label:v("ReportPeer.ReasonCopyright")},{value:"illegalDrugs",label:"Illegal Drugs"},{value:"personalDetails",label:"Personal Details"},{value:"other",label:v("lng_report_reason_other")}],[v]);if(!t||!i)return;const A=v("ReportPeer.Report");return(0,se.FD)(te.A,{isOpen:e,onClose:a,onEnter:e?m:void 0,onCloseAnimationEnd:o,className:"narrow",title:A,children:[(0,se.Y)(ie.A,{className:"dialog-checkbox-group",name:"report-message",options:g,onChange:u,selected:l}),(0,se.Y)(ee.A,{label:v("lng_report_reason_description"),value:d,onChange:p}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m,children:v("lng_report_button")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:v("Cancel")})]})]})});var ae=i(26607),oe=i(41036);const[re,le]=(0,R.n5)(1);function ce(){return(0,s._W)(()=>{le(1)}),[re,le]}const de=(0,s.ph)(({isOpen:e,photo:t,profileId:i,onClose:a,onConfirm:o})=>{const{deleteProfilePhoto:r,deleteChatPhoto:l}=(0,n.ko)(),c=(0,s.hb)(()=>{o?.(),(0,v.L8)(i)?r({photo:t}):l({photo:t,chatId:i}),a()},[o,i,a,r,t,l]),d=(0,B.A)();return(0,se.Y)(te.A,{isOpen:e,onClose:a,onEnter:c,className:"delete dialog-buttons-column",title:d("AreYouSure"),children:(0,se.FD)("div",{className:"dialog-buttons mt-2",children:[(0,se.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:c,children:d("Preview.DeletePhoto")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:d("Cancel")})]})})});var he=i(18276),me=i(22699),ue=i(24433),pe=i(35913);const ve=(0,s.ph)((0,n.EK)((e,{item:t,canUpdateMedia:i})=>{const s=(0,c.nTw)(e),{origin:n}=s.mediaViewer,a="message"===t?.type?t.message:void 0,o="avatar"===t?.type?t.avatarOwner:void 0,r="avatar"===t?.type&&t.profilePhotos.photos[t.mediaIndex],l=(0,c.meB)(e),d=(0,c.Xf0)(e),{threadId:h}=(0,c.Xf0)(e)||{},m=(0,c.ynf)(e,a),u=(0,c.yuw)(e),p=a&&(0,c.ryq)(e,a?.chatId),{canDelete:v}=h&&a&&(0,c.WAX)(e,a,h)||{},g=r&&r.id===o?.avatarPhotoId,A=i&&Boolean(r),f=v||A,b=i&&Boolean(r)&&!g,y=d?.type;return{activeDownloads:u,isProtected:m,chat:l,isChatProtected:p,canDelete:f,canUpdate:b,messageListType:y,origin:n,viewableMedia:C(e,0,t)}})(({item:e,mediaData:t,isVideo:i,chat:a,isChatProtected:o,isProtected:r,canReportAvatar:c,canDelete:d,canUpdate:h,messageListType:m,activeDownloads:u,origin:p,viewableMedia:g,onReportAvatar:A,onCloseMediaViewer:f,onBeforeDelete:C,onForward:b})=>{const[y,S,N]=(0,D.A)(!1),[k,w]=ce(),{isMobile:I}=(0,Y.Ay)(),{downloadMedia:P,cancelMediaDownload:F,updateProfilePhoto:M,updateChatPhoto:L,openMediaViewer:R,openDeleteMessageModal:x}=(0,n.ko)(),E="message"===e?.type,{media:V}=g||{},_=V&&(0,l.sd)(V),U=V&&(0,l.$r)(u,V),{loadProgress:O}=(0,W.A)(V&&(0,l.VO)(V,"download"),!U,V&&(0,l.Cz)(V,"download")),K=(0,T.A)(()=>{if(V)if(U)F({media:V});else{const t="message"===e?.type?e.message:void 0;P({media:V,originMessage:t})}}),J=(0,T.A)(()=>{const e=k();w((e<0?e:0)-1)}),G=(0,T.A)(()=>{const e=k();w((e>0?e:0)+1)}),j=(0,T.A)(()=>{if("avatar"!==e?.type)return;const{avatarOwner:t,profilePhotos:i,mediaIndex:s}=e,n=i?.photos[s];(0,v.L8)(t.id)?M({photo:n}):L({chatId:t.id,photo:n}),R({origin:p,chatId:t.id,mediaIndex:0,isAvatarView:!0},{forceOnHeavyAnimation:!0})}),z=(0,B.A)(),H=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions",iconName:"more"}),[]);function $(){return"avatar"===e?.type?(0,se.Y)(de,{isOpen:y,onClose:N,onConfirm:C,profileId:e.avatarOwner.id,photo:e.profilePhotos.photos[e.mediaIndex]}):void 0}const q=(0,T.A)(()=>{"message"===e?.type&&a?x({chatId:a?.id,messageIds:[e.message.id],isSchedule:"scheduled"===m,onConfirm:C}):S()});if(I){const s=[];if(E&&e.message.isForwardingAllowed&&!e.message.content.action&&!o&&s.push({icon:"forward",onClick:b,children:z("Forward")}),r||(i?s.push({icon:U?"close":"download",onClick:K,children:U?`${Math.round(100*O)}% Downloading...`:"Download"}):s.push({icon:"download",href:t,download:_,children:z("AccActionDownload")})),c&&s.push({icon:"flag",onClick:A,children:z("ReportPeer.Report")}),h&&s.push({icon:"copy-media",onClick:j,children:z("ProfilePhoto.SetMainPhoto")}),d&&s.push({icon:"delete",onClick:q,children:z("Delete"),destructive:!0}),0===s.length)return;return(0,se.FD)("div",{className:"MediaViewerActions-mobile",children:[(0,se.Y)(me.A,{trigger:H,positionX:"right",children:s.map(({icon:e,onClick:t,href:i,download:s,children:n,destructive:a})=>(0,se.Y)(ue.A,{icon:e,href:i,download:s,onClick:t,destructive:a,children:n},e))}),U&&(0,se.Y)(pe.A,{progress:O,size:"s",noCross:!0}),d&&$()]})}return(0,se.FD)("div",{className:"MediaViewerActions",children:[E&&e.message.isForwardingAllowed&&!o&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Forward"),onClick:b,iconName:"forward"}),function(){if(!r&&"standalone"!==e?.type)return"sponsoredMessage"!==e?.type&&(i?(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("AccActionDownload"),onClick:K,children:U?(0,se.Y)(pe.A,{progress:O,size:"s",onClick:K}):(0,se.Y)(he.A,{name:"download"})}):(0,se.Y)(X.A,{href:t,download:_,round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("AccActionDownload"),iconName:"download"}))}(),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("MediaZoomOut"),onClick:J,iconName:"zoom-out"}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("MediaZoomIn"),onClick:G,iconName:"zoom-in"}),c&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z(i?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:A,iconName:"flag"}),h&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("ProfilePhoto.SetMainPhoto"),onClick:j,iconName:"copy-media"}),d&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Delete"),onClick:q,iconName:"delete"}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:z("Close"),onClick:f,iconName:"close"}),d&&$()]})}));var ge=i(87357),Ae=i(50442),fe=i(43336),Ce=i(37836),be=i(14737),ye=i(16581),Se=i(19129),Ne=i(26072),ke=i(15283);function we(e){const t=(0,s.li)(e());return(0,ke.A)(()=>e.subscribe(()=>{t.current=e()})),t}var Ie=i(90423),Pe=i(39751),Ye=i(83414);const[Fe,De]=(0,R.n5)(!1),[Me,Te]=(0,R.n5)(!1);function Be(){return[(0,Ye.A)(()=>Fe()&&!Me(),[Fe,Me]),De,Te]}var Le=i(56494);const[Re,xe]=(0,R.n5)(0);function Ee(){return(0,s._W)(()=>{xe(0)}),[Re,xe]}var Ve=i(5718),_e=i(672),Ue=i(97422);const Oe=({text:e="",buttonText:t,isForVideo:i,onClick:n,handleSponsoredClick:a,isProtected:o,isForceMobileVersion:r})=>{const[l,c]=(0,s.J0)(!1),{isMobile:d}=(0,Y.Ay)(),[h]=Be(),u=(0,Se.A)(()=>!!m.TF&&!h(),[h]);(0,s.vJ)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;c(t>2*g.$)};t();const i=(0,Ce.nF)(t,500,!0);return window.addEventListener("resize",i,!1),()=>{window.removeEventListener("resize",i,!1)}},[]);const p=(0,T.A)(()=>{a()}),v=(0,ge.A)("MediaViewerFooter",i&&"is-for-video",u&&"is-hidden",o&&"is-protected",r&&"mobile");return(0,se.FD)("div",{className:v,onClick:function(t){e&&t.stopPropagation()},children:[Boolean(e)&&(0,se.Y)("div",{className:"media-viewer-footer-content",onClick:d?void 0:n,children:(0,se.Y)("p",{className:"media-text custom-scroll allow-selection "+(l?"multiline":""),dir:"auto",children:e})}),Boolean(t)&&(0,se.Y)(X.A,{className:(0,ge.A)("media-viewer-footer-content","media-viewer-button"),size:"default",color:"primary",isRectangular:!0,onClick:p,children:t})]})};var Ke=i(15640),Je=i(84313),Ge=i(71533),je=i(50680),ze=i(73622);const[He,$e]=(0,R.n5)(!1);function qe(){return(0,s._W)(()=>{$e(!1)}),[He,$e]}var We=i(58744),Qe=i(70832),Ze=i(71429),Xe=i(82497),et=i(61433),tt=i(95807);class it{constructor(e){const[t,i,s,...n]=e.split("\n"),a=Number.parseFloat(i.split("=")[1]),o=Number.parseFloat(s.split("=")[1]);if(Number.isNaN(a)||Number.isNaN(o))throw new Error("Invalid storyboard map frame size");if(this.frames=n.map(e=>{if(!e.trim().length)return;const[t,i,s]=e.split(","),n={time:Number.parseFloat(t),left:Number.parseInt(i,10),top:Number.parseInt(s,10),width:a,height:o};if(Number.isNaN(n.time)||Number.isNaN(n.left)||Number.isNaN(n.top))throw new Error("Invalid storyboard map data");return n}).filter(Boolean),0===this.frames.length)throw new Error("Missing frames in storyboard map data")}getNearestPreview(e){let t=0,i=this.frames.length-1;for(;t<=i;){const s=Math.floor((t+i)/2);this.frames[s].time<=e?t=s+1:i=s-1}return this.frames[Math.max(0,t-1)]}}var st=i(63988);const nt="Od9ZSc1U";let at;const ot=(0,s.ph)(({storyboardInfo:e,duration:t,bufferedRanges:i,isReady:n,playbackRate:a,isActive:c,isPlaying:d,onSeek:h,onSeekStart:u})=>{const p=(0,s.li)(),[v]=Ee(),[g]=qe(),A=(0,st.aG)(v,250),[f,C]=(0,s.Ul)(A()),[y,S]=(0,s.Ul)(0),[N,k]=(0,s.Ul)(0),w=(0,s.li)(!1),[I,P]=(0,s.J0)(!1),[Y,F]=(0,s.J0)(!1),D=(0,s.li)(),M=(0,s.li)(),B=(0,s.li)(),L=(0,s.li)(),R=(0,s.li)(),x=e&&(0,l.mr)(e.storyboardFile,"full"),E=e&&(0,l.mr)(e.storyboardMapFile,"full"),V=(0,q.A)(x,!n),_=(0,q.A)(E,!n,G.qZ.Text);(0,s.vJ)(()=>{P(!1)},[c]),(0,s.vJ)(()=>{if(_)try{R.current=new it(_)}catch(e){o.Oig&&console.error("Error parsing storyboard map data",e,_)}},[_]);const U=(0,T.A)(e=>{const t=D.current;if(!R.current||!t)return;const i=R.current.getNearestPreview(e);k(Math.floor(i.time)),(0,r.RK)(()=>{(0,et.Tv)(t,{backgroundPosition:`${-i.left}px ${-i.top}px`})})});return(0,s.vJ)(()=>{if(at&&at(),at=void 0,!w.current&&!Y){const e=A(),i=t-e;at=(0,b.Hd)({from:e,to:t,duration:1e3*i/a,onUpdate:C})}},[A,Y,C,a,t]),(0,s.vJ)(()=>{d&&!g()||(at&&at(),at=void 0)},[d,f,g]),(0,s.vJ)(()=>{if(d){at&&at(),at=void 0;const e=A(),i=t-e;at=(0,b.Hd)({from:e,to:t,duration:1e3*i/a,onUpdate:C})}},[d,a,t]),(0,s.Nf)(()=>{if(!B.current)return;const e=(0,fe.LI)(f()/t*100,2);B.current.style.width=`${e}%`},[f,t]),(0,s.Nf)(()=>{M.current&&(M.current.style.left=`${y()}px`)},[y]),(0,s.Nf)(()=>{L.current&&(L.current.innerText=(0,We.QO)(N()))},[N]),(0,s.vJ)(()=>{if(!p.current||!c)return;const i=p.current;let s=i.getBoundingClientRect(),n=0,a=0;const o=n=>{const a=(0,Ke.A)(n).x,o=(0,fe.qE)(t*((a-s.left)/s.width),0,t);if(!e)return[o,0];s.width||(s=i.getBoundingClientRect());const r=M.current;return[o,(0,fe.qE)(a-s.left-r.clientWidth/2,-4,s.width-r.clientWidth+4)]},r=()=>{at&&at(),at=void 0},l=()=>{r(),w.current=!0,P(!1),F(!1),C(n),h(n),setTimeout(()=>{w.current=!1},250)},d=(0,Ae.wJ)(i,{onCapture:()=>{r(),P(!0),F(!0),u()},onRelease:l,onClick:l,onDrag:e=>{r(),P(!0),[n,a]=o(e),U(n),S(a),C(n)}});if(m.TF)return d;const v=e=>{P(!0),[n,a]=o(e),S(a),U(n)},g=()=>{P(!1)};return i.addEventListener("mousemove",v),i.addEventListener("mouseenter",v),i.addEventListener("mouseleave",g),()=>{d(),i.removeEventListener("mousemove",v),i.removeEventListener("mouseenter",v),i.removeEventListener("mouseleave",g)}},[t,U,c,h,u,S,C,F,I,a,e]),(0,se.FD)("div",{className:"ingarEvU",ref:p,children:[e&&(0,se.FD)(ae.A,{isOpen:!0,isHidden:!I,className:"TqpEWfl3",style:`width: ${e.frameSize.width}px; height: ${e.frameSize.height}px`,ref:M,children:[(0,se.Y)("div",{ref:D,style:(0,tt.A)(`background-image: url(${V});`),className:"k3Ytd13f"}),(0,se.Y)("div",{className:"bGiNvx5D",children:(0,se.Y)("span",{className:"mnkqvOMR",ref:L})})]}),(0,se.Y)("div",{className:nt,children:i.map(({start:e,end:t})=>(0,se.Y)("div",{className:"ANe2DKfp",style:`left: ${100*e}%; right: ${100-100*t}%`},`${e}-${t}`))}),(0,se.Y)("div",{className:nt,children:(0,se.Y)("div",{ref:B,className:(0,ge.A)("igaGLblf",Y&&"beUP6SqY")})})]})}),rt=e=>{e.stopPropagation()},lt=[.5,1,1.5,2];function ct(e,t){return(0,se.Y)("div",{className:"player-time",children:`${(0,We.QO)(e)} / ${(0,We.QO)(t)}`})}const dt=(0,s.ph)(({storyboardInfo:e,bufferedRanges:t,bufferedProgress:i,duration:n,isReady:a,fileSize:o,isForceMobileVersion:r,isPlaying:l,isFullscreenSupported:c,isFullscreen:d,isBuffered:h,volume:u,isMuted:p,playbackRate:v,isPictureInPictureSupported:g,onChangeFullscreen:A,onVolumeClick:f,onVolumeChange:C,onPlaybackRateChange:b,onPictureInPictureChange:y,onPlayPause:S,onSeek:N,onSeekingChange:k})=>{const[w,I,P]=(0,D.A)(),[F]=Ee(),M=(0,Se.A)(()=>Math.trunc(F()),[F]),[L,R]=(0,s.Ul)(!1),x=(0,s.li)(),{isMobile:E}=(0,Y.Ay)(),[V,_]=Be(),U=(0,Se.A)(V);(0,s.vJ)(()=>{if(m.TF||r){if(U&&l&&!w&&!L())return x.current=window.setTimeout(()=>{_(!1)},3e3),()=>{x.current&&window.clearTimeout(x.current)};x.current&&window.clearTimeout(x.current)}},[l,U,_,w,L,r]),(0,s.Nf)(()=>(U?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[U]),(0,s.vJ)(()=>{U||P()},[P,U]);const O=(0,B.A)(),K=(0,T.A)(e=>{R(!1),N(e),k(!1)}),J=(0,T.A)(()=>{R(!0),k(!0)}),G=(0,s.Kr)(()=>0===u||p?"muted":u<.3?"volume-1":u<.6?"volume-2":"volume-3",[u,p]);return(0,se.FD)("div",{className:(0,ge.A)("VideoPlayerControls",r&&"mobile",U&&"active"),onClick:rt,children:[(0,se.Y)(ot,{storyboardInfo:e,duration:n,isReady:a,isPlaying:l,bufferedRanges:t,playbackRate:v,onSeek:K,onSeekStart:J,isActive:U}),(0,se.FD)("div",{className:"buttons",children:[(0,se.Y)(X.A,{ariaLabel:O("AccActionPlay"),size:"tiny",ripple:!E,color:"translucent-white",className:"play",round:!0,onClick:S,iconName:l?"pause":"play"}),(0,se.Y)(X.A,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:f,iconName:G}),!m.pz&&(0,se.Y)(Xe.A,{bold:!0,className:"volume-slider",value:p?0:100*u,onChange:C}),ct(M,n),!h&&(0,se.Y)("div",{className:"player-file-size",children:(0,se.Y)(Qe.A,{size:o,progress:i})}),(0,se.Y)("div",{className:"spacer"}),(0,se.Y)(X.A,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:I,children:`${v}x`}),g&&(0,se.Y)(X.A,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:y,iconName:"pip"}),c&&(0,se.Y)(X.A,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:A,iconName:d?"smallscreen":"fullscreen"})]}),(0,se.Y)(Ze.A,{isOpen:w,className:(0,ge.A)("playback-rate-menu",!c&&"no-fullscreen",!g&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:P,children:lt.map(e=>(0,se.Y)(ue.A,{disabled:v===e,onClick:()=>b(e),children:`${e}x`}))})]})}),ht=(0,s.ph)(({url:e,storyboardInfo:t,isGif:i,posterData:a,posterSize:r,loadProgress:l,fileSize:c,isMediaViewerOpen:d,noPlay:h,volume:u,isMuted:p,playbackRate:v,isForceMobileVersion:g,shouldCloseOnClick:A,isProtected:f,isClickDisabled:C,isSponsoredMessage:b,timestamp:S,handleSponsoredClick:N,onClose:k})=>{const{setMediaViewerVolume:w,setMediaViewerMuted:I,setMediaViewerPlaybackRate:P,setMediaViewerHidden:F}=(0,n.ko)(),D=(0,s.li)(),[M,B]=(0,s.J0)(!m.TF||!m.pz),[R,x,V]=(0,Ie.Ay)(D,B),{isMobile:O}=(0,Y.Ay)(),K=D.current?.duration||0,J=i||K<=30,G=(0,T.A)(()=>{m.Nd||F({isHidden:!0})}),j=(0,T.A)(()=>{m.Nd||F({isHidden:!1})}),[z,H,$]=function(e,t,i){const[n,a]=(0,s.J0)(!1),[r,l]=(0,s.J0)(!1);(0,s.Nf)(()=>{if(m.pz&&m._7||!e.current)return;const s=e.current,n=_(s);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===n)return;s.autoPictureInPicture=!0,a(!0);const o=()=>{t(),l(!0),E(!0)},r=()=>{E(!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.current);t?t("inline"):U()},[e]),d=(0,s.hb)(()=>{if(!e.current)return;c();const t=e.current,i=(0,L.e)(t),s=_(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,L.A)(t)},[e,c]);return n?[n,d,r]:[!1]}(D,G,j),[,q,W]=Be(),[Q,Z]=(0,s.Ul)(!1),ee=(0,s.li)({x:0,y:0});(0,s.vJ)(()=>{const e=e=>{ee.current=(0,Ke.A)(e)};return window.addEventListener("mousemove",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}},[]);const te=(0,T.A)((e,t)=>{const i=D.current?.getBoundingClientRect();i&&(e<=i.left||e>=i.right||t<=i.top||t>=i.bottom)&&(Q()||q(!1))}),ie=(0,T.A)(()=>{q(!0)}),ne=(0,T.A)(e=>{te(e.clientX,e.clientY)}),ae=(0,T.A)(e=>{if(Z(e),!e){const{x:e,y:t}=ee.current;te(e,t)}}),{isReady:oe,isBuffered:re,bufferedRanges:le,bufferingHandlers:ce,bufferedProgress:de}=(0,Ge.A)(),he=(0,Je.A)(D,void 0,!e),{shouldRender:me,transitionClassNames:ue}=(0,je.A)(!re&&!he,void 0,void 0,"slow"),{shouldRender:ve,transitionClassNames:ge}=(0,je.A)(m.pz&&!M&&!me&&!he,void 0,void 0,"slow"),[,Ae]=Ee(),[,Ce]=qe();(0,s.vJ)(()=>{W(me)},[W,me]),(0,s.vJ)(()=>{h||!d||he?D.current.pause():e&&!m.TF&&(0,L.A)(D.current)},[h,d,e,I,he]),(0,s.vJ)(()=>{D.current.volume=u},[u]),(0,s.vJ)(()=>{D.current.playbackRate=v},[v]),(0,s.vJ)(()=>{S&&(D.current.currentTime=S,Ae(S))},[Ae,S]);const be=(0,T.A)(e=>{e.stopPropagation(),M?(D.current.pause(),B(!1)):((0,L.A)(D.current),B(!0))}),ye=(0,T.A)(e=>{b&&(N?.(!0),k(e)),C||(A?k(e):be(e))});(0,ze.A)(D,ce);const Se=(0,T.A)(e=>{const t=e.currentTarget;t.readyState>=4&&(Ce(!1),Ae(t.currentTime)),J||t.currentTime!==t.duration||(Ae(0),B(!1))}),Ne=(0,T.A)(()=>{J||(Ae(0),B(!1),q(!0))}),ke=(0,T.A)(()=>{R&&V?V():!R&&x&&x()}),we=(0,T.A)(e=>{D.current.currentTime=e}),Pe=(0,T.A)(e=>{w({volume:e/100})}),Ye=(0,T.A)(()=>{D.current.muted=!D.current.muted,I({isMuted:!p})}),Fe=(0,T.A)(e=>{P({playbackRate:e})});(0,s.vJ)(()=>{if(!d)return;const e=e=>{if(!R)return;const t=D.current,i=(0,fe.qE)(t.currentTime+5*e,0,t.duration);Number.isFinite(i)&&(t.currentTime=i)},t=t=>{if(!$)switch(t.key){case" ":case"Enter":t.preventDefault(),be(t);break;case"Left":case"ArrowLeft":t.preventDefault(),e(-1);break;case"Right":case"ArrowRight":t.preventDefault(),e(1)}};return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}},[be,d,R,$]);const De=r&&`width: ${r.width}px; height: ${r.height}px`,Me=`background-image: url(${a})`,Te=!m.TF&&!g;return(0,se.FD)("div",{className:"VideoPlayer",onMouseMove:Te?ie:void 0,onMouseLeave:Te?ne:void 0,children:[(0,se.FD)("div",{style:De,children:[f&&(0,se.Y)("div",{onContextMenu:y.A,onDoubleClick:m.TF?void 0:ke,onClick:O?void 0:be,className:"protector"}),(0,se.Y)("video",{ref:D,autoPlay:m.TF,controlsList:"nodownload",playsInline:!0,loop:J,muted:i||p,id:"media-viewer-video",style:Me,onWaiting:()=>Ce(!0),onPlay:()=>B(!0),onEnded:Ne,onClick:O||R?void 0:ye,onDoubleClick:m.TF?void 0:ke,...ce,onPause:e=>{B(!1),ce.onPause(e)},onTimeUpdate:Se,src:e})]}),ve&&(0,se.Y)(X.A,{round:!0,className:`play-button ${ge}`,onClick:be,iconName:"play"}),me&&(0,se.FD)("div",{className:["spinner-container",ue].join(" "),children:[!re&&(0,se.Y)("div",{className:"buffering",children:"Buffering..."}),(0,se.Y)(pe.A,{size:"xl",progress:re?1:l,onClick:k})]}),!i&&!b&&!he&&(0,se.Y)(dt,{storyboardInfo:t,isPlaying:M,bufferedRanges:le,bufferedProgress:de,isBuffered:re,isFullscreenSupported:Boolean(x),isPictureInPictureSupported:z,isFullscreen:R,fileSize:c,duration:K,isReady:oe,isForceMobileVersion:g,onSeek:we,onChangeFullscreen:ke,onPictureInPictureChange:H,onPlayPause:be,volume:u,playbackRate:v,isMuted:p,onVolumeClick:Ye,onVolumeChange:Pe,onPlaybackRateChange:Fe,onSeekingChange:ae})]})}),mt=(0,s.ph)((0,n.EK)((e,{item:t})=>{const{volume:i,isMuted:s,playbackRate:n,isHidden:a,origin:o,timestamp:r,threadId:l}=(0,c.nTw)(e).mediaViewer,d="message"===t.type?t.message:void 0,h="sponsoredMessage"===t.type?t.message:void 0,m=d||h,u=C(e,0,t),p=d&&(0,Le.me)(e,d,!0);return{origin:o,textMessage:m,isProtected:d&&(0,c.ynf)(e,d),volume:i,isMuted:s,isHidden:a,playbackRate:n,threadId:l,timestamp:r,maxTimestamp:p,viewableMedia:u}})(({item:e,viewableMedia:t,isActive:i,textMessage:s,origin:a,withAnimation:r,isProtected:l,volume:c,playbackRate:d,isMuted:h,isHidden:u,isMoving:p,threadId:v,timestamp:f,maxTimestamp:C,onClose:b,onFooterClick:y,handleSponsoredClick:S})=>{const{updateLastPlaybackTimestamp:N}=(0,n.ko)(),k=(0,B.A)(),w="avatar"===e.type,I="sponsoredMessage"===e.type,{media:P}=t||{},{isVideo:F,isPhoto:D,bestImageData:M,bestData:L,dimensions:R,isGif:x,isVideoAvatar:E,mediaSize:V,loadProgress:_}=Z({media:P,isAvatar:w,origin:a,delay:!!r&&350}),[,U]=Be(),[O]=Ee(),K=Boolean(P),{isMobile:J}=(0,Y.Ay)(),G=(0,T.A)(()=>{U(!0)}),j=(0,_e.A)(()=>{if(!i||!s||"video"!==P?.mediaType)return;if(P.duration<o.u4b)return;const e="id"in s?s:void 0,t=O();if(!t||!e||e.isInAlbum)return;const n=P.duration-t>1?t:void 0;N({chatId:e.chatId,messageId:e.id,timestamp:n})},[O,i,P,s],1e3);if((0,Ve.R)(j,[O]),!P)return;if("avatar"===e.type)return E?(0,se.Y)("div",{className:"MediaViewerContent",children:(0,se.Y)(ht,{url:L,isGif:!0,posterData:M,posterSize:(0,g.sk)(R,!1,!0),loadProgress:_,fileSize:V,isMediaViewerOpen:K&&i,isProtected:l,noPlay:!i,onClose:b,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:p,playbackRate:1,isSponsoredMessage:I,handleSponsoredClick:S},P.id)},P.id):(0,se.Y)("div",{className:"MediaViewerContent",children:ut(L,(0,g.sk)(R,!1),!J&&!l,l)},P.id);const z=s&&(s.content.action?"suggestProfilePhoto"===s.content.action.type?k("Conversation.SuggestedPhotoTitle"):void 0:(0,A.V)({message:s,maxTimestamp:C,threadId:v,forcePlayback:!0,isForMediaViewer:!0})),H=s&&"buttonText"in s?s.buttonText:void 0,$=Boolean(z),q=(0,g.sk)(R,$,F),W=J||function(e){return!!e&&e.width<350}(q);return(0,se.FD)("div",{className:(0,ge.A)("MediaViewerContent",$&&"has-footer"),onMouseMove:W&&!m.TF?G:void 0,children:[D&&ut(L,q,!J&&!l,l),F&&(i?(0,se.Y)(ht,{url:L,storyboardInfo:"storyboardInfo"in P?P.storyboardInfo:void 0,isGif:x,posterData:M,posterSize:q,loadProgress:_,fileSize:V,isMediaViewerOpen:K&&i,noPlay:!i,onClose:b,isMuted:h,isHidden:u,isForceMobileVersion:W,isProtected:l,volume:c,isClickDisabled:p,playbackRate:d,isSponsoredMessage:I,handleSponsoredClick:S,timestamp:f},P.id):pt(M,q,!J&&!l,l)),z&&(0,se.Y)(Oe,{text:z,buttonText:H,onClick:y,isProtected:l,isForceMobileVersion:W,isForVideo:F&&!x,handleSponsoredClick:S})]})}));function ut(e,t,i,s){return e?(0,se.FD)("div",{style:"position: relative;",children:[s&&(0,se.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,se.Y)("img",{src:e,alt:"",className:(0,ge.A)(s&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(i)})]}):(0,se.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,se.Y)(Ue.A,{color:"white"})})}function pt(e,t,i,s){const n=t&&`width: ${t.width}px; height: ${t.height}px`,a=`background-image: url(${e})`;return e?(0,se.FD)("div",{className:"VideoPlayer",children:[s&&(0,se.Y)("div",{onContextMenu:y.A,className:"protector"}),(0,se.Y)("div",{style:n,children:(0,se.Y)("video",{style:a,className:(0,ge.A)(s&&"is-protected"),draggable:Boolean(i)})})]}):(0,se.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,se.Y)(Ue.A,{color:"white"})})}const{easeOutCubic:vt,easeOutQuart:gt}=b.qM,At=m.TF?40:0,ft=350;let Ct,bt;var yt=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(yt||{});const St=(0,s.ph)(({item:e,isVideo:t,isGif:i,isOpen:n,withAnimation:a,isHidden:o,isLoadingMoreMedia:r,isSynced:l,loadMoreItemsIfNeeded:c,getNextItem:d,selectItem:h,onClose:u,onFooterClick:p,handleSponsoredClick:v})=>{const g=(0,s.li)(),A=(0,s.li)(),f=(0,s.li)(),C=(0,s.li)(),y=(0,s.li)({x:0,y:0,scale:1}),S=(0,s.li)(void 0),N=(0,s.li)(void 0),k=(0,s.li)(!1),[w,I]=(0,s.J0)(!0),[P]=ce(),Y=(0,s.li)(P()),F=(0,Ie.zk)(),[D,M]=(0,s.J0)(!1),[L,R]=(0,s.Ul)({x:0,y:0,scale:1}),x=we(L),[E,V]=(0,s.Ul)(e),_=we(E),U=(0,Se.A)(()=>1!==L().scale,[L]),O=(0,Se.A)(E),{height:K,width:J,isResizing:G}=(0,Pe.A)(),[j,z,H]=Be(),$=(0,B.A)();(0,Ne.A)({isActive:n,onBack:u,shouldBeReplaced:!0});const q=(0,ye.A)(h,[h],350,!0),W=(0,ye.A)(()=>{S.current=void 0},[],500,!0),Q=(0,ye.A)(e=>I(e),[],800,!0),Z=Boolean(i&&!m.pz),X=m.TF?40:J/10,ee=(0,T.A)(e=>{if(!m.TF)return;const t=K-e.pageY<80;!t&&e.pageX<X||!t&&e.pageX>J-X||z(!j())});(0,be.A)(()=>z(!0),ft),(0,s.vJ)(()=>{const{scale:t,x:i,y:s}=x.current;0===i&&0===s&&1===t&&V(e)},[e,V,x]),(0,s.vJ)(()=>{l&&O&&!r&&c(O)},[O,c,l,r]),(0,s.Nf)(()=>{const{x:e,y:t,scale:i}=L();H(1!==i),f.current&&(f.current.style.transform=Nt(-J+e-At)),A.current&&(A.current.style.transform=Nt(e,t,i)),C.current&&(C.current.style.transform=Nt(J+e+At))},[L,H,J]),(0,s.vJ)(()=>{if(!g.current||void 0===_.current||o||F)return;let e=y.current;const t={x:0,y:0},i={x:0,y:0},s={x:0,y:0};let n,r=Date.now();const l=(0,Ce.sg)(()=>{r=Date.now()},500,!1,!0),c=t=>{const i=_.current;if(void 0===i)return!1;const s=d(i,t);if(void 0!==s){const i=(J+At)*t,n=x.current.x+i;return I(!1),V(s),q(s),Q(!0),e={x:0,y:0,scale:1},a?(Ct=(0,b.Hd)({from:n,to:0,duration:ft,timing:vt,onUpdate:e=>R({y:0,x:e,scale:1})}),!0):(R(e),!0)}return!1},h=e=>{const{scale:t}=x.current;if(1!==t)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let i=0;return K-e.pageY<80?[!1,!1]:(e.pageX<X?i=-1:e.pageX>J-X&&(i=1),[0!==i,c(i)])},p=e=>{const{scale:t}=x.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},v=({x:e,y:t,scale:i},s=0)=>{const n=N.current;if(!n)return[{x:e,y:t,scale:i},!0,!0];let a=!0,o=!0;const r=(J-J*i)/2,l=(K-K*i)/2,c=Math.max(-n.left*i,r),d=J-n.right*i;a=(0,fe.Bt)(e,d,c),e=(0,fe.qE)(e,d,c);const h=Math.max(-n.top*i+s,l),m=K-n.bottom*i;return o=(0,fe.Bt)(t,m,h),[{x:e,y:t=(0,fe.qE)(t,m,h),scale:i},a,o]},f=n=>{if(k.current)return void(k.current=!1);"mouseup"===n.type&&M(!1);const a=x.current,{y:o,scale:l}=a;let c=a.x;const h=Math.abs(c),m=Math.abs(o);if(W(),Q(!0),l<1)return e={x:0,y:0,scale:1},void(Ct=(0,b.Hd)({from:[c,o,l],to:[0,0,1],duration:ft,timing:vt,onUpdate:e=>R({x:e[0],y:e[1],scale:e[2]})}));if(l>1){const a=Math.min(l,4),d=a/l;let h=c*d+(i.x-d*i.x),m=o*d+(i.y-d*i.y);const u=.15;if("wheel"!==n.type&&e.scale===l){const e=Math.abs(t.x)/(Date.now()-r),i=Math.abs(t.y)/(Date.now()-r);h-=Math.abs(t.x)*e*u*s.x,m-=Math.abs(t.y)*i*u*s.y}return[e]=v({x:h,y:m,scale:a},60),void(Ct=(0,b.Hd)({from:[c,o,l],to:[e.x,e.y,e.scale],duration:ft,timing:vt,onUpdate:e=>R({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:c,y:o,scale:l},m>=50)return void u();if(m>0)return void(Ct=(0,b.Hd)({from:o,to:0,duration:ft,timing:vt,onUpdate:e=>R({x:0,y:e,scale:l})}));const p=c<0?1:-1,g=_.current,A=g&&d(g,c<0?1:-1),f=s.x<0?-1:1;void 0!==A&&h>=50&&p===f&&(c+=(J+At)*p,V(A),q(A)),Ct=(0,b.Hd)({from:c,to:0,duration:ft,timing:vt,onUpdate:e=>R({y:0,x:e,scale:l??1})})},C=(0,Ae.wJ)(g.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls, .VideoPlayerControls",minZoom:1,maxZoom:4,doubleTapZoom:3,withWheelDrag:!0,onCapture:e=>{if(wt(e))return;const{x:t,y:i,scale:s}=x.current;if("mousedown"!==e.type||(M(!0),1===s)){if(r=Date.now(),0===t&&0===i&&1===s){if(!A.current)return;if(n=A.current.querySelector("img, video"),!n)return;N.current=n.getBoundingClientRect()}}else e.preventDefault()},onDrag:(i,n,{dragOffsetX:a,dragOffsetY:o},r)=>{if(k.current||wt(i))return;if(m.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=Ae.h6||e>=J-Ae.h6)return}Ct&&(Ct(),Ct=void 0),s.x=t.x-a,s.y=t.y-o,t.x=a,t.y=o;const c=Math.abs(a),d=Math.abs(o),{x:h,y:u,scale:p}=x.current;if(l(),1!==p){const t=e.x+a,s=e.y+o;if(["wheel","mousemove"].includes(i.type)){const[e,i,n]=v({x:t,y:s,scale:p},60);return r&&r(!i,!n),void R(e)}return void("touches"in i&&1===i.touches.length&&R({x:t,y:s,scale:p}))}if("mousemove"!==i.type){if(S.current!==yt.Vertical&&(S.current===yt.Horizontal||Math.abs(h)>Ae.no||c/d>Ae.fG)){S.current=yt.Horizontal,I(!1);const e=J+At,t=(0,fe.qE)(a,-e,e);return R({x:t,y:0,scale:p}),void("wheel"===i.type&&Math.abs(t)>100&&(f(i),k.current=!0))}if(S.current===yt.Vertical||Math.abs(u)>Ae.no||d/c>Ae.fG){S.current=yt.Vertical;const e=K,t=(0,fe.qE)(o,-e,e);R({x:0,y:t,scale:p}),"wheel"===i.type&&Math.abs(t)>100&&(f(i),k.current=!0)}}},onZoom:(t,{zoom:s,zoomFactor:n,initialCenterX:a,initialCenterY:o,dragOffsetX:r,dragOffsetY:l,currentCenterX:c,currentCenterY:d})=>{Ct&&Ct(),a=a||J/2,o=o||K/2,c=c||J/2,d=d||K/2;const h=s??(0,fe.qE)(e.scale*n,.5,12),m=h/e.scale,u=Math.abs(Math.min(e.x,0)),p=Math.abs(Math.min(e.y,0));i.x=c,i.y=d;const g=u+a,A=p+o,f=g-m*g,C=A-m*A,[b]=v({x:e.x+f+r,y:e.y+C+l,scale:h});R(b)},onClick(t){M(!1);const[i,s]=h(t);if(i){if(t.preventDefault(),t.stopPropagation(),m.TF)return;s||u()}else 1!==e.scale||m.TF||!Z&&kt(t.target,".VideoPlayer")||u()},onDoubleClick(t,{centerX:i,centerY:s}){const[n]=h(t);if(n)return t.preventDefault(),void t.stopPropagation();if(!m.TF&&"wheel"!==t.type)return;const{x:a,y:o,scale:r}=x.current;if(1===r){if(0!==a||0!==o)return;e=v({x:i-3*i,y:s-3*s,scale:3})[0]}else e={x:0,y:0,scale:1};Ct=(0,b.Hd)({from:[a,o,r],to:[e.x,e.y,e.scale],duration:ft,timing:vt,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};R(t)}})},onRelease:f});return document.addEventListener("keydown",p,!1),()=>{C(),document.removeEventListener("keydown",p,!1)}},[_,W,X,d,F,o,u,q,V,Q,R,Z,x,K,J,a]),(0,s.vJ)(()=>{const e=P(),t=void 0!==Y.current&&Y.current!==e;if(!g.current||!t||o||F)return;Y.current=e;const{scale:i}=x.current,s=e>0?-1:1;let n=100,a=0;i<=.6&&s>0||i>=12&&s<0||(1===i&&s>0&&(n=20),bt&&bt(),bt=(0,b.Hd)({from:s,to:s*n,duration:ft,timing:gt,onUpdate:e=>{if(!g.current)return;const t=(0,fe.LI)(e-a,2);a=e;const i=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});g.current.dispatchEvent(i)}}))},[P,o,F,x]);const[te,ie]=(0,s.Kr)(()=>void 0===O?[void 0,void 0]:[d(O,-1),d(O,1)],[O,d]);if(void 0===O)return;const ne=void 0!==te,ae=void 0!==ie,oe=D&&U;return(0,se.FD)("div",{className:"MediaViewerSlides",ref:g,children:[(0,se.Y)("div",{className:"MediaViewerSlide",ref:f,children:ne&&!U&&!G&&(0,se.Y)(mt,{withAnimation:a,isMoving:oe,item:te,onClose:u,onFooterClick:p,handleSponsoredClick:v})}),(0,se.Y)("div",{className:(0,ge.A)("MediaViewerSlide","MediaViewerSlide--active",oe&&"MediaViewerSlide--moving"),onClick:ee,ref:A,children:(0,se.Y)(mt,{item:O,withAnimation:a,isActive:w,isMoving:oe,onClose:u,onFooterClick:p,handleSponsoredClick:v})}),(0,se.Y)("div",{className:"MediaViewerSlide",ref:C,children:ae&&!U&&!G&&(0,se.Y)(mt,{withAnimation:a,isMoving:oe,item:ie,onClose:u,onFooterClick:p,handleSponsoredClick:v})}),ne&&!U&&!m.TF&&(0,se.Y)("button",{type:"button",className:`navigation prev ${t&&!i&&"inline"}`,"aria-label":$("AccDescrPrevious"),dir:$.isRtl?"rtl":void 0}),ae&&!U&&!m.TF&&(0,se.Y)("button",{type:"button",className:`navigation next ${t&&!i&&"inline"}`,"aria-label":$("Next"),dir:$.isRtl?"rtl":void 0})]})});function Nt(e=0,t=0,i=1){return`translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${i.toFixed(3)})`}function kt(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function wt(e){const t=e.target;return!!kt(t,".VideoPlayerControls")&&(kt(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu, .SeekLine")||e.preventDefault(),!0)}var It=i(70636),Pt=i(4961),Yt=i(21849);const Ft=(0,n.EK)((e,{item:t})=>{const i="message"===t?.type?t.message:void 0,s=i&&(0,c.Y7C)(e,i);return{owner:"avatar"===t?.type?t.avatarOwner:s}})(({owner:e,item:t})=>{const{closeMediaViewer:i,focusMessage:a,toggleChatInfo:o}=(0,n.ko)(),{isMobile:r}=(0,Y.Ay)(),c=(0,T.A)(()=>{if(i(),"message"!==t?.type)return;const e=t.message;r?setTimeout(()=>{o({force:!1},{forceSyncOnIOs:!0}),a({chatId:e.chatId,messageId:e.id})},350):a({chatId:e.chatId,messageId:e.id})}),d=(0,B.A)(),h=(0,s.Kr)(()=>{if(!t||"standalone"===t.type)return;const e="avatar"===t.type?t.avatarOwner:void 0,i="avatar"===t.type?t.profilePhotos:void 0,s=i?.photos[t.mediaIndex],n=s?.id===i?.fallbackPhoto?.id,a=s?.id===i?.personalPhoto?.id,o="message"===t.type?t.message.date:s?.date;if(!o)return;const r=(0,We.fS)(d,1e3*o,!0),c=i?.count&&i.count+(i?.fallbackPhoto?1:0),h=t.mediaIndex+1+(i?.personalPhoto?-1:0),m=c&&d("Of",[h,c]),u=[];if(s){const t=(0,v.L8)(e.id)?void 0:e,i=t&&(0,l.WX)(t),s=t&&(0,l.YE)(t);u.push(d(a?"lng_mediaview_profile_photo_by_you":n?"lng_mediaview_profile_public_photo":i?"lng_mediaview_channel_photo":s?"lng_mediaview_group_photo":"lng_mediaview_profile_photo"))}return!m||a||n||u.push(m),u.push(r),u.join(" • ")},[t,d]);if(!e)return;const m=(0,It.F9)(d,e);return(0,se.FD)("div",{className:"SenderInfo",onClick:c,children:[(0,se.Y)(Yt.A,{size:"medium",peer:e},e.id),(0,se.FD)("div",{className:"meta",children:[(0,se.Y)("div",{className:"title",dir:"auto",children:m&&(0,Pt.A)(m)}),(0,se.Y)("div",{className:"date",dir:"auto",children:h})]})]})}),Dt=250,Mt=(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:m,mediaIndex:u,isAvatarView:p,isSponsoredMessage:g}=t,A=(0,c.xYJ)(e,"mediaViewerAnimations"),{currentUserId:b,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===b:(0,l.SJ)(t));const p=(0,c.IVq)(e,s),g=f({avatarOwner:t,standaloneMedia:m,profilePhotos:p,mediaIndex:u}),N=C(e,0,g);return{profilePhotos:p,avatar:p?.photos[u],avatarOwner:t,isLoadingMoreMedia:p?.isLoading,isChatWithSelf:S,canUpdateMedia:a,withAnimation:A,origin:r,shouldSkipHistoryAnimations:i,isHidden:d,standaloneMedia:m,mediaIndex:u,isSynced:y,currentItem:g,viewableMedia:N,chatId:s,threadId:n,messageId:o,message:void 0,collectedMessageIds:void 0,chatMessages:void 0,sponsoredMessage:void 0,withDynamicLoading:h}}let N,k;s&&o&&(N=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&&(k=(0,c.v8U)(e,s));const w=f({message:N,standaloneMedia:m,mediaIndex:u,sponsoredMessage:k}),I=C(e,0,w);let P;s&&(P=r&&[a.TQ.ScheduledAlbum,a.TQ.ScheduledInline].includes(r)?(0,c.yFI)(e,s):(0,c.zeq)(e,s));let Y=!1;const F=r===a.TQ.Inline,D=r===a.TQ.Album;let M;if(s&&n&&o)if(h&&(F||D)){const t=(0,c.CuV)(e);Y=Boolean(t?.isLoading);const{foundIds:i}=t?.currentSegment||{};M=i}else if(r===a.TQ.SharedMedia){const t=(0,c.BU_)(e),i=t?.resultsByType,s=I&&(0,l.JU)(I?.media),{foundIds:n}=s&&i?.[s]||{};M=n}else(F||D)&&(M=(0,c.Lzh)(e,s,n,o)||(0,c.gCU)(e,s,n));return{chatId:s,threadId:n,messageId:o,isChatWithSelf:S,origin:r,message:N,chatMessages:P,sponsoredMessage:k,collectedMessageIds:M,withAnimation:A,isHidden:d,shouldSkipHistoryAnimations:i,withDynamicLoading:h,standaloneMedia:m,mediaIndex:u,isLoadingMoreMedia:Y,isSynced:y,currentItem:w,viewableMedia:I,canUpdateMedia:void 0,avatar:void 0,avatarOwner:void 0,profilePhotos:void 0}})(({chatId:e,threadId:t,messageId:i,message:c,collectedMessageIds:f,isChatWithSelf:C,canUpdateMedia:y,origin:L,avatar:R,avatarOwner:x,profilePhotos:E,chatMessages:_,sponsoredMessage:G,standaloneMedia:j,mediaIndex:z,withAnimation:H,isHidden:$,shouldSkipHistoryAnimations:q,withDynamicLoading:W,isLoadingMoreMedia:Q,isSynced:ee,currentItem:te,viewableMedia:ie})=>{const{openMediaViewer:re,closeMediaViewer:le,openForwardMenu:ce,focusMessage:de,toggleChatInfo:he,searchChatMediaMessages:me,loadMoreProfilePhotos:ue,clickSponsored:pe,openUrl:ge}=(0,n.ko)(),Ae=Boolean(x||c||j||G),{isMobile:fe}=(0,Y.Ay)(),{media:Ce,isSingle:be}=ie||{},ye=(0,s.li)(),Se=c?.senderId||x?.id||c?.chatId,Ne=(0,K.A)(Se),ke=H?"slideFade":"none",we=Boolean(H&&!q),[Ie,Pe,Ye]=(0,D.A)(),{isVideo:Fe,isPhoto:De,bestImageData:Me,bestData:Te,dimensions:Be,isGif:Le,contentType:Re}=Z({media:Ce,isAvatar:Boolean(x),origin:L,delay:we&&Dt}),xe=(()=>{if(C)return!1;if("avatar"!==te?.type||!x)return!1;const e=te.profilePhotos;return Ce!==e.personalPhoto})(),Ee=(0,s.Kr)(()=>W?f:(0,l.lH)(_||{},f||[],Re||"media"),[_,f,Re,W]);!Ae||Ne&&Ne===Se&&void 0!==ye.current||(ye.current=be?0:i||z);const[Ve]=V;(0,s.vJ)(()=>{if(!Ae||Ve())return;(0,p.FD)();const e=(0,J.w4)();return()=>{e(),(0,p.wb)()}},[Ae,Ve]),(0,s.vJ)(()=>{$&&Ae||U()},[$,Ae]),(0,s.vJ)(()=>{fe&&(0,r.RK)(()=>{document.body.classList.toggle("is-media-viewer-open",Ae)})},[fe,Ae]);const _e=(0,M.A)();(0,s.vJ)(()=>{const e=window.matchMedia(g.wy);return e.addEventListener("change",_e),()=>{e.removeEventListener("change",_e)}},[_e]);const Ue=(0,O.A)(c),Oe=(0,O.A)(L),Ke=(0,O.A)(te),Je=(0,O.A)(Me),Ge=c?(0,A.V)({message:c,forcePlayback:!0,isForMediaViewer:!0}):void 0,je=Boolean(Ge);(0,F.A)(([e,t])=>{e===Ae&&t===$||(we&&Ae&&!Ke&&((0,s.VK)(Dt+o.xB5),function(e,t,i,s,n,l,c){const{mediaEl:d}=I(t,l,c);if(!d)return;const{width:h}=k.A.get(),{width:u,height:p}=(0,g.$w)(e,n),{width:v,height:A}=(0,g.ky)(u,p,s.width,s.height),f=(h-v)/2,C=function(e){const t=window.matchMedia(g.wy);let i=4.125;return e&&!m.TF&&(i+=t.matches?.875:2.125),i*g.$}(e)+(p-A)/2;let{top:y,left:S,width:N,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,N,Y);y=e.top,S=e.left,N=e.width,Y=e.height}const F=S+N/2-(f+v/2),D=y+Y/2-(C+A/2),M=N/v,T=Y/A;(0,r.RK)(()=>{const e=w(i||d);(0,b.ZM)(e,{top:`${C}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)})})}(je,L,Me,Be,Fe,c,z)),we&&!Ae&&Ke&&((0,s.VK)(Dt+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:m,height:u}=c.getBoundingClientRect(),{top:p,left:v,width:g,height:A}=l.getBoundingClientRect();let f=p;if(!(0,N.Y)(n)){const{height:e}=k.A.get();f=p<d?-A:e}const C=h+m/2-(v+g/2),y=d+u/2-(f+A/2);let Y=m/g,F=u/A;const D=[a.TQ.Inline,a.TQ.ScheduledInline,a.TQ.Album,a.TQ.ScheduledAlbum].includes(e)&&!function(e){const t=document.querySelector(".Transition_slide-active > .MessageList"),{top:i}=(0,S.A)(e,t);return i>t.scrollTop&&i+e.offsetHeight<t.scrollTop+t.offsetHeight}(l);[a.TQ.SharedMedia,a.TQ.Album,a.TQ.ScheduledAlbum,a.TQ.SearchResult].includes(e)&&(Y>F?Y=F:F>Y&&(F=Y));const M=document.getElementsByClassName("ghost")[0],T=M||w(t||l,e);let B;if(M){const{top:e,left:t,width:i,height:s}=M.getBoundingClientRect();B={transition:"none",top:`${f}px`,left:`${v}px`,transformOrigin:"top left",transform:`translate3d(${t-v}px, ${e-f}px, 0) scale(${i/g}, ${s/A})`,width:`${g}px`,height:`${A}px`}}else B={top:`${f}px`,left:`${v}px`,width:`${g}px`,height:`${A}px`,transform:`translate3d(${C}px, ${y}px, 0) scale(${Y}, ${F})`};(0,r.RK)(()=>{(0,b.ZM)(T,B),M||document.body.appendChild(T),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{M&&(M.style.transition=""),T.style.transform="",D&&(T.style.opacity="0"),P(T,e),setTimeout(()=>{(0,r.RK)(()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(Oe,Je,Ue,Ke?.mediaIndex)))},[Ae,$,Me,Be,je,we,Fe,c,L,Je,Ke,Ue,Oe,z]);const ze=(0,T.A)(()=>le()),He=(0,T.A)(s=>{s.target instanceof HTMLElement&&s.target.closest("a")||(ze(),e&&i&&(fe?setTimeout(()=>{he({force:!1},{forceSyncOnIOs:!0}),de({chatId:e,threadId:t,messageId:i})},Dt):de({chatId:e,threadId:t,messageId:i})))}),$e=(0,T.A)(t=>{G&&e&&(pe({isMedia:t,isFullscreen:!0,randomId:G.randomId}),ge({url:G.url}),le())}),qe=(0,T.A)(()=>{ce({fromChatId:e,messageIds:[i]})});(0,s.vJ)(()=>Ae?(0,u.A)(()=>{ze()}):void 0,[ze,Ae]),(0,s.vJ)(()=>{Fe&&!Le&&(0,d._K)()},[Le,Fe]);const We=(0,T.A)(i=>{if(i&&!Q){if("avatar"===i.type){if(!(i.mediaIndex>=i.profilePhotos.photos.length-4))return;ue({peerId:i.avatarOwner.id})}"message"===i.type&&W&&me({chatId:e,threadId:t,currentMediaMessageId:i.message.id})}}),Qe=(0,T.A)((e,t)=>{if(0===t||be)return;if("standalone"===e.type){const{media:i,mediaIndex:s}=e,n=s+t;return n>=0&&n<i.length?{type:"standalone",media:i,mediaIndex:n}:void 0}if("avatar"===e.type){const{avatarOwner:i,profilePhotos:s,mediaIndex:n}=e,a=n+t;return a>=0&&s&&a<s.photos.length?{type:"avatar",avatarOwner:i,profilePhotos:s,mediaIndex:a}:void 0}if("sponsoredMessage"===e.type){const{message:i,mediaIndex:s}=e,n=s+t;return n>=0&&i?{type:"sponsoredMessage",message:i,mediaIndex:n}:void 0}const{message:i,mediaIndex:s}=e,n=(0,l.qG)(i);if(n){const e=s+t;if(e>=0&&e<n.extendedMedia.length)return{type:"message",message:i,mediaIndex:e}}const a=Ee?.indexOf(i.id);if(void 0===a||-1===a)return;const o=Ee[a+t],r=_?.[o];return r?{type:"message",message:r}:void 0}),Ze=(0,T.A)(e=>{if(!e)return void ze();const t="avatar"===e.type?e.avatarOwner.id:"message"===e.type?e.message.chatId:void 0,i="message"===e.type?e.message.id:void 0,s="standalone"===e.type?e.media:void 0;re({origin:L,chatId:t,messageId:i,standaloneMedia:s,mediaIndex:e.mediaIndex,isAvatarView:"avatar"===e.type,withDynamicLoading:W},{forceOnHeavyAnimation:!0})}),Xe=(0,T.A)(()=>{if((E?.photos.length||j?.length||Ee?.length||0)<=1||!te)return void ze();const e=Qe(te,-1);e?Ze(e):"avatar"===te.type&&(0,v.L8)(te.avatarOwner.id)||"standalone"===te.type||ze()}),et=(0,B.A)();return(0,se.FD)(ae.A,{id:"MediaViewer",isOpen:Ae,isHidden:$,shouldAnimateFirstRender:!0,noCloseTransition:q,children:[(0,se.FD)("div",{className:"media-viewer-head",dir:et.isRtl?"rtl":void 0,"data-tauri-drag-region":!(!h.Vq||!m.MP)||void 0,children:[fe&&(0,se.Y)(X.A,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",iconName:"close",ariaLabel:et("Close"),onClick:ze}),(0,se.Y)(oe.Ay,{activeKey:ye.current,name:ke,children:(0,se.Y)(Ft,{item:te},Ce?.id)}),(0,se.Y)(ve,{mediaData:Te,isVideo:Fe,item:te,canUpdateMedia:y,canReportAvatar:xe,onBeforeDelete:Xe,onReportAvatar:Pe,onCloseMediaViewer:ze,onForward:qe}),(0,se.Y)(ne,{isOpen:Ie,onClose:Ye,photo:R,peerId:x?.id})]}),(0,se.Y)(St,{item:te,loadMoreItemsIfNeeded:We,isLoadingMoreMedia:Q,isSynced:ee,getNextItem:Qe,chatId:e,isPhoto:De,isGif:Le,threadId:t,avatarOwnerId:x?.id,origin:L,isOpen:Ae,hasFooter:je,isVideo:Fe,withAnimation:H,onClose:ze,selectItem:Ze,isHidden:$,onFooterClick:He,handleSponsoredClick:$e})]})}));var Tt=i(2429);const Bt="W9A8SEMl",Lt="gLHHo5k8",Rt="GJVwqV9e",xt="_Yn4SWUB",Et="hGCH03qc",Vt="ZecqXqKy",_t="PVZ8TOWS",Ut="Wi0DXPH2",Ot="Ka1CGfzq",Kt="urTtSsk9",Jt="AjXOHOgE",Gt="uAlXNXJN",jt="g8ypsnnC",zt="hGTnZuar",Ht="TkphaPyQ",$t="CvnxnCxN",qt="nZ30pf4g",Wt="MnNC7VHS",Qt="G8OgmMDJ",Zt=3.5*g.$,Xt=.5*g.$;function ei(e,t=!1,i=!1){const s=document.createElement("div");s.classList.add(i?"TYicp2_K":"fME2l_yv");const n=new Image;if(n.draggable=!1,n.oncontextmenu=y.A,n.classList.add("HjoURJRK"),t){const t=document.createElement("canvas");t.classList.add(Wt),n.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:i,height:s}=n;(0,r.RK)(()=>{t.width=i,t.height=s,m.QH&&(e.filter="blur(2px)"),e.drawImage(n,-4,-4,i+8,s+8),m.QH||(0,j.A)(e,0,0,i,s,2,2)})},n.src=e,s.appendChild(t)}else n.src=e,s.appendChild(n);return s}function ti(e,t){let i;const s=`#${(0,l.kR)(t)}`;switch(e){case a.G9.StoryRibbon:i=`#LeftColumn .${Tt.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 ii({scale:e,slideAmount:t,isActiveSlideSize:i,isMoveThroughActiveSlide:s,isBackward:n}){const a=40+(i?405:135),o=(Math.abs(t)-1)*(40+(s?405:135)),r=(0,fe.Ki)((a+o)*e);return n?-r:r}function si(){const{width:e,height:t}=(0,Pe.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,fe.Ki)(405*i),n=(0,fe.Ki)(135*i);return{activeSlide:{width:s,height:(0,fe.Ki)(720*i)},slide:{width:n,height:(0,fe.Ki)(240*i)},scale:i,toActiveScale:s/n,fromActiveScale:n/s}}(e,t),[e,t])}function ni(e,t=!1,i=!1){const s=e&&"content"in e,n=e&&"isDeleted"in e,a=!!s&&(0,l.XR)(e),o=s&&Boolean(e.forwardInfo);let r;s&&(e.content.photo?.thumbnail&&(r=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(r=e.content.video.thumbnail.dataUri));const c=s?(0,l.EN)(e):void 0,d=(0,q.A)(c),h=Boolean(s&&e.content.video),m=s&&e.content.video?.noSound,u=s?(0,l.EN)(e,"full"):void 0,p=(0,q.A)(u,!e,h?G.qZ.Progressive:G.qZ.BlobUrl),v=h&&s?(0,l.EN)(e,"full",!0):void 0,g=(0,q.A)(v,!e,G.qZ.Progressive),A=Boolean(p||g),f=h?d:p||d,C=!d&&!A,b=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:m,fullMediaHash:u,fullMediaData:p,altMediaHash:v,altMediaData:g,hasFullData:A,bestImageData:f,hasThumb:C,canDownload:b,downloadMediaData:(0,q.A)(y,!b&&!i)}}var ai=i(94189);const oi=(0,s.ph)(function({isOpen:e,story:t,onClose:i}){const{deleteStory:a,openNextStory:o}=(0,n.ko)(),r=(0,B.A)(),l=(0,s.hb)(()=>{t&&(o(),a({peerId:t.peerId,storyId:t.id}),i())},[i,t]);return(0,se.Y)(ai.A,{isOpen:e,onClose:i,title:r("DeleteStoryTitle"),text:r("DeleteStorySubtitle"),confirmLabel:r("Delete"),confirmHandler:l,confirmIsDestructive:!0,className:"component-theme-dark"})});var ri=i(21309),li=i(22720),ci=i(63152),di=i(87894),hi=i(79824),mi=i(54960);const ui=(0,s.ph)(function({id:e,contactListIds:t,currentUserId:i,selectedIds:n,lockedIds:a,onSelect:o}){const r=(0,B.A)(),[l,c]=(0,s.J0)(""),d=(0,s.Kr)(()=>{const e=(t||[]).filter(e=>e!==i);return(0,di.Am)((0,It.PU)({ids:[...n||[],...e],query:l,type:"user"}))},[t,i,l,n]);return(0,se.Y)(mi.A,{itemIds:d,selectedIds:n??hi.p,lockedSelectedIds:a,filterValue:l,filterPlaceholder:r("Search"),searchInputId:`${e}-picker-search`,isSearchable:!0,withDefaultPadding:!0,forceShowSelf:!0,onSelectedIdsChange:o,onFilterChange:c,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"},e)});var pi=i(12933);const vi=(0,s.ph)(function({isActive:e,contactListIds:t,usersById:i,currentUserId:a,onClose:o}){const{saveCloseFriends:r}=(0,n.ko)(),l=(0,B.A)(),[c,d]=(0,s.J0)(""),[h,m]=(0,s.J0)(!1),[u,p]=(0,s.J0)([]),v=(0,s.Kr)(()=>(t||[]).filter(e=>i[e]?.isCloseFriend),[t,i]),g=(0,s.Kr)(()=>{const e=(t||[]).filter(e=>e!==a);return(0,di.Am)((0,It.PU)({ids:[...v,...e],query:c,type:"user"}))},[v,t,a,c]);(0,F.A)(([t])=>{!t&&e&&(m(!1),p(v))},[e,v]);const A=(0,s.hb)(e=>{p(e),m(!0)},[]),f=(0,T.A)(()=>{r({userIds:u}),o()});return(0,se.FD)(se.FK,{children:[(0,se.Y)(mi.A,{itemIds:g||[],selectedIds:u,filterValue:c,filterPlaceholder:l("Search"),searchInputId:"close-friends-picker-search",isSearchable:!0,withDefaultPadding:!0,onSelectedIdsChange:A,onFilterChange:d,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),(0,se.Y)("div",{className:(0,ge.A)("BDK_pgpt",h&&"N8ujSwlC"),children:(0,se.Y)(pi.A,{isShown:h,onClick:f,ariaLabel:l("Save"),iconName:"check"})})]})}),gi={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"},Ai=[{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 fi=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(fi||{});const Ci=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{storyId:t,peerId:i}}=(0,c.nTw)(e),s=i&&t?(0,c.Msb)(e,i,t):void 0;return{story:s&&"content"in s?s:void 0,visibility:s&&"visibility"in s?s.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}})(function({isOpen:e,story:t,visibility:i,contactListIds:a,usersById:o,currentUserId:r,onClose:c}){const{editStoryPrivacy:d,toggleStoryInProfile:h}=(0,n.ko)(),m=(0,B.A)(),[u,p,v]=(0,D.A)(!1),[g,A]=(0,s.J0)(i),[f,C]=(0,s.J0)(t?.isInProfile),[b,S]=(0,s.J0)(fi.privacy),[N,k]=(0,s.J0)("everybody"),w=b!==fi.privacy,I=(0,s.Kr)(()=>(a||[]).filter(e=>o[e]?.isCloseFriend),[a,o]),P=(0,s.Kr)(()=>{if(b===fi.allowList&&(!g?.allowUserIds?.length||g.allowUserIds[0]===r))return[r]},[b,r,g?.allowUserIds]),Y=(0,s.Kr)(()=>N!==g?.visibility?[]:g?.blockUserIds||[],[N,g?.blockUserIds,g?.visibility]),F=(0,T.A)(e=>{A({...g,allowUserIds:e?.length?e?.filter(e=>e!==r):[r]})}),M=(0,T.A)(e=>{A({...g,blockUserIds:e,visibility:N})});(0,s.vJ)(()=>{e&&(S(fi.privacy),p())},[e]),(0,s.vJ)(()=>{A(i)},[i]);const L=(0,T.A)(()=>{b!==fi.privacy?S(fi.privacy):v()}),R=(0,T.A)(()=>{C(!f)}),x=(0,T.A)(()=>{d({peerId:t.peerId,storyId:t.id,privacy:g}),t.isInProfile!==f&&h({peerId:t.peerId,storyId:t.id,isInProfile:f}),v()});return(0,se.FD)(te.A,{isOpen:u,className:(0,ge.A)(gi.modal,"component-theme-dark"),onClose:v,noBackdrop:!0,onCloseAnimationEnd:c,children:[(0,se.FD)("div",{className:gi.header,children:[(0,se.Y)(X.A,{className:(0,ge.A)(gi.closeButton,"close-button"),round:!0,color:"translucent",size:"tiny",onClick:L,ariaLabel:m(w?"Common.Back":"Common.Close"),children:(0,se.Y)("div",{className:(0,ge.A)("animated-close-icon",w&&"state-back")})}),(0,se.Y)(oe.Ay,{name:"slideFade",activeKey:b,children:function(){switch(b){case fi.privacy:return(0,se.Y)("h3",{className:gi.headerTitle,children:m("StoryPrivacyAlertEditTitle")});case fi.allowList:return(0,se.Y)("h3",{className:gi.headerTitle,children:m("StoryPrivacyAlertSelectContactsTitle")});case fi.closeFriends:return(0,se.Y)("h3",{className:gi.headerTitle,children:m("CloseFriends")});case fi.denyList:return(0,se.Y)("h3",{className:gi.headerTitle,children:m("StoryPrivacyAlertExcludedContactsTitle")})}}()})]}),(0,se.Y)(oe.Ay,{activeKey:b,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:gi.content,children:function(e){switch(b){case fi.privacy:return function(){const e=t?(0,ri.qZ)(t.expireDate-t.date):0;return(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:gi.section,children:[(0,se.Y)("h3",{className:gi.title,children:m("StoryPrivacyAlertSubtitleProfile")}),(0,se.Y)("div",{className:gi.list,children:Ai.map(e=>{return(0,se.FD)("label",{className:(0,ge.A)(gi.option,e.value===g?.visibility&&gi.checked),children:[(0,se.Y)("input",{type:"radio",name:"story_privacy",className:gi.input,value:e.value,checked:e.value===g?.visibility,onChange:()=>{return t=e.value,void A({...g,visibility:t});var t},teactExperimentControlled:!0}),(0,se.Y)("span",{className:gi.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`,children:(0,se.Y)(he.A,{name:e.icon})}),(0,se.FD)("div",{className:gi.optionContent,children:[(0,se.Y)("span",{className:(0,ge.A)(gi.option_name),children:m(e.name)}),e.actions&&(0,se.FD)("div",{tabIndex:0,role:"button",className:gi.action,"aria-label":m("Edit"),onClick:t=>{!function(e,t){switch((0,y.A)(e),t){case"closeFriends":S(fi.closeFriends);break;case"allowUserIds":S(fi.allowList);break;case"blockUserIds":S(fi.denyList),k("everybody");break;case"blockContactUserIds":S(fi.denyList),k("contacts")}}(t,e.actions)},children:[(0,se.Y)("span",{className:gi.actionInner,children:(t=e.actions,"closeFriends"===t?0===I.length?m("StoryPrivacyOptionCloseFriendsDetail"):1===I.length?(0,It.F9)(m,o[I[0]]):m("StoryPrivacyOptionPeople",I.length,"i"):"blockUserIds"===t&&"everybody"===g?.visibility||"blockContactUserIds"===t&&"contacts"===g?.visibility?g?.blockUserIds?.length?1===g.blockUserIds.length?m("StoryPrivacyOptionExcludePerson",(0,l.Yg)(o[g.blockUserIds[0]])):m("StoryPrivacyOptionExcludePeople",g.blockUserIds.length,"i"):m("StoryPrivacyOptionContactsDetail"):g?.allowUserIds&&0!==g.allowUserIds.length?1===g.allowUserIds.length?(0,l.Yg)(o[g.allowUserIds[0]]):m("StoryPrivacyOptionPeople",g.allowUserIds.length,"i"):m("StoryPrivacyOptionSelectedContactsDetail"))}),(0,se.Y)(he.A,{name:"next"})]})]})]},e.value);var t})})]}),(0,se.Y)("div",{className:gi.section,children:(0,se.FD)(li.A,{ripple:!0,onClick:R,children:[(0,se.Y)("span",{children:m("StoryKeep")}),(0,se.Y)(ci.A,{id:"group-notifications",label:m("StoryKeep"),checked:f,inactive:!0})]})}),(0,se.FD)("div",{className:gi.footer,children:[(0,se.Y)("div",{className:gi.info,children:m("StoryKeepInfo",e)}),(0,se.Y)("div",{className:gi.submit,children:(0,se.Y)(X.A,{onClick:x,children:m("StoryPrivacyButtonSave")})})]})]})}();case fi.closeFriends:return(0,se.Y)(vi,{isActive:e,contactListIds:a,currentUserId:r,usersById:o,onClose:L},"close-friends");case fi.denyList:return(0,se.Y)(ui,{id:"deny-list",contactListIds:a,currentUserId:r,selectedIds:Y,onSelect:M},"deny-list");case fi.allowList:return(0,se.Y)(ui,{id:"allow-list",contactListIds:a,lockedIds:P,currentUserId:r,selectedIds:g?.allowUserIds,onSelect:F},"allow-list")}}})]})}));var bi=i(36353),yi=i(73104),Si=i(14),Ni=i(52674),ki=i(95362),wi=i(48775),Ii=i(80140),Pi=i(46051),Yi=i(45470),Fi=i(39351),Di=i(38218),Mi=i(83057),Ti=i(66991),Bi=i(61157),Li=i(92111),Ri=i(31403),xi=i(65843),Ei=i(55158),Vi=i(59816),_i=i(91800),Ui=i(23565),Oi=i(69282),Ki=i(11217),Ji=i(39996),Gi=i(86070),ji=i(39877);const zi=(0,s.ph)((0,n.EK)((e,{forwardInfo:t})=>({sender:t.fromPeerId?(0,c.PVB)(e,t.fromPeerId):void 0,story:t.storyId&&t.fromPeerId?(0,c.Msb)(e,t.fromPeerId,t.storyId):void 0,theme:(0,c.SJA)(e)}))(({className:e,forwardInfo:t,sender:i,story:a,theme:o})=>{const{openStoryViewer:r,loadPeerStoriesByIds:l,openChat:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,B.A)();(0,s.vJ)(()=>{!a&&t.fromPeerId&&t.storyId&&l({peerId:t.fromPeerId,storyIds:[t.storyId]})},[t,a]);const{className:m,style:u}=(0,Ji.Ay)({peer:i,noUserColors:!0,shouldReset:!0,theme:o}),p=i?(0,It.F9)(h,i):t.fromName,g=(0,T.A)(()=>{const{fromPeerId:e,storyId:i}=t;e&&(!a||"isDeleted"in a&&a.isDeleted?c({id:e}):r({peerId:e,storyId:i,isSingleStory:!0}))}),{handleClick:A,handleMouseDown:f}=(0,Ki.Q)(g);return(0,se.FD)(Gi.A,{ref:d,className:(0,ge.A)("EmbeddedMessage",e,m),style:u,dir:h.isRtl?"rtl":void 0,onClick:A,onMouseDown:f,children:[i?.color?.backgroundEmojiId&&(0,se.Y)(ji.A,{emojiDocumentId:i.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),(0,se.FD)("div",{className:"message-text",children:[function(){if(a&&"content"in a&&a.content.text)return(0,se.Y)("p",{className:"embedded-text-wrapper",children:(0,Oi.fd)(a.content.text)})}(),(0,se.Y)("div",{className:"message-title",children:function(){if(!i||!p)return;const e=(0,v.L8)(i.id)?"user-filled":"channel-filled";return(0,se.FD)(se.FK,{children:[e&&(0,se.Y)(he.A,{name:e,className:"embedded-chat-icon"}),p&&(0,Pt.A)(p)]})}()})]})]})}));var Hi=i(45215);const $i=(0,s.ph)(function({story:e,isExpanded:t,className:i,onExpand:n,onFold:a}){const o=(0,B.A)(),l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(),m=(0,Si.A)(e,!0),u=m?.content.text,[p,v]=(0,s.J0)(!1),g=(0,Ui.A)(t||void 0,400),A=t||g;(0,s.vJ)(()=>{(0,r.RK)(()=>{c.current&&(t?(0,et.YM)(c.current,$t):(0,et.HW)(c.current,$t))})},[t]);const f=p&&!A,{shouldRender:C,transitionClassNames:b}=(0,je.A)(f,void 0,!0,"slow",!0);(0,s.Nf)(()=>{(0,r.YS)(()=>{const e=c.current,t=h.current;if(!e||!t)return;const{offsetWidth:i}=t;(0,r.RK)(()=>{e.style.setProperty("--expand-button-width",`${i}px`)})})},[C,o]),(0,s.Nf)(()=>{(0,r.gm)(()=>{if(!c.current||!d.current)return;const e=c.current,t=d.current,i=t.offsetTop,{lineHeight:s,totalLines:n}=(0,_i.A)(t),a=n>3,o=i+3*s;return()=>{a&&((0,et.YM)(e,"e1gyTmKe"),v(!0)),e.style.setProperty("--_overflow-shift",`${o}px`)}})},[u]),(0,s.vJ)(()=>{t||l.current?.scrollTo({top:0})},[t]);const y=(0,ge.A)("ilyTRZtw",A&&"HIMnUViv",C&&"Vq8pl_kQ");return(0,se.FD)("div",{className:(0,ge.A)("RKedwa0I",i),children:[(0,se.Y)("div",{ref:c,className:y,role:f?"button":void 0,onClick:f?n:a,children:(0,se.FD)("div",{ref:l,className:(0,ge.A)("D_5mWNmi","allow-selection","custom-scroll"),children:[m?.forwardInfo&&(0,se.Y)(zi,{forwardInfo:m.forwardInfo,className:"_M8CgT7s"}),m&&u&&(0,se.Y)("div",{ref:d,className:"hmFA5qb1",children:(0,se.Y)(Hi.A,{messageOrStory:m,withTranslucentThumbs:!0,forcePlayback:!0})})]})}),C&&(0,se.Y)("div",{ref:h,className:(0,ge.A)("bM5rlQtM",b),onClick:n,children:o("Story.CaptionShowMore")})]})});var qi=i(26875),Wi=i(11241);const Qi="YVD19vOP",Zi="vJRk_UUk",Xi="nIv3YAnZ",es=(0,s.ph)(({story:e,className:t})=>{const{openStoryViewModal:i,openForwardMenu:a,sendStoryReaction:r}=(0,n.ko)(),c=(0,B.A)(),{views:d,isOut:h,peerId:m,id:u,sentReaction:p}=e,{viewsCount:g,forwardsCount:A,reactionsCount:f}=d||{},C=!(0,v.L8)(m),b=p&&(0,l.a0)(p,o.tNZ),y=Boolean((h||C)&&e.isPublic&&!e.noForwards),S=(0,l.$_)(m,u),N=(0,s.Kr)(()=>{const{users:{byId:e}}=(0,n.mS)(),t=d&&"recentViewerIds"in d?d.recentViewerIds:void 0;if(t)return t.map(t=>e[t]).filter(Boolean)},[d]),k=(0,T.A)(()=>{i({storyId:u})}),w=(0,T.A)(()=>{a({fromChatId:m,storyId:u})}),I=(0,T.A)(()=>{const e=p?void 0:o.tNZ;r({peerId:m,storyId:u,containerId:S,reaction:e})});return g?(0,se.FD)("div",{className:(0,ge.A)(Qi,t),children:[(0,se.FD)("div",{className:(0,ge.A)("cknL5COh",!C&&"pJAyeGkG"),onClick:C?void 0:k,children:[Boolean(N?.length)&&(0,se.Y)(qi.A,{size:"small",peers:N,className:"Vz_VtJ16"}),C?(0,se.FD)("span",{className:Xi,children:[(0,se.Y)(he.A,{name:"channelviews",className:"WyBiNM6e"}),g]}):(0,se.Y)("span",{className:Xi,children:c("Views",g,"i")}),Boolean(f)&&!C&&(0,se.FD)("span",{className:"sf3u_6Vh",children:[(0,se.Y)(he.A,{name:"heart",className:"Er2XKRqi"}),f]})]}),(0,se.Y)("div",{className:"kKoeDk3Z"}),y&&(0,se.Y)(X.A,{color:"translucent",size:"smaller",round:!0,onClick:w,ariaLabel:c("Forward"),className:Zi,iconName:"forward"}),C&&(0,se.FD)(se.FK,{children:[Boolean(A)&&(0,se.FD)("div",{className:Zi,children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:c("PublicShares"),iconName:"loop"}),(0,se.Y)("span",{children:A})]}),(0,se.FD)("div",{className:Zi,children:[(0,se.FD)(X.A,{round:!0,className:"lpDXVIuf",color:"translucent",size:"smaller",onClick:I,ariaLabel:c("AccDescrLike"),children:[p&&(0,se.Y)(Wi.A,{containerId:S,reaction:p,withEffectOnly:b},(0,l.Jj)(p)),(!p||b)&&(0,se.Y)(he.A,{name:b?"heart":"heart-outline",className:(0,ge.A)(b&&"twgMDT1y")})]}),Boolean(f)&&(0,se.Y)("span",{children:f})]})]})]}):(0,se.Y)("div",{className:(0,ge.A)(Qi,t),children:c("NobodyViewed")})}),ts=(0,s.ph)(function({isActive:e,isViewed:t,isVideo:i,duration:s=6,isPaused:n,onImageComplete:a}){const o=(0,T.A)(e=>{i||"XY98E7VM"!==e.animationName||a()}),r=(0,ge.A)("c1fbGgcx",t&&"xwOKghO2",e&&"ZuByYcIx",n&&"n9V6B7hP");return(0,se.Y)("span",{className:r,"aria-hidden":!0,children:e&&(0,se.Y)("i",{style:`--progress-duration: ${s}s`,className:"qyBCpJct",onAnimationEnd:o})})}),is=m.Yw?4:3,ss=(0,s.ph)((0,n.EK)((e,{peerId:t,storyId:i,isDeleteModalOpen:s})=>{const{appConfig:n}=e,a=(0,c.mBe)(e,t),o=(0,c.hds)(e,t),r=(0,c.vGo)(e,t),l=(0,c.nTw)(e),{storyViewer:{isMuted:d,viewModal:h,isPrivacyModalOpen:m,storyList:u},forwardMessages:{storyId:p},premiumModal:v,safeLinkModalUrl:g,mapModal:A,reportModal:f,giftInfoModal:C,isPaymentMessageConfirmDialogOpen:b,storyStealthModal:y}=l,{isOpen:S}=v||{},N=Boolean(y),k=(0,c.Msb)(e,t,i),w=k&&"content"in k,I=Boolean(b||h||p||l.reactionPicker?.storyId||f||m||S||s||g||N||A||C),P=w?k.forwardInfo:void 0,Y=w?k.mediaAreas:void 0,F=P?.fromPeerId||Y?.find(e=>"channelPost"===e.type)?.channelId,D=F?(0,c.PVB)(e,F):void 0,M=(0,c.xYJ)(e,"mediaViewerAnimations"),T=w&&k.fromId?(0,c.PVB)(e,k.fromId):void 0,B=(0,c.WA9)(e,t),L=(0,c.trm)(e);return{peer:a||o,forwardSender:D,fromPeer:T,story:k,orderedIds:u?.storyIdsByPeerId[t],isMuted:d,isCurrentUserPremium:(0,c.g29)(e),shouldForcePause:I,storyChangelogUserId:n.storyChangelogUserId,viewersExpirePeriod:n.storyViewersExpirePeriod,isChatExist:Boolean(o),arePeerSettingsLoaded:Boolean(r?.settings),stealthMode:e.stories.stealthMode,withHeaderAnimation:M,paidMessagesStars:B,isAccountFrozen:L}})(function({peerId:e,storyId:t,peer:i,forwardSender:a,fromPeer:r,isMuted:c,isArchivedStories:d,isPrivateStories:h,story:m,orderedIds:u,isSingleStory:p,dimensions:g,shouldForcePause:A,storyChangelogUserId:f,viewersExpirePeriod:C,isChatExist:b,arePeerSettingsLoaded:y,getIsAnimating:S,isCurrentUserPremium:N,stealthMode:k,withHeaderAnimation:w,paidMessagesStars:I,isAccountFrozen:P,onDelete:M,onClose:L,onReport:R}){const{viewStory:x,setStoryViewerMuted:E,openPreviousStory:V,openNextStory:_,loadPeerSkippedStories:U,openForwardMenu:O,copyStoryLink:K,toggleStoryInProfile:J,openChat:j,showNotification:z,openStoryPrivacyEditor:H,loadPeerSettings:$,fetchChat:q,loadStoryViews:W,openStealthModal:Q}=(0,n.ko)(),Z=(0,Ii.Fm)(),ee=(0,B.A)(),te=(0,Fi.A)(),{isMobile:ie}=(0,Y.Ay)(),[ne,ae,re]=(0,D.A)(!1),[le,ce,de]=(0,D.A)(!1),[pe,ve,Ae]=(0,D.A)(!1),[Ce,be,ye]=(0,D.A)(!0),[Se,Ne,ke]=(0,D.A)(!1),[we,Ie]=(0,s.J0)(!1),[Pe,Ye,Fe]=(0,D.A)(!1),[De,Me,Te]=(0,D.A)(!1),Be=(0,s.li)(),{isDeletedStory:Le,hasText:Re,hasForwardInfo:xe,thumbnail:Ee,previewBlobUrl:Ve,isVideo:_e,noSound:Ue,fullMediaData:Oe,altMediaHash:Ke,altMediaData:Ge,hasFullData:ze,hasThumb:He,canDownload:$e,downloadMediaData:qe}=ni(m,N,De),Qe=m&&"content"in m,Ze=e===f,Xe=(0,v.L8)(e),et=!Xe,tt=et&&(0,l.WX)(i),it=Qe&&m.isOut,st=Qe&&0===Object.keys(m.content).length,nt=(0,Si.A)(it?!m.isInProfile:void 0,!0),at=(0,Si.A)(it?m.isInProfile:void 0,!0),ot=Boolean(it&&m.date+C<(0,Ii.Fm)()),rt=a?(0,It.F9)(te,a):Qe&&m.forwardInfo?.fromName,lt=Boolean(Qe&&m.isPublic&&!Ze&&i?.hasUsername),ct=Boolean(Qe&&m.isPublic&&!m.noForwards&&!Ze&&!Se),dt=Boolean((ze||st)&&!A&&Ce&&!ne&&!Se&&!we&&!Pe),ht=Qe&&m.content.video?.duration?m.content.video.duration:void 0,mt=!(it&&Xe||Ze||tt||P),ut=Qe&&!mt&&(it||tt),pt=ie&&w?"slideFade":"none",{shouldRender:vt,transitionClassNames:gt}=(0,je.A)(!ze&&!st),{transitionClassNames:At}=(0,je.A)(Boolean(Oe)&&!st),ft=(0,Yi.A)(Ee,!He),Ct=(0,Mi.A)(Ve),{shouldRender:bt,transitionClassNames:yt}=(0,je.A)(mt),{shouldRender:St,transitionClassNames:Nt}=(0,je.A)(Re&&Se),{transitionClassNames:kt}=(0,je.A)(!0),{shouldRender:wt,transitionClassNames:Ft}=(0,je.A)(Re||xe),Dt=(0,Ti.Y)(Be,Oe,Pi.G);(0,Li.A)(e,t),(0,s.vJ)(()=>{t&&x({peerId:e,storyId:t})},[t,e]),(0,s.vJ)(()=>{U({peerId:e})},[e]),(0,s.vJ)(()=>{const t=(0,v.L8)(e);!b&&t&&q({chatId:e})},[b,e]),(0,s.vJ)(()=>{b&&!y&&$({peerId:e})},[y,b,e]);const Mt=(0,T.A)(()=>{_e&&Be.current?.pause(),Ae(),de()}),Tt=(0,T.A)(()=>{dt&&(ce(),_e||ve())}),Lt=(0,T.A)(()=>{Ye()}),Rt=(0,T.A)(()=>{Fe()}),xt=(0,T.A)(()=>{Me(),Mt()}),Vt=(0,T.A)(()=>{Te(),Tt()}),{onMouseDown:Kt,onMouseUp:Jt,onMouseLeave:Gt,onTouchStart:$t,onTouchEnd:Zt}=(0,Di.A)({onStart:Lt,onEnd:Rt}),Xt=(0,Je.A)(Be,void 0,!_e||!Oe||Dt),ei=Oe&&(!Ke||Ge);(0,s.vJ)(()=>{(ei||Xt||st)&&Tt()},[ei,Xt,st]),(0,Bi.Ay)(ye,be),(0,s.vJ)(()=>{ei&&Be.current?.load()},[ei]),(0,s.vJ)(()=>{!Qe||Le||ot||(it||tt)&&W({peerId:e,storyId:t})},[Le,ot,Qe,e,t,it,tt]),(0,s.vJ)(()=>{A||!Ce||ne||Se||we||Pe?Mt():Tt()},[Tt,Ce,Se,ne,A,we,Pe]),(0,s.vJ)(()=>{if(!(ne||A||Se))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),Ie(!we))}},[Se,ne,we,A]),(0,F.A)(([e,t,i,s,n])=>{!we||Se||ne||A||!Ce||Pe||t===Se&&e===ne&&i===A&&s===Ce&&n===Pe||Ie(!1)},[ne,Se,A,Ce,Pe,we]);const ti=(0,T.A)(()=>{L(),j({id:e})}),ii=(0,T.A)(()=>{L(),j({id:a.id})}),si=(0,T.A)(()=>{L(),j({id:r.id})}),ai=(0,T.A)(()=>{V()}),oi=(0,T.A)(()=>{_()}),ri=(0,T.A)(e=>{const t=e.currentTarget;t.readyState>=is?ve():Ae(),ht&&(0,fe.LI)(t.currentTime,2)>=(0,fe.LI)(ht,2)&&oi()});(0,s.vJ)(()=>S()||ne?void 0:(0,Ni.A)({onRight:oi,onLeft:ai}),[S,ne]);const li=(0,T.A)(()=>{K({peerId:e,storyId:t})}),ci=(0,T.A)(()=>{J({peerId:e,storyId:t,isInProfile:!0})}),di=(0,T.A)(()=>{J({peerId:e,storyId:t,isInProfile:!1})}),hi=(0,T.A)(()=>{M(m)}),mi=(0,T.A)(()=>{R()}),ui=(0,T.A)(()=>{O({fromChatId:e,storyId:t})}),pi=(0,T.A)(()=>{H()}),vi=(0,T.A)(()=>{const e=!Qe||m.isPublic?void 0:m.isForContacts?"contacts":m.isForCloseFriends?"closeFriends":"nobody";let t;const s=(0,It.F9)(te,i);switch(e){case"nobody":t=ee("StorySelectedContactsHint",s);break;case"contacts":t=ee("StoryContactsHint",s);break;case"closeFriends":t=ee("StoryCloseFriendsHint",s);break;default:return}z({message:t})}),gi=(0,T.A)(()=>{Ue?z({message:ee("Story.TooltipVideoHasNoSound")}):(Be.current.muted=!Be.current.muted,E({isMuted:!c}))}),Ai=(0,T.A)(()=>{if(k.activeUntil&&(0,Ii.Fm)()<k.activeUntil){const e=k.activeUntil-(0,Ii.Fm)();return void z({title:te("StealthModeOnTitle"),message:te("StealthModeOnHint",{time:(0,We.QO)(e)}),duration:4e3})}Q({})}),fi=(0,T.A)(()=>{qe&&(0,ki.A)(qe,`story-${e}-${t}.${_e?"mp4":"jpg"}`)});(0,s.vJ)(()=>{Le&&z({message:ee("StoryNotFound")})},[ee,Le]);const Ci=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{round:!0,ripple:!ie,size:"tiny",color:"translucent-white",onClick:e,className:(0,ge.A)(Ht,t&&"active"),ariaLabel:te("AriaLabelOpenMenu"),iconName:"more"}),[ie,te]);const bi=I?te("ComposerPlaceholderPaidReply",{amount:(0,wi.U2)(te,I,{asFont:!0,className:"placeholder-star-icon"})},{withNodes:!0}):ee(et?"ReplyToGroupStory":"ReplyPrivately");return(0,se.FD)("div",{className:(0,ge.A)(jt,"component-theme-dark"),onMouseDown:Kt,onMouseUp:Jt,onMouseLeave:Gt,onTouchStart:$t,onTouchEnd:Zt,children:[(0,se.FD)("div",{className:(0,ge.A)("e7HHuS1g",kt),children:[(0,se.Y)("div",{className:"jGDd2sza",children:(p?[t]:u??[]).map(e=>(0,se.Y)(ts,{isActive:e===m?.id,isVideo:_e,isViewed:Boolean(m?.id&&(h||d?e>m?.id:e<m?.id)),isPaused:!pe,duration:ht,onImageComplete:oi},`progress-${e}`))}),(0,se.FD)("div",{className:"eMYhXF_X",children:[(0,se.Y)(oe.Ay,{activeKey:Number(e),name:pt,className:"PXnfXZur",children:(0,se.FD)("div",{className:"WpyVfrsc",children:[(0,se.Y)(Yt.A,{peer:i,size:"tiny",onClick:ti}),(0,se.FD)("div",{className:"jmKI_lhC",children:[(0,se.Y)("span",{onClick:ti,className:"H1uod43o",children:(0,Pt.A)((0,It.F9)(te,i)||"")}),(0,se.FD)("div",{className:"zimpR8Hz",children:[rt&&(0,se.FD)("span",{className:(0,ge.A)(zt,"JJFtefb9",a&&"BsqMBS2I"),onClick:a?ii:void 0,children:[(0,se.Y)(he.A,{name:"loop"}),(0,se.Y)("span",{className:Qt,children:(0,Pt.A)(rt)})]}),r&&(0,se.FD)("span",{className:(0,ge.A)(zt,"nJr8QgYX"),onClick:si,children:[(0,se.Y)(Yt.A,{peer:r,size:"micro"}),(0,se.Y)("span",{className:Qt,children:(0,Pt.A)((0,It.F9)(te,r)||"")})]}),m&&"date"in m&&(0,se.Y)("span",{className:zt,children:(0,We.jy)(ee,Z,m.date)}),Qe&&m.isEdited&&(0,se.Y)("span",{className:zt,children:ee("Story.HeaderEdited")})]})]})]})}),(0,se.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,se.FD)("div",{className:(0,ge.A)("prxptFFf",it&&"_MVsZpgB"),onClick:it?pi:vi,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`,children:[(0,se.Y)(he.A,{name:e}),it&&(0,se.Y)(he.A,{name:"next"})]})}(),_e&&(0,se.Y)(X.A,{className:Ht,round:!0,ripple:!ie,size:"tiny",color:"translucent-white",disabled:!ze,onClick:gi,ariaLabel:ee("Volume"),iconName:c||Ue?"speaker-muted-story":"speaker-story"}),(0,se.FD)(me.A,{className:"K0_xAdzf",trigger:Ci,positionX:"right",onOpen:xt,onClose:Vt,children:[lt&&(0,se.Y)(ue.A,{icon:"copy",onClick:li,children:ee("CopyLink")}),nt&&(0,se.Y)(ue.A,{icon:"save-story",onClick:ci,children:ee(Xe?"StorySave":"SaveToPosts")}),at&&(0,se.Y)(ue.A,{icon:"delete",onClick:di,children:ee(Xe?"ArchiveStory":"RemoveFromPosts")}),$e&&(0,se.Y)(ue.A,{icon:"download",disabled:!qe,onClick:fi,children:ee("lng_media_download")}),!it&&Xe&&(0,se.Y)(ue.A,{icon:"eye-crossed-outline",onClick:Ai,children:ee("StealthMode")}),!it&&(0,se.Y)(ue.A,{icon:"flag",onClick:mi,children:ee("lng_report_story")}),it&&(0,se.Y)(ue.A,{icon:"delete",destructive:!0,onClick:hi,children:ee("Delete")})]}),(0,se.Y)(X.A,{className:(0,ge.A)(Ht,"WlLsjJ2Z"),round:!0,size:"tiny",color:"translucent-white",ariaLabel:ee("Close"),onClick:L,iconName:"close"})]})]})]}),(0,se.FD)("div",{className:"YiuvOPgT",style:`width: ${g.width}px; height: ${g.height}px`,children:[(0,se.Y)("canvas",{ref:ft,className:Wt}),Ve&&(0,se.Y)("img",{src:Ve,draggable:!1,alt:"",className:(0,ge.A)(_t,"lQfkulvp",Ct)},`preview-${t}`),vt&&(0,se.Y)(Ei.A,{className:(0,ge.A)(gt,Bt),animation:"pulse"}),!_e&&Oe&&(0,se.Y)("img",{src:Oe,alt:"",className:(0,ge.A)(_t,At),draggable:!1}),_e&&Oe&&(0,se.FD)(xi.A,{ref:Be,className:(0,ge.A)(_t,At),canPlay:le,muted:c,width:720,height:1280,draggable:!1,playsInline:!0,disablePictureInPicture:!0,isPriority:!0,onPause:Ae,onWaiting:Ae,disableRemotePlayback:!0,onTimeUpdate:ri,children:[(0,se.Y)("source",{src:Oe,type:Pi.G,width:"720"}),Ge&&(0,se.Y)("source",{src:Ge,type:Pi.w,width:"480"})]},`video-${t}`),st&&(0,se.Y)("div",{className:(0,ge.A)(_t,"snxbMlts"),children:(0,se.Y)("span",{children:te("StoryUnsupported")})}),!Pe&&!ne&&(0,se.FD)(se.FK,{children:[(0,se.Y)("button",{type:"button",className:(0,ge.A)(qt,"SXpRZiax"),onClick:ai,"aria-label":ee("Previous")}),(0,se.Y)("button",{type:"button",className:(0,ge.A)(qt,"twOBFwUE"),onClick:oi,"aria-label":ee("Next")})]}),Qe&&Oe&&(0,se.Y)(Vi.A,{story:m,isActive:!0,isStoryPlaying:De},`area-overlay-${t}-${e}`),!ie&&(0,se.Y)("div",{className:Et,children:(0,se.FD)("div",{className:Ut,children:[(0,se.Y)(Yt.A,{peer:i,withStory:!0,storyViewerMode:"disabled"}),(0,se.Y)("div",{className:Ot,children:(0,Pt.A)((0,It.F9)(te,i)||"")})]})})]}),ut&&(0,se.Y)(es,{story:m,className:kt}),St&&(0,se.Y)("div",{tabIndex:0,role:"button",className:(0,ge.A)("Jd1DYS6Y",Nt),onClick:()=>ke(),"aria-label":ee("Close")}),Re&&(0,se.Y)("div",{className:(0,ge.A)("sHNAfxzf",Ft)}),wt&&(0,se.Y)($i,{story:m,isExpanded:Se,onExpand:Ne,onFold:ke,className:Ft},`caption-${t}-${e}`),bt&&(0,se.Y)(Ri.A,{type:"story",chatId:e,threadId:G.l3,storyId:t,isReady:!it,messageListType:"thread",isMobile:(0,Y.Ny)(),editableInputCssSelector:o.iKt,editableInputId:o.YVZ,inputId:"story-input-text",className:(0,ge.A)("FXineBYO",yt),inputPlaceholder:bi,onForward:ct?ui:void 0,onFocus:ae,onBlur:re})]})})),ns=(0,s.ph)((0,n.EK)((e,{peer:t})=>{const{storyViewer:{lastViewedByPeerId:i,origin:s,storyList:n}}=(0,c.nTw)(e);return{lastViewedId:t?.id?i?.[t.id]:void 0,origin:s,storyIdsForViewer:t?.id?n?.storyIdsByPeerId[t.id]:void 0}})(function({peer:e,peerStories:t,lastViewedId:i,storyIdsForViewer:a,origin:o}){const{openStoryViewer:r,loadPeerSkippedStories:c}=(0,n.ko)(),d=(0,B.A)(),h=(0,s.Kr)(()=>{if(!t)return;const{orderedIds:e,lastReadId:s,byId:n}=t,o=e[e.length-1]!==s,r=i&&a?.includes(i)?i??(o?s??-1:-1):-1;return n[n[r]?.id||a?.[0]||e[0]]},[i,t,a]),m=h&&"content"in h;(0,s.vJ)(()=>{h&&!m&&c({peerId:h.peerId})},[h,m]);const u=m?h.content.video:void 0,p=m?(0,l.EN)(h):void 0,v=(0,q.A)(p)||u?.thumbnail?.dataUri;if(e&&h&&!("isDeleted"in h))return(0,se.FD)("div",{className:jt,onClick:()=>{r({peerId:h.peerId,storyId:h.id,origin:o})},children:[v&&(0,se.Y)("img",{src:v,alt:"",className:_t,draggable:!1}),m&&(0,se.Y)(Vi.A,{story:h}),(0,se.Y)("div",{className:Et,children:(0,se.FD)("div",{className:Ut,children:[(0,se.Y)(Yt.A,{peer:e,withStory:!0,storyViewerMode:"disabled"}),(0,se.Y)("div",{className:Ot,children:(0,Pt.A)((0,It.F9)(d,e)||"")})]})})]})}));var as=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(as||{});const os=(0,s.ph)((0,n.EK)(e=>{const{storyViewer:{peerId:t,storyId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o,storyList:r}}=(0,c.nTw)(e),{byPeerId:l,orderedPeerIds:{active:d}}=e.stories;return{byPeerId:l,peerIds:r?.peerIds??d,currentPeerId:t,currentStoryId:i,isSinglePeer:s,isSingleStory:n,isPrivate:a,isArchive:o}},e=>(0,c.gd2)(e))(function({peerIds:e,currentPeerId:t,currentStoryId:i,isOpen:a,isSinglePeer:d,isSingleStory:h,isPrivate:u,isArchive:p,byPeerId:v,isDeleteModalOpen:g,onDelete:A,onClose:f,onReport:C}){const{stopActiveReaction:b}=(0,n.ko)(),y=(0,s.li)(),[S,N]=(0,s.J0)(t),[k,w]=(0,s.J0)(i),I=(0,K.A)(t),P=(0,Si.A)(p,!0),F=(0,Si.A)(u,!0),D=(0,Si.A)(d,!0),M=(0,Si.A)(h,!0),B=si(),{height:L,width:R}=(0,Pe.A)(),x=(0,s.li)(void 0),E=(0,s.li)(!1),{isMobile:V}=(0,Y.Ay)(),_=(0,s.li)({}),[U,O]=(0,s.Ul)(!1);function J(e,t){e&&(_.current[t]?_.current[t].current=e:_.current[t]={current:e})}(0,Ne.A)({isActive:a,onBack:f,shouldBeReplaced:!0});const G=(0,s.Kr)(()=>{if(S&&(D||M))return[S];const t=S?e.indexOf(S):-1;if(!S||-1===t)return[];const i=Math.max(t-4,0),s=Math.min(t+5,e.length);return e.slice(i,s)},[M,D,S,e]),j=(0,s.Kr)(()=>G.length&&S?G.indexOf(S):-1,[S,G]),z=(0,s.Kr)(()=>G.length&&t?G.indexOf(t):-1,[t,G]);(0,s.vJ)(()=>{V&&N(t)},[t,V]),(0,s.vJ)(()=>{S===t&&i!==k&&w(i)},[t,i,S,k]),(0,s.vJ)(()=>{if(!V)return I&&I!==t&&O(!0),()=>{O(!1)}},[I,t,O,V]),(0,s.vJ)(()=>()=>{i&&t&&b({containerId:(0,l.$_)(t,i)})},[i,t]);const H=z-j,$=j>z,q=(0,T.A)(()=>e.reduce((i,s,n)=>{if(s===S)i[s]=ii({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:$});else{let a=!1;!$&&n>0&&e[n-1]===S&&(a=!0),$&&n<e.length-1&&e[n+1]===S&&(a=!0),i[s]=ii({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:t===s&&!$,isMoveThroughActiveSlide:a})}return i},{}));(0,s.vJ)(()=>{if(!y.current||!a)return;let e=0;const t=()=>S?_.current[S]?.current:void 0,i=i=>{if(E.current)return void(E.current=!1);const s=t();if(s){if(e<-50){const e=document.getElementById(o.YVZ);return void(e&&(0,r.RK)(()=>{(0,bi.A)(e)}))}e>50?(f(),"wheel"===i.type&&((0,yi.M6)(),setTimeout(yi.v5,1500))):(0,r.RK)(()=>{s.style.setProperty("--slide-translate-y","0px")})}};return(0,Ae.wJ)(y.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(s,n,{dragOffsetX:a,dragOffsetY:o})=>{if(E.current)return;if(m.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=Ae.h6||e>=R-Ae.h6)return}if("mousemove"===s.type)return;const l=Math.abs(a),c=Math.abs(o),d=t();if(d&&(x.current===as.Vertical||Math.abs(c)>Ae.no||c/l>Ae.fG)){x.current=as.Vertical;const t=L;e=(0,fe.qE)(o,-t,t),e>0&&(0,r.RK)(()=>{d.style.setProperty("--slide-translate-y",e*(V?1:-1)+"px")}),"wheel"===s.type&&Math.abs(e)>100&&(i(s),E.current=!0)}},onRelease:i})},[a,f,R,L,V,S]),(0,s.Nf)(()=>{if(V)return;const e=q();Object.entries(_.current).forEach(([i,{current:s}])=>{if(!s)return;if(!U())return s.classList.remove(Rt,xt,Vt),s.style.setProperty("--slide-translate-x","0px"),s.style.setProperty("--slide-translate-y","0px"),s.style.setProperty("--slide-translate-scale","1"),void s.style.setProperty("--slide-content-scale",String(B.toActiveScale));let n=0;i===S&&(n=-1.75*B.fromActiveScale,s.classList.add(Vt)),i===t&&(n=1.75,s.classList.add(xt)),s.classList.add(Rt),s.style.setProperty("--slide-translate-x",`${e[i]||0}px`),s.style.setProperty("--slide-translate-y",`${n}rem`),s.style.setProperty("--slide-translate-scale",t===i?String(B.toActiveScale):i===S?String(B.fromActiveScale):"1")})},[t,U,S,B,V]);const W=(0,T.A)(e=>{const s=e.target;s&&s.classList.contains(Gt)&&(S!==t?(N(t),w(i)):i!==k&&w(i),O(!1))});return V?(0,se.Y)("div",{className:Lt,ref:y,children:(0,se.Y)("div",{className:Jt,ref:e=>J(e,S),children:(0,se.Y)(ss,{peerId:S,storyId:k,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:g,isSingleStory:h,getIsAnimating:U,onClose:f,onReport:C})})}):(0,se.FD)("div",{className:Lt,ref:y,style:`--story-viewer-scale: ${B.scale}`,onTransitionEnd:W,children:[(0,se.Y)("div",{className:Bt,onClick:f}),G.length>1&&(0,se.Y)("div",{className:"xe67dhtF",style:`height: ${B.slide.height}px`}),G.map((e,t)=>e===S?function(e){const t=V?void 0:(0,tt.A)(`width: ${B.activeSlide.width}px`,`--slide-media-height: ${B.activeSlide.height}px`);return(0,se.Y)("div",{ref:t=>J(t,e),className:(0,ge.A)(Kt,Gt),style:t,children:(0,se.Y)(ss,{peerId:e,storyId:k,onDelete:A,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:P,isDeleteModalOpen:g,isSingleStory:h,getIsAnimating:U,onClose:f,onReport:C})},e)}(S):function(e,t,i){const s=(0,tt.A)(`width: ${B.slide.width}px`,`height: ${B.slide.height}px`),a=(0,ge.A)(Kt,"Sef28wEh",`slide-${i}`);return(0,se.Y)("div",{ref:t=>J(t,e),className:a,style:s,children:(0,se.Y)(ns,{peer:(0,c.PVB)((0,n.mS)(),e),peerStories:v?.[e]})},e)}(e,0,t-j))]})}));var rs=i(47366),ls=i(46222),cs=i(283),ds=i(36393),hs=i(51083),ms=i(58920),us=i(17794);const ps={"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"},vs=1.5*g.$,gs=(0,s.ph)((0,n.EK)((e,{storyView:t})=>({peer:(0,c.PVB)(e,t.peerId),availableReactions:e.reactions.availableReactions}))(({storyView:e,peer:t,availableReactions:i})=>{const{openChat:a,closeStoryViewer:o,unblockUser:r,blockUser:c,deleteContact:d,updateStoryView:h,focusMessage:m,openStoryViewer:u,closeStoryViewModal:p}=(0,n.ko)(),g=(0,B.A)(),A=(0,T.A)(()=>{const{type:t}=e;if("repost"===t)return p(),void u({peerId:e.peerId,storyId:e.storyId});o(),setTimeout(()=>{"user"===t?a({id:e.peerId}):"forward"===t&&m({chatId:e.peerId,messageId:e.messageId})},100)}),f=(0,s.Kr)(()=>{if(!(0,v.L8)(e.peerId))return;const{peerId:i,areStoriesBlocked:s,isUserBlocked:n}=e,a=t,{isContact:o}=a||{},m=(0,l.Yg)(a),u=[];return n||(s?u.push({handler:()=>{r({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!1})},title:g("StoryShowBackTo",m),icon:"play-story"}):u.push({handler:()=>{c({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!0})},title:g("StoryHideFrom",m),icon:"hand-stop"})),o?u.push({handler:()=>{d({userId:i})},title:g("DeleteContact"),icon:"delete-user",destructive:!0}):u.push({handler:()=>{n?(r({userId:i}),h({userId:i,isUserBlocked:!1})):(c({userId:i}),h({userId:i,isUserBlocked:!0}))},title:g(n?"Unblock":"BlockUser"),icon:n?"user":"delete-user",destructive:!n}),u},[g,e,t]),C="user"===e.type?"message-read":"forward"===e.type?"forward":"loop",b="forward"===e.type||"repost"===e.type,y=(0,s.Kr)(()=>{const t="repost"===e.type&&e.story.forwardInfo?.isModified,i=[(0,We.U)(g,1e3*e.date)];return t&&i.push(g("lng_edited")),i.join(" • ")},[g,e]);return(0,se.Y)(li.A,{className:(0,ge.A)("chat-item-clickable small-icon",ps.opacityFadeIn,(e.isUserBlocked||e.areStoriesBlocked)&&ps.blocked),onClick:A,rightElement:"user"===e.type&&e.reaction?(0,se.Y)(us.A,{reaction:e.reaction,className:ps.viewReaction,size:vs,availableReactions:i,withIconHeart:!0}):void 0,contextActions:f,withPortalForMenu:!0,menuBubbleClassName:ps.menuBubble,children:(0,v.L8)(e.peerId)?(0,se.Y)(ms.A,{className:(0,ge.A)(b&&ps.withColoredStatus),userId:e.peerId,noStatusOrTyping:!0,status:y,statusIcon:C,withStory:!0,forceShowSelf:!0}):(0,se.Y)(hs.A,{className:(0,ge.A)(b&&ps.withColoredStatus),chatId:e.peerId,status:y,statusIcon:C,withStory:!0})},e.peerId)})),As=(0,s.ph)((0,n.EK)(e=>{const{appConfig:t}=e,{storyViewer:{viewModal:i}}=(0,c.nTw)(e),{storyId:s,views:n,nextOffset:a,isLoading:o}=i||{},r=s?(0,c.Msb)(e,e.currentUserId,s):void 0,l="story"===r?.["@type"]?r.expireDate:void 0;return{views:n,viewersExpireDate:l?l+t.storyViewersExpirePeriod:void 0,story:r&&"content"in r?r:void 0,nextOffset:a,isLoading:o,isCurrentUserPremium:(0,c.g29)(e)}})(function({story:e,viewersExpireDate:t,views:i,nextOffset:a,isLoading:r,isCurrentUserPremium:l}){const{loadStoryViewList:c,closeStoryViewModal:d,clearStoryViews:h}=(0,n.ko)(),[m,u,p]=(0,D.A)(!1),[v,g,A]=(0,D.A)(!0),[f,C]=(0,s.J0)(""),b=(0,B.A)(),y=Boolean(e),S=Boolean(t)&&t<(0,Ii.Fm)(),{viewsCount:N=0,reactionsCount:k=0}=e?.views||{},w=e?.isPublic&&N>o.XQO,I=k>o.$4F,P=N>o.frj,Y=w||I||P;(0,s.vJ)(()=>{y||(C(""),p(),g())},[y]);const F=(0,ye.A)(()=>{h({isLoading:!0})},[],250,!0);(0,s.vJ)(()=>{F()},[m,v,f,F]);const M=(0,s.Kr)(()=>i?.sort(function(e){return(t,i)=>{if(e){const e="user"===t.type&&t.reaction,s="user"===i.type&&i.reaction;if(e&&!s)return-1;if(!e&&s)return 1}return i.date-t.date}}(v)),[v,i]),L=M?.length?1:Math.min(N,8),R=Boolean(M?.length)&&M.length<N&&S,x=(0,T.A)(()=>{e?.id&&void 0!==a&&c({peerId:e.peerId,storyId:e.id,offset:a,areReactionsFirst:v||void 0,areJustContacts:m||void 0,query:f})}),{handleScroll:E,isAtBeginning:V}=(0,rs.A)(),_=(0,T.A)(()=>{d()}),U=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.FD)(X.A,{fluid:!0,size:"tiny",color:"translucent",className:(0,ge.A)(!t&&"active",ps.sortButton,ps.topButton),faded:t,onClick:e,ariaLabel:b("SortBy"),children:[(0,se.Y)(he.A,{name:v?"heart-outline":"recent",className:ps.iconSort}),(0,se.Y)(he.A,{name:"down",className:ps.iconDown})]}),[v,b]);return(0,se.FD)(te.A,{isOpen:y,onClose:_,className:"component-theme-dark",contentClassName:ps.viewsList,isSlim:!0,children:[Y&&(0,se.FD)("div",{className:ps.header,children:[w&&(0,se.FD)("div",{className:ps.contactFilter,children:[(0,se.Y)(X.A,{className:(0,ge.A)(!m&&ps.selected,ps.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:p,children:b("AllViewers")}),(0,se.Y)(X.A,{className:(0,ge.A)(m&&ps.selected,ps.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:u,children:b("Contacts")})]}),I&&(0,se.FD)(me.A,{className:ps.sort,trigger:U,positionX:"right",children:[(0,se.FD)(ue.A,{icon:"heart-outline",onClick:g,children:[b("SortByReactions"),v&&(0,se.Y)(he.A,{name:"check",className:ps.check})]}),(0,se.FD)(ue.A,{icon:"recent",onClick:A,children:[b("SortByTime"),!v&&(0,se.Y)(he.A,{name:"check",className:ps.check})]})]}),P&&(0,se.Y)(ds.A,{className:ps.search,value:f,onChange:C})]}),(0,se.FD)("div",{className:(0,ge.A)(ps.content,!V&&ps.topScrolled,"custom-scroll"),onScroll:E,children:[S&&!r&&!f&&Boolean(!M?.length)&&(0,se.Y)("div",{className:(0,ge.A)(ps.info,ps.centeredInfo),children:(0,Pt.A)(b(l?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])}),!r&&Boolean(f.length)&&!M?.length&&(0,se.Y)("div",{className:ps.info,children:b("Story.ViewList.EmptyTextSearch")}),(0,se.FD)(ls.A,{items:M,onLoadMore:x,children:[M?.map(e=>{const t="forward"===e.type?e.messageId:"repost"===e.type?e.storyId:"user";return(0,se.Y)(gs,{storyView:e},`${e.peerId}-${e.date}-${t}`)}),r&&Array.from({length:L}).map((e,t)=>(0,se.Y)(li.A,{className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0,children:(0,se.Y)(cs.A,{})},`placeholder-${t}`)),R&&(0,se.Y)("div",{className:(0,ge.A)(ps.info,ps.bottomInfo),children:b("Story.ViewList.NotFullyRecorded")},"not-all-available")]})]}),(0,se.Y)("div",{className:(0,ge.A)(ps.footer,"dialog-buttons"),children:(0,se.Y)(X.A,{className:(0,ge.A)("confirm-dialog-button",ps.close),isText:!0,onClick:_,children:b("Close")})})]})})),fs=(0,s.ph)((0,n.EK)(e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:i,peerId:s,isPrivacyModalOpen:n,origin:a}}=(0,c.nTw)(e),o=s&&i?(0,c.Msb)(e,s,i):void 0,r=(0,c.xYJ)(e,"mediaViewerAnimations");return{isOpen:(0,c.gd2)(e),shouldSkipHistoryAnimations:t,peerId:s,storyId:i,story:o,origin:a,withAnimation:r,isPrivacyModalOpen:n}})(function({isOpen:e,peerId:t,storyId:i,story:a,origin:l,shouldSkipHistoryAnimations:c,withAnimation:d,isPrivacyModalOpen:h}){const{closeStoryViewer:m,closeStoryPrivacyEditor:v,reportStory:g}=(0,n.ko)(),A=(0,B.A)(),[f,C]=(0,s.J0)(void 0),[y,S,N]=(0,D.A)(!1),{bestImageData:w,thumbnail:I}=ni(a),P=si(),Y=(0,K.A)(e),F=(0,K.A)(w),M=(0,K.A)(t),L=(0,K.A)(l),R=Boolean(d&&!c);(0,s.vJ)(()=>{e||(C(void 0),N())},[e]),(0,s.vJ)(()=>{if(!e)return;(0,p.FD)();const t=(0,J.w4)();return()=>{(0,p.wb)(),t()}},[e]);const x=(0,s.hb)(()=>{m()},[m]),E=(0,T.A)(e=>{C(e),S()}),V=(0,T.A)(()=>{N(),C(void 0)}),_=(0,T.A)(()=>{i&&g({storyId:i,peerId:t})});return(0,s.vJ)(()=>e?(0,u.A)(()=>{x()}):void 0,[x,e]),(0,s.vJ)(()=>{R&&!Y&&e&&t&&I&&void 0!==l&&((0,s.VK)(250+o.xB5),function(e,t,i,s,n){const{mediaEl:a}=ti(t,e);if(!a)return;const{width:l,height:c}=k.A.get();let{width:d,height:h}=n;const m=l<=600;if(m){d=l-2*Xt,h=c-Zt-2*Xt;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(h-=parseFloat(e))}const u=m?Xt:(l-d)/2,p=m?Xt:(c-(h+Zt))/2,{top:v,left:g,width:A,height:f}=a.getBoundingClientRect(),C=g+A/2-(u+d/2),y=v+f/2-(p+h/2),S=A/d,N=f/h;(0,r.RK)(()=>{const e=ei(s||i,!s);(0,b.ZM)(e,{top:`${p}px`,left:`${u}px`,width:`${d}px`,height:`${h}px`,transform:`translate3d(${C}px, ${y}px, 0) scale(${S}, ${N})`});const t=document.getElementById("StoryViewer");t.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)(()=>{(0,b.ZM)(e,{transform:""}),setTimeout(()=>{(0,r.RK)(()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")})},200+o.xB5)})})}(t,l,I,w,P.activeSlide)),R&&Y&&!e&&M&&F&&void 0!==L&&((0,s.VK)(250+o.xB5),function(e,t,i){const{mediaEl:s}=ti(t,e),n=document.getElementById("StoryViewer").querySelector(`.${Jt} .${_t}, .${Gt} .${_t}`);if(!n||!s)return;const{top:a,left:l,width:c,height:d}=n.getBoundingClientRect(),{top:h,left:m,width:u,height:p}=s.getBoundingClientRect(),v=m+u/2-(l+c/2),g=h+p/2-(a+d/2),A=u/c,f=p/d;(0,r.RK)(()=>{const e=ei(i);(0,b.ZM)(e,{top:`${a}px`,left:`${l}px`,width:`${c}px`,height:`${d}px`});const t=ei(s.src,void 0,!0),n=a+d/2-c/2;(0,b.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,b.ZM)(e,{transform:`translate3d(${v}px, ${g}px, 0) scale(${A}, ${f})`}),(0,b.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)})})}(M,L,F))},[R,w,F,e,Y,P.activeSlide,I,t,M,l,L]),(0,se.FD)(ae.A,{id:"StoryViewer",className:"bu_hGbaa",isOpen:e,shouldAnimateFirstRender:!0,noCloseTransition:c,children:[(0,se.Y)("div",{className:"OFh6u50Q",onClick:x}),(0,se.Y)(X.A,{className:"Mye8Dwxa",round:!0,size:"tiny",color:"translucent-white",ariaLabel:A("Close"),onClick:x,iconName:"close"}),(0,se.Y)(os,{isOpen:e,isDeleteModalOpen:y,onReport:_,onClose:x,onDelete:E}),(0,se.Y)(oi,{isOpen:y,story:f,onClose:V}),(0,se.Y)(As,{}),(0,se.Y)(Ci,{isOpen:h,onClose:v})]})}));var Cs=i(1455),bs=i(68292),ys=i(64520),Ss=i(79582),Ns=i(74984),ks=i(8247),ws=i(41257),Is=i(17486),Ps=i(10187),Ys=i(30708),Fs=i(31460),Ds=i(63527),Ms=i(96374),Ts=i(79174),Bs=i(10328),Ls=i(52745),Rs=i(34431),xs=i(38102),Es=i(45780);const Vs=2.75*g.$,_s="ChatOrUserPicker-item";function Us({isOpen:e,viewportIds:t,maxHeight:i,viewportFooter:n,onLoadMore:a,onSelect:o,onKeyDownHandlerUpdate:r,renderItem:l}){const c=(0,Fi.A)(),d=(0,s.li)(),h=(0,Bs.A)(d,e,o,`.${_s}`,!0);return(0,s.vJ)(()=>{r(h)},[h,r]),(0,se.Y)(se.FK,{children:t?.length?(0,se.FD)(ls.A,{ref:d,className:"picker-list custom-scroll",items:t,itemSelector:`.${_s}`,onLoadMore:a,withAbsolutePositioning:!0,maxHeight:i,onKeyDown:h,children:[t.map(l),Boolean(n)&&(0,se.Y)("div",{className:"picker-list-spacer",style:`top: ${i}px`})]}):t&&!t.length?(0,se.Y)("p",{className:"no-results",children:c("NothingFound")}):(0,se.Y)(Ls.A,{})})}const Os=(0,s.ph)((0,n.EK)(e=>({animationLevel:(0,Ys.Vu)(e),shouldSkipHistoryAnimations:(0,c.nTw)(e).shouldSkipHistoryAnimations}))(({isOpen:e,currentUserId:t,chatOrUserIds:i,title:a,search:r,searchPlaceholder:d,className:h,isLowStackPriority:m,subheader:u,renderSearchRow:p,footer:v,viewportFooter:g,listActiveKey:A,selectedIds:f,animationLevel:C,shouldSkipHistoryAnimations:b,loadMore:y,onSearchChange:S,onSelectChatOrUser:N,onClose:k,onCloseAnimationEnd:w})=>{const{loadTopics:I}=(0,n.ko)(),P=(0,B.A)(),Y=(0,Fi.A)(),[F,D]=(0,s.J0)(),M=(0,s.li)(),L=(0,s.li)(),R=(0,s.li)(),[x,E]=(0,Ms.A)(y,i,Boolean(r)),[V,_]=(0,s.J0)(void 0),[U,O]=(0,s.J0)(""),K=V?1:0,J=i.indexOf(x[0]),G=(0,T.A)(()=>{S("")});(0,Ts.A)(L,e&&0===K,G),(0,Ts.A)(R,e&&1===K);const j=(0,s.hb)(e=>{if(V)return(0,c.pSx)(e,V)},[V]),z=(0,Ds.Ay)(j),[H,$]=(0,s.Kr)(()=>{const e=(0,n.mS)(),t=e.chats.byId,i=e.chats.fullInfoById,s=t[V];if(!s||!z)return[void 0,void 0];const a=U.toLowerCase(),o=z?Object.values(z).reduce((e,t)=>(!(0,l.__)(s,t,void 0,i[V])||a&&!t.title.toLowerCase().includes(a)||(e[t.id]=t),e),{}):z;return[Object.keys(o).map(Number),o]},[V,U,z]),q=(0,T.A)(()=>{_(void 0),O("")}),W=(0,T.A)(e=>{S(e.currentTarget.value)}),Q=(0,T.A)(e=>{O(e.currentTarget.value)}),Z=(0,T.A)(e=>{if(x&&x.length>0){const t=(0,n.mS)().chats.byId,i=x[-1===e?0:e],s=t[i];s?.isForum?(z||I({chatId:i}),_(i)):N(i)}}),X=(0,T.A)(e=>{D(()=>e)}),ee=(0,Bs.A)(M,e,e=>{H?.length&&N(V,H[-1===e?0:e])},`.${_s}`,!0),ie=Boolean(f),ne=(0,T.A)(e=>{const t=(0,n.mS)().chats.byId,i=t?.[e];i?.isForum?(z||I({chatId:e}),_(e),G()):N(e)}),ae=(0,s.hb)((e,i)=>{const s=(0,n.mS)();let a=(0,c.PVB)(s,e);if(!a)return;const r=(0,c.k2W)(s,e);r&&(a=r);const d=s.chats.byId[e],h=d?.isForum,m=a&&!(0,It.vj)(a)?a.isSelf:void 0,u=f?.includes(e),p=h&&f?f.filter(t=>t.startsWith(`${e}:`)).length:0,v=p>0,[g,A]=function(){if(!a)return;if(a.id===t)return[P("SavedMessagesInfo")];if((0,It.vj)(a))return[(0,l.sT)(Y,a)];const e=(0,c.K0y)(s,a.id);return[(0,l.CD)(P,a,e),(0,ge.A)((0,l.PF)(a,e,!0)&&"online")]}()||[],C=f?(0,se.FD)("div",{className:(0,ge.A)("picker-checkbox",(u||v)&&"selected"),children:[(u||v)&&(0,se.Y)(he.A,{name:"check-bold"}),v&&(0,se.Y)("div",{className:"picker-checkbox-count",children:p})]}):void 0;return(0,se.Y)(Es.A,{className:_s,title:(0,se.Y)("div",{className:"title-wrapper",children:(0,se.Y)(Rs.A,{className:"item-title",peer:a,isMonoforum:Boolean(r),isSavedMessages:m})}),avatarElement:(0,se.FD)("div",{className:"picker-avatar-wrapper",children:[(0,se.Y)(Yt.A,{peer:a,asMessageBubble:Boolean(r),isSavedMessages:m,size:"medium"}),h&&(0,se.Y)(he.A,{name:"forums",className:"forum-badge"})]}),inputElement:C,inputPosition:"end",subtitle:g,subtitleClassName:A,ripple:!0,style:`top: ${(J+i)*o.xw7}px;`,onClick:()=>ne(e)},e)},[t,P,Y,J,f]),re=(0,T.A)(()=>{V?q():k()});return(0,se.FD)(te.A,{isOpen:e,title:a,hasCloseButton:!0,isBackButton:Boolean(V),headerClassName:"modal-header-condensed-wide",className:(0,ge.A)("ChatOrUserPicker",h),isLowStackPriority:m,onClose:re,onCloseAnimationEnd:w,children:[(0,se.Y)(oe.Ay,{activeKey:K,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",children:()=>1===K?(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:"picker-header",dir:Y.isRtl?"rtl":void 0,children:p?p({inputRef:R,value:U,placeholder:d,onChange:Q,onKeyDown:ee}):(0,se.FD)("div",{className:"search-input-wrapper",children:[(0,se.Y)("i",{className:"icon icon-search"}),(0,se.Y)("input",{ref:R,className:"search-input",type:"text",dir:"auto",placeholder:d,value:U,onChange:Q,onKeyDown:ee})]})}),H?.length?(0,se.FD)(ls.A,{ref:M,className:"picker-list custom-scroll",items:H,withAbsolutePositioning:!0,maxHeight:56*(H?.length||0),onKeyDown:ee,children:[H.map((e,t)=>{const i=`${V}:${e}`,s=f?.includes(i),n=ie?(0,se.Y)("div",{className:(0,ge.A)("picker-checkbox",s&&"selected"),children:s&&(0,se.Y)(he.A,{name:"check-bold"})}):void 0;return(0,se.Y)(Es.A,{className:_s,onClick:()=>N(V,e),style:`top: ${56*t}px;`,avatarElement:(0,se.Y)("div",{className:"picker-avatar-wrapper",children:(0,se.Y)(xs.A,{size:Vs,topic:$[e],className:"topic-icon",letterClassName:"topic-icon-letter"})}),title:(0,Pt.A)($[e].title),inputElement:n,inputPosition:"end"},`${V}_${e}`)}),Boolean(g)&&(0,se.Y)("div",{className:"picker-list-spacer",style:`top: ${56*H.length}px`})]}):H&&!H.length?(0,se.Y)("p",{className:"no-results",children:Y("NothingFound")}):(0,se.Y)("div",{className:"picker-list picker-list-loading",children:(0,se.Y)(Ls.A,{})})]}):(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"picker-header",dir:Y.isRtl?"rtl":void 0,children:[p?p({inputRef:L,value:r,placeholder:d,onChange:W,onKeyDown:F}):(0,se.FD)("div",{className:"search-input-wrapper",children:[(0,se.Y)("i",{className:"icon icon-search"}),(0,se.Y)("input",{ref:L,className:"search-input",type:"text",dir:"auto",placeholder:d,value:r,onChange:W,onKeyDown:F})]}),u]}),(0,se.Y)(oe.Ay,{activeKey:A||0,name:(0,Fs.P)("slideOptimized",C,b,Y.isRtl),slideClassName:"ChatOrUserPicker_slide",children:(0,se.Y)(Us,{isOpen:e,viewportIds:x,maxHeight:i.length*o.xw7,viewportFooter:g,onLoadMore:E,onSelect:Z,renderItem:ae,onKeyDownHandlerUpdate:X})})]})}),v]})}));var Ks=i(36838);const Js=(0,s.ph)(({contactIds:e,currentUserId:t,selectedIds:i,className:a,onSelect:o})=>{const r=(0,Fi.A)(),l=(0,s.li)();(0,Ks.A)(l,!e.length);const d=(0,T.A)(e=>{o(e)}),h=t?[t,...e.filter(e=>e!==t)]:e;if(h.length)return(0,se.Y)("div",{className:(0,ge.A)("nQlR0Q0W",a),dir:r.isRtl?"rtl":void 0,children:(0,se.Y)("div",{ref:l,className:"sLQQgItu",children:h.map(e=>{const s=(0,n.mS)(),a=(0,c.PVB)(s,e);if(!a)return;const o=e===t,l=i?.includes(e),h=o?r("SavedMessagesShort"):(0,It.F9)(r,a);return(0,se.FD)("div",{className:(0,ge.A)("LCuyQF4w",l&&"OlGxnpac"),onClick:()=>d(e),children:[(0,se.FD)("div",{className:"FK8lKKJm",children:[(0,se.Y)(Yt.A,{peer:a,isSavedMessages:o,size:48}),(0,se.Y)("div",{className:"Z2Iz5Ghc",children:(0,se.Y)(he.A,{name:"check-bold"})})]}),(0,se.Y)("div",{className:"g1cuprzz",children:(0,Pt.A)(h||r("ActionFallbackSomeone"))})]},e)})})})}),Gs=(0,s.ph)((0,n.EK)(e=>{const{chatFolders:{byId:t,orderedIds:i},chats:{listIds:s,orderedPinnedIds:n},currentUserId:a}=e;return{activeListIds:s.active,archivedListIds:s.archived,pinnedIds:n.active,contactIds:e.contactList?.userIds,currentUserId:a,chatFoldersById:t,orderedFolderIds:i,maxFolders:(0,ys.d)(e,"dialogFilters")}})(({isOpen:e,currentUserId:t,activeListIds:i,archivedListIds:a,pinnedIds:r,contactIds:d,filter:h=o.K_A,title:m,className:u,searchPlaceholder:p,isLowStackPriority:v,chatFoldersById:g,orderedFolderIds:A,isForwarding:f,isMultiSelect:C,maxFolders:b,withFolders:y,footer:S,viewportFooter:N,loadMore:k,onSelectRecipient:w,onSelectedIdsChange:I,onClose:P,onCloseAnimationEnd:Y})=>{const{openLimitReachedModal:F}=(0,n.ko)(),D=(0,Fi.A)(),[M,B]=(0,s.J0)(""),[L,R]=(0,s.J0)([]),[x,E]=(0,s.J0)([]),[V,_]=(0,s.J0)([]),U=(0,ws.i)(L),O=(0,ws.i)(x),K=(0,ws.i)(V),[J,G]=(0,s.J0)(0),{displayedFolders:j,folderTabs:z}=(0,ks.A)({sidebarMode:!1,orderedFolderIds:A,chatFoldersById:g,maxFolders:b,isReadOnly:!0}),H=y&&z&&z.length>1&&!M,$=j?.[J]?.id||o.DSF,q=(0,Ns.Rh)($),W=(0,T.A)(e=>{const t=z?.[e];t&&(t.isBlocked?F({limit:"dialogFilters"}):G(e))}),Q=(0,T.A)((e,t)=>{R(e),I?.(e),t&&(0,c.PKK)((0,n.mS)())&&(_([...K.current,t]),setTimeout(()=>{_(K.current.filter(e=>e!==t))},200))}),Z=(0,T.A)(e=>{if(!O.current.includes(e)){if(!(0,c.PKK)((0,n.mS)())){const t=U.current.filter(t=>t!==e);return R(t),void I?.(t)}E([...O.current,e]),setTimeout(()=>{E(O.current.filter(t=>t!==e));const t=U.current.filter(t=>t!==e);R(t),I?.(t)},300)}}),X=(0,T.A)((e,t)=>{const i=t?`${e}:${t}`:e;L.includes(i)?Z(i):Q([...L,i],i)}),ee=(0,T.A)((e,t)=>{C?X(e,t):w(e,t)}),te=(0,s.Kr)(()=>{if(!e)return[];let s=r||[];t&&(s=(0,di.Am)([t,...s]));const o=(0,n.mS)(),m=(H?q||[]:[...i||[],...M&&a||[]]).filter(e=>{if((0,l.DX)(e))return!1;const t=(0,c.hds)(o,e),i=(0,c.mBe)(o,e),s=t&&(0,l.ub)(t,"postMessages"),n=t&&(0,l.WX)(t);if(f&&n&&!s)return!1;if(i&&!(0,l.PL)(i))return!0;if(!t)return!1;if(t.isMonoforum&&(0,c.ODG)(o,e))return!1;const a=(0,c.AWZ)(o,e);return!a||(0,l.__)(t,void 0,void 0,a)}),u=H?m:(0,di.Am)([...t?[t]:[],...m,...d||[]]),p=(0,Ss.A)((0,It.PU)({ids:u,query:M}),void 0,s,t);return(0,c.yMZ)(o,p,h)},[e,r,t,i,M,a,d,h,f,q,H]),ie=(0,Si.A)(te,!0),ne=(0,s.Kr)(()=>d?d.slice(0,15):[],[d]),ae=C&&L.length>0,oe=(0,T.A)(e=>{const t=e.indexOf(":");return-1===t?{peerId:e}:{peerId:e.substring(0,t),topicId:Number(e.substring(t+1))}}),re=(0,T.A)(e=>{const{peerId:t,topicId:i}=oe(e);if(!i)return;const s=(0,n.mS)(),a=(0,c.S0q)(s,t,i),o=(0,c.hds)(s,t);if(!a||!o)return;const r=(0,l.Js)(D,o);return`${a.title}${r}`}),le=(0,s.hb)(e=>ae?(0,se.Y)("div",{className:"search-row-with-chips",children:(0,se.FD)("div",{className:"chips-and-search-scroll no-scrollbar",children:[L.map(e=>{const{peerId:t}=oe(e),i=re(e),s=V.includes(e),n=x.includes(e);return(0,se.Y)("div",{className:(0,ge.A)("picker-chip-wrapper",s&&"picker-chip-appear",n&&"picker-chip-disappear"),children:(0,se.Y)(Ps.A,{peerId:t,title:i,size:"small",forceShowSelf:!0,canClose:!0,className:"picker-chip",itemClassName:"picker-chip-name",clickArg:e,onClick:Z})},e)}),(0,se.FD)("div",{className:"inline-search",children:[(0,se.Y)("i",{className:"icon icon-search"}),(0,se.Y)("input",{ref:e.inputRef,className:"search-input",type:"text",dir:"auto",placeholder:e.placeholder,value:e.value,onChange:e.onChange,onKeyDown:e.onKeyDown})]})]})}):(0,se.FD)("div",{className:"search-input-wrapper",children:[(0,se.Y)("i",{className:"icon icon-search"}),(0,se.Y)("input",{ref:e.inputRef,className:"search-input",type:"text",dir:"auto",placeholder:e.placeholder,value:e.value,onChange:e.onChange,onKeyDown:e.onKeyDown})]}),[ae,L,V,x]),ce=(0,s.Kr)(()=>{const e=ne.length>0&&!M,i=H;if(e||i)return(0,se.FD)(se.FK,{children:[e&&(0,se.Y)(Js,{contactIds:ne,currentUserId:t,selectedIds:C?L:void 0,className:"jvwlI557",onSelect:ee}),Boolean(i)&&z&&(0,se.Y)(Is.A,{tabs:z,activeTab:J,onSwitchTab:W})]})},[ne,M,H,t,ee,C,L,z,J,W]);return(0,se.Y)(Os,{isOpen:e,className:u,chatOrUserIds:ie,currentUserId:t,title:m,searchPlaceholder:p,search:M,renderSearchRow:le,subheader:ce,footer:S,viewportFooter:N,listActiveKey:J,selectedIds:C?L:void 0,onSearchChange:B,loadMore:k,onSelectChatOrUser:ee,onClose:P,onCloseAnimationEnd:Y,isLowStackPriority:v})}));var js=i(19806);const zs="XtlmXkE6",Hs=(0,s.ph)((0,n.EK)(e=>{const{messageIds:t,storyId:i,fromChatId:s}=(0,c.nTw)(e).forwardMessages,n=t&&t.length>0;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(i),isForwarding:n,fromChatId:s,forwardMessageIds:t,shouldPaidMessageAutoApprove:e.settings.byKey.shouldPaidMessageAutoApprove}})(({isOpen:e,currentUserId:t,isManyMessages:i,isStory:a,isForwarding:o,fromChatId:r,forwardMessageIds:d,shouldPaidMessageAutoApprove:h})=>{const{openChatOrTopicWithReplyInDraft:m,setForwardChatOrTopic:u,exitForwardMode:p,forwardToSavedMessages:g,forwardToMultipleChats:A,forwardStory:f,showNotification:C,copyMessageLink:b,openStarsBalanceModal:y,setPaidMessageAutoApprove:S}=(0,n.ko)(),N=(0,Fi.A)(),k=(0,B.A)(),w=(0,K.A)(a,!0),[I,P,Y]=(0,D.A)(),[F,M]=(0,s.J0)([]),[L,R]=(0,s.J0)(""),[x,E,V]=(0,D.A)(),[_,U]=(0,s.J0)(h),O=o&&!a,J=d?.length||0,G=(0,s.Kr)(()=>{if(!F.length)return{paidChatsCount:0,totalStars:0,totalMessages:0};const e=(0,n.mS)();let t=0,i=0;const s=L.trim().length>0,a=J+(s?1:0);for(const s of F){const n=(0,c.WA9)(e,s);n&&(t++,i+=n*a)}return{paidChatsCount:t,totalStars:i,totalMessages:a}},[F,J,L]),j=(0,s.Kr)(()=>{if(!r||1!==d?.length)return!1;const e=(0,n.mS)(),t=(0,c.zeq)(e,r);if(!t)return!1;const i=t[d[0]];return i&&(0,c.dVs)(e,i)},[r,d]);(0,s.vJ)(()=>{e&&P()},[e,P]),(0,s.vJ)(()=>{e||(M([]),R(""))},[e]);const z=(0,s.hb)((e,s)=>{const r=e===t;if(a){f({toChatId:e});const t=(0,n.mS)();if((0,v.L8)(e))C({message:r?k("Conversation.StoryForwardTooltip.SavedMessages.One"):k("StorySharedTo",(0,l.u0)((0,c.mBe)(t,e)))});else{const i=(0,c.hds)(t,e);if(!i)return;C({message:k("StorySharedTo",(0,l.Js)(k,i))})}return}if(r){const e=k(i?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");g({}),C({message:e})}else{const t=e,i=s?Number(s):void 0;o?u({chatId:t,topicId:i}):m({chatId:t,topicId:i})}},[t,i,a,k,o]),H=(0,s.hb)(()=>{p()},[p]),$=(0,T.A)(e=>{M(e)}),q=(0,T.A)(()=>{r&&d?.length&&(b({chatId:r,messageId:d[0]}),p())}),W=(0,T.A)(()=>{if(F.length)if(1!==F.length)if(G.totalStars>0&&!h)E();else{if(G.totalStars>0){const e=(0,n.mS)().stars?.balance?.amount||0;if(G.totalStars>e)return void y({topup:{balanceNeeded:G.totalStars}})}Q()}else u({chatId:F[0]})}),Q=(0,T.A)(()=>{A({toChatIds:F,comment:L||void 0}),C({message:N("FwdMessagesToChats",{count:F.length},{pluralValue:F.length})}),p()}),Z=(0,T.A)(()=>{const{totalStars:e}=G;e>((0,n.mS)().stars?.balance?.amount||0)?y({topup:{balanceNeeded:e}}):(V(),_&&S(),Q())}),ee=(0,s.Kr)(()=>(0,se.Y)("div",{className:"picker-list-spacer"}),[]),te=F.length,ie=te>=2,{totalStars:ne}=(0,Cs.A)({totalStars:G.totalStars},!ie),ae=(0,s.Kr)(()=>{if(o&&!a)return(0,se.FD)("div",{className:"picker-footer",children:[(0,se.Y)("div",{className:(0,ge.A)("RzrVoYN7",!ie&&zs),children:(()=>{const e=0===te,t=1===te?G.totalStars:0;return(0,se.Y)(X.A,{className:"picker-footer-button",color:"primary",disabled:e&&!j,onClick:e?q:W,children:(0,se.Y)(oe.Ay,{name:"fade",activeKey:e?0:1,slideClassName:"rC4tg125",children:(0,se.Y)("span",{children:e?j?k("CopyLink"):N("SelectChats"):t>0?N("ForwardForStars",{price:(0,wi.U2)(N,t,{asFont:!0})},{withNodes:!0}):N("Forward")})})})})()}),(0,se.Y)("div",{className:(0,ge.A)("UTDObnoN",ie&&zs),children:(0,se.Y)("div",{className:"picker-footer-input",children:(0,se.FD)("div",{className:"picker-caption-wrapper",children:[(0,se.Y)("input",{className:"picker-caption-input",type:"text",value:L,onChange:e=>R(e.currentTarget.value),placeholder:N("AttachmentCaptionPlaceholder")}),(0,se.Y)(X.A,{className:"picker-send-button",color:"primary",onClick:W,ariaLabel:N("Forward"),children:ne>0?(0,se.FD)(se.FK,{children:[(0,se.Y)(he.A,{name:"star",className:"star-icon"}),(0,se.Y)(bs.A,{text:String(ne)})]}):(0,se.Y)("i",{className:"icon icon-new-send"})})]})})})]})},[o,a,te,ie,L,j,ne,G,W,q,N,k]);if(!e&&!I)return;const re=G.totalStars>0?N("ForwardPaidChatsConfirmation",{chatsSelected:N("ForwardPaidChatsSelected",{paidChatsCount:G.paidChatsCount},{withNodes:!0,withMarkdown:!0,pluralValue:G.paidChatsCount}),payConfirmation:N("ForwardPaidChatsPayConfirmation",{totalAmount:(0,wi.Kk)(N,G.totalStars),count:G.totalMessages},{withNodes:!0,withMarkdown:!0,pluralValue:G.totalMessages})},{withNodes:!0}):void 0,le=N("PayForMessage",{count:G.totalMessages},{withNodes:!0,pluralValue:G.totalMessages});return(0,se.FD)(se.FK,{children:[(0,se.Y)(Gs,{isOpen:e,className:w?"component-theme-dark":void 0,title:N("ShareWith"),searchPlaceholder:N("Search"),isMultiSelect:O,footer:ae,viewportFooter:ee,onSelectRecipient:z,onSelectedIdsChange:$,onClose:H,onCloseAnimationEnd:Y,isForwarding:o,withFolders:!0}),(0,se.FD)(ai.A,{title:N("TitleConfirmPayment"),confirmLabel:le,isOpen:x,onClose:V,confirmHandler:Z,children:[re,(0,se.Y)(js.A,{label:N("DoNotAskAgain"),checked:_,onCheck:U})]})]})})),$s=(0,s.ph)(({requestedDraft:e})=>{const t=Boolean(e&&!e.chatId),{openChatWithDraft:i,resetOpenChatWithDraft:a}=(0,n.ko)(),o=(0,Fi.A)(),[r,l,c]=(0,D.A)();(0,s.vJ)(()=>{t&&l()},[t,l]);const d=(0,s.hb)((t,s)=>{i({chatId:t,threadId:s,text:e.text,files:e.files})},[i,e]),h=(0,s.hb)(()=>{a()},[a]);if(t||r)return(0,se.Y)(Gs,{isOpen:t,title:o("ShareWith"),searchPlaceholder:o("Search"),filter:e?.filter,onSelectRecipient:d,onClose:h,onCloseAnimationEnd:c})}),qs=(0,s.ph)(({requestedAttachBotInChat:e})=>{const{cancelAttachBotInChat:t,callAttachBot:i}=(0,n.ko)(),a=(0,Fi.A)(),o=Boolean(e),[r,l,c]=(0,D.A)();(0,s.vJ)(()=>{o&&l()},[o,l]);const{bot:d,filter:h,startParam:m}=e||{},u=(0,s.hb)(e=>{i({bot:d,chatId:e,startParam:m}),t()},[d,i,t,m]);if(o||r)return(0,se.Y)(Gs,{isOpen:o,title:a("SelectChat"),searchPlaceholder:a("Search"),filter:h,onSelectRecipient:u,onClose:t,onCloseAnimationEnd:c})});var Ws=i(26087),Qs=i(24585);const Zs=(0,s.ph)(({url:e})=>{const{toggleSafeLinkModal:t}=(0,n.ko)(),i=(0,Fi.A)(),a=(0,s.hb)(()=>{e&&(window.open((0,Qs.Tc)(e),"_blank","noopener noreferrer"),t({url:void 0}))},[t,e]),o=(0,s.hb)(()=>{t({url:void 0})},[t]),r=(0,Si.A)(e);return(0,se.Y)(ai.A,{isOpen:Boolean(e),onClose:o,title:i("OpenUrlTitle"),textParts:(0,Pt.A)(i("OpenUrlText",{url:r},{withNodes:!0,withMarkdown:!0})),confirmLabel:i("OpenUrlConfirm"),confirmHandler:a})});var Xs=i(47526);const en=(0,s.ph)(({modal:e})=>{const{closeMapModal:t}=(0,n.ko)(),{point:i,zoom:a}=e||{},o=(0,B.A)(),r=Boolean(i),l=(0,T.A)(()=>{t()}),[c,d,h,u]=(0,s.Kr)(()=>{if(!i)return[];const e=(0,Xs.zS)("google",i,a),t=(0,Xs.zS)("bing",i,a),s=(0,Xs.zS)("osm",i,a);return[e,t,(0,Xs.zS)("apple",i,a),s]},[i,a]),p=(0,T.A)(e=>{t(),window.open(e,"_blank","noopener")}),v=(0,T.A)(()=>{p(c)}),g=(0,T.A)(()=>{p(d)}),A=(0,T.A)(()=>{p(h)}),f=(0,T.A)(()=>{p(u)});return(0,se.FD)(te.A,{contentClassName:"VJDwJpsF",title:o("OpenMapWith"),isOpen:r,onClose:l,isSlim:!0,children:[(0,se.FD)("div",{className:"aYO2C2Hx",children:[(m.pz||m.MP)&&(0,se.Y)(X.A,{fluid:!0,size:"smaller",onClick:A,children:"Apple Maps"}),(0,se.Y)(X.A,{fluid:!0,size:"smaller",onClick:v,children:"Google Maps"}),(0,se.Y)(X.A,{fluid:!0,size:"smaller",onClick:g,children:"Bing Maps"}),(0,se.Y)(X.A,{fluid:!0,size:"smaller",onClick:f,children:"OpenStreetMap"})]}),(0,se.Y)("div",{className:"dialog-buttons mt-2",children:(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:o("Cancel")})})]})});var tn=i(64713),sn=i(87412),nn=i(84685);const an={content:"jBdWsSFY",center:"AkTjFYUS",textCenter:"g__9CLCQ",title:"smVIBWXa",actions:"OdtxQhLZ",infoCard:"ya1CESP4",infoLabel:"tTy56DcP",note:"Bs7Lf3QD",allowMessages:"R_X7jC91",infoValue:"GtgpHX_Y",matchCodes:"SI3bVp__",matchCodeButton:"gMdAhAzP",footnote:"KfSLcqGx",cancelButton:"rtMLZB5Q"},on=2*g.$,rn=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=(0,c.mBe)(e,e.currentUserId);return{bot:t?.request?.botId?(0,c.mBe)(e,t.request.botId):void 0,currentUser:i}})(({modal:e,bot:t,currentUser:i})=>{const{acceptBotUrlAuth:a,acceptLinkUrlAuth:o,checkUrlAuthMatchCode:r,declineUrlAuth:d}=(0,n.ko)(),h=(0,Fi.A)(),m=(0,Si.A)(e,!1),u=(0,Si.A)(t,!1),p=e?.request,v=m?.request,g=m?.matchCode,A=(0,l.Yg)(u)||u?.firstName,f=Boolean(p?.matchCodesFirst&&p.matchCodes?.length&&!e?.matchCode),C=Boolean(e?.url&&e?.request)&&!f,[b,y]=(0,s.J0)(()=>Boolean(p?.shouldRequestWriteAccess)),[S,N]=(0,s.J0)(),[k,w]=(0,s.J0)("closed"),I=g||S,P=f||"match-confirm"===k,Y="phone"===k,F=(0,s.hb)(e=>v?.matchCodes?.map(t=>(0,c.oei)(e,t)),[v?.matchCodes]),D=(0,Ds.LV)(F);(0,s.vJ)(()=>{if(!p)return N(void 0),void w("closed");y(Boolean(p.shouldRequestWriteAccess)),N(void 0),w("closed")},[p]);const M=(0,T.A)(()=>{w("closed"),d()}),B=(0,T.A)((e={})=>{(m?.button?a:o)({isWriteAllowed:v?.shouldRequestWriteAccess?b:void 0,wasPhoneShared:e.wasPhoneShared,matchCode:e.matchCode??I})}),L=(0,T.A)(()=>{v&&(!v.matchCodes?.length||I?v.shouldRequestPhoneNumber?w("phone"):B():w("match-confirm"))}),R=(0,T.A)(()=>{w("closed")}),x=(0,T.A)(e=>{f?r({matchCode:e}):(N(e),w("closed"),v?.shouldRequestPhoneNumber?w("phone"):B({matchCode:e}))}),E=(0,T.A)(()=>{w("closed")}),V=(0,T.A)(e=>{w("closed"),B({wasPhoneShared:e})}),_=(0,T.A)(()=>{y(!b)});if(!v)return;const U=Boolean(v.platform||v.browser||v.ip||v.region),O=v.domain,K=i?.phoneNumber?`+${(0,tn.n4)(i.phoneNumber)}`:void 0,J=h("BotAuthTitle",{url:(0,se.Y)(nn.A,{url:O,text:O})},{withNodes:!0}),G=h("BotAuthSiteSubtitle",void 0,{withNodes:!0,withMarkdown:!0});return(0,se.FD)(se.FK,{children:[(0,se.FD)(te.A,{isOpen:C,contentClassName:an.content,className:"tall",onClose:M,hasAbsoluteCloseButton:!0,isSlim:!0,children:[(0,se.Y)(Yt.A,{peer:u,size:96,className:an.center}),(0,se.Y)("h2",{className:(0,ge.A)(an.center,an.title),dir:"auto",children:J}),(0,se.Y)("span",{className:an.textCenter,children:G}),U&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:an.infoCard,children:[(0,se.Y)("span",{className:an.infoLabel,children:h("BotAuthDevice")}),(0,se.Y)("span",{className:an.infoValue,children:[v.platform,v.browser].filter(Boolean).join(" · ")}),(0,se.Y)("span",{className:an.infoLabel,children:h("SessionPreviewIp")}),(0,se.Y)("span",{className:an.infoValue,children:v.ip}),(0,se.Y)("span",{className:an.infoLabel,children:h("SessionPreviewLocation")}),(0,se.Y)("span",{className:an.infoValue,children:v.region})]}),(0,se.Y)("span",{className:an.note,children:h("BotAuthInfo")})]}),v.shouldRequestWriteAccess&&(0,se.FD)(se.FK,{children:[(0,se.Y)(li.A,{className:an.allowMessages,onClick:_,rightElement:(0,se.Y)(ci.A,{id:"url_auth_allow_messages",label:h("BotAuthAllowMessages"),checked:b}),children:h("BotAuthAllowMessages")}),A&&(0,se.Y)("span",{className:an.note,children:h("BotAuthAllowMessagesInfo",{bot:A},{withNodes:!0,withMarkdown:!0})})]}),(0,se.FD)("div",{className:(0,ge.A)(an.actions,an.center),children:[(0,se.Y)(X.A,{className:an.actionButton,color:"gray",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:M,children:h("Cancel")}),(0,se.Y)(X.A,{className:an.actionButton,color:"primary",fluid:!0,noForcedUpperCase:!0,onClick:L,children:h("BotAuthLogin")})]})]}),(0,se.FD)(te.A,{isOpen:P,title:h("BotAuthSelectEmoji"),onClose:f?M:R,className:(0,ge.A)("confirm",an.matchDialog),children:[(0,se.Y)("div",{className:an.matchCodes,children:v.matchCodes?.map((e,t)=>{const i=D?.[t];return(0,se.Y)(X.A,{fluid:!0,color:"adaptive",className:an.matchCodeButton,onClick:()=>x(e),children:i?(0,se.Y)(sn.A,{sticker:i,size:on}):(0,Pt.A)(e)},e)})}),(0,se.Y)("div",{className:an.footnote,children:h("BotAuthTitle",{url:(0,se.Y)(nn.A,{url:O,text:O})},{withNodes:!0})}),(0,se.Y)(X.A,{color:"danger",className:an.cancelButton,isText:!0,noForcedUpperCase:!0,onClick:M,children:h("Cancel")})]}),(0,se.FD)(te.A,{isOpen:Y,title:h("BotAuthPhoneNumber"),onClose:E,className:(0,ge.A)("confirm",an.phoneDialog),children:[(0,se.FD)(se.FK,{children:[(0,se.Y)("p",{children:h("BotAuthPhoneNumberText",{domain:O,phone:K||h("Phone")},{withNodes:!0,withMarkdown:!0})}),(0,se.Y)("p",{children:h("BotAuthPhoneNumberQuestion")})]}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",color:"primary",noForcedUpperCase:!0,onClick:()=>V(!0),children:h("BotAuthPhoneNumberAccept")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",color:"gray",noForcedUpperCase:!0,onClick:()=>V(!1),children:h("BotAuthPhoneNumberDeny")})]})]})]})}));var ln=i(15379),cn=i(10722);const dn=1e3*o.fRl,hn=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function mn(e,t,i,s,n){const a=new Date(e,t,i),o=s&&(0,We.pU)(s),r=n&&(0,We.pU)(n);return!!(r&&a>r)||!!(o&&a<o)}function un(e){return String(e).padStart(2,"0")}function pn(e,t,i){return`${e}-${t+1}-${i}`}const vn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.g29)(e);return{isTestServer:e.config?.isTestServer,isCurrentUserPremium:t}})(({selectedAt:e,minAt:t,maxAt:i,isFutureMode:a,isPastMode:o,isOpen:r,withTimePicker:l,withRepeatMode:c,initialRepeatMode:d,submitButtonLabel:h,secondButtonLabel:m,description:u,isTestServer:p,isCurrentUserPremium:v,onClose:g,onSubmit:A,onDateChange:f,onSecondButtonClick:C})=>{const{showNotification:b}=(0,n.ko)(),y=(0,s.li)(),S=(0,s.li)(),N=(0,B.A)(),k=(0,Fi.A)(),w=new Date,{isContextMenuOpen:I,contextMenuAnchor:P,handleContextMenu:Y,handleContextMenuClose:F,handleContextMenuHide:M}=(0,cn.A)(y),L=(0,T.A)(()=>S.current),R=(0,T.A)(()=>y.current.querySelector(".bubble")),x=(0,T.A)(()=>S.current.querySelector(".repeat-mode-button")),E=(0,s.Kr)(()=>a&&!t?new Date:new Date(Math.max(t||0,0)),[a,t]),V=(0,s.Kr)(()=>o&&!i?new Date:new Date(Math.min(i||dn,dn)),[o,i]),_=(0,s.Kr)(()=>e?new Date(e):new Date,[e]),U=(0,K.A)(r),[O,J]=(0,D.A)(!1),[G,j]=(0,s.J0)(_),[z,H]=(0,s.J0)(()=>new Date(G.getFullYear(),G.getMonth(),1)),[$,q]=(0,s.J0)(()=>un(_.getHours())),[W,Q]=(0,s.J0)(()=>un(_.getMinutes())),[Z,ee]=(0,s.J0)(d||"never"),ie=pn(G.getFullYear(),G.getMonth(),G.getDate()),ne=z.getFullYear(),ae=z.getMonth(),oe=a&&G.getTime()<E.getTime()||o&&G.getTime()>V.getTime();(0,s.vJ)(()=>{r||ee("never")},[r]),(0,s.vJ)(()=>{ee(d||"never")},[d]),(0,s.vJ)(()=>{!U&&r&&(j(_),H(new Date(_.getFullYear(),_.getMonth(),1)),l&&(q(un(_.getHours())),Q(un(_.getMinutes()))))},[_,r,U,l]),(0,s.vJ)(()=>{a&&!O&&G.getTime()<E.getTime()&&(j(E),q(un(E.getHours())),Q(un(E.getMinutes())))},[a,O,E,G]),(0,s.vJ)(()=>{o&&!O&&G.getTime()>V.getTime()&&(j(V),q(un(V.getHours())),Q(un(V.getMinutes())))},[a,o,O,V,E,G]),(0,s.vJ)(()=>{if(e){const t=new Date(e);j(t),q(un(t.getHours())),Q(un(t.getMinutes()))}},[e]);const re=o&&ne>=w.getFullYear()&&ae>=w.getMonth()||V&&ne>=V.getFullYear()&&ae>=V.getMonth(),le=a&&ne<=w.getFullYear()&&ae<=w.getMonth(),{prevMonthGrid:ce,currentMonthGrid:de,nextMonthGrid:he}=(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}}(ne,ae),[ae,ne]),me=(0,s.Kr)(()=>h||function(e,t){const i=(0,We.A)(t,e.code);return i===(0,We.A)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,We.fU)(e,t)):e("Conversation.ScheduleMessage.SendOn",[i,(0,We.fU)(e,t)])}(N,G),[N,G,h]),pe=(0,T.A)(e=>{v?Y(e):b({message:k("MessageScheduledRepeatPremium"),action:{action:"openPremiumModal",payload:{}},actionText:k("PremiumMore")})}),ve=(0,s.hb)(()=>{A(a&&G<E?E:o&&G>V?V:G,c&&"never"!==Z?Z:void 0)},[a,o,E,V,A,G,c,Z]),Ae=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return q(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),23)),s=new Date(G.getTime());s.setHours(i),j(s),f?.(s);const n=un(i);q(n),e.target.value=n},[G,f]),fe=(0,s.hb)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return Q(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),59)),s=new Date(G.getTime());s.setMinutes(i),j(s),f?.(s);const n=un(i);Q(n),e.target.value=n},[G,f]),Ce=(0,s.hb)(e=>(0,se.Y)(ue.A,{onClick:()=>ee(e),children:(0,ln.j5)(e,k)},e),[k]),be=(0,s.Kr)(()=>ln.to.filter(e=>p||!ln.Vb.has(e)),[p]);return(0,se.FD)(te.A,{isOpen:r,onClose:g,className:"CalendarModal",onEnter:ve,dialogRef:S,hasAbsoluteCloseButton:!0,children:[(0,se.Y)("div",{className:"container",children:(0,se.FD)("div",{className:"month-selector",children:[(0,se.FD)("h4",{children:[N(`lng_month${ae+1}`)," ",ne]}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",iconName:"previous",disabled:le,onClick:le?void 0:function(){H(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})}}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",iconName:"next",disabled:re,onClick:re?void 0:function(){H(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t})}})]})}),(0,se.Y)("div",{className:"calendar-wrapper",children:(0,se.FD)("div",{className:"calendar-grid",children:[hn.map(e=>(0,se.Y)("div",{className:"day-button faded weekday",children:(0,se.Y)("span",{children:N(e)})})),ce.map(e=>(0,se.Y)("div",{className:"day-button disabled",children:(0,se.Y)("span",{children:e})})),de.map(e=>(0,se.Y)("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void j(e=>{const i=new Date(e);return i.setDate(t),i.setMonth(ae),i.setFullYear(ne),f?.(i),i});var t},className:(0,ge.A)("day-button","div-button",mn(ne,ae,e,E,V)?"disabled":e?"clickable":"",ie===pn(ne,ae,e)&&"selected"),children:Boolean(e)&&(0,se.Y)("span",{children:e})})),he.map(e=>(0,se.Y)("div",{className:"day-button disabled",children:(0,se.Y)("span",{children:e})}))]})}),l&&(0,se.FD)("div",{className:"timepicker",children:[(0,se.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:$,onChange:Ae,onFocus:J}),":",(0,se.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:W,onChange:fe,onFocus:J})]}),c&&r&&function(){const e=(0,ge.A)("drop-down-icon",!I&&"expanded-icon");return(0,se.FD)("div",{className:"repeat-mode",ref:y,children:[(0,se.Y)(X.A,{className:"repeat-mode-button",onClick:pe,noForcedUpperCase:!0,isText:!0,iconName:v?"down":"lock-badge",iconClassName:v?e:void 0,iconAlignment:"end",children:k("ScheduleRepeat",{value:(0,ln.j5)(Z,k)})}),(0,se.Y)(Ze.A,{isOpen:I,className:"with-menu-transitions",anchor:P,getTriggerElement:x,getRootElement:L,getMenuElement:R,onClose:F,onCloseAnimationEnd:M,autoClose:!0,children:be.map(Ce)})]})}(),(0,se.FD)("div",{className:"footer",children:[u&&(0,se.Y)("div",{className:"description",children:u}),(0,se.FD)("div",{className:"footer",children:[(0,se.Y)(X.A,{onClick:ve,disabled:oe,children:me}),m&&(0,se.Y)(X.A,{onClick:C,isText:!0,children:m})]})]})]})})),gn=(0,s.ph)((0,n.EK)(e=>({selectedAt:(0,c.nTw)(e).historyCalendarSelectedAt}))(({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:i,closeHistoryCalendar:a}=(0,n.ko)(),o=(0,s.hb)(e=>{i({timestamp:e.getTime()/1e3}),a()},[a,i]),r=(0,B.A)();return(0,se.Y)(vn,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:a,onSubmit:o})}));var An=i(13235),fn=i(94079);const Cn=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=t?(0,c.mBe)(e,t):void 0,s=t?(0,c.vGo)(e,t):void 0,n=e.appConfig?.contactNoteLimit||An.tI;return{user:i,userStatus:t?(0,c.K0y)(e,t):void 0,phoneCodeList:e.countryList.phoneCodes,contactNoteLimit:n,noteText:s?.note?.text}})(({isOpen:e,userId:t,isByPhoneNumber:i,user:a,userStatus:o,phoneCodeList:r,contactNoteLimit:c,noteText:d})=>{const{updateContact:h,importContact:u,closeNewContactDialog:p}=(0,n.ko)(),v=(0,B.A)(),g=(0,Fi.A)(),A=(0,Si.A)(a),f=(0,Si.A)(i),C=(0,s.li)(),[b,y,S]=(0,D.A)(),[N,k]=(0,s.J0)(A?.firstName??""),[w,I]=(0,s.J0)(A?.lastName??""),[P,Y]=(0,s.J0)(A?.phoneNumber??""),[F,M]=(0,s.J0)(""),[T,L]=(0,s.J0)(!0),R=Boolean(N&&(!i||P)),x=c-F.length,E=(0,s.li)();(0,s.vJ)(()=>{e&&(y(),k(A?.firstName??""),I(A?.lastName??""),Y(A?.phoneNumber??""),M(d??""),L(!0))},[e,y,d,A?.firstName,A?.lastName,A?.phoneNumber]),(0,s.vJ)(()=>{!m.TF&&b&&setTimeout(()=>{C.current?.focus()},200)},[b]);const V=(0,s.hb)(e=>{k(e.target.value)},[]),_=(0,s.hb)(e=>{Y((0,tn.Ox)(r,e.target.value))},[r]),U=(0,s.hb)(e=>{I(e.target.value)},[]),O=(0,s.hb)(e=>{M(e.target.value)},[]),K=(0,s.hb)(()=>{p(),k(""),I(""),Y(""),M("")},[p]),J=(0,s.hb)(()=>{const e=F.trim()?{text:F,entities:[]}:void 0;i||!t?u({firstName:N,lastName:w,phoneNumber:P}):h({userId:t,firstName:N,lastName:w,shouldSharePhoneNumber:T,note:e})},[N,u,i,w,F,P,T,h,t]);if(e||b)return(0,se.FD)(te.A,{className:"NewContactModal",title:v("NewContact"),isOpen:e,onClose:K,onCloseAnimationEnd:S,children:[A&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"NewContactModal__profile",dir:g.isRtl?"rtl":void 0,children:[(0,se.Y)(Yt.A,{size:"jumbo",peer:A,text:`${N} ${w}`}),(0,se.FD)("div",{className:"NewContactModal__profile-info",children:[(0,se.Y)("p",{className:"NewContactModal__phone-number",children:A?.phoneNumber?(0,tn.Ox)(r,A.phoneNumber):v("MobileHidden")}),(0,se.Y)("span",{className:"NewContactModal__user-status",dir:"auto",children:(0,l.CD)(v,A,o)})]})]}),(0,se.Y)(ee.A,{ref:C,value:N,label:v("FirstName"),tabIndex:0,onChange:V}),(0,se.Y)(ee.A,{value:w,label:v("LastName"),tabIndex:0,onChange:U}),(0,se.Y)(fn.A,{ref:E,id:"user-note",label:g("UserNoteTitle"),onChange:O,value:F,maxLength:c,maxLengthIndicator:x.toString(),noReplaceNewlines:!0}),(0,se.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__edit",children:g("EditUserNoteHint")}),(0,se.Y)("p",{className:"NewContactModal__help-text",children:(0,Pt.A)(v("NewContact.Phone.Hidden.Text",A?.firstName||""),["emoji","simple_markdown"])}),(0,se.Y)(js.A,{className:"dialog-checkbox",checked:T,tabIndex:0,onCheck:L,label:v("lng_new_contact_share")}),(0,se.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__negative",children:(0,Pt.A)(v("AddContact.SharedContactExceptionInfo",A?.firstName))})]}),f&&(0,se.FD)("div",{className:"NewContactModal__new-contact",dir:g.isRtl?"rtl":void 0,children:[(0,se.Y)(Yt.A,{size:"jumbo",text:`${N} ${w}`}),(0,se.FD)("div",{className:"NewContactModal__new-contact-fieldset",children:[(0,se.Y)(ee.A,{ref:C,value:P,inputMode:"tel",label:v("lng_contact_phone"),tabIndex:0,onChange:_}),(0,se.Y)(ee.A,{value:N,label:v("FirstName"),tabIndex:0,onChange:V}),(0,se.Y)(ee.A,{value:w,label:v("LastName"),tabIndex:0,onChange:U})]})]}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",disabled:!R,onClick:J,children:v("Done")}),(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:K,children:v("Cancel")})]})]})}));var bn=i(20179),yn=i(48894),Sn=i(32625);let Nn=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 kn={top:Nn.Top,bottom:Nn.Bottom,left:Nn.Left,right:Nn.Right,topLeft:Nn.TopLeft,topRight:Nn.TopRight,bottomLeft:Nn.BottomLeft,bottomRight:Nn.BottomRight},wn=Object.keys(kn);let In;const Pn={x:0,y:0};const Yn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).webApps,{botId:i}=(0,c.ES7)(e)||{},{modalState:s,openedWebApps:n}=t||{},a="minimized"===s;return{activeTabBot:i?(0,c.mBe)(e,i):void 0,isMinimizedState:a,openedWebApps:n}})(({activeTabBot:e,isMinimizedState:t,openedWebApps:i})=>{const{changeWebAppModalState:a,closeWebAppModal:o}=(0,n.ko)(),r=(0,B.A)(),l=(0,Fi.A)(),d=(0,s.li)(),h=(0,s.Kr)(()=>i&&Object.values(i),[i]),m=h?.length,u=(0,s.Kr)(()=>{if(!m)return[];const t=(0,n.mS)(),i=e?.id;return(0,di.Am)([i,...h.map(e=>e.botId)]).map(e=>e&&(0,c.mBe)(t,e)).filter(Boolean).slice(0,3)},[m,e,h]),p=(0,T.A)(()=>{o()}),v=(0,T.A)(()=>{a({state:"maximized"})});if(t)return(0,se.FD)("div",{ref:d,className:(0,ge.A)("kUZmBlnN"),children:[(0,se.Y)(X.A,{className:"SMRJmUuE",round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:"P0P4gW6a",ariaLabel:r("Close"),onClick:p}),(0,se.Y)(qi.A,{className:"GP17QhNN",size:"mini",peers:u}),function(){const e=u.length>0&&u[0]?.firstName,t=m&&e&&m>1?l("MiniAppsMoreTabs",{botName:e,count:m-1},{pluralValue:m-1}):e;return(0,se.Y)("div",{className:"TZFjRaG4",children:t})}(),(0,se.Y)(X.A,{className:(0,ge.A)("Rax9j_TK","no-drag"),round:!0,color:"translucent",size:"tiny",iconName:"expand-modal",iconClassName:"sdbTXCxq",onClick:v})]})}));var Fn=i(14242),Dn=i(59852),Mn=i(84991);const Tn={container:"RFg0Ey2I","user-count-badge":"UZtJ6ZXb",userCountBadge:"UZtJ6ZXb","user-badge-icon":"pTiZFhsG",userBadgeIcon:"pTiZFhsG",name:"TzA5nqCC"},Bn=(0,s.ph)((0,n.EK)((e,{chatId:t})=>({user:(0,c.mBe)(e,t)}))(function({user:e,isPopularApp:t}){const{requestMainWebView:i}=(0,n.ko)(),s=(0,Fi.A)(),a=(0,T.A)(()=>{if(!e)return;const t=e?.id;if(!t)return;const s=(0,Dn.A)();i({botId:t,peerId:t,theme:s})});if(!e)return;const o=e?.firstName,r=e?.botActiveUsers,l=r&&t?(0,Fn.Vw)(s,r):void 0;return(0,se.Y)("div",{className:Tn.container,onClick:a,children:(0,se.Y)(Mn.A,{className:(0,ge.A)(Tn.avatarContainer,t&&"PopularAppGridItem"),textClassName:Tn.name,badgeClassName:Tn.userCountBadge,badgeIconClassName:Tn.userBadgeIcon,peer:e,text:o,badgeText:l,badgeIcon:"user-filled"})})})),Ln={root:"BJV09FsC",search:"bdi8G7GR","section-title":"ex3kxgWX",sectionTitle:"ex3kxgWX","section-content":"uIZzLhEh",sectionContent:"uIZzLhEh",showMoreLink:"h_Zs9ypA"},Rn=(0,Ce.nF)(e=>e(),500,!0),xn=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(({foundIds:e,recentBotIds:t})=>{const i=(0,B.A)(),o=(0,Fi.A)(),[r,l]=(0,s.J0)(!1),{searchPopularBotApps:c}=(0,n.ko)(),d=(0,T.A)(()=>{l(e=>!e)}),[h,m]=(0,s.J0)(""),u=(0,s.Kr)(()=>e?(0,It.PU)({ids:e,query:h,type:"user"}):[],[e,h]),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Rn(()=>{c()})},[]),v=(0,s.hb)(()=>{m("")},[]);return(0,se.FD)(ls.A,{className:(0,ge.A)(Ln.root,"custom-scroll"),items:u,onLoadMore:p,itemSelector:".PopularAppGridItem",noFastList:!0,preloadBackwards:30,children:[(0,se.Y)(ds.A,{className:Ln.search,value:h,onChange:m,onReset:v,placeholder:o("SearchApps")}),t&&!h&&(0,se.FD)("div",{className:Ln.section,children:[(0,se.FD)("div",{className:Ln.sectionTitle,children:[(0,se.Y)("span",{children:i("SearchAppsMine")}),(0,se.Y)("span",{className:Ln.showMoreLink,onClick:d,children:i(r?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")})]}),(0,se.Y)("div",{className:Ln.sectionContent,children:t.map((e,t)=>{if(r||!(t>=5))return(0,se.Y)(Bn,{chatId:e})})})]}),(0,se.FD)("div",{className:Ln.section,children:[(0,se.Y)("div",{className:Ln.sectionTitle,children:o(h?"Apps":"PopularApps")}),(0,se.Y)("div",{className:Ln.sectionContent,children:u&&u.map(e=>(0,se.Y)(Bn,{chatId:e,isPopularApp:!h}))})]})]})}));var En=i(4875);const Vn=3.675*g.$,_n="jEAibDyh",Un="ablUg8HU",On="Wrl63uWL",Kn="vOFiAq3l",Jn="KwI4XdkC",Gn="oq6HKJur",jn="a0AI_he5",zn="MvCwTbk_",Hn=250,$n=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),qn={ok:"OK",cancel:"Cancel",close:"Close"},Wn=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=t?.modalState,a=s?e.attachMenu.bots[s]:void 0,o=s?(0,c.mBe)(e,s):void 0,r=s?(0,c.vGo)(e,s):void 0,l=r?.botInfo?.appSettings,d=e.currentUserId?(0,c.mBe)(e,e.currentUserId):void 0,h=(0,c.SJA)(e),{isPaymentModalOpen:m,status:u}=(0,c.nTw)(e).payment,{status:p,inputInvoice:v}=(0,c.nTw)(e).starsPayment,g=o?(0,c.XOs)(e,o.id):void 0,A=p||u;return{attachBot:a,bot:o,currentUser:d,theme:h,isPaymentModalOpen:m||Boolean(v),paymentStatus:A,modalState:n,botAppPermissions:g,botAppSettings:l}})(({modal:e,webApp:t,bot:i,theme:a,isPaymentModalOpen:r,paymentStatus:c,registerSendEventCallback:d,registerReloadFrameCallback:h,isTransforming:u,modalState:p,isMultiTabSupported:v,onContextMenuButtonClick:g,botAppPermissions:A,botAppSettings:f,modalHeight:C})=>{const{closeActiveWebApp:b,sendWebViewData:y,toggleAttachBot:S,openTelegramLink:N,setWebAppPaymentSlug:k,switchBotInline:w,sharePhoneWithBot:I,updateWebApp:P,resetPaymentStatus:M,openChatWithInfo:L,showNotification:R,openEmojiStatusAccessModal:x,openLocationAccessModal:E,changeWebAppModalState:V,closeWebAppModal:_,openPreparedInlineMessageModal:U}=(0,n.ko)(),[O,K]=(0,s.J0)(),[J,G]=(0,s.J0)(),[j,z,H]=(0,D.A)(!1),[q,W]=(0,s.J0)(),Q=(0,Si.A)(q),[Z,ee]=(0,s.J0)(!1),[ie,ne]=(0,s.J0)(!1),[ae,re]=(0,s.J0)(),[le,ce]=(0,s.J0)(),[de,me]=(0,s.J0)(),{unlockPopupsAt:ue,handlePopupOpened:pe,handlePopupClosed:ve}=function(){const[e,t]=(0,s.J0)(0),i=(0,s.li)(0),n=(0,s.li)(0),a=(0,T.A)(()=>{const e=Date.now();e-n.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&t(e+2e3)}),o=(0,T.A)(()=>{e<Date.now()&&(n.current=Date.now())});return{unlockPopupsAt:e,handlePopupOpened:a,handlePopupClosed:o}}(),Ae=(0,s.li)(),fe=(0,s.li)(),Ce=(0,s.li)(),be="fullScreen"===p,ye="minimized"===p,Se=(0,T.A)(()=>{setTimeout(()=>{V({state:"maximized"})},350)}),Ne=(0,s.li)();(0,s.vJ)(()=>{Ne.current=document.querySelector("#portals")},[]);const[,ke,we]=(0,Ie.Ay)(Ne,Se),Ye=e?.activeWebAppKey?e.openedWebApps[e.activeWebAppKey]:void 0,{appName:Fe,backgroundColor:De}=Ye||{},{url:Me,buttonText:Te,isBackButtonVisible:Be}=t||{},{placeholderPath:Le}=f||{},Re=Boolean(t?.isCloseModalOpen),xe=Boolean(t?.isRemoveModalOpen),Ee=t&&(0,bn.rp)(t),Ve=Ye&&(0,bn.rp)(Ye),_e=Ye&&t&&Ve===Ee,Oe=m.H$,Ke=void 0!==A?.geolocation,Je=Boolean(A?.geolocation),Ge=(0,T.A)(e=>{Ee&&P({key:Ee,update:e})}),je=(0,s.Kr)(()=>(0,Dn.A)(),[a]);(0,s.vJ)(()=>{me(je.secondary_bg_color)},[je]);const ze=je.bg_color,[He,$e]=(0,s.J0)(),qe="light"===a?f?.backgroundColor:f?.backgroundDarkColor;(0,s.vJ)(()=>{Ge({backgroundColor:He||qe||ze})},[ze,He,qe]);const We=je.bg_color,[Qe,Ze]=(0,s.J0)(),Xe="light"===a?f?.headerColor:f?.headerDarkColor;(0,s.vJ)(()=>{Ge({headerColor:Qe||Xe||We})},[We,Qe,Xe]);const et=(0,s.li)(),it=(0,B.A)(),st=(0,Fi.A)(),nt=e?.isModalOpen||!1,at=Boolean(Te),{reloadFrame:ot,sendEvent:rt,sendFullScreenChanged:lt,sendViewport:ct,sendSafeArea:dt,sendTheme:ht}=((e,t,i,a,r,c,d)=>{const{showNotification:h,setWebAppPaymentSlug:m,openInvoice:u,closeWebApp:p,openSuggestedStatusModal:v,updateWebApp:g,updateContentSettings:A}=(0,n.ko)(),f=(0,s.li)(!1),C=(0,s.li)(),b=(0,s.li)(!1),y=(0,s.li)(),S=(0,Pe.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 N=(0,s.hb)(t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")},[e]),k=(0,s.hb)(e=>{N({eventType:"fullscreen_changed",eventData:{is_fullscreen:e}})},[N]),w=(0,T.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 N({eventType:"reload_iframe"}),void(C.current=setTimeout(()=>{w(e)},500));w(e)},[N]),P=(0,s.hb)(t=>{if(!e.current)return;const{width:i,height:s}=e.current.getBoundingClientRect();N({eventType:"viewport_changed",eventData:{width:i,height:s,is_expanded:!0,is_state_stable:!t}})},[N,e]),Y=(0,s.hb)(()=>{e.current&&(N({eventType:"safe_area_changed",eventData:{left:0,right:0,top:0,bottom:0}}),N({eventType:"content_safe_area_changed",eventData:{left:0,right:0,top:i?Vn:0,bottom:0}}))},[N,i,e]),F=(0,s.hb)(()=>{N({eventType:"theme_changed",eventData:{theme_params:(0,Dn.A)()}})},[N]),D=(0,s.hb)(e=>{N({eventType:"set_custom_style",eventData:e})},[N]),M=(0,s.hb)(t=>{if(b.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(C.current),"web_app_data_send"===i){if(!a)return;b.current=!0}if("web_app_open_scan_qr_popup"===i&&h({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===i&&(m({slug:s.slug}),u({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&&N({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;N({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;N({eventType:"secure_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_start_accelerometer"===i&&N({eventType:"accelerometer_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_gyroscope"===i&&N({eventType:"gyroscope_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_device_orientation"===i&&N({eventType:"device_orientation_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_add_to_home_screen"===i&&N({eventType:"home_screen_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_check_home_screen"===i&&N({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 N({eventType:"emoji_status_failed",eventData:{error:"SUGGESTED_EMOJI_INVALID"}});if(t)try{BigInt(t)}catch(e){return void N({eventType:"emoji_status_failed",eventData:{error:"DURATION_INVALID"}})}if(!c)return void N({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,N,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=>{N(e)}),g({key:(0,l.rp)(c),update:{plannedEvents:[]}}))},[N,c]),(0,s.vJ)(()=>(window.addEventListener("message",M),()=>window.removeEventListener("message",M)),[M,e]),(0,s.vJ)(()=>{t&&e.current?.contentWindow?(P(),Y(),b.current=!1):y.current=void 0},[t,i,P,Y,e]),{sendEvent:N,sendFullScreenChanged:k,reloadFrame:I,sendViewport:P,sendSafeArea:Y,sendTheme:F}})(et,nt,be,at,function(e){const{eventType:t,eventData:s}=e;if("web_app_request_fullscreen"===t&&((0,Y.cB)()?V({state:"fullScreen"}):rt({eventType:"fullscreen_failed",eventData:{error:"UNSUPPORTED"}})),"web_app_exit_fullscreen"===t&&Nt(),"web_app_open_tg_link"===t){V({state:"minimized"});const e=o.jsp+s.path_full;N({url:e,shouldIgnoreCache:s.force_request})}if("web_app_setup_back_button"===t&&Ge({isBackButtonVisible:s.is_visible}),"web_app_setup_settings_button"===t&&Ge({isSettingsButtonVisible:s.is_visible}),"web_app_set_background_color"===t&&$e((0,Dn.To)(s.color)?s.color:void 0),"web_app_set_header_color"===t){const e=s.color_key;Ze(s.color||(e?je[e]:void 0))}if("web_app_set_bottom_bar_color"===t&&me(s.color),"web_app_data_send"===t&&(b(),y({bot:i,buttonText:Te,data:s.data})),"web_app_setup_main_button"===t){const e=s.color,t=s.text_color;K({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible})}if("web_app_setup_secondary_button"===t){const e=s.color,t=s.text_color;G({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible,position:s.position})}if("web_app_setup_closing_behavior"===t&&Ge({shouldConfirmClosing:s.need_confirmation}),"web_app_open_popup"===t){if(q||!s.message.trim().length||!s.buttons?.length||s.buttons.length>3||Z||ie||ue>Date.now())return void Ct(void 0);W(s),pe()}if("web_app_switch_inline_query"===t){const e=s.chat_types?.map(l.Xj).filter(Boolean),t=!e?.length;w({botId:i.id,query:s.query,filter:e,isSamePeer:t}),b()}if("web_app_request_phone"===t){if(q||ie||ue>Date.now())return void Yt();ee(!0),pe()}if("web_app_request_write_access"===t){if(q||Z||ue>Date.now())return void Mt();!async function(){if(!i)return;const e=await(0,En.px)("fetchBotCanSendMessage",{bot:i});e&&rt({eventType:"write_access_requested",eventData:{status:"allowed"}}),ne(!e)}(),pe()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:n}=s;!async function(e,t,s){const n=await(0,En.px)("invokeWebViewCustomMethod",{bot:i,customMethod:t,parameters:s});rt({eventType:"custom_method_invoked",eventData:{req_id:e,...n}})}(n,e,JSON.stringify(t))}if("web_app_request_file_download"===t){if(le||ue>Date.now())return void Dt();!async function(e,t){await(0,En.px)("checkBotDownloadFileParams",{bot:i,url:e,fileName:t})?(ce({url:e,fileName:t}),pe()):rt({eventType:"file_download_requested",eventData:{status:"cancelled"}})}(s.url,s.file_name)}if("web_app_send_prepared_message"===t){if(!i||!Ee)return;const{id:e}=s;U({botId:i.id,messageId:e,webAppKey:Ee})}if("web_app_request_emoji_status_access"===t){if(!i)return;x({bot:i,webAppKey:Ee})}"web_app_check_location"===t&&rt({eventType:"location_checked",eventData:{available:Oe,access_requested:Ke,access_granted:Je}}),"web_app_request_location"===t&&(async()=>{const e=await(0,m.Bu)(),{accessRequested:t,accessGranted:s,geolocation:n}=e;if(!s||!t)return rt({eventType:"location_requested",eventData:{available:!1}}),R({message:it("PermissionNoLocationPosition")}),void Ct(void 0);Oe?Ke?rt({eventType:"location_requested",eventData:{available:Boolean(A?.geolocation),latitude:n?.latitude,longitude:n?.longitude,altitude:n?.altitude,course:n?.heading,speed:n?.speed,horizontal_accuracy:n?.accuracy,vertical_accuracy:n?.altitudeAccuracy}}):E({bot:i,webAppKey:Ee}):(R({message:it("PermissionNoLocationPosition")}),Ct(void 0))})(),"web_app_open_location_settings"===t&&xt(),"web_app_read_text_from_clipboard"===t&&re(s.req_id)},t,z);(0,s.vJ)(()=>{_e&&d(rt)},[rt,d,_e]),(0,s.vJ)(()=>{_e&&h(ot)},[ot,h,_e]);const mt=j&&O?.isVisible&&O.text.trim().length>0,ut=j&&J?.isVisible&&J.text.trim().length>0,pt=(0,T.A)(()=>{Ge({isCloseModalOpen:!1})}),vt=(0,T.A)(()=>{Ge({shouldConfirmClosing:!1,isCloseModalOpen:!1}),setTimeout(()=>{b()},400)}),gt=(0,T.A)(()=>{Ge({isRemoveModalOpen:!1})}),At=(0,T.A)(()=>{rt({eventType:"main_button_pressed"})}),ft=(0,T.A)(()=>{rt({eventType:"secondary_button_pressed"})}),Ct=(0,T.A)(e=>{W(void 0),ve(),rt({eventType:"popup_closed",eventData:{button_id:e}})}),bt=(0,T.A)(()=>{Ct()}),yt=(0,T.A)(()=>{ht()});(0,$.A)(()=>{setTimeout(()=>{yt()},400)},[a]);const St=(0,T.A)(()=>{!(0,Ie.j9)()&&_e&&ke?.()}),Nt=(0,T.A)(()=>{(0,Ie.j9)()&&_e&&we?.()}),kt=(0,T.A)(e=>{_e&&lt(e)});(0,s.vJ)(()=>{be?(St(),kt(!0)):(Nt(),kt(!1))},[be]);const wt=(0,T.A)(e=>{rt({eventType:"visibility_changed",eventData:{is_visible:e}})});(0,s.vJ)(()=>{j&&wt(Boolean(_e))},[_e,j]),(0,F.A)(([e])=>{"minimized"===p&&wt(!1),p&&"minimized"===e&&wt(!0)},[p]),(0,$.A)(([e])=>{r!==e&&t?.slug&&!r&&c&&(rt({eventType:"invoice_closed",eventData:{slug:t.slug,status:c}}),k({slug:void 0}),M())},[r,c,rt,t?.slug]);const It=(0,T.A)(()=>{S({botId:i.id,isEnabled:!1}),b()}),Yt=(0,T.A)(()=>{ee(!1),ve(),rt({eventType:"phone_requested",eventData:{status:"cancelled"}})}),Ft=(0,T.A)(()=>{I({botId:i.id}),ee(!1),ve(),rt({eventType:"phone_requested",eventData:{status:"sent"}})}),Dt=(0,T.A)(e=>{e&&(ce(void 0),ve()),rt({eventType:"file_download_requested",eventData:{status:"cancelled"}})}),Mt=(0,T.A)(()=>{rt({eventType:"write_access_requested",eventData:{status:"cancelled"}}),ne(!1),ve()}),Tt=(0,T.A)(async()=>{i&&(await(0,En.px)("allowBotSendMessages",{bot:i})?(rt({eventType:"write_access_requested",eventData:{status:"allowed"}}),ne(!1),ve()):Mt())}),Bt=(0,T.A)(()=>{ae&&(re(void 0),rt({eventType:"clipboard_text_received",eventData:{req_id:ae,data:null}}))}),Lt=(0,T.A)(()=>{const e=ae;e&&(re(void 0),window.navigator.clipboard.readText().then(t=>{rt({eventType:"clipboard_text_received",eventData:{req_id:e,data:t}})}).catch(()=>{rt({eventType:"clipboard_text_received",eventData:{req_id:e,data:null}})}))}),Rt=(0,T.A)(()=>{le&&(ce(void 0),ve(),(0,ki.A)(le.url,le.fileName),rt({eventType:"file_download_requested",eventData:{status:"downloading"}}))});(0,s.vJ)(()=>{nt||(W(void 0),ee(!1),ne(!1),K(void 0),G(void 0),ce(void 0),re(void 0),Ge({isSettingsButtonVisible:!1,shouldConfirmClosing:!1,isBackButtonVisible:!1,isCloseModalOpen:!1,isRemoveModalOpen:!1}),H())},[nt]);const xt=(0,T.A)(()=>{L({id:i.id})}),Et=(0,Si.A)(O?.color,!0),Vt=(0,Si.A)(O?.textColor,!0),_t=(0,Si.A)(O&&Boolean(O.isActive),!0),Ut=(0,Si.A)(O?.text,!0),Ot=(0,Si.A)(J?.position,!0),Kt=(0,Si.A)(J?.color,!0),Jt=(0,Si.A)(J?.textColor,!0),Gt=(0,Si.A)(J&&Boolean(J.isActive),!0),jt=(0,Si.A)(J?.text,!0),[zt,Ht]=(0,s.J0)(!1),[$t,qt]=(0,s.J0)(!0),[Wt,Qt]=(0,s.J0)(!0),[Zt,Xt]=(0,s.J0)(!1),[ei,ti]=(0,s.J0)(!1),[ii,si]=(0,s.J0)(!1),[ni,oi]=(0,s.J0)(0);(0,$.A)(()=>{setTimeout(()=>{ct(),dt()},u?0:400)},[ei,Wt,Zt,Zt,J?.position,ct,u,C,dt]);const ri="top"===Ot||"bottom"===Ot,li=ri&&Zt&&ei?2:Zt||ei?1:0,ci=ri||$t||Wt?"vertical":"horizontal",di=(0,s.li)(),hi=(0,s.li)(),mi=(0,s.li)(),ui=(0,s.li)(),pi=(0,s.li)();(0,s.vJ)(()=>(be&&nt&&Boolean(Fe)?(si(!0),pi.current&&clearTimeout(pi.current),pi.current=setTimeout(()=>{si(!1),pi.current=void 0},3800)):(si(!1),pi.current&&(clearTimeout(pi.current),pi.current=void 0)),()=>{pi.current&&clearTimeout(pi.current)}),[be,nt,Fe]),(0,s.vJ)(()=>{di.current&&clearTimeout(di.current),hi.current&&clearTimeout(hi.current),mt&&(hi.current=setTimeout(()=>{Xt(!0)},35),qt(!1),di.current=setTimeout(()=>{Ht(!0)},Hn)),mt||(Xt(!1),di.current=setTimeout(()=>{qt(!0)},Hn))},[mt]),(0,s.vJ)(()=>{mi.current&&clearTimeout(mi.current),ui.current&&clearTimeout(ui.current),ut&&(ui.current=setTimeout(()=>{ti(!0)},35),Qt(!1),mi.current=setTimeout(()=>{Ht(!0)},Hn)),ut||(ti(!1),mi.current=setTimeout(()=>{Qt(!0)},Hn))},[ut]),(0,s.vJ)(()=>{ei||Zt||Ht(!1)},[Ht,ei,Zt]);const vi=(0,tt.A)(`background-color: ${De||"var(--color-background)"}`,u&&"pointer-events: none;"),gi=(0,T.A)(()=>{Be?rt({eventType:"back_button_pressed"}):(Nt(),lt(!1),V({state:"maximized"}),_())}),Ai=(0,T.A)(()=>{Nt()}),fi=(0,T.A)(e=>{g(e)}),Ci=(0,ge.A)("BvNtfigU",Be&&"rC2wkMIk"),bi=ii?Fe:it(Be?"Back":"Close"),yi=Ce?.current;return(0,s.vJ)(()=>{oi(Ce?.current?.clientWidth||0)},[bi,yi]),(0,se.FD)("div",{ref:Ae,className:(0,ge.A)("LeeJZdwH",!_e&&Kn,v&&"ESsGT5OD"),children:[be&&(0,Y.cB)()&&(0,se.FD)("div",{className:"eYrhewMy",children:[(0,se.FD)("div",{ref:fe,className:zn,onClick:gi,children:[(0,se.Y)("div",{className:"JXsuZ01s",children:(0,se.Y)("div",{className:Ci})}),(0,se.Y)("span",{className:"dpZR3YT7",style:`width: ${ni}px;`,children:(0,se.Y)(oe.Ay,{activeKey:ii?0:Be?1:2,name:"slideFade",children:(0,se.Y)("div",{ref:Ce,className:"dWDprnWa",children:bi})})})]}),(0,se.FD)("div",{className:"Tl4_05AQ",children:[(0,se.Y)("div",{className:(0,ge.A)(zn,"emOpAMBm"),tabIndex:0,role:"button","aria-label":st("WebAppCollapse"),onClick:Ai,children:(0,se.Y)(he.A,{name:"down",className:jn})}),(0,se.Y)("div",{className:(0,ge.A)(zn,"z4C5VD5o"),tabIndex:0,role:"button","aria-haspopup":"menu","aria-label":st("AriaMoreButton"),onClick:fi,children:(0,se.Y)(he.A,{name:"more",className:(0,ge.A)(jn,"T58ozRyW")})})]})]}),!ye&&(Le?(0,se.Y)("svg",{className:(0,ge.A)(_n,j&&On),viewBox:"0 0 512 512",children:(0,se.Y)("path",{className:"Gx1BIECZ",d:Le})}):function(){const e=(0,ge.A)(_n,"Ig_t1R7i",j&&On);return(0,se.FD)("div",{className:e,children:[(0,se.Y)("div",{className:Un}),(0,se.Y)("div",{className:Un}),(0,se.Y)("div",{className:Un}),(0,se.Y)("div",{className:Un})]})}()),(0,se.Y)("iframe",{className:(0,ge.A)("OmY14FFl",zt&&"liDRl1xT",!j&&On),style:vi,src:Me,title:st("AriaMiniApp",{bot:i?.firstName}),sandbox:$n,allow:"camera; microphone; geolocation; clipboard-write;",allowFullScreen:!0,ref:et}),!ye&&(0,se.FD)("div",{style:`background-color: ${de};`,className:(0,ge.A)("mR_hsBdT","left"===Ot&&"ntESqwQ_","right"===Ot&&"q6IUFEL0","top"===Ot&&"gb4iHJ9H","bottom"===Ot&&"R_bh3GF8","horizontal"===ci&&"oYaRA7u4",1===li&&"YfQO314y",2===li&&"gUldkEoy"),children:[(0,se.FD)(X.A,{className:(0,ge.A)("ypxiUCFQ",ei&&!Wt&&Jn,Wt&&Kn),fluid:!0,style:`background-color: ${Kt}; color: ${Jt}`,disabled:!Gt&&!J?.isProgressVisible,nonInteractive:J?.isProgressVisible,onClick:ft,children:[!J?.isProgressVisible&&jt,J?.isProgressVisible&&(0,se.Y)(Ue.A,{className:Gn,color:"blue"})]}),(0,se.FD)(X.A,{className:(0,ge.A)("U_ggDKn1",Zt&&!$t&&Jn,$t&&Kn),fluid:!0,style:`background-color: ${Et}; color: ${Vt}`,disabled:!_t&&!O?.isProgressVisible,nonInteractive:O?.isProgressVisible,onClick:At,children:[!O?.isProgressVisible&&Ut,O?.isProgressVisible&&(0,se.Y)(Ue.A,{className:Gn,color:"white"})]})]}),(0,se.FD)(te.A,{isOpen:Boolean(q),title:Q?.title||" ",className:(0,ge.A)("YEOURXza",!Q?.title?.trim().length&&"gvljUzY9"),hasCloseButton:!0,onClose:bt,children:[Q?.message,(0,se.Y)("div",{className:"dialog-buttons mt-2",children:Q?.buttons.map(e=>(0,se.Y)(X.A,{className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,onClick:()=>Ct(e.id),children:e.text||it(qn[e.type])},e.id||e.type))})]}),(0,se.Y)(ai.A,{isOpen:Z,onClose:Yt,title:st("ShareYouPhoneNumberTitle"),textParts:st("AreYouSureShareMyContactInfoBot",void 0,{withNodes:!0,withMarkdown:!0,renderTextFilters:["br"]}),confirmHandler:Ft,confirmLabel:st("ContactShare")}),(0,se.Y)(ai.A,{isOpen:ie,onClose:Mt,title:it("lng_bot_allow_write_title"),text:it("lng_bot_allow_write"),confirmHandler:Tt,confirmLabel:it("lng_bot_allow_write_confirm")}),(0,se.Y)(ai.A,{isOpen:Boolean(le),title:it("BotDownloadFileTitle"),textParts:st("BotDownloadFileDescription",{bot:i?.firstName,filename:le?.fileName},{withNodes:!0,withMarkdown:!0}),confirmLabel:it("BotDownloadFileButton"),onClose:Dt,confirmHandler:Rt}),(0,se.Y)(ai.A,{isOpen:Re,onClose:pt,title:it("lng_bot_close_warning_title"),text:it("lng_bot_close_warning"),confirmHandler:vt,confirmIsDestructive:!0,confirmLabel:it("lng_bot_close_warning_sure")}),(0,se.Y)(ai.A,{isOpen:xe,onClose:gt,title:it("BotRemoveFromMenuTitle"),textParts:(0,Pt.A)(it("BotRemoveFromMenu",i?.firstName),["simple_markdown"]),confirmHandler:It,confirmIsDestructive:!0}),(0,se.Y)(ai.A,{isOpen:Boolean(ae),title:st("BotReadTextFromClipboardTitle"),text:st("BotReadTextFromClipboardDescription",{bot:(0,l.Yg)(i)}),confirmLabel:st("BotReadTextFromClipboardConfirm"),onClose:Bt,confirmHandler:Lt})]})})),Qn="oHX2d8Or",Zn="O4NxErFX",Xn="dgdyQDsZ",ea="xGefqS93",ta="f7EicoVH",ia="s6pBIYMI",sa="txS0KiU0",na="XpHR_yo0",aa="DoeOewUR",oa="YRMGpqUS",ra="b13oE9uA",la={width:300,height:40},ca={width:420,height:730},da={width:300,height:300},ha=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=s?e.attachMenu.bots[s]:void 0,a=s?(0,c.mBe)(e,s):void 0,o=(0,c.meB)(e),r=(0,c.SJA)(e),{miniAppsCachedPosition:l,miniAppsCachedSize:d}=(0,Ys.lS)(e);return{attachBot:n,bot:a,chat:o,theme:r,cachedPosition:l,cachedSize:d}})(({modal:e,chat:t,bot:i,attachBot:a,theme:r,cachedSize:l,cachedPosition:c})=>{const{closeActiveWebApp:d,closeWebAppModal:h,prolongWebView:m,toggleAttachBot:u,openChat:p,changeWebAppModalState:v,openWebAppTab:g,updateWebApp:A,openMoreAppsTab:f,closeMoreAppsTab:C,updateMiniAppCachedPosition:b,updateMiniAppCachedSize:y}=(0,n.ko)(),[S,N]=(0,s.Ul)(l||ca);function w(){return"fullScreen"===e?.modalState?k.A.get():"maximized"===e?.modalState?S():la}const{openedWebApps:I,activeWebAppKey:P,openedOrderedKeys:F,sessionKeys:M,isMoreAppsTabActive:L}=e||{},R=P?I?.[P]:void 0,{isBackButtonVisible:x,headerColor:E,backgroundColor:V,isSettingsButtonVisible:_}=R||{},U=(0,s.Kr)(()=>F?.map(e=>{const t=I[e];return{bot:(0,n.mS)().users.byId[t.botId],webApp:t,isOpen:Boolean(R&&e===(0,bn.rp)(R))}}),[F,I,R]),{isMobile:O}=(0,Y.Ay)(),K=e?.isModalOpen||!1,J="maximized"===e?.modalState,G="minimized"===e?.modalState,j="fullScreen"===e?.modalState,z=!O,H=(0,s.li)(),$=(0,s.li)(),q=(0,s.li)(),W=(0,T.A)(()=>H.current),Q=(0,T.A)(()=>H.current),Z=(0,T.A)(()=>q.current),{isContextMenuOpen:ee,contextMenuAnchor:ie,handleContextMenu:ne,handleContextMenuClose:ae,handleContextMenuHide:oe}=(0,cn.A)(H),[re,le]=(0,s.J0)(!1),ce=$.current,de=H.current;(0,s.vJ)(()=>{le(Boolean(z&&ce&&de&&!j))},[z,ce,de,j]),(0,s.vJ)(()=>{v({state:"maximized"})},[z]);const{isDragging:pe,isResizing:ve,style:fe,size:Ce,position:be}=function(e,t,i=!0,n,a=!1,r={width:0,height:0},l){const[c,d]=(0,s.J0)(l),[h,m]=(0,s.J0)(void 0),[u,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}),C=u(),b=A(),y=e.current,S=t.current,[N,k]=(0,D.A)(!1),[w,I]=(0,D.A)(!1),[P,Y,F]=(0,D.A)(!1),[M,B,L]=(0,D.A)(!1),[R,x,E]=(0,D.A)(!1),[V,_]=(0,s.J0)(void 0);function U(){return{width:window.innerWidth,height:window.innerHeight}}const O=(0,T.A)(e=>{a||d({x:e.x,y:e.y})}),K=(0,T.A)(()=>a?Pn:c),J=(0,T.A)(()=>{if(!h)return;const{width:e,height:t}=h,i=U();return{x:(i.width-e)/2,y:(i.height-t)/2}});(0,s.vJ)(()=>{y&&I()},[y]),(0,s.vJ)(()=>{if(!N&&h){const e=J();if(!e)return;O(e),k()}},[h,N,y]);const G=(0,T.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;if(e.target.closest(".no-drag")||!y)return;const{x:t,y:i}=(0,Ke.A)(e),{left:s,top:n}=y.getBoundingClientRect();p({x:s,y:n}),f({x:t,y:i}),Y()}),j=(0,T.A)(e=>{if(e instanceof MouseEvent&&0!==e.button)return;const t=e.target;if(!y||!t)return;const i=function(e){const t=t=>e.closest(t);if(t(o.cnh))for(const e of wn)if(t(`.${e}`))return kn[e]}(t);if(void 0===i)return;_(i);const{x:s,y:n}=(0,Ke.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,T.A)(()=>{F()}),H=(0,T.A)(()=>{L()});(0,s.vJ)(()=>{i||F()},[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,T.A)(()=>{if(a)return;const e=w||l?c:J();if(!h||!e)return;const t=$(e.x,e.y);O(t)}),W=(0,T.A)(e=>{const t=e,i=U(),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(M)return;const e=W({width:n.width,height:n.height});e&&m(e)},[n,M]);const Q=(0,T.A)(()=>{if(!h||M)return;const e=W(h);e&&m(e)});(0,s.vJ)(()=>{M||q()},[h,M]),(0,s.vJ)(()=>{const e=()=>{x(),Q(),q(),In&&(clearTimeout(In),In=void 0),In=window.setTimeout(()=>{In=void 0,E()},250)};return window.addEventListener("resize",e),()=>{clearTimeout(In),In=void 0,window.removeEventListener("resize",e)}},[q]);const Z=(0,T.A)(e=>{if(!P||!y)return;const{x:t,y:i}=(0,Ke.A)(e),s=t-b.x,n=i-b.y,a=C.x+s,o=C.y+n;h&&d($(a,o))}),X=(0,T.A)(e=>{if(!M||!y||void 0===V)return;const{x:t,y:i}=(0,Ke.A)(e),s=v(),n=Math.min(Math.max(0,t),U().width),a=Math.min(Math.max(0,i),U().height),o=n-b.x,l=a-b.y,c=C.x+s.width-r.width,h=C.y+s.height-r.height,u={x:C.x,y:C.y,width:s.width,height:s.height};V!==Nn.Left&&V!==Nn.TopLeft&&V!==Nn.BottomLeft||(u.width=Math.max(s.width-o,r.width),u.x=Math.min(u.x+o,c)),V!==Nn.Right&&V!==Nn.TopRight&&V!==Nn.BottomRight||(u.width=Math.max(s.width+o,r.width)),V!==Nn.Top&&V!==Nn.TopLeft&&V!==Nn.TopRight||(u.height=Math.max(s.height-l,r.height),u.y=Math.min(u.y+l,h)),V!==Nn.Bottom&&V!==Nn.BottomLeft&&V!==Nn.BottomRight||(u.height=Math.max(s.height+l,r.height)),m({width:u.width,height:u.height}),d({x:u.x,y:u.y})});(0,s.vJ)(()=>{let e;return S&&i&&(e=(0,Ae.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 wn){const i=y.querySelector(`.resizeHandle.${t}`);if(i){const t=(0,Ae.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(!N||!h||!te)return{isDragging:!1,style:ee};const ie=(0,tt.A)(`left: ${te.x}px;`,`top: ${te.y}px;`,!a&&`max-width: ${h.width}px;`,!a&&`max-height: ${h.height}px;`,"position: fixed;",(P||M||R)&&"transition: none !important;",ee);return{position:c,size:h,isDragging:P,isResizing:M,style:ie}}(H,$,re,w(),j,function(){if("maximized"===e?.modalState)return da}(),c),ye=be?.x,Se=be?.y;(0,s.vJ)(()=>{pe||void 0===ye||void 0===Se||b({position:{x:ye,y:Se}})},[pe,ye,Se]),(0,s.vJ)(()=>{!pe&&Ce&&J&&y({size:Ce})},[pe,J,Ce]);const Ne=Ce||w(),ke=Ne.width,we=Ne.height;(0,s.vJ)(()=>{ve&&N({width:ke,height:we})},[we,ke,ve,N]);const Ie=(0,B.A)(),Pe=(0,Fi.A)(),{queryId:Ye}=R||{},Fe=I?Object.values(I).length:0;(0,Sn.A)(()=>{I&&Object.keys(I).forEach(e=>{const i=I[e];i.queryId&&m({botId:i.botId,queryId:i.queryId,peerId:i.peerId||t.id,replyInfo:i.replyInfo})})},Ye?45e3:void 0,!0);const De=(0,s.li)(null),Me=(0,s.li)(null),Te=(0,T.A)(e=>{De.current=e}),Be=(0,T.A)(e=>{De.current&&De.current(e)}),Le=(0,T.A)(e=>{Me.current=e}),Re=(0,T.A)(e=>{Me.current&&Me.current(e)}),xe=(0,T.A)(()=>{Be({eventType:"settings_button_pressed"})}),Ee=(0,T.A)(()=>{Re(R.url)}),Ve=(0,T.A)(()=>{h()}),_e=(0,T.A)(()=>{C()}),Ue=(0,T.A)(()=>{Fe>1?d():h()}),Oe=(0,T.A)(()=>{if(a){const e=(0,bn.rp)(R);return void A({key:e,update:{isRemoveModalOpen:!0}})}u({botId:i.id,isEnabled:!0})}),Je=(0,T.A)(()=>{x?Be({eventType:"back_button_pressed"}):Ve()}),Ge=(0,T.A)(()=>{v({state:"minimized"})}),je=(0,T.A)(()=>{v({state:"fullScreen"})}),ze=(0,T.A)(()=>{f()}),He=(0,T.A)(e=>{g({webApp:e.webApp})}),$e=(0,T.A)(()=>{p({id:i.id})}),qe=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{className:(0,ge.A)(z?"gkji2_RB":"kKPD09tc",t&&"active"),round:!0,ripple:!O,size:z?"tiny":"smaller",color:"translucent",onClick:e,ariaLabel:"More actions",iconName:"more"}),[O,z]);function We(){return(0,se.FD)(se.FK,{children:[t&&i&&t.id!==i.id&&(0,se.Y)(ue.A,{icon:"bots",onClick:$e,children:Ie("BotWebViewOpenBot")}),(0,se.Y)(ue.A,{icon:"reload",onClick:Ee,children:Ie("WebApp.ReloadPage")}),_&&(0,se.Y)(ue.A,{icon:"settings",onClick:xe,children:Ie("Settings")}),i?.isAttachBot&&(0,se.Y)(ue.A,{icon:a?"stop":"install",onClick:Oe,destructive:Boolean(a),children:Ie(a?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")})]})}function Qe(){return(0,se.Y)(Ze.A,{isOpen:ee,anchor:ie,ref:q,className:(0,ge.A)(z?sa:"web-app-more-menu","with-menu-transitions"),getTriggerElement:W,getMenuElement:Z,getRootElement:Q,autoClose:!0,onClose:ae,onCloseAnimationEnd:oe,children:We()})}const Xe=(0,ge.A)("RuJ3d9N6",x&&"IWA50OWU"),et=(0,s.Kr)(()=>{if(L)return"color-text";if(!E)return;const{r:e,g:t,b:i}=(0,yn.hF)(E),s=(0,yn.LS)([e,t,i]);return("dark"===r?255-s:s)>128?"color-text":"color-background"},[E,r,L]);function it(e){return(0,se.Y)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,se.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,ge.A)(o.jQ1,e)}return(0,Ks.A)(st,!K||G||!st.current),(0,se.FD)(te.A,{dialogRef:H,className:(0,ge.A)("XWfkIDLY",z&&"gBVR7Hec",G&&"dJ1Ld_PX",j&&"ciSTWz16"),dialogStyle:z?fe:void 0,dialogContent:re&&!G?(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:nt("top")}),(0,se.Y)("div",{className:nt("bottom")}),(0,se.Y)("div",{className:nt("left")}),(0,se.Y)("div",{className:nt("right")}),(0,se.Y)("div",{className:nt("topLeft")}),(0,se.Y)("div",{className:nt("topRight")}),(0,se.Y)("div",{className:nt("bottomLeft")}),(0,se.Y)("div",{className:nt("bottomRight")})]}):void 0,isOpen:K,isLowStackPriority:!0,onClose:Ve,header:(0,se.Y)("div",{ref:$,children:z?J?(0,se.FD)("div",{className:(0,ge.A)("modal-header","multiTab"),style:(0,tt.A)(et&&`--color-header-text: var(--${et})`),children:[(0,se.Y)(X.A,{className:"GE5AkJOU",round:!0,color:"translucent",size:"tiny",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,se.Y)("div",{className:Xe})}),(0,se.FD)("div",{className:"X18WbDa5",ref:st,children:[U?.map(e=>e.isOpen?function(){const e=(0,tt.A)(et&&`--color-header-text: var(--${et})`,E&&`--active-tab-background: ${E}`);return(0,se.FD)("div",{className:Qn,style:e,children:[it(ta),(0,se.FD)("div",{className:Zn,children:[(0,se.FD)("div",{className:"z39ojrWc",children:[(0,se.Y)(Yt.A,{size:"mini",peer:i}),(0,se.Y)(qe,{onTrigger:ne,isOpen:ee})]}),a?.shortName??i?.firstName,(0,se.Y)("div",{className:Xn}),(0,se.Y)(X.A,{className:ea,round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:aa,ariaLabel:Ie("Close"),onClick:Ue})]}),it(ia)]})}():(0,se.Y)(Yt.A,{className:"tI6TE6HP",size:"mini",peer:e.bot,onClick:()=>He(e)})),L&&(0,se.FD)("div",{className:Qn,children:[it(ta),(0,se.FD)("div",{className:Zn,children:[(0,se.Y)("div",{className:"Obu3ui67",children:(0,se.Y)(he.A,{className:ra,name:"add"})}),Pe("OpenApp"),(0,se.Y)("div",{className:Xn}),(0,se.Y)(X.A,{className:ea,round:!0,color:"translucent",size:"tiny",iconName:"close",iconClassName:aa,ariaLabel:Ie("Close"),onClick:_e})]}),it(ia)]})]}),Qe(),(0,se.FD)("div",{className:"qK4q0Sat",children:[!L&&(0,se.Y)(X.A,{className:(0,ge.A)("cEuW1_hJ","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:ze,iconName:"add",iconClassName:ra}),!L&&(0,se.Y)(X.A,{className:(0,ge.A)(na,"otlJULGy","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:je,iconName:"expand-modal",iconClassName:oa}),(0,se.Y)(X.A,{className:(0,ge.A)(na,"no-drag"),round:!0,color:"translucent",size:"tiny",onClick:Ge,iconClassName:oa,iconName:"collapse-modal"})]})]}):(0,se.Y)(Yn,{}):(0,se.FD)("div",{className:"modal-header",style:(0,tt.A)(E&&`background-color: ${E}`,et&&`--color-header-text: var(--${et})`),children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,se.Y)("div",{className:Xe})}),(0,se.Y)("div",{className:"modal-title",children:a?.shortName??i?.firstName}),!L&&(0,se.Y)(me.A,{className:(0,ge.A)(z?sa:"web-app-more-menu","with-menu-transitions"),trigger:qe,positionX:z?"left":"right",children:We()})]})}),style:`background-color: ${V||"var(--color-background)"}`,noBackdrop:!0,noBackdropClose:!0,children:[j&&Qe(),I&&M?.map(t=>(0,se.Y)(Wn,{modal:e,registerSendEventCallback:Te,registerReloadFrameCallback:Le,webApp:I[t],isTransforming:pe||ve,onContextMenuButtonClick:ne,isMultiTabSupported:z,modalHeight:we},t)),L&&(0,se.Y)(xn,{})]})})),ma=(0,s.ph)(({bot:e,type:t,shouldRequestWriteAccess:i})=>{const{cancelBotTrustRequest:a,markBotTrusted:o}=(0,n.ko)(),[r,c]=(0,s.J0)(i||!1),d=(0,B.A)(),h=(0,s.hb)(()=>{o({botId:e.id,isWriteAllowed:r})},[o,r,e]),m=(0,s.hb)(()=>{a()},[]),u=d("game"===t?"AppName":"BotOpenPageTitle"),p=(0,s.Kr)(()=>{switch(t){case"game":return d("BotPermissionGameAlert",(0,l.Yg)(e));case"webApp":return d("BotOpenPageMessage",(0,l.Yg)(e));default:return d("BotWebViewStartPermission")}},[e,t,d]);return(0,se.FD)(ai.A,{isOpen:Boolean(e),onClose:m,title:u,confirmHandler:h,children:[(0,Pt.A)(p,["simple_markdown"]),i&&(0,se.Y)(js.A,{className:"dialog-checkbox",checked:r,label:(0,Pt.A)(d("WebApp.AddToAttachmentAllowMessages",e?.firstName),["simple_markdown"]),onCheck:c})]})}),ua=(0,s.ph)(({modal:e})=>{const{confirmAttachBotInstall:t,cancelAttachBotInstall:i}=(0,n.ko)(),a=e?.bot,[r,l]=(0,s.J0)(!1),c=(0,B.A)(),d=(0,s.hb)(()=>{t({isWriteAllowed:Boolean(a?.shouldRequestWriteAccess)})},[t,a]);(0,s.vJ)(()=>{a&&l(!1)},[a]);const h=(0,s.Kr)(()=>{const e=c("lng_mini_apps_disclaimer_button").split("{link}"),t=c("lng_mini_apps_disclaimer_link");return[e[0],(0,se.Y)("a",{href:o.Pje,target:"_blank",rel:"noopener noreferrer",children:t}),e[1]]},[c]);return(0,se.FD)(ai.A,{isOpen:Boolean(a),onClose:i,title:c("lng_mini_apps_disclaimer_title"),confirmHandler:d,isConfirmDisabled:!r,children:[(0,Pt.A)(c("lng_mini_apps_disclaimer_text",a?.shortName),["simple_markdown"]),(0,se.Y)(js.A,{className:"dialog-checkbox",checked:r,label:h,onCheck:l}),(0,Pt.A)(c("WebBot.Account.Desclaimer.Desc",a?.shortName),["simple_markdown"])]})}),pa=(0,s.ph)(({folder:e})=>{const{closeDeleteChatFolderModal:t,deleteChatFolder:i,openDeleteChatFolderModal:a}=(0,n.ko)(),o=(0,B.A)(),r=Boolean(e),l=(0,K.A)(e)||e,c=l?.hasMyInvites,d=(0,s.hb)(()=>{t(),c?a({folderId:l.id,isConfirmedForChatlist:!0}):i({id:l.id})},[c,l]);return(0,se.Y)(ai.A,{isOpen:r,onClose:t,text:o(c?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:o("Delete"),confirmHandler:d,confirmIsDestructive:!0})});var va=i(17142),ga=i(66833),Aa=i(526);const fa={root:"Wn7D2H1e",text:"IQ1U2TrZ",header:"F6qqXRvD",description:"ILLaH6qQ",icon:"DzGwbpu5","font-icon":"Pa9h5mh3",fontIcon:"Pa9h5mh3"},Ca=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(yn.hF),ba=(0,s.ph)(({icon:e,isFontIcon:t,title:i,text:s,index:n,count:a,section:o,onClick:r})=>{const l=n/a*Ca.length,c=Ca[Math.floor(l)],d=Ca[Math.ceil(l)]??c,{r:h,g:m,b:u}=(0,yn.R5)(c,d,.5),p=(0,T.A)(()=>{r?.(o)});return(0,se.FD)(li.A,{buttonClassName:fa.root,onClick:p,inactive:!r,children:[t?(0,se.Y)(he.A,{name:e,className:fa.fontIcon,style:`--item-color: rgb(${h},${m},${u})`}):(0,se.Y)("img",{src:e,className:fa.icon,alt:"",style:`--item-color: rgb(${h},${m},${u})`,draggable:!1}),(0,se.FD)("div",{className:fa.text,children:[(0,se.Y)("div",{className:fa.title,children:(0,Pt.A)(i,["br"])}),(0,se.Y)("div",{className:fa.description,children:s})]})]})});var ya=i(57446);const Sa="cqNhvdib",Na="wDzTWXzO",ka=(0,s.ph)(({length:e,active:t,onSelectSlide:i})=>{const n=Math.max(0,Math.min(e-8,t-4)),a=n===e-8-1,o=n===e-8,r=0===n,l=1===n,c=Math.min(e,8),d=(0,s.hb)(()=>{i(t+1)},[t,i]),h=(0,s.hb)(()=>{i(t-1)},[t,i]),u=Math.min(8,e);return(0,se.FD)("div",{children:[!m.TF&&(0,se.Y)(X.A,{className:(0,ge.A)(Sa,0===t&&Na),color:"translucent",disabled:0===t,round:!0,onClick:h,iconName:"previous"}),(0,se.Y)("div",{className:"HmY1pYD9",style:`--start-from: ${n}; --length: ${e}; --count: ${u};`,children:Array(e).fill(void 0).map((e,s)=>{const d=s,h=s===n+c-1&&!o&&!a,m=s===n+c-2&&!a&&!o||s===n+c-1&&a,u=s===n&&!r&&!l,p=s===n+1&&!r&&!l||s===n&&l,v=s<n||s>=n+c;return(0,se.Y)("div",{onClick:()=>i(s),className:(0,ge.A)("Ac0pMX9w",d===t&&"NYDxCNdz",(m||p)&&"yDo_8Y7X",(h||u||v)&&"bhODNwmU",v&&"O9pyrgj0")})})}),!m.TF&&(0,se.Y)(X.A,{className:(0,ge.A)(Sa,t===e-1&&Na,"hIgQCprt"),color:"translucent",round:!0,disabled:t===e-1,onClick:d,iconName:"next"})]})}),wa="Hy5kWx0p",Ia=(0,s.ph)(({leftValue:e,rightValue:t,className:i,floatingBadgeIcon:s,rightStyle:n})=>{const a=(0,B.A)();return(0,se.FD)("div",{className:(0,ge.A)("u84X0r2z",i),children:[s&&(0,se.FD)("div",{className:"hPi4fICJ",children:[(0,se.Y)(he.A,{name:s,className:"XkiOXdMP"}),(0,se.Y)("div",{className:"iC3LJrvy",dir:a.isRtl?"rtl":void 0,children:e}),(0,se.Y)("div",{className:"jufjjcX9",children:(0,se.Y)("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none",children:(0,se.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,se.FD)("div",{className:(0,ge.A)(wa,"scGr4JS9"),children:[(0,se.Y)("div",{className:"OejVAPj6 YaiSoFKE YaiSoFKE",dir:a.isRtl?"rtl":void 0,children:a("LimitFree")}),!s&&(0,se.Y)("div",{className:"RJosx238 YaiSoFKE",children:e})]}),(0,se.FD)("div",{className:(0,ge.A)(wa,"nPaUalQf"),style:n,children:[(0,se.Y)("div",{className:"COQdFBQk YaiSoFKE YaiSoFKE",dir:a.isRtl?"rtl":void 0,children:a("LimitPremium")}),(0,se.Y)("div",{className:"BEq3jFlz YaiSoFKE YaiSoFKE",children:t})]})]})}),Pa=[91,160,255],Ya=[197,100,243],Fa=(0,s.ph)(({title:e,description:t,leftValue:i,rightValue:n,colorStepProgress:a})=>{const o=(0,s.Kr)(()=>Pa.map((e,t)=>(0,fe.Cc)(e,Ya[t],a)),[a]);return(0,se.FD)("div",{className:"ZXp65Wgy",children:[(0,se.Y)("div",{className:"W1xG3pjS",children:e}),(0,se.Y)("div",{className:"b_CBXIkT",children:t}),(0,se.Y)(Ia,{leftValue:i,rightValue:n,rightStyle:`background: rgb(${o.join(",")})`})]})});var Da=i(7972),Ma=i(64489);const Ta=(0,s.ph)(()=>{const e=(0,Fi.A)(),t=(0,s.Kr)(()=>[["no-share",e("NoForwardingTitle"),e("NoForwardingDescription")],["no-download",e("NoSavingTitle"),e("NoSavingDescription")]],[e]);return(0,se.FD)("div",{className:"ALLjgiIU",children:[(0,se.Y)("div",{className:"YgV1fU9E",children:(0,se.Y)(Ma.A,{size:100,tgsUrl:Da.w.HandStop,previewUrl:Da.d.HandStop,noLoop:!0})}),(0,se.Y)("div",{className:"jbxddW_x",children:t.map(([e,t,i])=>(0,se.FD)(li.A,{isStatic:!0,multiline:!0,icon:e,className:"O0vha2cO",children:[(0,se.Y)("span",{className:(0,ge.A)("title","Sg_dw4sv"),children:t}),(0,se.Y)("span",{className:"subtitle",children:i})]}))})]})});var Ba=i(67054),La=i(18104);const Ra=({size:e,realIndex:t,canPlay:i,sticker:n,index:a,maxLength:o,onClick:r,onEnded:l})=>{const c=(0,q.A)(`sticker${n.id}`),d=(0,q.A)(`sticker${n.id}?size=f`),h=0===a,[m,u,p]=(0,D.A)(h),v=e-.6*e,g=3*v,A=3.2*v,f=a/o*(2*Math.PI),C=h?1:.66,b=Math.cos(f)*g-2.8*v,y=Math.sin(f)*A,S=(0,T.A)(()=>{r(t)}),N=(0,T.A)(()=>{p(),l(t)});return(0,s.vJ)(()=>{h&&u()},[h,u]),(0,se.FD)(se.FK,{children:[h&&(0,se.Y)(La.A,{className:"Stdz4UIW ogaoEAcn",tgsUrl:d,play:i,isLowPriority:!0,noLoop:!0,size:.8*e,style:`--x: calc(${b}px - 10%); --y: ${y}px;`}),(0,se.Y)(La.A,{className:"ogaoEAcn",tgsUrl:c,play:i&&m,noLoop:!0,size:.6*e,style:`--x: ${b}px; --y: ${y}px; --opacity: ${C}`,onClick:S,onEnded:N})]})},xa=(0,s.ph)((0,n.EK)(e=>({stickers:e.stickers.premium.stickers}))(({stickers:e,isActive:t})=>{const i=(0,s.li)(),[n,a]=(0,s.J0)(0),[o,r]=(0,s.J0)(0),l=e?.slice(0,15),c=(0,T.A)(e=>{a(-e)}),d=(0,T.A)(e=>{0===(0,Ba.A)(l.length,e+n)&&setTimeout(()=>{a(e=>(0,Ba.A)(l.length,e+1))},150)});return(0,s.vJ)(()=>{const e=i.current;e&&r(e.closest(".modal-dialog").clientWidth)},[]),(0,se.Y)("div",{className:"O1fqNCy0",ref:i,children:Boolean(o)&&l?.map((e,i)=>(0,se.Y)(Ra,{size:o,sticker:e,realIndex:i,index:(i+n+l.length)%l.length,maxLength:l.length,onClick:c,onEnded:d,canPlay:t}))})}));var Ea=i(38691),Va=i(88554);const _a=["#A667FF","#55A5FF"],Ua={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"},Oa={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},Ka={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"},Ja=Object.keys(Ua),Ga=.25*g.$,ja=Yt.R.giant+Ga,za=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({currentUser:e})=>{const t=(0,s.li)(),i=(0,B.A)(),n=(0,Ea.A)();(0,s.Nf)(()=>{t.current&&(0,Va.$)({canvas:t.current,size:ja,strokeWidth:Ga,segmentsCount:8,colorStops:_a,readSegmentsCount:0,readSegmentColor:"transparent",dpr:n})},[n]);const{handleScroll:a,isAtBeginning:o}=(0,rs.A)(),r=ja;return(0,se.FD)("div",{className:"mFElmm7a",children:[(0,se.FD)("div",{className:"Jjbochk6",children:[(0,se.Y)(Yt.A,{forPremiumPromo:!0,peer:e,size:"giant"}),(0,se.Y)("canvas",{className:"ChteQ9C3",ref:t,style:`max-width: ${r}px; max-height: ${r}px`})]}),(0,se.Y)("div",{className:"d2ayix6L",children:i("UpgradedStories")}),(0,se.FD)("div",{className:(0,ge.A)("ensyCeMe",!o&&"iN1T0a2Y","custom-scroll"),onScroll:a,children:[Ja.map((e,t)=>(0,se.Y)(ba,{title:i(Ua[e]),text:i(Oa[e]),icon:Ka[e],isFontIcon:!0,index:t,count:Ja.length,section:e},e)),(0,se.Y)("div",{className:"DFbZJafh",children:i("lng_premium_stories_about_mobile")})]})]})}));var Ha=i(83240);const $a="a7IoUtQG",qa="gubS9KP1",Wa="iZLwcL8v",Qa="A7YHY8qF",Za={double_limits:"PremiumPreviewLimits",infinite_reactions:"PremiumPreviewReactions2",premium_stickers:"PremiumPreviewStickers",animated_emoji:"PremiumPreviewEmoji",no_ads:"PremiumPreviewNoAds",voice_to_text:"PremiumPreviewVoiceToText",profile_badge:"PremiumPreviewProfileBadge",faster_download:"PremiumPreviewDownloadSpeed",more_upload:"PremiumPreviewUploads",advanced_chat_management:"PremiumPreviewAdvancedChatManagement",animated_userpics:"PremiumPreviewAnimatedProfiles",emoji_status:"PremiumPreviewEmojiStatus",translations:"PremiumPreviewTranslations",stories:"PremiumPreviewStories",saved_tags:"PremiumPreviewTags2",last_seen:"PremiumPreviewLastSeen",message_privacy:"PremiumPreviewMessagePrivacy",effects:"Premium.MessageEffects",todo:"PremiumPreviewTodo",pm_noforwards:"PremiumPreviewNoForwards"},Xa={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",pm_noforwards:"PremiumPreviewNoForwardsDescription"},eo={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle",recommendedChannels:"SimilarChannelsLimitTitle",moreAccounts:"ConnectedAccountsLimitTitle"},to={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle",recommendedChannels:"SimilarChannelsLimitSubtitle",moreAccounts:"ConnectedAccountsLimitSubtitle"},io=(0,s.ph)(({promo:e,initialSection:t,isPremium:i,limits:n,premiumPromoOrder:a,subscriptionOption:l,onBack:c,onClickSubscribe:d})=>{const h=(0,B.A)(),m=(0,Fi.A)(),u=(0,s.li)(),[p,v]=(0,s.J0)(o.O2i.indexOf(t)),[g,A]=(0,s.J0)(0),[f,C,b]=(0,D.A)(),[y,S]=(0,s.J0)(!0),[N,k]=(0,s.J0)(!1),w=(0,K.A)(t),I=(0,s.Kr)(()=>a?a.filter(e=>o.O2i.includes(e)):o.O2i,[a]),P=(0,s.Kr)(()=>{if(!l)return;const{amount:e,months:t,currency:s}=l,n=Math.floor(e/t);return i?m("OK"):m("SubscribeToPremium",{price:(0,va.vv)(m,n,s)},{withNodes:!0})},[i,m,l]),Y=(0,T.A)(()=>{d(t)});function F(e){const{scrollTop:t,clientHeight:i,scrollHeight:s}=e.currentTarget;S(t<=20),k(t>=s-i-20)}(0,s.vJ)(()=>{const e=u.current;if(!e||w===t)return;const i=I.indexOf(t);v(i),C(),(0,ya.A)(e,e.clientWidth*i,0).then(b)},[p,I,t,w]);const M=(0,T.A)(async e=>{const t=u.current;t&&(v(e),C(),await(0,ya.A)(t,t.clientWidth*e,800),b())}),L=I[p],R="double_limits"!==L&&"stories"!==L&&"pm_noforwards"!==L;return(0,se.FD)("div",{className:"oyUTEj8I",children:[(0,se.Y)(X.A,{round:!0,size:"tiny",className:(0,ge.A)("njYoMrKM",R&&"SB4pczOo"),color:R?"translucent-white":"translucent",onClick:c,ariaLabel:h("Back"),iconName:"arrow-left"}),(0,se.Y)("div",{className:"dIVBSdWi"}),(0,se.Y)("div",{className:(0,ge.A)("sJubG84j","no-scrollbar"),onScroll:function(e){const t=e.currentTarget,{clientWidth:i,scrollLeft:s}=t,n=Math.round(s),a=n%i/i,o=Math.ceil((n+1)/i);A(o);const l=t.querySelector("#premium_feature_preview_video_"+(o-1)),c=t.querySelector(`#premium_feature_preview_video_${o}`);if((0,r.RK)(()=>{t.style.setProperty("--scroll-progress",a.toString()),t.style.setProperty("--abs-scroll-progress",Math.abs(a).toString()),l&&(0,et.dH)(l,"reverse",!1),c&&(0,et.dH)(c,"reverse",!0)}),f)return;const d=Math.round(n/i);v(d)},ref:u,children:I.map((t,i)=>{if("double_limits"===t)return(0,se.FD)("div",{className:(0,ge.A)(qa,"U7ePgVBR"),children:[(0,se.Y)("h2",{className:(0,ge.A)("mz2Hmd83",y&&"AgmNOqi7"),children:h(Za.double_limits)}),(0,se.Y)("div",{className:(0,ge.A)("n_rowVPI","custom-scroll"),onScroll:F,children:o.M$8.map((e,t)=>{const i=n?.[e][0].toString(),s=n?.[e][1].toString();return(0,se.Y)(Fa,{title:h(eo[e]),description:h(to[e],s),leftValue:i,rightValue:s,colorStepProgress:t/(o.M$8.length-1)})})})]});if("premium_stickers"===t)return(0,se.FD)("div",{className:qa,children:[(0,se.Y)("div",{className:$a,children:(0,se.Y)(xa,{isActive:p===i})}),(0,se.Y)("h1",{className:Wa,children:h(Za.premium_stickers)}),(0,se.Y)("div",{className:Qa,children:(0,Pt.A)(h(Xa.premium_stickers),["br"])})]});if("stories"===t)return(0,se.Y)("div",{className:(0,ge.A)(qa,"J1M6fEdo"),children:(0,se.Y)(za,{})});if("pm_noforwards"===t)return(0,se.FD)("div",{className:(0,ge.A)(qa,"zmZJKKP5"),children:[(0,se.Y)(Ta,{}),(0,se.FD)("div",{className:"iK4wSnTs",children:[(0,se.Y)("h1",{className:Wa,children:m(Za.pm_noforwards)}),(0,se.Y)("div",{className:Qa,children:m(Xa.pm_noforwards)})]})]});const s=e.videoSections.indexOf(t),a="todo"===t;return(0,se.FD)("div",{className:qa,children:[(0,se.Y)("div",{className:$a,children:(0,se.Y)(Ha.A,{isActive:p===i,videoId:-1!==s?e.videos[s].id:void 0,videoThumbnail:-1!==s?e.videos[s].thumbnail:void 0,isDown:o.jhT.includes(t),index:i,isReverseAnimation:i===g})}),(0,se.Y)("h1",{className:Wa,children:a?m(Za.todo,void 0,{withNodes:!0,renderTextFilters:["br"]}):h(Za[t])}),(0,se.Y)("div",{className:Qa,children:(0,Pt.A)(a?m(Xa.todo,void 0,{withNodes:!0,renderTextFilters:["br"]}):h(Xa[t]),["br"])})]})})}),(0,se.FD)("div",{className:(0,ge.A)("yN2611rA",(N||0!==p)&&"rCHMABcD"),children:[(0,se.Y)(ka,{length:I.length,active:p,onSelectSlide:M}),Boolean(P)&&(0,se.Y)(X.A,{className:(0,ge.A)("EPfM7AgT"),isShiny:!i,withPremiumGradient:!i,onClick:i?c:Y,children:P})]})]})}),so=(0,s.ph)(({option:e,checked:t,fullMonthlyAmount:i,onChange:n,className:a,isGiveaway:o})=>{const r=(0,B.A)(),l=(0,Fi.A)(),{months:c,amount:d,currency:h}=e,m="users"in e?e.users:void 0,u=Math.floor(d/c),p=m?m>1:void 0,v=(0,s.Kr)(()=>i&&i>u?Math.ceil(100-u/(i/100)):void 0,[i,u]),g=(0,s.hb)(e=>{e.target.checked&&n(c)},[c,n]);return(0,se.FD)("label",{className:(0,ge.A)(o?"PkseWxFK":"qZA6S2kc",t&&!o&&"EJOQwnRj",a),dir:l.isRtl?"rtl":void 0,children:[(0,se.Y)("input",{className:"WOEkhx6R",type:"radio",name:"subscription_option",value:c,checked:t,onChange:g}),(0,se.FD)("div",{className:"BHUCScsU",children:[(0,se.FD)("div",{className:"DfYCMUkL",children:[Boolean(v)&&(0,se.FD)("span",{className:(0,ge.A)("ublijP0j","uqDlP3Zt"),title:r("GiftDiscount"),children:[" ","",v,"%"]}),r("Months",c)]}),(0,se.Y)("div",{className:"poxOXJ2o",children:o||p?`${(0,va.Ad)(d,h,r.code)} x ${m}`:r("PricePerMonth",(0,va.Ad)(u,h,r.code))}),(0,se.Y)("div",{className:"IGMrERf_",children:(0,va.Ad)(d,h,r.code)})]})]})}),no="yKm9hKQP",ao=i.p+"PremiumAds.a758f19ece91fe91318e.svg",oo=i.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",ro=i.p+"PremiumChats.89d9d315638e283ca895.svg",lo=i.p+"PremiumEffects.4eab9caad8e9c276842d.svg",co=i.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",ho=i.p+"PremiumFile.884dd3865acfe594fc61.svg",mo=i.p+"PremiumLastSeen.9575a548770d23785846.svg",uo=i.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",po=i.p+"PremiumMessagePrivacy.950cab3e87c60c5733a6.svg",vo=i.p+"PremiumNoForwardsPrivacy.87316a475396fb320c19.svg",go=i.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",Ao=i.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",fo=i.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",Co=i.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",bo=i.p+"PremiumTags.3b187054cc90f8e16cb7.svg",yo=i.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",So=i.p+"PremiumVideo.288cb61931e33d913f0a.svg",No=i.p+"PremiumVoice.b3a2893dbe481108ab94.svg",ko=8*g.$,wo={stories:fo,double_limits:uo,infinite_reactions:go,premium_stickers:Co,animated_emoji:co,no_ads:ao,voice_to_text:No,profile_badge:oo,faster_download:Ao,more_upload:ho,advanced_chat_management:ro,animated_userpics:So,emoji_status:fo,translations:yo,saved_tags:bo,last_seen:mo,message_privacy:po,effects:lo,todo:oo,pm_noforwards:vo},Io=(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,daysAmount:t?.daysAmount,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,ys.B)(e,"channels"),limitFolders:(0,ys.B)(e,"dialogFilters"),limitPins:(0,ys.B)(e,"dialogFolderPinned"),limitLinks:(0,ys.B)(e,"channelsPublic"),limits:e.appConfig.limits,premiumSlug:e.appConfig.premiumInvoiceSlug,premiumBotUsername:e.appConfig.premiumBotUsername,premiumPromoOrder:e.appConfig.premiumPromoOrder}})(({isOpen:e,currentUserId:t,fromUser:i,fromUserStatusEmoji:a,fromUserStatusSet:r,promo:c,initialSection:d,isPremium:h,limitChannels:m,limitLinks:u,limitFolders:p,limitPins:v,limits:g,premiumSlug:A,premiumBotUsername:f,isSuccess:C,isGift:b,toUser:y,daysAmount:S,premiumPromoOrder:N,gift:k})=>{const w=(0,s.li)(),{closePremiumModal:I,openInvoice:P,requestConfetti:Y,openTelegramLink:F,loadStickers:D,openStickerSet:M}=(0,n.ko)(),L=(0,B.A)(),R=(0,Fi.A)(),[x,E]=(0,s.J0)(!0),[V,_]=(0,s.J0)(d),[U,O]=(0,s.J0)();(0,s.vJ)(()=>{e?d&&_(d):(E(!0),_(void 0))},[e,d]);const K=(0,T.A)(e=>{_(e)}),J=(0,T.A)(()=>{_(void 0)}),G=(0,T.A)(e=>{w.current&&(A?P({type:"slug",slug:A}):f&&(F({url:`${o.jsp}${f}?start=${e||"promo"}`}),I()))}),j=(0,T.A)(()=>{U?G(String(U.months)):G()}),z=(0,T.A)(e=>{const t=c?.options.find(t=>t.months===e);O(t)}),H=(0,T.A)(()=>{const t=w.current;if(t&&e){const{top:e,left:i,width:s,height:n}=t.querySelector(".modal-content").getBoundingClientRect();Y({top:e,left:i,width:s,height:n,withStars:!0})}});(0,s.vJ)(()=>{C&&H()},[C,H]),(0,$.A)(([e])=>{e!==h&&H()},[h,H]);const q=(0,s.Kr)(()=>N?N.filter(e=>o.O2i.includes(e)):o.O2i,[N]);(0,s.vJ)(()=>{a&&!r&&D({stickerSetInfo:a.stickerSetInfo})},[D,a,r]),(0,s.vJ)(()=>{const[e]=c?.options??[];O(e)},[c]);const W=(0,T.A)(()=>{r&&M({stickerSetInfo:r})}),Q=(0,s.Kr)(()=>{const e=c?.options.find(e=>1===e.months);if(e)return Number(e.amount)},[c]),Z=(0,s.Kr)(()=>{if(!U)return;const{amount:e,months:t,currency:i}=U,s=Math.floor(e/t);return(0,va.vv)(R,s,i)},[U,R]);if(c&&(!a||r))return(0,se.Y)(te.A,{className:"sfbpMFHM",onClose:I,isOpen:e,dialogRef:w,hasAbsoluteCloseButton:!V,children:(0,se.Y)(oe.Ay,{name:"slide",activeKey:V?1:0,className:"ELNkgPve",children:V?(0,se.Y)(io,{initialSection:V,onBack:J,promo:c,onClickSubscribe:G,isPremium:h,limits:g,premiumPromoOrder:N,subscriptionOption:U}):(0,se.FD)("div",{className:(0,ge.A)("ZpOIPrhp","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;E(t<=150)},children:[function(){if(k){const e=(0,ga.yQ)(k);return(0,se.Y)(Aa.A,{model:"sticker",sticker:e,color:"purple",title:ee(),description:(0,Pt.A)(ie(),["simple_markdown","emoji"]),className:"lzalivui"})}return a?(0,se.FD)(se.FK,{children:[(0,se.Y)(sn.A,{className:"mQwvY9LA",onClick:W,documentId:a.id,isBig:!0,size:ko}),(0,se.Y)("h2",{className:(0,ge.A)("y71v6ECL",r&&"xw_GbDj7"),children:ee()}),(0,se.Y)("div",{className:"cUcKXV3j",children:(0,Pt.A)(ie(),["simple_markdown","emoji"])})]}):(0,se.Y)(Aa.A,{model:"swaying-star",color:"purple",title:ee(),description:(0,Pt.A)(ie(),["simple_markdown","emoji"]),className:"z0zfJObh"})}(),!h&&!b&&(0,se.Y)("div",{className:"xZC_Oajr",children:c?.options.map(e=>(0,se.Y)(so,{className:"gygsbDbE",option:e,onChange:z,fullMonthlyAmount:Q,checked:U?.months===e.months},e.amount))}),(0,se.Y)("div",{className:(0,ge.A)("Bc_F0RKb",x&&"ltXo0Xi7"),children:(0,se.Y)("h2",{className:"xysPdANX",children:L("TelegramPremium")})}),(0,se.FD)("div",{className:(0,ge.A)("c3Ee2oSo",h&&"yWEHoJOL"),children:[q.map((e,t)=>{const i="todo"===e||"pm_noforwards"===e;return(0,se.Y)(ba,{title:i?R(Za[e]):L(Za[e]),text:"double_limits"===e?L(Xa[e],[m,p,v,u,4]):i?R(Xa[e]):L(Xa[e]),icon:wo[e],index:t,count:q.length,section:e,onClick:K},e)}),(0,se.FD)("div",{className:(0,ge.A)(no,"l1WlNpmu"),dir:R.isRtl?"rtl":void 0,children:[(0,se.Y)("p",{children:(0,Pt.A)(L("AboutPremiumDescription"),["simple_markdown"])}),(0,se.Y)("p",{children:(0,Pt.A)(L("AboutPremiumDescription2"),["simple_markdown"])})]}),function(){if(c&&(!b||i?.id!==t))return(0,se.Y)("div",{className:no,dir:R.isRtl?"rtl":void 0,children:(0,Oi.fd)({text:c.statusText,entities:c.statusEntities})})}()]}),!h&&U&&(0,se.Y)("div",{className:"nCnlO9UZ",children:(0,se.Y)(X.A,{className:"c1tMxuFH",isShiny:!0,withPremiumGradient:!0,onClick:j,children:L("SubscribeToPremium",Z)})})]})})});function ee(){if(k)return R("PremiumGiftHeader");if(b){const e=S?(0,We.w6)(R,S):"";return(0,Pt.A)(i?.id===t?R("DialogTitlePremiumGiftSentTo",{user:(0,l.Yg)(y),amount:e}):R("DialogTitlePremiumGiftReceivedFrom",{user:(0,l.Yg)(i),amount:e}),["simple_markdown","emoji"])}if(r&&i){const e=L("lng_premium_emoji_status_title").replace("{user}",(0,l.Yg)(i)),[t,s]=e.split("{link}"),n=r.thumbCustomEmojiId?(0,se.Y)(sn.A,{className:"Y0jTcadE",documentId:r.thumbCustomEmojiId}):void 0,a=(0,se.FD)("span",{className:"FLzl2ng5",onClick:W,children:[n,(0,Pt.A)(r.title)]});return[(0,Pt.A)(t),a,(0,Pt.A)(s)]}return(0,Pt.A)(i?L("TelegramPremiumUserDialogTitle",(0,l.Yg)(i)):L(h?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])}function ie(){return k&&"starGiftUnique"!==k.type&&k.perUserTotal?R("DescriptionGiftPremiumRequired2",{count:k.perUserTotal},{pluralValue:k.perUserTotal}):b?i?.id===t?L("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Yg)(y)):L("TelegramPremiumUserGiftedPremiumDialogSubtitle"):L(r?"TelegramPremiumUserStatusDialogSubtitle":i?"TelegramPremiumUserDialogSubtitle":h?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle")}}));var Po=i(80089),Yo=i(80464);const Fo=e=>{const{isOpen:t}=e,i=(0,Yo.A)(Po.ar.Extra,"CountryPickerModal",!t);return i?(0,se.Y)(i,{...e}):void 0};var Do=i(1526),Mo=i(96530),To=i(11124),Bo=i(34642);const Lo=(0,s.ph)(({isOpen:e,giveawayChatId:t,selectionLimit:i,initialSelectedIds:a,onSelectedIdsConfirmed:o,onClose:r})=>{const{showNotification:c}=(0,n.ko)(),d=(0,B.A)(),[h,m]=(0,s.J0)(void 0),[u,p]=(0,s.J0)(""),[v,g,A]=(0,D.A)(),[f,C]=(0,s.J0)(a);(0,s.vJ)(()=>{C(a)},[a]);const b=(0,s.Kr)(()=>{const e=(0,n.mS)(),i=e.chats.byId,{active:s,archived:a}=e.chats.listIds,o=(s||[]).concat(a||[]);return(0,di.Am)(o).map(e=>i[e]).filter(e=>e&&((0,l.WX)(e)||(0,l.Vs)(e))&&e.id!==t).map(e=>e.id)},[t]),y=(0,s.Kr)(()=>{const e=b?(0,It.PU)({ids:b,query:u,type:"chat"}):[];return(0,Ss.A)(e,!1,f)},[b,u,f]),S=(0,T.A)(e=>{const t=(0,n.mS)().chats.byId,s=e.filter(e=>!f.includes(e)).find(e=>{const i=t[e];return i&&!(0,l.gA)(i)});f?.length>=i?c({message:d("BoostingSelectUpToWarningChannelsPlural",i)}):s?(m(s),g()):C(e)}),N=(0,T.A)(()=>{h&&C((0,di.Am)([...f,h])),A()}),k=(0,T.A)(()=>{o(f),r()});return(0,se.FD)(Bo.A,{isOpen:e,onClose:r,title:d("RequestPeer.ChooseChannelTitle"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:d("Save"),onConfirm:k,onEnter:k,children:[(0,se.Y)(mi.A,{itemIds:y,selectedIds:f,filterValue:u,filterPlaceholder:d("Search"),onSelectedIdsChange:S,onFilterChange:p,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"}),(0,se.Y)(ai.A,{title:d("BoostingGiveawayPrivateChannel"),text:d("BoostingGiveawayPrivateChannelWarning"),confirmLabel:d("Add"),isOpen:v,onClose:A,confirmHandler:N})]})}),Ro=(0,s.ph)(({option:e,checked:t,name:i,text:s,img:n,isLink:a,onChange:o,onClickAction:r,className:l,userNames:c,selectedMemberIds:d})=>{const h=(0,B.A)();let m=h(s);a&&d?.length&&(m=d.length>2?d.length.toString():c);const u=(0,T.A)(t=>{t.target.checked&&o(e)}),p=(0,T.A)(()=>{r?.()});return(0,se.FD)("label",{className:(0,ge.A)("w3OGYFKn",l),dir:h.isRtl?"rtl":void 0,role:"button",tabIndex:0,children:[(0,se.Y)("input",{className:"xy4AclZa",type:"radio",name:"giveaway_option",value:e,checked:t,onChange:u,onClick:e=>e.stopPropagation()}),(0,se.FD)("div",{className:"TTgSI7Xh",children:[(0,se.Y)("img",{className:"lGhZJbMF",src:n,alt:"",draggable:!1}),(0,se.FD)("div",{className:"sEt7TF59",children:[(0,se.Y)("h3",{className:"u4NzVBBi",children:h(i)}),a?(0,se.FD)("div",{className:"y7XfPOoG",onClick:p,children:[(0,se.Y)("span",{children:m}),(0,se.Y)(he.A,{name:"next"})]}):(0,se.Y)("span",{className:"kt2ZKZ6j",children:m})]})]})]})}),xo=(0,s.ph)((0,n.EK)((e,{giveawayChatId:t})=>{const i=t?(0,c.AWZ)(e,t):void 0;return i?{members:i.members,adminMembersById:i.adminMembersById}:{members:void 0,adminMembersById:void 0}})(({isOpen:e,selectionLimit:t,members:i,adminMembersById:a,initialSelectedIds:o,onSelectedIdsConfirmed:r,onClose:c})=>{const{showNotification:d}=(0,n.ko)(),h=(0,B.A)(),[m,u]=(0,s.J0)(""),[p,v]=(0,s.J0)(o);(0,s.vJ)(()=>{v(o)},[o]);const g=(0,s.Kr)(()=>{const e=(0,n.mS)(),{byId:t,statusesById:s}=e.users;if(!i?.length)return[];const o=a&&new Set(Object.keys(a)),r=(0,l.UB)(i.map(({userId:e})=>e),t,s);return o?r.filter(e=>!o.has(e)):r},[a,i]),A=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=g?(0,It.PU)({ids:g,query:m,type:"user"}):[];return(0,Ss.A)((0,di.Am)(t).filter(t=>{const i=e[t];return!i||!(0,l.tv)(i)}))},[g,m]),f=(0,T.A)(e=>{e.length>t?d({message:h("BoostingSelectUpToWarningUsers",t)}):v(e)}),C=(0,T.A)(()=>{r(p),c()});return(0,se.Y)(Bo.A,{isOpen:e,onClose:c,title:h("BoostingAwardSpecificUsers"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:h("Save"),onConfirm:C,onEnter:C,children:(0,se.Y)(mi.A,{itemIds:A,selectedIds:p,filterValue:m,filterPlaceholder:h("Search"),onSelectedIdsChange:f,onFilterChange:u,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"})})})),Eo="rZRDMqUL",Vo="JjDLNrKG",_o="p5Hn4Q6E",Uo="rniPcuiP",Oo="G9H3tm6D",Ko="xKl2UeV8",Jo="HLx3wTBD",Go="Ftr7zf2v",jo="Ce0Ob2tg",zo="rDFQAfTt",Ho="LZ3vPzak",$o="Z9QJQ6IS",qo="ldn4mh2T";var Wo=i(72078),Qo=i(68153),Zo=i(65741),Xo=i(45318);const er=i.p+"PremiumStar.39c1ff364d35554f4b80.svg",tr={3:Qo,6:Wo,12:Zo},ir=(0,s.ph)((0,n.EK)(e=>{const{giveawayModal:t}=(0,c.nTw)(e),i=t?.chatId,s=i?(0,c.hds)(e,i):void 0,n=s&&(0,l.WX)(s);return{chatId:i,gifts:t?.gifts,selectedMemberList:t?.selectedMemberIds,selectedChannelList:t?.selectedChannelIds,giveawayBoostPerPremiumLimit:e.appConfig.giveawayBoostsPerPremium,isStarsGiftEnabled:e.appConfig.isStarsGiftEnabled,userSelectionLimit:e.appConfig.giveawayAddPeersMax,countrySelectionLimit:e.appConfig.giveawayCountriesMax,countryList:e.countryList.general,prepaidGiveaway:t?.prepaidGiveaway,isChannel:n,starsGiftOptions:t?.starOptions}})(({chatId:e,gifts:t,isOpen:i,isChannel:a,selectedMemberList:r,selectedChannelList:c,giveawayBoostPerPremiumLimit:d=o.CQG,countryList:h,prepaidGiveaway:m,countrySelectionLimit:u=o.y67,userSelectionLimit:p=o.qbC,isStarsGiftEnabled:v,starsGiftOptions:g})=>{const A=(0,s.li)(),{closeGiveawayModal:f,openInvoice:C,openPremiumModal:b,launchPrepaidGiveaway:y,launchPrepaidStarsGiveaway:S}=(0,n.ko)(),N=(0,B.A)(),[k,w,I]=(0,D.A)(),[P,Y,F]=(0,D.A)(),[M,L,R]=(0,D.A)(),[x,E,V]=(0,D.A)(),[_,U,O]=(0,D.A)(),K=[{name:"Premium.Title",text:"BoostingWinnersRandomly",value:"premium_giveaway",img:Wo,actions:"createPremiumGiveaway",isLink:!0,onClickAction:()=>{E()}}];v&&K.push({name:"TelegramStars",text:"BoostingWinnersRandomly",value:"stars_giveaway",img:Xo,actions:"createStarsGiveaway",isLink:!1});const[J,G]=(0,s.J0)(()=>Date.now()+2592e5),[j,z]=(0,s.J0)(!0),[H,$]=(0,s.J0)(5),[q,W]=(0,s.J0)(K[0].value),[Q,Z]=(0,s.J0)(),[ne,ae]=(0,s.J0)("all"),[oe,re]=(0,s.J0)(),[le,ce]=(0,s.J0)([]),[de,me]=(0,s.J0)([]),[ue,pe]=(0,s.J0)([]),[ve,Ae]=(0,s.J0)(!1),[fe,Ce]=(0,s.J0)(!1),[be,ye]=(0,s.J0)(void 0),[Se,Ne]=(0,s.J0)(void 0),[ke,we]=(0,s.J0)(void 0),Ie="premium_giveaway"===q,Pe="stars_giveaway"===q,Ye=Ie&&!le.length?H:le.length,Fe=Ye*d,De=Q?.yearlyBoosts,Me=(0,s.Kr)(()=>[{value:"all",label:N(a?"BoostingAllSubscribers":"BoostingAllMembers"),subLabel:ue&&ue.length>0?N("Giveaway.ReceiverType.Countries",ue.length):N("BoostingFromAllCountries")},{value:"new",label:N(a?"BoostingNewSubscribers":"BoostingNewMembers"),subLabel:ue&&ue.length>0?N("Giveaway.ReceiverType.Countries",ue.length):N("BoostingFromAllCountries")}],[a,N,ue]),Te=N("Months",oe),Be="starsGiveaway"===m?.type,Le="giveaway"===m?.type,Re=(0,s.Kr)(()=>t?.find(e=>e.months===oe&&e.users===Ye),[t,oe,Ye]),xe=(0,s.Kr)(()=>g?.find(e=>Be&&e.stars===ke?.stars),[ke,g,Be]),Ee=(0,s.Kr)(()=>t?.filter(e=>e.users===Ye&&e.currency!==o.OUy),[t,Ye]),Ve=(0,s.Kr)(()=>{const e=Ee?.reduce((e,t)=>t.amount<e.amount?t:e,Ee[0]);return e&&Math.floor(e.amount/e.months)},[Ee]),_e=(0,s.Kr)(()=>(0,di.Am)(t?.filter(e=>e.currency!==o.OUy)?.map(e=>e.users)||[]).sort((e,t)=>e-t),[t]),Ue=(0,s.Kr)(()=>(0,di.Am)(Q?.winners?.map(e=>e.users)||[]).sort((e,t)=>e-t),[Q]);(0,s.vJ)(()=>{i&&t?.length&&!Be&&re(t?.[0].months)},[i,t,Be]),(0,s.vJ)(()=>{i&&g?.length&&!Le&&Z(g?.[0])},[i,g,Le]),(0,s.vJ)(()=>{i&&Be&&($(m.quantity),we(m))},[i,Be,m]),(0,s.vJ)(()=>{i&&Le&&($(m.quantity),Ne(m),re(m.months))},[i,Le,m]),(0,s.vJ)(()=>{r&&ce(r)},[r]),(0,s.vJ)(()=>{c&&me(c)},[c]);const Oe=(0,T.A)(()=>{b()}),Ke=(0,T.A)(()=>{we(void 0),Ne(void 0),Z(void 0),re(void 0),$(5),f()}),Je=(0,T.A)(()=>{C(Ie?le?.length?{type:"giftcode",boostChannelId:e,userIds:le,currency:Re.currency,amount:Re.amount,option:Re}:{type:"giveaway",chatId:e,additionalChannelIds:de,isOnlyForNewSubscribers:"new"===ne,countries:ue,areWinnersVisible:ve,prizeDescription:be,untilDate:J/1e3,currency:Re.currency,amount:Re.amount,option:Re}:{type:"starsgiveaway",chatId:e,additionalChannelIds:de,isOnlyForNewSubscribers:"new"===ne,countries:ue,areWinnersVisible:ve,prizeDescription:be,untilDate:J/1e3,currency:Q.currency,amount:Q.amount,stars:Q.stars,users:H}),Ke()}),Ge=(0,T.A)(()=>{Be?S({chatId:e,giveawayId:ke.id,paymentPurpose:{additionalChannelIds:de,countries:ue,prizeDescription:be,areWinnersVisible:ve,untilDate:J/1e3,stars:ke.stars,currency:xe.currency,amount:xe.amount,users:ke.quantity}}):y({chatId:e,giveawayId:Se.id,paymentPurpose:{additionalChannelIds:de,countries:ue,prizeDescription:be,areWinnersVisible:ve,untilDate:J/1e3,currency:Re.currency,amount:Re.amount}}),R(),Ke()}),je=(0,T.A)(e=>{$(e)}),ze=(0,T.A)(e=>{$(e)}),He=(0,T.A)(e=>{ye(e.target.value)}),$e=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;return le?.map(t=>(0,l.Yg)(e[t])).join(", ")},[le]),qe=(0,T.A)(e=>{ae(e)}),Qe=(0,T.A)(e=>{W(e),ce([]),$(5)}),Ze=(0,T.A)(e=>{G(e.getTime()),I()}),Xe=(0,T.A)(e=>{pe(e)}),et=(0,T.A)(e=>{ce(e),e.length||W("premium_giveaway")}),tt=(0,T.A)(e=>{me(e)}),it=(0,T.A)(e=>{Ae(e.target.checked)}),st=(0,T.A)(e=>{Ce(e.target.checked)}),nt=(0,T.A)(()=>{Y()}),at=(0,T.A)(e=>{Z(e)});function ot(){return(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:Eo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingChannelsGroupsIncludedGiveaway")}),(0,se.Y)(li.A,{inactive:!0,className:"chat-item-clickable contact-list-item",children:(0,se.Y)(hs.A,{chatId:e,status:N(a?"BoostingChannelWillReceiveBoost":"BoostingGroupWillReceiveBoost",Fe||De,"i")})}),de?.map(e=>(0,se.Y)(li.A,{ripple:!0,className:"chat-item-clickable contact-list-item",onClick:()=>function(e){const t=de.filter(t=>t!==e);me(t)}(e),rightElement:(0,se.Y)(he.A,{name:"close",className:"UZdErfVI"}),children:(0,se.Y)(hs.A,{chatId:e.toString()})},e)),de.length<9&&(0,se.Y)(li.A,{icon:"add",ripple:!0,onClick:U,className:"sOXvh85b",iconClassName:"aGbyR60s",children:N("BoostingAddChannelOrGroup")})]}),(0,se.FD)("div",{className:Eo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingEligibleUsers")}),(0,se.Y)("div",{className:Vo,children:(0,se.Y)(ie.A,{name:"subscribers",options:Me,selected:ne,onChange:qe,onClickAction:nt,subLabelClassName:"txXJxVFu",isLink:!0})})]}),(0,se.Y)("div",{className:Uo,children:(0,Pt.A)(N(a?"BoostGift.LimitSubscribersInfo":"lng_giveaway_users_about_group"))}),(0,se.FD)("div",{className:Eo,children:[(0,se.FD)("div",{className:$o,children:[(0,se.Y)("h2",{className:Ho,children:N("BoostingGiveawayAdditionalPrizes")}),(0,se.Y)(ci.A,{label:N("BoostingGiveawayAdditionalPrizes"),checked:fe,onChange:st})]}),fe&&(0,se.FD)("div",{className:"eQVP0Nx8",children:[(0,se.Y)("h2",{className:Ho,children:H}),(0,se.Y)(ee.A,{className:"qMYNwiUZ",value:be,onChange:He,label:N("BoostingGiveawayEnterYourPrize")})]})]}),fe?Pe||Be?void 0:(0,se.Y)("div",{className:Uo,children:be?.length?(0,Pt.A)(N("BoostingGiveawayAdditionPrizeCountNameHint",Se?[Se.quantity,be,Te]:[Ye,be,Te],void 0,oe),["simple_markdown"]):(0,Pt.A)(N("BoostingGiveawayAdditionPrizeCountHint",Se?[Se.quantity,Te]:[Ye,Te],void 0,oe),["simple_markdown"])}):(0,se.Y)("div",{className:Uo,children:(0,Pt.A)(N("BoostingGiveawayAdditionPrizeHint"))}),(0,se.Y)("div",{className:Eo,children:(0,se.FD)("div",{className:$o,children:[(0,se.Y)("h2",{className:Ho,children:N("BoostingGiveawayShowWinners")}),(0,se.Y)(ci.A,{label:N("BoostingGiveawayAdditionalPrizes"),checked:ve,onChange:it})]})}),(0,se.Y)("div",{className:Uo,children:(0,Pt.A)(N("BoostingGiveawayShowWinnersHint"))}),(0,se.FD)("div",{className:(0,ge.A)(Eo,(Se||ke||Pe)&&zo),children:[(0,se.Y)("h2",{className:_o,children:N("BoostingDateWhenGiveawayEnds")}),(0,se.FD)(X.A,{ariaLabel:N("BoostGift.DateEnds"),className:(0,ge.A)("GeKqKRgP","expire-limit"),isText:!0,onClick:w,children:[(0,se.Y)("h3",{className:Ho,children:N("BoostGift.DateEnds")}),(0,We.L2)(J,N.code)]})]})]})}return(0,se.FD)(te.A,{className:"P0kLOw15",onClose:Ke,isOpen:i,dialogRef:A,onEnter:Se||ke?L:Je,hasAbsoluteCloseButton:!0,children:[(0,se.FD)("div",{className:(0,ge.A)("SqiN63Ef","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;z(t<=150)},children:[(0,se.Y)("img",{className:"Me2hCsMs",src:er,alt:"",draggable:!1}),(0,se.Y)("h2",{className:"UVDnB0Wq",children:(0,Pt.A)(N("BoostingBoostsViaGifts"))}),(0,se.Y)("div",{className:"v5yGzV6v",children:(0,Pt.A)(N(a?"BoostingGetMoreBoost":"BoostingGetMoreBoostsGroup"))}),(0,se.Y)("div",{className:(0,ge.A)("U6XNIToQ",j&&"tDZc21ZC"),children:(0,se.Y)("h2",{className:"v6hiGpEn",children:N("BoostingBoostsViaGifts")})}),Se||ke?(0,se.FD)("div",{className:"q1y2qUTn",children:[(0,se.Y)("div",{children:ke?(0,se.Y)("img",{className:qo,src:Xo,alt:""}):(0,se.Y)("img",{className:qo,src:tr[Se.months]||tr[3],alt:""})}),(0,se.FD)("div",{className:"IsT38nlq",children:[(0,se.Y)("h3",{className:Ho,children:ke?N("Giveaway.Stars.Prepaid.Title",ke?.stars):N("BoostingTelegramPremiumCountPlural",Se.quantity)}),(0,se.Y)("p",{className:"TsGuei3B",children:ke?N("Giveaway.Stars.Prepaid.Desc",ke?.quantity):N("PrepaidGiveawayMonths",Se?.months)})]}),(0,se.Y)("div",{className:Oo,children:(0,se.FD)("div",{className:(0,ge.A)(Ko,Jo),children:[(0,se.Y)(he.A,{name:"boost",className:Go}),(0,se.Y)("div",{className:jo,dir:N.isRtl?"rtl":void 0,children:ke?ke?.boosts:Se.quantity*(d??o.CQG)})]})})]}):(0,se.Y)("div",{className:(0,ge.A)(Eo,"sQ5PkKEs"),children:(0,se.Y)("div",{className:Vo,children:K.map(e=>(0,se.Y)(Ro,{name:e.name,text:e.text,option:e.value,img:e.img,onChange:Qe,checked:q===e.value,isLink:e.isLink,userNames:$e,selectedMemberIds:le,onClickAction:e.onClickAction},e.name))})}),Ie&&!le?.length&&(0,se.FD)(se.FK,{children:[!Se&&!ke&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:Eo,children:[(0,se.FD)("div",{className:Oo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingQuantityPrizes")}),(0,se.FD)("div",{className:(0,ge.A)(Ko,Jo),children:[(0,se.Y)(he.A,{name:"boost",className:Go}),(0,se.Y)("div",{className:jo,dir:N.isRtl?"rtl":void 0,children:Fe})]})]}),(0,se.Y)(To.A,{rangeCount:Ye,marks:_e,onChange:je})]}),(0,se.Y)("div",{className:Uo,children:(0,Pt.A)(N("BoostingChooseHowMany"))})]}),ot()]}),Pe&&(0,se.FD)(se.FK,{children:[!ke&&!Se&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:Eo,children:[(0,se.FD)("div",{className:Oo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingStarsOptions")}),(0,se.FD)("div",{className:(0,ge.A)(Ko,Jo),children:[(0,se.Y)(he.A,{name:"boost",className:Go}),(0,se.Y)("div",{className:jo,dir:N.isRtl?"rtl":void 0,children:De})]})]}),(0,se.Y)(Do.A,{className:"cLhNkYPB",options:g,selectedStarCount:H,selectedStarOption:Q,onClick:at})]}),(0,se.Y)("div",{className:(0,ge.A)(Uo,"bzRAETfR"),children:(0,Pt.A)(N("BoostGift.Stars.Info"))}),(0,se.FD)("div",{className:Eo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingStarsQuantityPrizes")}),(0,se.Y)(To.A,{rangeCount:H,marks:Ue,onChange:ze}),(0,se.Y)("div",{className:Uo,children:(0,Pt.A)(N("BoostingStarsQuantityPrizesInfo"))})]})]}),ot()]}),!Se&&!ke&&Ie&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:Eo,children:[(0,se.Y)("h2",{className:_o,children:N("BoostingDurationOfPremium")}),(0,se.Y)("div",{className:Vo,children:Ee?.map(e=>(0,se.Y)(so,{isGiveaway:!0,option:e,fullMonthlyAmount:Ve,checked:e.months===oe,onChange:re},e.months))})]}),(0,se.Y)("div",{className:(0,ge.A)(Uo,zo),children:function(){const e=N("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return(0,se.FD)("p",{className:"eNQ_nrKr",children:[e[1],(0,se.Y)(Mo.A,{isPrimary:!0,onClick:Oe,children:e[2]}),e[3]]})}()})]}),q&&(0,se.Y)("div",{className:"hD_AEzjd",children:(0,se.Y)(X.A,{className:"ILuhBsJG",onClick:Se||ke?L:Je,children:N("BoostingStartGiveaway")})})]}),(0,se.Y)(vn,{isOpen:k,isFutureMode:!0,withTimePicker:!0,onClose:I,onSubmit:Ze,selectedAt:J,submitButtonLabel:N("Save")}),(0,se.Y)(Fo,{isOpen:P,onClose:F,countryList:h,onSubmit:Xe,selectionLimit:u}),(0,se.Y)(xo,{isOpen:x,onClose:V,onSelectedIdsConfirmed:et,initialSelectedIds:le,selectionLimit:p,giveawayChatId:e}),(0,se.Y)(Lo,{isOpen:_,onClose:O,initialSelectedIds:de,onSelectedIdsConfirmed:tt,selectionLimit:o.cgU,giveawayChatId:e}),(0,se.Y)(ai.A,{title:N("BoostingStartGiveawayConfirmTitle"),text:N("BoostingStartGiveawayConfirmText"),confirmLabel:N("Start"),isOpen:M,onClose:R,confirmHandler:Ge})]})})),sr={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders",savedDialogsPinned:"LimitReachedPinSavedDialogs"},nr={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked",savedDialogsPinned:"LimitReachedPinSavedDialogsLocked"},ar={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium",savedDialogsPinned:"LimitReachedPinSavedDialogsPremium"},or={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"},rr={uploadMaxFileparts:(e,t)=>8e3===t?e("MediaSizeGB",{size:4},{pluralValue:4}):4e3===t?e("MediaSizeGB",{size:2},{pluralValue:2}):(0,Fn.v7)(e,t*o.dK5)},lr=(0,s.ph)((0,n.EK)((e,{limit:t})=>{const{limits:i}=e.appConfig,s=(0,c.g29)(e);return{defaultValue:t?i?.[t][0]:void 0,premiumValue:t?i?.[t][1]:void 0,canBuyPremium:!(0,c.n_C)(e),isPremium:s}})(({defaultValue:e,premiumValue:t,limit:i,isPremium:a,canBuyPremium:o})=>{const{closeLimitReachedModal:r,openPremiumModal:l}=(0,n.ko)(),c=(0,Fi.A)(),d=(0,B.A)(),[h,m,u]=(0,D.A)(),p=(0,s.hb)(()=>{l(),m()},[l,m]);(0,s.vJ)(()=>{!i&&h&&u()},[h,i,u]);const v=c("LimitReached"),g=i&&rr[i],A=function({lang:e,oldLang:t,limitType:i,isPremium:s,canBuyPremium:n,defaultValue:a,premiumValue:o,valueFormatter:r}){if(!i)return;const l=r?r(e,a):a,c=r?r(e,o):o;return s?t(ar[i],c):n?t(sr[i],"channelsPublic"===i?c:[l,c]):t(nr[i],l)}({lang:c,oldLang:d,limitType:i,isPremium:a,canBuyPremium:o,defaultValue:e,premiumValue:t,valueFormatter:g}),f=i&&or[i],C=o&&!a;return(0,se.FD)(te.A,{onClose:m,onCloseAnimationEnd:r,isOpen:Boolean(i)&&!h,title:v,className:"QAs_iFxO",children:[!C&&(0,se.FD)("div",{className:"Q5d_7bB4",children:[(0,se.Y)("i",{className:(0,ge.A)("rbnU7JVX",f,"icon")}),(0,se.Y)("div",{className:"ArEy3hhB",children:g?.(c,a?t:e)||(a?t:e)})]}),C&&(0,se.Y)(Ia,{className:"k0O6Rnjh",leftValue:g?.(c,e)||e?.toString(),rightValue:g?.(c,t)||t?.toString(),floatingBadgeIcon:f}),(0,se.Y)("div",{children:(0,Pt.A)(A||"",["simple_markdown","br"])}),(0,se.FD)("div",{className:"RVM_RSap",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:m,color:"primary",children:c(C?"Cancel":"OK")}),C&&(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,color:"primary",iconName:"double-badge",iconClassName:"esB1OhAF",iconAlignment:"end",children:c("IncreaseLimit")})]})]})}));var cr=i(93809),dr=i(81954),hr=i(5912);const mr=350+o.xB5,ur=.5*g.$;function pr(e,t,i,n){const a=(0,s.li)([]),[o,r]=(0,s.J0)(0),{observe:l,freeze:c,unfreeze:d}=(0,hr.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:m,unfreeze:u}=(0,hr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:p}=(0,hr.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:v}=(0,hr.BL)({rootRef:t});return(0,$.A)(()=>{n?(c(),m()):setTimeout(()=>{u(),d()},mr)},[c,m,n,d,u]),{activeSetIndex:o,observeIntersectionForSet:l,observeIntersectionForShowingItems:h,observeIntersectionForPlayingItems:p,observeIntersectionForCovers:v,selectStickerSet:(0,T.A)(t=>{r(s=>{const n=document.getElementById(`${i}-${t}`),a=1===Math.abs(s-t);return(0,dr.Ay)({container:e.current,element:n,position:"start",margin:ur,maxDistance:a?200:80}),t})})}}var vr=i(37479),gr=i(87094),Ar=i(94519),fr=i(45294);const Cr=(0,s.ph)(({stickerSet:e,size:t=o.TBj,noPlay:i,forcePlayback:a,observeIntersection:r,sharedCanvasRef:d})=>{const{loadStickers:h}=(0,n.ko)(),u=(0,s.li)(),{hasThumbnail:p,hasVideoThumb:v,hasAnimatedThumb:g,hasStaticThumb:A,thumbCustomEmojiId:f}=e,{customEmoji:C}=(0,fr.A)(f),b=C?.shouldUseTextColor,y=(0,gr.A)(u,void 0,!b),S=(0,vr.A)(y),N=(0,hr.Vz)(u,r),k=N&&!i,w=!p||v&&!m.OF&&!g&&!A,I=w&&e.stickers?.[0]&&(0,l.Mw)(e.stickers[0],"preview"),P=(0,q.A)(I,!N),Y=(p&&!I||g)&&`stickerSet${e.id}`,F=(0,q.A)(Y,!N),D=f||F||P,M=(0,Mi.A)(D),T=(0,Ar.A)(u,d);return(0,s.vJ)(()=>{N&&!e.stickers?.length&&h({stickerSetInfo:e})},[N,h,e]),(0,se.Y)("div",{ref:u,className:(0,ge.A)("m6XpTzQX","sticker-set-cover"),style:`--_size: ${t}px`,children:D?f?(0,se.Y)(sn.A,{documentId:f,size:t,observeIntersectionForPlaying:r,noPlay:i}):g?(0,se.Y)(La.A,{className:M,tgsUrl:F,size:t,play:k,isLowPriority:!(0,c.CzR)((0,n.mS)(),e),sharedCanvas:d?.current||void 0,sharedCanvasCoords:T,forceAlways:a}):v&&!w?(0,se.Y)(xi.A,{className:(0,ge.A)("OZHqKbDL",M),src:F,canPlay:k,style:S,isPriority:a,loop:!0,disablePictureInPicture:!0}):(0,se.Y)("img",{src:F||P,style:S,className:(0,ge.A)("enA6c8gc",M),alt:"",draggable:!1}):(0,Fn.Qh)(e.title,2)})});var br=i(54464),yr=i(82855);const Sr=[{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}],Nr=(0,s.ph)(({sticker:e,size:t,noPlay:i,title:a,className:o,noContextMenu:r,isSavedMessages:l,isStatusPicker:c,canViewSet:d,isSelected:h,isCurrentUserPremium:u,shouldIgnorePremium:p,noShowPremium:v,sharedCanvasRef:g,withTranslucentThumb:A,forcePlayback:f,isEffectEmoji:C,noIcons:b,clickArg:y,onClick:S,observeIntersection:N,observeIntersectionForShowing:k,onFaveClick:w,onUnfaveClick:I,onRemoveRecentClick:P,onDismiss:Y})=>{const{openStickerSet:F,openPremiumModal:D,setEmojiStatus:M}=(0,n.ko)(),L=(0,s.li)(),R=(0,s.li)(),x=(0,B.A)(),E=e.shouldUseTextColor,V=(0,gr.A)(L,void 0,!E),{id:_,stickerSetInfo:U}=e,O=!e.isFree||e.hasEffect,K=e.isCustomEmoji||C,J=!K&&O,G=!u&&O&&!p,j=(0,hr.Vz)(L,N),z=j,H=j&&!i,$=(0,hr.Vz)(L,k),{isContextMenuOpen:q,contextMenuAnchor:W,handleBeforeContextMenu:Q,handleContextMenu:Z,handleContextMenuClose:ee,handleContextMenuHide:te}=(0,cn.A)(L),ie=Boolean(!r&&W),ne=(0,T.A)(()=>L.current),ae=(0,T.A)(()=>L.current.closest(".custom-scroll, .no-scrollbar")),oe=(0,T.A)(()=>c?R.current:L.current.querySelector(".sticker-context-menu .bubble")),re=(0,T.A)(()=>({withPortal:c,shouldAvoidNegativePosition:!0}));(0,s.vJ)(()=>{j||ee()},[ee,j]);const le=(0,T.A)(t=>{t.stopPropagation(),t.preventDefault(),P(e)}),ce=(0,T.A)(()=>{P(e)}),de=(0,T.A)(()=>{I(e)}),me=(0,T.A)(()=>{w(e)}),pe=(0,T.A)(()=>{S?.(y,!0)}),ve=(0,T.A)(()=>{S?.(y,void 0,!0)}),Ae=(0,T.A)(()=>{F({stickerSetInfo:U})}),fe=(0,T.A)((t,i=0)=>{t.preventDefault(),t.stopPropagation(),ee(),Y?.(),M({emojiStatus:{type:"regular",documentId:e.id,until:(0,Ii.Fm)()+i}})}),Ce=!m.TF&&P,be=(0,ge.A)("StickerButton",S&&"interactive",h&&"selected",K&&"custom-emoji",C&&"effect-emoji",o),ye=(0,s.Kr)(()=>{if(!ie||r||K&&!c)return[];const e=[];return K?(Sr.forEach(t=>{e.push((0,se.Y)(ue.A,{onClick:fe,clickArg:t.arg,children:x(t.title,t.value,"i")}))}),e):(I&&e.push((0,se.Y)(ue.A,{icon:"favorite",onClick:de,children:x("Stickers.RemoveFromFavorites")})),w&&e.push((0,se.Y)(ue.A,{icon:"favorite",onClick:me,children:x("Stickers.AddToFavorites")})),!G&&S&&(l||e.push((0,se.Y)(ue.A,{onClick:pe,icon:"muted",children:x("SendWithoutSound")})),e.push((0,se.Y)(ue.A,{onClick:ve,icon:"calendar",children:x(l?"SetReminder":"ScheduleMessage")}))),d&&e.push((0,se.Y)(ue.A,{onClick:Ae,icon:"stickers",children:x("ViewPackPreview")})),P&&e.push((0,se.Y)(ue.A,{icon:"delete",onClick:ce,children:x("DeleteFromRecent")})),e)},[ie,r,K,c,I,w,G,S,d,P,fe,x,de,me,l,ve,pe,Ae,ce]);return(0,se.FD)("div",{ref:L,className:be,title:a||e?.emoji,"data-sticker-id":_,onMouseDown:e=>{(0,br.u)(e),Q(e)},onClick:()=>{if(!q)return G?(D(C?{initialSection:"effects"}:K?{initialSection:"animated_emoji"}:{initialSection:"premium_stickers"}),void Y?.()):void S?.(y)},onContextMenu:Z,children:[$&&(0,se.Y)(yr.A,{containerRef:L,sticker:e,isSmall:!0,size:t,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!z,noPlay:!H,noVideoOnMobile:!0,withSharedAnimation:!0,sharedCanvasRef:g,withTranslucentThumb:A,customColor:V,forceAlways:f}),!b&&!v&&G&&(0,se.Y)("div",{className:"sticker-locked",children:(0,se.Y)(he.A,{name:"lock-badge"})}),!b&&!v&&J&&!G&&(0,se.Y)("div",{className:"sticker-premium",children:(0,se.Y)(he.A,{name:"star"})}),Ce&&(0,se.Y)(X.A,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:le,iconName:"close"}),Boolean(ye.length)&&(0,se.Y)(Ze.A,{ref:R,isOpen:q,anchor:W,getTriggerElement:ne,getRootElement:ae,getMenuElement:oe,getLayout:re,className:"sticker-context-menu",autoClose:!0,withPortal:c,onClose:ee,onCloseAnimationEnd:te,children:ye})]})});var kr=i(93545),wr=i(95773);const Ir=(0,s.ph)(({reaction:e,availableReactions:t,isSelected:i,loadAndPlay:n,observeIntersection:a,sharedCanvasRef:r,sharedCanvasHqRef:c,forcePlayback:d,onClick:h,onContextMenu:m})=>{const u=(0,s.li)(),p="custom"===e.type,v=(0,s.Kr)(()=>t?.find(t=>(0,l.a0)(t.reaction,e)),[t,e]),g=v?.staticIcon?.thumbnail?.dataUri,A=v?.selectAnimation?.id,f=(0,Ar.A)(u,r),C=(0,q.A)(v?.selectAnimation?(0,l.mr)(v.selectAnimation,"full"):void 0,!A),{isContextMenuOpen:b,handleBeforeContextMenu:y,handleContextMenu:S,handleContextMenuClose:N,handleContextMenuHide:k}=(0,cn.A)(u,"paid"!==e.type,void 0,void 0,void 0,!0);(0,s.vJ)(()=>{b&&(m?.(e),N(),k())},[N,m,k,b,e]);const w="paid"===e.type?Da.w.StarReaction:C,I=(0,T.A)(()=>{h(e)}),P=(0,Mi.A)(C),Y=(0,ge.A)("AVrrYEbM",i&&"QkdO_lz1",!p&&"sticker-reaction");return(0,se.Y)("div",{ref:u,className:Y,onClick:I,title:v?.title,"data-sticker-id":p?e.documentId:void 0,onMouseDown:y,onContextMenu:S,children:p?(0,se.Y)(sn.A,{ref:u,documentId:e.documentId,size:o.g0Q,noPlay:!n,observeIntersectionForPlaying:a,sharedCanvasRef:r,sharedCanvasHqRef:c,withTranslucentThumb:!0,forceAlways:d}):(0,se.Y)(Ma.A,{tgsUrl:w,thumbDataUri:g,play:n,noLoop:!1,size:o.g0Q,isLowPriority:!0,className:P,sharedCanvas:r.current||void 0,sharedCanvasCoords:f,forceAlways:d})})});var Pr=i(38027);const Yr=(0,s.ph)((0,n.EK)(e=>{const t=e.collectibleEmojiStatuses?.statuses;return{collectibleStatuses:t}})(({stickerSet:e,loadAndPlay:t,index:i,idPrefix:a,isNearActive:r,favoriteStickers:d,availableReactions:h,isSavedMessages:m,isStatusPicker:u,isReactionPicker:p,isCurrentUserPremium:v,shouldHideHeader:g,withDefaultTopicIcon:A,selectedReactionIds:f,withDefaultStatusIcon:C,isChatEmojiSet:b,isChatStickerSet:y,isTranslucent:S,noContextMenus:N,forcePlayback:k,collectibleStatuses:w,observeIntersection:I,observeIntersectionForPlayingItems:P,observeIntersectionForShowingItems:F,onReactionSelect:M,onReactionContext:L,onStickerSelect:R,onStickerUnfave:x,onStickerFave:E,onStickerRemoveRecent:V,onDismiss:_})=>{const{clearRecentStickers:U,clearRecentCustomEmoji:O,clearRecentReactions:K,openPremiumModal:J,toggleStickerSet:G,loadStickers:j}=(0,n.ko)(),z=(0,s.li)(),H=(0,s.li)(),$=(0,s.li)(),q=(0,B.A)(),{width:W}=(0,Pe.A)(),[Q,Z,ee]=(0,D.A)(),{isMobile:te}=(0,Y.Ay)(),[ie,ne]=(0,s.J0)(()=>Fr(W)),ae=(0,hr.Vz)(z,I??F),oe=(0,Mi.A)(ae),re=r||ae,le=te?8:4,ce=te?8:10,de=te?8:4,me=e.id===o.sR2,ue=e.id===o.j1l,pe=e.id===o.tRH,ve=e.id===o.EPW,Ae=e.isEmoji,fe=!me&&(0,c.Q31)(e),Ce=(0,T.A)(()=>{p?K():Ae?O():U(),ee()}),be=(0,T.A)(()=>{fe&&!v?J({initialSection:"animated_emoji"}):G({stickerSetId:e.id})}),ye=(0,T.A)(()=>{R?.({mediaType:"sticker",id:o.MyF,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Se=(0,T.A)(()=>{R?.({mediaType:"sticker",id:o.zNY,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})}),Ne=Ae?o.g0Q:o.bkT,ke=Ae?ce:le,we=Ae?de:le,Ie=(0,T.A)(e=>e?Math.floor((e+ke)/(Ne+ke)):Fr(W)),Ye=(0,T.A)(e=>{ne(Ie(e.contentRect.width))});(0,kr.A)(z,Ye),(0,s.vJ)(()=>{z.current&&ne(Ie(z.current.clientWidth))},[Ie]),(0,s.vJ)(()=>{re&&!e.stickers?.length&&!e.reactions?.length&&e.accessHash&&j({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})},[re,j,e]);const Fe=!m&&!v&&fe&&!b,De=e.installedDate&&!e.isArchived,Me=!De&&e.id!==o.sR2&&e.id!==o.EPW&&e.id!==o.hfH&&e.id!==o.Kp3&&!b&&!y,[Te,,Be]=(0,D.A)(Me),Le=3*ie-1,Re=A||C?e.count+1:e.count,xe=Ne+we,Ee=Math.ceil(Math.min(Le,Re)/ie)*xe-we,Ve=Te?Ee:Math.ceil(Re/ie)*xe-we,_e=(0,s.Kr)(()=>d?new Set(d.map(({id:e})=>e)):void 0,[d]),Ue=(0,s.Kr)(()=>w?new Set(w.map(({documentId:e})=>e)):void 0,[w]),Oe=!g&&!me&&!ue&&Ae&&!ve&&!b&&(!De||!v&&!m),Ke=(0,s.Kr)(()=>q(Fe?De?"lng_emoji_premium_restore":"Unlock":"Add"),[Fe,q,De]);return(0,se.FD)("div",{ref:z,id:`${a}-${i}`,className:(0,ge.A)("symbol-set",Fe&&"symbol-set-locked"),children:[!g&&(0,se.FD)("div",{className:"symbol-set-header",children:[(0,se.FD)("p",{className:(0,ge.A)("symbol-set-title",Oe&&"symbol-set-title-external"),children:[Fe&&(0,se.Y)(he.A,{name:"lock-badge",className:"symbol-set-locked-icon"}),(0,se.Y)("span",{className:"symbol-set-name",children:e.title}),(b||y)&&(0,se.Y)("span",{className:"symbol-set-chat",children:q(b?"GroupEmoji":"GroupStickers")}),Oe&&Boolean(e.stickers)&&(0,se.Y)("span",{className:"symbol-set-amount",children:q(Ae?"EmojiCount":"Stickers",e.stickers.length,"i")})]}),me&&(0,se.Y)(he.A,{className:"symbol-set-remove",name:"close",onClick:Z}),Oe&&(0,se.Y)(X.A,{className:"symbol-set-add-button",withPremiumGradient:fe&&!v,onClick:be,pill:!0,size:"tiny",fluid:!0,children:Ke})]}),(0,se.FD)("div",{className:(0,ge.A)("symbol-set-container shared-canvas-container",oe,e.id===o.hfH&&"effect-emojis"),style:`height: ${Ve}px;`,children:[(0,se.Y)("canvas",{ref:H,className:"shared-canvas",style:Me?`height: ${Ee}px;`:void 0}),(me||pe||Me)&&(0,se.Y)("canvas",{ref:$,className:"shared-canvas"}),A&&(0,se.Y)(X.A,{className:"StickerButton custom-emoji",color:"translucent",onClick:ye,children:(0,se.Y)("img",{src:Pr,alt:"Reset",className:"sticker-media",draggable:!1})},"default-topic-icon"),C&&(0,se.Y)(X.A,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:Se,iconName:"star"},"default-status-icon"),re&&e.reactions?.map(i=>{const s=(0,l.Jj)(i),n=s?f?.includes(s):void 0;return(0,se.Y)(Ir,{reaction:i,isSelected:n,loadAndPlay:t,availableReactions:h,observeIntersection:P,onClick:M,onContextMenu:L,sharedCanvasRef:H,sharedCanvasHqRef:$,forcePlayback:k},`${e.id}_${s}`)}),re&&e.stickers?.slice(0,Te?Le:e.stickers.length).map((i,s)=>{const a=(me||pe)&&(0,c.CzR)((0,n.mS)(),i.stickerSetInfo),r=Me&&s>=Le||a?$:H,l=i.isCustomEmoji?i.id:i.emoji,d=l?f?.includes(l):void 0,h=e.id===o.j1l||Ue?.has(i.id),p=(0,se.Y)(Nr,{sticker:i,size:Ne,observeIntersection:P,observeIntersectionForShowing:F,noPlay:!t,isSavedMessages:m,isStatusPicker:u,canViewSet:!0,noContextMenu:N,isCurrentUserPremium:v,shouldIgnorePremium:b,sharedCanvasRef:r,withTranslucentThumb:S,onClick:R,clickArg:i,noIcons:Ae&&!me,isSelected:d,onUnfaveClick:pe&&_e?.has(i.id)?x:void 0,onFaveClick:_e?.has(i.id)?void 0:E,onRemoveRecentClick:me?V:void 0,onDismiss:_,forcePlayback:k,isEffectEmoji:e.id===o.hfH,noShowPremium:v&&(e.id===o.Kp3||e.id===o.hfH)},i.id);return h?(0,se.Y)(wr.A,{className:"gift-effect-wrapper",withSparkles:!0,children:p}):p}),Te&&Re>Le&&(0,se.FD)(X.A,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:Be,children:["+",Re-Le]},"more")]}),me&&(0,se.Y)(ai.A,{text:q(p?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:Q,onClose:ee,confirmHandler:Ce,confirmIsDestructive:!0})]},e.id)}));function Fr(e){return e>440?8:e<362?6:7}const Dr="p7c8y0LH",Mr="zTGriBHY",Tr="Qn3lBUNs",Br="HMspKpNp",Lr="YKO0Obwy",Rr="BZfaP1GD",xr=2.5*g.$,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,{chatId:t,isStatusPicker:i,isReactionPicker:s})=>{const{stickers:{setsById:n},customEmojis:{byId:a,featuredIds:o,statusRecent:{emojis:r}},recentCustomEmojis:l,reactions:{availableReactions:d,recentReactions:h,topReactions:m,defaultTags:u}}=e,p=Boolean(t&&(0,c.nZ4)(e,t)),v=t?(0,c.AWZ)(e,t):void 0,g=e.collectibleEmojiStatuses?.statuses;return{customEmojisById:a,recentCustomEmojiIds:i?void 0:l,recentStatusEmojis:i?r:void 0,collectibleStatuses:i?g:void 0,stickerSetsById:n,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,c.BWX)(e),isSavedMessages:p,isCurrentUserPremium:(0,c.g29)(e),customEmojiFeaturedIds:o,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:s?m:void 0,recentReactions:s?h:void 0,chatEmojiSetId:v?.emojiSet?.id,isWithPaidReaction:s&&v?.isPaidReactionAvailable,availableReactions:s?d:void 0,defaultTagReactions:s?u:void 0}})(({className:e,pickerListClassName:t,isHidden:i,loadAndPlay:a,addedCustomEmojiIds:r,customEmojisById:d,recentCustomEmojiIds:h,selectedReactionIds:u,recentStatusEmojis:p,collectibleStatuses:v,stickerSetsById:g,chatEmojiSetId:A,topReactions:f,recentReactions:C,availableReactions:b,idPrefix:y="custom-emoji-set",customEmojiFeaturedIds:S,canAnimate:N,isReactionPicker:k,isStatusPicker:w,isTranslucent:I,isSavedMessages:P,isCurrentUserPremium:F,withDefaultTopicIcons:D,defaultTopicIconsId:M,defaultStatusIconsId:L,defaultTagReactions:R,isWithPaidReaction:x,onCustomEmojiSelect:E,onReactionSelect:V,onReactionContext:_,onDismiss:U})=>{const O=(0,s.li)(),K=(0,s.li)(),J=(0,s.li)(),G=(0,s.li)(),{isMobile:j}=(0,Y.Ay)(),{handleScroll:z,isAtBeginning:H}=(0,rs.A)(),$=(0,s.Kr)(()=>w?p:Object.values((0,di._E)(d,h)),[d,w,h,p]),q=(0,s.Kr)(()=>{const e=v?.map(e=>e.documentId);return d&&e?.map(e=>d[e]).filter(Boolean)},[d,v]),W=`${y}-custom-emoji`,{activeSetIndex:Q,observeIntersectionForSet:Z,observeIntersectionForPlayingItems:ee,observeIntersectionForShowingItems:te,observeIntersectionForCovers:ie,selectStickerSet:ne}=pr(O,K,W,i),ae=(0,Ui.A)(a||void 0,o.jhd),re=(0,B.A)(),le=(0,Fi.A)(),ce=Boolean(r),de=(0,s.Kr)(()=>{const e=[];if(k&&P&&R?.length&&e.push({id:o.G3A,accessHash:"",title:re("PremiumPreviewTags"),reactions:R,count:R.length,isEmoji:!0}),k&&!P){const t=f?.slice(0,16)||[];x&&t.unshift({type:"paid"}),t?.length&&e.push({id:o.G3A,accessHash:"",title:re("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=(b||[]).filter(({isInactive:e})=>!e).map(({reaction:e})=>e).filter(e=>!t.some(t=>(0,l.a0)(t,e))&&!i.some(t=>(0,l.a0)(t,e)));if(s?.length||i?.length){const t=!i?.length,n=i.concat(s);e.push({id:t?o.EPW:o.sR2,accessHash:"",title:re(t?"PopularReactions":"RecentStickers"),reactions:n,count:n.length,isEmoji:!0})}}else if(w){const t=g[L];if(t?.stickers?.length){const i=(0,di.Xd)(t.stickers.slice(0,7).concat($||[]),"id");e.push({...t,stickers:i,count:i.length,id:o.sR2,title:re("RecentStickers"),isEmoji:!0})}q?.length&&e.push({id:o.j1l,accessHash:"",count:q.length,stickers:q,title:le("CollectibleStatusesCategory"),isEmoji:!0})}else if(D){const t=g[M];t.stickers?.length&&e.push({...t,id:o.sR2,title:re("RecentStickers")})}else $?.length&&e.push({id:o.sR2,accessHash:"0",title:re("RecentStickers"),stickers:$,count:$.length,isEmoji:!0});const t=[...r||[]];A&&t.unshift(A);const i=(0,di.Am)(t.concat(S||[])),s=Object.values((0,di._E)(g,i));return[...e,...s]},[r,k,w,D,$,S,g,f,b,re,C,L,M,P,R,A,x,q,le]),me=(0,s.Kr)(()=>ce&&0===de.filter(e=>e.stickers?.length).length,[de,ce]),ue=(0,cr.A)([],o.jhd),pe=ce&&ue&&!me;(0,Ks.A)(K,j||!pe),(0,s.vJ)(()=>{if(!ce)return;const e=K.current;if(!e)return;const t=Q*xr-(e.offsetWidth/2-xr/2);(0,ya.A)(e,t)},[ce,Q]);const ve=(0,T.A)(e=>{E(e)}),Ae=(0,ge.A)("StickerPicker","Qk9PEGRE",e),fe=(0,ge.A)(Tr,"no-scrollbar",!H&&Br),Ce=(0,ge.A)(Dr,"U0BL1VvK",m.TF?"no-scrollbar":"custom-scroll",t,Mr),be=!pe&&!me;return(0,se.Y)(oe.Ay,{className:Ae,name:"fade",activeKey:be?0:1,shouldCleanup:!0,children:pe||me?!pe&&me?(0,se.Y)("div",{className:Rr,children:re("NoStickers")}):(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{ref:K,className:fe,children:(0,se.FD)("div",{className:"shared-canvas-container",children:[(0,se.Y)("canvas",{ref:J,className:"shared-canvas"}),(0,se.Y)("canvas",{ref:G,className:"shared-canvas"}),de.map(function(e,t){const i=e.stickers?.[0],s=(0,ge.A)(Lr,t===Q&&"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,se.Y)(X.A,{className:s,ariaLabel:e.title,round:!0,faded:n,color:"translucent",onClick:()=>ne(i?0:t),children:i?(0,se.Y)(he.A,{name:"recent"}):(0,se.Y)(Cr,{stickerSet:e,noPlay:!N||!ae,forcePlayback:!0,observeIntersection:ie,sharedCanvasRef:a?r?G:J:void 0})},e.id)}return(0,se.Y)(Nr,{sticker:i,size:o.TBj,title:e.title,className:s,noPlay:!N||!ae,observeIntersection:ie,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?r?G:J:void 0,withTranslucentThumb:I,onClick:ne,clickArg:t,forcePlayback:!0},e.id)}})]})}),(0,se.Y)("div",{ref:O,onScroll:z,className:Ce,children:de.map((e,t)=>{const i=e.id===o.G3A||e.id===o.sR2&&(D||w),s=e.id===A;return(0,se.Y)(Yr,{stickerSet:e,loadAndPlay:Boolean(N&&ae),index:t,idPrefix:W,observeIntersection:Z,observeIntersectionForPlayingItems:ee,observeIntersectionForShowingItems:te,isNearActive:Q>=t-1&&Q<=t+1,isSavedMessages:P,isStatusPicker:w,isReactionPicker:k,shouldHideHeader:i,withDefaultTopicIcon:D&&e.id===o.sR2,withDefaultStatusIcon:w&&e.id===o.sR2,isChatEmojiSet:s,isCurrentUserPremium:F,selectedReactionIds:u,availableReactions:b,isTranslucent:I,onReactionSelect:V,onReactionContext:_,onStickerSelect:ve,onDismiss:U,forcePlayback:!0},e.id)})})]}):(0,se.Y)(Ls.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)}))(({isOpen:e,statusButtonRef:t,areFeaturedStickersLoaded:i,isTranslucent:a,onEmojiStatusSelect:o,onClose:r})=>{const{loadFeaturedEmojiStickers:l}=(0,n.ko)(),c=(0,s.li)(0);(0,s.vJ)(()=>{c.current=t.current.getBoundingClientRect().right},[e,t]),(0,s.vJ)(()=>{e&&!i&&l()},[i,e,l]);const d=(0,s.hb)(e=>{o(e),r()},[r,o]);return(0,se.Y)(Ur.A,{children:(0,se.Y)(Ze.A,{isOpen:e,noCompact:!0,positionX:"left",bubbleClassName:"hRzvfaRb",onClose:r,transformOriginX:c.current,children:(0,se.Y)(_r,{idPrefix:"status-emoji-set-",loadAndPlay:e,isHidden:!e,isStatusPicker:!0,isTranslucent:a,onDismiss:r,onCustomEmojiSelect:d})})})})),Kr=6*g.$,Jr=(0,s.ph)((0,n.EK)((e,{modal:t})=>({currentUser:(0,c.mBe)(e,e.currentUserId),bot:t?.botId?(0,c.mBe)(e,t.botId):void 0}))(({modal:e,currentUser:t,bot:i})=>{const{setEmojiStatus:a,closeSuggestedStatusModal:o,sendWebAppEvent:r}=(0,n.ko)(),c=(0,Fi.A)(),d=Boolean(e),h=(0,Si.A)(e),m=(0,s.Kr)(()=>{if(t&&h)return{...t,emojiStatus:{type:"regular",documentId:h.customEmojiId}}},[t,h]),u=(0,s.Kr)(()=>{if(!h||!i)return;const e=(0,l.Yg)(i);return h.duration?c("BotSuggestedStatusFor",{bot:e,duration:(0,We.A$)(c,h.duration)},{withNodes:!0,withMarkdown:!0}):c("BotSuggestedStatus",{bot:e},{withNodes:!0,withMarkdown:!0})},[i,c,h]),p=(0,T.A)(()=>{const e=h?.webAppKey;e&&r({webAppKey:e,event:{eventType:"emoji_status_failed",eventData:{error:"USER_DECLINED"}}}),o()}),v=(0,T.A)(()=>{if(!h)return;const e=h.duration?(0,Ii.Fm)()+h.duration:void 0;a({referrerWebAppKey:h.webAppKey,emojiStatus:{type:"regular",documentId:h.customEmojiId,until:e}}),o()});return(0,se.FD)(te.A,{isOpen:d,contentClassName:"C9sWDINB",hasAbsoluteCloseButton:!0,isSlim:!0,onClose:p,children:[h&&(0,se.Y)(sn.A,{className:"gdG3oY21",documentId:h.customEmojiId,size:Kr,loopLimit:1,forceAlways:!0}),(0,se.FD)("div",{children:[(0,se.Y)("h3",{className:"KVpsce1g",children:c("BotSuggestedStatusTitle")}),(0,se.Y)("p",{className:"p7S4AH8A",children:u})]}),m&&(0,se.Y)(Ps.A,{mockPeer:m,withEmojiStatus:!0}),(0,se.Y)(X.A,{onClick:v,children:c("GeneralConfirm")})]})}));var Gr=i(55317),jr=i(20333);const zr="j6xEoljc";function Hr(e,t){return e.find(e=>!e.chatId)||e.filter(e=>t&&e.chatId!==t).sort((e,t)=>e.date-t.date)[0]}const $r=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t&&(0,c.hds)(e,t?.chatId),s=i&&(0,c.AWZ)(e,i.id),n=t?.myBoosts&&Hr(t.myBoosts,t.chatId);return{chat:i,chatFullInfo:s,prevBoostedChat:n?.chatId?(0,c.hds)(e,n?.chatId):void 0,isCurrentUserPremium:(0,c.g29)(e)}})(({modal:e,chat:t,chatFullInfo:i,prevBoostedChat:a,isCurrentUserPremium:o})=>{const{applyBoost:r,closeBoostModal:c,requestConfetti:d,openPremiumModal:h,loadFullChat:m}=(0,n.ko)(),[u,p,v]=(0,D.A)(),[g,A,f]=(0,D.A)(),[C,b,y]=(0,D.A)(),S=t&&(0,l.WX)(t),N=Boolean(e),k=(0,B.A)(),w=(0,Fi.A)();(0,s.vJ)(()=>{t&&!i&&m({chatId:t.id})},[t,i]);const I=(0,s.Kr)(()=>{if(t)return(0,l.Js)(k,t)},[t,k]),P=(0,s.Kr)(()=>{if(a)return(0,l.Js)(k,a)},[a,k]),{isStatusLoaded:Y,isBoosted:F,boost:M,title:L,leftText:R,rightText:x,value:E,progress:V,descriptionText:_,canBoostMore:U}=(0,s.Kr)(()=>{if(!e?.boostStatus||!t)return{isStatusLoaded:!1,title:k("Loading")};const{hasMyBoost:s}=e.boostStatus,n=e?.myBoosts&&Hr(e.myBoosts,t.id),a=e?.myBoosts&&(o=e.myBoosts,r=t.id,!o.every(e=>e.chatId===r));var o,r;const{boosts:c,currentLevel:d,hasNextLevel:h,levelProgress:m,remainingBoosts:u,isMaxLevel:p}=(0,Gr.z)(e.boostStatus,!0),v=s,g=k("BoostsLevel",d),A=h?k("BoostsLevel",d+1):void 0,f=k("ChannelBoost.MoreBoosts",u),C=k(S?"BoostChannel":"BoostGroup"),b=(i?.boostsToUnrestrict||0)-(i?.boostsApplied||0);let y;if(p)y=k("BoostsMaxLevelReached");else if(b>0&&!(0,l.SJ)(t)){const e=k("GroupBoost.BoostToUnrestrict.Times",b);y=k("GroupBoost.BoostToUnrestrict",[e,I])}else y=k("ChannelBoost.MoreBoostsNeeded.Text",[I,f]);return{isStatusLoaded:!0,title:C,leftText:g,rightText:A,value:c.toString(),progress:m,remainingBoosts:u,descriptionText:y,boost:n,isBoosted:v,canBoostMore:a&&!p}},[t,I,e,k,i,S]),O=!e?.myBoosts?.length&&o,K=M?.chatId&&M.chatId!==e?.chatId,J=(0,T.A)(()=>{v(),r({chatId:t.id,slots:[M.slot]}),d({})}),G=(0,T.A)(()=>{h(),y(),c()}),j=(0,T.A)(()=>{if(!M)return o?void c():void b();U?M.cooldownUntil?A():K?p():J():c()}),z=(0,T.A)(()=>{c()});return(0,se.FD)(te.A,{isOpen:N,title:L,className:"IK2mBqbm",contentClassName:"pUyNTysT",onClose:c,children:[Y?(0,se.FD)(se.FK,{children:[(0,se.Y)(jr.A,{leftText:R,rightText:x,progress:V,floatingBadgeText:E,floatingBadgeIcon:"boost"}),F&&(0,se.Y)("div",{className:(0,ge.A)(zr,"hAA6B1lc"),children:k("ChannelBoost.YouBoostedChannelText",I)}),(0,se.Y)("div",{className:zr,children:(0,Pt.A)(_,["simple_markdown","emoji"])}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",disabled:O,onClick:j,children:U?(0,se.FD)(se.FK,{children:[(0,se.Y)(he.A,{name:"boost"}),k(S?"ChannelBoost.BoostChannel":"GroupBoost.BoostGroup")]}):k("OK")}),(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:z,children:k("Cancel")})]})]}):(0,se.Y)(Ls.A,{className:"zjXCH3pT"}),K&&P&&(0,se.FD)(te.A,{isOpen:u,className:"GIFAjZPY",contentClassName:"Jxyz9TaL",onClose:v,children:[(0,se.FD)("div",{className:"OKp6HS1U",children:[(0,se.FD)("div",{className:"NU9itcIm",children:[(0,se.Y)(Yt.A,{peer:a,size:"large"}),(0,se.Y)(he.A,{name:"boostcircle",className:"upXvhNRY"})]}),(0,se.Y)(he.A,{name:"next",className:"WSJdWV7L"}),(0,se.Y)(Yt.A,{peer:t,size:"large"})]}),(0,se.Y)("div",{children:(0,Pt.A)(k("ChannelBoost.ReplaceBoost",[P,I]),["simple_markdown","emoji"])}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:J,children:k("Replace")}),(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:v,children:k("Cancel")})]})]}),Boolean(M?.cooldownUntil)&&(0,se.Y)(ai.A,{isOpen:g,isOnlyConfirm:!0,confirmLabel:k("OK"),title:k("ChannelBoost.Error.BoostTooOftenTitle"),onClose:f,confirmHandler:f,children:(0,Pt.A)(k("ChannelBoost.Error.BoostTooOftenText",(0,We.A$)(w,M.cooldownUntil-(0,Ii.Fm)())),["simple_markdown","emoji"])}),!o&&(0,se.Y)(ai.A,{isOpen:C,confirmLabel:k("Common.Yes"),title:k("PremiumNeeded"),onClose:y,confirmHandler:G,children:(0,Pt.A)(k("PremiumNeededForBoosting"),["simple_markdown","emoji"])})]})}));var qr=i(47058),Wr=i(70046);const Qr="xVLGjLub",Zr=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{message:i}=t||{},s=i&&(0,c.O5q)(e,i.chatId,i.messageId),n=s&&(0,c.Y7C)(e,s);return{currentUserId:e.currentUserId,messageSender:n}})(({currentUserId:e,modal:t,messageSender:i})=>{const{closeGiftCodeModal:a,applyGiftCode:r,focusMessage:l}=(0,n.ko)(),c=(0,Fi.A)(),d=(0,B.A)(),h=Boolean(t),m=!(t?.info.toId&&t?.info.toId!==e||t?.info.usedAt),u=(0,T.A)(()=>{t&&t.info.giveawayMessageId&&(l({chatId:t.info.fromId,messageId:t.info.giveawayMessageId}),a())}),p=(0,T.A)(()=>{m?r({slug:t.slug}):a()}),v=(0,s.Kr)(()=>{if(!t)return;const{slug:e,info:s}=t,n=s.fromId||i?.id,a=(0,se.FD)(se.FK,{children:[(0,se.Y)("img",{src:er,alt:"",className:"Mtx4SWww"}),(0,se.Y)("p",{className:Qr,children:(0,Pt.A)(d("lng_gift_link_about"),["simple_markdown"])}),(0,se.Y)(qr.A,{title:"BoostingGiftLink",link:`${o.jsp}/giftcode/${e}`})]}),r=[[d("BoostingFrom"),n?{chatId:n}:d("BoostingNoRecipient")],[d("BoostingTo"),s.toId?{chatId:s.toId}:d("BoostingNoRecipient")],[d("BoostingGift"),d("BoostingTelegramPremiumFor",(0,We.w6)(c,s.days))]];return s.isFromGiveaway&&r.push([d("BoostingReason"),(0,se.Y)("span",{className:(0,ge.A)(s.giveawayMessageId&&"IzcASdzD"),onClick:u,children:s.isFromGiveaway&&!s.toId?d("BoostingIncompleteGiveaway"):d("BoostingGiveaway")})]),r.push([d("BoostingDate"),(0,We.L2)(1e3*s.date,d.code,!0)]),{header:a,tableData:r,footer:(0,se.Y)("span",{className:Qr,children:(0,Pt.A)(s.usedAt?d("BoostingUsedLinkDate",(0,We.L2)(1e3*s.usedAt,d.code,!0)):d("BoostingSendLinkToAnyone"),["simple_markdown"])})}},[c,d,i?.id,t]);if(v)return(0,se.Y)(Wr.A,{isOpen:h,title:d("lng_gift_link_title"),tableData:v.tableData,header:v.header,footer:v.footer,buttonText:d(m?"BoostingUseLink":"Close"),onButtonClick:p,onClose:a})}));function Xr(e,t){return e.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)}const el=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{selfDestructAccountDays:i}=t||{};return{selfDestructAccountDays:i}})(({modal:e,selfDestructAccountDays:t})=>{const{closeGiftCodeModal:i,closeDeleteAccountModal:a,setAccountTTL:r}=(0,n.ko)(),l=(0,Fi.A)(),c=Boolean(e),[d,h]=(0,s.J0)(),m=(0,T.A)(e=>30*Number(e)),u=(0,s.Kr)(()=>{if(t)return Xr(o.WF4,t/30).toString()},[t]);(0,s.vJ)(()=>{u&&h(u)},[u]);const p=(0,s.Kr)(()=>o.WF4.map(e=>({value:String(e),label:l("Months",{count:e},{pluralValue:1})})),[l]),v=(0,T.A)(e=>{h(e)}),g=(0,T.A)(()=>{d&&r({days:m(d)})}),A=(0,T.A)(()=>{a()});return(0,se.FD)(te.A,{isOpen:c,title:l("SelfDestructTitle"),onClose:i,className:"X6K5oA8U",children:[(0,se.Y)("p",{children:l("SelfDestructSessionsDescription")}),(0,se.Y)(ie.A,{className:"dialog-checkbox-group",name:"quick-reaction-settings",options:p,selected:d,onChange:v,withIcon:!0}),(0,se.FD)("div",{className:"dialog-buttons mt-2",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:g,children:l("Save")}),(0,se.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:A,children:l("Cancel")})]})]})})),tl={root:"OviJR58x",content:"BlpqzGYt",header:"b9RUzfpF",iconWrapper:"l1X5kBUM",icon:"qOoRnv_Y",mainText:"s2SOQSml",description:"wiKBjcl2"},il=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig;return{verifyAgeBotUsername:t.verifyAgeBotUsername,verifyAgeMin:t.verifyAgeMin||o.lYi}})(({modal:e,verifyAgeBotUsername:t,verifyAgeMin:i})=>{const{closeAgeVerificationModal:s,openChatByUsername:a}=(0,n.ko)(),o=(0,Fi.A)(),r=Boolean(e),l=(0,T.A)(()=>{t&&a({shouldStartMainApp:!0,username:t}),s()}),c=(0,T.A)(()=>{s()});return(0,se.FD)(te.A,{isOpen:r,onClose:c,className:tl.root,children:[(0,se.FD)("div",{className:tl.content,children:[(0,se.Y)("div",{className:tl.header,children:(0,se.Y)("div",{className:tl.iconWrapper,children:(0,se.Y)(he.A,{name:"user",className:tl.icon})})}),(0,se.Y)("h2",{className:tl.title,children:o("TitleAgeVerificationModal")}),(0,se.Y)("p",{className:tl.mainText,children:o("TextAgeVerificationModal",{count:i},{withMarkdown:!0,withNodes:!0,pluralValue:i})}),(0,se.Y)("p",{className:tl.description,children:o("DescriptionAgeVerificationModal")})]}),(0,se.Y)("div",{className:"dialog-buttons mt-2",children:(0,se.Y)(X.A,{onClick:l,children:o("ButtonAgeVerification")})})]})}));var sl=i(34132),nl=i(24713);const al={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"},ol=(0,s.ph)(({invite:e,folder:t})=>{const{closeChatlistModal:i,joinChatlistInvite:a}=(0,n.ko)(),o=(0,Fi.A)(),r=(0,B.A)(),[l,c]=(0,s.J0)(e.missingPeerIds),d=Boolean(e.missingPeerIds.length),h=0===e.alreadyPeerIds.length,m=d?e.missingPeerIds.length:0,u=l.length?l.length.toString():void 0,p=h?o("FolderLinkSubtitleNew"):m?o("FolderLinkSubtitleAdd",{chats:o("FolderLinkSubtitleAddCount",{count:m},{pluralValue:m}),title:(0,Oi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})},{withNodes:!0,withMarkdown:!0}):o("FolderLinkSubtitleAlready"),v=(0,s.hb)(()=>{i(),l.length&&a({invite:e,peerIds:l})},[e,l]),g=(0,s.hb)(()=>{const t=l.length===e.missingPeerIds.length;c(t?[]:e.missingPeerIds)},[e.missingPeerIds,l.length]);return(0,se.FD)("div",{className:al.content,children:[(0,se.Y)("div",{className:al.description,children:(0,Pt.A)(p,["simple_markdown","emoji"])}),(0,se.FD)("div",{className:(0,ge.A)(al.pickerWrapper,"custom-scroll"),children:[Boolean(e.missingPeerIds.length)&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:al.pickerHeader,children:[(0,se.Y)("div",{className:al.pickerHeaderInfo,children:r("FolderLinkHeaderChatsJoin",l.length,"i")}),(0,se.Y)("div",{className:al.selectionToggle,role:"button",tabIndex:0,onClick:g,children:l.length===e.missingPeerIds.length?r("DeselectAll"):r("SelectAll")})]}),(0,se.Y)(mi.A,{itemIds:e.missingPeerIds,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,se.Y)("div",{className:al.pickerHeader,children:(0,se.Y)("div",{className:al.pickerHeaderInfo,children:r("FolderLinkHeaderAlready")})}),(0,se.Y)(mi.A,{itemIds:e.alreadyPeerIds,lockedSelectedIds:e.alreadyPeerIds,selectedIds:e.alreadyPeerIds,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,se.Y)(X.A,{onClick:v,children:(0,se.FD)("div",{className:al.buttonText,children:[!l.length&&r("OK"),Boolean(l.length)&&(0,se.FD)(se.FK,{children:[r("FolderLinkButtonJoinPlural",l.length,"i"),(0,se.Y)(nl.A,{className:al.buttonBadge,text:u,isAlternateColor:!0})]})]})})]})}),rl=(0,s.ph)(({folder:e,suggestedPeerIds:t=hi.p})=>{const{closeChatlistModal:i,leaveChatlist:a}=(0,n.ko)(),o=(0,B.A)(),[r,l]=(0,s.J0)([]),c=r.length?r.length.toString():void 0,d=(0,s.hb)(()=>{const e=r.length===t.length;l(e?[]:t)},[t,r.length]),h=(0,s.hb)(()=>{i(),a({folderId:e.id,peerIds:r})},[e.id,r]);return(0,se.FD)("div",{className:al.content,children:[Boolean(t?.length)&&(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:al.description,children:(0,Pt.A)(o("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])}),(0,se.FD)("div",{className:(0,ge.A)(al.pickerWrapper,"custom-scroll"),children:[(0,se.FD)("div",{className:al.pickerHeader,children:[(0,se.Y)("div",{className:al.pickerHeaderInfo,children:o("FolderLinkHeaderChatsQuit",r.length,"i")}),(0,se.Y)("div",{className:al.selectionToggle,role:"button",tabIndex:0,onClick:d,children:r.length===t.length?o("DeselectAll"):o("SelectAll")})]}),(0,se.Y)(mi.A,{itemIds:t,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]})]}),(0,se.Y)(X.A,{onClick:h,children:(0,se.FD)("div",{className:al.buttonText,children:[!r.length&&o("FolderLinkButtonRemove"),Boolean(r.length)&&(0,se.FD)(se.FK,{children:[o("FolderLinkButtonRemoveChats"),(0,se.Y)(nl.A,{className:al.buttonBadge,text:c,isAlternateColor:!0})]})]})})]})}),ll=(0,s.ph)(({invite:e})=>{const{closeChatlistModal:t,joinChatlistInvite:i}=(0,n.ko)(),a=(0,Fi.A)(),o=(0,B.A)(),[r,l]=(0,s.J0)(e.peerIds),c=(0,s.Kr)(()=>{const t=(0,n.mS)().chats.byId;return e.peerIds.filter(e=>!t[e].isNotJoined)},[e.peerIds]),d=r.length-c.length,h=d?d.toString():void 0,m=(0,s.hb)(()=>{t(),i({invite:e,peerIds:r})},[e,r]),u=(0,s.hb)(()=>{const t=r.length===e.peerIds.length;l(t?c:e.peerIds)},[e.peerIds,c,r.length]);return(0,se.FD)("div",{className:al.content,children:[(0,se.Y)("div",{className:al.description,children:a("FolderLinkSubtitleNew")}),(0,se.FD)("div",{className:(0,ge.A)(al.pickerWrapper,"custom-scroll"),children:[(0,se.FD)("div",{className:al.pickerHeader,children:[(0,se.Y)("div",{className:al.pickerHeaderInfo,children:o("FolderLinkHeaderChatsJoin",d,"i")}),(0,se.Y)("div",{className:al.selectionToggle,role:"button",tabIndex:0,onClick:u,children:r.length===e.peerIds.length?o("DeselectAll"):o("SelectAll")})]}),(0,se.Y)(mi.A,{itemIds:e.peerIds,lockedSelectedIds:c,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,se.Y)(X.A,{onClick:m,disabled:!r.length,children:(0,se.FD)("div",{className:al.buttonText,children:[a("FolderLinkAddFolder"),(0,se.Y)(nl.A,{className:al.buttonBadge,text:h,isAlternateColor:!0})]})})]})}),cl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{invite:i,removal:s}=t||{},n=s?.folderId||(i&&"folderId"in i?i.folderId:void 0);return{folder:n?(0,c.$aQ)(e,n):void 0}})(({modal:e,folder:t})=>{const{closeChatlistModal:i}=(0,n.ko)(),a=(0,B.A)(),o=Boolean(e),r=(0,K.A)(e)||e,l=(0,K.A)(t)||t,c=(0,s.Kr)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?a("FolderLinkTitleAddChats"):a("FolderLinkTitleAlready"):a("FolderLinkTitleAdd")}return r.removal?a("FolderLinkTitleRemove"):void 0}},[a,r]),d=(0,s.Kr)(()=>l?(0,Oi.fd)({text:l.title.text,entities:l.title.entities,noCustomEmojiPlayback:l.noTitleAnimations}):r?.invite&&"title"in r.invite?(0,Oi.fd)({text:r.invite.title.text,entities:r.invite.title.entities,noCustomEmojiPlayback:r.invite.noTitleAnimations}):void 0,[l,r]),h=(0,s.Kr)(()=>{if(r?.invite)return"missingPeerIds"in r.invite?r.invite.missingPeerIds.length:void 0},[r]),m=(0,s.hb)(()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?(0,se.Y)(ol,{invite:e,folder:l}):(0,se.Y)(ll,{invite:e})}return r.removal?(0,se.Y)(rl,{folder:l,suggestedPeerIds:r.removal.suggestedPeerIds}):void 0}},[l,r]);return(0,se.FD)(te.A,{isOpen:o,title:c,onClose:i,isSlim:!0,hasCloseButton:!0,children:[d&&(u=d,(0,se.Y)("div",{className:al.foldersWrapper,children:(0,se.FD)("div",{className:al.folders,children:[(0,se.Y)(sl.A,{className:al.folder,title:a("FolderLinkPreviewLeft")}),(0,se.Y)(sl.A,{className:al.folder,isActive:!0,badgeCount:h,isBadgeActive:!0,title:u}),(0,se.Y)(sl.A,{className:al.folder,title:a("FolderLinkPreviewRight")})]})})),m()]});var u})),dl={content:"MZ0RCecx",title:"ar8XeydN",participantCount:"un00TXYY",participants:"YvkZ6c2D",participant:"DHJSBDeE",buttons:"KFtrPtNr"},hl=(0,s.ph)(({modal:e})=>{const{acceptChatInvite:t,closeChatInviteModal:i,showNotification:a}=(0,n.ko)(),o=(0,s.li)(),r=(0,B.A)(),d=(0,O.A)(e),{hash:h,inviteInfo:m}=e||d||{},{about:u,isBroadcast:p,participantIds:v,participantsCount:g,photo:A,isRequestNeeded:f}=m||{},C=(0,T.A)(()=>{i()}),b=(0,T.A)(()=>{t({hash:h}),f&&a({message:r(p?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),C()}),y=p?"ProfileJoinChannel":"JoinGroup",S=p?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup",N=(0,s.Kr)(()=>{if(m)return(0,l.nr)(m)},[m]),k=(0,s.Kr)(()=>{if(!v)return;const e=(0,n.mS)();return v.map(t=>(0,c.mBe)(e,t)).filter(Boolean)},[v]);return(0,Ks.A)(o,!e||!k),(0,se.FD)(te.A,{isOpen:Boolean(e),contentClassName:dl.content,isSlim:!0,onClose:C,onEnter:b,children:[N&&(0,se.Y)(Yt.A,{size:"jumbo",photo:A,peer:N,withVideo:!0}),N&&(0,se.Y)(Rs.A,{className:dl.title,peer:N}),u&&(0,se.Y)("p",{className:dl.about,children:u}),(0,se.Y)("p",{className:dl.participantCount,children:r(p?"Subscribers":"Members",g,"i")}),k&&(0,se.Y)("div",{ref:o,className:(0,ge.A)(dl.participants,"no-scrollbar"),children:k.map(e=>(0,se.Y)(Mn.A,{className:dl.participant,peer:e,text:(0,l.Yg)(e)}))}),(0,se.FD)("div",{className:(0,ge.A)("dialog-buttons",dl.buttons),children:[(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:b,children:r(f?S:y)}),(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:C,children:r("Cancel")})]})]})});var ml=i(5463);const ul=(0,s.ph)(({modal:e})=>{const{closePasskeyModal:t,startPasskeyRegistration:i}=(0,n.ko)(),a=(0,Fi.A)(),o=(0,T.A)(()=>{t()}),r=(0,T.A)(()=>{i(),o()}),l=(0,s.Kr)(()=>({header:(0,se.FD)("div",{className:"flex-column-centered",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Passkeys,previewUrl:Da.d.Passkeys,size:120}),(0,se.Y)("h3",{className:"vi6YQWX0",children:a("PasskeyModalTitle")}),(0,se.Y)("p",{children:a("PasskeyModalDescription")})]}),listItemData:[["key",a("PasskeyModalFeature1Title"),a("PasskeyModalFeature1Description")],["animals",a("PasskeyModalFeature2Title"),a("PasskeyModalFeature2Description")],["lock",a("PasskeyModalFeature3Title"),a("PasskeyModalFeature3Description")]]}),[a]);return(0,se.Y)(ml.A,{isOpen:Boolean(e),listItemData:l.listItemData,header:l.header,buttonText:a("PasskeyModalButtonText"),onButtonClick:r,onClose:o})}),pl="kiV5YwpR",vl=(new Date).getFullYear(),gl=vl-150,Al=Array.from({length:12},(e,t)=>t+1),fl=(e,t)=>e?2===e?t&&(t%4!=0||t%100==0&&t%400!=0)?28:29:4===e||6===e||9===e||11===e?30:31:31,Cl=(0,s.ph)(({modal:e})=>{const{closeBirthdaySetupModal:t,openSettingsScreen:i,updateBirthday:o}=(0,n.ko)(),{currentBirthday:r}=e||{},l=(0,s.li)(),[c,d]=(0,s.J0)(r?.day),[h,m]=(0,s.J0)(r?.month),[u,p]=(0,s.J0)(r?.year),v=(0,Fi.A)(),g=(0,T.A)(()=>{t()}),A=(0,T.A)(()=>{o({birthday:void 0}),t()}),f=(0,T.A)(()=>{i({screen:a.VS.PrivacyBirthday}),t()}),C=fl(h,u),b=(0,T.A)(e=>{if(!e.target.value)return void d(void 0);const t=Number(e.target.value.replace(/[^\d]+/g,""));t?d(t>C?C:Math.max(t,1)):e.preventDefault()}),y=(0,T.A)(e=>{m(e),c&&d(Math.min(c,fl(e,u)))}),S=(0,T.A)(e=>{if(!e.target.value)return void p(void 0);const t=Number(e.target.value.replace(/[^\d]+/g,""));t?t>vl?p(vl):(p(t),c&&d(Math.min(c,fl(h,t)))):e.preventDefault()}),N=(0,T.A)(()=>{u?u<100?p(1900+u):u<gl&&p(gl):p(void 0)}),k=(0,T.A)(()=>{c&&h&&(o({birthday:{day:c,month:h,year:u}}),t())}),w=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(ee.A,{label:v("BirthdayInputMonth"),className:(0,ge.A)(pl,"xSFFwTx2",t&&"active"),value:h?v(`Month${h}`):"",onClick:e,inputMode:"numeric",teactExperimentControlled:!0}),[v,h]);return(0,se.FD)(te.A,{isOpen:Boolean(e),hasCloseButton:!0,hasAbsoluteCloseButton:!0,isSlim:!0,dialogRef:l,contentClassName:"W0kySiJ6",onClose:g,children:[(0,se.FD)("div",{className:"PpcrztHS",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.DuckCake,size:120,className:"section-icon"}),(0,se.Y)("h3",{className:"lMKiFLTe",children:v("BirthdaySetupTitle")})]}),(0,se.FD)("div",{className:"sje6F_wI",children:[(0,se.Y)(ee.A,{label:v("BirthdayInputDay"),className:pl,value:c?.toString(),onChange:b,maxLength:2,inputMode:"numeric"}),(0,se.Y)(me.A,{className:(0,ge.A)("OMO_wq8N","with-menu-transitions"),bubbleClassName:"JcsMNM0K",autoClose:!0,positionY:"bottom",trigger:w,children:Al.map(e=>(0,se.Y)(ue.A,{onClick:()=>y(e),children:v(`Month${e}`)},e))}),(0,se.Y)(ee.A,{label:v("BirthdayInputYear"),className:pl,value:u?.toString(),onBlur:N,onChange:S,maxLength:4,inputMode:"numeric"})]}),(0,se.FD)("div",{className:"mkIotrno",children:[(0,se.Y)("span",{className:"INQVqP2z",children:v("BirthdayPrivacySuggestion",{link:(0,se.Y)(Mo.A,{isPrimary:!0,onClick:f,children:v("BirthdayPrivacySuggestionLink",void 0,{withNodes:!0,specialReplacement:(0,wi.dE)()})})},{withNodes:!0})}),r&&(0,se.Y)(X.A,{isText:!0,onClick:A,children:v("BirthdayRemove")}),(0,se.Y)(X.A,{disabled:!c||!h,onClick:k,children:v("Save")})]})]})});var bl=i(89873);const yl="La4sUYaq",Sl="Bn5kz5br",Nl=(0,s.ph)((0,n.EK)(e=>({minLevelToRestrictAds:e.appConfig.channelRestrictAdsLevelMin}))(({modal:e,minLevelToRestrictAds:t})=>{const{closeAboutAdsModal:i}=(0,n.ko)(),a=(0,s.li)(),o=Boolean(e),r=(0,Si.A)(e),{canReport:l,randomId:c,additionalInfo:d,sponsorInfo:h}=r||{},m=l,u=(0,Si.A)(m),p=(0,B.A)(),v=(0,s.Kr)(()=>(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{children:p("SponsoredMessageInfoScreen.Title")}),(0,se.Y)("p",{children:(0,Pt.A)(p("SponsoredMessageInfoDescription1"),["br"])}),(0,se.Y)("p",{children:(0,Pt.A)(p("SponsoredMessageInfoDescription2"),["br"])}),(0,se.Y)("p",{children:(0,Pt.A)(p("SponsoredMessageInfoDescription3"),["br"])}),(0,se.Y)("p",{children:(0,se.Y)(nn.A,{url:p("SponsoredMessageAlertLearnMoreUrl"),text:p("SponsoredMessageAlertLearnMoreUrl")})}),(0,se.Y)("p",{children:(0,Pt.A)(p("SponsoredMessageInfoDescription4"),["br"])})]}),[p]),{isContextMenuOpen:g,contextMenuAnchor:A,handleContextMenu:f,handleContextMenuClose:C,handleContextMenuHide:b}=(0,cn.A)(a,!u),y=(0,T.A)(()=>{i(),C(),b()}),S=(0,s.Kr)(()=>{if(o)return{header:(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:yl,children:p("AboutRevenueSharingAds")}),(0,se.Y)("p",{className:(0,ge.A)(Sl,"hbsLlXSH"),children:p("RevenueSharingAdsAlertSubtitle")}),(0,se.Y)(X.A,{ref:a,round:!0,size:"smaller",color:"translucent",className:"JdN5pGTw",onClick:f,iconName:"more"})]}),listItemData:[["lock",p("RevenueSharingAdsInfo1Title"),(0,Pt.A)(p("RevenueSharingAdsInfo1Subtitle"),["simple_markdown"])],["revenue-split",p("RevenueSharingAdsInfo2Title"),(0,Pt.A)(p("RevenueSharingAdsInfo2Subtitle"),["simple_markdown"])],["nochannel",p("RevenueSharingAdsInfo3Title"),(0,Pt.A)(p("RevenueSharingAdsInfo3Subtitle",t),["simple_markdown"])]],footer:(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:yl,children:(0,Pt.A)(p("RevenueSharingAdsInfo4Title"),["simple_markdown"])}),(0,se.FD)("p",{className:Sl,children:[(0,Pt.A)(p("RevenueSharingAdsInfo4Subtitle2",""),["simple_markdown"]),(0,se.Y)(nn.A,{url:p("PromoteUrl"),text:p("LearnMoreArrow")})]})]})}},[o,p,f,t]);return u?(0,se.FD)(se.FK,{children:[(0,se.Y)(ml.A,{isOpen:o,listItemData:S?.listItemData,headerIconName:"channel",headerIconPremiumGradient:!0,withSeparator:!0,header:S?.header,footer:S?.footer,buttonText:p("RevenueSharingAdsUnderstood"),onClose:y}),A&&c&&(0,se.Y)(bl.A,{isOpen:g,anchor:A,triggerRef:a,randomId:c,additionalInfo:d,canReport:l,sponsorInfo:h,shouldSkipAbout:!0,onItemClick:y,onClose:C,onCloseAnimationEnd:b})]}):(0,se.FD)(te.A,{isOpen:o,className:"LFkgLoAk",contentClassName:"TZE15Pt_",onClose:y,children:[v,(0,se.Y)(X.A,{onClick:y,children:p("RevenueSharingAdsUnderstood")})]})})),kl="t9iZUzOj",wl=(0,s.ph)(({isOpen:e,onClose:t})=>{const i=(0,B.A)(),n=(0,Fi.A)(),a=(0,s.Kr)(()=>{const e=i("LearnMore");return n("ChannelEarnLearnCoinAbout",{link:(0,se.FD)(nn.A,{url:i("MonetizationInfoTONLink"),text:e,children:[e,(0,se.Y)(he.A,{name:"next"})]})},{withNodes:!0})},[n,i]),o=(0,s.Kr)(()=>n("MonetizationInfoTONTitle",void 0,{withNodes:!0,specialReplacement:{"💎":(0,se.Y)(he.A,{className:"ATkOSqJ7",name:"toncoin"})}}),[n]),r=(0,s.Kr)(()=>{if(e)return{header:(0,se.Y)("h3",{className:kl,children:i("lng_channel_earn_learn_title")}),listItemData:[["channel",i("lng_channel_earn_learn_in_subtitle"),(0,Pt.A)(i("lng_channel_earn_learn_in_about"),["simple_markdown"])],["revenue-split",i("lng_channel_earn_learn_split_subtitle"),(0,Pt.A)(i("Monetization.Intro.Split.Text"),["simple_markdown"])],["cash-circle",i("lng_channel_earn_learn_out_subtitle"),(0,Pt.A)(i("lng_channel_earn_learn_out_about"),["simple_markdown"])]],footer:(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:kl,children:o}),(0,se.Y)("p",{className:"mjveZmdr",children:a})]})}},[e,i,o,a]);if(r)return(0,se.Y)(ml.A,{isOpen:e,listItemData:r.listItemData,headerIconName:"cash-circle",headerIconPremiumGradient:!0,withSeparator:!0,header:r.header,footer:r.footer,buttonText:i("RevenueSharingAdsUnderstood"),onClose:t})});var Il=i(15535);const Pl="oofoCYlu",Yl=(0,s.ph)((0,n.EK)(e=>{const{twoFaSettings:{hint:t}}=e;return{passwordHint:t}})(({modal:e,passwordHint:t})=>{const{closeMonetizationVerificationModal:i,clearMonetizationVerificationError:a,processMonetizationRevenueWithdrawalUrl:o}=(0,n.ko)(),r=Boolean(e),l=(0,Si.A)(e),c=(0,Fi.A)(),[d,h]=(0,s.J0)(!1),m=(0,T.A)(e=>{l&&o({peerId:l.chatId,currentPassword:e})}),u=(0,T.A)(()=>{a()}),p=(0,T.A)(()=>{i()});return(0,se.Y)(te.A,{isOpen:r,hasCloseButton:!0,title:c("CheckPasswordTitle"),className:"WqeWhMAS",contentClassName:Pl,onClose:p,children:(0,se.Y)("div",{className:(0,ge.A)(Pl,"settings-content password-form custom-scroll"),children:(0,se.Y)("div",{className:"settings-item pt-0",children:(0,se.Y)(Il.A,{shouldShowSubmit:!0,placeholder:c("CheckPasswordPlaceholder"),error:l?.errorKey&&c.withRegular(l.errorKey),description:c("CheckPasswordDescription"),onClearError:u,isLoading:l?.isLoading,hint:t,isPasswordVisible:d,shouldResetValue:r,onChangePasswordVisibility:h,onSubmit:m})})})})})),Fl={content:"MKdSUg2P",chatItem:"qEIwBtp0"},Dl=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.mBe)(e,e.currentUserId),i=(0,c.g29)(e);return{currentUser:t,stickerSet:e.defaultStatusIconsId?(0,c.ycM)(e,e.defaultStatusIconsId):void 0,isPremium:i,isAccountFrozen:(0,c.trm)(e)}})(({modal:e,currentUser:t,stickerSet:i,isPremium:a,isAccountFrozen:o})=>{const{closeEmojiStatusAccessModal:r,toggleUserEmojiStatusPermission:c,sendWebAppEvent:d,openPremiumModal:h,loadDefaultStatusIcons:m}=(0,n.ko)(),u=Boolean(e),p=(0,B.A)(),v=(0,Fi.A)(),g=(0,s.li)(),[A,f]=(0,s.J0)(0);(0,s.vJ)(()=>{!u||i?.stickers||o||m()},[u,i,o]);const C=(0,s.Kr)(()=>{if(t&&i?.stickers)return{...t,emojiStatus:{type:"regular",documentId:i.stickers[A].id}}},[t,i,A]),b=i?.stickers?.length;(0,Sn.A)(()=>{b&&f(e=>(e+1)%b)},b?3200:void 0);const y=(0,T.A)(()=>(0,se.Y)(Ps.A,{withEmojiStatus:!0,className:Fl.chatItem,itemClassName:Fl.itemName,mockPeer:C})),S=(0,T.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&(a?(d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"allowed"}}}),c({botId:e.bot.id,isEnabled:!0,isBotAccessEmojiGranted:!0})):(h(),d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}))))}),N=(0,T.A)(()=>{e?.bot?.id&&(r(),e?.webAppKey&&d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}),a&&c({botId:e.bot.id,isEnabled:!1}))}),k=(0,T.A)(()=>{if(e?.bot)return v("EmojiStatusAccessText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,se.FD)(te.A,{className:(0,ge.A)("confirm"),contentClassName:Fl.content,isOpen:u,onClose:N,children:[y(),(0,se.FD)("div",{children:[k(),(0,se.FD)("div",{className:"dialog-buttons mt-2",ref:g,children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:S,color:"primary",children:p("lng_bot_allow_write_confirm")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:N,children:v("Cancel")})]})]})]})})),Ml=(0,s.ph)((0,n.EK)(e=>({currentUser:(0,c.mBe)(e,e.currentUserId)}))(({modal:e,currentUser:t})=>{const{closeLocationAccessModal:i,toggleUserLocationPermission:a,sendWebAppEvent:o}=(0,n.ko)(),r=Boolean(e),c=(0,B.A)(),d=(0,Fi.A)(),h=(0,s.li)(),u=(0,T.A)(async()=>{const t=await(0,m.Bu)(),{geolocation:s}=t;e?.bot?.id&&(i(),e?.webAppKey&&(a({botId:e.bot.id,isAccessGranted:!0}),o({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!0,latitude:s?.latitude,longitude:s?.longitude,altitude:s?.altitude,course:s?.heading,speed:s?.speed,horizontal_accuracy:s?.accuracy,vertical_accuracy:s?.accuracy}}})))}),p=(0,T.A)(()=>{e?.bot?.id&&(i(),e?.webAppKey&&(a({botId:e.bot.id,isAccessGranted:!1}),o({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}})))}),v=(0,T.A)(()=>{if(e?.bot)return(0,se.FD)("div",{className:"CGPoDaLo",children:[(0,se.Y)(Yt.A,{size:"large",peer:t}),(0,se.Y)(he.A,{name:"next",className:"pzERgD5x"}),(0,se.Y)(Yt.A,{size:"large",peer:e.bot})]})}),g=(0,T.A)(()=>{if(e?.bot)return d("LocationPermissionText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})});return(0,se.FD)(te.A,{className:(0,ge.A)("confirm"),isOpen:r,onClose:p,children:[v(),(0,se.FD)("div",{children:[g(),(0,se.FD)("div",{className:"dialog-buttons mt-2",ref:h,children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary",children:c("lng_bot_allow_write_confirm")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:d("Cancel")})]})]})]})})),Tl="qJDgUtjV",Bl=(0,s.ph)(({modal:e})=>{const{reportSponsored:t,closeReportAdModal:i,openPreviousReportAdModal:a}=(0,n.ko)(),o=(0,B.A)(),l=Boolean(e),c=(0,s.li)(),d=(0,T.A)((i,s)=>{const{chatId:n,randomId:a}=e;t({peerId:n,randomId:a,option:s})}),[h,m]=(0,s.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e.sections[t],t]},[e]),u=(0,T.A)(()=>{m?a():i()}),p=(0,s.Kr)(()=>{if(!e)return;const t=o("lng_report_sponsored_reported_learn").split("{link}");return[t[0],(0,se.Y)(nn.A,{text:o("lng_report_sponsored_reported_link"),url:o("ReportAd.Help_URL")}),t[1]]},[o,e]),v=(0,s.Kr)(()=>{if(!e)return;const t=Boolean(h?.subtitle);return(0,se.FD)("div",{className:"modal-header-condensed",children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:o(m?"Back":"Close"),onClick:u,iconName:m?"arrow-left":"close"}),(0,se.FD)("div",{className:(0,ge.A)("modal-title","ZAdG13Ah",t&&"lVVyV0py"),children:[(0,se.Y)("h3",{className:"mMmY6YR4",children:o("ReportAd")}),t&&(0,se.Y)("span",{className:"gSkAFc4u",children:h.subtitle})]})]})},[o,e,m,h?.subtitle]);(0,s.vJ)(()=>{if(!e)return;const t=document.querySelector(`.${oe.uo} > .${Tl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)(()=>{c.current.style.height=`${i+56}px`})},[e]);const g=(0,T.A)(()=>{const e=document.querySelector(`.${oe.VY} > .${Tl}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{c.current.style.height=`${t+56}px`})})});return(0,se.Y)(te.A,{isOpen:l,hasCloseButton:!0,className:"njPBcVYr",header:v,onClose:i,children:(0,se.FD)(oe.Ay,{name:"slide",className:"HjsGIG6e",ref:c,activeKey:m,onStart:g,children:[(0,se.FD)("div",{className:Tl,children:[(0,se.Y)("h3",{className:"jrA2dOiw",children:h?.title}),h?.options.map(e=>(0,se.Y)(li.A,{narrow:!0,secondaryIcon:"next",className:"aFbjDzNo",buttonClassName:"VbE0HzDs",clickArg:e.option,onClick:d,children:(0,se.Y)("div",{className:"oWujoaSC",children:e.text})}))]}),(0,se.Y)("p",{className:"k71Zrc_P",children:p})]})})}),Ll="kq9LwNTZ",Rl=(0,s.ph)(({modal:e})=>{const{reportMessages:t,reportStory:i,closeReportModal:a,openPreviousReportModal:o}=(0,n.ko)(),l=(0,B.A)(),c=Boolean(e),d=(0,s.li)(),[h,m]=(0,s.J0)(""),u=(0,T.A)((s,n)=>{const{messageIds:a,subject:o,peerId:r,chatId:l}=e;if(a)switch(o){case"message":t({chatId:l,messageIds:a,option:n});break;case"story":i({storyId:a[0],peerId:r,option:n})}}),[p,v]=(0,s.Kr)(()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e?.sections[t],t]},[e]),g=(0,T.A)(()=>{o()}),A=(0,T.A)(()=>{a()}),f=(0,s.Kr)(()=>{if(!e)return;const t=Boolean(p?.subtitle);return(0,se.FD)("div",{className:"modal-header-condensed",children:[v?(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:l("Back"),onClick:g,iconName:"arrow-left"}):(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:l("Close"),onClick:A,iconName:"close"}),(0,se.FD)("div",{className:(0,ge.A)("modal-title","Lj_ezEWU",t&&"OYFbu8fQ"),children:[(0,se.Y)("h3",{className:(0,ge.A)("QawchdxB",v&&"CV7kzv9H"),children:p?.options?l("story"===e?.subject?"ReportStory":"Report"):p?.title}),t&&(0,se.Y)("span",{className:"OUFckTb7",children:p.subtitle})]})]})},[l,e,v,p?.options,p?.subtitle,p?.title]),C=(0,T.A)(e=>{m(e.target.value)});(0,s.vJ)(()=>{if(!e)return;const t=document.querySelector(`.${oe.uo} > .${Ll}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${i}px`})},[e]);const b=(0,T.A)(()=>{const e=document.querySelector(`.${oe.VY} > .${Ll}`);(0,r.YS)(()=>{const t=e.scrollHeight;(0,r.RK)(()=>{d.current.style.height=`${t+20}px`})})}),y=(0,T.A)(()=>{m(""),a()}),S=(0,T.A)(()=>{const{messageIds:s,subject:n,peerId:a,chatId:o}=e;switch(n){case"message":t({chatId:o,messageIds:s,option:p?.option,description:h});break;case"story":i({storyId:s?.[0],peerId:a,option:p?.option,description:h})}y()});return(0,se.Y)(te.A,{isOpen:c,header:f,onClose:y,contentClassName:"tNysQgHL",className:(0,ge.A)("E1bGWeON","story"===e?.subject&&"component-theme-dark"),children:(0,se.Y)(oe.Ay,{name:"slide",className:"n2VxPirU",ref:d,activeKey:v,onStart:b,children:(0,se.FD)("div",{className:Ll,children:[p?.options?(0,se.Y)("h3",{className:"GSfUuTet",children:p?.title}):void 0,p?.options?.map(e=>(0,se.Y)(li.A,{narrow:!0,nonInteractive:!0,secondaryIcon:"next",className:"RoxwMzvA",buttonClassName:"Z6skYdvb",clickArg:e.option,onClick:u,children:(0,se.Y)("div",{className:"FU8m6NUU",children:e.text})})),p?.option?(0,se.FD)("div",{className:"KpptZ3Mk",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Report,size:100,className:"kO8JC4gK",nonInteractive:!0,forceAlways:!0,noLoop:!1}),(0,se.Y)(fn.A,{id:"option",className:"yc3szGcx",label:p.isOptional?l("Report2CommentOptional"):l("Report2Comment"),onChange:C,value:h,maxLength:512,maxLengthIndicator:(512-h.length).toString(),noReplaceNewlines:!0}),(0,se.Y)(X.A,{onClick:S,disabled:p.isOptional?void 0:!h.length,children:l("ReportSend")})]}):void 0]})})})});var xl=i(65632),El=i(89966);const Vl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:s,patternColor:n,background:a,backgroundColor:o}=(0,c.Gyz)(e,i)||{};return{theme:i,isBackgroundBlurred:s,patternColor:n,customBackground:a,backgroundColor:o,bot:t?(0,c.mBe)(e,t?.botId):void 0,currentUserId:e.currentUserId}})(({modal:e,theme:t,isBackgroundBlurred:i,patternColor:a,customBackground:o,backgroundColor:r,bot:c})=>{const{closePreparedInlineMessageModal:d,sendWebAppEvent:h,openSharePreparedMessageModal:m}=(0,n.ko)(),u=(0,Fi.A)(),p=Boolean(e),{webAppKey:v,message:g,botId:A}=e||{},f=(0,s.li)(),C=(0,xl.A)(t,o),b=(0,T.A)(()=>{v&&A&&g&&(m({webAppKey:v,message:g}),d())}),y=(0,T.A)(()=>{d(),v&&h({webAppKey:v,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),S=(0,s.Kr)(()=>{if(e)return(0,se.FD)("div",{className:"P1fPh6h8",children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:u("Close"),onClick:y,iconName:"close"}),(0,se.Y)("h3",{className:(0,ge.A)("modal-title","E42tgAwD"),children:u("BotShareMessage")})]})},[u,e]),N=(0,s.Kr)(()=>{if(A&&g&&v)return(0,l.i7)(A,g)},[A,g,v]),k=(0,ge.A)("_6w75ldP","lElCwweL",o&&"CZkpv8n0",r&&"VJAYrDF_",o&&i&&"m8xzfVvU");return(0,se.FD)(te.A,{dialogRef:f,isOpen:p,header:S,onClose:y,className:"Rzj2LMLf",contentClassName:"Ve4u2KVI",children:[(0,se.FD)("div",{className:(0,ge.A)("McJgXCtB","MessageList"),inert:!0,style:(0,tt.A)(`--pattern-color: ${a}`,r&&`--theme-background-color: ${r}`),children:[(0,se.Y)("div",{className:k,style:C?`--custom-background: ${C}`:void 0}),N&&(0,se.Y)(El.A,{message:N,threadId:G.l3,messageListType:"thread",noComments:!0,noReplies:!0,appearanceOrder:0,isJustAdded:!1,isFirstInGroup:!0,isLastInGroup:!0,isLastInList:!1,isFirstInDocumentGroup:!1,isLastInDocumentGroup:!1},A)]}),(0,se.FD)("div",{className:"pNSCKAVN",children:[(0,se.Y)("p",{className:"xWnXsG7q",children:u("WebAppShareMessageInfo",{user:(0,l.Yg)(c)})}),(0,se.Y)(X.A,{onClick:b,children:u("BotShareMessageShare")})]})]})}));var _l=i(20247),Ul=i(48227);const Ol=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{isPaymentMessageConfirmDialogOpen:i}=t;return{isPaymentMessageConfirmDialogOpen:i,starsBalance:e.stars?.balance.amount||0,isStarsBalanceModalOpen:Boolean(t.starsBalanceModal)}})(({modal:e,isPaymentMessageConfirmDialogOpen:t,isStarsBalanceModalOpen:i,starsBalance:a})=>{const{closeSharePreparedMessageModal:o,sendInlineBotResult:r,sendWebAppEvent:l,showNotification:d,updateSharePreparedMessageModalSendArgs:h}=(0,n.ko)(),m=(0,B.A)(),u=Boolean(e),[p,v,g]=(0,D.A)();(0,s.vJ)(()=>{u&&v()},[u,v]);const{message:A,filter:f,webAppKey:C,pendingSendArgs:b}=e||{},{starsForSendMessage:y}=b||{},{closeConfirmDialog:S,dialogHandler:N,shouldAutoApprove:k,setAutoApprove:w,handleWithConfirmation:I}=(0,_l.A)(y||0,i,a),P=(0,T.A)(()=>{o(),C&&l({webAppKey:C,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})}),Y=(0,T.A)((e,t)=>{if(A&&C){const i=(0,n.mS)(),s=(0,c.PVB)(i,e);r({chatId:e,threadId:t||G.l3,id:A.result.id,queryId:A.result.queryId}),y||d({message:m("BotSharedToOne",(0,It.F9)(m,s))}),l({webAppKey:C,event:{eventType:"prepared_message_sent"}}),o(),h({args:void 0})}}),F=(0,T.A)((e,t)=>{h({args:{peerId:e,threadId:t}})}),M=(0,T.A)(()=>{b&&I(Y,b.peerId,b.threadId)}),L=(0,T.A)(()=>{S(),h({args:void 0})});(0,s.vJ)(()=>{b&&M()},[b]);const R=(0,n.mS)(),x=b?(0,c.PVB)(R,b.peerId):void 0,E=x?(0,It.F9)(m,x):void 0;if(u||p)return(0,se.FD)(se.FK,{children:[(0,se.Y)(Gs,{isOpen:u,title:m("SelectChat"),searchPlaceholder:m("Search"),filter:f,onSelectRecipient:F,onClose:P,onCloseAnimationEnd:g,isLowStackPriority:!0}),(0,se.Y)(Ul.A,{isOpen:t,onClose:L,userName:E,messagePriceInStars:y||0,messagesCount:1,shouldAutoApprove:k,setAutoApprove:w,confirmHandler:N})]})}));var Kl=i(96115);const Jl={content:"iGABsB4C",modalHeader:"Ofq4u4pq",section:"k44LZ99u",form:"VhNBPaMY",label:"anDcU5bi",input:"kYxuUcwe",description:"A_JjwhXv",timeInputIcon:"pHne2E6K",offerButton:"d_PCM2tC",currencySelector:"genSNudF",currencyIcon:"fT5aRs0H"},Gl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=e.stars?.balance,s=t?(0,c.PVB)(e,t.chatId):void 0,n=t?(0,Kl.GA)(e,t.chatId,G.l3):void 0,{appConfig:a}=e,o=a.starsSuggestedPostAmountMax,r=a.starsSuggestedPostAmountMin,l=a.starsSuggestedPostAgeMin,d=a.starsSuggestedPostFutureMin,h=a.starsSuggestedPostFutureMax,m=a.tonSuggestedPostAmountMax,u=a.tonSuggestedPostAmountMin,p=!!t&&(0,c.ODG)(e,t.chatId);return{peer:s,starBalance:i,tonBalance:e.ton?.balance?.amount,currentDraft:n,maxStarsAmount:o,minStarsAmount:r,tonMaxAmount:m,tonMinAmount:u,ageMinSeconds:l,futureMin:d,futureMax:h,isMonoforumAdmin:p}})(({modal:e,starBalance:t,tonBalance:i,peer:a,currentDraft:r,maxStarsAmount:l,minStarsAmount:c,tonMaxAmount:d,tonMinAmount:h,ageMinSeconds:m,futureMin:u,futureMax:p,isMonoforumAdmin:v})=>{const{closeSuggestMessageModal:g,updateDraftSuggestedPostInfo:A,openStarsBalanceModal:f}=(0,n.ko)(),[C,b,y]=(0,D.A)(),S=r?.suggestedPostInfo,N=r?.replyInfo,k=Boolean(N),[w,I]=(0,s.J0)(S?.price?.amount||void 0),[P,Y]=(0,s.J0)(S?.price?.currency||o.OUy),[F,M]=(0,s.J0)(S?.scheduleDate?1e3*S.scheduleDate:void 0);(0,s.vJ)(()=>{const e=S?.price,t=e?.currency===o.ykW?(0,va.wD)(e.amount):e?.amount;I(t),Y(S?.price?.currency||o.OUy),M(S?.scheduleDate?1e3*S.scheduleDate:void 0)},[S]);const L=(0,Fi.A)(),R=(0,B.A)(),x=P===o.OUy,E=Math.floor(Date.now()/1e3),V=1e3*(E+u),_=1e3*(E+p),U=1e3*(E+2*u),O=(0,T.A)(e=>{const t=e.target.value,i=parseFloat(t),s=""===t||Number.isNaN(i)?void 0:Math.min(Math.max(i,0),j);I(s)}),K=(0,T.A)(e=>{M(e.getTime()),y()}),J=(0,T.A)(()=>{M(void 0),y()}),G=x?c:(0,va.wD)(h),j=x?l:(0,va.wD)(d),z=Boolean(w)&&w<G,H=(0,T.A)(()=>{const e=w?x?w:(0,va.tT)(w):0;if(!z){if(!v)if(x){if(e>(t?.amount||0))return void f({topup:{balanceNeeded:e}})}else if(e>(i||0))return void f({currency:o.ykW});A({price:{currency:P,amount:e,nanos:0},scheduleDate:F?Math.max(F/1e3,(0,Ii.Fm)()+u+60):void 0}),g()}});return(0,se.Y)(te.A,{headerClassName:Jl.modalHeader,isOpen:Boolean(e),onClose:g,isSlim:!0,isLowStackPriority:!0,hasCloseButton:!0,contentClassName:Jl.content,title:L(k?"TitleSuggestedChanges":"TitleSuggestMessage"),children:(0,se.FD)("div",{className:Jl.form,children:[(0,se.FD)("div",{className:Jl.section,children:[(0,se.FD)("div",{className:Jl.currencySelector,children:[(0,se.FD)(X.A,{className:Jl.currencyButton,color:x?"primary":"translucent",pill:!0,fluid:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(o.OUy),children:[(0,se.Y)(he.A,{name:"star",className:Jl.currencyIcon}),L("CurrencyStars")]}),(0,se.FD)(X.A,{className:Jl.currencyButton,fluid:!0,color:x?"translucent":"primary",pill:!0,size:"tiny",noFastClick:!0,onClick:()=>Y(o.ykW),children:[(0,se.Y)(he.A,{name:"toncoin",className:Jl.currencyIcon}),L("CurrencyTon")]})]}),(0,se.Y)(ee.A,{label:L("InputPlaceholderPrice"),className:(0,ge.A)(Jl.input),value:w?.toString(),onChange:O,inputMode:"numeric",tabIndex:0,teactExperimentControlled:x}),(0,se.Y)("div",{className:Jl.description,children:void 0!==w&&w>0&&w<G?L("DescriptionSuggestedPostMinimumOffer",{amount:x?(0,wi.Kk)(L,G):(0,wi.QH)(L,G)},{withNodes:!0,withMarkdown:!0}):L(x?"SuggestMessagePriceDescriptionStars":"SuggestMessagePriceDescriptionTon")})]}),(0,se.FD)("div",{className:Jl.section,children:[(0,se.FD)("div",{className:(0,ge.A)(Jl.input,"input-group","touched"),children:[(0,se.Y)("input",{type:"text",className:(0,ge.A)("form-control",C&&"focus"),value:F?(0,We.e0)(F/1e3,L,R):L("SuggestMessageAnytime"),autoComplete:"off",onClick:b,onFocus:b,readOnly:!0}),(0,se.Y)("label",{children:L("InputTitleSuggestMessageTime")}),(0,se.Y)(he.A,{name:"down",className:Jl.timeInputIcon})]}),(0,se.Y)("div",{className:Jl.description,children:L("SuggestMessageTimeDescription",{hint:L("SuggestMessageDateTimeHint"),duration:(0,We.A$)(L,m,!0)})})]}),(0,se.Y)(vn,{isOpen:C,isFutureMode:!0,withTimePicker:!0,minAt:V,maxAt:_,onClose:y,onSubmit:K,selectedAt:F||U,submitButtonLabel:L("Save"),secondButtonLabel:L("SuggestMessageAnytime"),onSecondButtonClick:J,description:L("SuggestMessageDateTimeHint")}),(0,se.Y)(X.A,{className:Jl.offerButton,onClick:H,disabled:z,inline:!0,children:k?L("ButtonUpdateTerms"):w?L("ButtonOfferAmount",{amount:x?(0,wi.U2)(L,w,{asFont:!0}):(0,wi.Ms)(L,w)},{withNodes:!0,withMarkdown:!0}):L("ButtonOfferFree")})]})})})),jl="xqyFGV8R",zl=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t&&(0,c.O5q)(e,t.chatId,t.messageId),s=i?(0,c.Y7C)(e,i):void 0,n=t&&(0,c.ODG)(e,t.chatId),{appConfig:a}=e,o=a.starsSuggestedPostCommissionPermille,r=a.tonSuggestedPostCommissionPermille,l=a.starsSuggestedPostAgeMin,d=a.starsSuggestedPostFutureMin,h=a.starsSuggestedPostFutureMax,m=i?.suggestedPostInfo?.scheduleDate;return{minAge:l,futureMin:d,futureMax:h,message:i,sender:s,isAdmin:n,commissionPermille:o,tonCommissionPermille:r,scheduleDate:m}})(({modal:e,message:t,sender:i,isAdmin:a,commissionPermille:r,tonCommissionPermille:l,minAge:c,futureMin:d,futureMax:h,scheduleDate:m})=>{const{closeSuggestedPostApprovalModal:u,approveSuggestedPost:p}=(0,n.ko)(),v=(0,Fi.A)(),g=(0,B.A)(),[A,f,C]=(0,D.A)(),b=Math.floor(Date.now()/1e3),y=1e3*(b+d),S=1e3*(b+h),N=b+2*d,[k,w]=(0,s.J0)(N),I=(0,T.A)(()=>{u()}),P=(0,T.A)(t=>{e&&(p({chatId:e.chatId,messageId:e.messageId,scheduleDate:t}),u())}),Y=(0,T.A)(e=>{const t=Math.floor(e.getTime()/1e3);w(t)}),F=(0,T.A)(e=>{const t=Math.floor(e.getTime()/1e3);C(),P(t)}),M=(0,T.A)(()=>{C(),P()}),L=(0,T.A)(()=>{m?P(m):f()});if(!e||!t)return;const R=i?(0,It.em)(g,i):"";return(0,se.FD)(se.FK,{children:[(0,se.Y)(ai.A,{isOpen:Boolean(e)&&!A,onClose:I,title:v("SuggestedPostConfirmTitle"),confirmHandler:L,confirmLabel:v(m?"ButtonPublish":"Next"),children:(()=>{const e=t?.suggestedPostInfo?.price,i=e?.amount,s=e?.currency||o.OUy,n=v("SuggestedPostConfirmMessage",{peer:R},{withNodes:!0,withMarkdown:!0}),d=(0,Pt.A)(n);if(!i)return d;const h=(s===o.ykW?l:r)/10,u=i/100*h,p=s===o.ykW?(0,wi.QH)(v,(0,va.wD)(u)):(0,wi.Kk)(v,u),A=c,f=(0,We.A$)(v,A,!0);if(m){const e=(0,We.e0)(m,v,g),t=a?"SuggestedPostConfirmDetailsWithTimeAdmin":"SuggestedPostConfirmDetailsWithTimeUser";return(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{children:d}),(0,se.Y)("div",{className:jl,children:(0,Pt.A)(v(t,{amount:p,commission:h,duration:f,time:e},{withNodes:!0,withMarkdown:!0}))})]})}const C=a?"SuggestedPostConfirmDetailsAdmin":"SuggestedPostConfirmDetailsUser";return(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{children:d}),(0,se.Y)("div",{className:jl,children:(0,Pt.A)(v(C,{amount:p,commission:h,duration:f},{withNodes:!0,withMarkdown:!0}))})]})})()}),(0,se.Y)(vn,{isOpen:A,isFutureMode:!0,withTimePicker:!0,minAt:y,maxAt:S,onClose:C,onSubmit:F,onDateChange:Y,selectedAt:1e3*k,submitButtonLabel:v("ButtonPublishAtTime",{time:(0,We.e0)(k,v,g)}),secondButtonLabel:v("PublishNow"),onSecondButtonClick:M,description:v("SuggestMessageDateTimeHint")})]})})),Hl=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],$l=[...Hl,"sendPlain"];function ql(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=Hl.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,...Hl.reduce((e,t)=>Object.assign(e,{[t]:c.sendMedia}),{})},"embedLinks"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==o&&d();const h=$l.every(e=>c[e]);c={...c,sendMessages:!!h||void 0},i(c),a(!e||Object.keys(c).some(t=>{const i=t;return Boolean(e[i])!==Boolean(c[i])}))},[e,t]),c=(0,s.hb)(()=>{i(e||{}),a(!1)},[e]);return{permissions:t,isLoading:o,havePermissionChanged:n,handlePermissionChange:l,setIsLoading:r,resetPermissions:c}}const Wl=["sendPhotos","sendVideos","sendStickers","sendAudios","sendDocs","sendVoices","sendRoundvideos","embedLinks","sendPolls"],Ql=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=t?(0,c.hds)(e,t):void 0,s=i&&(0,c.AWZ)(e,i.id);return{chat:i,hasLinkedChat:Boolean(s?.linkedChatId)}})(({chat:e,isMediaDropdownOpen:t,hasLinkedChat:i,permissions:a,className:o,shiftedClassName:r,dropdownClassName:c,withCheckbox:d,permissionGroup:h,setIsMediaDropdownOpen:m,handlePermissionChange:u,getControlIsDisabled:p})=>{const{showNotification:v}=(0,n.ko)(),{isForum:g}=e||{},A=(0,Fi.A)(),f=(0,s.Kr)(()=>e&&(0,l.gA)(e),[e]),C=i||f,b=(0,s.Kr)(()=>Wl.reduce((e,t)=>(a[t]||(e+=1),e),0),[a]),S=(0,T.A)(e=>{(0,y.A)(e),m(!t)}),N=(0,T.A)(()=>{v({message:A("ChatPermissionNotAvailable")})});return(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendPlain",checked:!a.sendPlain,label:A("UserRestrictionsSend"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendPlain")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendMedia",checked:!a.sendMedia,label:A("UserRestrictionsSendMedia"),labelText:`${b}/${Wl.length}`,blocking:!0,permissionGroup:h,rightIcon:t?"up":"down",onChange:u,onClickLabel:S,disabled:p&&p("sendMedia")})}),(0,se.Y)("div",{className:c,children:(0,se.FD)("div",{className:o,children:[(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendPhotos",checked:!a.sendPhotos,label:A("SendMediaPermissionPhotos"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendPhotos")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendVideos",checked:!a.sendVideos,label:A("SendMediaPermissionVideos"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendVideos")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendStickers",checked:!a.sendStickers&&!a.sendGifs,label:A("SendMediaPermissionStickersGifs"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendStickers")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendAudios",checked:!a.sendAudios,label:A("SendMediaPermissionAudios"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendAudios")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendDocs",checked:!a.sendDocs,label:A("SendMediaPermissionFiles"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendDocs")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendVoices",checked:!a.sendVoices,label:A("SendMediaPermissionVoices"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendVoices")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendRoundvideos",checked:!a.sendRoundvideos,label:A("SendMediaPermissionRoundVideos"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendRoundvideos")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"embedLinks",checked:!a.embedLinks,label:A("SendMediaPermissionWebPages"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("embedLinks")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"sendPolls",checked:!a.sendPolls,label:A("SendMediaPermissionPolls"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("sendPolls")})})]})}),(0,se.FD)("div",{className:r,children:[(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"inviteUsers",checked:!a.inviteUsers,label:A("UserRestrictionsInviteUsers"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("inviteUsers")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),onClick:C?N:void 0,children:(0,se.Y)(js.A,{name:"pinMessages",checked:!a.pinMessages,label:A("UserRestrictionsPinMessages"),disabled:p?p("pinMessages"):C,blocking:!0,permissionGroup:h,onChange:u})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"editRank",checked:!a.editRank,label:A("UserRestrictionsEditRank"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("editRank")})}),(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),onClick:C?N:void 0,children:(0,se.Y)(js.A,{name:"changeInfo",checked:!a.changeInfo,label:A("UserRestrictionsChangeInfo"),blocking:!0,permissionGroup:h,disabled:p?p("changeInfo"):C,onChange:u})}),g&&(0,se.Y)("div",{className:(0,ge.A)("ListItem",d&&"with-checkbox"),children:(0,se.Y)(js.A,{name:"manageTopics",checked:!a.manageTopics,label:A("UserRestrictionsCreateTopics"),blocking:!0,permissionGroup:h,onChange:u,disabled:p&&p("manageTopics")})})]})]})}));var Zl=i(77561);const Xl="yGhFKTl5",ec="goI3MITH",tc=(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),m=t?.isSchedule,u=t?.onConfirm,p=s&&(0,v.L8)(s)?(0,l.u0)((0,c.mBe)(e,s)):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")&&!a.isMonoforum,C=a?.isCreator,b=s?(0,c.ALW)(e,s):void 0,y=a&&(0,l.yn)(a)&&!n||b,S=a&&((0,l.Vs)(a)||d);return{chat:a,isChannel:d,isSuperGroup:h,messageIds:i,currentUserId:e.currentUserId,canDeleteForAll:!m&&n,contactName:p,willDeleteForCurrentUserOnly:y,willDeleteForAll:S,adminMembersById:A,chatBot:g,canBanUsers:f,linkedChatId:r,isSchedule:m,isCreator:C,onConfirm:u}})(({isOpen:e,chat:t,isChannel:i,isSuperGroup:a,isSchedule:o,currentUserId:r,messageIds:l,isCreator:d,canDeleteForAll:h,contactName:m,willDeleteForCurrentUserOnly:u,willDeleteForAll:p,chatBot:v,adminMembersById:g,canBanUsers:A,linkedChatId:f,onConfirm:C})=>{const{closeDeleteMessageModal:b,deleteMessages:y,reportChannelSpam:S,deleteChatMember:N,deleteScheduledMessages:k,exitMessageSelectMode:w,updateChatMemberBannedRights:I,deleteParticipantHistory:P}=(0,n.ko)(),Y=(0,K.A)(e),F=(0,B.A)(),D=(0,Fi.A)(),{permissions:M,havePermissionChanged:L,handlePermissionChange:R,resetPermissions:x}=ql(t?.defaultBannedRights),[E,V]=(0,s.J0)([]),[_,U]=(0,s.J0)([]),[O,J]=(0,s.J0)([]),[G,j]=(0,s.J0)(!1),[z,H]=(0,s.J0)(!1),[$,q]=(0,s.J0)(!0),W=(0,s.Kr)(()=>{if(i||!l||!t)return hi.p;const e=(0,n.mS)(),s=(0,c.SpN)(e,t.id,l);return s?(0,di.Am)(s).filter(e=>e?.id!==t?.id&&e?.id!==f&&e?.id!==t?.linkedMonoforumId):hi.p},[t,i,f,l]),Q=(0,T.A)(()=>W.map(e=>({value:e.id,label:(0,It.F9)(D,e)||"",leftElement:(0,se.Y)(Yt.A,{size:"small",peer:e})}))),Z=(0,s.Kr)(()=>W.filter(e=>e.id!==f&&e.id!==t?.linkedMonoforumId&&e.id!==r),[W,r,f,t?.linkedMonoforumId]),ee=(0,s.Kr)(()=>W.filter(e=>e.id!==r&&e.id!==f&&e.id!==t?.linkedMonoforumId),[W,r,f,t?.linkedMonoforumId]),ie=(0,s.Kr)(()=>{const e=W.some(e=>e.id===r);return!A||e?hi.p:W.filter(e=>{const t=g?.[e.id];return d||!t})},[W,d,r,A,g]),ne=(0,s.Kr)(()=>Boolean(Z.length||ee.length||ie.length),[Z,ee,ie])&&!h&&!o&&a,ae=(0,s.Kr)(()=>!W||o?{}:(0,di.pA)(W,e=>[e.id,(0,It.F9)(D,e)]),[o,D,W]),oe=(0,s.Kr)(()=>[{value:l&&W.length>=2?"spam":W?.[0]?.id,label:F("ReportSpamTitle"),nestedOptions:l&&W.length>=2?[...Q().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,f,t?.linkedMonoforumId,r]),re=(0,s.Kr)(()=>[{value:l&&W.length>=2?"delete_all":W?.[0]?.id,label:l&&W.length>=2?F("DeleteAllFromUsers"):F("DeleteAllFrom",Object.values(ae)[0]),nestedOptions:l&&W.length>=2?[...Q().filter(e=>e.value!==f&&e.value!==t?.linkedMonoforumId&&e.value!==r)]:void 0}],[l,W,F,ae,f,t?.linkedMonoforumId,r]),le=(0,s.Kr)(()=>[{value:l&&W.length>=2?"ban":W?.[0]?.id,label:l&&W.length>=2?F(z?"DeleteRestrictUsers":"DeleteBanUsers"):z?F("KickFromSupergroup"):F("DeleteBan",Object.values(ae)[0]),nestedOptions:l&&W.length>=2?[...Q()]:void 0}],[z,F,l,W,ae]),ce=(0,T.A)(()=>{H(e=>!e)}),de=(0,T.A)((e,i)=>{if(!t)return hi.p;const s=(0,n.mS)();return i.filter(i=>{const n=(0,c.LM$)(s,t.id,i);return n&&e.includes(n.id)})}),me=(0,T.A)(e=>{Object.entries(e).forEach(([e,i])=>{i.length&&S({participantId:e,chatId:t.id,messageIds:i})})}),ue=(0,T.A)(e=>{y({messageIds:e,shouldDeleteForAll:!0})}),pe=(0,T.A)(e=>{t&&e.forEach(e=>{P({peerId:e,chatId:t.id})})}),ve=(0,T.A)(e=>{e.forEach(e=>{N({chatId:t.id,userId:e})})}),Ae=(0,T.A)(e=>{e.forEach(e=>{I({chatId:t.id,userId:e,bannedRights:M})})}),fe=(0,T.A)(()=>{if(t&&l){if(C?.(),o)k({messageIds:l});else if(ne){if(O?.length){const e=(0,n.mS)(),i=O.filter(e=>!Number.isNaN(Number(e))),s=l.reduce((s,n)=>{const a=(0,c.LM$)(e,t.id,n);return a&&i.includes(a.id)&&(s[a.id]||(s[a.id]=[]),s[a.id].push(Number(n))),s},{});me(s)}if(E?.length){const e=E.filter(e=>!Number.isNaN(Number(e)));pe(e)}if(_?.length&&!L){const e=_.filter(e=>!Number.isNaN(Number(e)));ve(e);const t=de(e,l);ue(t)}if(_?.length&&L){const e=_.filter(e=>!Number.isNaN(Number(e)));Ae(e)}O?.length&&E?.length&&_?.length||y({messageIds:l,shouldDeleteForAll:$})}else y({messageIds:l,shouldDeleteForAll:$});b(),w()}}),Ce=(0,T.A)(()=>{b()});return(0,s.vJ)(()=>{!e&&Y&&(J([]),V([]),U([]),q(!0),j(!1),H(!1),x())},[e,Y,x]),(0,se.Y)(te.A,{isOpen:e,onClose:Ce,onEnter:fe,className:"SeaF_shb",children:(0,se.FD)("div",{className:"_YNfwDqt",children:[(0,se.FD)("div",{className:ne&&"axa67kqo",dir:D.isRtl?"rtl":void 0,children:[ne&&(0,se.Y)(qi.A,{size:"small",peers:W}),(0,se.Y)("h3",{className:(0,ge.A)(ne?"U4IFhV0a":"qd6OFHiG"),children:F("Chat.DeleteMessagesConfirmation",l?.length)})]}),ne&&(0,se.FD)(se.FK,{children:[(0,se.Y)("p",{className:Xl,children:F("DeleteAdditionalActions")}),(0,se.FD)("div",{className:"b6847Kh3",children:[(0,se.Y)(Zl.A,{options:oe,onChange:J,selected:O,nestedCheckbox:l&&W.length>=2}),Z?.length>0&&(0,se.Y)(Zl.A,{options:re,onChange:V,selected:E,nestedCheckbox:l&&W.length>=2}),ie?.length>0&&(0,se.Y)(Zl.A,{options:le,onChange:U,selected:_,nestedCheckbox:l&&W.length>=2})]}),(0,se.FD)("div",{className:(0,ge.A)("iv0u9Zw6",z&&"qCQftA04"),children:[(0,se.Y)("h3",{className:(0,ge.A)(Xl,"t3KOsBfm"),children:F("UserRestrictionsCanDoUsers",W.length)}),(0,se.Y)(Ql,{withCheckbox:!0,chatId:t?.id,isMediaDropdownOpen:G,setIsMediaDropdownOpen:j,handlePermissionChange:R,permissions:M,className:(0,ge.A)("czTjjKim",G&&"Ifpyv7Jp")})]}),_?.length&&A?(0,se.FD)(li.A,{narrow:!0,buttonClassName:ec,onClick:ce,children:[F(z?"DeleteToggleBanUsers":"DeleteToggleRestrictUsers"),(0,se.Y)(he.A,{name:z?"up":"down",className:(0,ge.A)(ec,"ml-2")})]}):H(!1)]}),(h||v||!ne)&&(0,se.FD)(se.FK,{children:[(0,se.Y)("p",{children:l&&l.length>1?D("AreYouSureDeleteFewMessages"):D("AreYouSureDeleteSingleMessage")}),u&&(0,se.Y)("p",{children:F("lng_delete_for_me_chat_hint",1,"i")}),p&&(0,se.Y)("p",{children:F("lng_delete_for_everyone_hint",1,"i")})]}),h&&(0,se.Y)(js.A,{className:"dialog-checkbox",label:m?(0,Pt.A)(F("DeleteMessagesOptionAlso",m)):F("Conversation.DeleteMessagesForEveryone"),checked:$,onCheck:q}),(0,se.FD)("div",{className:(0,ge.A)("dialog-buttons",G?"JTT_DIRv":"L4YzeG91"),children:[(0,se.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:fe,children:ne?F("DeleteProceedBtn"):D("Delete")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:Ce,children:F("Cancel")})]})]})})})),ic=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,v.L8)(t),s=(0,c.nZ4)(e,t),n=(0,c.hds)(e,t),a=Boolean(n)&&(0,l.WX)(n),o=Boolean(n)&&(0,l.yn)(n),r=Boolean(n)&&(0,l.Vs)(n);return{isPrivateChat:i,isChatWithSelf:s,isChannel:a,isGroup:o,isSuperGroup:r,canPinForAll:i&&!s||r||o,contactName:t&&(0,v.L8)(t)?(0,l.u0)((0,c.mBe)(e,t)):void 0}})(({isOpen:e,chatId:t,messageId:i,isChannel:a,isGroup:o,isSuperGroup:r,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:h}=(0,n.ko)(),[m,u]=(0,s.J0)(!0),p=(0,T.A)(()=>{h({chatId:t,messageId:i,isUnpin:!1,isOneSide:!m,isSilent:!m}),d()}),v=(0,B.A)();return(0,se.FD)(te.A,{isOpen:e,onClose:d,className:"pin",title:v("PinMessageAlertTitle"),children:[(0,se.Y)("p",{children:v(a?"PinMessageAlertChannel":o||r?"PinMessageAlert":"PinMessageAlertChat")}),l&&(0,se.Y)(js.A,{className:"dialog-checkbox",label:c?(0,Pt.A)(v("Conversation.PinMessagesFor",c)):v("Conversation.PinMessageAlert.PinAndNotifyMembers"),checked:m,onCheck:u}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:v("DialogPin")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:v("Cancel")})]})]})})),sc=(0,s.ph)(({isOpen:e,pinnedMessagesCount:t=0,onClose:i,onUnpin:s})=>{const n=(0,B.A)();return(0,se.FD)(te.A,{isOpen:e,onClose:i,className:"unpin-all",title:n("Chat.PanelUnpinAllMessages"),children:[(0,se.Y)("p",{children:n("Chat.UnpinAllMessagesConfirmation",t,"i")}),(0,se.FD)("div",{className:"dialog-buttons mt-2",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:s,children:n("DialogUnpin")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:i,children:n("Cancel")})]})]})});var nc=i(2178);const ac=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e),{shouldWarnAboutFiles:i}=(0,Ys.lS)(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||{},m=!!a&&(0,c.o45)(e,a,h),u=!(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:u,selectedMessageIds:h,hasProtectedMessage:m,isAnyModalOpen:g,shouldWarnAboutFiles:i,hasIpRevealingMedia:p}})(({chat:e,canPost:t,isActive:i,messageListType:a,isSchedule:o,selectedMessagesCount:r,canDeleteMessages:l,canReportMessages:c,canDownloadMessages:d,canForwardMessages:h,hasProtectedMessage:m,isAnyModalOpen:u,selectedMessageIds:p,shouldWarnAboutFiles:v,hasIpRevealingMedia:g})=>{const{exitMessageSelectMode:A,openForwardMenuForSelectedMessages:f,downloadSelectedMessages:C,copySelectedMessages:b,showNotification:y,reportMessages:S,openDeleteMessageModal:N,setSharedSettingOption:k}=(0,n.ko)(),w=(0,B.A)();(e=>{function t(e){e.preventDefault(),(0,n.ko)().copySelectedMessages()}(0,nc.v)((0,s.Kr)(()=>e?{"Mod+C":t}:void 0,[e]))})(i);const[I,P,Y]=(0,D.A)(),[F,M]=(0,s.J0)(!1),L=(0,T.A)(()=>{A()}),R=(0,T.A)(()=>{p&&e&&N({chatId:e.id,messageIds:p,isSchedule:o})});(0,s.vJ)(()=>i&&!u?(0,Ni.A)({onBackspace:l?R:void 0,onDelete:l?R:void 0,onEsc:L}):void 0,[i,R,L,u,l]);const x=(0,T.A)(()=>{b(),y({message:w("Share.Link.Copied")}),A()}),E=(0,T.A)(()=>{C(),A()}),V=(0,T.A)(()=>{v&&g?P():E()}),_=(0,T.A)(()=>{k({shouldWarnAboutFiles:!F}),Y(),E()}),U=(0,K.A)(r||void 0,!0),O=w("VoiceOver.Chat.MessagesSelected",i?r:U,"i"),J=(0,T.A)(()=>{p&&e&&(S({chatId:e.id,messageIds:p}),A())}),G=(0,ge.A)("MessageSelectToolbar",t&&"with-composer",i&&"shown"),j=(e,t,i,s)=>(0,se.Y)("div",{role:"button",tabIndex:0,className:(0,ge.A)("div-button","item",s&&"destructive"),onClick:i,title:t,"aria-label":t,children:(0,se.Y)(he.A,{name:e})});return(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:G,children:(0,se.FD)("div",{className:"MessageSelectToolbar-inner",children:[(0,se.Y)(X.A,{color:"translucent",round:!0,onClick:L,ariaLabel:"Exit select mode",iconName:"close"}),(0,se.Y)("span",{className:"MessageSelectToolbar-count",title:O,children:O}),Boolean(r)&&(0,se.FD)("div",{className:"MessageSelectToolbar-actions",children:["scheduled"!==a&&h&&j("forward",w("Chat.ForwardActionHeader"),f),c&&j("flag",w("Conversation.ReportMessages"),J),d&&!m&&j("download",w("lng_media_download"),V),!m&&j("copy",w("lng_context_copy_selected_items"),x),l&&j("delete",w("EditAdminGroupDeleteMessages"),R,!0)]})]})}),(0,se.FD)(ai.A,{isOpen:I,onClose:Y,confirmHandler:_,children:[w("lng_launch_svg_warning"),(0,se.Y)(js.A,{className:"dialog-checkbox",checked:F,label:w("lng_launch_exe_dont_ask"),onCheck:M})]})]})})),oc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).seenByModal||{};return t&&i?{seenByDates:(0,c.O5q)(e,t,i)?.seenByDates}:{seenByDates:void 0}})(function({isOpen:e,seenByDates:t}){const{openChat:i,closeSeenByModal:a}=(0,n.ko)(),o=(0,B.A)(),r=(0,Si.A)(t,!0),l=(0,s.Kr)(()=>{if(!r)return;const e=Object.keys(r);return e.sort((e,t)=>r[t]-r[e]),e},[r]),c=(0,T.A)(e=>{a(),setTimeout(()=>{i({id:e})},100)}),d=(0,T.A)(()=>{a()});return(0,se.FD)(te.A,{isOpen:e,onClose:a,className:(0,ge.A)("slqA9gR2","narrow"),title:`Seen by ${l?.length} users`,children:[(0,se.Y)("div",{dir:o.isRtl?"rtl":void 0,children:l&&l.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>c(e),children:(0,se.Y)(ms.A,{userId:e,noStatusOrTyping:!0,status:(0,We.U)(o,1e3*r[e]),statusIcon:"message-read"})},e))}),(0,se.Y)("div",{className:"dialog-buttons mt-2",children:(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:o("Close")})})]})}));var rc=i(32581);const lc="MQxuEIRA",cc="AEAN1Au4",dc="F7owtTHj",hc=te.U+o.xB5,mc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,isReadDate:i}=(0,c.nTw)(e).privacySettingsNoticeModal||{};return{user:t?(0,c.mBe)(e,t):void 0,isReadDate:i}})(({isOpen:e,isReadDate:t,user:i})=>{const{updateGlobalPrivacySettings:s,openPremiumModal:a,closePrivacySettingsNoticeModal:o,showNotification:r,setPrivacyVisibility:c,loadUser:d}=(0,n.ko)(),h=(0,B.A)(),m=(0,Fi.A)(),u=(0,l.u0)(i),p=(0,T.A)(()=>{s({shouldHideReadMarks:!1}),o(),setTimeout(()=>{r({message:h("PremiumReadSet")})},hc)}),v=(0,T.A)(()=>{c({privacyKey:"lastSeen",visibility:"everybody",onSuccess:()=>d({userId:i.id})}),o(),setTimeout(()=>{r({message:h("PremiumLastSeenSet")})},hc)}),g=(0,T.A)(()=>{o(),setTimeout(()=>{a({initialSection:"last_seen"})},hc)}),A=(0,T.A)(()=>{o()});return(0,se.Y)(te.A,{isSlim:!0,isOpen:e,onClose:A,children:(0,se.FD)("div",{className:"tauadiDm",dir:m.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{className:"i6iFv9YE",color:"translucent",round:!0,size:"tiny",onClick:A,ariaLabel:"Close",iconName:"close"}),(0,se.Y)(Ma.A,{tgsUrl:t?Da.w.ReadTime:Da.w.LastSeen,size:84,className:"i4wZg_0J",nonInteractive:!0,noLoop:!0}),(0,se.Y)("h2",{className:lc,children:h(t?"PremiumReadHeader1":"PremiumLastSeenHeader1")}),(0,se.Y)("p",{className:cc,children:(0,Pt.A)(h(t?"PremiumReadText1":"PremiumLastSeenText1Locked",u),["simple_markdown"])}),(0,se.Y)(X.A,{onClick:t?p:v,className:dc,children:h(t?"PremiumReadButton1":"PremiumLastSeenButton1")}),(0,se.Y)(rc.A,{className:"sXXb5yOS",children:h("PremiumOr")}),(0,se.Y)("h2",{className:lc,children:h("PremiumReadHeader2")}),(0,se.Y)("p",{className:cc,children:(0,Pt.A)(h(t?"PremiumReadText2":"PremiumLastSeenText2",u),["simple_markdown"])}),(0,se.Y)(X.A,{withPremiumGradient:!0,onClick:g,className:dc,children:h("PremiumLastSeenButton2")})]})})}));var uc=i(97822),pc=i(24956),vc=i(31722);const gc="ItemPickerItem",Ac=(0,s.ph)(({className:e,isSearchable:t,searchInputId:i,items:n,filterValue:a,notFoundText:o,isLoading:l,noScrollRestore:c,filterPlaceholder:d,isViewOnly:h,itemInputType:m,itemClassName:u,withDefaultPadding:p,forceRenderAllItems:v,onFilterChange:g,onDisabledClick:A,onLoadMore:f,...C})=>{const b=(0,B.A)(),y=(0,s.li)(),S=C.allowMultiple,N=S?C.lockedSelectedValues:void 0,k=S?C.lockedUnselectedValues:void 0;(0,s.vJ)(()=>{t&&(0,r.YS)(()=>{(0,uc.A)(y.current)})},[t]);const w=(0,s.Kr)(()=>S?C.selectedValues:C.selectedValue?[C.selectedValue]:hi.p,[S,C.selectedValue,C.selectedValues]),I=(0,s.Kr)(()=>new Set(N),[N]),P=(0,s.Kr)(()=>new Set(k),[k]),Y=(0,s.Kr)(()=>{if(a)return n.map(e=>e.value);const e=[],t=[],i=[];return n.forEach(s=>{I.has(s.value)?e.push(s):P.has(s.value)?i.push(s):t.push(s)}),e.concat(t,i).map(e=>e.value)},[a,n,I,P]),F=(0,T.A)(e=>{if(S){const t=w.slice(),i=t.indexOf(e);return i>=0?t.splice(i,1):t.push(e),void C.onSelectedValuesChange?.(t)}C.onSelectedValueChange?.(e)}),[D,M]=(0,Ms.A)(f,Y,Boolean(v||a)),L=(0,T.A)(e=>{const{value:t}=e.currentTarget;g?.(t)}),R=(0,s.hb)(e=>{const t=n.find(t=>t.value===e);if(!t)return;const{label:i,subLabel:s,isLoading:a}=t,o=P.has(e),r=I.has(e),l=o||r,c=w.includes(e);return(0,se.Y)(Es.A,{className:(0,ge.A)(gc,u),title:i,subtitle:s,disabled:l,inactive:h,ripple:!0,inputElement:l?(0,se.Y)(he.A,{name:"lock-badge"}):"radio"===m?(0,se.Y)(pc.A,{checked:c,disabled:l,isLoading:a,onlyInput:!0}):"checkbox"===m?(0,se.Y)(js.A,{checked:c,disabled:l,isLoading:a,onlyInput:!0}):void 0,onClick:()=>F(e),onDisabledClick:A&&(()=>A(e,r))},e)},[n,P,I,w,h,A,m,u]);return(0,se.FD)("div",{className:(0,ge.A)(vc.A.container,e),children:[t&&(0,se.Y)("div",{className:(0,ge.A)(vc.A.header,"custom-scroll"),dir:b.isRtl?"rtl":void 0,children:(0,se.Y)(ee.A,{id:i,ref:y,value:a,onChange:L,placeholder:d||b("Search")})}),D?.length?(0,se.Y)(ls.A,{className:(0,ge.A)(vc.A.pickerList,p&&vc.A.padded,"custom-scroll"),items:D,itemSelector:`.${gc}`,onLoadMore:M,noScrollRestore:c,children:D.map(e=>R(e))}):l||!D||D.length?(0,se.Y)(Ls.A,{}):(0,se.Y)("p",{className:vc.A.noResults,children:o||b("SearchEmptyViewTitle")})]})}),fc={root:"wzzA3MFh",pickerSelector:"xhujrq9i",pickerTitle:"YuRK4e7S",picker:"YF9nLkCK",footer:"ATCZ2Q5G"},Cc=(0,s.ph)(({isOpen:e,onClose:t,onSubmit:i,countryList:a,selectionLimit:o})=>{const{showNotification:r}=(0,n.ko)(),l=(0,B.A)(),[c,d]=(0,s.J0)([]),h=(0,K.A)(c)===c,m=(0,s.Kr)(()=>a?a.filter(e=>!e.isHidden&&"FT"!==e.iso2).map(({iso2:e,defaultName:t})=>({value:e,label:t})):[],[a]),u=(0,T.A)(e=>{o&&e.length>o?r({message:l("BoostingSelectUpToWarningCountries",o)}):d(e)}),p=(0,T.A)(()=>{i(c),t()});return(0,se.FD)(te.A,{className:fc.root,isOpen:e,onClose:t,onEnter:p,hasAbsoluteCloseButton:!0,children:[(0,se.Y)("div",{className:fc.container,children:(0,se.Y)("div",{className:fc.pickerSelector,children:(0,se.Y)("h4",{className:fc.pickerTitle,children:l("BoostingSelectCountry")})})}),(0,se.Y)("div",{className:(0,ge.A)(fc.main,"custom-scroll"),children:(0,se.Y)(Ac,{className:fc.picker,items:m,selectedValues:c,onSelectedValuesChange:u,noScrollRestore:h,allowMultiple:!0,itemInputType:"checkbox"})}),(0,se.Y)("div",{className:fc.footer,children:(0,se.Y)(X.A,{onClick:p,children:l("SelectCountries.OK")})})]})});var bc=i(60406);const yc=1.5*g.$,Sc=(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,animationLevel:(0,Ys.lS)(e).animationLevel}})(({isOpen:e,reactors:t,reactions:i,chatId:o,messageId:r,seenByDates:c,availableReactions:d,animationLevel:h})=>{const{loadReactors:m,closeReactorListModal:u,openChat:p}=(0,n.ko)(),v=(0,n.mS)().chats.byId,g=(0,n.mS)().users.byId,A=(0,B.A)(),f=(0,Fi.A)(),[C,b,y]=(0,D.A)(!1),[S,N]=(0,s.J0)(void 0),k=t&&i&&t.count>=10&&i.results.length>1,w=(0,s.li)(),I=(0,s.li)(),P=(0,s.li)();(0,Ks.A)(I,!k||!e),(0,s.vJ)(()=>{e&&!C&&(w.current=void 0),C&&!e&&(y(),N(void 0))},[C,e,y]);const Y=(0,T.A)(()=>{w.current&&p({id:w.current}),u()}),F=(0,T.A)(()=>{b()}),M=(0,T.A)(e=>{w.current=e,F()}),L=(0,T.A)(()=>{m({chatId:o,messageId:r})}),R=(0,s.Kr)(()=>{const e=[];return t?.reactions?.forEach(({reaction:t})=>{e.some(e=>(0,l.a0)(e,t))||e.push(t)}),e},[t]),x=(0,s.Kr)(()=>S?R.findIndex(e=>(0,l.a0)(e,S))+1:0,[S,R]),E=(0,s.Kr)(()=>{if(S)return t?.reactions.filter(({reaction:e})=>(0,l.a0)(e,S)).map(({peerId:e})=>e);const e=Object.keys(c||{});return(0,di.Am)(t?.reactions.map(({peerId:e})=>e).concat(e||[])||[])},[S,t,c]),[V,_]=(0,Ms.A)(L,E,t&&void 0===t.nextOffset);return(0,bc.A)({containerRef:P,selector:".reactor-list"},[x,e]),(0,s.vJ)(()=>{_?.({direction:a.TN.Backwards})},[_]),(0,se.FD)(te.A,{isOpen:e&&!C,onClose:F,className:"ReactorListModal narrow",title:A("Reactions"),onCloseAnimationEnd:Y,isCondensedHeader:!0,hasCloseButton:!0,children:[k&&(0,se.FD)("div",{ref:I,className:(0,ge.A)("Reactions","no-scrollbar"),dir:f.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{color:S?"adaptive":"primary",size:"tiny",ripple:!0,iconName:"heart",className:S?"not-chosen-button":void 0,pill:!0,fluid:!0,onClick:()=>N(void 0),children:Boolean(t?.count)&&(0,Fn.Vw)(f,t.count)}),R.map(e=>{const t=i?.results.find(t=>(0,l.a0)(t.reaction,e))?.count,s=(0,l.a0)(S,e);return(0,se.FD)(X.A,{className:s?void 0:"not-chosen-button",color:s?"primary":"adaptive",size:"tiny",pill:!0,fluid:!0,ripple:!0,onClick:()=>N(e),children:[(0,se.Y)(us.A,{reaction:e,className:"reaction-filter-emoji",availableReactions:d,size:yc}),Boolean(t)&&(0,Fn.Vw)(f,t)]},(0,l.Jj)(e))})]}),(0,se.Y)("div",{ref:P,dir:f.isRtl?"rtl":void 0,className:"reactor-list-wrapper",children:(0,se.Y)(oe.Ay,{activeKey:x,name:(0,Fs.P)("slide",h,void 0,f.isRtl),children:V?.length?(0,se.Y)(ls.A,{className:"reactor-list custom-scroll",items:V,onLoadMore:_,children:V?.flatMap(e=>{const i=g[e]||v[e],s=t?.reactions.filter(t=>t.peerId===e),n=[],a=c?.[e];return s?.forEach(t=>{S&&!(0,l.a0)(t.reaction,S)||n.push((0,se.FD)(li.A,{className:"chat-item-clickable reactors-list-item",onClick:()=>M(e),children:[(0,se.Y)(Yt.A,{peer:i,size:"medium"}),(0,se.FD)("div",{className:"info",children:[(0,se.Y)(Rs.A,{peer:i,withEmojiStatus:!0}),(0,se.FD)("span",{className:"status",dir:"auto",children:[(0,se.Y)(he.A,{name:"heart-outline",className:"status-icon"}),(0,We.U)(A,1e3*t.addedDate)]})]}),t.reaction&&(0,se.Y)(us.A,{className:"reactors-list-emoji",reaction:t.reaction,availableReactions:d,size:yc})]},`${e}-${(0,l.Jj)(t.reaction)}`))}),S||s?.length||n.push((0,se.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>M(e),children:(0,se.Y)(ms.A,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:a?(0,We.U)(A,1e3*a):void 0,statusIcon:"message-read"})},`${e}-seen-by`)),n})}):(0,se.Y)(Ls.A,{})})})]})})),Nc=(0,s.ph)((0,n.EK)((e,{activeEmojiInteraction:t})=>{const i=void 0!==t.animatedEffect&&(0,c.Nr8)(e,t.animatedEffect);return{effectAnimationId:i?i.id:void 0}})(({effectAnimationId:e,activeEmojiInteraction:t})=>{const{stopActiveEmojiInteraction:i}=(0,n.ko)(),[a,o]=(0,D.A)(!1),[r,l]=(0,D.A)(!1),c=(0,s.li)(),d=(0,T.A)(()=>{o(),c.current&&clearTimeout(c.current),setTimeout(()=>{i({id:t.id})},250)}),h=(0,T.A)(e=>{e.target?.closest(".AnimatedEmoji")||d()});(0,s.vJ)(()=>(document.addEventListener("touchstart",h),document.addEventListener("touchmove",h),document.addEventListener("mousedown",h),document.addEventListener("wheel",h),()=>{document.removeEventListener("touchstart",h),document.removeEventListener("touchmove",h),document.removeEventListener("mousedown",h),document.removeEventListener("wheel",h)}),[h]),(0,s.Nf)(()=>{const e=(0,s.VK)();c.current=setTimeout(()=>{d(),e()},3e3)},[d]);const u=e&&`sticker${e}`,p=(0,q.A)(u,!e);if(!t.startSize)return;const v=(t.startSize||0)/309;return(0,se.Y)("div",{className:(0,ge.A)("EmojiInteractionAnimation",a&&"hiding",r&&"playing",t.isReversed&&"reversed"),style:`--scale: ${v}; --start-x: ${t.x}px; --start-y: ${t.y}px;`,children:(0,se.Y)(La.A,{size:309,tgsUrl:p,play:!0,quality:m.Ni?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:l},`effect_${e}`)})})),kc=(0,s.ph)((0,n.EK)(e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).chatLanguageModal||{},s=(0,c.wmb)(e);return{chatId:t,messageId:i,activeTranslationLanguage:t?i?(0,c.Rny)(e,t,i):(0,c.qZq)(e,t):void 0,currentLanguageCode:s}})(({isOpen:e,chatId:t,messageId:i,activeTranslationLanguage:a,currentLanguageCode:r})=>{const{requestMessageTranslation:l,closeChatLanguageModal:c,setSettingOption:d,requestChatTranslation:h}=(0,n.ko)(),[m,u]=(0,s.J0)(""),p=(0,B.A)(),v=(0,T.A)(e=>{t&&(i?l({chatId:t,id:i,toLanguageCode:e}):(d({translationLanguage:e}),h({chatId:t,toLanguageCode:e})),c())}),g=(0,T.A)(e=>{u(e.target.value)}),A=(0,s.Kr)(()=>o.N89.map(e=>({langCode:e,translatedName:new Intl.DisplayNames([r],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})),[r]);(0,s.vJ)(()=>{e||u("")},[e]);const f=(0,s.Kr)(()=>m.trim()?A.filter(({langCode:e,translatedName:t,originalName:i})=>t.toLowerCase().includes(m.toLowerCase())||i.toLowerCase().includes(m.toLowerCase())||e.toLowerCase().includes(m.toLowerCase())):A,[A,m]);return(0,se.FD)(te.A,{className:"aMjNU9gm",isSlim:!0,isOpen:e,hasCloseButton:!0,title:p("Language"),onClose:c,children:[(0,se.Y)(ee.A,{value:m,onChange:g,placeholder:p("Search"),teactExperimentControlled:!0},"search"),(0,se.Y)("div",{className:(0,ge.A)("r3YNWDQr","custom-scroll"),children:f.map(({langCode:e,originalName:t,translatedName:i})=>(0,se.FD)(li.A,{className:(0,ge.A)("T3An6Hoz","no-icon"),secondaryIcon:a===e?"check":void 0,disabled:a===e,multiline:!0,narrow:!0,onClick:()=>v(e),children:[(0,se.Y)("span",{className:(0,ge.A)("title","dQ9wwFu1"),children:(0,Pt.A)(t,["highlight"],{highlight:m})}),(0,se.Y)("span",{className:(0,ge.A)("subtitle","m_J41YYl"),children:(0,Pt.A)(i,["highlight"],{highlight:m})})]},e))})]})}));var wc=i(85982),Ic=i(24899);const Pc={content:"WEJIbFQj",closeButton:"_vwPuDEM",icon:"BUiGM8qZ",title:"Q3NhXpNI",description:"frZbGQ0G"},Yc=(0,s.ph)((0,n.EK)(e=>{const{countryList:t}=e;return{phoneCodeList:t.phoneCodes}})(({modal:e,phoneCodeList:t})=>{const{closeCollectibleInfoModal:i,openChat:a,openUrl:o,showNotification:r}=(0,n.ko)(),l=(0,B.A)(),c="username"===e?.type,d=(0,T.A)(()=>{i()}),h=(0,T.A)(()=>{a({id:e.peerId}),d()}),m=(0,T.A)(()=>{o({url:e.url}),d()}),u=(0,T.A)(()=>{const i=c?(0,Ic.A)(e.collectible):(0,tn.Ox)(t,e.collectible);(0,wc.eM)(i),r({message:l(c?"UsernameCopied":"PhoneCopied")}),d()}),p=(0,s.Kr)(()=>{if(!e)return;const i=c?"FragmentUsernameTitle":"FragmentPhoneTitle",s=c?(0,Ic.A)(e.collectible):(0,tn.Ox)(t,e.collectible);return l(i,s)},[e,c,t,l]),v=(0,s.Kr)(()=>{if(!e)return;const t=c?"FragmentUsernameMessage":"FragmentPhoneMessage",i=(0,We.U)(l,1e3*e.purchaseDate),s=(0,va.Ad)(e.amount,e.currency,l.code),n=(0,va.Ad)(e.cryptoAmount,e.cryptoCurrency,l.code);return l(t,[i,`${n} (${s})`])},[e,c,l]);return(0,se.FD)(te.A,{isOpen:Boolean(e),isSlim:!0,contentClassName:Pc.content,onClose:i,hasAbsoluteCloseButton:!0,children:[(0,se.Y)("div",{className:Pc.icon,children:(0,se.Y)(Ma.A,{tgsUrl:c?Da.w.Mention:Da.w.Fragment,size:60})}),(0,se.Y)("h3",{className:Pc.title,children:p&&(0,Pt.A)(p,["simple_markdown"])}),(0,se.Y)(Ps.A,{className:Pc.chip,peerId:e?.peerId,forceShowSelf:!0,clickArg:e?.peerId,onClick:h}),(0,se.Y)("p",{className:Pc.description,children:v&&(0,Pt.A)(v,["simple_markdown"])}),(0,se.FD)("div",{className:"dialog-buttons dialog-buttons-centered",children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",onClick:m,children:l("FragmentUsernameOpen")}),(0,se.Y)(X.A,{isText:!0,className:"confirm-dialog-button",onClick:u,children:l(c?"FragmentUsernameCopy":"FragmentPhoneCopy")})]})]})}));var Fc=i(22191),Dc=i(57309);function Mc(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,Ys.lS)(t),h="audio"!==e?e:i?.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=r?.[h]?.foundIds,p=s.activeDownloads;return{theme:(0,c.SJA)(t),isLoading:void 0===u||!!o&&Boolean(o.chats||o.messages),chatsById:n,usersById:a,globalMessagesByChatId:m,foundIds:u,searchChatId:l,activeDownloads:p,isChatProtected:l?(0,c.hds)(t,l)?.isProtected:void 0,shouldWarnAboutFiles:d}}}var Tc=i(55429),Bc=i(65240),Lc=i(42827);const Rc=(0,Ce.nF)(e=>e(),500,!0),xc=(0,s.ph)((0,n.EK)(Mc("audio"))(({theme:e,isVoice:t,searchQuery:i,isLoading:r,chatsById:c,usersById:d,globalMessagesByChatId:h,foundIds:m,activeDownloads:u})=>{const{searchMessagesGlobal:p,focusMessage:v,openAudioPlayer:g}=(0,n.ko)(),A=(0,B.A)(),f=t?"voice":"audio",C=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Rc(()=>{p({type:f})})},[f,p,i]),b=(0,s.Kr)(()=>m&&h?m.map(e=>{const[t,i]=(0,Dc.a)(e);return h[t]?.byId[i]}).filter(Boolean):hi.p,[h,m]),y=(0,s.hb)(e=>{v({chatId:e.chatId,messageId:e.id})},[v]),S=(0,s.hb)((e,t)=>{g({chatId:t,messageId:e})},[g]),N=(0,cr.A)([i],o.jhd)&&!r;return(0,se.Y)(oe.Ay,{slideClassName:"LeftSearch--content",name:"fade",activeKey:N?1:0,shouldCleanup:!0,children:(0,se.FD)(ls.A,{className:"search-content documents-list custom-scroll",items:N?b:void 0,onLoadMore:C,noFastList:!0,children:[!N&&(0,se.Y)(Ls.A,{}),N&&(!m||0===m.length)&&(0,se.Y)(Lc.A,{withSticker:!0,text:A("ChatList.Search.NoResults"),description:A("ChatList.Search.NoResultsDescription")}),N&&m&&m.length>0&&b.map((t,i)=>{const s=(0,n.mS)(),o=0===i||(0,We.$$)(t.date)!==(0,We.$$)(b[i-1].date),r=(0,Le.iS)(s,t);return(0,se.FD)(se.FK,{children:[o&&(0,se.Y)("p",{className:"section-heading",dir:A.isRtl?"rtl":void 0,children:(0,We.i6)(A,new Date(1e3*t.date))},t.date),(0,se.Y)("div",{className:"ListItem small-icon",children:(0,se.Y)(Bc.Ay,{theme:e,message:t,origin:a.d9.Search,senderTitle:(0,Tc.N)(A,t,c,d),date:t.date,className:"scroll-item",onPlay:S,onDateClick:y,canDownload:!c[t.chatId]?.isProtected&&!t.isProtected,isDownloading:(0,l.$r)(u,r)},t.id)},t.id)]})})]})})}));var Ec=i(27109),Vc=i(75956),_c=i(47067);const Uc=e=>{const t=(0,s.li)(),i=(0,T.A)(i=>{"Enter"===i.key&&t.current===document.activeElement&&e()});return(0,s.vJ)(()=>(window.addEventListener("keydown",i,!1),()=>window.removeEventListener("keydown",i,!1)),[]),t};var Oc=i(97967),Kc=i(97046);const Jc=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.mBe)(e,t),n=(0,c.D3D)(e,t),a=i&&(0,Ec.If)(i,(0,c.K52)(e),(0,c.P5N)(e,i.id)),o=(0,c.xyP)(e,t)?.listedTopicIds;return{chat:i,user:s,isPinned:n,isMuted:a,canChangeFolder:Boolean(e.chatFolders.orderedIds?.length),listedTopicIds:o}})(({chatId:e,withUsername:t,chat:i,user:r,listedTopicIds:l,isPinned:c,isMuted:d,canChangeFolder:h,withOpenAppButton:m,onClick:u})=>{const{requestMainWebView:p,updateChatMutedState:g,openQuickPreview:A}=(0,n.ko)(),f=(0,Fi.A)(),[C,b,y]=(0,D.A)(),[S,N,k]=(0,D.A)(),[w,I,P]=(0,D.A)(),[Y,F,M]=(0,D.A)(),B=(0,s.hb)(()=>{I(),N()},[I,N]),L=(0,s.hb)(()=>{F(),b()},[F,b]),R=(0,T.A)(()=>{g({chatId:e,mutedUntil:o.Os5})}),x=(0,_c.A)({chat:i,user:r,isPinned:c,isMuted:d,canChangeFolder:h,topicIds:l,handleMute:L,handleUnmute:R,handleChatFolderChange:B},!0),E=(0,T.A)(t=>{if(t.altKey&&i&&!i.isForum)return t.preventDefault(),void A({id:e});u(e)}),V=(0,T.A)(t=>{t.stopPropagation();const i=(0,Dn.A)();p({botId:e,peerId:e,theme:i})}),_=(0,T.A)(t=>{t.preventDefault(),(0,Vc.W)(()=>{u(e)},!0)}),U=Uc(()=>{u(e)});return(0,se.FD)(li.A,{className:"chat-item-clickable search-result",contextActions:x,buttonRef:U,onClick:E,onDragEnter:_,onDragLeave:Vc.d,children:[(0,v.L8)(e)?(0,se.Y)(ms.A,{userId:e,withUsername:t,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,se.Y)(hs.A,{chatId:e,withUsername:t,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),m&&r?.hasMainMiniApp&&(0,se.Y)(X.A,{className:"search-result-miniapp-button",pill:!0,fluid:!0,size:"tiny",onClick:V,children:f("BotChatMiniAppOpen")}),Y&&(0,se.Y)(Kc.A,{isOpen:C,onClose:y,onCloseAnimationEnd:M,chatId:e}),w&&(0,se.Y)(Oc.A,{isOpen:S,onClose:k,onCloseAnimationEnd:P,chatId:e})]})})),Gc=(0,Ce.nF)(e=>e(),500,!0),jc=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}})(({searchQuery:e,isLoading:t,foundIds:i,recentBotIds:r})=>{const{searchPopularBotApps:l,openChatWithInfo:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,B.A)(),[m,u]=(0,s.J0)(!1),p=(0,s.Kr)(()=>{if(!i)return[];const t=new Set(r),s=i.filter(e=>!t.has(e));return(0,It.PU)({ids:s,query:e,type:"user"})},[i,r,e]),v=(0,T.A)(e=>{c({id:e,shouldReplaceHistory:!0})}),g=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Gc(()=>{l()})},[]),A=(0,T.A)(()=>{u(e=>!e)}),f=(0,cr.A)([e],o.jhd)&&!t;return(0,se.Y)(oe.Ay,{ref:d,slideClassName:"LeftSearch--content",name:"fade",activeKey:f?1:0,shouldCleanup:!0,children:(0,se.FD)(ls.A,{className:"search-content custom-scroll",items:f?p:void 0,onLoadMore:g,noFastList:!0,children:[!f&&(0,se.Y)(Ls.A,{}),f&&!p?.length&&(0,se.Y)(Lc.A,{withSticker:!0,text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),f&&!e&&Boolean(r?.length)&&(0,se.FD)("div",{className:"search-section",children:[(0,se.FD)("h3",{className:"section-heading",children:[r.length>5&&(0,se.Y)(Mo.A,{className:"Link",onClick:A,children:h(m?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),h("SearchAppsMine")]}),r.map((e,t)=>{if(m||!(t>=5))return(0,se.Y)(Jc,{chatId:e,onClick:v,withOpenAppButton:!0})})]}),f&&Boolean(p?.length)&&(0,se.FD)("div",{className:"search-section",children:[(0,se.Y)("h3",{className:"section-heading",children:h("SearchAppsPopular")}),p.map(e=>(0,se.Y)(Jc,{chatId:e,onClick:v,withOpenAppButton:!0}))]})]})})}));var zc=i(35749),Hc=i(2338);function $c(e,t,i,s,n){if(!i)return(0,A.C)(e,t,void 0,s);const a=(0,l.y2)(t);return(0,se.FD)("span",{className:"media-preview",children:[(0,se.Y)("img",{src:i,alt:"",className:(0,ge.A)("media-preview--image",n&&"round",a&&"media-preview-spoiler"),draggable:!1}),(0,l.zX)(t)&&(0,se.Y)(he.A,{name:"play"}),(0,A.C)(e,t,!0,s)]})}const qc=(0,s.ph)((0,n.EK)((e,{chatId:t})=>({peer:(0,c.PVB)(e,t)}))(({message:e,searchQuery:t,chatId:i,peer:s})=>{const{focusMessage:a}=(0,n.ko)(),{isMobile:o}=(0,Y.Ay)(),r=(0,Hc.A)(e),c=(0,l.fP)(e)?void 0:r,d=(0,zc.A)(e,"micro"),h=(0,q.A)(d),m=Boolean((0,l.lk)(e)),u=(0,T.A)(()=>{a({chatId:i,messageId:e.id,shouldReplaceHistory:!0})}),p=(0,Fi.A)(),v=(0,B.A)(),g=Uc(u);if(!s)return;const A=(0,It.mO)(s)?s:void 0;return(0,se.FD)(li.A,{className:"ChatMessage chat-item-clickable",ripple:!o,onClick:u,buttonRef:g,children:[(0,se.Y)(Yt.A,{peer:s,isSavedMessages:A?.isSelf}),(0,se.FD)("div",{className:"info",children:[(0,se.FD)("div",{className:"info-row",children:[(0,se.Y)(Rs.A,{peer:s,withEmojiStatus:!0,isSavedMessages:A?.isSelf}),(0,se.Y)("div",{className:"message-date",children:(0,se.Y)(Mo.A,{className:"date",children:(0,We.be)(v,1e3*e.date)})})]}),(0,se.Y)("div",{className:"subtitle",children:(0,se.Y)("div",{className:"message",dir:"auto",children:$c(p,e,h||c,t,m)})})]})]})})),Wc=(0,s.ph)(({searchDate:e,onSelect:t})=>{const i=(0,s.Kr)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,We.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,We.A)(s)})}return t}(e),[e]);return(0,se.Y)("section",{className:"DateSuggest custom-scroll custom-scroll-x",children:i.map(({date:e,text:i})=>(0,se.FD)("div",{onClick:()=>t(e),className:"date-item",children:[(0,se.Y)(he.A,{name:"calendar"}),(0,se.Y)("span",{children:i})]},i))})}),Qc=2*g.$,Zc=(0,s.ph)((0,n.EK)((e,{chatId:t,topicId:i})=>({topic:(0,c.S0q)(e,t,i)}))(({chatId:e,topicId:t,topic:i,onClick:a})=>{const{openQuickPreview:o}=(0,n.ko)(),r=(0,s.hb)(i=>{if(i.altKey)return i.preventDefault(),void o({id:e,threadId:t});a(t)},[e,t,a,o]),l=Uc(()=>a(t));if(i)return(0,se.FD)(li.A,{className:"chat-item-clickable search-result",onClick:r,buttonClassName:"topic-item",buttonRef:l,children:[(0,se.Y)(xs.A,{size:Qc,topic:i,className:"topic-icon",letterClassName:"topic-icon-letter"}),(0,se.Y)("div",{dir:"auto",className:"fullName",children:(0,Pt.A)(i.title)})]})})),Xc=(0,Ce.nF)(e=>e(),500,!0),ed=(0,s.ph)((0,n.EK)(e=>{const{byId:t}=e.chats,{currentUserId:i,messages:{byChatId:s}}=e,{fetchingStatus:n,resultsByType:a,foundTopicIds:o,chatId:r}=(0,c.nTw)(e).globalSearch,{foundIds:l}=a?.text||{};return{currentUserId:i,foundIds:l,globalMessagesByChatId:s,chatsById:t,fetchingStatus:n,foundTopicIds:o,searchChatId:r}})(({searchQuery:e,dateSearchQuery:t,foundIds:i,globalMessagesByChatId:o,chatsById:r,fetchingStatus:l,foundTopicIds:c,searchChatId:d,onSearchDateSelect:h,onReset:m})=>{const{searchMessagesGlobal:u,openThread:p}=(0,n.ko)(),v=(0,Fi.A)(),{isMobile:g}=(0,Y.Ay)(),f=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&Xc(()=>{u({type:"text"})})},[e]),C=(0,s.hb)(e=>{d&&(p({chatId:d,threadId:e,shouldReplaceHistory:!0}),g||m())},[d,g,m]),b=(0,s.Kr)(()=>i&&0!==i.length?i.map(e=>{const[t,i]=(0,Dc.a)(e);return o?.[t]?.byId[i]}).filter(Boolean).sort((e,t)=>t.date-e.date):hi.p,[i,o]),y=l&&!l.chats&&!l.messages&&!b.length&&!c?.length;return(0,se.Y)("div",{className:"LeftSearch--content",children:(0,se.FD)(ls.A,{className:"search-content custom-scroll chat-list",items:b,onLoadMore:f,noFastList:!0,children:[t&&(0,se.Y)("div",{className:"chat-selection no-scrollbar",children:(0,se.Y)(Wc,{searchDate:t,onSelect:h})}),y&&(0,se.Y)(Lc.A,{withSticker:!0,text:v("ChatListSearchNoResults"),description:v("ChatListSearchNoResultsDescription")}),Boolean(c?.length)&&(0,se.FD)("div",{className:"pb-2",children:[(0,se.Y)("h3",{className:"section-heading topic-search-heading",dir:v.isRtl?"auto":void 0,children:v("SearchResultTopics")}),c.map(e=>(0,se.Y)(Zc,{chatId:d,topicId:e,onClick:C}))]}),Boolean(b.length)&&(0,se.FD)("div",{className:"pb-2",children:[(0,se.Y)("h3",{className:"section-heading topic-search-heading",dir:v.isRtl?"auto":void 0,children:v("SearchMessages")}),b.map(function(t){const i=(0,A.C)(v,t),s=r[t.chatId];if(i&&s)return(0,se.Y)(qc,{chatId:t.chatId,message:t,searchQuery:e})})]})]})})}));var td=i(49763),id=i(81949);const sd=(0,s.ph)(({sponsoredPeer:e,observeIntersection:t})=>{const i=(0,s.li)(),{clickSponsored:o,viewSponsored:r,openChat:l}=(0,n.ko)(),c=(0,Fi.A)(),{peerId:d,randomId:h,additionalInfo:m,sponsorInfo:u}=e;(0,hr.mv)(i,t,e=>{1===e.intersectionRatio&&r({randomId:h})});const p=(0,T.A)(()=>{o({randomId:h}),l({id:d})}),{isContextMenuOpen:g,contextMenuAnchor:A,handleBeforeContextMenu:f,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:y}=(0,cn.A)(i),{handleClick:S,handleMouseDown:N}=(0,Ki.Q)(e=>{e.stopPropagation(),C(e)}),k=Uc(p);return(0,se.FD)(li.A,{ref:i,className:"chat-item-clickable search-result",onClick:p,onMouseDown:f,onContextMenu:C,buttonRef:k,children:[(0,v.L8)(d)?(0,se.Y)(ms.A,{userId:d,withUsername:!0,withStory:!0,avatarSize:"medium",storyViewerOrigin:a.G9.SearchResult}):(0,se.Y)(hs.A,{chatId:d,withUsername:!0,avatarSize:"medium",withStory:!0,storyViewerOrigin:a.G9.SearchResult}),(0,se.FD)(id.A,{className:"search-sponsored-badge",onMouseDown:N,onClick:S,children:[c("SponsoredPeerBadge"),(0,se.Y)(he.A,{name:"more"})]}),A&&(0,se.Y)(bl.A,{isOpen:g,anchor:A,triggerRef:i,randomId:h,additionalInfo:m,canReport:!0,sponsorInfo:u,onClose:b,onCloseAnimationEnd:y})]})}),nd=(0,Ce.nF)(e=>e(),6e4,!0),ad=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.topPeers,i=e.users.byId,{recentlyFoundChatIds:s}=e;return{topUserIds:t,usersById:i,recentlyFoundChatIds:s}})(({topUserIds:e,usersById:t,recentlyFoundChatIds:i,onReset:a})=>{const{loadTopUsers:o,openChat:r,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,n.ko)(),h=(0,s.li)();(0,s.vJ)(()=>{nd(()=>{o()})},[o]),(0,Ks.A)(h,!e);const m=(0,s.hb)(e=>{r({id:e,shouldReplaceHistory:!0}),a(),setTimeout(()=>{c({id:e})},250)},[r,c,a]),u=(0,s.hb)(()=>{d()},[d]),p=(0,B.A)();return(0,se.FD)("div",{className:"RecentContacts custom-scroll",children:[e&&(0,se.Y)("div",{className:"top-peers-section",dir:p.isRtl?"rtl":void 0,children:(0,se.Y)("div",{ref:h,className:"top-peers",children:e.map(e=>(0,se.FD)("div",{className:"top-peer-item",onClick:()=>m(e),dir:p.isRtl?"rtl":void 0,children:[(0,se.Y)(Yt.A,{peer:t[e]}),(0,se.Y)("div",{className:"top-peer-name",children:(0,Pt.A)((0,l.u0)(t[e])||" ")})]},e))})}),i&&(0,se.FD)("div",{className:"search-section pt-1",children:[(0,se.FD)("h3",{className:(0,ge.A)("section-heading mt-0 recent-chats-header",!e&&"without-border"),dir:p.isRtl?"rtl":void 0,children:[p("Recent"),(0,se.Y)(X.A,{className:"clear-recent-chats",round:!0,size:"smaller",color:"translucent",ariaLabel:p("Clear"),onClick:u,isRtl:p.isRtl,iconName:"close"})]}),i.map(e=>(0,se.Y)(Jc,{chatId:e,withOpenAppButton:!0,onClick:m}))]})]})})),od=(0,Ce.nF)(e=>e(),500,!1),rd=(0,s.ph)((0,n.EK)((e,{isChannelList:t})=>{const{userIds:i}=e.contactList||{},{currentUserId:s,messages:n}=e;if(!i)return{};const{fetchingStatus:a,globalResults:r,localResults:l,resultsByType:d,sponsoredPeer:h}=(0,c.nTw)(e).globalSearch,{peerIds:m}=r||{},{peerIds:u}=l||{},{byChatId:p}=n,v=d?.[t?"channels":"text"]?.foundIds,{similarChannelIds:g}=(0,c.dg4)(e,o.rBM)||{};return{currentUserId:s,contactIds:i,accountPeerIds:u,globalPeerIds:m,foundIds:v,globalMessagesByChatId:p,fetchingStatus:a,sponsoredPeer:h,suggestedChannelIds:g}})(({isChannelList:e,searchQuery:t,searchDate:i,dateSearchQuery:r,currentUserId:c,contactIds:d,accountPeerIds:h,globalPeerIds:m,foundIds:u,globalMessagesByChatId:p,fetchingStatus:v,suggestedChannelIds:g,sponsoredPeer:f,onReset:C,onSearchDateSelect:b})=>{const{openChat:y,addRecentlyFoundChatId:S,searchMessagesGlobal:N,setGlobalSearchChatId:k,loadChannelRecommendations:w}=(0,n.ko)(),I=(0,s.li)(),P=(0,s.li)(),F=(0,Fi.A)(),{isMobile:D}=(0,Y.Ay)(),[M,B]=(0,s.J0)(!1),[L,R]=(0,s.J0)(!1),[x,E]=(0,s.J0)("all"),V=(0,s.li)();(0,ke.A)(()=>{e&&w({})});const _=(0,s.hb)(({direction:t})=>{t===a.TN.Backwards&&od(()=>{N({type:e?"channels":"text",context:x})})},[t,x]),U=(0,s.hb)(e=>{y({id:e,shouldReplaceHistory:!0}),e!==c&&S({id:e}),D||C()},[y,c,D,S,C]),O=(0,s.hb)(e=>{k({id:e})},[k]);function K(e){return F("users"===e?"PrivateChatsSearchContext":"groups"===e?"GroupChatsSearchContext":"channels"===e?"ChannelsSearchContext":"AllChatsSearchContext")}const{isContextMenuOpen:J,contextMenuAnchor:G,handleContextMenu:j,handleContextMenuClose:z,handleContextMenuHide:H}=(0,cn.A)(V),$=(0,T.A)(()=>V.current),q=(0,T.A)(()=>V.current.querySelector(".chatResultsContextMenu .bubble")),W=(0,T.A)(()=>V.current.querySelector(".menuTrigger")),Q=(0,T.A)(e=>{j(e)}),Z=(0,ge.A)("icon","iconPlaceholder"),X=(0,s.Kr)(()=>{if(!e&&(!t||t.startsWith("@")&&t.length<2))return hi.p;const i=(0,n.mS)().chats.byId,s=((0,td.YA)(o.DSF)??[]).filter(t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)}),a=(0,It.PU)({ids:s,query:t,type:"chat"});if(e)return a;const r=[...c?[c]:[],...d||[]],m=[...(0,It.PU)({ids:r,query:t,type:"user"}),...a];return(0,di.Am)([...(0,Ss.A)(m,void 0,c?[c]:void 0),...(0,Ss.A)(h||[])])},[t,c,d,h,e]);(0,Ks.A)(P,!X.length||e,!0);const ee=(0,s.Kr)(()=>{if(!t||t.length<4||!m)return hi.p;const i=(0,n.mS)().chats.byId,s=m.filter(t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)});return(0,Ss.A)(s,!0)},[m,e,t]),te=(0,s.Kr)(()=>{if(!t&&!i||!u||0===u.length)return hi.p;const s=(0,n.mS)().chats.byId;return u.map(t=>{const[i,n]=(0,Dc.a)(t),a=s[i];if(a&&(!e||(0,l.WX)(a)))return p?.[i]?.byId[n]}).filter(Boolean)},[t,i,u,e,p]);(0,s.vJ)(()=>{t&&N({type:e?"channels":"text",context:x,shouldResetResultsByType:!0,shouldCheckFetchingMessagesStatus:!0})},[x]);const ie=(0,s.hb)(()=>{B(!M)},[M]),ne=(0,s.hb)(()=>{R(!L)},[L]),ae=te,re="all"===x&&v&&!v.chats&&!v.messages&&!X.length&&!ee.length&&!ae.length,le=v?.messages,ce=!t&&!i&&!e,{observe:de}=(0,hr.BL)({rootRef:I,throttleMs:200,isDisabled:!ce});if(ce)return(0,se.Y)(ad,{onReset:C});const me="all"!==x||Boolean(ae.length);return(0,se.FD)(ls.A,{ref:I,className:"LeftSearch--content custom-scroll",items:ae,onLoadMore:_,noScrollRestoreOnTop:!0,noFastList:!0,children:[r&&(0,se.Y)("div",{className:"chat-selection no-scrollbar",children:(0,se.Y)(Wc,{searchDate:r,onSelect:b})}),re&&(0,se.Y)(Lc.A,{withSticker:!0,text:F("ChatListSearchNoResults"),description:F("ChatListSearchNoResultsDescription")}),Boolean(X.length)&&!e&&(0,se.Y)("div",{className:"chat-selection no-scrollbar",dir:F.isRtl?"rtl":void 0,ref:P,children:X.map(e=>(0,se.Y)(Ps.A,{peerId:e,className:"left-search-local-suggestion",onClick:O,clickArg:e}))}),Boolean(X.length)&&(0,se.FD)("div",{className:"search-section",children:[(0,se.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[X.length>5&&(0,se.Y)(Mo.A,{className:"Link",onClick:ie,children:F(M?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F(e?"SearchResultMyChannels":"DialogListSearchSectionDialogs")]}),X.map((e,t)=>{if(M||!(t>=5))return(0,se.Y)(Jc,{withOpenAppButton:!0,chatId:e,onClick:U})})]}),Boolean(ee.length)&&(0,se.FD)("div",{className:"search-section",children:[(0,se.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[ee.length>5&&(0,se.Y)(Mo.A,{className:"Link",onClick:ne,children:F(L?"ChatListSearchShowLess":"ChatListSearchShowMore")}),F("DialogListSearchSectionGlobal")]}),f&&(0,se.Y)(sd,{sponsoredPeer:f,observeIntersection:de}),ee.map((e,t)=>{if(L||!(t>=5))return(0,se.Y)(Jc,{chatId:e,withUsername:!0,onClick:U})})]}),Boolean(g?.length)&&!t&&(0,se.FD)("div",{className:"search-section",children:[(0,se.Y)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:F("SearchResultRecommendedChannels")}),g.map(e=>(0,se.Y)(Jc,{chatId:e,withUsername:!0,onClick:U}))]}),(0,se.FD)("div",{className:"menuOwner",ref:V,children:[(0,se.Y)(Ze.A,{isOpen:J,anchor:G,getTriggerElement:W,getRootElement:$,getMenuElement:q,className:"chatResultsContextMenu",onClose:z,onCloseAnimationEnd:H,autoClose:!0,children:(0,se.FD)(se.FK,{children:[(0,se.Y)(ue.A,{icon:"all"===x?"check":void 0,customIcon:"all"!==x?(0,se.Y)("i",{className:Z}):void 0,onClick:()=>E("all"),children:K("all")}),(0,se.Y)(ue.A,{icon:"users"===x?"check":void 0,customIcon:"users"!==x?(0,se.Y)("i",{className:Z}):void 0,onClick:()=>E("users"),children:K("users")}),(0,se.Y)(ue.A,{icon:"groups"===x?"check":void 0,customIcon:"groups"!==x?(0,se.Y)("i",{className:Z}):void 0,onClick:()=>E("groups"),children:K("groups")}),(0,se.Y)(ue.A,{icon:"channels"===x?"check":void 0,customIcon:"channels"!==x?(0,se.Y)("i",{className:Z}):void 0,onClick:()=>E("channels"),children:K("channels")})]})}),me&&(0,se.FD)("div",{className:"search-section",children:[(0,se.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[!e&&(0,se.FD)(Mo.A,{className:"Link menuTrigger dropDownLink",onClick:Q,children:[F("SearchContextCaption",{type:K(x)},{withNodes:!0}),(0,se.FD)(oe.Ay,{name:"fade",shouldCleanup:!0,activeKey:Number(le),className:"iconContainer",slideClassName:"iconContainerSlide",children:[le&&(0,se.Y)(Ls.A,{}),!le&&(0,se.Y)(he.A,{name:"down"})]})]}),F("SearchMessages")]}),ae.map(function(e){const i=(0,n.mS)().chats.byId,s=(0,A.C)(F,e),a=i[e.chatId];if(s&&a)return(0,se.Y)(qc,{chatId:e.chatId,message:e,searchQuery:t})})]})]})]})}));var ld=i(55723);const cd="documents",dd=(0,Ce.nF)(e=>e(),500,!0),hd=(0,s.ph)((0,n.EK)(Mc(cd))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:c,foundIds:d,activeDownloads:h,shouldWarnAboutFiles:m})=>{const{searchMessagesGlobal:u,focusMessage:p}=(0,n.ko)(),v=(0,s.li)(),g=(0,B.A)(),{observe:A}=(0,hr.BL)({rootRef:v,throttleMs:500}),f=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&dd(()=>{u({type:cd})})},[e]),C=(0,s.Kr)(()=>d&&c?d.map(e=>{const[t,i]=(0,Dc.a)(e),s=c[t]?.byId[i];return s&&(0,l.zC)(s)?s:void 0}).filter(Boolean):hi.p,[c,d]),b=(0,s.hb)(e=>{p({chatId:e.chatId,messageId:e.id})},[p]),y=(0,cr.A)([e],o.jhd)&&!t;return(0,se.Y)(oe.Ay,{ref:v,slideClassName:"LeftSearch--content",name:"fade",activeKey:y?1:0,shouldCleanup:!0,children:(0,se.FD)(ls.A,{className:"search-content documents-list custom-scroll",items:y?C:void 0,onLoadMore:f,noFastList:!0,children:[!y&&(0,se.Y)(Ls.A,{}),y&&(!d||0===d.length)&&(0,se.Y)(Lc.A,{withSticker:!0,text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),y&&d&&d.length>0&&C.map((e,t)=>{const s=0===t||(0,We.$$)(e.date)!==(0,We.$$)(C[t-1].date);return(0,se.FD)(se.FK,{children:[s&&(0,se.Y)("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0,children:(0,We.i6)(g,new Date(1e3*e.date))},e.date),(0,se.Y)("div",{className:"ListItem small-icon",children:(0,se.Y)(ld.A,{document:(0,l.zC)(e),message:e,datetime:e.date,fileSize:"small",sender:(0,Tc.N)(g,e,i,r),className:"scroll-item",isDownloading:(0,l.$r)(h,e.content.document),shouldWarnAboutFiles:m,observeIntersection:A,onDateClick:b})},e.id)]})})]})})}));var md=i(37378);const ud="links",pd=(0,Ce.nF)(e=>e(),500,!0),vd=(0,s.ph)((0,n.EK)(Mc(ud))(({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:l,foundIds:c,isChatProtected:d})=>{const{searchMessagesGlobal:h,focusMessage:m}=(0,n.ko)(),u=(0,s.li)(),p=(0,B.A)(),{observe:v}=(0,hr.BL)({rootRef:u,throttleMs:500}),g=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&pd(()=>{h({type:ud})})},[e]),A=(0,s.Kr)(()=>c&&l?c.map(e=>{const[t,i]=(0,Dc.a)(e);return l[t]?.byId[i]}).filter(Boolean):hi.p,[l,c]),f=(0,s.hb)(e=>{m({chatId:e.chatId,messageId:e.id})},[m]),C=(0,cr.A)([e],o.jhd)&&!t;return(0,se.Y)(oe.Ay,{ref:u,slideClassName:"LeftSearch--content",name:"fade",activeKey:C?1:0,shouldCleanup:!0,children:(0,se.FD)(ls.A,{className:"search-content documents-list custom-scroll",items:C?A:void 0,onLoadMore:g,noFastList:!0,children:[!C&&(0,se.Y)(Ls.A,{}),C&&(!c||0===c.length)&&(0,se.Y)(Lc.A,{withSticker:!0,text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),C&&c&&c.length>0&&A.map((e,t)=>{const s=0===t||(0,We.$$)(e.date)!==(0,We.$$)(A[t-1].date);return(0,se.FD)(se.FK,{children:[s&&(0,se.Y)("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0,children:(0,We.i6)(p,new Date(1e3*e.date))},e.date),(0,se.Y)("div",{className:"ListItem small-icon",dir:p.isRtl?"rtl":void 0,children:(0,se.Y)(md.A,{message:e,senderTitle:(0,Tc.N)(p,e,i,r),isProtected:d||e.isProtected,observeIntersection:v,onMessageClick:f},e.id)},e.id)]})})]})})}));var gd=i(81524);const Ad="media",fd=(0,Ce.nF)(e=>e(),500,!0),Cd=(0,s.ph)((0,n.EK)(Mc(Ad))(({searchQuery:e,isLoading:t,globalMessagesByChatId:i,foundIds:r,isChatProtected:l})=>{const{searchMessagesGlobal:c,openMediaViewer:d}=(0,n.ko)(),h=(0,s.li)(),m=(0,B.A)(),{observe:u}=(0,hr.BL)({rootRef:h,throttleMs:500}),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&fd(()=>{c({type:Ad})})},[c,e]),v=(0,s.Kr)(()=>r&&i?r.map(e=>{const[t,s]=(0,Dc.a)(e);return i[t]?.byId[s]}).filter(Boolean):hi.p,[i,r]),g=(0,s.hb)((e,t)=>{d({chatId:t,messageId:e,origin:a.TQ.SearchResult})},[d]),A=(0,cr.A)([e],o.jhd)&&!t,f=A&&r&&r.length>0&&!e,C=A&&r&&r.length>0&&e,b=(0,ge.A)("search-content custom-scroll",C&&"chat-list");return(0,se.Y)(oe.Ay,{ref:h,slideClassName:"LeftSearch--content LeftSearch--media",name:"fade",activeKey:A?1:0,shouldCleanup:!0,children:(0,se.FD)(ls.A,{className:b,items:A?v:void 0,itemSelector:e?".ListItem":".Media",onLoadMore:p,noFastList:!0,children:[!A&&(0,se.Y)(Ls.A,{}),A&&(!r||0===r.length)&&(0,se.Y)(Lc.A,{withSticker:!0,text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),f&&(0,se.Y)("div",{className:"media-list",dir:m.isRtl?"rtl":void 0,children:v.map(e=>(0,se.Y)(gd.A,{idPrefix:"search-media",message:e,isProtected:l||e.isProtected,observeIntersection:u,onClick:g},`${e.chatId}-${e.id}`))}),C&&v.map(e=>(0,se.Y)(qc,{chatId:e.chatId,message:e},e.id))]})})}));var bd=i(537),yd=i(61361);const Sd={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"},Nd=(0,Ce.nF)(e=>e(),500,!1),kd=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),starsBalance:e.stars?.balance?.amount||0}))(({searchQuery:e,searchFlood:t,onSearch:i,isLoading:a,isCurrentUserPremium:r,starsBalance:l})=>{const{checkSearchPostsFlood:c,openPremiumModal:d,openStarsBalanceModal:h}=(0,n.ko)(),m=(0,Fi.A)(),u=t?.queryIsFree,p=t?.query,v=(0,bd.A)([e?.slice(0,18).trimEnd()]),g=(0,T.A)(()=>{i()});(0,s.vJ)(()=>{u&&e&&p===e&&i()},[u,e,p,i]);const A=(0,T.A)(()=>{const e=t?.starsAmount||0;l<e?h({topup:{balanceNeeded:e}}):i()});(0,s.vJ)(()=>{e&&p!==e&&Nd(()=>{c({query:e})})},[e,p]);const f=(0,T.A)(()=>{c({})}),C=(0,T.A)(()=>{d()}),b=(0,Ii.Fm)(),y=0===t?.remains||t?.waitTill&&t.waitTill>b;return(0,se.Y)(oe.Ay,{name:"fade",activeKey:r?a?2:y?0:1:3,children:r?a?(0,se.Y)("div",{className:Sd.container,children:(0,se.Y)("div",{className:(0,ge.A)(Sd.content,Sd.loadingScreen),children:(0,se.Y)(Ls.A,{})})}):y?(()=>{const i=t?.waitTill,s=t?.starsAmount||o._tP,n=t?.totalDaily||o.M3$;return(0,se.Y)("div",{className:Sd.container,children:(0,se.FD)("div",{className:Sd.content,children:[(0,se.Y)(Ma.A,{className:Sd.sticker,size:120,tgsUrl:Da.w.Search,previewUrl:Da.d.Search,nonInteractive:!0,noLoop:!1}),(0,se.Y)("div",{className:Sd.limitTitle,children:m("PublicPostsLimitReached")}),(0,se.Y)("div",{className:Sd.limitDescription,children:m("HintPublicPostsSearchQuota",{count:n},{pluralValue:n})}),(0,se.Y)(X.A,{className:Sd.paidSearchButton,color:"primary",disabled:!e,noForcedUpperCase:!0,inline:!0,onClick:A,children:m("PublicPostsSearchForStars",{stars:(0,wi.U2)(m,s,{asFont:!0})},{withNodes:!0})}),Boolean(i)&&(0,se.Y)("div",{className:Sd.freeSearchUnlock,children:m("UnlockTimerPublicPostsSearch",{time:(0,se.Y)(yd.A,{endsAt:i+2,onEnd:f})},{withNodes:!0})})]})})})():(()=>{const i=t?.remains||0;return(0,se.Y)("div",{className:Sd.container,children:(0,se.FD)("div",{className:Sd.content,children:[(0,se.Y)(Ma.A,{className:Sd.sticker,size:120,tgsUrl:Da.w.Search,previewUrl:Da.d.Search,nonInteractive:!0,noLoop:!1}),(0,se.Y)("div",{className:Sd.title,children:m("GlobalSearch")}),(0,se.Y)("div",{className:Sd.description,children:m("DescriptionPublicPostsSearch")}),(0,se.Y)(X.A,{className:Sd.searchButton,color:"primary",noForcedUpperCase:!0,disabled:!e,onClick:g,children:(0,se.Y)(oe.Ay,{name:"fade",activeKey:v,children:(0,se.FD)("div",{className:Sd.searchButtonContent,children:[(0,se.Y)(he.A,{name:"search",className:(0,ge.A)(Sd.searchIcon,e&&Sd.searchIconWithNext)}),m("ButtonSearchPublicPosts",{query:e?(0,se.Y)("span",{className:Sd.searchQuery,children:e}):""},{withNodes:!0}),e&&(0,se.Y)(he.A,{name:"next",className:Sd.nextIcon})]})})}),(0,se.Y)("div",{className:Sd.remainingSearches,children:m("RemainingPublicPostsSearch",{count:i},{pluralValue:i})})]})})})():(0,se.Y)("div",{className:Sd.container,children:(0,se.FD)("div",{className:Sd.content,children:[(0,se.Y)("div",{className:Sd.premiumTitle,children:m("GlobalSearch")}),(0,se.Y)("div",{className:Sd.premiumDescription,children:m("PublicPostsPremiumFeatureDescription")}),(0,se.Y)(X.A,{className:Sd.subscribePremiumButton,color:"primary",noForcedUpperCase:!0,onClick:C,children:m("PublicPostsSubscribeToPremium")}),(0,se.Y)("div",{className:Sd.premiumSubtitle,children:m("PublicPostsPremiumFeatureSubtitle")})]})})})})),wd=(0,Ce.nF)(e=>e(),500,!0),Id=(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,Ys.lS)(e);return{foundIds:o,globalMessagesByChatId:t,searchFlood:s,shouldShowSearchLauncher:l,isNothingFound:d,isLoading:r,animationLevel:h}})(({searchQuery:e,foundIds:t,globalMessagesByChatId:i,searchFlood:o,shouldShowSearchLauncher:r,isNothingFound:l,isLoading:c,animationLevel:d})=>{const{searchMessagesGlobal:h}=(0,n.ko)(),m=(0,Fi.A)(),u=(0,T.A)(()=>{e&&h({type:"publicPosts",shouldResetResultsByType:!0})}),p=(0,s.hb)(({direction:e})=>{e===a.TN.Backwards&&wd(()=>{h({type:"publicPosts"})})},[]),v=(0,s.Kr)(()=>t&&0!==t.length?t.map(e=>{const[t,s]=(0,Dc.a)(e);return i?.[t]?.byId[s]}).filter(Boolean):hi.p,[t,i]);return(0,se.Y)(oe.Ay,{name:(0,Fs.P)("slideOptimized",d,void 0,m.isRtl),activeKey:r||c?0:1,children:r||c?(0,se.Y)(kd,{searchQuery:e,searchFlood:o,onSearch:u,isLoading:c}):(0,se.Y)("div",{className:"LeftSearch--content",children:(0,se.FD)(ls.A,{className:"search-content custom-scroll chat-list",items:v,onLoadMore:p,noFastList:!0,children:[l&&(0,se.Y)(Lc.A,{text:m("ChatListSearchNoResults"),description:m("ChatListSearchNoResultsDescription"),withSticker:!0}),Boolean(v.length)&&(0,se.FD)("div",{className:"pb-2",children:[(0,se.Y)("h3",{className:"section-heading",dir:m.isRtl?"auto":void 0,children:m("PublicPosts")}),v.map(function(t){const i=(0,n.mS)().chats.byId,s=(0,A.C)(m,t),a=i[t.chatId];if(s&&a)return(0,se.Y)(qc,{chatId:t.chatId,message:t,searchQuery:e},`${t.chatId}-${t.id}`)})]})]},e)})})})),Pd=[{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"}],Yd=[{type:a.$C.ChatList,key:"SearchTabMessages"},...Pd.slice(3)],Fd=(0,s.ph)((0,n.EK)(e=>{const{currentContent:t,chatId:i}=(0,c.nTw)(e).globalSearch,{animationLevel:s}=(0,Ys.lS)(e);return{currentContent:t,chatId:i,animationLevel:s}})(({searchQuery:e,searchDate:t,isActive:i,currentContent:o=a.$C.ChatList,chatId:r,animationLevel:l,onReset:c})=>{const{setGlobalSearchContent:d,setGlobalSearchDate:h,checkSearchPostsFlood:m}=(0,n.ko)(),u=(0,Fi.A)(),[p,v]=(0,s.J0)(o),g=(0,s.Kr)(()=>(0,We.Rm)(e),[e]);(0,s.vJ)(()=>{i&&m({})},[i]);const A=(0,s.Kr)(()=>(r?Yd:Pd).map(e=>({...e,title:u(e.key)})),[r,u]),f=(0,T.A)(e=>{const t=A[e];d({content:t.type}),v(e)}),C=(0,T.A)(e=>{h({date:e.getTime()/1e3})});(0,Ne.A)({isActive:i,onBack:c});const b=(0,s.li)(),y=(0,Bs.A)(b,i,void 0,".ListItem-button",!0);return(0,se.FD)("div",{className:"LeftSearch",ref:b,onKeyDown:y,children:[(0,se.Y)(Fc.A,{activeTab:p,tabs:A,onSwitchTab:f}),(0,se.Y)(oe.Ay,{name:(0,Fs.P)("slideOptimized",l,void 0,u.isRtl),renderCount:A.length,activeKey:o,children:(()=>{switch(o){case a.$C.ChatList:case a.$C.ChannelList:return r?(0,se.Y)(ed,{searchQuery:e,dateSearchQuery:g,onReset:c,onSearchDateSelect:C}):(0,se.Y)(rd,{isChannelList:o===a.$C.ChannelList,searchQuery:e,searchDate:t,dateSearchQuery:g,onReset:c,onSearchDateSelect:C});case a.$C.Media:return(0,se.Y)(Cd,{searchQuery:e});case a.$C.Links:return(0,se.Y)(vd,{searchQuery:e});case a.$C.Files:return(0,se.Y)(hd,{searchQuery:e});case a.$C.Music:return(0,se.Y)(xc,{searchQuery:e},"audio");case a.$C.Voice:return(0,se.Y)(xc,{isVoice:!0,searchQuery:e},"voice");case a.$C.BotApps:return(0,se.Y)(jc,{searchQuery:e},"botApps");case a.$C.PublicPosts:return(0,se.Y)(Id,{searchQuery:e},"publicPosts");default:return}})()})]})}));var Dd=i(42215);const Md={currentPassword:"",password:"",hint:"",email:""},Td=(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 Md;default:return e}};var Bd=i(31880),Ld=i(58968);const Rd=(0,s.ph)((0,n.EK)(e=>({maxChats:(0,ys.d)(e,"dialogFiltersChats")}))(({mode:e,state:t,dispatch:i,isActive:a,onReset:r,onSaveFilter:l,maxChats:c})=>{const d=(0,B.A)(),{openLimitReachedModal:h}=(0,n.ko)(),{chatFilter:m}=t,{selectedChatIds:u,selectedChatTypes:p}=(0,s.Kr)(()=>(0,Bd.a)(t,e,!0),[e,t]),v="included"===e?Ld.V2:Ld.LS,[g,A]=(0,s.J0)(!1),f=(0,Ns.Rh)(o.DSF),C=(0,Ns.Rh)(o._E9),b=t.folder.isChatList;(0,s.vJ)(()=>{a||A(!1)},[a]);const y=(0,s.Kr)(()=>{const e=[...f||[],...C||[]];return(0,di.Am)([...(0,It.PU)({ids:e,query:m,type:"chat"})])},[f,C,m]),S=(0,T.A)(e=>{i({type:"setChatFilter",payload:e}),A(!0)}),N=(0,T.A)(s=>{if("included"===e){if(s.length>=c)return void h({limit:"dialogFiltersChats"});i({type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:s}})}else i({type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:s}});A(!0)}),k=(0,T.A)(t=>{const s={};t.forEach(e=>{s[e]=!0}),i("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:u,...s}}:{type:"setExcludeFilters",payload:{excludedChatIds:u,...s}}),A(!0)});return(0,Ne.A)({isActive:a,onBack:r}),y?(0,se.FD)("div",{className:"Picker settings-folders-chat-list",children:[(0,se.Y)(mi.A,{categories:b?void 0:v,itemIds:y,selectedIds:u,selectedCategories:p,filterValue:m,filterPlaceholder:d("Search"),categoryPlaceholderKey:"FilterChatTypes",searchInputId:"new-group-picker-search",isSearchable:!0,withDefaultPadding:!0,withPeerTypes:!0,allowMultiple:!0,itemInputType:"checkbox",onSelectedIdsChange:N,onSelectedCategoriesChange:k,onFilterChange:S}),(0,se.Y)(pi.A,{isShown:g,onClick:l,ariaLabel:d("Save"),iconName:"check"})]}):(0,se.Y)(Ls.A,{})}));var xd=i(72167),Ed=i(98021);const Vd=(0,s.ph)(({isOpen:e,onEmojiSelect:t,onClose:i})=>{const n=(0,s.hb)(e=>{t(e),i()},[i,t]);return(0,se.Y)(Ze.A,{isOpen:e,positionX:"left",onClose:i,withPortal:!0,className:"settings-folders-icon-picker-menu SymbolMenu",children:(0,se.FD)("div",{className:"SymbolMenu-main",children:[(0,se.Y)("div",{className:"settings-folders-icon-picker-menu-folders",children:Object.keys(Ed.E6).map(e=>(0,se.Y)("div",{className:"EmojiButton",onClick:()=>n(e),children:(0,se.Y)(he.A,{name:Ed.E6[e]})}))}),(0,se.Y)(_r,{idPrefix:"folder-emoji-set-",loadAndPlay:e,isHidden:!e,onCustomEmojiSelect:e=>n(e),onDismiss:i})]})})}),_d=[0,1,2,3,4,5,6],Ud="Please provide a title for this folder.",Od="ChatList.Filter.Error.Empty",Kd=(0,s.ph)((0,n.EK)((e,{state:t})=>{const{listIds:i}=e.chats,{byId:s,invites:n}=e.chatFolders,a=Object.values(s).reduce((e,t)=>e+(t.isChatList?1:0),0),o=(0,c.g29)(e);return{loadedActiveChatIds:i.active,loadedArchivedChatIds:i.archived,invites:t.folderId?n[t.folderId]||hi.p:void 0,isRemoved:void 0!==t.folderId&&!s[t.folderId],maxInviteLinks:(0,ys.d)(e,"chatlistInvites"),maxChatLists:(0,ys.d)(e,"chatlistJoined"),chatListCount:a,isCurrentUserPremium:o}})(({state:e,dispatch:t,onAddIncludedChats:i,onAddExcludedChats:a,onShareFolder:r,onOpenInvite:l,isActive:d,onReset:h,isRemoved:m,onBack:u,loadedActiveChatIds:p,isOnlyInvites:g,loadedArchivedChatIds:A,invites:f,maxInviteLinks:C,maxChatLists:b,chatListCount:y,onSaveFolder:S,isCurrentUserPremium:N,isMobile:k})=>{const{loadChatlistInvites:w,openLimitReachedModal:I,showNotification:P,openPremiumModal:Y}=(0,n.ko)(),F="create"===e.mode,D=e.folder.isChatList,[M,L]=(0,s.J0)(!1),[R,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)(!1);(0,s.vJ)(()=>{m&&h()},[m,h]),(0,s.vJ)(()=>{d&&e.folderId&&e.folder.isChatList&&w({folderId:e.folderId})},[d,e.folder.isChatList,e.folderId]);const{selectedChatIds:_,selectedChatTypes:U}=(0,s.Kr)(()=>(0,Bd.a)(e,"included"),[e]),{selectedChatIds:O,selectedChatTypes:K}=(0,s.Kr)(()=>(0,Bd.a)(e,"excluded"),[e]);(0,s.vJ)(()=>{L(!1),x(!1)},[e.folderId]);const[J,j]=(0,s.Kr)(()=>{const e=new Set([...p||[],...A||[]]),t=(0,di.$h)(_,e),i=(0,di.$h)(O,e);return[M?t:t.slice(0,5-U.length),R?i:i.slice(0,5-K.length)]},[O,_,U,K,R,M,p,A]),z=(0,B.A)();(0,Ne.A)({isActive:d,onBack:u});const H=(0,s.Kr)(()=>e.folder.title.entities?.find(e=>e.type===G.C7.CustomEmoji&&0===e.offset),[e.folder.title]),$=(0,s.Kr)(()=>o.kGl-(H?H.length:0),[H]),q=(0,s.hb)(i=>{let s=e.folder.title.text;const n=[];let a="🗂";if(H){const{offset:e,length:t}=H;s=s.replace(s.substring(e,e+t),"")}if("string"==typeof i)a=i;else{const{id:e,emoji:t}=i;n.push({type:G.C7.CustomEmoji,documentId:e,offset:0,length:t?.length||2}),t&&(s=`${t}${s}`,a=t,s.length>$&&(s=s.slice(0,$)))}t({type:"setEmoticon",payload:a}),t({type:"setTitle",payload:{text:s,entities:n}})},[t,H,e.folder.title,$]),W=(0,s.hb)(e=>{const{currentTarget:i}=e;let s=i.value;if(H){const{emoji:e}=(0,c.O8F)((0,n.mS)(),H.documentId);s=`${e}${s}`}t({type:"setTitle",payload:{text:s,entities:H?[H]:[]}})},[t,H]),Q=(0,s.hb)(()=>{t({type:"setIsLoading",payload:!0}),S(()=>{setTimeout(()=>{h()},500)})},[t,S,h]),Z=(0,s.hb)(()=>{f?(0,c.w5O)((0,n.mS)(),e.folderId)?y>=b&&!e.folder.isChatList?I({limit:"chatlistJoined"}):f.length<C?e.isTouched?S(r):r():I({limit:"chatlistInvites"}):P({message:z("ChatList.Filter.InviteLink.IncludeExcludeError")}):F&&S(r)},[f,e.folderId,e.isTouched,y,C,F,S,r,z,b,e.folder.isChatList]),X=(0,s.hb)((t,i)=>{e.isTouched?S(()=>l(i)):l(i)},[S,l,e.isTouched]);function te(e){const t="included"===e?U:K,i="included"===e?J:j,s="included"===e?M:R,n=("included"===e?_:O).length-i.length,a="included"===e?()=>L(!0):()=>x(!0);return(0,se.FD)(se.FK,{children:[t.map(t=>function(e,t){const i="included"===t?Ld.V2.find(({type:t})=>t===e):Ld.LS.find(({type:t})=>t===e);if(i)return(0,se.Y)(li.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,se.Y)(ms.A,{avatarSize:"small",customPeer:i})},i.type)}(t,e)),i.map(e=>(0,se.Y)(li.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,v.L8)(e)?(0,se.Y)(ms.A,{avatarSize:"small",userId:e}):(0,se.Y)(hs.A,{avatarSize:"small",chatId:e})})),!s&&n>0&&(0,se.Y)(li.A,{className:"settings-folders-list-item",narrow:!0,onClick:a,icon:"down",children:z("FilterShowMoreChats",n,"i")},"load-more")]})}const ie=(0,T.A)(e=>{q(e)}),ne=(0,T.A)(()=>{V(!1)}),ae=(0,T.A)(()=>{V(!0)}),oe=(0,s.Kr)(()=>{let t=e.folder.title.text;if(H){const{offset:e,length:i}=H;t=t.substring(e+i,t.length)}return t},[e.folder.title.text,H]);return(0,se.FD)("div",{className:"settings-fab-wrapper",children:[(0,se.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header",children:[(0,se.Y)(Ma.A,{size:o.fwn,tgsUrl:Da.w.FoldersNew,play:String(e.folderId),className:"settings-content-icon"}),F&&(0,se.Y)("p",{className:"settings-item-description mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterIncludeInfo")}),(0,se.FD)("div",{className:"settings-folders-input-container",children:[(0,se.Y)(ee.A,{className:(0,ge.A)("mb-0",!k&&"settings-folders-input-with-icon"),label:z("FilterNameHint"),value:oe,maxLength:$,onChange:W,error:e.error&&e.error===Ud?Ud:void 0}),!k&&(0,se.FD)("div",{className:"settings-folders-icon-picker",dir:z.isRtl?"rtl":void 0,children:[(0,se.Y)("div",{className:"settings-folders-icon-picker-button",onClick:ae,children:(0,se.Y)(xd.A,{emoji:e.folder.emoticon,customEmojiId:H?.documentId,shouldAnimate:e.folder.noTitleAnimations})}),(0,se.Y)(Vd,{isOpen:E,onEmojiSelect:ie,onClose:ne})]})]})]}),!g&&(0,se.FD)("div",{className:"settings-item",children:[e.error&&e.error===Od&&(0,se.Y)("p",{className:"settings-item-description color-danger mb-2",dir:z.isRtl?"rtl":void 0,children:z(e.error)}),(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterInclude")}),(0,se.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:i,children:z("FilterAddChats")}),te("included")]}),!g&&!D&&(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FilterExclude")}),(0,se.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:a,children:z("FilterAddChats")}),te("excluded")]}),(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.FD)("h4",{className:"settings-item-header mb-3 color-picker-header",dir:z.isRtl?"rtl":void 0,children:[(0,se.Y)("span",{className:"color-picker-title-text",children:z("FilterColorTitle")}),(0,se.Y)("div",{className:(0,ge.A)("color-picker-title","color-picker-selected-color",N&&void 0!==e.folder.color&&-1!==e.folder.color?(0,Ji.yp)(e.folder.color):"color-picker-item-disabled"),children:(0,Oi.fd)({text:e.folder.title.text,entities:e.folder.title.entities,noCustomEmojiPlayback:e.folder.noTitleAnimations})})]}),(0,se.FD)("div",{className:"color-picker custom-scroll-x",children:[_d.map(i=>(0,se.Y)("button",{type:"button",onClick:()=>{N?t({type:"setColor",payload:i}):Y()},className:(0,ge.A)("color-picker-item",(0,Ji.yp)(i),!N&&"color-picker-item-hover-disabled",i===e.folder.color&&N&&"color-picker-item-active")},i)),(0,se.Y)("button",{type:"button",onClick:()=>{N?t({type:"setColor",payload:void 0}):Y()},className:(0,ge.A)("color-picker-item","color-picker-item-none",(void 0===e.folder.color||-1===e.folder.color||!N)&&"color-picker-item-active"),children:N?(0,se.Y)(he.A,{name:"close",className:"color-picker-item-none-icon"}):(0,se.Y)(he.A,{name:"lock-badge",className:"color-picker-item-none-icon"})})]}),(0,se.Y)("p",{className:"settings-item-description mb-0 mt-3",dir:z.isRtl?"rtl":void 0,children:z("FilterColorHint")})]}),(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:z.isRtl?"rtl":void 0,children:z("FolderLinkScreen.Title")}),(0,se.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:Z,children:z("ChatListFilter.CreateLinkNew")}),f?.map(e=>(0,se.FD)(li.A,{className:"settings-folders-list-item",icon:"link",narrow:!0,multiline:!0,onClick:X,clickArg:e.url,children:[(0,se.Y)("span",{className:"title",dir:"auto",children:e.title||e.url}),(0,se.Y)("span",{className:"subtitle",children:z("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i")})]}))]})]}),(0,se.Y)(pi.A,{isShown:Boolean(e.isTouched),disabled:e.isLoading,onClick:Q,ariaLabel:"edit"===e.mode?"Save changes":"Create folder",iconName:"check",isLoading:e.isLoading})]})}));var Jd=i(80401);const Gd=(0,Ce.nF)(e=>e(),6e4,!0),jd=(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,ys.d)(e,"dialogFilters"),areTagsEnabled:n,foldersPosition:e.sharedState.settings.foldersPosition}})(({isActive:e,foldersById:t,isPremium:i,recommendedChatFolders:a,maxFolders:r,areTagsEnabled:c,foldersPosition:d,isMobile:h,onCreateFolder:m,onEditFolder:u,onReset:p,folderIds:v})=>{const{loadRecommendedChatFolders:g,addChatFolder:A,openLimitReachedModal:f,openDeleteChatFolderModal:C,sortChatFolders:b,toggleDialogFilterTags:y,openPremiumModal:S,setSharedSettingOption:N}=(0,n.ko)(),[k,w]=(0,s.J0)({orderedFolderIds:v,dragOrderIds:v,draggedIndex:void 0}),I=(0,K.A)(v);(0,s.vJ)(()=>{I!==v&&w({orderedFolderIds:v,dragOrderIds:v,draggedIndex:void 0})},[I,v,k.orderedFolderIds?.length]),(0,s.vJ)(()=>{Gd(()=>{g()})},[g]);const P=(0,s.hb)(()=>{Object.keys(t).length>=r-1?f({limit:"dialogFilters"}):m()},[t,r,m,f]),Y=(0,Fi.A)();(0,Ne.A)({isActive:e,onBack:p});const F=(0,Ns.g5)(),D=(0,s.Kr)(()=>{if(v)return v.length<=1?hi.p:v.map(e=>{const i=t[e];return e===o.DSF?{id:e,title:{text:Y("FilterAllChats"),entities:[]}}:{id:i.id,title:i.title,subtitle:(0,l.A5)(Y,i,F[i.id]),isChatList:i.isChatList,color:i.color,noTitleAnimations:i.noTitleAnimations}})},[v,t,Y,F]),M=(0,s.hb)(e=>{Object.keys(t).length>=r-1?f({limit:"dialogFilters"}):A({folder:e})},[t,r,A,f]),B=(0,s.hb)(()=>{i&&y({isEnabled:!c})},[c,i,y]),L=(0,s.hb)((e,t)=>{const s=Math.round(e.y/56),n=k.orderedFolderIds?.indexOf(t)||0,a=k.orderedFolderIds?.filter(e=>e!==t);a&&(0,fe.Bt)(n+s,0,v?.length||0)&&(a.splice(n+s+(i?0:1),0,t),w(e=>({...e,draggedIndex:n,dragOrderIds:a})))},[v?.length,i,k.orderedFolderIds]),R=(0,s.hb)(()=>{w(e=>(b({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0}))},[b]),x=(0,T.A)(e=>{N({foldersPosition:e})}),E=(0,s.Kr)(()=>!i||Object.keys(t).length<r-1,[t,i,r]);return(0,se.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header",children:[(0,se.Y)(Ma.A,{size:o.fwn,tgsUrl:Da.w.FoldersAll,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:Y("CreateNewFilterInfo")}),E&&(0,se.Y)(X.A,{className:"settings-button with-icon",color:"primary",pill:!0,fluid:!0,onClick:P,isRtl:Y.isRtl,iconName:"add",children:Y("CreateNewFilter")})]}),(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("Filters")}),(0,se.Y)("div",{className:"settings-sortable-container",style:`height: ${56*(v?.length||0)}px`,children:D?.length?D.map((s,n)=>{const a=n>r-1,l=k.draggedIndex===n,d=56*(k.orderedFolderIds?.indexOf(s.id)??0),h=56*(k.dragOrderIds?.indexOf(s.id)??0),m=void 0!==s?.color&&-1!==s.color&&c;return s.id===o.DSF?(0,se.Y)(Jd.A,{id:s.id,onDrag:L,onDragEnd:R,style:`top: ${l?d:h}px;`,knobStyle:(Y.isRtl?"left":"right")+": 0.375rem;",isDisabled:!i||!e,children:(0,se.FD)(li.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0,allowSelection:!0,children:[(0,se.Y)("span",{className:"title",children:(0,Oi.fd)({text:s.title.text,entities:s.title.entities,noCustomEmojiPlayback:s.noTitleAnimations})}),(0,se.Y)("span",{className:"subtitle",children:Y("FoldersAllChatsDesc")})]},s.id)},s.id):(0,se.Y)(Jd.A,{id:s.id,onDrag:L,onDragEnd:R,style:`top: ${l?d:h}px;`,knobStyle:`${Y.isRtl?"left":"right"}: ${m?"4rem":"2.5rem"};`,isDisabled:a||!e,children:(0,se.FD)(li.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{C({folderId:s.id})},destructive:!0,title:Y("Delete"),icon:"delete"}],onClick:()=>{a?f({limit:"dialogFilters"}):u(t[s.id])},children:[(0,se.FD)("span",{className:"title",children:[(0,Oi.fd)({text:s.title.text,entities:s.title.entities,noCustomEmojiPlayback:s.noTitleAnimations}),a&&(0,se.Y)(he.A,{name:"lock-badge",className:"settings-folders-blocked-icon"})]}),(0,se.FD)("span",{className:"subtitle",children:[s.isChatList&&(0,se.Y)(he.A,{name:"link",className:"mr-1"}),s.subtitle]}),m&&(0,se.Y)("div",{className:(0,ge.A)("settings-folders-color-circle",void 0!==s.color&&-1!==s.color&&(0,Ji.yp)(s.color))})]})},s.id)}):D&&!D.length?(0,se.Y)("p",{className:"settings-item-description my-4",dir:"auto",children:Y("SettingsFoldersEmpty")}):(0,se.Y)(Ls.A,{})})]}),a&&Boolean(a.length)&&(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("FilterRecommended")}),a.map(e=>(0,se.Y)(li.A,{narrow:!0,onClick:()=>M(e),children:(0,se.FD)("div",{className:"settings-folders-recommended-item",children:[(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:(0,Oi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,se.Y)("span",{className:"subtitle",children:e.description})]}),(0,se.Y)(X.A,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:Y.isRtl,children:Y("Add")})]})}))]}),(0,se.Y)("div",{className:"settings-item pt-3",children:(0,se.FD)("div",{className:"settings-item-relative",children:[(0,se.Y)(js.A,{label:Y("ShowFolderTags"),subLabel:Y("ShowFolderTagsHint"),checked:i&&c,onChange:B,onClickLabel:e=>{i||(e.preventDefault(),S())}}),!i&&(0,se.Y)(he.A,{name:"lock-badge",className:"settings-folders-lock-icon"})]})}),!h&&(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.Y)("h4",{className:"settings-item-header mb-3",dir:Y.isRtl?"rtl":void 0,children:Y("TabsPosition")}),(0,se.Y)(ie.A,{name:"tabsPosition",options:[{label:Y("TabsPositionLeft"),value:o._C3},{label:Y("TabsPositionTop"),value:o.ATy}],selected:d,onChange:x})]})]})}));var zd=i(4438);const Hd=(0,s.ph)((0,n.EK)(e=>{const{folderId:t,url:i,isLoading:s}=(0,c.nTw)(e).shareFolderScreen||{},n=t?(0,c.$aQ)(e,t):void 0,a=t?e.chatFolders.invites[t]?.find(e=>e.url===i):void 0;return{folderId:t,folder:n,url:i,isLoading:s,peerIds:a?.peerIds}})(({isActive:e,onReset:t,folderId:i,folder:a,peerIds:r,url:d,isLoading:h})=>{const{createChatlistInvite:m,deleteChatlistInvite:u,editChatlistInvite:p,showNotification:v}=(0,n.ko)(),g=(0,Fi.A)(),A=(0,B.A)(),[f,C]=(0,s.J0)(!1);(0,Ne.A)({isActive:e,onBack:t}),(0,s.vJ)(()=>{h||C(!1)},[h]),(0,s.vJ)(()=>{!d&&i&&e&&m({folderId:i})},[i,e,d]);const b=(0,T.A)(()=>{d&&i&&(u({folderId:i,url:d}),t())}),y=(0,s.Kr)(()=>(a?.includedChatIds||[]).concat(a?.pinnedChatIds||[]),[a?.includedChatIds,a?.pinnedChatIds]),[S,N]=(0,s.Kr)(()=>{const e=(0,n.mS)();return(0,di.jB)(y,t=>(0,c.hXb)(e,t))},[y]),[k,w]=(0,s.J0)(r||[]),I=(0,s.li)(!0);(0,F.A)(([e])=>{e!==d&&(I.current=!0),I.current&&(I.current=!1,d?r&&w(r):w(S))},[d,S,r]);const P=(0,T.A)(e=>{const t=(0,n.mS)(),i=(0,c.mBe)(t,e),s=(0,c.hds)(t,e);i&&(0,l.tv)(i)?v({message:A("FolderLinkScreen.AlertTextUnavailableBot")}):i?v({message:A("FolderLinkScreen.AlertTextUnavailableUser")}):s&&(0,l.WX)(s)?v({message:A("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):v({message:A("FolderLinkScreen.AlertTextUnavailablePublicGroup")})}),Y=(0,T.A)(e=>{w(e),C(!0)}),D=(0,T.A)(()=>{i&&d&&f&&p({folderId:i,peerIds:k,url:d})}),M=k.length,L=!M||h;return(0,se.FD)("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker",children:[(0,se.FD)("div",{className:"settings-content-header",children:[(0,se.Y)(zd.A,{size:o.fwn,tgsUrl:Da.w.FoldersShare,className:"settings-content-icon"}),a&&(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:g("FolderLinkTitleDescription",{folder:(0,Oi.fd)({text:a.title.text,entities:a.title.entities,noCustomEmojiPlayback:a.noTitleAnimations}),chats:g("FolderLinkTitleDescriptionChats",{count:M},{pluralValue:M})},{withMarkdown:!0,withNodes:!0})})]}),(0,se.Y)(qr.A,{className:"settings-item",link:d||A("Loading"),withShare:!0,onRevoke:b,isDisabled:!M||f}),(0,se.Y)("div",{className:"settings-item settings-item-picker",children:(0,se.Y)(mi.A,{itemIds:y,lockedUnselectedIds:N,onSelectedIdsChange:Y,selectedIds:k,onDisabledClick:P,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})}),(0,se.Y)(pi.A,{isShown:h||f,disabled:L,onClick:D,ariaLabel:"Save changes",iconName:"check",isLoading:h})]})})),$d=(0,s.ph)(({currentScreen:e,shownScreen:t,state:i,dispatch:o,isActive:r,onReset:l})=>{const{isMobile:c}=(0,Y.Ay)(),{openShareChatFolderModal:d,editChatFolder:h,addChatFolder:m,openSettingsScreen:u}=(0,n.ko)(),p=(0,s.hb)(()=>{e!==a.VS.FoldersCreateFolder&&e!==a.VS.FoldersEditFolder&&e!==a.VS.FoldersEditFolderFromChatList&&e!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{o({type:"reset"})},200),e!==a.VS.FoldersIncludedChats&&e!==a.VS.FoldersExcludedChats?l():"create"===i.mode?u({screen:a.VS.FoldersCreateFolder}):u({screen:a.VS.FoldersEditFolder})},[i.mode,o,e,l]),v="create"===i.mode,g=(0,s.hb)(e=>{const{title:{text:t}}=e.folder;if(!t)return o({type:"setError",payload:Ud}),!1;const{selectedChatIds:i,selectedChatTypes:s}=(0,Bd.a)(e,"included");return i.length||Object.keys(s).length?(v?m({folder:e.folder}):h({id:e.folderId,folderUpdate:e.folder}),o({type:"setError",payload:void 0}),o({type:"setIsTouched",payload:!1}),!0):(o({type:"setError",payload:Od}),!1)},[o,v]),A=(0,s.hb)(e=>{g(i)&&e?.()},[g,i]),f=(0,s.hb)(()=>{o({type:"saveFilters"}),p()},[o,p]),C=(0,s.hb)(()=>{o({type:"reset"}),u({screen:a.VS.FoldersCreateFolder})},[o]),b=(0,s.hb)(e=>{o({type:"editFolder",payload:e}),u({screen:a.VS.FoldersEditFolder})},[o]),y=(0,s.hb)(()=>{o({type:"editIncludeFilters"}),u({screen:e===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersIncludedChatsFromChatList:a.VS.FoldersIncludedChats})},[e,o]),S=(0,s.hb)(()=>{o({type:"editExcludeFilters"}),u({screen:e===a.VS.FoldersEditFolderFromChatList?a.VS.FoldersExcludedChatsFromChatList:a.VS.FoldersExcludedChats})},[e,o]),N=(0,s.hb)(()=>{d({folderId:i.folderId,noRequestNextScreen:!0}),o({type:"setIsChatlist",payload:!0}),u({screen:a.VS.FoldersShare})},[o,i.folderId]),k=(0,s.hb)(e=>{d({folderId:i.folderId,url:e,noRequestNextScreen:!0}),u({screen:a.VS.FoldersShare})},[i.folderId]);switch(e){case a.VS.Folders:return(0,se.Y)(jd,{onCreateFolder:C,onEditFolder:b,isActive:r||[a.VS.FoldersCreateFolder,a.VS.FoldersEditFolder,a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(t),onReset:l,isMobile:c});case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,se.Y)(Kd,{state:i,dispatch:o,onAddIncludedChats:y,onAddExcludedChats:S,onShareFolder:N,onOpenInvite:k,onReset:p,isActive:r||[a.VS.FoldersIncludedChats,a.VS.FoldersExcludedChats].includes(t),isOnlyInvites:e===a.VS.FoldersEditFolderInvites,onBack:l,onSaveFolder:A,isMobile:c});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:return(0,se.Y)(Rd,{mode:"included",state:i,dispatch:o,onReset:p,onSaveFilter:f,isActive:r});case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,se.Y)(Rd,{mode:"excluded",state:i,dispatch:o,onReset:p,onSaveFilter:f,isActive:r});case a.VS.FoldersShare:return(0,se.Y)(Hd,{isActive:r,onReset:p});default:return}});var qd=i(70934),Wd=i(3178);const Qd=(0,s.ph)(({isActive:e,error:t,isLoading:i,shouldDisablePasswordManager:n,expectedPassword:a,placeholder:o,hint:r,submitLabel:l,onSubmit:c,onClearError:d,onReset:h})=>{const[m,u]=(0,s.J0)(""),[p,v]=(0,s.J0)(!1),g=(0,Fi.A)(),A=(0,s.hb)(e=>{a&&e!==a?u(g("SettingsPasswordEqual")):c(e)},[c,a,g]),f=(0,s.hb)(()=>{d&&d(),u("")},[d]);return(0,Ne.A)({isActive:e,onBack:h}),(0,se.FD)("div",{className:"settings-content password-form custom-scroll",children:[(0,se.Y)("div",{className:"settings-content-header no-border",children:(0,se.Y)(Wd.A,{isBig:!0,isPasswordVisible:p})}),(0,se.Y)("div",{className:"settings-item settings-group",children:(0,se.Y)(Il.A,{error:m||t,hint:r,placeholder:o||g("CurrentPasswordPlaceholder"),shouldDisablePasswordManager:n,submitLabel:l,onClearError:f,isLoading:i,isPasswordVisible:p,shouldResetValue:e,onChangePasswordVisibility:v,onSubmit:A})})]})}),Zd=(0,s.ph)(({isActive:e,onReset:t})=>{const i=(0,B.A)(),n=(0,s.hb)(()=>{t(!0)},[t]);return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(zd.A,{size:o.BYH,tgsUrl:Da.w.Congratulations,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Congratulations!"}),(0,se.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,se.Y)("div",{className:"settings-item settings-group",children:(0,se.Y)(X.A,{onClick:n,children:i("Back")})})]})});var Xd=i(89704);const eh=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,B.A)();return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Lock,previewUrl:Xd,size:160,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Local passcode is enabled."})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{icon:"edit",onClick:()=>i({screen:a.VS.PasscodeChangePasscodeCurrent}),children:s("Passcode.Change")}),(0,se.Y)(li.A,{icon:"password-off",onClick:()=>i({screen:a.VS.PasscodeTurnOff}),children:s("Passcode.TurnOff")})]})]})}),th=(0,s.ph)(({isActive:e,onReset:t,onStart:i})=>{const s=(0,Fi.A)();return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Lock,previewUrl:Xd,size:o.BYH,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description",dir:"auto",children:s("SettingsPasscodeStart1",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("SettingsPasscodeStart2",void 0,{withNodes:!0,renderTextFilters:["br"]})})]}),(0,se.Y)("div",{className:"settings-item settings-group",children:(0,se.Y)(X.A,{onClick:i,children:s("EnablePasscode")})})]})}),ih=(0,s.ph)((0,n.EK)(e=>({...e.passcode}))(({passcode:e,currentScreen:t,shownScreen:i,error:o,isActive:r,isLoading:l,onSetPasscode:c,onReset:d})=>{const{setPasscode:h,clearPasscode:m,setPasscodeError:u,clearPasscodeError:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,B.A)(),A=(0,s.hb)(()=>{c(""),v({screen:a.VS.PasscodeNewPasscode})},[c]),f=(0,s.hb)(e=>{c(e),v({screen:a.VS.PasscodeNewPasscodeConfirm})},[c]),C=(0,s.hb)(()=>{h({passcode:e}),c(""),v({screen:a.VS.PasscodeCongratulations})},[c,e]),b=(0,s.hb)(e=>{c(""),(0,qd.UQ)(e).then(()=>{v({screen:a.VS.PasscodeChangePasscodeNew})},()=>{u({error:g("PasscodeController.Error.Current")})})},[g,c]),y=(0,s.hb)(e=>{c(e),v({screen:a.VS.PasscodeChangePasscodeConfirm})},[c]),S=(0,s.hb)(e=>{(0,qd.UQ)(e).then(()=>{m(),v({screen:a.VS.Privacy})},()=>{u({error:g("PasscodeController.Error.Current")})})},[g]);switch(t){case a.VS.PasscodeDisabled:return(0,se.Y)(th,{onStart:A,isActive:r||[a.VS.PasscodeNewPasscode,a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeNewPasscode:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,placeholder:g("EnterNewPasscode"),submitLabel:g("Continue"),onSubmit:f,isActive:r||[a.VS.PasscodeNewPasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeNewPasscodeConfirm:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("ReEnterYourPasscode"),submitLabel:g("Continue"),isLoading:l,onSubmit:C,isActive:r||[a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeCongratulations:return(0,se.Y)(Zd,{isActive:r,onReset:d});case a.VS.PasscodeEnabled:return(0,se.Y)(eh,{isActive:r||[a.VS.PasscodeChangePasscodeCurrent,a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations,a.VS.PasscodeTurnOff].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeCurrent:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,error:o,onClearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:b,isActive:r||[a.VS.PasscodeChangePasscodeNew,a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeNew:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,placeholder:g("PleaseEnterNewFirstPassword"),onSubmit:y,isActive:r||[a.VS.PasscodeChangePasscodeConfirm,a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeChangePasscodeConfirm:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:l,onSubmit:C,isActive:r||[a.VS.PasscodeCongratulations].includes(i),onReset:d});case a.VS.PasscodeTurnOff:return(0,se.Y)(Qd,{shouldDisablePasswordManager:!0,error:o?g(o):void 0,onClearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:S,isActive:r,onReset:d});default:return}})),sh=[50,100,500,1e3,2e3,5e3,1e4];function nh(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 ah(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 oh=(0,s.ph)(({min:e=0,max:t,value:i,disabled:n,readOnly:a,bold:o,className:r,defaultValue:l,onChange:c,canChangeChargeForMessages:d})=>{const h=(0,Fi.A)(),m=(0,s.Kr)(()=>{const e=[];for(let i=0;i<sh.length;i++)if(sh[i]<t&&e.push(sh[i]),sh[i]>=t){e.push(t);break}return e},[t]),u=(0,T.A)(e=>{const t=Number(e.currentTarget.value);c(ah(m,t))}),p=(0,ge.A)(r,"RangeSlider",n&&"disabled",a&&"readOnly",o&&"bold");return(0,se.FD)("div",{className:p,children:[(0,se.FD)("div",{className:"slider-top-row",dir:h.isRtl?"rtl":void 0,children:[(0,se.Y)("span",{className:"value-min",dir:"auto",children:h.number(e)}),(0,se.FD)("span",{className:"settings-range-value",children:[!d&&(0,se.Y)(he.A,{name:"lock-badge"}),(0,wi.Kk)(h,ah(m,nh(m,i)))]}),(0,se.Y)("span",{className:"value-max",dir:"auto",children:h.number(t)})]}),(0,se.FD)("div",{className:"slider-main",children:[(0,se.Y)("div",{className:"slider-fill-track",style:`width: ${nh(m,i)/m.length*100}%`}),(0,se.Y)("input",{min:0,max:m.length,defaultValue:nh(m,l),step:"any",type:"range",className:"RangeSlider__input",onChange:u})]})]})}),rh=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.starsUsdWithdrawRateX1000,i=t?t/1e3:1,s=e.appConfig.starsPaidMessageCommissionPermille;return{starsPaidMessageCommissionPermille:s?s/1e3:100,starsUsdWithdrawRate:i,starsPaidMessageAmountMax:e.appConfig.starsPaidMessageAmountMax||o.$$v}})(function({starsUsdWithdrawRate:e,starsPaidMessageAmountMax:t,starsPaidMessageCommissionPermille:i,canChangeChargeForMessages:s,isGroupChat:a,chargeForMessages:r,onChange:l}){const{openPremiumModal:c}=(0,n.ko)(),d=(0,Fi.A)(),h=(0,T.A)(e=>{l?.(e)}),m=(0,T.A)(()=>{c({initialSection:"message_privacy"})});return(0,se.FD)(se.FK,{children:[(0,se.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("SectionTitleStarsForForMessages")}),(0,se.Y)(oh,{defaultValue:r,min:o.BSg,max:t,value:r,onChange:h,canChangeChargeForMessages:s,readOnly:!s}),!s&&(0,se.Y)(X.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:m,children:(0,se.FD)("span",{className:"settings-unlock-button-title",children:[d("UnlockButtonTitle"),(0,se.Y)(he.A,{name:"lock-badge",className:"settings-unlock-button-icon"})]})}),s&&(0,se.Y)("p",{className:"settings-item-description-larger",dir:d.isRtl?"rtl":void 0,children:d(a?"SetPriceGroupDescription":"SectionDescriptionStarsForForMessages",{percent:(0,Fn.l9)(100*i),amount:(0,va.Ad)(r*e*i,"USD",d.code)},{withNodes:!0})})]})}));var lh=i(9267);const ch=(0,s.ph)(function({premiumSection:e}){const{openPremiumModal:t}=(0,n.ko)(),i=(0,B.A)(),s=(0,T.A)(()=>t({initialSection:e}));return(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{leftElement:(0,se.Y)(lh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:s,children:i("PrivacyLastSeenPremium")}),(0,se.Y)("p",{className:"settings-item-description-larger premium-info",dir:i.isRtl?"rtl":void 0,children:i("lng_messages_privacy_premium_about")})]})}),dh=(0,s.ph)(function({label:e,isChecked:t}){const i=(0,B.A)(),{showNotification:s}=(0,n.ko)();return(0,se.FD)("div",{className:(0,ge.A)("sBptmiga",t&&"U_6O1ebL"),onClick:()=>s({message:i("OptionPremiumRequiredMessage")}),children:[(0,se.Y)("span",{children:e}),(0,se.Y)(he.A,{name:"lock-badge",className:"jWxrRbkh"})]})}),hh=(0,s.ph)((0,n.EK)(e=>{const{settings:{privacy:t}}=e,i=(0,c.Iv$)(e),s=e.settings.privacy.noPaidMessages?.allowUserIds.length||0;return{shouldNewNonContactPeersRequirePremium:(0,c.BSN)(e),shouldChargeForMessages:Boolean(i),nonContactPeersPaidStars:i||o.wZe,isCurrentUserPremium:(0,c.g29)(e),canLimitNewMessagesWithoutPremium:e.appConfig.canLimitNewMessagesWithoutPremium,canChargeForMessages:e.appConfig.starsPaidMessagesAvailable,noPaidReactionsForUsersCount:s,privacy:t}})(function({isActive:e,canLimitNewMessagesWithoutPremium:t,canChargeForMessages:i,shouldNewNonContactPeersRequirePremium:o,shouldChargeForMessages:r,nonContactPeersPaidStars:l,isCurrentUserPremium:c,noPaidReactionsForUsersCount:d,onReset:h,privacy:m}){const{updateGlobalPrivacySettings:u,openSettingsScreen:p,showNotification:v}=(0,n.ko)(),g=(0,B.A)(),A=(0,Fi.A)(),f=c||t,C=c&&i,[b,y]=(0,s.J0)(l),[S,N]=(0,s.J0)(!1),k=(0,s.Kr)(()=>r?"charge_for_messages":o?"contacts_and_premium":"everybody",[r,o]);(0,F.A)(([e])=>{S||void 0===e||"everybody"===k||k===e||("everybody"===m.chatInvite?.visibility&&v({message:A("CheckPrivacyInviteText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyGroupChats}},actionText:{key:"Review"},duration:8e3}),"everybody"===m.phoneCall?.visibility&&v({message:A("CheckPrivacyCallsText"),action:{action:"openSettingsScreen",payload:{screen:a.VS.PrivacyPhoneCall}},actionText:{key:"Review"},duration:8e3}),N(!0))},[k,r,m,A,S]);const w=(0,s.Kr)(()=>[{value:"everybody",label:g("P2PEverybody")},{value:"contacts_and_premium",label:f?g("PrivacyMessagesContactsAndPremium"):(0,se.Y)(dh,{label:g("PrivacyMessagesContactsAndPremium"),isChecked:"contacts_and_premium"===k}),hidden:!f,isCanCheckedInDisabled:!0},{value:"charge_for_messages",label:C?A("PrivacyChargeForMessages"):(0,se.Y)(dh,{label:A("PrivacyChargeForMessages"),isChecked:"charge_for_messages"===k}),hidden:!C,isCanCheckedInDisabled:!0}],[g,A,f,C,k]),I=(0,T.A)(e=>{u({shouldNewNonContactPeersRequirePremium:"contacts_and_premium"===e,nonContactPeersPaidStars:"charge_for_messages"===e?b:null})}),P=(0,ye.A)(e=>{u({nonContactPeersPaidStars:e})},[u],300,!0),Y=(0,s.hb)(e=>{y(e),P(e)},[y,P]);(0,Ne.A)({isActive:e,onBack:h});const D=(0,s.Kr)(()=>A(r?"PrivacyDescriptionChargeForMessages":"PrivacyDescriptionMessagesContactsAndPremium"),[r,A]);return(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:g("PrivacyMessagesTitle")}),(0,se.Y)(ie.A,{name:"privacy-messages",options:w,onChange:I,selected:k}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:A.isRtl?"rtl":void 0,children:D})]}),"charge_for_messages"===k&&(0,se.Y)("div",{className:"settings-item fluid-container",children:(0,se.Y)(rh,{canChangeChargeForMessages:C,chargeForMessages:b,onChange:Y})}),C&&"charge_for_messages"===k&&function(){const e=d?g("Users",d,"i"):A("SubtitlePrivacyAddUsers");return(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:A.isRtl?"rtl":void 0,children:A("RemoveFeeTitle")}),(0,se.Y)(li.A,{narrow:!0,icon:"delete-user",onClick:()=>{p({screen:a.VS.PrivacyNoPaidMessages})},children:(0,se.FD)("div",{className:"multiline-item full-size",children:[(0,se.Y)("span",{className:"title",children:A("ExceptionTitlePrivacyChargeForMessages")}),(0,se.Y)("span",{className:"subtitle",children:e})]})})]})}(),!c&&"charge_for_messages"!==k&&(0,se.Y)(ch,{premiumSection:"message_privacy"})]})}));function mh(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 uh={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 ph(e){return[e.region,e.country].filter(Boolean).join(", ")}const vh=(0,s.ph)((0,n.EK)((e,{hash:t})=>({session:t?e.activeSessions.byHash[t]:void 0}))(({isOpen:e,session:t,onClose:i})=>{const{changeSessionSettings:a,terminateAuthorization:o}=(0,n.ko)(),r=(0,Fi.A)(),l=(0,Si.A)(t,!0),c=(0,s.hb)(()=>{a({hash:t.hash,areSecretChatsEnabled:!t.areSecretChatsEnabled})},[a,t]),d=(0,s.hb)(()=>{a({hash:t.hash,areCallsEnabled:!t.areCallsEnabled})},[a,t]),h=(0,s.hb)(()=>{o({hash:t.hash}),i()},[i,t,o]);if(l)return(0,se.FD)(te.A,{header:(0,se.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:i,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:r("SessionPreviewTitle")}),(0,se.Y)(X.A,{color:"danger",onClick:h,className:(0,ge.A)("modal-action-button",uh.headerButton),children:r("SessionPreviewTerminateSession")})]}),isOpen:e,hasCloseButton:!0,onClose:i,className:uh.SettingsActiveSession,children:[(0,se.Y)("div",{className:(0,ge.A)(uh.iconDevice,l&&uh[`iconDevice__${mh(l)}`])}),(0,se.Y)("h3",{className:uh.title,dir:"auto",children:l?.deviceModel}),(0,se.Y)("div",{className:uh.date,"aria-label":r("PrivacySettingsLastSeen"),children:(0,We.L2)(1e3*l.dateActive,r.code)}),(0,se.FD)("dl",{className:uh.box,children:[(0,se.Y)("dt",{children:r("SessionPreviewApp")}),(0,se.FD)("dd",{children:[l?.appName," ",l?.appVersion,","," ",l?.platform," ",l?.systemVersion]}),l?.ip&&(0,se.FD)(se.FK,{children:[(0,se.Y)("dt",{children:r("SessionPreviewIp")}),(0,se.Y)("dd",{children:l.ip})]}),(0,se.Y)("dt",{children:r("SessionPreviewLocation")}),(0,se.Y)("dd",{children:l&&ph(l)})]}),(0,se.Y)("p",{className:uh.note,children:r("SessionPreviewIpDesc")}),(0,se.Y)("h4",{className:uh.actionHeader,children:r("AuthSessionsViewAcceptTitle")}),(0,se.FD)(li.A,{onClick:c,children:[(0,se.Y)("span",{className:uh.actionName,children:r("SessionPreviewAcceptSecret")}),(0,se.Y)(ci.A,{id:"accept_secrets",label:"On",checked:l.areSecretChatsEnabled})]}),(0,se.FD)(li.A,{onClick:d,children:[(0,se.Y)("span",{className:uh.actionName,children:r("SessionPreviewAcceptCalls")}),(0,se.Y)(ci.A,{id:"accept_calls",label:"On",checked:l.areCallsEnabled})]})]})}));function gh(e){return[e.region,e.country].filter(Boolean).join(", ")}const Ah=(0,s.ph)((0,n.EK)(e=>e.activeSessions)(({isActive:e,onReset:t,byHash:i,orderedHashes:a,ttlDays:o})=>{const{terminateAuthorization:r,terminateAllAuthorizations:l,changeSessionTtl:c}=(0,n.ko)(),d=(0,B.A)(),h=(0,Fi.A)(),[m,u,p]=(0,D.A)(),[v,g]=(0,s.J0)(),[A,f,C]=(0,D.A)(),b=(0,s.Kr)(()=>{if(void 0!==o)return o<=7?"7":o<=30?"30":o<=93?"90":o<=183?"183":o>183?"365":void 0},[o]),y=(0,s.Kr)(()=>{const e=[{label:h("Weeks",{count:1},{pluralValue:1}),value:"7"},{label:h("Months",{count:1},{pluralValue:1}),value:"30"},{label:h("Months",{count:3},{pluralValue:3}),value:"90"},{label:h("Months",{count:6},{pluralValue:6}),value:"183"}];return o&&o>=365&&e.push({label:h("Years",{count:1},{pluralValue:1}),value:"365"}),e},[h,o]),S=(0,s.hb)(e=>{r({hash:e})},[r]),N=(0,s.hb)(()=>{p(),l()},[p,l]),k=(0,s.hb)(e=>{g(e),f()},[f]),w=(0,s.hb)(()=>{g(void 0),C()},[C]),I=(0,s.hb)(e=>{c({days:Number(e)})},[c]),P=(0,s.Kr)(()=>{const e=a.find(e=>i[e].isCurrent);return e?i[e]:void 0},[i,a]),Y=(0,s.Kr)(()=>a.filter(e=>!i[e].isCurrent),[i,a]),F=Boolean(Y.length);return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content custom-scroll SettingsActiveSessions",children:[P&&(T=P,(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("AuthSessionsCurrentSession")}),(0,se.Y)(li.A,{narrow:!0,inactive:!0,icon:`device-${mh(T)}`,iconClassName:"icon-device",children:(0,se.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,se.Y)("span",{className:"title",dir:"auto",children:T.deviceModel}),(0,se.FD)("span",{className:"subtitle black tight",children:[T.appName," ",T.appVersion,","," ",T.platform," ",T.systemVersion]}),(0,se.FD)("span",{className:"subtitle",children:[T.ip," ","-"," ",gh(T)]})]})}),F&&(0,se.Y)(li.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:u,children:h("TerminateAllSessions")})]})),F&&(M=Y,(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("OtherSessions")}),M.map(function(e){const t=i[e];return(0,se.Y)(li.A,{ripple:!0,narrow:!0,contextActions:[{title:h("SessionTerminate"),icon:"stop",destructive:!0,handler:()=>{S(t.hash)}}],icon:`device-${mh(t)}`,iconClassName:"icon-device",onClick:()=>{k(t.hash)},children:(0,se.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,se.Y)("span",{className:"date",children:(0,We.be)(d,1e3*t.dateActive)}),(0,se.Y)("span",{className:"title",children:t.deviceModel}),(0,se.FD)("span",{className:"subtitle black tight",children:[t.appName," ",t.appVersion,","," ",t.platform," ",t.systemVersion]}),(0,se.FD)("span",{className:"subtitle",children:[t.ip," ",gh(t)]})]})},t.hash)})]})),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0,children:h("TerminateOldSessionHeader")}),(0,se.Y)("p",{className:"settings-item-description-larger",children:h("IfInactiveFor")}),(0,se.Y)(ie.A,{name:"session_ttl",options:y,selected:b,onChange:I})]}),F&&(0,se.Y)(ai.A,{isOpen:m,onClose:p,text:h("AreYouSureSessions"),confirmLabel:h("TerminateAllSessions"),confirmHandler:N,confirmIsDestructive:!0,areButtonsInColumn:!0}),(0,se.Y)(vh,{isOpen:A,hash:v,onClose:w})]});var M,T})),fh="YRYk96ki",Ch=(0,s.ph)((0,n.EK)((e,{hash:t})=>{const i=t?e.activeWebSessions.byHash[t]:void 0;return{session:i,bot:i?e.users.byId[i.botId]:void 0}})(({isOpen:e,session:t,bot:i,onClose:a})=>{const{terminateWebAuthorization:o}=(0,n.ko)(),r=(0,B.A)(),l=(0,Si.A)(t,!0),c=(0,Si.A)(i,!0),d=(0,s.hb)(()=>{o({hash:t.hash}),a()},[a,t,o]);if(l)return(0,se.FD)(te.A,{header:(0,se.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:a,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:r("WebSessionsTitle")}),(0,se.Y)(X.A,{color:"danger",onClick:d,className:(0,ge.A)("modal-action-button","lUf0RJ2h"),children:r("AuthSessions.LogOut")})]}),isOpen:e,hasCloseButton:!0,onClose:a,className:"Wd0fmiSY",children:[(0,se.Y)(Yt.A,{className:"OhZHdRsP",peer:c,size:"large"}),c&&(0,se.Y)(Rs.A,{className:"EQ7__xGn",peer:c}),(0,se.Y)("div",{className:fh,children:l?.domain}),(0,se.FD)("dl",{className:"kmCTIfvf",children:[(0,se.Y)("dt",{children:r("AuthSessions.View.Browser")}),(0,se.Y)("dd",{children:l?.browser}),(0,se.Y)("dt",{children:r("SessionPreview.Ip")}),(0,se.Y)("dd",{children:l?.ip}),(0,se.Y)("dt",{children:r("SessionPreview.Location")}),(0,se.Y)("dd",{children:l?.region})]}),(0,se.Y)("p",{className:fh,children:r("AuthSessions.View.LocationInfo")})]})})),bh={avatar:"v0wP46TR","clear-help":"WnnxcARX",clearHelp:"WnnxcARX",subtitle:"uEUfjByC"},yh=(0,s.ph)((0,n.EK)(e=>{const{byHash:t,orderedHashes:i}=e.activeWebSessions;return{byHash:t,orderedHashes:i}})(({isActive:e,byHash:t,orderedHashes:i,onReset:a})=>{const{terminateWebAuthorization:o,terminateAllWebAuthorizations:r}=(0,n.ko)(),l=(0,B.A)(),[c,d,h]=(0,D.A)(),[m,u]=(0,s.J0)(),[p,v,g]=(0,D.A)(),A=(0,s.hb)(e=>{o({hash:e})},[o]),f=(0,s.hb)(()=>{h(),r()},[h,r]),C=(0,s.hb)(e=>{u(e),v()},[v]),b=(0,s.hb)(()=>{u(void 0),g()},[g]);var y;if((0,s.vJ)(()=>{i.length||a()},[a,i]),(0,Ne.A)({isActive:e,onBack:a}),i.length)return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d,children:l("AuthSessions.LogOutApplications")}),(0,se.Y)("p",{className:(0,ge.A)("settings-item-description",bh.clearHelp),children:l("ClearOtherWebSessionsHelp")})]}),(y=i,(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("WebSessionsTitle")}),y.map(function(e){const i=t[e],s=(0,n.mS)().users.byId[i.botId];return(0,se.FD)(li.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{A(i.hash)}}],onClick:()=>C(i.hash),children:[(0,se.Y)(Yt.A,{className:bh.avatar,peer:s,size:"tiny"}),(0,se.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,se.Y)("span",{className:"date",children:(0,We.be)(l,1e3*i.dateActive)}),s&&(0,se.Y)(Rs.A,{className:bh.title,peer:s}),(0,se.FD)("span",{className:(0,ge.A)("subtitle","black","tight",bh.platform),children:[i.domain,",",i.browser,",",i.platform]}),(0,se.FD)("span",{className:(0,ge.A)("subtitle",bh.subtitle),children:[i.ip," ",i.region]})]})]},i.hash)})]})),(0,se.Y)(ai.A,{isOpen:c,onClose:h,title:l("AuthSessions.LogOutApplications"),text:l("AreYouSureWebSessions"),confirmHandler:f,confirmIsDestructive:!0}),(0,se.Y)(Ch,{isOpen:p,hash:m,onClose:b})]})})),Sh=(0,s.ph)(({stickerSet:e,noPlay:t,className:i,observeIntersection:s,onClick:n})=>{const a=(0,B.A)(),r=e?.stickers?.[0],l=(0,T.A)(()=>{r&&n(r)});if(e?.stickers)return(0,se.FD)(li.A,{className:(0,ge.A)("StickerSetCard","small-icon",i),inactive:!r,onClick:l,children:[function(){if(e)return e.hasThumbnail||!r?(0,se.Y)(X.A,{ariaLabel:e.title,color:"translucent",isRtl:a.isRtl,children:(0,se.Y)(Cr,{stickerSet:e,size:o.RCH,noPlay:t,observeIntersection:s})}):(0,se.Y)(Nr,{sticker:r,size:o.RCH,title:e.title,noPlay:t,observeIntersection:s,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("div",{className:"title",children:e.title}),(0,se.Y)("div",{className:"subtitle",children:a("StickerPack.StickerCount",e.count,"i")})]})]})}),Nh=(0,s.ph)((0,n.EK)(e=>({...(0,di.Up)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({isActive:e,customEmojiSetIds:t,stickerSetsById:i,shouldSuggestCustomEmoji:a,canPlayAnimatedEmojis:o,onReset:r})=>{const{openStickerSet:l,setSettingOption:c}=(0,n.ko)(),d=(0,B.A)(),h=(0,s.li)(),{observe:m}=(0,hr.BL)({rootRef:h});(0,Ne.A)({isActive:e,onBack:r});const u=(0,s.hb)(e=>{l({stickerSetInfo:e.stickerSetInfo})},[l]),p=(0,s.hb)(e=>{c({shouldSuggestCustomEmoji:e})},[c]),v=(0,s.Kr)(()=>t&&Object.values((0,di.Up)(i,t)),[t,i]);return(0,se.Y)("div",{className:"settings-content custom-scroll",children:v&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:d("SuggestAnimatedEmoji"),checked:a,onCheck:p}),(0,se.Y)("div",{className:"mt-4",ref:h,children:v.map(e=>(0,se.Y)(Sh,{stickerSet:e,observeIntersection:m,onClick:u,noPlay:!o},e.id))}),(0,se.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Pt.A)(d("EmojiBotInfo"),["links"])})]})})}));var kh=i(74824);const wh=(0,s.ph)((0,n.EK)(e=>(0,di.Up)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"]))(({isActive:e,canAutoLoadPhotoFromContacts:t,canAutoLoadPhotoInPrivateChats:i,canAutoLoadPhotoInGroups:s,canAutoLoadPhotoInChannels:a,canAutoLoadVideoFromContacts:r,canAutoLoadVideoInPrivateChats:l,canAutoLoadVideoInGroups:c,canAutoLoadVideoInChannels:d,canAutoLoadFileFromContacts:h,canAutoLoadFileInPrivateChats:m,canAutoLoadFileInGroups:u,canAutoLoadFileInChannels:p,autoLoadFileMaxSizeMb:v,onReset:g})=>{const{setSettingOption:A,showNotification:f}=(0,n.ko)(),C=(0,Fi.A)();(0,Ne.A)({isActive:e,onBack:g});const b=(0,T.A)(e=>{const t=o.$gx[e];return C("AutodownloadSizeLimitUpTo",{limit:C("MediaSizeMB",{size:t},{pluralValue:t})})}),y=(0,T.A)(e=>{A({autoLoadFileMaxSizeMb:o.$gx[e]})}),S=(0,T.A)(()=>{(0,kh.purgeClearableCache)(),f({message:{key:"SettingsDataClearMediaDone"}})});function N(){const e=o.$gx.indexOf(v);return(0,se.Y)("div",{className:"pt-5",children:(0,se.Y)(Xe.A,{label:C("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:b,onChange:y})})}function k(e,t,i,s,n,a){return(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0,children:e}),(0,se.Y)(js.A,{label:C("AutoDownloadSettingsContacts"),checked:i,onCheck:e=>A({[`canAutoLoad${t}FromContacts`]:e})}),(0,se.Y)(js.A,{label:C("AutoDownloadSettingsPrivateChats"),checked:s,onCheck:e=>A({[`canAutoLoad${t}InPrivateChats`]:e})}),(0,se.Y)(js.A,{label:C("AutoDownloadSettingsGroupChats"),checked:n,onCheck:e=>A({[`canAutoLoad${t}InGroups`]:e})}),(0,se.Y)(js.A,{label:C("AutoDownloadSettingsChannels"),checked:a,onCheck:e=>A({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&N()]})}return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[k(C("AutoDownloadPhotosTitle"),"Photo",t,i,s,a),k(C("AutoDownloadVideosTitle"),"Video",r,l,c,d),k(C("AutoDownloadFilesTitle"),"File",h,m,u,p),(0,se.Y)("div",{className:"settings-item",children:(0,se.FD)(li.A,{onClick:S,icon:"delete",multiline:!0,children:[(0,se.Y)("span",{className:"title",children:C("SettingsDataClearMediaCache")}),(0,se.Y)("span",{className:"subtitle",children:C("SettingsDataClearMediaCacheDescription")})]})})]})})),Ih={root:"Ys1i4ssl",item:"skaVPMTF"},Ph=(0,s.ph)((0,n.EK)(e=>{const{doNotTranslate:t}=e.settings.byKey;return{doNotTranslate:t}})(({isActive:e,doNotTranslate:t,onReset:i})=>{const{setSettingOption:a}=(0,n.ko)(),r=(0,Fi.A)().code,[l,c]=(0,s.J0)(""),d=(0,s.Kr)(()=>{const e=new Intl.DisplayNames([r],{type:"language"}),t=o.N89.map(t=>{const i=e.of(t),s=new Intl.DisplayNames([t],{type:"language"}).of(t);if(i&&s)return{value:t,label:i,subLabel:s}}).filter(Boolean);if(!l.trim()){const e=t.find(e=>e.value===r),i=t.filter(e=>e.value!==r);return e?[e,...i]:t}return t?.filter(e=>e.label.toLowerCase().includes(l.toLowerCase())||e.subLabel?.toLowerCase().includes(l.toLowerCase())||e.value.toLowerCase().includes(l.toLowerCase()))},[r,l]),h=(0,T.A)(e=>{a({doNotTranslate:e})});return(0,Ne.A)({isActive:e,onBack:i}),(0,se.Y)("div",{className:(0,ge.A)(Ih.root,"settings-content infinite-scroll"),children:(0,se.Y)("div",{className:(0,ge.A)(Ih.item),children:(0,se.Y)(Ac,{className:Ih.picker,items:d,selectedValues:t,onSelectedValuesChange:h,filterValue:l,onFilterChange:c,isSearchable:!0,allowMultiple:!0,withDefaultPadding:!0,itemInputType:"checkbox",searchInputId:"lang-picker-search"})})})})),Yh=(0,s.ph)(({chatId:e,usernames:t,onEditUsername:i})=>{const{showNotification:a,toggleUsername:o,toggleChatUsername:r,sortUsernames:l,sortChatUsernames:c}=(0,n.ko)(),d=(0,B.A)(),h=(0,Fi.A)(),[m,u]=(0,s.J0)(),p=(0,s.Kr)(()=>t.map(({username:e})=>e),[t]),v=(0,K.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,wc.eM)(`@${e}`),a({message:d("UsernameCopied")})},[d,a]),C=(0,s.hb)(e=>{e.isEditable?i(e.username):u(e)},[i]),b=(0,s.hb)(()=>{u(void 0)},[]),y=(0,s.hb)(()=>{m&&(e?r({chatId:e,username:m.username,isActive:!m.isActive}):o({username:m.username,isActive:!m.isActive}),b())},[e,b,r,o,m]),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,fe.Bt)(s+i,0,p.length)&&(n.splice(s+i,0,t),A(e=>({...e,draggedIndex:s,dragOrderUsernames:n})))},[g.orderedUsernames,p.length]),N=(0,s.hb)(()=>{A(t=>(e?c({chatId:e,usernames:t.dragOrderUsernames}):l({usernames:t.dragOrderUsernames}),{...t,orderedUsernames:t.dragOrderUsernames,draggedIndex:void 0}))},[e,c,l]);return(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"PaO1MMi5",children:[(0,se.Y)("h4",{className:"wSswdVkR",dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_subtitle")}),(0,se.Y)("div",{className:"lAeeBh9K",style:`height: ${56*t.length}px`,children:t.map((e,t)=>{const i=g.draggedIndex===t,s=56*(g.orderedUsernames?.indexOf(e.username)??0),n=56*(g.dragOrderUsernames?.indexOf(e.username)??0),a=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return(0,se.Y)(Jd.A,{id:e.username,onDrag:S,onDragEnd:N,style:`top: ${i?s:n}px;`,knobStyle:"inset-inline-end: 3rem;",isDisabled:!e.isActive,children:(0,se.FD)(li.A,{className:(0,ge.A)("drag-item no-icon","l04OwRBg"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{f(e.username)},title:d("Copy"),icon:"copy"}],onClick:()=>{C(e)},children:[(0,se.FD)("span",{className:"title",children:["@",e.username]}),(0,se.Y)("span",{className:"subtitle",children:d(a)})]},e.username)},e.username)})}),(0,se.Y)("p",{className:"oiJc22Aj",dir:h.isRtl?"rtl":void 0,children:d("lng_usernames_description")})]}),(0,se.Y)(ai.A,{isOpen:Boolean(m),onClose:b,title:d(m?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:d(m?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:d(m?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:y,confirmIsDestructive:!m?.isActive})]})});var Fh=i(11116);const Dh=/https:\/\/t\.me\/?/i,Mh=(0,Ce.sg)(e=>e(),250,!1),Th=(0,s.ph)(({currentUsername:e,asLink:t,isLoading:i,isUsernameAvailable:a,checkedUsername:r,onChange:l})=>{const{checkUsername:c,checkPublicLink:d}=(0,n.ko)(),[h,m]=(0,s.J0)(e||""),u=(0,B.A)(),p=t?"SetUrl":"Username",v=u(t?"SetUrlPlaceholder":"Username"),g=(0,K.A)(a),A=e!==h?a??g:void 0,f=h&&e!==h&&r!==h,[C,b]=(0,s.Kr)(()=>h.length?h.length<Fh.tX?[void 0,u(`${p}InvalidShort`)]:h.length>Fh.Tk?[void 0,u(`${p}InvalidLong`)]:Fh.Ny.test(h)?void 0===A||f?[]:[A?u(`${p}Available`,v):void 0,!1===A?u(`${p}InUse`):void 0]:[void 0,u(`${p}Invalid`)]:[],[h,A,f,u,p,v]);(0,s.vJ)(()=>{m(e||"")},[t,e]);const y=(0,s.hb)(i=>{const s=i.target.value.trim();if(t&&!s.match(Dh))return void(s.length||(m(""),l?.("")));const n=s.replace(Dh,"");m(n),(""===n||(0,Fh.BU)(n,!0))&&(l?.(n),Mh(()=>{n!==e&&(t?d:c)({username:n})}))},[t,d,c,e,l]);return(0,se.Y)(ee.A,{value:`${t?o.jsp:""}${h}`,onChange:y,label:f?u("Checking"):v,error:b,success:C,readOnly:i,teactExperimentControlled:!0})});var Bh=i(43434);const Lh=(0,Ce.nF)(e=>e(),6e4,!0),Rh="Please provide your first name",xh=(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,ys.d)(e,"aboutLength"),{firstName:d,lastName:h,usernames:m}=o||{},u=t?(0,c.vGo)(e,t):void 0;return{currentAvatarHash:o&&(0,l.cP)(o),currentFirstName:d,currentLastName:h,currentBirthday:u?.birthday,currentBio:u?.bio,progress:i,isUsernameAvailable:s,checkedUsername:n,editUsernameError:a,maxBioLength:r,usernames:m}})(({isActive:e,currentAvatarHash:t,currentFirstName:i,currentLastName:r,currentBirthday:l,currentBio:c,progress:d,checkedUsername:h,editUsernameError:m,isUsernameAvailable:u,maxBioLength:p,usernames:v,onReset:g})=>{const{loadCurrentUser:A,updateProfile:f,openSettingsScreen:C,openBirthdaySetupModal:b}=(0,n.ko)(),y=(0,B.A)(),S=(0,Fi.A)(),N=(0,s.Kr)(()=>v?.find(({isEditable:e})=>e),[v]),k=N?.username||"",[w,I]=(0,s.J0)(!1),[P,Y]=(0,s.J0)(!1),[F,D]=(0,s.J0)(),[M,L]=(0,s.J0)(),[R,x]=(0,s.J0)(i||""),[E,V]=(0,s.J0)(r||""),[_,U]=(0,s.J0)(c||""),[O,J]=(0,s.J0)(k),j=(0,q.A)(t,!1,G.qZ.BlobUrl),z=d===a.DV.InProgress,H=!1===O,$=(0,K.A)(u),W=u??$,Q=v&&v.length>1,Z=(0,s.Kr)(()=>!H&&(Boolean(M)||P||w&&!0===W),[H,M,P,w,W]);(0,Ne.A)({isActive:e,onBack:g}),(0,s.vJ)(()=>{Lh(()=>{A()})},[A]),(0,s.vJ)(()=>{L(void 0)},[j]),(0,s.vJ)(()=>{x(i||""),V(r||""),U(c||"")},[i,r,c]),(0,s.vJ)(()=>{J(k||"")},[k]),(0,s.vJ)(()=>{d===a.DV.Complete&&(Y(!1),I(!1),D(void 0))},[d]);const X=(0,s.Kr)(()=>{if(!l)return;const e=new Date(l.year||2024,l.month-1,l.day);return(0,We.A)(e,S.code,!0,"long")},[l,S]),te=(0,T.A)(e=>{L(e)}),ie=(0,T.A)(e=>{x(e.target.value),Y(!0)}),ne=(0,T.A)(e=>{V(e.target.value),Y(!0)}),ae=(0,T.A)(e=>{U(e.target.value),Y(!0)}),oe=(0,T.A)(e=>{J(e),I(k!==e)}),re=(0,T.A)(()=>{C({screen:a.VS.PrivacyBirthday})}),le=(0,T.A)(()=>{b({currentBirthday:l})}),ce=(0,T.A)(()=>{const e=R.trim(),t=E.trim(),i=_.trim();O&&(e.length?f({photo:M,...P&&{firstName:e,lastName:t,bio:i},...w&&{username:O}}):D(Rh))});return(0,se.FD)("div",{className:"settings-fab-wrapper",children:[(0,se.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.FD)("div",{className:"settings-input",children:[(0,se.Y)(Bh.A,{currentAvatarBlobUrl:j,onChange:te,title:S("AriaSettingsEditProfilePhoto"),disabled:z}),(0,se.Y)(ee.A,{value:R,onChange:ie,label:y("FirstName"),disabled:z,error:F===Rh?F:void 0}),(0,se.Y)(ee.A,{value:E,onChange:ne,label:y("LastName"),disabled:z}),(0,se.Y)(fn.A,{value:_,onChange:ae,label:y("UserBio"),disabled:z,maxLength:p,maxLengthIndicator:p?(p-_.length).toString():void 0})]}),(0,se.Y)("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0,children:(0,Pt.A)(y("lng_settings_about_bio"),["br","simple_markdown"])})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{icon:"gift",narrow:!0,rightElement:X?(0,se.Y)("span",{className:"settings-birthday-date",children:X}):void 0,onClick:le,children:(0,se.Y)("span",{className:"flex-grow",children:S("SettingsBirthday")})}),(0,se.Y)("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0,children:S("BirthdayPrivacySuggestion",{link:(0,se.Y)(Mo.A,{isPrimary:!0,onClick:re,children:S("BirthdayPrivacySuggestionLink",void 0,{withNodes:!0,specialReplacement:(0,wi.dE)()})})},{withNodes:!0})})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0,children:y("Username")}),(0,se.Y)("div",{className:"settings-input",children:(0,se.Y)(Th,{currentUsername:k,isLoading:z,isUsernameAvailable:u,checkedUsername:h,onChange:oe})}),m===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,se.Y)("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0,children:y("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,se.Y)(nn.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,se.Y)("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0,children:(0,Pt.A)(y("UsernameHelp"),["br","simple_markdown"])}),O&&(0,se.FD)("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0,children:[y("lng_username_link"),(0,se.Y)("br",{}),(0,se.FD)("span",{className:"username-link",children:[o.jsp,O]})]})]}),Q&&(0,se.Y)(Yh,{usernames:v,onEditUsername:J})]}),(0,se.Y)(pi.A,{isShown:Z,onClick:ce,disabled:z,ariaLabel:y("Save"),iconName:"check",isLoading:z})]})}));var Eh=i(61182),Vh=i(4350),_h=i(93855),Uh=i(15006);const Oh=(0,s.ph)((0,n.EK)(e=>{const{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}=(0,Ys.lS)(e);return{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}})(({isActive:e,shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:a,shouldDebugExportedSenders:r,onReset:l})=>{const{requestConfetti:c,setSharedSettingOption:d,requestWave:h}=(0,n.ko)(),u=(0,s.li)(),[p,v]=(0,s.J0)(!1),g=(0,B.A)(),A=(0,_h.A)();(0,Ne.A)({isActive:e,onBack:l});const f=(0,T.A)(()=>{const e=new File([(0,Eh.F8)()],o.lFE,{type:"text/plain"}),t=URL.createObjectURL(e);(0,ki.A)(t,o.lFE)}),C=(0,T.A)(e=>{h({startX:e.clientX,startY:e.clientY})}),b=(0,T.A)(()=>{c({withStars:!0})}),y=(0,T.A)(()=>{const e=u.current;e&&(0,Uh.U)(e)&&(v(!0),setTimeout(()=>{v(!1)},1500))}),S=(0,s.Kr)(()=>{if(!Object.values(A).length)return;let e=1;for(;A[e];)e+=1;return(0,Vh.Nv)(e,!0,!0)},[A]);return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),(0,se.Y)("p",{className:"settings-item-description pt-3",dir:"auto",children:g("lng_settings_experimental_about")})]}),(0,se.Y)("div",{className:"settings-item",children:(0,se.Y)(li.A,{href:S,icon:"add-user",children:(0,se.Y)("div",{className:"title",children:"Login on Test Server"})})}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{onClick:b,icon:"animations",children:(0,se.Y)("div",{className:"title",children:"Launch some confetti!"})}),(0,se.Y)(li.A,{onClick:C,icon:"story-expired",disabled:!m.J6,children:(0,se.Y)("div",{className:"title",children:"Start wave"})}),(0,se.Y)(li.A,{ref:u,onClick:y,icon:"spoiler",disabled:!m.bW,style:p?"visibility: hidden":"",children:(0,se.Y)("div",{className:"title",children:"Vaporize this button"})})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:"Allow HTTP Transport",checked:Boolean(i),onCheck:()=>d({shouldAllowHttpTransport:!i})}),(0,se.Y)(js.A,{label:"Force HTTP Transport",disabled:!i,checked:Boolean(t),onCheck:()=>d({shouldForceHttpTransport:!t})})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:g("DebugMenuEnableLogs"),checked:Boolean(a),onCheck:()=>d({shouldCollectDebugLogs:!a})}),(0,se.Y)(js.A,{label:"Enable exported senders debug",checked:Boolean(r),onCheck:()=>d({shouldDebugExportedSenders:!r})}),(0,se.Y)(li.A,{onClick:f,icon:"bug",children:(0,se.Y)("div",{className:"title",children:"Download log"})})]})]})}));var Kh=i(84382);const Jh=(0,s.ph)((0,n.EK)(e=>{const{theme:t,shouldUseSystemTheme:i,messageSendKeyCombo:s,messageTextSize:n,timeFormat:a}=(0,Ys.lS)(e);return{messageSendKeyCombo:s,messageTextSize:n,timeFormat:a,theme:t,shouldUseSystemTheme:i}})(({isActive:e,messageTextSize:t,messageSendKeyCombo:i,timeFormat:o,theme:r,shouldUseSystemTheme:l,onReset:c})=>{const{setSharedSettingOption:d,openSettingsScreen:h}=(0,n.ko)(),u=(0,Fi.A)(),{isMobile:p}=(0,Y.Ay)(),v=p&&(m.pz||m.Ni),g=[{label:u("SettingsTimeFormat12"),value:"12h"},{label:u("SettingsTimeFormat24"),value:"24h"}],A=[{label:u("EmptyChatAppearanceLight"),value:"light"},{label:u("EmptyChatAppearanceDark"),value:"dark"},{label:u("EmptyChatAppearanceSystem"),value:"auto"}],f=v?void 0:[{value:"enter",label:u("SettingsSendEnter"),subLabel:u("SettingsSendEnterDescription")},{value:"ctrl-enter",label:u(m.MP||m.pz?"SettingsSendCmdenter":"SettingsSendCtrlenter"),subLabel:u("SettingsSendPlusEnterDescription")}],C=(0,s.hb)(e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,m.pz?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),d({messageTextSize:e})},[]),b=(0,s.hb)(e=>{const t="auto"===e?(0,Kh.V)():e;d({theme:t}),d({shouldUseSystemTheme:"auto"===e})},[]),y=(0,s.hb)(e=>{d({timeFormat:e}),d({wasTimeFormatSetManually:!0})},[]),S=(0,s.hb)(e=>{d({messageSendKeyCombo:e})},[]);return(0,Ne.A)({isActive:e,onBack:c}),(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("Settings")}),(0,se.Y)(Xe.A,{label:u("TextSize"),min:12,max:20,value:t,onChange:C}),(0,se.Y)(li.A,{icon:"photo",narrow:!0,onClick:()=>h({screen:a.VS.GeneralChatBackground}),children:u("ChatBackground")})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("Theme")}),(0,se.Y)(ie.A,{name:"theme",options:A,selected:l?"auto":r,onChange:b})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("SettingsTimeFormat")}),(0,se.Y)(ie.A,{name:"timeformat",options:g,selected:o,onChange:y})]}),f&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0,children:u("SettingsKeyboard")}),(0,se.Y)(ie.A,{name:"keyboard-send-settings",options:f,onChange:S,selected:i})]})]})}));var Gh=i(52844);const jh=(0,s.ph)(({wallpaper:e,theme:t,isSelected:i,onClick:n})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,h=(0,q.A)(`${c}?size=m`),m=(0,Yi.A)(l.thumbnail?.dataUri,Boolean(h),!0),{transitionClassNames:u}=(0,je.A)(Boolean(h||d),void 0,void 0,"slow"),p=(0,s.li)(!1),[v,g]=(0,s.J0)(!1),{mediaData:A,loadProgress:f}=(0,W.A)(c,!v),C=!1===(0,K.A)(v),{shouldRender:b,transitionClassNames:y}=(0,je.A)(v&&!A||r===a.Vw,void 0,C,"slow"),S=(0,s.li)();S.current=t;const N=(0,s.hb)(()=>{(async()=>{const e=await(0,z.sZ)(A);await kh.save(o.nfi,S.current,e),n(r)})()},[A,n,r]);(0,s.vJ)(()=>{A&&p.current&&(N(),p.current=!1)},[A,N]);const k=(0,s.hb)(()=>{A?N():(p.current=!0,g(e=>!e))},[A,N]),w=(0,ge.A)("WallpaperTile",i&&"selected");return(0,se.Y)("div",{className:w,onClick:k,children:(0,se.FD)("div",{className:"media-inner",children:[(0,se.Y)("canvas",{ref:m,className:"thumbnail"}),(0,se.Y)("img",{src:h||d,className:(0,ge.A)("full-media",u),alt:"",draggable:!1}),b&&(0,se.Y)("div",{className:(0,ge.A)("spinner-container",y),children:(0,se.Y)(pe.A,{progress:f,onClick:k})})]})})}),zh=(0,Ce.nF)(e=>e(),6e4,!0),Hh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{background:i,isBlurred:s}=(0,c.Gyz)(e,t)||{},{loadedWallpapers:n}=e.settings;return{background:i,isBlurred:s,loadedWallpapers:n,theme:t}})(({isActive:e,onReset:t,background:i,isBlurred:r,loadedWallpapers:l,theme:c})=>{const{loadWallpapers:d,uploadWallpaper:h,setThemeSettings:m,openSettingsScreen:u}=(0,n.ko)(),p=(0,s.li)();p.current=c,(0,s.vJ)(()=>{zh(()=>{d()})},[d]);const v=(0,s.hb)(e=>{const{files:t}=e.target,i=(0,z.kc)(t);i?.length&&h(i[0])},[h]),g=(0,s.hb)(()=>{(0,Gh.p)("image/jpeg",v,!0)},[v]),A=(0,s.hb)(()=>{u({screen:a.VS.GeneralChatBackgroundColor})},[]),f=(0,s.hb)(()=>{m({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?o.MkD:o.be8})},[m,c]),C=(0,s.hb)(e=>{m({theme:p.current,background:e});const t=l&&l.find(t=>t.slug===e);t?.document.thumbnail&&(0,yn.rX)(t.document.thumbnail.dataUri).then(e=>{m({theme:p.current,backgroundColor:(0,yn.v2)(e),patternColor:(0,yn.Yi)(e)})})},[l,m]),b=(0,s.hb)(e=>{m({theme:p.current,isBlurred:e.target.checked})},[m]),y=(0,B.A)();(0,Ne.A)({isActive:e,onBack:t});const S=l?.[0]&&l[0].slug===a.Vw;return(0,se.FD)("div",{className:"SettingsGeneralBackground settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{icon:"camera-add",className:"mb-0",disabled:S,onClick:g,children:y("UploadImage")}),(0,se.Y)(li.A,{icon:"colorize",className:"mb-0",onClick:A,children:y("SetColor")}),(0,se.Y)(li.A,{icon:"favorite",onClick:f,children:y("ThemeResetToDefaults")}),(0,se.Y)(js.A,{label:y("BackgroundBlurred"),checked:Boolean(r),onChange:b})]}),l?(0,se.Y)("div",{className:"settings-wallpapers",children:l.map(e=>(0,se.Y)(jh,{wallpaper:e,theme:c,isSelected:i===e.slug,onClick:C},e.slug))}):(0,se.Y)(Ls.A,{})]})})),$h=(0,yn.bi)((0,yn.xp)("e6ebee")),qh=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Wh(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 Qh({colorPosition:e,huePosition:t},i){return[t/(i.hueRect.width-1),e[0]/(i.colorRect.width-1),1-e[1]/(i.colorRect.height-1)]}const Zh=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{backgroundColor:i}=(0,c.Gyz)(e,t)||{};return{backgroundColor:i,theme:t}})(({isActive:e,onReset:t,theme:i,backgroundColor:a})=>{const{setThemeSettings:o}=(0,n.ko)(),r=(0,s.li)();r.current=i;const l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(!0),[m,u]=(0,s.J0)(()=>function(e){return e?.startsWith("#")?(0,yn.bi)((0,yn.xp)(e)):$h}(a)),p=(0,s.li)(m);(0,s.vJ)(()=>{p.current=m},[m]);const[v,g,A]=(0,D.A)(),[f,C]=(0,s.J0)(""),[b,y]=(0,s.J0)(""),S=(0,s.li)(),N=(0,s.li)();(0,s.vJ)(()=>{const e={offsetLeft:c.current.offsetLeft,...(0,di.Up)(c.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:d.current.offsetLeft,...(0,di.Up)(d.current.getBoundingClientRect(),["width"])};function i(t){const i=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+l.current.scrollTop),e.height-1)],{huePosition:s}=Wh(p.current,S.current);return u(Qh({colorPosition:i,huePosition:s},S.current)),g(),!0}function s(e){const{colorPosition:i}=Wh(p.current,S.current),s=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return u(Qh({colorPosition:i,huePosition:s},S.current)),g(),!0}S.current={colorRect:e,hueRect:t},(0,Ae.wJ)(c.current,{onCapture:i,onDrag:i,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Ae.wJ)(d.current,{onCapture:s,onDrag:s,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})},[g,A]);const{colorPosition:k=[0,0],huePosition:w=0}=S.current?Wh(m,S.current):{},I=(0,yn.v2)((0,yn.hT)(m)),P=m[0],Y=(0,yn.v2)((0,yn.hT)([P,1,1]));(0,s.vJ)(()=>{const e=(0,yn.hT)(m),t=(0,yn.v2)(e);if(C(e.join(", ")),y(t),!h.current){const i=(0,yn.Yi)(e);o({theme:r.current,background:void 0,backgroundColor:t,patternColor:i})}h.current=!1},[m,o]),(0,s.vJ)(()=>{!function(e,t,i,s){let n,a,o;i.current&&s.current?(n=s.current.colorRect.width,a=s.current.colorRect.height,o=i.current):(n=e.offsetWidth,a=e.offsetHeight,o=e.getContext("2d"),e.width=n,e.height=a,i.current=o);const r=o.createImageData(n,a),l=r.data,c=(0,yn.hT)([t,1,1]);let d=0;for(let e=0;e<a;e++){const t=1-e/(a-1),i=[255*t,255*t,255*t],s=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<n;e++){const t=e/(n-1);l[d++]=i[0]+(s[0]-i[0])*t,l[d++]=i[1]+(s[1]-i[1])*t,l[d++]=i[2]+(s[2]-i[2])*t,l[d++]=255}}o.putImageData(r,0,0)}(c.current.firstChild,P,N,S)},[P]),(0,s.vJ)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const i=e.getContext("2d"),s=i.createImageData(t,1),n=s.data;let a=0;for(let e=0;e<t;e++){const i=e/(t-1),s=(0,yn.hT)([i,1,1]);n[a++]=s[0],n[a++]=s[1],n[a++]=s[2],n[a++]=255}i.putImageData(s,0,0)}(d.current.firstChild)},[]);const F=(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()));u((0,yn.bi)(e))}e.currentTarget.value=t},[]),M=(0,s.hb)(e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&u((0,yn.bi)((0,yn.xp)(t))),e.currentTarget.value=t},[]),T=(0,s.hb)(e=>{u((0,yn.bi)((0,yn.xp)(e.currentTarget.dataset.color)))},[]),B=(0,ge.A)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{ref:l,className:B,children:[(0,se.FD)("div",{className:"settings-item pt-3",children:[(0,se.FD)("div",{ref:c,className:"color-picker",children:[(0,se.Y)("canvas",{}),(0,se.Y)("div",{className:"handle",style:`transform: translate(${k[0]}px, ${k[1]}px); background-color: ${I};`})]}),(0,se.FD)("div",{ref:d,className:"hue-picker",children:[(0,se.Y)("canvas",{}),(0,se.Y)("div",{className:"handle",style:`transform: translateX(${w}px); background-color: ${Y};`})]}),(0,se.FD)("div",{className:"tools",children:[(0,se.Y)(ee.A,{value:b,label:"HEX",onChange:M}),(0,se.Y)(ee.A,{value:f,label:"RGB",onChange:F})]})]}),(0,se.Y)("div",{className:"predefined-colors",children:qh.map(e=>(0,se.Y)("div",{className:(0,ge.A)("predefined-color",e===I?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:T}))})]})})),Xh=(0,s.ph)(({currentScreen:e,editedFolderId:t,onReset:i})=>{const{signOut:o,openDeleteChatFolderModal:r,openSettingsScreen:l}=(0,n.ko)(),{isMobile:c}=(0,Y.Ay)(),[d,h]=(0,s.J0)(!1),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,()=>{l({screen:a.VS.Experimental})}),u=(0,s.hb)(()=>{h(!0)},[]),p=(0,s.hb)(()=>{h(!1)},[]),v=(0,s.hb)(()=>{t&&r({folderId:t})},[t,r]),g=(0,s.hb)(()=>{p(),o({forceInitApi:!0})},[p,o]),A=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[c]),f=(0,B.A)(),C=(0,Fi.A)();return(0,se.FD)("div",{className:"left-header",children:[(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:f("AccDescrGoBack"),iconName:"arrow-left"}),function(){switch(e){case a.VS.EditProfile:return(0,se.Y)("h3",{children:f("lng_settings_information")});case a.VS.General:return(0,se.Y)("h3",{children:f("General")});case a.VS.QuickReaction:return(0,se.Y)("h3",{children:f("DoubleTapSetting")});case a.VS.CustomEmoji:return(0,se.Y)("h3",{children:f("Emoji")});case a.VS.Notifications:return(0,se.Y)("h3",{children:f("Notifications")});case a.VS.DataStorage:return(0,se.Y)("h3",{children:f("DataSettings")});case a.VS.Privacy:return(0,se.Y)("h3",{children:f("PrivacySettings")});case a.VS.Language:return(0,se.Y)("h3",{children:f("Language")});case a.VS.DoNotTranslate:return(0,se.Y)("h3",{children:f("DoNotTranslate")});case a.VS.Stickers:return(0,se.Y)("h3",{children:f("StickersName")});case a.VS.Experimental:return(0,se.Y)("h3",{children:f("lng_settings_experimental")});case a.VS.GeneralChatBackground:return(0,se.Y)("h3",{children:f("ChatBackground")});case a.VS.GeneralChatBackgroundColor:return(0,se.Y)("h3",{children:f("SetColor")});case a.VS.PrivacyPhoneNumber:return(0,se.Y)("h3",{children:f("PrivacyPhone")});case a.VS.PrivacyLastSeen:return(0,se.Y)("h3",{children:f("PrivacyLastSeen")});case a.VS.PrivacyProfilePhoto:return(0,se.Y)("h3",{children:f("Privacy.ProfilePhoto")});case a.VS.PrivacyBio:return(0,se.Y)("h3",{children:f("PrivacyBio")});case a.VS.PrivacyBirthday:return(0,se.Y)("h3",{children:f("PrivacyBirthday")});case a.VS.PrivacyGifts:return(0,se.Y)("h3",{children:C("PrivacyGifts")});case a.VS.PrivacyForwarding:return(0,se.Y)("h3",{children:f("PrivacyForwards")});case a.VS.PrivacyVoiceMessages:return(0,se.Y)("h3",{children:f("PrivacyVoiceMessages")});case a.VS.PrivacyMessages:return(0,se.Y)("h3",{children:f("PrivacyMessages")});case a.VS.PrivacyGroupChats:return(0,se.Y)("h3",{children:f("AutodownloadGroupChats")});case a.VS.PrivacyPhoneCall:return(0,se.Y)("h3",{children:f("Calls")});case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:return(0,se.Y)("h3",{children:f("AlwaysShareWith")});case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,se.Y)("h3",{children:f("NeverShareWith")});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:return(0,se.Y)("h3",{children:f("AlwaysAllow")});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:return(0,se.Y)("h3",{children:f("NeverAllow")});case a.VS.PrivacyNoPaidMessages:return(0,se.Y)("h3",{children:C("RemoveFeeTitle")});case a.VS.Performance:return(0,se.Y)("h3",{children:C("MenuAnimations")});case a.VS.ActiveSessions:return(0,se.Y)("h3",{children:f("SessionsTitle")});case a.VS.ActiveWebsites:return(0,se.Y)("h3",{children:f("OtherWebSessions")});case a.VS.PrivacyBlockedUsers:return(0,se.Y)("h3",{children:f("BlockedUsers")});case a.VS.TwoFaDisabled:case a.VS.TwoFaEnabled:return(0,se.Y)("h3",{children:f("TwoStepVerification")});case a.VS.TwoFaNewPassword:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:return(0,se.Y)("h3",{children:f("PleaseEnterCurrentPassword")});case a.VS.TwoFaNewPasswordConfirm:return(0,se.Y)("h3",{children:f("PleaseReEnterPassword")});case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaChangePasswordHint:return(0,se.Y)("h3",{children:f("PasswordHint")});case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaRecoveryEmail:return(0,se.Y)("h3",{children:f("RecoveryEmailTitle")});case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaRecoveryEmailCode:return(0,se.Y)("h3",{children:"Recovery Email Code"});case a.VS.TwoFaCongratulations:return(0,se.Y)("h3",{children:f("TwoStepVerificationPasswordSet")});case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,se.Y)("h3",{children:f("PleaseEnterCurrentPassword")});case a.VS.PasscodeDisabled:case a.VS.PasscodeEnabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeCongratulations:return(0,se.Y)("h3",{children:f("Passcode")});case a.VS.PasscodeTurnOff:return(0,se.Y)("h3",{children:f("PasscodeController.Disable.Title")});case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:return(0,se.Y)("h3",{children:f("PasscodeController.Change.Title")});case a.VS.PasscodeChangePasscodeConfirm:return(0,se.Y)("h3",{children:f("PasscodeController.ReEnterPasscode.Placeholder")});case a.VS.Folders:return(0,se.Y)("h3",{children:f("Filters")});case a.VS.FoldersCreateFolder:return(0,se.Y)("h3",{children:f("FilterNew")});case a.VS.FoldersShare:return(0,se.Y)("h3",{children:f("FolderLinkScreen.Title")});case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:return(0,se.FD)("div",{className:"settings-main-header",children:[(0,se.Y)("h3",{children:f("FilterEdit")}),Boolean(t)&&(0,se.Y)(me.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,se.Y)(ue.A,{icon:"delete",destructive:!0,onClick:v,children:f("Delete")})})]});case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:return(0,se.Y)("h3",{children:f(e===a.VS.FoldersIncludedChats||e===a.VS.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude")});case a.VS.Passkeys:return(0,se.Y)("h3",{children:C("SettingsPasskeyTitle")});default:return(0,se.FD)("div",{className:"settings-main-header",children:[(0,se.Y)("h3",{onClick:m,children:f("SETTINGS")}),(0,se.Y)(X.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",onClick:()=>l({screen:a.VS.EditProfile}),ariaLabel:f("lng_settings_information"),iconName:"edit"}),(0,se.Y)(me.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,se.Y)(ue.A,{icon:"logout",onClick:u,children:f("LogOutTitle")})})]})}}(),(0,se.Y)(ai.A,{isOpen:d,onClose:p,text:f("lng_sure_logout"),confirmLabel:f("AccountSettings.Logout"),confirmHandler:g,confirmIsDestructive:!0})]})});var em=i(6e4);const tm=(0,s.ph)((0,n.EK)(e=>{const{canTranslate:t,canTranslateChats:i,doNotTranslate:s}=e.settings.byKey,{language:n,languages:a}=(0,Ys.lS)(e);return{isCurrentUserPremium:(0,c.g29)(e),languages:a,language:n,canTranslate:t,canTranslateChats:i,doNotTranslate:s}})(({isActive:e,isCurrentUserPremium:t,languages:i,language:o,canTranslate:r,canTranslateChats:l,doNotTranslate:c,onReset:d})=>{const{loadLanguages:h,setSettingOption:u,setSharedSettingOption:p,openPremiumModal:v,openSettingsScreen:g}=(0,n.ko)(),[A,f]=(0,s.J0)(o),[C,b,y]=(0,D.A)(),S=t&&l,N=(0,B.A)();(0,s.vJ)(()=>{i?.length||h()},[i]);const k=(0,T.A)(e=>{f(e),b(),(0,em.wT)(e,()=>{y(),p({language:e})})}),w=(0,s.Kr)(()=>{if(!i)return;const e=(window.navigator.language||"en").toLowerCase(),t=e.substr(0,2);return i.map(({langCode:e,nativeName:t,name:i})=>({value:e,label:t,subLabel:i,isLoading:e===A&&C})).sort(i=>!e||i.value!==e&&i.value!==t?0:-1)},[C,i,A]),I=(0,T.A)(e=>{u({canTranslate:e})}),P=(0,T.A)(e=>{u({canTranslateChats:e})}),Y=(0,T.A)(()=>{t||v({initialSection:"translations"})}),F=(0,s.Kr)(()=>{if(m.CM&&c.length)return 1===c.length?new Intl.DisplayNames([o],{type:"language"}).of(c[0]):N("Languages",c.length)},[c,N,o]),M=(0,T.A)(()=>{g({screen:a.VS.DoNotTranslate})});return(0,Ne.A)({isActive:e,onBack:d}),(0,se.FD)("div",{className:"settings-content settings-language custom-scroll",children:[m.CM&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:N("ShowTranslateButton"),checked:r,onCheck:I}),(0,se.Y)(js.A,{label:N("ShowTranslateChatButton"),checked:S,disabled:!t,rightIcon:t?void 0:"lock",onClickLabel:Y,onCheck:P}),(r||S)&&(0,se.FD)(li.A,{narrow:!0,onClick:M,children:[N("DoNotTranslate"),(0,se.Y)("span",{className:"settings-item__current-value",children:F})]}),(0,se.Y)("p",{className:"settings-item-description mb-0 mt-1",children:N("lng_translate_settings_about")})]}),(0,se.FD)("div",{className:"settings-item settings-item-picker",children:[(0,se.Y)("h4",{className:"settings-item-header",children:N("Localization.InterfaceLanguage")}),w?(0,se.Y)(Ac,{items:w,selectedValue:A,forceRenderAllItems:!0,onSelectedValueChange:k,itemInputType:"radio",className:"settings-picker"}):(0,se.Y)(Ls.A,{})]})]})}));var im=i(86046),sm=i(25301),nm=i(87970);const am=(0,s.ph)((0,n.EK)(e=>{const{currentUserId:t}=e,i=(0,c.hc)(e),s=e.stars?.balance,n=e.ton?.balance;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,c.n_C)(e),isGiveawayAvailable:i,starsBalance:s,tonBalance:n}})(({isActive:e,currentUserId:t,sessionCount:i,canBuyPremium:r,isGiveawayAvailable:l,starsBalance:c,tonBalance:d,onReset:h})=>{const{loadMoreProfilePhotos:m,openPremiumModal:u,openSupportChat:p,openUrl:v,openGiftRecipientPicker:g,openStarsBalanceModal:A,openSettingsScreen:f}=(0,n.ko)(),[C,b,y]=(0,D.A)(!1),S=(0,Fi.A)();(0,s.vJ)(()=>{t&&m({peerId:t,isPreload:!0})},[t]),(0,Ne.A)({isActive:e,onBack:h});const N=(0,T.A)(()=>{p(),y()});return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-main-menu self-profile",children:[t&&(0,se.Y)(nm.A,{peerId:t,canPlayVideo:Boolean(e),isForSettings:!0}),t&&(0,se.Y)(sm.A,{chatOrUserId:t,isInSettings:!0})]}),(0,se.FD)("div",{className:"settings-main-menu",children:[(0,se.Y)(li.A,{icon:"settings",narrow:!0,onClick:()=>f({screen:a.VS.General}),children:S("TelegramGeneralSettingsViewController")}),(0,se.Y)(li.A,{icon:"animations",narrow:!0,onClick:()=>f({screen:a.VS.Performance}),children:S("MenuAnimations")}),(0,se.Y)(li.A,{icon:"unmute",narrow:!0,onClick:()=>f({screen:a.VS.Notifications}),children:S("Notifications")}),(0,se.Y)(li.A,{icon:"data",narrow:!0,onClick:()=>f({screen:a.VS.DataStorage}),children:S("DataSettings")}),(0,se.Y)(li.A,{icon:"lock",narrow:!0,onClick:()=>f({screen:a.VS.Privacy}),children:S("PrivacySettings")}),(0,se.Y)(li.A,{icon:"folder",narrow:!0,onClick:()=>f({screen:a.VS.Folders}),children:S("Filters")}),(0,se.FD)(li.A,{icon:"active-sessions",narrow:!0,onClick:()=>f({screen:a.VS.ActiveSessions}),children:[S("SessionsTitle"),i>0&&(0,se.Y)("span",{className:"settings-item__current-value",children:i})]}),(0,se.FD)(li.A,{icon:"language",narrow:!0,onClick:()=>f({screen:a.VS.Language}),children:[S("Language"),(0,se.Y)("span",{className:"settings-item__current-value",children:S.languageInfo.nativeName})]}),(0,se.Y)(li.A,{icon:"stickers",narrow:!0,onClick:()=>f({screen:a.VS.Stickers}),children:S("MenuStickers")})]}),(0,se.FD)("div",{className:"settings-main-menu",children:[r&&(0,se.Y)(li.A,{leftElement:(0,se.Y)(lh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),narrow:!0,onClick:()=>u(),children:S("TelegramPremium")}),(0,se.FD)(li.A,{leftElement:(0,se.Y)(lh.A,{className:"icon ListItem-main-icon",type:"gold",size:"big"}),narrow:!0,onClick:()=>A({}),children:[S("MenuStars"),Boolean(c)&&(0,se.Y)("span",{className:"settings-item__current-value",children:(0,im.ZF)(S,c)})]}),(0,se.FD)(li.A,{leftElement:(0,se.Y)(he.A,{className:"icon ListItem-main-icon",name:"toncoin"}),narrow:!0,onClick:()=>A({currency:o.ykW}),children:[S("MenuTon"),Boolean(d)&&(0,se.Y)("span",{className:"settings-item__current-value",children:(0,va.UL)(d.amount,d.currency)})]}),l&&(0,se.Y)(li.A,{icon:"gift",narrow:!0,onClick:()=>g(),children:S("MenuSendGift")})]}),(0,se.FD)("div",{className:"settings-main-menu",children:[(0,se.Y)(li.A,{icon:"ask-support",narrow:!0,onClick:b,children:S("AskAQuestion")}),(0,se.Y)(li.A,{icon:"help",narrow:!0,onClick:()=>v({url:o.r9K}),children:S("MenuTelegramFaq")}),(0,se.Y)(li.A,{icon:"privacy-policy",narrow:!0,onClick:()=>v({url:o.pkx}),children:S("MenuPrivacyPolicy")})]}),(0,se.Y)(ai.A,{isOpen:C,confirmLabel:S("OK"),title:S("AskAQuestion"),textParts:S("MenuAskText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:N,onClose:y})]})}));var om=i(5560),rm=i(56133);const lm=(0,s.ph)((0,n.EK)(e=>({hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume,notifyDefaults:e.settings.notifyDefaults}))(({isActive:e,onReset:t,notifyDefaults:i,hasContactJoinedNotifications:a,hasPushNotifications:o,hasWebNotifications:r,notificationSoundVolume:l})=>{const{loadNotificationSettings:c,updateContactSignUpNotification:d,updateNotificationSettings:h,updateWebNotificationSettings:m}=(0,n.ko)();(0,s.vJ)(()=>{c()},[c]);const u=(0,rm.A)(500,!0),p=(0,om.M2)(),v=p&&!(0,om.Ac)(),g=Boolean(i?.channels?.mutedUntil),A=Boolean(i?.groups?.mutedUntil),f=Boolean(i?.users?.mutedUntil),C=(0,s.hb)((e,t,s)=>{const n=Boolean(i?.[t]?.mutedUntil),a=Boolean(i?.[t]?.shouldShowPreviews);h({peerType:t,isMuted:"mute"===s?!e.target.checked:n,shouldShowPreviews:"showPreviews"===s?e.target.checked:a})},[i]),b=(0,s.hb)(e=>{const t=e.target.checked;m({hasWebNotifications:t,...!t&&{hasPushNotifications:!1}})},[m]),y=(0,s.hb)(e=>{m({hasPushNotifications:e.target.checked})},[m]),S=(0,s.hb)(e=>{C(e,"users","mute")},[C]),N=(0,s.hb)(e=>{C(e,"users","showPreviews")},[C]),k=(0,s.hb)(e=>{C(e,"groups","mute")},[C]),w=(0,s.hb)(e=>{C(e,"groups","showPreviews")},[C]),I=(0,s.hb)(e=>{C(e,"channels","mute")},[C]),P=(0,s.hb)(e=>{C(e,"channels","showPreviews")},[C]),Y=(0,s.hb)(e=>{d({isSilent:!e.target.checked})},[d]),F=(0,s.hb)(e=>{m({notificationSoundVolume:e}),u(()=>(0,om.BA)(void 0,e))},[u,m]),D=(0,Fi.A)();return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("NotificationsWeb")}),(0,se.Y)(js.A,{label:D("NotificationsWeb"),subLabel:D(r?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:r,disabled:!p,onChange:b}),(0,se.Y)(js.A,{label:D("NotificationsOffline"),disabled:!r||!v,subLabel:D(v?o?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled":"SettingsOfflineNotificationUnsupported"),checked:o,onChange:y}),(0,se.Y)("div",{className:"settings-item-slider",children:(0,se.Y)(Xe.A,{label:D("NotificationsSound"),min:0,max:10,disabled:!p,value:l,onChange:F})})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("AutodownloadPrivateChats")}),(0,se.Y)(js.A,{label:D("NotificationsForPrivateChats"),subLabel:D(f?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!f,onChange:S}),(0,se.Y)(js.A,{label:D("MessagePreview"),disabled:f,subLabel:D(i?.users?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.users?.shouldShowPreviews),onChange:N})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("FilterGroups")}),(0,se.Y)(js.A,{label:D("NotificationsForGroups"),subLabel:D(A?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!A,onChange:k}),(0,se.Y)(js.A,{label:D("MessagePreview"),disabled:A,subLabel:D(i?.groups?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.groups?.shouldShowPreviews),onChange:w})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("FilterChannels")}),(0,se.Y)(js.A,{label:D("NotificationsForChannels"),subLabel:D(g?"UserInfoNotificationsDisabled":"UserInfoNotificationsEnabled"),checked:!g,onChange:I}),(0,se.Y)(js.A,{label:D("MessagePreview"),disabled:g,subLabel:D(i?.channels?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.channels?.shouldShowPreviews),onChange:P})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:D.isRtl?"rtl":void 0,children:D("PhoneOther")}),(0,se.Y)(js.A,{label:D("ContactJoined"),checked:a,onChange:Y})]})]})})),cm=2*g.$,dm=(0,s.ph)((0,n.EK)(e=>({passkeys:e.settings.passkeys,maxPasskeysCount:e.appConfig.passkeysMaxCount}))(({isActive:e,passkeys:t,maxPasskeysCount:i,onReset:a})=>{const{startPasskeyRegistration:o,deletePasskey:r,openPasskeyModal:l}=(0,n.ko)(),c=(0,Fi.A)(),[d,h]=(0,s.J0)(),u=m.DL&&(t?.length??0)<i,p=(0,T.A)(()=>{o()}),v=(0,T.A)(()=>{l()}),g=(0,T.A)(()=>{d&&(r({id:d}),h(void 0))});return(0,s.vJ)(()=>{t&&!t.length&&e&&a()},[t,a,e]),(0,Ne.A)({isActive:e,onBack:a}),(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Passkeys,previewUrl:Da.d.Passkeys,size:120,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description",dir:"auto",children:c("SettingsPasskeyInfo")})]}),(0,se.FD)("div",{className:"settings-item",children:[t?.map(function(e){const{softwareEmojiId:t,id:i,name:s,date:n,lastUsageDate:a}=e;return(0,se.Y)(li.A,{ripple:!0,narrow:!0,contextActions:[{title:c("Delete"),icon:"delete",destructive:!0,handler:()=>{h(i)}}],leftElement:t?(0,se.Y)(sn.A,{size:cm,className:(0,ge.A)("KYlz_M1L","ListItem-main-icon"),documentId:t,noPlay:!0}):(0,se.Y)(he.A,{name:"lock",className:(0,ge.A)("eHtPi2EI","ListItem-main-icon")}),children:(0,se.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,se.Y)("span",{className:"date",children:(0,We.vm)(c,n)}),(0,se.Y)("span",{className:"title",children:s||c("SettingsPasskeyFallbackTitle")}),Boolean(a)&&(0,se.Y)("span",{className:"subtitle",children:c("SettingsPasskeyUsedAt",{date:(0,We.vm)(c,a)})})]})},i)}),u&&(0,se.Y)(X.A,{className:"settings-button",color:"primary",iconName:"add",isText:!0,noForcedUpperCase:!0,onClick:p,children:c("SettingsPasskeysCreate")}),(0,se.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:c("SettingsPasskeysFooter",{link:(0,se.Y)(Mo.A,{isPrimary:!0,onClick:v,children:c("SettingsPasskeysFooterLink",void 0,{withNodes:!0,specialReplacement:(0,wi.dE)()})})},{withNodes:!0})})]}),(0,se.Y)(ai.A,{isOpen:Boolean(d),title:c("PasskeyDeleteTitle"),textParts:c("PasskeyDeleteText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:g,confirmIsDestructive:!0,confirmLabel:c("Delete"),onClose:()=>h(void 0)})]})}));var hm=i(20714),mm=i(22986);const um=["SettingsPerformanceSliderLow","SettingsPerformanceSliderMedium","SettingsPerformanceSliderHigh"],pm=["SettingsPerformanceSliderLow","SettingsPerformanceSliderCustom","SettingsPerformanceSliderHigh"],vm=[["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:!m.Fy},{key:"messageBlur",label:"SettingsPerformanceMessageBlur",disabled:!m.Fy},{key:"rightColumnAnimations",label:"SettingsPerformanceRightColumn"},{key:"snapEffect",label:"SettingsPerformanceThanos"},{key:"textStreaming",label:"SettingsPerformanceTextStreaming"}]],["SettingsPerformanceStickers",[{key:"animatedEmoji",label:"SettingsPerformanceAnimatedEmoji"},{key:"loopAnimatedStickers",label:"SettingsPerformanceLoopStickers"},{key:"reactionEffects",label:"SettingsPerformanceReactionEffects"},{key:"stickerEffects",label:"SettingsPerformanceStickerEffects"}]],["SettingsPerformanceMediaAutoplay",[{key:"autoplayGifs",label:"SettingsPerformanceAutoplayGif"},{key:"autoplayVideos",label:"SettingsPerformanceAutoplayVideo"}]]],gm=(0,s.ph)((0,n.EK)(e=>({performanceSettings:(0,c.Cw0)(e)}))(function({isActive:e,performanceSettings:t,onReset:i}){const{setSharedSettingOption:a,updatePerformanceSettings:r}=(0,n.ko)();(0,Ne.A)({isActive:e,onBack:i});const l=(0,Fi.A)(),[c,d]=(0,s.J0)({}),h=(0,s.Kr)(()=>vm.reduce((e,[,i],s)=>(e[s]=i.every(({key:e})=>t[e]),e),{}),[t]),u=(0,s.Kr)(()=>(0,mm.T)(t,hm.LH)?o.zP3:(0,mm.T)(t,hm.PI)?o.dnp:(0,mm.T)(t,hm.tS)?o.zHL:o.M8B,[t]),p=(0,s.Kr)(()=>(u===o.M8B?pm:um).map(e=>l(e)),[u,l]),v=(0,s.hb)((e,t)=>{e.preventDefault();const i=Number(t);d(e=>({...e,[i]:!e[i]}))},[]),g=(0,s.hb)(e=>{const t=e===o.dnp?hm.PI:e===o.zHL?hm.tS:hm.LH;a({animationLevel:e,wasAnimationLevelSetManually:!0}),r(t)},[]),A=(0,s.hb)(e=>{const{name:t,checked:i}=e.target,s=vm.find(([e])=>e===t);if(!s)return;const n=s[1].reduce((e,{key:t})=>(e[t]=i,e),{});r(n)},[]),f=(0,s.hb)(e=>{const{name:t,checked:i}=e.target;r({[t]:i})},[]);return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderTitle")}),(0,se.Y)("p",{className:"settings-item-description",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderSubtitle")}),(0,se.Y)(Xe.A,{options:p,value:u===o.M8B?o.zHL:u,onChange:g})]}),(0,se.FD)("div",{className:"settings-item-simple settings-item__with-shifted-dropdown",children:[(0,se.Y)("h3",{className:"settings-item-header",dir:"auto",children:l("SettingsPerformanceGranularTitle")}),vm.map(([e,i],s)=>(0,se.FD)("div",{className:"settings-dropdown-section",children:[(0,se.Y)("div",{className:"ListItem with-checkbox",children:(0,se.Y)(js.A,{name:e,value:s.toString(),checked:h[s],label:l(e),rightIcon:c[s]?"up":"down",onChange:A,onClickLabel:v})}),Boolean(c[s])&&(0,se.Y)("div",{className:"DropdownList DropdownList--open",children:i.map(({key:e,label:i,disabled:s})=>{if("snapEffect"!==e||m.bW)return(0,se.Y)(js.A,{name:e,checked:t[e],label:l(i),disabled:s,onChange:f},e)})})]},e))]})]})})),Am=(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,passkeys:d},blocked:h,passcode:{hasPasscode:m},appConfig:u}=e,{canDisplayChatInTitle:p}=(0,Ys.lS)(e),v=Boolean(o),g=(0,c.trm)(e),A=(0,c.g29)(e);return{isCurrentUserPremium:A,hasPassword:t,hasPasscode:Boolean(m),blockedCount:h.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:i,canDisplayAutoarchiveSetting:u.canDisplayAutoarchiveSetting||A,shouldArchiveAndMuteNewNonContact:n,canChangeSensitive:s,shouldNewNonContactPeersRequirePremium:a,shouldChargeForMessages:v,needAgeVideoVerification:Boolean(u.needAgeVideoVerification),privacy:r,canDisplayChatInTitle:p,canSetPasscode:(0,c.Ntz)(e),isCurrentUserFrozen:g,accountDaysTtl:l,passkeyCount:d?.length,arePasskeysAvailable:u.arePasskeysAvailable}})(({isActive:e,isCurrentUserPremium:t,hasPassword:i,hasPasscode:r,blockedCount:l,webAuthCount:c,passkeyCount:d,arePasskeysAvailable:h,isSensitiveEnabled:m,canChangeSensitive:u,canDisplayAutoarchiveSetting:p,shouldArchiveAndMuteNewNonContact:v,shouldNewNonContactPeersRequirePremium:g,shouldChargeForMessages:A,canDisplayChatInTitle:f,canSetPasscode:C,needAgeVideoVerification:b,privacy:y,isCurrentUserFrozen:S,accountDaysTtl:N,onReset:k})=>{const{openDeleteAccountModal:w,loadPrivacySettings:I,loadBlockedUsers:P,updateContentSettings:Y,loadGlobalPrivacySettings:F,updateGlobalPrivacySettings:D,loadWebAuthorizations:M,setSharedSettingOption:L,openSettingsScreen:R,loadAccountDaysTtl:x,openAgeVerificationModal:E,loadPasskeys:V,openPasskeyModal:_}=(0,n.ko)();(0,s.vJ)(()=>{S||(P(),I({}),M(),V())},[S]),(0,s.vJ)(()=>{e&&!S&&(F(),x())},[e,S]);const U=(0,B.A)(),O=(0,Fi.A)();(0,Ne.A)({isActive:e,onBack:k});const K=(0,T.A)(e=>{D({shouldArchiveAndMuteNewNonContact:e})}),J=(0,T.A)(e=>{L({canDisplayChatInTitle:e})}),G=(0,T.A)(e=>{Y({isSensitiveEnabled:e})}),j=(0,T.A)(()=>{E()}),z=(0,T.A)(()=>{N&&w({days:N})}),H=(0,T.A)(()=>{h&&void 0!==d&&(0!==d?R({screen:a.VS.Passkeys}):_())}),$=(0,s.Kr)(()=>{if(N)return Xr(o.WF4,N/30).toString()},[N]);function q(e){if(!e)return U("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?O("PrivacyValueBots"):"",O.conjunction(l)].filter(Boolean).join(" ");if(a&&!n)return c;if(i)return U(c?"ContactsAndPremium":"PrivacyPremium");switch(t){case"everybody":return`${U("P2PEverybody")} ${c}`;case"contacts":return`${U("P2PContacts")} ${c}`;case"nobody":return`${U("P2PNobody")} ${c}`}}return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.FD)(li.A,{icon:"delete-user",narrow:!0,onClick:()=>R({screen:a.VS.PrivacyBlockedUsers}),children:[U("BlockedUsers"),(0,se.Y)("span",{className:"settings-item__current-value",children:l||""})]}),C&&(0,se.Y)(li.A,{icon:"lock",narrow:!0,onClick:()=>R({screen:r?a.VS.PasscodeEnabled:a.VS.PasscodeDisabled}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("Passcode")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:O(r?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),(0,se.Y)(li.A,{icon:"admin",narrow:!0,onClick:()=>R({screen:i?a.VS.TwoFaEnabled:a.VS.TwoFaDisabled}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("TwoStepVerification")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:O(i?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),h&&(0,se.Y)(li.A,{icon:"key",narrow:!0,onClick:H,children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:O("SettingsItemPrivacyPasskeys")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:O(void 0===d?"Loading":d>0?"SettingsItemPrivacyOn":"SettingsItemPrivacyOff")})]})}),c>0&&(0,se.FD)(li.A,{icon:"web",narrow:!0,onClick:()=>R({screen:a.VS.ActiveWebsites}),children:[U("PrivacySettings.WebSessions"),(0,se.Y)("span",{className:"settings-item__current-value",children:c})]})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:O.isRtl?"rtl":void 0,children:U("PrivacyTitle")}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyPhoneNumber}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyPhoneTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.phoneNumber)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyLastSeen}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("LastSeenTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.lastSeen)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyProfilePhoto}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyProfilePhotoTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.profilePhoto)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyBio}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyBio")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.bio)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyBirthday}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyBirthday")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.birthday)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyGifts}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:O("PrivacyGifts")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.gifts)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyForwarding}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyForwardsTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.forwards)})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyPhoneCall}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("WhoCanCallMe")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.phoneCall)})]})}),(0,se.Y)(li.A,{narrow:!0,allowDisabledClick:!0,rightElement:t&&(0,se.Y)(lh.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyVoiceMessages}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyVoiceMessagesTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.voiceMessages)})]})}),(0,se.Y)(li.A,{narrow:!0,rightElement:t&&(0,se.Y)(lh.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyMessages}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("PrivacyMessagesTitle")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:A?O("PrivacyPaidMessagesValue"):U(g?"PrivacyMessagesContactsAndPremium":"P2PEverybody")})]})}),(0,se.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>R({screen:a.VS.PrivacyGroupChats}),children:(0,se.FD)("div",{className:"multiline-item",children:[(0,se.Y)("span",{className:"title",children:U("WhoCanAddMe")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:q(y.chatInvite)})]})})]}),u&&(0,se.FD)("div",{className:"settings-item fluid-container",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:O.isRtl?"rtl":void 0,children:U("lng_settings_sensitive_title")}),(0,se.Y)(js.A,{label:U("lng_settings_sensitive_disable_filtering"),subLabel:U("lng_settings_sensitive_about"),checked:Boolean(m),disabled:!u||!m&&b,onCheck:G}),!m&&b&&(0,se.Y)(X.A,{color:"primary",fluid:!0,noForcedUpperCase:!0,className:"settings-unlock-button",onClick:j,children:(0,se.Y)("span",{className:"settings-unlock-button-title",children:O("ButtonAgeVerification")})})]}),p&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:O.isRtl?"rtl":void 0,children:U("NewChatsFromNonContacts")}),(0,se.Y)(js.A,{label:U("ArchiveAndMute"),subLabel:U("ArchiveAndMuteInfo"),checked:Boolean(v),onCheck:K})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:O.isRtl?"rtl":void 0,children:U("lng_settings_window_system")}),(0,se.Y)(js.A,{label:U("lng_settings_title_chat_name"),checked:Boolean(f),onCheck:J})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:O.isRtl?"rtl":void 0,children:O("DeleteMyAccount")}),(0,se.FD)(li.A,{narrow:!0,onClick:z,children:[O("DeleteAccountIfAwayFor"),(0,se.Y)("span",{className:"settings-item__current-value",children:O("Months",{count:$},{pluralValue:1})})]})]})]})})),fm=(0,s.ph)((0,n.EK)(e=>{const{users:{byId:t},blocked:{ids:i},contactList:s,currentUserId:n}=e;return{usersById:t,blockedIds:i,contactIds:s?.userIds,localContactIds:(0,c.nTw)(e).userSearch.localUserIds,currentUserId:n}})(({usersById:e,blockedIds:t,contactIds:i,localContactIds:a,currentUserId:o,isOpen:r,onClose:c})=>{const{setUserSearchQuery:d,blockUser:h}=(0,n.ko)(),m=(0,Fi.A)(),[u,p]=(0,s.J0)("");(0,s.vJ)(()=>{d({query:u})},[u,d]);const v=(0,s.Kr)(()=>{const s=(0,di.Am)([...i||[],...a||[]].filter(e=>e!==o&&!t.includes(e)));return(0,It.PU)({ids:s,query:u,type:"user"}).sort((t,i)=>{const s=(0,l.Yg)(e[t])||"",n=(0,l.Yg)(e[i])||"";return s.localeCompare(n)})},[t,i,o,u,a,e]),g=(0,s.hb)(e=>{h({userId:e}),c()},[c]);return(0,se.Y)(Os,{isOpen:r,chatOrUserIds:v,title:m("BlockedUsersBlockUser"),searchPlaceholder:m("Search"),search:u,onSearchChange:p,onSelectChatOrUser:g,onClose:c})})),Cm=(0,s.ph)((0,n.EK)(e=>{const{chats:{byId:t},users:{byId:i},blocked:{ids:s},countryList:{phoneCodes:n}}=e;return{chatsByIds:t,usersByIds:i,blockedIds:s,phoneCodeList:n}})(({isActive:e,onReset:t,chatsByIds:i,usersByIds:a,blockedIds:r,phoneCodeList:c})=>{const{unblockUser:d}=(0,n.ko)(),h=(0,B.A)(),[m,u,p]=(0,D.A)(),g=(0,s.hb)(e=>{d({userId:e})},[d]);(0,Ne.A)({isActive:e,onBack:t});const A=(0,s.Kr)(()=>r.reduce((e,t)=>{const i=(0,v.L8)(t)?a[t]:void 0,s=i&&!i.phoneNumber&&(0,l.Kl)(i);return s&&(e[t]=s),e},{}),[r,a]);return(0,se.FD)("div",{className:"settings-fab-wrapper",children:[(0,se.FD)("div",{className:"settings-content infinite-scroll",children:[(0,se.Y)("div",{className:"settings-item no-border",children:(0,se.Y)("p",{className:"settings-item-description-larger mt-0 mb-2",dir:h.isRtl?"rtl":void 0,children:h("BlockedUsersInfo")})}),(0,se.Y)("div",{className:"chat-list custom-scroll",children:r?.length?(0,se.Y)("div",{className:"scroll-container settings-item",children:r.map((e,t)=>function(e,t){const s=(0,v.L8)(e),n=a[e],r=i[e],l=n||r,d=(0,ge.A)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group"),h=A[e];return(0,se.FD)(li.A,{className:d,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{g(e)}}],style:`top: ${(0+t)*o.yq1}px;`,children:[(0,se.Y)(Yt.A,{size:"medium",peer:l}),(0,se.FD)("div",{className:"contact-info",dir:"auto",children:[l&&(0,se.Y)(Rs.A,{peer:l}),n?.phoneNumber&&(0,se.Y)("div",{className:"contact-phone",dir:"auto",children:(0,tn.Ox)(c,n.phoneNumber)}),h&&(0,se.FD)("div",{className:"contact-username",dir:"auto",children:["@",h]})]})]},`blocked_${e}`)}(e,t))}):r&&!r.length?(0,se.Y)("div",{className:"no-results",dir:"auto",children:h("NoBlocked")}):(0,se.Y)(Ls.A,{},"loading")})]}),(0,se.Y)(pi.A,{isShown:!0,className:"block-user-button",onClick:u,ariaLabel:h("BlockContact"),iconName:"add"}),(0,se.Y)(fm,{isOpen:m,onClose:p})]})}));function bm(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 ym=(0,s.ph)((0,n.EK)(e=>{const{settings:{byKey:{disallowedGifts:t}}}=e;return{disallowedGifts:t,isCurrentUserPremium:(0,c.g29)(e)}})(({disallowedGifts:e,isCurrentUserPremium:t})=>{const{showNotification:i,updateGlobalPrivacySettings:s}=(0,n.ko)(),a=(0,Fi.A)(),o=(0,T.A)(()=>{i({message:a("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),r=(0,T.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowLimitedStarGifts:!e?.shouldDisallowLimitedStarGifts||void 0}}):o()}),l=(0,T.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowUnlimitedStarGifts:!e?.shouldDisallowUnlimitedStarGifts||void 0}}):o()}),c=(0,T.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowUniqueStarGifts:!e?.shouldDisallowUniqueStarGifts||void 0}}):o()}),d=(0,T.A)(()=>{t?s({disallowedGifts:{...e,shouldDisallowPremiumGifts:!e?.shouldDisallowPremiumGifts||void 0}}):o()});return(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:a.isRtl?"rtl":void 0,children:a("PrivacyAcceptedGiftTitle")}),(0,se.FD)(li.A,{onClick:r,children:[(0,se.Y)("span",{children:a("PrivacyGiftLimitedEdition")}),(0,se.Y)(ci.A,{id:"limited_edition",label:a(e?.shouldDisallowLimitedStarGifts?"PrivacyDisableLimitedEditionStarGifts":"PrivacyEnableLimitedEditionStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowLimitedStarGifts})]}),(0,se.FD)(li.A,{onClick:l,children:[(0,se.Y)("span",{children:a("PrivacyGiftUnlimited")}),(0,se.Y)(ci.A,{id:"unlimited",label:a(e?.shouldDisallowUnlimitedStarGifts?"PrivacyDisableUnlimitedStarGifts":"PrivacyEnableUnlimitedStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUnlimitedStarGifts})]}),(0,se.FD)(li.A,{onClick:c,children:[(0,se.Y)("span",{children:a("PrivacyGiftUnique")}),(0,se.Y)(ci.A,{id:"unique",label:a(e?.shouldDisallowUniqueStarGifts?"PrivacyDisableUniqueStarGifts":"PrivacyEnableUniqueStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUniqueStarGifts})]}),(0,se.FD)(li.A,{onClick:d,children:[(0,se.Y)("span",{children:a("PrivacyGiftPremiumSubscription")}),(0,se.Y)(ci.A,{id:"premium_subscription",label:a(e?.shouldDisallowPremiumGifts?"PrivacyDisablePremiumGifts":"PrivacyEnablePremiumGifts"),disabled:!t,checked:!t||!e?.shouldDisallowPremiumGifts})]}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:a.isRtl?"rtl":void 0,children:a("PrivacyAcceptedGiftInfo")})]})})),Sm=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e),shouldHideReadMarks:Boolean((0,c.KIM)(e))}))(({isCurrentUserPremium:e,shouldHideReadMarks:t,visibility:i})=>{const{updateGlobalPrivacySettings:s,openPremiumModal:a}=(0,n.ko)(),o=(0,B.A)(),r="nobody"===i||"contacts"===i,l=(0,T.A)(e=>s({shouldHideReadMarks:e})),c=(0,T.A)(()=>{a({initialSection:"last_seen"})});return(0,se.FD)(se.FK,{children:[r&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:o("HideReadTime"),checked:t,onCheck:l}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:o.isRtl?"rtl":void 0,children:(0,Pt.A)(o("HideReadTimeInfo"),["br"])})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{leftElement:(0,se.Y)(lh.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:c,children:o(e?"PrivacyLastSeenPremiumForPremium":"PrivacyLastSeenPremium")}),(0,se.Y)("p",{className:"settings-item-description-larger premium-info",dir:o.isRtl?"rtl":void 0,children:o(e?"PrivacyLastSeenPremiumInfoForPremium":"PrivacyLastSeenPremiumInfo")})]})]})}));var Nm=i(91356);const km=(0,s.ph)(({currentUserId:e,hasCurrentUserFullInfo:t,currentUserFallbackPhoto:i})=>{const{loadFullUser:a,uploadProfilePhoto:o,deleteProfilePhoto:r,showNotification:l}=(0,n.ko)(),c=(0,B.A)(),[d,h,m]=(0,D.A)(!1),u=(0,s.li)();(0,s.vJ)(()=>{t||a({userId:e})},[t,e,a]);const p=(0,s.hb)(e=>{o({file:e,isFallback:!0}),l({message:c("Privacy.ProfilePhoto.PublicPhotoSuccess")})},[c,l,o]),v=(0,s.hb)(()=>{m(),r({photo:i})},[m,r,i]),g=(0,s.hb)(()=>{u.current?.click()},[]);return(0,se.FD)("div",{className:"settings-item",children:[(0,se.FD)(li.A,{narrow:!0,icon:"camera-add",onClick:g,children:[(0,se.Y)(Nm.A,{onChange:p,inputRef:u}),c(i?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")]}),i&&(0,se.FD)(li.A,{narrow:!0,leftElement:(0,se.Y)(Yt.A,{photo:i,size:"mini",className:"Qvhl9Jjv"}),onClick:h,destructive:!0,children:[c(i.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),(0,se.Y)(ai.A,{isOpen:d,onClose:m,text:c("Privacy.ResetPhoto.Confirm"),confirmLabel:c("Delete"),confirmHandler:v,confirmIsDestructive:!0})]}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:c("Privacy.ProfilePhoto.PublicPhotoInfo")})]})});function wm({screen:e,privacy:t,isPremiumRequired:i}){const{setPrivacyVisibility:o,openSettingsScreen:r}=(0,n.ko)(),l=(0,B.A)(),c=(0,Fi.A)(),d=(0,s.Kr)(()=>{const t=e!==a.VS.PrivacyAddByPhone,s=[{value:"everybody",label:l("P2PEverybody")},{value:"contacts",label:i?(0,se.Y)(dh,{label:l("P2PContacts")}):l("P2PContacts"),hidden:i}];return t&&s.push({value:"nobody",label:i?(0,se.Y)(dh,{label:l("P2PNobody")}):l("P2PNobody"),hidden:i}),s},[l,e,i]),h=(0,s.Kr)(()=>e===a.VS.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==t?.visibility,shouldShowAllowed:"everybody"!==t?.visibility},[t,e]),m=bm(e),u=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyGifts:return c("PrivacyGiftsInfo");case a.VS.PrivacyLastSeen:return l("CustomHelp");case a.VS.PrivacyAddByPhone:return l("everybody"===t?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");case a.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesInfo");default:return}},[l,c,e,t]),p=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return l("PrivacyPhoneTitle");case a.VS.PrivacyAddByPhone:return l("PrivacyPhoneTitle2");case a.VS.PrivacyLastSeen:return l("LastSeenTitle");case a.VS.PrivacyProfilePhoto:return l("PrivacyProfilePhotoTitle");case a.VS.PrivacyBio:return l("PrivacyBioTitle");case a.VS.PrivacyBirthday:return l("PrivacyBirthdayTitle");case a.VS.PrivacyGifts:return c("PrivacyGiftsTitle");case a.VS.PrivacyForwarding:return l("PrivacyForwardsTitle");case a.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesTitle");case a.VS.PrivacyGroupChats:return l("WhoCanAddMe");case a.VS.PrivacyPhoneCall:return l("WhoCanCallMe");case a.VS.PrivacyPhoneP2P:return l("PrivacyP2P");default:return}},[l,c,e]),v=(0,T.A)((e,t,i,s)=>{const n=e?.length||0,a=t?.length||0,o="allow"===s;if(!n&&!a&&!o)return l(i?"PrivacyPremium":"EditAdminAddUsers");if(i)return l("ContactsAndPremium");const r=n>0?l("Users",n):void 0,d=a>0?l("Chats",a):void 0;return[o?c("PrivacyValueBots"):"",c.conjunction([r,d].filter(Boolean))].filter(Boolean).join(" ")}),g=(0,s.Kr)(()=>v(t?.allowUserIds,t?.allowChatIds,t?.shouldAllowPremium,t?.botsPrivacy),[t]),A=(0,s.Kr)(()=>v(t?.blockUserIds,t?.blockChatIds),[t]),f=(0,s.hb)(e=>{o({privacyKey:m,visibility:e})},[m]),C=(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberAllowedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenAllowedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoAllowedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioAllowedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayAllowedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsAllowedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingAllowedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallAllowedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PAllowedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesAllowedContacts;default:return a.VS.PrivacyGroupChatsAllowedContacts}})(),b=(()=>{switch(e){case a.VS.PrivacyPhoneNumber:return a.VS.PrivacyPhoneNumberDeniedContacts;case a.VS.PrivacyLastSeen:return a.VS.PrivacyLastSeenDeniedContacts;case a.VS.PrivacyProfilePhoto:return a.VS.PrivacyProfilePhotoDeniedContacts;case a.VS.PrivacyBio:return a.VS.PrivacyBioDeniedContacts;case a.VS.PrivacyBirthday:return a.VS.PrivacyBirthdayDeniedContacts;case a.VS.PrivacyGifts:return a.VS.PrivacyGiftsDeniedContacts;case a.VS.PrivacyForwarding:return a.VS.PrivacyForwardingDeniedContacts;case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneCallDeniedContacts;case a.VS.PrivacyPhoneP2P:return a.VS.PrivacyPhoneP2PDeniedContacts;case a.VS.PrivacyVoiceMessages:return a.VS.PrivacyVoiceMessagesDeniedContacts;default:return a.VS.PrivacyGroupChatsDeniedContacts}})();return(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:p}),(0,se.Y)(ie.A,{name:`visibility-${m}`,options:d,onChange:f,selected:t?.visibility}),u&&(0,se.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:u})]}),!i&&(h.shouldShowAllowed||h.shouldShowDenied)&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:c.isRtl?"rtl":void 0,children:l("PrivacyExceptions")}),h.shouldShowAllowed&&(0,se.Y)(li.A,{narrow:!0,icon:"add-user",onClick:()=>{r({screen:C})},children:(0,se.FD)("div",{className:"multiline-item full-size",children:[(0,se.Y)("span",{className:"title",children:l("AlwaysAllow")}),(0,se.Y)("span",{className:"subtitle",children:g})]})}),h.shouldShowDenied&&(0,se.Y)(li.A,{narrow:!0,icon:"delete-user",onClick:()=>{r({screen:b})},children:(0,se.FD)("div",{className:"multiline-item full-size",children:[(0,se.Y)("span",{className:"title",children:l("NeverAllow")}),(0,se.Y)("span",{className:"subtitle",children:A})]})})]}),i&&(0,se.Y)(ch,{})]})}const Im=(0,s.ph)((0,n.EK)((e,{screen:t})=>{let i,s;const{currentUserId:n,settings:{privacy:o,byKey:{shouldDisplayGiftsButton:r}}}=e,l=(0,c.vGo)(e,n);switch(t){case a.VS.PrivacyPhoneNumber:i=o.phoneNumber,s=o.addByPhone;break;case a.VS.PrivacyLastSeen:i=o.lastSeen;break;case a.VS.PrivacyProfilePhoto:i=o.profilePhoto;break;case a.VS.PrivacyBio:i=o.bio;break;case a.VS.PrivacyBirthday:i=o.birthday;break;case a.VS.PrivacyGifts:i=o.gifts;break;case a.VS.PrivacyPhoneP2P:case a.VS.PrivacyPhoneCall:i=o.phoneCall,s=o.phoneP2P;break;case a.VS.PrivacyForwarding:i=o.forwards;break;case a.VS.PrivacyVoiceMessages:i=o.voiceMessages;break;case a.VS.PrivacyGroupChats:i=o.chatInvite}return i?{primaryPrivacy:i,secondaryPrivacy:s,currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto,isPremiumRequired:t===a.VS.PrivacyVoiceMessages&&!(0,c.g29)(e),shouldDisplayGiftsButton:r,isCurrentUserPremium:(0,c.g29)(e)}:{currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto}})(({screen:e,isActive:t,primaryPrivacy:i,secondaryPrivacy:o,currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c,isPremiumRequired:d,onReset:h,shouldDisplayGiftsButton:m,isCurrentUserPremium:u})=>{const{updateGlobalPrivacySettings:p,showNotification:v}=(0,n.ko)(),g=(0,Fi.A)();(0,Ne.A)({isActive:t,onBack:h});const A=(0,T.A)(()=>{u?p({shouldDisplayGiftsButton:!m}):v({message:g("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})}),f=(0,s.Kr)(()=>{switch(e){case a.VS.PrivacyPhoneCall:return a.VS.PrivacyPhoneP2P;case a.VS.PrivacyPhoneNumber:return"nobody"===i?.visibility?a.VS.PrivacyAddByPhone:void 0;default:return}},[i,e]);return(0,se.FD)("div",{className:"settings-content custom-scroll",children:[e===a.VS.PrivacyGifts&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.FD)(li.A,{onClick:A,children:[(0,se.Y)("span",{children:g("PrivacyDisplayGiftsButton")}),(0,se.Y)(ci.A,{id:"gift",disabled:!u,label:g(m?"HideGiftsButton":"DisplayGiftsButton"),checked:m})]}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:g.isRtl?"rtl":void 0,children:g("PrivacyDisplayGiftIconInChats",{icon:(0,se.Y)(he.A,{name:"gift",className:"gift-icon"}),gift:g("PrivacyDisplayGift")},{withNodes:!0})})]}),(0,se.Y)(wm,{screen:e,privacy:i,isPremiumRequired:d}),e===a.VS.PrivacyProfilePhoto&&"everybody"!==i?.visibility&&(0,se.Y)(km,{currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c}),e===a.VS.PrivacyLastSeen&&(0,se.Y)(Sm,{visibility:i?.visibility}),e===a.VS.PrivacyGifts&&(0,se.Y)(ym,{}),Boolean(f)&&(0,se.Y)(wm,{screen:f,privacy:o})]})})),Pm=[Ld.lw];function Ym(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 Fm=(0,s.ph)((0,n.EK)((e,{screen:t})=>({currentUserId:e.currentUserId,settings:Ym(e,t)}))(({isAllowList:e,withPremiumCategory:t,withMiniAppsCategory:i,screen:a,isActive:r,currentUserId:c,settings:d,usersOnly:h=!1,onReset:m})=>{const{setPrivacySettings:u}=(0,n.ko)(),p=(0,B.A)(),v=(0,Fi.A)(),g=(0,s.Kr)(()=>({isCustomPeer:!0,type:"bots",title:v("PrivacyValueBots"),avatarIcon:"bots",isAvatarSquare:!0,peerColorId:6}),[v]),A=(0,s.Kr)(()=>[g],[g]),f=(0,s.Kr)(()=>d?e?[...d.allowUserIds,...d.allowChatIds]:[...d.blockUserIds,...d.blockChatIds]:[],[e,d]),C=(0,s.Kr)(()=>d?d.shouldAllowPremium?[Ld.lw.type]:"allow"===d.botsPrivacy&&e?[g.type]:[]:[],[d,e,g]),[b,y]=(0,s.J0)(""),[S,N]=(0,s.J0)(!1),[k,w]=(0,s.J0)(f),[I,P]=(0,s.J0)(C);(0,s.vJ)(()=>{r||(w(f),P(C))},[r,C,f]);const Y=(0,Ns.Rh)(o.DSF),F=(0,Ns.Rh)(o._E9),D=(0,s.Kr)(()=>{const e=(0,n.mS)().chats.byId,t=(0,n.mS)().users.byId,i=(0,di.Am)([...Y||[],...F||[]]).filter(i=>{const s=e[i],n=t[i],a=n&&(0,l.PL)(n),r=s&&(0,l.WX)(s);return(!h||n)&&i!==c&&i!==o.zv8&&!r&&!a}),s=(0,It.PU)({ids:i,query:b});return b?s:(0,di.Am)([...f,...i])},[Y,F,f,b,c,h]),M=(0,s.hb)(e=>{P(e),N(!0)},[]),T=(0,s.hb)(e=>{w(e),N(!0)},[]),L=(0,s.hb)(()=>{u({privacyKey:bm(a),isAllowList:Boolean(e),updatedIds:k,isPremiumAllowed:I.includes(Ld.lw.type)||void 0,botsPrivacy:i?I.includes(g.type)?"allow":"disallow":"none"}),m()},[e,i,I,k,m,a,g]);return(0,Ne.A)({isActive:r,onBack:m}),(0,se.FD)("div",{className:"NewChat-inner step-1",children:[(0,se.Y)(mi.A,{categories:t?Pm:i&&e?A:void 0,itemIds:D||[],selectedIds:k,selectedCategories:I,filterValue:b,filterPlaceholder:p(e?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),categoryPlaceholderKey:"PrivacyUserTypes",searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:T,onSelectedCategoriesChange:M,onFilterChange:y,allowMultiple:!0,itemInputType:"checkbox",withDefaultPadding:!0,withStatus:!0}),(0,se.Y)(pi.A,{isShown:S,onClick:L,ariaLabel:p(e?"AlwaysAllow":"NeverAllow"),iconName:"check"})]})})),Dm=(0,s.ph)((0,n.EK)(e=>{const{config:t,reactions:i}=e;return{availableReactions:i.availableReactions,selectedReaction:t?.defaultReaction}})(({isActive:e,availableReactions:t,selectedReaction:i,onReset:a})=>{const{setDefaultReaction:o}=(0,n.ko)();(0,Ne.A)({isActive:e,onBack:a});const r=(0,s.Kr)(()=>(t||[]).filter(e=>!e.isInactive).map(e=>({label:(0,se.FD)(se.FK,{children:[(0,se.Y)(us.A,{reaction:e.reaction,availableReactions:t}),e.title]}),value:e.reaction.emoticon})),[t]),l=(0,s.hb)(e=>{o({reaction:{type:"emoji",emoticon:e}})},[o]);return(0,se.Y)("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction",children:(0,se.Y)(ie.A,{name:"quick-reaction-settings",options:r,selected:"emoji"===i?.type?i.emoticon:void 0,onChange:l,withIcon:!0})})})),Mm=1.5*g.$,Tm=(0,s.ph)((0,n.EK)(e=>({...(0,di.Up)(e.settings.byKey,["shouldSuggestStickers","shouldUpdateStickerSetOrder"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:e.config?.defaultReaction,availableReactions:e.reactions.availableReactions,canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({isActive:e,addedSetIds:t,customEmojiSetIds:i,stickerSetsById:o,defaultReaction:r,shouldSuggestStickers:l,shouldUpdateStickerSetOrder:c,availableReactions:d,canPlayAnimatedEmojis:h,onReset:m})=>{const{setSettingOption:u,openStickerSet:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,B.A)(),A=(0,s.li)(),{observe:f}=(0,hr.BL)({rootRef:A}),C=(0,s.hb)(e=>{p({stickerSetInfo:e.stickerSetInfo})},[p]),b=(0,s.hb)(e=>{u({shouldUpdateStickerSetOrder:e})},[u]),y=(0,s.hb)(e=>{u({shouldSuggestStickers:e})},[u]),S=(0,s.Kr)(()=>t&&Object.values((0,di.Up)(o,t)),[t,o]);return(0,Ne.A)({isActive:e,onBack:m}),(0,se.FD)("div",{className:"settings-content custom-scroll",children:[(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(js.A,{label:g("SuggestStickers"),checked:l,onCheck:y}),(0,se.FD)(li.A,{narrow:!0,onClick:()=>v({screen:a.VS.CustomEmoji}),icon:"smile",children:[g("StickersList.EmojiItem"),i&&(0,se.Y)("span",{className:"settings-item__current-value",children:i.length})]}),r&&(0,se.FD)(li.A,{className:"SettingsDefaultReaction",narrow:!0,onClick:()=>v({screen:a.VS.QuickReaction}),children:[(0,se.Y)(us.A,{reaction:r,className:"current-default-reaction",size:Mm,availableReactions:d}),(0,se.Y)("div",{className:"title",children:g("DoubleTapSetting")})]})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("InstalledStickers.DynamicPackOrder")}),(0,se.Y)(js.A,{label:g("InstalledStickers.DynamicPackOrder"),checked:c,onCheck:b}),(0,se.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:g("InstalledStickers.DynamicPackOrderInfo")})]}),S&&(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("ChooseStickerMyStickerSets")}),(0,se.Y)("div",{ref:A,children:S.map(e=>(0,se.Y)(Sh,{stickerSet:e,observeIntersection:f,onClick:C,noPlay:!h},e.id))}),(0,se.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Pt.A)(g("StickersBotInfo"),["links"])})]})]})})),Bm=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,B.A)(),r=(0,T.A)(()=>{i({screen:a.VS.Privacy})});return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(zd.A,{size:o.r2x,tgsUrl:Da.w.Congratulations,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("TwoStepVerificationPasswordSetInfo")})]}),(0,se.Y)("div",{className:"settings-item settings-group",children:(0,se.Y)(X.A,{onClick:r,children:s("TwoStepVerificationPasswordReturnSettings")})})]})});var Lm=i(79577);const Rm=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.nTw)(e).recoveryEmail;return{animatedEmoji:(0,c.oei)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength,recoveryEmail:t}})(({animatedEmoji:e,codeLength:t,isLoading:i,error:n,clearError:a,onSubmit:o,isActive:r,onReset:l,recoveryEmail:c})=>{const d=(0,s.li)(),{isMobile:h}=(0,Y.Ay)(),u=h?550:400,[p,v]=(0,s.J0)("");(0,s.vJ)(()=>{m.TF||setTimeout(()=>{d.current.focus()},u)},[u]);const g=(0,B.A)();(0,Ne.A)({isActive:r,onBack:l});const A=(0,s.hb)(e=>{n&&a&&a();const i=e.target.value.slice(0,t);i.length===t&&o(i),v(i),e.target.value=i},[a,t,n,o]);return(0,se.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Lm.A,{sticker:e,size:160,className:"settings-content-icon"}),c&&(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:g("TwoStepAuth.ConfirmEmailDescription",c)})]}),(0,se.FD)("div",{className:"settings-item settings-group",children:[(0,se.Y)(ee.A,{value:p,ref:d,inputMode:"decimal",label:g("YourEmailCode"),error:n,onChange:A}),i&&(0,se.Y)(Ls.A,{})]})]})})),xm=(0,s.ph)(({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,B.A)();return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Lock,previewUrl:Xd,size:160,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:(0,Pt.A)(s("EnabledPasswordText"),["br"])})]}),(0,se.FD)("div",{className:"settings-item",children:[(0,se.Y)(li.A,{icon:"edit",onClick:()=>i({screen:a.VS.TwoFaChangePasswordCurrent}),children:s("ChangePassword")}),(0,se.Y)(li.A,{icon:"password-off",onClick:()=>i({screen:a.VS.TwoFaTurnOff}),children:s("TurnPasswordOff")}),(0,se.Y)(li.A,{icon:"email",onClick:()=>i({screen:a.VS.TwoFaRecoveryEmailCurrentPassword}),children:s("SetRecoveryEmail")})]})]})}),Em=(0,s.ph)((0,n.EK)((e,{icon:t})=>({animatedEmoji:(0,c.oei)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:i,error:n,placeholder:a,shouldConfirm:o,clearError:r,onSubmit:l,isActive:c,onReset:d})=>{const h=(0,s.li)(),{isMobile:u}=(0,Y.Ay)(),p=u?550:400,[v,g]=(0,s.J0)(""),[A,f,C]=(0,D.A)(!1);(0,s.vJ)(()=>{m.TF||setTimeout(()=>{h.current.focus()},p)},[p]);const b=(0,s.hb)(e=>{n&&r&&r(),g(e.target.value)},[r,n]),y=(0,s.hb)(()=>{l()},[l]),S=(0,s.hb)(()=>{C(),l()},[l,C]),N=(0,B.A)();return(0,Ne.A)({isActive:c,onBack:d}),(0,se.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Lm.A,{sticker:e,size:160,className:"settings-content-icon"}),"email"===t&&(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:N("RecoveryEmailSubtitle")})]}),(0,se.FD)("div",{className:"settings-item settings-group",children:[(0,se.FD)("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&l(v)},children:[(0,se.Y)(ee.A,{ref:h,value:v,inputMode:t,label:a,error:n,onChange:b}),v?(0,se.Y)(X.A,{type:"submit",isLoading:i,ripple:!0,children:N("Continue")}):(0,se.Y)(X.A,{isText:!0,isLoading:i,ripple:!0,onClick:o?f:y,children:N("YourEmailSkip")})]}),o&&(0,se.FD)(te.A,{className:"narrow",isOpen:A,title:N("YourEmailSkipWarning"),onClose:C,children:[(0,Pt.A)(N("YourEmailSkipWarningText"),["br","simple_markdown"]),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:S,children:N("YourEmailSkip")}),(0,se.Y)(X.A,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:C,children:N("Cancel")})]})]})]})]})})),Vm=(0,s.ph)(({isActive:e,onReset:t,onStart:i})=>{const s=(0,B.A)();return(0,Ne.A)({isActive:e,onBack:t}),(0,se.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,se.FD)("div",{className:"settings-content-header no-border",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Lock,previewUrl:Xd,size:160,className:"settings-content-icon"}),(0,se.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("SetAdditionalPasswordInfo")})]}),(0,se.Y)("div",{className:"settings-item settings-group",children:(0,se.Y)(X.A,{onClick:i,children:s("EditAdminTransferSetPassword")})})]})}),_m=(0,s.ph)((0,n.EK)(e=>({...e.twoFaSettings}))(({currentScreen:e,shownScreen:t,state:i,hint:o,isLoading:r,errorKey:l,waitingEmailCodeLength:c,dispatch:d,isActive:h,onReset:m})=>{const{updatePassword:u,checkPassword:p,clearTwoFaError:v,updateRecoveryEmail:g,provideTwoFaEmailCode:A,clearPassword:f,openSettingsScreen:C}=(0,n.ko)(),b=(0,Fi.A)(),y=(0,B.A)();(0,s.vJ)(()=>{c&&(e===a.VS.TwoFaNewPasswordEmail?C({screen:a.VS.TwoFaNewPasswordEmailCode}):e===a.VS.TwoFaRecoveryEmail&&C({screen:a.VS.TwoFaRecoveryEmailCode}))},[e,c,C]);const S=(0,s.hb)(()=>{d({type:"reset"}),C({screen:a.VS.TwoFaNewPassword})},[d,C]),N=(0,s.hb)(e=>{d({type:"setPassword",payload:e}),C({screen:a.VS.TwoFaNewPasswordConfirm})},[d,C]),k=(0,s.hb)(()=>{C({screen:a.VS.TwoFaNewPasswordHint})},[C]),w=(0,s.hb)(e=>{d({type:"setHint",payload:e}),C({screen:a.VS.TwoFaNewPasswordEmail})},[d,C]),I=(0,s.hb)(e=>{d({type:"setEmail",payload:e}),u({...i,email:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[d,i,u,C]),P=(0,s.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{C({screen:a.VS.TwoFaChangePasswordNew})}})},[p,d,C]),Y=(0,s.hb)(e=>{d({type:"setPassword",payload:e}),C({screen:a.VS.TwoFaChangePasswordConfirm})},[d,C]),F=(0,s.hb)(()=>{C({screen:a.VS.TwoFaChangePasswordHint})},[C]),D=(0,s.hb)(e=>{d({type:"setHint",payload:e}),u({...i,hint:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[d,i,u,C]),M=(0,s.hb)(e=>{f({currentPassword:e,onSuccess:()=>{C({screen:a.VS.Privacy})}})},[f,C]),T=(0,s.hb)(e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{C({screen:a.VS.TwoFaRecoveryEmail})}})},[p,d,C]),L=(0,s.hb)(e=>{d({type:"setEmail",payload:e}),g({...i,email:e,onSuccess:()=>{C({screen:a.VS.TwoFaCongratulations})}})},[d,i,g,C]),R=(0,s.hb)(e=>{A({code:e})},[A]);switch(e){case a.VS.TwoFaDisabled:return(0,se.Y)(Vm,{onStart:S,isActive:h||[a.VS.TwoFaNewPassword,a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaNewPassword:return(0,se.Y)(Qd,{placeholder:y("PleaseEnterPassword"),submitLabel:y("Continue"),onSubmit:N,isActive:h||[a.VS.TwoFaNewPasswordConfirm,a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaNewPasswordConfirm:return(0,se.Y)(Qd,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),submitLabel:y("Continue"),onSubmit:k,isActive:h||[a.VS.TwoFaNewPasswordHint,a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaNewPasswordHint:return(0,se.Y)(Em,{icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:w,isActive:h||[a.VS.TwoFaNewPasswordEmail,a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaNewPasswordEmail:return(0,se.Y)(Em,{icon:"email",type:"email",isLoading:r,error:l&&b.withRegular(l),clearError:v,placeholder:y("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,isActive:h||[a.VS.TwoFaNewPasswordEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaNewPasswordEmailCode:return(0,se.Y)(Rm,{isLoading:r,error:l&&b.withRegular(l),clearError:v,onSubmit:R,isActive:h||t===a.VS.TwoFaCongratulations,onReset:m});case a.VS.TwoFaCongratulations:return(0,se.Y)(Bm,{isActive:h,onReset:m});case a.VS.TwoFaEnabled:return(0,se.Y)(xm,{isActive:h||[a.VS.TwoFaChangePasswordCurrent,a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaTurnOff,a.VS.TwoFaRecoveryEmailCurrentPassword,a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaChangePasswordCurrent:return(0,se.Y)(Qd,{isLoading:r,error:l&&b.withRegular(l),onClearError:v,hint:o,onSubmit:P,isActive:h||[a.VS.TwoFaChangePasswordNew,a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaChangePasswordNew:return(0,se.Y)(Qd,{placeholder:y("PleaseEnterNewFirstPassword"),onSubmit:Y,isActive:h||[a.VS.TwoFaChangePasswordConfirm,a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaChangePasswordConfirm:return(0,se.Y)(Qd,{expectedPassword:i.password,placeholder:y("PleaseReEnterPassword"),onSubmit:F,isActive:h||[a.VS.TwoFaChangePasswordHint,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaChangePasswordHint:return(0,se.Y)(Em,{isLoading:r,error:l&&b.withRegular(l),clearError:v,icon:"hint",placeholder:y("PasswordHintPlaceholder"),onSubmit:D,isActive:h||t===a.VS.TwoFaCongratulations,onReset:m});case a.VS.TwoFaTurnOff:return(0,se.Y)(Qd,{isLoading:r,error:l&&b.withRegular(l),onClearError:v,hint:o,onSubmit:M,isActive:h,onReset:m});case a.VS.TwoFaRecoveryEmailCurrentPassword:return(0,se.Y)(Qd,{isLoading:r,error:l&&b.withRegular(l),onClearError:v,hint:o,onSubmit:T,isActive:h||[a.VS.TwoFaRecoveryEmail,a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaRecoveryEmail:return(0,se.Y)(Em,{icon:"email",type:"email",placeholder:y("RecoveryEmailTitle"),onSubmit:L,isActive:h||[a.VS.TwoFaRecoveryEmailCode,a.VS.TwoFaCongratulations].includes(t),onReset:m});case a.VS.TwoFaRecoveryEmailCode:return(0,se.Y)(Rm,{isLoading:r,error:l&&b.withRegular(l),clearError:v,onSubmit:R,isActive:h||t===a.VS.TwoFaCongratulations,onReset:m});default:return}})),Um=Object.keys(a.VS).length/2,Om=[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],Km=[a.VS.PasscodeDisabled,a.VS.PasscodeEnabled],Jm=[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],Gm=[a.VS.PrivacyBlockedUsers,a.VS.ActiveWebsites,a.VS.Passkeys],jm=[a.VS.PrivacyPhoneNumberAllowedContacts,a.VS.PrivacyPhoneNumberDeniedContacts],zm=[a.VS.PrivacyLastSeenAllowedContacts,a.VS.PrivacyLastSeenDeniedContacts],Hm=[a.VS.PrivacyProfilePhotoAllowedContacts,a.VS.PrivacyProfilePhotoDeniedContacts],$m=[a.VS.PrivacyBioAllowedContacts,a.VS.PrivacyBioDeniedContacts],qm=[a.VS.PrivacyBirthdayAllowedContacts,a.VS.PrivacyBirthdayDeniedContacts],Wm=[a.VS.PrivacyGiftsAllowedContacts,a.VS.PrivacyGiftsDeniedContacts],Qm=[a.VS.PrivacyPhoneCallAllowedContacts,a.VS.PrivacyPhoneCallDeniedContacts],Zm=[a.VS.PrivacyPhoneP2PAllowedContacts,a.VS.PrivacyPhoneP2PDeniedContacts],Xm=[a.VS.PrivacyForwardingAllowedContacts,a.VS.PrivacyForwardingDeniedContacts],eu=[a.VS.PrivacyVoiceMessagesAllowedContacts,a.VS.PrivacyVoiceMessagesDeniedContacts],tu=[a.VS.PrivacyGroupChatsAllowedContacts,a.VS.PrivacyGroupChatsDeniedContacts],iu=[a.VS.PrivacyNoPaidMessages],su=(0,s.ph)(({isActive:e,currentScreen:t,foldersState:i,foldersDispatch:o,onReset:r,animationLevel:l,shouldSkipTransition:d})=>{const{closeShareChatFolderModal:h,openSettingsScreen:m}=(0,n.ko)(),u=(0,s.li)(),[p,v]=(0,Dd.A)(Td,Md),[g,A]=(0,s.J0)("");(0,bc.A)({containerRef:u,selector:".settings-content"},[t]);const f=(0,T.A)(e=>{const s=(0,c.nTw)((0,n.mS)()).shareFolderScreen?.isFromSettings;t===a.VS.FoldersShare&&h(),!0===e||void 0!==s&&!s?r(!0):(t!==a.VS.FoldersCreateFolder&&t!==a.VS.FoldersEditFolder&&t!==a.VS.FoldersEditFolderFromChatList&&t!==a.VS.FoldersEditFolderInvites||setTimeout(()=>{o({type:"reset"})},200),t!==a.VS.FoldersIncludedChats&&t!==a.VS.FoldersExcludedChats?r():"create"===i.mode?m({screen:a.VS.FoldersCreateFolder}):m({screen:a.VS.FoldersEditFolder}))});function C(s,n){const r={[a.VS.PrivacyPhoneNumber]:jm.includes(n),[a.VS.PrivacyLastSeen]:zm.includes(n),[a.VS.PrivacyProfilePhoto]:Hm.includes(n),[a.VS.PrivacyBio]:$m.includes(n),[a.VS.PrivacyBirthday]:qm.includes(n),[a.VS.PrivacyGifts]:Wm.includes(n),[a.VS.PrivacyPhoneCall]:Qm.includes(n),[a.VS.PrivacyPhoneP2P]:Zm.includes(n),[a.VS.PrivacyForwarding]:Xm.includes(n),[a.VS.PrivacyVoiceMessages]:eu.includes(n),[a.VS.PrivacyGroupChats]:tu.includes(n),[a.VS.PrivacyMessages]:iu.includes(n)},l=Om.includes(n),c=Km.includes(n),d=Jm.includes(n),h=Gm.includes(n)||l||c||Object.keys(r).map(Number).includes(n)||Object.values(r).includes(!0);switch(t){case a.VS.Main:return(0,se.Y)(am,{isActive:e,onReset:f});case a.VS.EditProfile:return(0,se.Y)(xh,{isActive:e&&s,onReset:f});case a.VS.General:return(0,se.Y)(Jh,{isActive:s||n===a.VS.GeneralChatBackgroundColor||n===a.VS.GeneralChatBackground||n===a.VS.QuickReaction||n===a.VS.CustomEmoji||h||d,onReset:f});case a.VS.QuickReaction:return(0,se.Y)(Dm,{isActive:s,onReset:f});case a.VS.CustomEmoji:return(0,se.Y)(Nh,{isActive:s,onReset:f});case a.VS.Notifications:return(0,se.Y)(lm,{isActive:s,onReset:f});case a.VS.DataStorage:return(0,se.Y)(wh,{isActive:s,onReset:f});case a.VS.Privacy:return(0,se.Y)(Am,{isActive:s||h,onReset:f});case a.VS.Language:return(0,se.Y)(tm,{isActive:s||n===a.VS.DoNotTranslate,onReset:f});case a.VS.DoNotTranslate:return(0,se.Y)(Ph,{isActive:s,onReset:f});case a.VS.Stickers:return(0,se.Y)(Tm,{isActive:s,onReset:f});case a.VS.Experimental:return(0,se.Y)(Oh,{isActive:s,onReset:f});case a.VS.GeneralChatBackground:return(0,se.Y)(Hh,{isActive:s||n===a.VS.GeneralChatBackgroundColor,onReset:f});case a.VS.GeneralChatBackgroundColor:return(0,se.Y)(Zh,{isActive:s,onReset:f});case a.VS.ActiveSessions:return(0,se.Y)(Ah,{isActive:s,onReset:f});case a.VS.ActiveWebsites:return(0,se.Y)(yh,{isActive:s,onReset:f});case a.VS.PrivacyBlockedUsers:return(0,se.Y)(Cm,{isActive:s,onReset:f});case a.VS.PrivacyPhoneNumber:case a.VS.PrivacyLastSeen:case a.VS.PrivacyProfilePhoto:case a.VS.PrivacyBio:case a.VS.PrivacyBirthday:case a.VS.PrivacyGifts:case a.VS.PrivacyPhoneCall:case a.VS.PrivacyForwarding:case a.VS.PrivacyVoiceMessages:case a.VS.PrivacyGroupChats:return(0,se.Y)(Im,{screen:t,isActive:s||r[t],onReset:f});case a.VS.PrivacyPhoneNumberAllowedContacts:case a.VS.PrivacyLastSeenAllowedContacts:case a.VS.PrivacyProfilePhotoAllowedContacts:case a.VS.PrivacyBioAllowedContacts:case a.VS.PrivacyBirthdayAllowedContacts:case a.VS.PrivacyGiftsAllowedContacts:case a.VS.PrivacyPhoneCallAllowedContacts:case a.VS.PrivacyPhoneP2PAllowedContacts:case a.VS.PrivacyForwardingAllowedContacts:case a.VS.PrivacyVoiceMessagesAllowedContacts:case a.VS.PrivacyGroupChatsAllowedContacts:case a.VS.PrivacyNoPaidMessages:return(0,se.Y)(Fm,{isAllowList:!0,usersOnly:t===a.VS.PrivacyNoPaidMessages,withPremiumCategory:t===a.VS.PrivacyGroupChatsAllowedContacts,withMiniAppsCategory:t===a.VS.PrivacyGiftsAllowedContacts,screen:t,isActive:s||r[t],onReset:f});case a.VS.PrivacyPhoneNumberDeniedContacts:case a.VS.PrivacyLastSeenDeniedContacts:case a.VS.PrivacyProfilePhotoDeniedContacts:case a.VS.PrivacyBioDeniedContacts:case a.VS.PrivacyBirthdayDeniedContacts:case a.VS.PrivacyGiftsDeniedContacts:case a.VS.PrivacyPhoneCallDeniedContacts:case a.VS.PrivacyPhoneP2PDeniedContacts:case a.VS.PrivacyForwardingDeniedContacts:case a.VS.PrivacyVoiceMessagesDeniedContacts:case a.VS.PrivacyGroupChatsDeniedContacts:return(0,se.Y)(Fm,{screen:t,isActive:s,onReset:f});case a.VS.PrivacyMessages:return(0,se.Y)(hh,{isActive:s,onReset:f});case a.VS.Folders:case a.VS.FoldersCreateFolder:case a.VS.FoldersEditFolder:case a.VS.FoldersEditFolderFromChatList:case a.VS.FoldersEditFolderInvites:case a.VS.FoldersIncludedChats:case a.VS.FoldersIncludedChatsFromChatList:case a.VS.FoldersExcludedChats:case a.VS.FoldersExcludedChatsFromChatList:case a.VS.FoldersShare:return(0,se.Y)($d,{currentScreen:t,shownScreen:n,state:i,dispatch:o,isActive:s,onReset:f});case a.VS.TwoFaDisabled:case a.VS.TwoFaNewPassword:case a.VS.TwoFaNewPasswordConfirm:case a.VS.TwoFaNewPasswordHint:case a.VS.TwoFaNewPasswordEmail:case a.VS.TwoFaNewPasswordEmailCode:case a.VS.TwoFaCongratulations:case a.VS.TwoFaEnabled:case a.VS.TwoFaChangePasswordCurrent:case a.VS.TwoFaChangePasswordNew:case a.VS.TwoFaChangePasswordConfirm:case a.VS.TwoFaChangePasswordHint:case a.VS.TwoFaTurnOff:case a.VS.TwoFaRecoveryEmailCurrentPassword:case a.VS.TwoFaRecoveryEmail:case a.VS.TwoFaRecoveryEmailCode:return(0,se.Y)(_m,{currentScreen:t,state:p,dispatch:v,shownScreen:n,isActive:s,onReset:f});case a.VS.PasscodeDisabled:case a.VS.PasscodeNewPasscode:case a.VS.PasscodeNewPasscodeConfirm:case a.VS.PasscodeChangePasscodeCurrent:case a.VS.PasscodeChangePasscodeNew:case a.VS.PasscodeChangePasscodeConfirm:case a.VS.PasscodeCongratulations:case a.VS.PasscodeEnabled:case a.VS.PasscodeTurnOff:return(0,se.Y)(ih,{currentScreen:t,passcode:g,onSetPasscode:A,shownScreen:n,isActive:s,onReset:f});case a.VS.Performance:return(0,se.Y)(gm,{isActive:s,onReset:f});case a.VS.Passkeys:return(0,se.Y)(dm,{isActive:s,onReset:f});default:return}}return(0,se.Y)(oe.Ay,{ref:u,id:"Settings",name:(0,Fs.P)("layers",l,d),activeKey:t,renderCount:Um,shouldWrap:!0,withSwipeControl:!0,children:function(e,s,n,a){return(0,se.FD)(se.FK,{children:[(0,se.Y)(Xh,{currentScreen:t,onReset:f,editedFolderId:i.folderId}),C(e,a)]})}})}),nu=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{byId:i,statusesById:s}=e.users;return{usersById:i,userStatusesById:s,contactIds:t}})(({isActive:e,filter:t,usersById:i,userStatusesById:o,contactIds:r,onReset:c})=>{const{openChat:d,openNewContactDialog:h}=(0,n.ko)(),m=(0,B.A)(),{isMobile:u}=(0,Y.Ay)();(0,Ne.A)({isActive:e,onBack:c});const p=(0,s.hb)(e=>{d({id:e,shouldReplaceHistory:!0})},[d]),v=(0,s.Kr)(()=>{if(!r)return;const e=(0,It.PU)({ids:r,query:t,type:"user"});return(0,l.UB)(e,i,o)},[r,t,i,o]),[g,A]=(0,Ms.A)(void 0,v,Boolean(t));return(0,se.FD)(ls.A,{items:g,onLoadMore:A,className:"chat-list custom-scroll",children:[g?.length?g.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable contact-list-item",onClick:()=>p(e),children:(0,se.Y)(ms.A,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:a.G9.ChatList,ripple:!u})},e)):g&&!g.length?(0,se.Y)("p",{className:"no-results",dir:"auto",children:t.length?"No contacts matched your search.":"Contact list is empty."},"no-results"):(0,se.Y)(Ls.A,{},"loading"),(0,se.Y)(pi.A,{isShown:!0,onClick:h,ariaLabel:m("CreateNewContact"),iconName:"add-user-filled"},"create-new-contact")]})})),au=(0,s.ph)((0,n.EK)(e=>{const{userIds:t}=e.contactList||{},{query:i,fetchingStatus:s,globalResults:n,localResults:a}=(0,c.nTw)(e).globalSearch,{peerIds:o}=n||{},{peerIds:r}=a||{};return{localContactIds:t,searchQuery:i,isSearching:s?.chats,globalPeerIds:o,localPeerIds:r}})(({isChannel:e,isActive:t,selectedMemberIds:i,localContactIds:a,searchQuery:o,isSearching:r,localPeerIds:c,globalPeerIds:d,onSelectedMemberIdsChange:h,onNextStep:m,onReset:u})=>{const{setGlobalSearchQuery:p}=(0,n.ko)(),v=(0,B.A)();(0,Ne.A)({isActive:t,onBack:u});const g=(0,s.hb)(e=>{p({query:e})},[]),A=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,t=a?(0,It.PU)({ids:a,query:o,type:"user"}):[];return(0,Ss.A)((0,di.Am)([...t,...c||[],...d||[]]).filter(t=>{const i=e[t];return i&&!i.isSelf&&(i.canBeInvitedToGroup||!(0,l.tv)(i))}),!1,i)},[a,o,c,d,i]),f=(0,s.hb)(()=>{p({query:""}),m()},[m]);return(0,se.FD)("div",{className:"NewChat step-1",children:[(0,se.FD)("div",{className:"left-header",children:[(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:u,ariaLabel:"Return to Chat List",iconName:"arrow-left"}),(0,se.Y)("h3",{children:v("GroupAddMembers")})]}),(0,se.FD)("div",{className:"NewChat-inner step-1",children:[(0,se.Y)(mi.A,{itemIds:A,selectedIds:i,filterValue:o,filterPlaceholder:v("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:r,isSearchable:!0,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox",withDefaultPadding:!0,onSelectedIdsChange:h,onFilterChange:g}),(0,se.Y)(pi.A,{isShown:!0,onClick:f,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info",iconName:"arrow-right"})]})]})})),ou=(0,s.ph)((0,n.EK)(e=>{const{progress:t,error:i}=(0,c.nTw)(e).chatCreation||{};return{creationProgress:t,creationError:i,maxGroupSize:e.config?.maxGroupSize}})(({isChannel:e,isActive:t,memberIds:i,maxGroupSize:o,creationProgress:r,creationError:c,onReset:d})=>{const{createGroupChat:h,createChannel:m}=(0,n.ko)(),u=(0,B.A)();(0,Ne.A)({isActive:t,onBack:d});const[p,v]=(0,s.J0)(""),[g,A]=(0,s.J0)(""),[f,C]=(0,s.J0)(),[b,y]=(0,s.J0)(),S="Chat title can't be empty",N="Channel title can't be empty",k=r===a.n7.InProgress;(0,s.vJ)(()=>{if(e)return;if(!i.length||i.length>4)return void v("");const t=(0,n.mS)(),s=t.users.byId,a=[t.currentUserId,...i].map(e=>(0,l.u0)(s[e])).filter(Boolean),o=a.slice(0,-1).join(", ")+u("CreateGroup.PeersTitleLastDelimeter")+a[a.length-1];v(o)},[e,i,u]);const w=(0,s.hb)(e=>{const{value:t}=e.currentTarget,i=t.replace(/^\s+/,"");v(i),i!==t&&(e.currentTarget.value=i)},[]),I=(0,s.hb)(e=>{A(e.currentTarget.value)},[]),P=(0,s.hb)(()=>{p.length?o&&i.length>=o?y("Sorry, creating supergroups is not yet supported"):h({title:p,photo:f,memberIds:i}):y(S)},[p,i,o,h,f]),Y=(0,s.hb)(()=>{p.length?m({title:p,about:g,photo:f,memberIds:i,isChannel:!0}):y(N)},[p,m,g,f,i,N]);(0,s.vJ)(()=>{r===a.n7.Complete&&d(!0)},[r,d]);const F=c&&u(c)||(b!==S&&b!==N?b:void 0);return(0,se.FD)("div",{className:"NewChat",children:[(0,se.FD)("div",{className:"left-header",children:[(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection",iconName:"arrow-left"}),(0,se.Y)("h3",{children:u(e?"NewChannel":"NewGroup")})]}),(0,se.FD)("div",{className:"NewChat-inner step-2",children:[(0,se.Y)(Bh.A,{onChange:C,title:u("AddPhoto")}),(0,se.Y)(ee.A,{value:p,onChange:w,label:u(e?"EnterChannelName":"GroupName"),error:b===S||b===N?b:void 0}),e&&(0,se.FD)(se.FK,{children:[(0,se.Y)(ee.A,{value:g,onChange:I,label:u("DescriptionOptionalPlaceholder")}),(0,se.Y)("p",{className:"note",children:u("DescriptionInfo")})]}),F&&(0,se.Y)("p",{className:"error",children:F}),i.length>0&&(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:"chat-members-heading",children:u("GroupInfo.ParticipantCount",i.length,"i")}),(0,se.Y)("div",{className:"chat-members-list custom-scroll",children:i.map(e=>(0,se.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,se.Y)(ms.A,{userId:e})}))})]})]}),(0,se.Y)(pi.A,{isShown:0!==p.length,onClick:e?Y:P,disabled:k,ariaLabel:e?u("ChannelIntro.CreateChannel"):"Create Group",iconName:"arrow-right",isLoading:k})]})})),ru=Object.keys(a.Bn).length/2,lu=(0,s.ph)(({isActive:e,isChannel:t=!1,content:i,animationLevel:o,onReset:r})=>{const{openLeftColumnContent:l,setGlobalSearchQuery:c}=(0,n.ko)(),[d,h]=(0,s.J0)([]),m=(0,s.hb)(()=>{l({contentKey:t?a.Bn.NewChannelStep2:a.Bn.NewGroupStep2})},[t]),u=(0,T.A)(e=>{const t=e.length>d.length;h(e),t&&c({query:""})});return(0,se.Y)(oe.Ay,{id:"NewChat",name:(0,Fs.P)("layers",o),renderCount:ru,activeKey:i,children:s=>{switch(i){case a.Bn.NewChannelStep1:case a.Bn.NewGroupStep1:return(0,se.Y)(au,{isChannel:t,isActive:e,selectedMemberIds:d,onSelectedMemberIdsChange:u,onNextStep:m,onReset:r});case a.Bn.NewChannelStep2:case a.Bn.NewGroupStep2:return(0,se.Y)(ou,{isChannel:t,isActive:s&&e,memberIds:d,onReset:r});default:return}}})});var cu=i(34458),du=i(11462),hu=i(24920),mu=i(75343),uu=i(40175),pu=i(70463),vu=i(77018);const gu=(0,s.ph)(({isActive:e,isForumPanelOpen:t,archiveSettings:i,isStoryRibbonShown:s,onReset:a,onTopicSearch:r,foldersDispatch:l})=>{const{updateArchiveSettings:c}=(0,n.ko)(),d=(0,B.A)();(0,Ne.A)({isActive:e,onBack:a});const h=(0,T.A)(()=>{c({isHidden:!1})}),{shouldDisableDropdownMenuTransitionRef:m,handleDropdownMenuTransitionEnd:u}=(0,hu.A)(t),{shouldRender:p,transitionClassNames:v}=(0,je.A)(!t,void 0,void 0,!1),{shouldRenderForumPanel:g,handleForumPanelAnimationEnd:A,handleForumPanelAnimationStart:f,isAnimationStarted:C}=(0,du.A)(t),b=t&&C,{shouldRender:y,transitionClassNames:S,isClosing:N}=(0,je.A)(s,void 0,void 0,"",!1,cu.UG+o.xB5);return(0,se.FD)("div",{className:"ArchivedChats",children:[(0,se.FD)("div",{className:(0,ge.A)("left-header",!y&&"left-header-shadow"),children:[d.isRtl&&(0,se.Y)("div",{className:"DropdownMenuFiller"}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:"Return to chat list",className:(0,ge.A)(d.isRtl&&"rtl",b&&d.isRtl&&"right-aligned",m.current&&d.isRtl&&"disable-transition"),onTransitionEnd:u,iconName:"arrow-left"}),p&&(0,se.Y)("h3",{className:v,children:d("ArchivedChats")}),(0,se.Y)("div",{className:"story-toggler-wrapper",children:(0,se.Y)(uu.A,{canShow:!0,isArchived:!0})}),i.isHidden&&(0,se.Y)(me.A,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:d.isRtl?u:void 0,children:(0,se.Y)(ue.A,{icon:"archive-from-main",onClick:h,children:d("lng_context_archive_to_list")})})]}),(0,se.FD)("div",{className:(0,ge.A)("chat-list-wrapper",y&&"with-story-ribbon",S),children:[y&&(0,se.Y)(mu.A,{isArchived:!0,className:"left-header-shadow",isClosing:N}),(0,se.Y)(pu.A,{folderType:"archived",isActive:e,isForumPanelOpen:b,isMainList:!0,foldersDispatch:l,archiveSettings:i,isStoryRibbonShown:s})]}),g&&(0,se.Y)(vu.A,{isOpen:t,onTopicSearch:r,onOpenAnimationStart:f,onCloseAnimationEnd:A})]})}),Au=(0,s.ph)((0,n.EK)(e=>{const{byId:t,orderedIds:i}=e.chatFolders;return{foldersById:t,folderOrderedIds:i}})(({isOpen:e,chatId:t,foldersById:i,folderOrderedIds:a,onClose:r,onCloseAnimationEnd:l})=>{const{editChatFolders:c}=(0,n.ko)(),d=(0,B.A)(),h=(0,s.Kr)(()=>i?Object.keys(i).reduce((e,s)=>{const{includedChatIds:n,pinnedChatIds:a}=i[Number(s)];return(n.includes(t)||a?.includes(t))&&e.push(s),e},[]):[],[t,i]),[m,u]=(0,s.J0)(h),p=(0,s.Kr)(()=>a?.filter(e=>e!==o.DSF).map(e=>{const t=i?i[e]:void 0;return{label:t?(0,Oi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}):"",value:String(e)}})||[],[a,i]),v=(0,s.hb)(()=>{const e=h.filter(e=>!m.includes(e)).map(Number),i=m.filter(e=>!h.includes(e)).map(Number);c({chatId:t,idsToRemove:e,idsToAdd:i}),r()},[t,c,h,r,m]);if(i&&a)return(0,se.FD)(te.A,{isOpen:e,onClose:r,onCloseAnimationEnd:l,onEnter:v,className:(0,ge.A)("_fJBBCCE","delete"),contentClassName:"EG5lPWY1",title:d("FilterAddTo"),children:[(0,se.Y)("div",{className:(0,ge.A)("heYMHiUt","custom-scroll"),children:(0,se.Y)(Zl.A,{options:p,selected:m,onChange:u})}),(0,se.Y)("div",{className:"_jtqAaUU",children:(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v,children:d("FilterAddTo")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:r,children:d("Cancel")})]})})]})}));var fu=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(fu||{});const Cu=(0,s.ph)(({isOpen:e,chatId:t,topicId:i,onClose:a,onCloseAnimationEnd:r})=>{const[l,c]=(0,s.J0)(fu.Forever),{updateChatMutedState:d,updateTopicMutedState:h}=(0,n.ko)(),m=(0,B.A)(),u=(0,s.Kr)(()=>[{label:m("MuteFor.Hours",1),value:fu.OneHour},{label:m("MuteFor.Hours",4),value:fu.FourHours},{label:m("MuteFor.Hours",8),value:fu.EightHours},{label:m("MuteFor.Days",1),value:fu.OneDay},{label:m("MuteFor.Days",3),value:fu.ThreeDays},{label:m("MuteFor.Forever"),value:fu.Forever}],[m]),p=(0,s.hb)(()=>{let e;e=l===fu.Forever?o.xEh:Math.floor(Date.now()/1e3)+Number(l),i?h({chatId:t,topicId:i,mutedUntil:e}):d({chatId:t,mutedUntil:e}),a()},[t,l,a,i]);return(0,se.FD)(te.A,{isOpen:e,onClose:a,onCloseAnimationEnd:r,onEnter:p,className:"delete",title:m("Notifications"),children:[(0,se.Y)(ie.A,{className:"dialog-checkbox-group",name:"muteFor",options:u,selected:l,onChange:c}),(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(X.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:p,children:m("Common.Done")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:a,children:m("Cancel")})]})]})});var bu=i(99515),yu=i(24531);const Su=(0,s.ph)((0,n.EK)((e,{fromSticker:t,stickerSetShortName:i})=>{const s=(0,c.Xf0)(e),{chatId:n,threadId:a}=s||{},o=n&&(0,c.hds)(e,n),r=n?(0,c.AWZ)(e,n):void 0,d=n&&(0,c.yps)(e,n),h=n?(0,c.nZ4)(e,n):void 0,m=o?(0,l.Q_)(o,r,Boolean(d),h):void 0,u=n&&a?(0,Kl.Vw)(e,n,a):void 0,p=Boolean(!u?.isCommentsInfo&&u?.fromChannelId),v=n&&a?(0,c.S0q)(e,n,a):void 0,g=Boolean(o&&a&&(0,l.__)(o,v,p,r)&&m?.canSendStickers),A=t?t.stickerSetInfo:i?{shortName:i}:void 0,f=A?(0,c.ycM)(e,A):void 0,C=n?(0,c.WA9)(e,n):void 0;return{canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),canSendStickers:g,isSavedMessages:h,shouldSchedule:!C&&(0,c.PIP)(e),stickerSet:f,isCurrentUserPremium:(0,c.g29)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:s}})(({isOpen:e,fromSticker:t,stickerSetShortName:i,stickerSet:a,canSendStickers:r,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isCurrentUserPremium:h,shouldUpdateStickerSetOrder:m,currentMessageList:u,onClose:p})=>{const{loadStickers:v,toggleStickerSet:g,sendMessage:A,showNotification:f}=(0,n.ko)(),C=(0,s.li)(),b=(0,s.li)(),y=(0,B.A)(),{isMobile:S}=(0,Y.Ay)(),N=(0,K.A)(a),k=a||N,w=Boolean(!k?.isArchived&&k?.installedDate),I=k?.isEmoji,[P,F]=(0,yu.A)(l),{handleScroll:D,isAtBeginning:M}=(0,rs.A)(),{observe:T}=(0,hr.BL)({rootRef:C,throttleMs:200,isDisabled:!e});(0,s.vJ)(()=>{e&&!k?.stickers&&v({stickerSetInfo:t?t.stickerSetInfo:{shortName:i}})},[e,t,v,i,k]);const L=(0,s.hb)((e,t,i)=>{u&&(e={...e,isPreloadedGlobally:!0},c||i?P((i,s)=>{A({messageList:u,sticker:e,isSilent:t,scheduledAt:i,scheduleRepeatPeriod:s}),p()}):(A({messageList:u,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:m&&w}),p()))},[u,c,P,p,m,w]),R=(0,s.hb)(()=>{k&&(g({stickerSetId:k.id}),p())},[p,k,g]),x=(0,s.hb)(()=>{if(!k)return;const{shortName:e}=k,t=I?"addemoji":"addstickers",i=`${o.jsp}${t}/${e}`;(0,wc.eM)(i),f({message:y("LinkCopied")})},[I,y,k,f]),E=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{round:!0,ripple:!S,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[S]);return(0,se.FD)(te.A,{className:(0,ge.A)("StickerSetModal",I&&"custom-emoji"),isOpen:e,onClose:p,header:function(){const e=(0,ge.A)("modal-header",!M&&"with-top-border");return(0,se.FD)("div",{className:e,dir:y.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:y("Close"),onClick:p,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:k?(0,Pt.A)(k.title,["emoji","links"]):y("AccDescrStickerSet")}),(0,se.Y)(me.A,{className:"stickers-more-menu with-menu-transitions",trigger:E,positionX:"right",children:(0,se.Y)(ue.A,{icon:"copy",onClick:x,children:y("StickersCopy")})})]})}(),children:[k?.stickers?(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{ref:C,className:"stickers custom-scroll",onScroll:D,children:(0,se.FD)("div",{className:"shared-canvas-container stickers-grid",children:[(0,se.Y)("canvas",{ref:b,className:"shared-canvas"}),k.stickers.map(e=>(0,se.Y)(Nr,{sticker:e,size:I?o.$nk:o.GhT,observeIntersection:T,onClick:r&&!I?L:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h,sharedCanvasRef:b}))]})}),(0,se.Y)("div",{className:"button-wrapper",children:(0,se.Y)(X.A,{fluid:!0,color:w?"danger":"primary",onClick:R,children:(()=>{if(!k)return y("Loading");const e=I?"Emoji":"Sticker";return y(w?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,k.count,"i")})()})})]}):(0,se.Y)(Ls.A,{}),F]})})),Nu={root:"nZYT4vJ3",sets:"JzkmXjFF"},ku=(0,s.ph)((0,n.EK)(e=>({canPlayAnimatedEmojis:(0,c.BWX)(e)}))(({customEmojiSetIds:e,canPlayAnimatedEmojis:t,onClose:i})=>{const{openStickerSet:a}=(0,n.ko)(),o=(0,B.A)(),r=(0,s.Kr)(()=>e?.map(e=>(0,n.mS)().stickers.setsById[e]),[e]),l=(0,s.li)(),{observe:c}=(0,hr.BL)({rootRef:l,isDisabled:!r}),d=(0,K.A)(r),h=r||d,m=(0,T.A)(e=>{a({stickerSetInfo:e.stickerSetInfo})});return(0,se.Y)(te.A,{isOpen:Boolean(r),className:Nu.root,onClose:i,hasCloseButton:!0,title:o("lng_custom_emoji_used_sets"),children:(0,se.Y)("div",{className:(0,ge.A)(Nu.sets,"custom-scroll"),ref:l,teactFastList:!0,children:h?.map(e=>(0,se.Y)(Sh,{className:Nu.setCard,stickerSet:e,onClick:m,observeIntersection:c,noPlay:!t},e.id))})})}));var wu=i(54314),Iu=i(60859);const Pu={settings:{icon:"bots",label:"BotSettings"},help:{icon:"help",label:"BotHelp"}},Yu=(0,s.ph)((0,n.EK)((e,{chatId:t,threadId:i})=>{const s=(0,c.hds)(e,t),n=(0,c._ls)(e,t);if(!s||n)return{};const a=(0,v.L8)(s.id),o=a?(0,c.mBe)(e,t):void 0,r=o&&(0,l.Gh)(o),d=i===G.l3,h=(0,c.nZ4)(e,t),{chatId:m,threadId:u}=(0,c.Xf0)(e)||{},p=d&&!o&&((0,l.WX)(s)||(0,l.YE)(s))&&!(0,l.SJ)(s),g=(0,l.DX)(t)?void 0:(0,c.yps)(e,t),A=a?(0,c.vGo)(e,t):void 0,f=a?void 0:(0,c.AWZ)(e,t),C=A||f,b=(0,c.X2D)(e,t),y=(0,c.S0q)(e,t,i),S=s.isForum&&!s.isBotForum&&(s.isCreator||!(0,l.Sq)(s,"manageTopics")||(0,l.ub)(s,"manageTopics")),N=y&&(0,l.l1)(s,y),k=(0,c.e5V)(e,t),w=(0,c.jGY)(e,t)&&C?.isTranslationDisabled,I=(0,l.cG)(t,i,e.currentUserId)?(0,c.hds)(e,String(i)):void 0,P=(0,c.trm)(e),Y=(0,c.nTw)(e).chatInfo;return{chat:s,isMuted:(0,Ec.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),isPrivate:a,isTopic:s?.isForum&&!d,isForum:s?.isForum,isBotForum:s?.isBotForum,isForumAsMessages:s?.isForumAsMessages,canAddContact:r,canDeleteChat:(0,l.IC)(s),canReportChat:p,canGift:b,hasLinkedChat:Boolean(f?.linkedChatId),botCommands:g?A?.botInfo?.commands:void 0,botPrivacyPolicyUrl:g?A?.botInfo?.privacyPolicyUrl:void 0,isChatInfoShown:Y.isOpen&&m===t&&u===i,canCreateTopic:S,canEditTopic:N,canManage:k,isRightColumnShown:(0,c.gjV)(e),canTranslate:w,isBlocked:A?.isBlocked,isBot:Boolean(g),isChatWithSelf:h,savedDialog:I,disallowedGifts:A?.disallowedGifts,isAccountFrozen:P,noForwardsMyEnabled:A?.noForwardsMyEnabled,noForwardsPeerEnabled:A?.noForwardsPeerEnabled}})(({chatId:e,threadId:t,isOpen:i,withExtraActions:a,anchor:r,isChannel:l,botCommands:c,botPrivacyPolicyUrl:d,withForumActions:h,isTopic:m,isForum:u,isBotForum:p,isForumAsMessages:v,isChatInfoShown:g,canStartBot:A,canSubscribe:f,canReportChat:C,canSearch:b,canCall:y,canMute:S,canViewStatistics:N,canViewMonetization:k,canViewBoosts:w,pendingJoinRequests:I,canLeave:P,canEnterVoiceChat:F,canCreateVoiceChat:M,chat:L,isPrivate:R,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,noForwardsMyEnabled:X,noForwardsPeerEnabled:ee,channelMonoforumId:te,onJoinRequestsClick:ie,onSubscribeChannel:ne,onSearchClick:ae,onAsMessagesClick:oe,onClose:re,onCloseAnimationEnd:le})=>{const{updateChatMutedState:ce,enterMessageSelectMode:de,sendBotCommand:he,restartBot:me,requestMasterAndJoinGroupCall:pe,createGroupCall:ve,openLinkedChat:ge,openAddContactDialog:Ae,openFrozenAccountModal:fe,requestMasterAndRequestCall:Ce,toggleStatistics:be,openMonetizationStatistics:ye,openBoostStatistics:Se,openGiftModal:Ne,openThreadWithInfo:ke,openCreateTopicPanel:we,openEditTopicPanel:Ie,openChat:Pe,openUrl:Ye,toggleManagement:Fe,togglePeerTranslations:De,blockUser:Me,unblockUser:Te,setViewForumAsMessages:Be,openBoostModal:Le,reportMessages:Re,showNotification:xe,toggleNoForwards:Ee,openDisableSharingAboutModal:Ve}=(0,n.ko)(),_e=(0,B.A)(),Ue=(0,Fi.A)(),{isMobile:Oe}=(0,Y.Ay)(),[Ke,Je]=(0,s.J0)(!0),[Ge,ze]=(0,s.J0)(!1),[He,$e]=(0,s.J0)(!1),[qe,We]=(0,s.J0)(!1),[Qe,Xe,et]=(0,D.A)(),{x:tt,y:it}=r;(0,je.A)(i,le,void 0,!1);const st=(0,Ui.A)(!(g||!u)||void 0,200),nt=(0,s.Kr)(()=>{if(Q)return Object.values(Q).every(Boolean)},[Q]),at=(0,T.A)(()=>{We(!1),re()}),ot=(0,T.A)(()=>{Z?fe():(Je(!1),Re({chatId:e,messageIds:[]})),re()}),rt=(0,T.A)(()=>{Z?(fe(),re()):$e(!0),Je(!1)}),lt=(0,T.A)(()=>{Je(!1),re()}),ct=(0,T.A)(()=>{ke({chatId:e,threadId:t}),ze(!G),lt()}),dt=(0,T.A)(()=>{$e(!1),re()}),ht=(0,T.A)(()=>{Z?fe():he({command:"/start"})}),mt=(0,T.A)(()=>{Z?fe():me({chatId:e})}),ut=(0,T.A)(()=>{Z?fe():ce({chatId:e,mutedUntil:o.Os5}),lt()}),pt=(0,T.A)(()=>{Z?(fe(),lt()):(Xe(),We(!0)),Je(!1)}),vt=(0,T.A)(()=>{Z?fe():(we({chatId:e}),ze(!G)),lt()}),gt=(0,T.A)(()=>{Z?fe():(Fe({force:!0}),ze(!G)),lt()}),At=(0,T.A)(()=>{Z?fe():(Ie({chatId:e,topicId:Number(t)}),ze(!G)),lt()}),ft=(0,T.A)(()=>{Pe({id:void 0}),Be({chatId:e,isEnabled:!1}),lt()}),Ct=(0,T.A)(()=>{Z?fe():M?ve({chatId:e}):pe({chatId:e}),lt()}),bt=(0,T.A)(()=>{ge({id:e}),lt()}),yt=(0,T.A)(()=>{nt&&L?xe({message:Ue("SendDisallowError")}):(Ne({forUserId:e}),Z?fe():Ne({forUserId:e}),lt())}),St=(0,T.A)(()=>{Z?fe():Ae({userId:e}),lt()}),Nt=(0,T.A)(()=>{Z?fe():ne(),lt()}),kt=(0,T.A)(()=>{Z?fe():Ce({userId:e,isVideo:!0}),lt()}),wt=(0,T.A)(()=>{Z?fe():Ce({userId:e}),lt()}),It=(0,T.A)(()=>{ae(),lt()}),Pt=(0,T.A)(()=>{be(),ze(!G),lt()}),Yt=(0,T.A)(()=>{ye({chatId:e}),ze(!G),lt()}),Ft=(0,T.A)(()=>{Z?fe():w?(Se({chatId:e}),ze(!G)):Le({chatId:e}),lt()}),Dt=(0,T.A)(()=>{De({chatId:e,isEnabled:!0}),lt()}),Mt=(0,T.A)(()=>{Z?fe():de(),lt()}),Tt=(0,T.A)(()=>{oe(),lt()}),Bt=(0,T.A)(()=>{Z?fe():Me({userId:e}),lt()}),Lt=(0,T.A)(()=>{Z?fe():Te({userId:e}),lt()}),Rt=(0,T.A)(()=>{lt(),Z?fe():X||ee?Ee({userId:e,isEnabled:!1}):Ve({userId:e})}),xt=(0,T.A)(()=>{Pe({id:te}),lt()});(0,s.vJ)(yi.M6,[]);const Et=(0,s.Kr)(()=>{const e=c?.map(({command:e})=>{const t=Pu[e];if(t)return(0,se.Y)(ue.A,{icon:t.icon,onClick:()=>{he({command:`/${e}`}),lt()},children:_e(t.label)},e)}),t=c?.some(({command:e})=>"privacy"===e);return[...e||[],H&&(0,se.Y)(ue.A,{icon:"privacy-policy",onClick:()=>{t&&!d?he({command:"/privacy"}):Ye({url:d||_e("BotDefaultPrivacyPolicy")}),lt()},children:_e("BotPrivacyPolicy")})].filter(Boolean)},[c,_e,d,H]),Vt=(0,s.Kr)(()=>{if(L)return _e(q?"Delete":R?"DeleteChatUser":E?"GroupInfo.DeleteAndExit":l?"LeaveChannel":"Group.LeaveGroup")},[E,L,l,R,q,_e]);return(0,se.Y)(Ur.A,{children:(0,se.FD)("div",{className:"HeaderMenuContainer",children:[(0,se.FD)(Ze.A,{isOpen:Ke,positionX:"right",style:`left: ${tt}px;top: ${it}px;`,onClose:lt,shouldCloseFast:Ge,children:[Oe&&b&&(0,se.Y)(ue.A,{icon:"search",onClick:It,children:_e("Search")}),h&&O&&(0,se.FD)(se.FK,{children:[(0,se.Y)(ue.A,{icon:"comments",onClick:vt,children:_e("lng_forum_create_topic")}),(0,se.Y)(Iu.A,{})]}),te&&(0,se.Y)(ue.A,{icon:"message",onClick:xt,children:Ue("ChannelSendMessage")}),st&&(0,se.Y)(ue.A,{icon:"info",onClick:ct,children:_e(m?"lng_context_view_topic":"lng_context_view_group")}),J&&!K&&(0,se.Y)(ue.A,{icon:"edit",onClick:gt,children:_e("Edit")}),K&&(0,se.Y)(ue.A,{icon:"edit",onClick:At,children:_e("lng_forum_topic_edit")}),Oe&&!h&&u&&!p&&!m&&(0,se.Y)(ue.A,{icon:"forums",onClick:ft,children:_e("Chat.ContextViewAsTopics")}),h&&Boolean(I)&&(0,se.FD)(ue.A,{icon:"user",onClick:ie,children:[_e(l?"SubscribeRequests":"MemberRequests"),(0,se.Y)("div",{className:"right-badge",children:I})]}),h&&!m&&!p&&!v&&(0,se.Y)(ue.A,{icon:"message",onClick:Tt,children:_e("lng_forum_view_as_messages")}),a&&A&&(0,se.Y)(ue.A,{icon:"bots",onClick:ht,children:_e("BotStart")}),a&&f&&(0,se.Y)(ue.A,{icon:l?"channel":"group",onClick:Nt,children:_e(l?"ProfileJoinChannel":"ProfileJoinGroup")}),W&&!w&&(0,se.Y)(ue.A,{icon:"boost-outline",onClick:Ft,children:_e(l?"BoostingBoostChannelMenu":"BoostingBoostGroupMenu")}),U&&(0,se.Y)(ue.A,{icon:"add-user",onClick:St,children:_e("AddContact")}),Oe&&y&&(0,se.Y)(ue.A,{icon:"phone",onClick:wt,children:_e("Call")}),y&&(0,se.Y)(ue.A,{icon:"video-outlined",onClick:kt,children:_e("VideoCall")}),S&&(x?(0,se.Y)(ue.A,{icon:"unmute",onClick:ut,children:_e("ChatsUnmute")}):(0,se.FD)(ue.A,{icon:"mute",onClick:pt,children:[_e("ChatsMute"),"..."]})),(F||M)&&(0,se.Y)(ue.A,{icon:"voice-chat",onClick:Ct,children:_e(M?"StartVoipChat":"VoipGroupJoinCall")}),_&&(0,se.Y)(ue.A,{icon:l?"comments":"channel",onClick:bt,children:_e(l?"ViewDiscussion":"lng_profile_view_channel")}),!h&&(0,se.Y)(ue.A,{icon:"select",onClick:Mt,children:_e("ReportSelectMessages")}),w&&(0,se.Y)(ue.A,{icon:"boost-outline",onClick:Ft,children:_e("Boosts")}),N&&(0,se.Y)(ue.A,{icon:"stats",onClick:Pt,children:_e("Statistics")}),l&&k&&(0,se.Y)(ue.A,{icon:"cash-circle",onClick:Yt,children:_e("lng_channel_earn_title")}),j&&(0,se.Y)(ue.A,{icon:"language",onClick:Dt,children:_e("lng_context_translate")}),C&&(0,se.Y)(ue.A,{icon:"flag",onClick:ot,children:_e("ReportPeer.Report")}),Et,V&&(0,se.Y)(ue.A,{icon:"gift",onClick:yt,children:_e("ProfileSendAGift")}),H&&(0,se.Y)(ue.A,{icon:z?"bots":"hand-stop",onClick:z?mt:Bt,children:_e(z?"BotRestart":"Bot.Stop")}),R&&!$&&!H&&(0,se.Y)(ue.A,{icon:X||ee?"allow-share":"no-share",onClick:Rt,children:Ue(X||ee?"EnableSharing":"DisableSharing")}),R&&!$&&!H&&(0,se.Y)(ue.A,{icon:z?"user":"hand-stop",onClick:z?Lt:Bt,children:_e(z?"Unblock":"BlockUser")}),P&&(0,se.FD)(se.FK,{children:[(0,se.Y)(Iu.A,{}),(0,se.Y)(ue.A,{destructive:!0,icon:"delete",onClick:rt,children:Vt})]})]}),L&&(0,se.Y)(wu.A,{isOpen:He,onClose:dt,chat:q||L,isSavedDialog:Boolean(q)}),S&&Qe&&L?.id&&(0,se.Y)(Kc.A,{isOpen:qe,onClose:at,onCloseAnimationEnd:et,chatId:L.id})]})})}));var Fu=i(87306),Du=i(92915),Mu=i(81642),Tu=i(18653);const Bu={root:"vv5ppXel",active:"FVgqrSSK",info:"DboxqiZd",topRow:"Ymu2m1PR",meta:"A2rsvUBm",subtitle:"qUzmwaIn"},Lu=(0,s.ph)(({isActive:e,message:t,peer:i,messageChat:s,shouldShowChat:n,query:a,className:o,onClick:r})=>{const c=(0,Fi.A)();if(i&&!t){const t=(0,l.Kl)(i),s=()=>{r(i.id)};return(0,se.FD)("div",{role:"button",tabIndex:0,className:(0,ge.A)(Bu.root,e&&Bu.active,o),onClick:s,children:[(0,se.Y)(Yt.A,{className:Bu.avatar,peer:i,size:"medium"}),(0,se.FD)("div",{className:Bu.info,children:[(0,se.Y)("div",{className:Bu.topRow,children:(0,se.Y)(Rs.A,{peer:i,withEmojiStatus:!0})}),((0,It.vj)(i)||t)&&(0,se.Y)("div",{className:Bu.subtitle,dir:"auto",children:t?`@${t}`:(0,l.sT)(c,i)})]})]})}if(!t)return;const d=t.forwardInfo?.hiddenUserName,h=n?s:i,m=n&&i?(0,It.Q5)(c,t.chatId,i):void 0,u=(0,T.A)(()=>{r(t)});return(0,se.FD)("div",{role:"button",tabIndex:0,className:(0,ge.A)(Bu.root,e&&Bu.active,o),onClick:u,children:[(0,se.Y)(Yt.A,{className:Bu.avatar,peer:h,text:d,size:"medium"}),(0,se.FD)("div",{className:Bu.info,children:[(0,se.FD)("div",{className:Bu.topRow,children:[h&&(0,se.Y)(Rs.A,{peer:h,withEmojiStatus:!0})||d,(0,se.Y)(Mu.A,{className:Bu.meta,message:t})]}),(0,se.FD)("div",{className:Bu.subtitle,dir:"auto",children:[m&&(0,se.FD)(se.FK,{children:[(0,se.Y)("span",{className:"sender-name",children:(0,Pt.A)(m)}),(0,se.Y)("span",{className:"colon",children:":"})]}),(0,se.Y)(Tu.A,{message:t,highlight:a,truncateLength:200})]})]})]})}),Ru={root:"FTMljUuX",header:"OvmjSMwA",active:"DEIUzXQd",avatar:"mp1PmoMq",input:"z2K8Q7ib",mobile:"u0fb78AA",focused:"dqF8dYNx",withDropdown:"AqhBggrp",adaptSearchBorders:"Q9RZQaTu",dropdown:"MFGvbICO",dropdownHidden:"Alee0CKy",results:"RtfTOE72",placeholder:"O1HoZFge",separator:"_Yy43QLl",savedTags:"BcvAfv1E",wrap:"JkESCST6",searchTags:"rO3pH3LI",savedSearchTag:"qA4gov4D",hash:"q5NOmUAM",fromTag:"xh4OgYEH",searchTypes:"rVYZG__K",searchType:"nE1Xwoo7",selectedType:"i29dP8iT",icons:"Mx8TXRsg",footer:"jyS1l9yn","keyboard-visible":"ao05jKHW",keyboardVisible:"ao05jKHW",counter:"NmmL_cO3",mobileNavigation:"dLO1hlHU",navigationButton:"Z4vLAlsu",navigationDisabled:"IqA7R2xO",memberItem:"BEPRQhWE",jumpIn:"n9kXbTu6"},xu={isCustomPeer:!0,avatarIcon:"channel-filled",titleKey:"SearchPublicPosts"},Eu="MiddleSearchResult",Vu=(0,Ce.sg)(e=>e(),200,!1),_u=(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:m,fromPeerId:u}=(0,c.TCk)(e)||{},{totalCount:p,foundIds:v,query:g}=r||{},A=e.currentUserId,f=(0,c.nZ4)(e,i),C=(0,l.cG)(i,s,A),b=f&&!C?e.savedReactionTags?.byKey:void 0;return{chat:n,monoforumChat:(0,c.k2W)(e,i),requestedQuery:a,totalCount:p,threadId:s,foundIds:v,isHistoryCalendarOpen:Boolean((0,c.nTw)(e).historyCalendarSelectedAt),savedTags:b,savedTag:o,isCurrentUserPremium:(0,c.g29)(e),isSavedMessages:f,fetchingQuery:d,isHashtagQuery:h,currentUserId:A,searchType:m,lastSearchQuery:g,fromPeerId:u,isGroupChat:(0,l.YE)(n)}})(({isActive:e,chat:t,monoforumChat:i,threadId:a,requestedQuery:d,savedTags:h,savedTag:p,totalCount:v,lastSearchQuery:g,foundIds:A,isHistoryCalendarOpen:f,isCurrentUserPremium:C,isSavedMessages:b,fetchingQuery:y,isHashtagQuery:S,searchType:N="chat",currentUserId:k,fromPeerId:w,isGroupChat:I})=>{const{updateMiddleSearch:P,resetMiddleSearch:M,performMiddleSearch:L,focusMessage:R,closeMiddleSearch:x,openHistoryCalendar:E,openPremiumModal:V,loadSavedReactionTags:_}=(0,n.ko)(),U=(0,s.li)(),O=(0,s.li)(),K=(0,s.li)(),J=(0,s.li)(!1),{isMobile:G}=(0,Y.Ay)(),j=(0,B.A)(),z=(0,Fi.A)(),[H,$]=(0,s.J0)(d||""),[q,W]=(0,s.J0)(0),Q=A&&q>0,Z=A&&q<A.length-1,[ee,te]=(0,s.J0)(!e),ie=(0,s.li)(),ne=(0,s.li)(!0),[ae,oe,re]=(0,D.A)(),[le,ce]=(0,s.J0)(!0),[de,he]=(0,s.J0)(!1),[me,ue]=(0,s.J0)(Boolean(w)),[pe,ve]=(0,s.J0)("");(0,s.vJ)(()=>{w&&(ue(!0),De())},[w]);const Ae=(0,s.Kr)(()=>t&&I?(0,Fu.qS)(t):void 0,[t,I]),fe=me&&!w,{result:be,isLoading:ye}=(0,Fu.Ay)({query:fe?pe||" ":H,queryFn:Ae,isDisabled:!I||Boolean(w)||!me&&(!H||S)});!function(e,t){const i=(0,T.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])}([U],(0,T.A)(e=>{ne.current||e.target.closest(".Modal")||re()}));const Se=Boolean((H||w)&&A||S),ke=S&&!H,we="myChats"===N||"channels"===N,Ie=!S&&Boolean(be?.length),Pe=Boolean(H&&!ke||p||w),Ye="chat"===N&&Boolean(A?.length),Fe=(0,T.A)(()=>{x()}),De=(0,T.A)(()=>{(0,r.YS)(()=>{(0,uc.A)(O.current)})}),Me=(0,T.A)(()=>{O.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===O.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)(()=>{W(-1)},[g]),(0,s.Nf)(()=>{m.pz&&Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==O.current)})},[e]),(0,s.vJ)(()=>{e?(te(!1),clearTimeout(ie.current)):(O.current.blur(),ce(!0),W(0),$(""),ue(!1),ve(""),ie.current=window.setTimeout(()=>te(!0),200))},[e]),(0,s.vJ)(()=>{d&&t?.id&&($(d),P({chatId:t.id,threadId:a,update:{requestedQuery:void 0}}),he(!0),(0,r.Uz)(()=>{const e=O.current;e&&((0,bi.A)(e,!0,!0),oe())}))},[t?.id,d,a]),(0,F.A)(([t])=>{e!==t&&!H&&g&&$(g)},[e,g,H]),(0,F.A)(([t])=>{e&&t!==f&&(f?(Me(),re()):De())},[f,e]);const Te=(0,T.A)(()=>{H?.length||p||w||me?($(""),he(!1),ue(!1),ve(""),M(),De()):Fe()});(0,s.vJ)(()=>e?(0,u.A)(Te):void 0,[e,Fe]);const Be=(0,s.Kr)(()=>{if(h)return Object.values(h)},[h]),Le=Boolean(Be?.length),Re=Le&&!C;(0,s.vJ)(()=>{b&&e&&_()},[b,e]);const xe=(0,T.A)(()=>{const e=t?.id;e&&Vu(()=>{J.current||L({chatId:e,threadId:a,query:H})})}),Ee=(0,T.A)(e=>{if(J.current=!1,e.startsWith("#")&&!S)return P({chatId:t.id,threadId:a,update:{isHashtag:!0}}),$(e.slice(1)),void xe();if(I&&e.toLowerCase().startsWith("from:")&&!w&&!me){ue(!0);const t=e.slice(5).trim();return void ve(t)}!me||w?($(e),e||w||(he(!1),M(),J.current=!0)):ve(e)});(0,s.vJ)(()=>{e&&(H||w)&&xe()},[e,H,w]),(0,s.vJ)(()=>{he(Boolean(y))},[y]),(0,s.vJ)(()=>{A?.length&&A.length-q<5&&xe()},[q,A?.length]),(0,s.vJ)(()=>{if(e)return ne.current=!0,window.addEventListener("touchend",t),window.addEventListener("mouseup",t),window.addEventListener("touchstart",i),window.addEventListener("mousedown",i),()=>{i(),window.removeEventListener("touchstart",i),window.removeEventListener("mousedown",i)};function t(){O.current?.focus(),oe(),(0,Ce.IJ)(()=>{ne.current=!1})}function i(){window.removeEventListener("touchend",t),window.removeEventListener("mouseup",t),(0,Ce.IJ)(()=>{ne.current=!1})}},[e]),(0,Ne.A)({isActive:e,onBack:Fe});const[Ve,_e,Ue=0]=(0,Ms.A)(xe,A),[Oe,Ke]=(0,Ms.A)(void 0,fe?be:void 0),Je=Ie&&(fe?Oe:be.slice(0,5))||void 0,Ge=(0,s.Kr)(()=>{if(!H&&!p&&!w||!Ve?.length)return hi.p;const e=(0,n.mS)();return Ve.map(t=>{const[i,s]=(0,Dc.a)(t),n=(0,c.O5q)(e,i,s);if(!n)return;const a=b||(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)},[H,p,w,Ve,b]),je=Boolean((H||w)&&!de&&!Ge.length&&!ke&&!Ie),ze=e&&(le||!G)&&(ae||we)&&Boolean(Se||je||ke||h||Ie),He=(0,T.A)(e=>{const t=(0,Dc.D)(e),i=A?.indexOf(t)||0;W(i+Ue),"chat"===N&&ce(!1),R({chatId:e.chatId,messageId:e.id,threadId:S?void 0:a}),re()}),$e=(0,T.A)(()=>{ce(e=>!e),oe()}),qe=(0,Bs.A)(K,Se||Ie,e=>{const t=-1===e?0:e,i=Je?.length||0;if(t<i&&Je){const e=Je[t];return void(e&&st(e))}const s=t-i,n=Ge?.[s];n&&(He(n.message),W(s+Ue))},`.${Eu}`,!0),Qe=(0,T.A)(e=>{P({chatId:t.id,threadId:a,update:e}),xe()}),Ze=(0,T.A)(e=>{Re?V({initialSection:"saved_tags"}):Qe({savedTag:e})}),Xe=(0,T.A)(()=>{Qe({savedTag:void 0})}),et=(0,T.A)(()=>w?(Qe({fromPeerId:void 0}),void ve("")):me?(ue(!1),void ve("")):void(S?Qe({isHashtag:!1}):p&&Xe())),tt=(0,T.A)(e=>{Qe({type:e}),ce(!0)}),it=(0,T.A)(()=>{ue(!0),ve(""),De()}),st=(0,T.A)(e=>{P({chatId:t.id,threadId:a,update:{fromPeerId:e}}),ve(""),$(""),De()}),nt=(0,T.A)(()=>{if("chat"===N&&(re(),Me(),A)){const e=q+1,[t,i]=(0,Dc.a)(A[e]);R({chatId:t,messageId:i,threadId:a}),W(e)}}),at=(0,T.A)(()=>{if("chat"===N&&(re(),Me(),A)){const e=q-1,[t,i]=(0,Dc.a)(A[e]);R({chatId:t,messageId:i,threadId:a}),W(e)}});function ot(e,i){const s=!i&&N===e;switch(e){case"chat":return(0,se.Y)(Ps.A,{className:(0,ge.A)(Ru.searchType,s&&Ru.selectedType),peerId:t?.id,title:j("SearchThisChat"),clickArg:"chat",onClick:i?et:tt});case"myChats":return(0,se.Y)(Ps.A,{className:(0,ge.A)(Ru.searchType,s&&Ru.selectedType),peerId:k,forceShowSelf:!0,title:j("SearchMyMessages"),clickArg:"myChats",onClick:i?et:tt});case"channels":return(0,se.Y)(Ps.A,{className:(0,ge.A)(Ru.searchType,s&&Ru.selectedType),customPeer:xu,title:j("SearchPublicPosts"),clickArg:"channels",onClick:i?et:tt})}}function rt(e){const t=(0,c.PVB)((0,n.mS)(),e);if(t)return(0,se.Y)(Lu,{className:Eu,peer:t,onClick:st},`member-${e}`)}function lt(){return(0,se.FD)("div",{className:(0,ge.A)(Ru.dropdown,!ze&&Ru.dropdownHidden),children:[!G&&(0,se.Y)("div",{className:Ru.separator}),Le&&!S&&!fe&&(0,se.Y)("div",{className:(0,ge.A)(Ru.savedTags,!G&&Ru.wrap,"no-scrollbar"),children:Be.map(e=>{const t=(0,l.a0)(e.reaction,p);return(0,se.Y)(Du.A,{containerId:"local-search",reaction:e.reaction,tag:e,withCount:!0,isDisabled:Re,isChosen:t,onClick:t?Xe:Ze},(0,l.Jj)(e.reaction))})}),S&&!fe&&(0,se.FD)("div",{className:(0,ge.A)(Ru.searchTypes,"no-scrollbar"),children:[ot("chat"),ot("myChats"),ot("channels")]}),Boolean(Se||Ie)&&(0,se.FD)(ls.A,{ref:K,className:(0,ge.A)(Ru.results,"custom-scroll"),items:fe?Je:Ge,itemSelector:`.${Eu}`,preloadBackwards:0,onLoadMore:fe?Ke:_e,onKeyDown:qe,children:[ye&&fe&&(0,se.Y)(Ls.A,{}),Je?.map(rt),fe&&!ye&&!be?.length&&(0,se.Y)("span",{className:Ru.placeholder,children:j("NoResult")}),je&&(0,se.Y)("span",{className:Ru.placeholder,children:j("NoResultFoundFor",H)},"nothing"),ke&&(0,se.Y)("span",{className:Ru.placeholder,children:j("HashtagSearchPlaceholder")},"enterhash"),!fe&&Ge?.map(({message:e,senderPeer:t,messageChat:i,searchResultKey:s},n)=>(0,se.Y)(Lu,{teactOrderKey:-e.date,className:Eu,query:H,message:e,peer:t,messageChat:i,shouldShowChat:S,isActive:q-Ue===n,onClick:He},s))]})]})}return(0,se.FD)("div",{id:"MiddleSearch",className:(0,ge.A)(Ru.root,e&&Ru.active,!e&&ee&&"visually-hidden",ae&&Ru.focused,G&&Ru.mobile),ref:U,children:[(0,se.FD)("div",{className:Ru.header,children:[!G&&(0,se.Y)(Yt.A,{className:Ru.avatar,peer:i||t,size:"medium",isSavedMessages:b}),(0,se.FD)(ds.A,{ref:O,value:me&&!w?pe:H,className:(0,ge.A)(Ru.input,ze&&Ru.withDropdown,ze&&!G&&Ru.adaptSearchBorders),canClose:!G,isLoading:de,resultsItemSelector:`.${Ru.results} .${Eu}`,hasUpButton:Ye&&!G,hasDownButton:Ye&&!G,placeholder:j(S?"SearchHashtagsHint":"Search"),teactExperimentControlled:!0,onChange:Ee,onStartBackspace:et,onReset:Te,withBackIcon:G,onFocus:oe,focused:ae,onUpClick:Z?nt:void 0,onDownClick:Q?at:void 0,children:[(0,se.FD)("div",{className:Ru.searchTags,children:[p&&(0,se.Y)(Du.A,{containerId:"local-search-tags",className:Ru.savedSearchTag,reaction:p,tag:h[(0,l.Jj)(p)],onClick:Xe}),S&&(0,se.Y)("div",{className:Ru.hash,children:"#"}),(me||w)&&(0,se.FD)("div",{className:Ru.fromTag,children:[z("SearchFilterFrom"),w&&(0,se.Y)(Ps.A,{peerId:w,forceShowSelf:!0,canClose:!0,onClick:et})]})]}),!G&&lt()]}),!G&&(0,se.FD)("div",{className:Ru.icons,children:[I&&!me&&!w&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:it,ariaLabel:j("FilterByUser"),iconName:"user"}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>E({selectedAt:(0,We.CS)(Date.now())}),ariaLabel:j("JumpToDate"),iconName:"calendar"})]})]}),G&&lt(),G&&(0,se.FD)("div",{className:Ru.footer,children:[I&&!me&&!w&&(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:it,ariaLabel:j("FilterByUser"),iconName:"user"}),(0,se.Y)(X.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>E({selectedAt:(0,We.CS)(Date.now())}),ariaLabel:j("JumpToDate"),iconName:"calendar"}),(0,se.Y)("div",{className:Ru.counter,children:Pe&&(A?.length?j("Of",[Math.max(q+1,1),v]):A&&!A.length&&j("NoResult"))}),"chat"===N&&Boolean(A?.length)&&(0,se.Y)(X.A,{className:Ru.viewStyle,size:"smaller",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:$e,children:j(le?"SearchAsChat":"SearchAsList")}),Ye&&!ze&&(0,se.FD)("div",{className:Ru.mobileNavigation,children:[(0,se.Y)(X.A,{className:(0,ge.A)(Ru.navigationButton,!Z&&Ru.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:nt,nonInteractive:!Z,ariaLabel:z("AriaSearchOlderResult"),iconName:"up"}),(0,se.Y)(X.A,{className:(0,ge.A)(Ru.navigationButton,!Q&&Ru.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:at,nonInteractive:!Q,ariaLabel:z("AriaSearchNewerResult"),iconName:"down"})]})]})]})}));var Uu=i(80539),Ou=i(58734),Ku=i(73172);const Ju=2.5*g.$,Gu=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{setsById:i,added:s,recent:n,favorite:a,effect:o}=e.stickers,r=(0,c.nZ4)(e,t),l=(0,c.hds)(e,t),d=(0,v.L8)(t)?void 0:(0,c.AWZ)(e,t)?.stickerSet?.id;return{chat:l,effectStickers:o?.stickers,effectEmojis:o?.emojis,recentStickers:n.stickers,favoriteStickers:a.stickers,stickerSetsById:i,addedSetIds:s.setIds,canAnimate:(0,c.ML4)(e),isSavedMessages:r,isCurrentUserPremium:(0,c.g29)(e),chatStickerSetId:d}})(({chat:e,threadId:t,className:i,isHidden:a,isTranslucent:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:h,effectStickers:u,effectEmojis:p,addedSetIds:v,stickerSetsById:g,chatStickerSetId:A,canAnimate:f,isSavedMessages:C,isCurrentUserPremium:b,noContextMenus:y,idPrefix:S,onStickerSelect:N,isForEffects:k})=>{const{loadRecentStickers:w,addRecentSticker:I,unfaveSticker:P,faveSticker:Y,removeRecentSticker:F}=(0,n.ko)(),D=(0,s.li)(),M=(0,s.li)(),L=(0,s.li)(),{handleScroll:R,isAtBeginning:x}=(0,rs.A)(),E=(0,Ku.A)(e?.id,t),V=`${S}-sticker-set`,{activeSetIndex:_,observeIntersectionForSet:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,observeIntersectionForCovers:J,selectStickerSet:G}=pr(D,M,V,a),j=(0,B.A)(),z=Boolean(v),H=(0,s.Kr)(()=>{if(k&&u){const e=[];return p?.length&&e.push({id:o.hfH,accessHash:"0",title:"",stickers:p,count:p.length,isEmoji:!0}),u?.length&&e.push({id:o.Kp3,accessHash:"0",title:j("StickerEffects"),stickers:u,count:u.length}),e}if(!v)return hi.p;const e=[];h.length&&e.push({id:o.tRH,accessHash:"0",title:j("FavoriteStickers"),stickers:h,count:h.length}),d.length&&e.push({id:o.sR2,accessHash:"0",title:j("RecentStickers"),stickers:d,count:d.length});const t=[...v||[]];A&&t.unshift(A);const i=Object.values((0,di._E)(g,t));return[...e,...i]},[v,g,h,d,A,j,u,k,p]),$=(0,s.Kr)(()=>z&&0===H.filter(e=>e.stickers?.length).length,[H,z]);(0,s.vJ)(()=>{l&&(w(),c&&E({type:"chooseSticker"}))},[c,l,w,E]);const q=(0,cr.A)([],o.jhd),W=z&&q&&!$&&(c||k);(0,Ks.A)(M,!W||!M.current),(0,s.vJ)(()=>{if(!z)return;const e=M.current;if(!e)return;const t=_*Ju-(e.offsetWidth/2-Ju/2);(0,ya.A)(e,t)},[z,_]);const Q=(0,T.A)((e,t,i)=>{N(e,t,i,!0),I({sticker:e})}),Z=(0,T.A)(e=>{P({sticker:e})}),ee=(0,T.A)(e=>{Y({sticker:e})}),te=(0,T.A)(()=>{c&&E({type:"chooseSticker"})}),ie=(0,T.A)(e=>{F({sticker:e})});if(!e)return;const ne=(0,ge.A)("lq8BD6Hc",i),ae=(0,ge.A)(Tr,"no-scrollbar",!x&&Br),re=!W&&(c||k)&&!$;return(0,se.Y)(oe.Ay,{className:ne,activeKey:re?0:1,name:"fade",shouldCleanup:!0,children:W?(0,se.FD)(se.FK,{children:[!k&&(0,se.Y)("div",{ref:M,className:ae,children:(0,se.FD)("div",{className:"shared-canvas-container",children:[(0,se.Y)("canvas",{ref:L,className:"shared-canvas"}),H.map(function(t,i){const s=t.stickers?.[0],n=(0,ge.A)(Lr,i===_&&"y02WwQk6"),a=i<o.j41;return t.id===o.sR2||t.id===o.tRH||t.id===o.eKB||t.hasThumbnail||!s?(0,se.Y)(X.A,{className:n,ariaLabel:t.title,round:!0,faded:t.id===o.sR2||t.id===o.tRH,color:"translucent",onClick:()=>G(i),children:t.id===o.sR2?(0,se.Y)(he.A,{name:"recent"}):t.id===o.tRH?(0,se.Y)(he.A,{name:"favorite"}):t.id===o.eKB?(0,se.Y)(Yt.A,{peer:e,size:"small"}):(0,se.Y)(Cr,{stickerSet:t,noPlay:!f||!l,observeIntersection:J,sharedCanvasRef:a?L:void 0,forcePlayback:!0})},t.id):(0,se.Y)(Nr,{sticker:s,size:o.TBj,title:t.title,className:n,noPlay:!f||!l,observeIntersection:J,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:a?L:void 0,withTranslucentThumb:r,onClick:G,clickArg:i,forcePlayback:!0},t.id)})]})}),(0,se.Y)("div",{ref:D,onMouseMove:te,onScroll:R,className:(0,ge.A)(Dr,m.TF?"no-scrollbar":"custom-scroll",!k&&Mr),children:H.map((e,t)=>(0,se.Y)(Yr,{stickerSet:e,loadAndPlay:Boolean(f&&l),noContextMenus:y,index:t,idPrefix:V,observeIntersection:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,isNearActive:_>=t-1&&_<=t+1,favoriteStickers:h,isSavedMessages:C,isCurrentUserPremium:b,isTranslucent:r,isChatStickerSet:e.id===A,onStickerSelect:Q,onStickerUnfave:Z,onStickerFave:ee,onStickerRemoveRecent:ie,forcePlayback:!0,shouldHideHeader:e.id===o.hfH},e.id))})]}):c||k?$?(0,se.Y)("div",{className:Rr,children:j("NoStickers")}):(0,se.Y)(Ls.A,{}):(0,se.Y)("div",{className:Rr,children:j("ErrorSendRestrictedStickersAll")})})})),ju=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{availableReactions:i,topReactions:s}=e.reactions,{maxUniqueReactions:n}=e.appConfig,{enabledReactions:a,isPaidReactionAvailable:o}=(0,c.AWZ)(e,t)||{};return{enabledReactions:a,availableReactions:i,topReactions:s,reactionsLimit:n,isWithPaidReaction:o}})(({loadAndPlay:e,enabledReactions:t,availableReactions:i,topReactions:n,selectedReactionIds:a,isWithPaidReaction:o,message:r,reactionsLimit:c,onReactionSelect:d,onReactionContext:h})=>{const m=(0,s.li)(),u=(0,s.li)(),{width:p}=(0,Pe.A)(),{isTouchScreen:v}=(0,Y.Ay)(),A=r?.reactions?.results,f=c&&A&&A.length>=c,C=(0,s.Kr)(()=>{if(f){const e=A.map(({reaction:e})=>e);return o&&e.unshift({type:"paid"}),e}if(!t)return[];if("all"===t.type){const e=(i||[]).map(({reaction:e})=>e);return o&&e.unshift({type:"paid"}),(0,l.fu)(e,n)}const e=t.allowed.slice();return o&&e.unshift({type:"paid"}),(0,l.fu)(e,n)},[i,t,n,f,A,o]),b=(0,s.Kr)(()=>{const e=Math.min(26.25*g.$,p),t=(p>600?.625:.5)*g.$,i=e-.5*g.$,s=Math.floor((i+t)/(36+t)),n=Math.ceil(C.length/s),a=36*n+(n-1)*t+.5*g.$*2;return Math.min(18*g.$,a)},[C.length,p]);return(0,se.Y)("div",{className:"MhpiTAwi",style:`height: ${b}px`,children:(0,se.Y)("div",{className:(0,ge.A)("NIaqmosK",v?"no-scrollbar":"custom-scroll"),children:(0,se.FD)("div",{className:"symbol-set-container shared-canvas-container",children:[(0,se.Y)("canvas",{ref:m,className:"shared-canvas"}),(0,se.Y)("canvas",{ref:u,className:"shared-canvas"}),C.map(t=>{const s=(0,l.Jj)(t),n=s?a?.includes(s):void 0;return(0,se.Y)(Ir,{reaction:t,isSelected:n,loadAndPlay:e,availableReactions:i,onClick:d,onContextMenu:h,sharedCanvasRef:m,sharedCanvasHqRef:u},s)})]})})})})),zu=16.375*g.$,Hu=(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,m=s?(0,c.hds)(e,s):void 0,u=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"===u?.enabledReactions?.type,{maxUniqueReactions:f}=e.appConfig,C="all"===u?.enabledReactions?.type&&u?.enabledReactions?.areCustomAllowed,b=p?.reactions?.results,y=Boolean(f&&b&&b.length>=f);return{message:p,story:h,position:r,shouldUseFullPicker:!(m?.isForbidden||A||y)&&(C||g),isTranslucent:(0,c.cwE)(e),isCurrentUserPremium:(0,c.g29)(e),sendAsMessage:l,isForEffects:d,chatId:s,availableEffectById:i}})(({isOpen:e,message:t,story:i,position:a,isTranslucent:o,isCurrentUserPremium:r,shouldUseFullPicker:c,sendAsMessage:d,chatId:h,isForEffects:m,availableEffectById:u})=>{const{toggleReaction:p,closeReactionPicker:v,sendMessage:g,showNotification:A,sendStoryReaction:f,saveEffectInDraft:C,requestEffectInComposer:b,addLocalPaidReaction:y,openPaidReactionModal:S}=(0,n.ko)(),N=(0,B.A)(),k=(0,Si.A)(t?.id,!0),w=(0,Si.A)(t?.chatId,!0),I=(0,Si.A)(i?.peerId,!0),P=(0,Si.A)(i?.id),F=(0,Si.A)(a,!0),D=(0,s.li)(),M=(0,s.Kr)(()=>{if(F)return P?F:{x:F.x+(c?-23:-21),y:F.y+(c?-64:-10)}},[P,F,c]),L=(0,T.A)(()=>D.current),R=(0,T.A)(()=>({withPortal:!0,isDense:!I,deltaX:!(0,Y.Ny)()&&D.current?-(D.current.offsetWidth-zu)/2- -11.5:0})),x=(0,T.A)(e=>{if(!w||!k)return;const t=e.isCustomEmoji?{type:"custom",documentId:e.id}:{type:"emoji",emoticon:e.emoji};p({chatId:w,messageId:k,reaction:t,shouldAddToRecent:!0}),v()}),E=(0,T.A)(e=>{w&&k&&("paid"===e.type?y({chatId:w,messageId:k,count:1}):p({chatId:w,messageId:k,reaction:e,shouldAddToRecent:!0}),v())}),V=(0,T.A)(e=>{"paid"===e.type&&(S({chatId:w,messageId:k}),v())}),_=(0,T.A)(e=>{if("type"in e&&"paid"===e.type)return;const t="id"in e?{type:"custom",documentId:e.id}:e,i="type"in e&&"custom"===e.type?(0,n.mS)().customEmojis.byId[e.documentId]:"id"in e?e:void 0;if(i&&!i.isFree&&!r)return A({message:N("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:N("PremiumMore")}),void v();if(!d)return f({peerId:I,storyId:P,containerId:(0,l.$_)(I,P),reaction:t,shouldAddToRecent:!0}),void v();let s,a;if("type"in e&&"emoji"===e.type)s=e.emoticon;else{const e=(0,Uu.Ay)((0,Ou.hB)(i));s=e.text,a=e.entities}g({text:s,entities:a,isReaction:!0}),v()}),U=(0,T.A)(e=>{const t=Object.values(u),i=t.find(t=>t.effectStickerId===e.id)?.id;h&&C({chatId:h,threadId:G.l3,effectId:i}),i&&b({}),v()}),O=(0,s.Kr)(()=>(t?.reactions?.results||[]).reduce((e,{chosenOrder:t,reaction:i})=>(void 0!==t&&e.push((0,l.Jj)(i)),e),[]),[t?.reactions?.results]);return(0,se.Y)(Ze.A,{isOpen:e,ref:D,className:(0,ge.A)("gBh4WvBC","ReactionPicker"),bubbleClassName:(0,ge.A)("qSfKwMzX",!c&&!P&&"dRNSqkOC",P&&"srpBMrqr"),withPortal:!0,noCompact:!0,anchor:M,positionY:i&&"bottom",getTriggerElement:$u,getRootElement:qu,getMenuElement:L,getLayout:R,backdropExcludedSelector:".Modal.confirm",onClose:v,children:m&&h?(0,se.Y)(Gu,{className:"",isHidden:!e,loadAndPlay:Boolean(e&&c),idPrefix:"message-effect",canSendStickers:!1,noContextMenus:!1,chatId:h,isTranslucent:o,onStickerSelect:U,isForEffects:m}):(0,se.FD)(se.FK,{children:[(0,se.Y)(_r,{chatId:w,idPrefix:"message-emoji-set-",isHidden:!e||!(c||P),loadAndPlay:Boolean(e&&c),isReactionPicker:!0,className:c||P?void 0:"KVwgF6DG",selectedReactionIds:O,isTranslucent:o,onCustomEmojiSelect:P?_:x,onReactionSelect:P?_:E,onReactionContext:V}),!c&&Boolean(w)&&(0,se.Y)(ju,{chatId:w,loadAndPlay:e,onReactionSelect:P?_:E,onReactionContext:V,selectedReactionIds:O,message:t})]})})}));function $u(){return document.querySelector("body")}function qu(){return document.querySelector("body")}var Wu=i(39074),Qu=i(55153),Zu=i(45761);const Xu=document.createElement("div");var ep=i(41316),tp=i(3225),ip=i(25498),sp=i(9442),np=i(1715),ap=i(91525),op=i(52988),rp=i(27860);const lp="SHoF85Vw",cp="Zo7u5epf",dp=15*g.$,hp=(0,s.ph)(({attachment:e,className:t,isSingle:i,shouldDisplayCompressed:n,shouldDisplayGrouped:a,index:r,onDelete:l,onToggleSpoiler:c,onEdit:d})=>{const h=(0,Fi.A)(),{isMobile:m}=(0,Y.Ay)(),u=function(e,t){if(t&&e.quick){if(o.gex.has(e.mimeType))return"photo";if(o.fNs.has(e.mimeType))return"video"}return"file"}(e,n),p=(0,T.A)(()=>{c?.(r)}),v=(0,T.A)(()=>{d?.(r)}),g=(0,s.Kr)(()=>{switch(u){case"photo":return(0,se.Y)("img",{className:lp,src:e.blobUrl,alt:"",draggable:!1});case"video":return(0,se.FD)(se.FK,{children:[Boolean(e.quick?.duration)&&(0,se.Y)("div",{className:"nI2M1SBH",children:(0,We.QO)(e.quick.duration)}),(0,se.Y)("video",{className:lp,src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})]});default:{const t=o.gex.has(e.mimeType)&&!m,i=o.gex.has(e.mimeType);return(0,se.FD)(se.FK,{children:[(0,se.Y)(op.A,{className:"B6f6GcvN",name:e.filename,extension:(0,ap.QC)(e.filename,e.mimeType),previewData:i&&e.blobUrl?e.blobUrl:e.previewBlobUrl,size:e.size,previewSize:"large",onClick:t?v:void 0,actionIcon:t?"edit":void 0}),l&&(0,se.Y)(he.A,{name:"delete",className:(0,ge.A)(cp,"CYJwy9T_"),onClick:()=>l(r)})]})}}},[e,u,r,l,m]),A="file"===u||!a,f=Boolean("file"!==u&&e.shouldSendAsSpoiler),C="file"!==u,b=(0,ge.A)(t,"QucaiGVU",i&&"FjrnqGba",A&&"g0cTsM9d");return(0,se.FD)("div",{className:b,dir:h.isRtl?"rtl":void 0,children:[g,(0,se.Y)(rp.A,{isVisible:f,thumbDataUri:e.previewBlobUrl||e.blobUrl,width:dp,height:dp}),C&&(0,se.FD)("div",{className:"bX7LdgxW",children:["photo"===u&&d&&(0,se.Y)(he.A,{name:"edit",className:cp,onClick:v}),(0,se.Y)(he.A,{name:e.shouldSendAsSpoiler?"spoiler-disable":"spoiler",className:cp,onClick:p}),l&&(0,se.Y)(he.A,{name:"delete",className:cp,onClick:()=>l(r)})]})]})});var mp=i(25897),up=i(6070),pp=i(49068);function vp(e,t,i=!1){const s=e[i?"scrollLeft":"scrollTop"],n=s+e[i?"offsetWidth":"offsetHeight"],a=t[i?"offsetLeft":"offsetTop"],o=a+t[i?"offsetWidth":"offsetHeight"];return a>s&&o<n}function gp(e,t,i=0,s=!1,n=!1,a=!1){const o=e[a?"scrollLeft":"scrollTop"],r=o+e[a?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let h=!1;for(let e=0;e<c;e++){const t=l[e],c=t[a?"offsetLeft":"offsetTop"],m=c+t[a?"offsetWidth":"offsetHeight"];if(n?m>=o-i&&m<=r+i:c<=r+i&&m>=o-i)d.push(e),h=!0;else if(h&&!s)break}return{allElements:l,visibleIndexes:d}}function Ap(e,t,i){const s=i.current;if(!s||t<0)return;const{visibleIndexes:n,allElements:a}=gp(s,e,8,!0,!0);if(!a.length||!a[t])return;const o=n[0];if(!n.includes(t)||t===o&&!vp(s,a[o])){const e=t>n[n.length-1]?"start":"end";(0,dr.Ay)({container:s,element:a[t],position:e,margin:10})}}function fp({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:i,shouldRemoveSelectionOnReset:n,noArrowNavigation:a,items:o,shouldSelectOnTab:r,onSelect:l,onClose:c}){const[d,h]=(0,s.J0)(-1),m=(0,T.A)(e=>o?(0,Ba.A)(o.length,e):-1),u=(0,T.A)((e,t)=>{t.preventDefault(),h(t=>m(t+e))}),p=(0,T.A)(t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return!1;if(!e)return!1;if(o&&o.length&&d>-1){const e=o[d];if(e){if(!1===l(e))return!1;t.preventDefault()}}return!0});(0,s.vJ)(()=>{e||h(n?-1:0)},[e,n]);const v=!o||d>o.length-1;return(0,s.vJ)(()=>{i&&!v||h(n?-1:0)},[v,n,i]),(0,s.vJ)(()=>e?(0,Ni.A)({onEsc:c,onUp:a||t?void 0:e=>u(-1,e),onDown:a||t?void 0:e=>u(1,e),onLeft:a||!t?void 0:e=>u(-1,e),onRight:a||!t?void 0:e=>u(1,e),onTab:r?p:void 0,onEnter:p}):void 0,[a,u,p,e,t,c,r]),d}const Cp=(0,s.ph)(({isOpen:e,onClose:t,onInsertUserName:i,filteredUsers:a})=>{const o=(0,s.li)(),{shouldRender:r,transitionClassNames:l}=(0,je.A)(e,void 0,void 0,!1),c=(0,T.A)((e,t=!1)=>{const s=(0,n.mS)().users.byId[e];s&&i(s,t)}),d=(0,T.A)((e,t)=>{e.preventDefault(),c(t)}),h=(0,T.A)(e=>{c(e.id,!0)}),m=fp({isActive:e,items:a,onSelect:h,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,s.vJ)(()=>{Ap(".chat-item-clickable",m,o)},[m]),(0,s.vJ)(()=>{a&&!a.length&&t()},[a,t]);const u=(0,K.A)(a?.length?a:void 0,r),p=a&&!a.length?u:a;if(!r||p&&!p.length)return;const v=(0,ge.A)("MentionTooltip composer-tooltip custom-scroll",l);return(0,se.Y)("div",{className:v,ref:o,children:p?.map(({id:e},t)=>(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item smaller-icon",onClick:d,clickArg:e,focus:m===t,children:(0,se.Y)(ms.A,{userId:e,avatarSize:"small",withUsername:!0})},e))})});var bp=i(78407),yp=i(26440);const Sp="AT_d9l0W",Np="AnO3BgVv",kp="caption-input-text",wp=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{currentUserId:i,recentEmojis:s,customEmojis:n,attachmentSettings:a}=e,{shouldSaveAttachmentsCompression:r,shouldOpenMessageMediaEditor:l}=(0,c.nTw)(e),d=(0,c.AWZ)(e,t),h=(0,c.nZ4)(e,t),{shouldSuggestCustomEmoji:m}=e.settings.byKey,{language:u}=(0,Ys.lS)(e),p=e.emojiKeywords[o.cUY],v=u!==o.cUY?e.emojiKeywords[u]:void 0;return{isChatWithSelf:h,currentUserId:i,groupChatMembers:d?.members,recentEmojis:s,baseEmojiKeywords:p?.keywords,emojiKeywords:v?.keywords,shouldSuggestCustomEmoji:m,customEmojiForEmoji:n.forEmoji.stickers,captionLimit:(0,ys.d)(e,"captionLength"),attachmentSettings:a,shouldSaveAttachmentsCompression:r,shouldOpenMessageMediaEditor:l}})(({chatId:e,threadId:t,attachments:i,getHtml:a,editingMessage:c,canShowCustomSendMenu:d,captionLimit:h,isReady:m,isChatWithSelf:p,currentUserId:v,groupChatMembers:g,recentEmojis:A,baseEmojiKeywords:f,emojiKeywords:C,isForMessage:b,shouldSchedule:y,shouldSuggestCustomEmoji:S,customEmojiForEmoji:N,attachmentSettings:k,shouldSaveAttachmentsCompression:w,shouldForceCompression:I,shouldForceAsFile:P,isForCurrentMessageList:F,forceDarkTheme:M,canScheduleUntilOnline:B,canSchedule:L,paidMessagesStars:R,shouldOpenMessageMediaEditor:x,onAttachmentsUpdate:E,onCaptionUpdate:V,onSend:_,onFileAppend:U,onClear:O,onSendSilent:J,onSendScheduled:G,onCustomEmojiSelect:j,onRemoveSymbol:H,onEmojiSelect:$,onSendWhenOnline:q})=>{const W=(0,s.li)(),Q=(0,s.li)(),{addRecentCustomEmoji:Z,addRecentEmoji:ee,updateAttachmentSettings:ie,resetMessageMediaEditorRequest:ne,updateShouldSaveAttachmentsCompression:ae}=(0,n.ko)(),oe=(0,Fi.A)(),re=(0,s.li)(),le=(0,s.li)(),ce=(0,s.li)(),de=(0,K.A)(i),he=i.length?i:de,{isMobile:pe}=(0,Y.Ay)(),ve=c&&Boolean(c),Ae=c&&c?.groupedId,fe="file"!==(ve&&i?.length&&(0,l.ES)(i[0])),Ce=he?.some(e=>e.gif),[be,ye,Ne]=(0,D.A)(),[we,Ie]=(0,s.J0)(void 0),Pe=void 0!==we?i[we]:void 0;(0,s.vJ)(()=>{x&&i.length&&(Ie(0),ne())},[x,i.length]);const Ye=k.shouldCompress,Fe=Boolean((Ye||I||Ae||Ce)&&!P),[De,Me]=(0,s.J0)(k.shouldSendGrouped),Te=k.isInvertedMedia,[Be,Le]=(0,s.J0)(k.shouldSendInHighQuality),[Re,xe]=(0,s.J0)(Be),Ee=Boolean(i.length),Ve=Boolean(he?.length),[_e,Ue,Oe]=(0,D.A)(),Ke=(0,s.li)();(0,s.vJ)(()=>{Ee||(Ne(),ie({isInvertedMedia:void 0}))},[Ne,Ee]),(0,s.vJ)(()=>{Ce&&(ae({shouldSave:!1}),Me(!1))},[Ce,ae]);const[Je,Ge]=(0,s.Kr)(()=>Boolean(he?.every(e=>e.quick||e.audio))?[!0,!0]:[Boolean(he?.some(e=>e.quick||e.audio)),!1],[he]),[je,ze]=(0,s.Kr)(()=>Boolean(he?.every(e=>e.shouldSendAsSpoiler))?[!0,!0]:[Boolean(he?.some(e=>e.shouldSendAsSpoiler)),!1],[he]),He=(0,ep.A)(`#${o.e0F}`),{isEmojiTooltipOpen:$e,filteredEmojis:qe,filteredCustomEmojis:We,insertEmoji:Qe,closeEmojiTooltip:Ze}=(0,ip.A)(Boolean(m&&(F||!b)&&Ve),a,V,o.e0F,A,f,C),{isCustomEmojiTooltipOpen:Xe,insertCustomEmoji:et,closeCustomEmojiTooltip:tt}=(0,tp.A)(Boolean(m&&(F||!b)&&Ve&&S),a,V,He,le,N),{isMentionTooltipOpen:it,closeMentionTooltip:st,insertMention:nt,mentionFilteredUsers:at}=(0,sp.A)(Boolean(m&&F&&Ve),a,V,He,le,g,void 0,v);function ot(e){ie({isInvertedMedia:e})}(0,s.vJ)(()=>Ee?(0,u.A)(O):void 0,[Ee,O]),(0,s.vJ)(()=>{Ee&&(Me(k.shouldSendGrouped),Le(k.shouldSendInHighQuality))},[k,Ee]),(0,s.vJ)(()=>{Ee||ie({isInvertedMedia:void 0})},[ie,Ee]),(0,s.vJ)(()=>{Ee&&pe&&(0,Wu.DY)()},[pe,Ee]);const{isContextMenuOpen:rt,handleContextMenu:lt,handleContextMenuClose:ct,handleContextMenuHide:dt}=(0,cn.A)(re,!d||!Ee),ht=(0,T.A)((e,t)=>{Ee&&(((y||t)&&b&&!c?G:e?J:_)(Fe,De,Te),ie({...w&&{defaultAttachmentCompression:k.shouldCompress?"compress":"original"},shouldSendGrouped:De,isInvertedMedia:Te,shouldSendInHighQuality:Be}))}),mt=(0,T.A)(()=>{ht(!0)}),ut=(0,T.A)(()=>{ht()}),pt=(0,T.A)(()=>{ht(!1,!0)}),vt=(0,T.A)(async e=>{e.preventDefault(),Oe();const{dataTransfer:t}=e,i=await(0,Zu.A)(t.items);i?.length&&U(i,ze)}),gt=(0,T.A)(e=>{const{files:t}=e.target,i=(0,z.kc)(t);i?.length&&U(i,ze)}),At=(0,T.A)(()=>{(0,Gh.p)("*",e=>gt(e))}),ft=(0,T.A)(e=>{E(i.filter((t,i)=>i!==e))}),Ct=(0,T.A)(()=>{E(i.map(e=>({...e,shouldSendAsSpoiler:!0})))}),bt=(0,T.A)(()=>{ie({shouldCompress:!Ye})}),yt=(0,T.A)(()=>{const e=!Be;Le(e),ie({shouldSendInHighQuality:e})}),St=(0,T.A)(()=>{E(i.map(e=>({...e,shouldSendAsSpoiler:void 0})))}),Nt=(0,T.A)(e=>{E(i.map((t,i)=>i===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t))}),kt=(0,T.A)(e=>{Ie(e)}),wt=(0,T.A)(()=>{Ie(void 0)}),It=(0,T.A)(async e=>{if(void 0===we)return;const t=await(0,Qu.Ay)(e.name,e,{shouldSendAsFile:i[we].shouldSendAsFile,shouldSendAsSpoiler:i[we].shouldSendAsSpoiler,shouldSendInHighQuality:i[we].shouldSendInHighQuality});E(i.map((e,i)=>i===we?t:e)),Ie(void 0)}),Pt=(0,T.A)(()=>{const e=Q.current;if(!e)return;const{width:t,height:i}=e.getBoundingClientRect();e.viewBox.baseVal.width=t,e.viewBox.baseVal.height=i});(0,kr.A)(W,Pt),(0,ke.A)(Pt),(0,s.vJ)(()=>{const e=re.current,t=document.getElementById(kp);if(!e||!t)return;const{width:i}=e.getBoundingClientRect();(0,r.RK)(()=>{t.style.setProperty("--margin-for-scrollbar",`${i}px`)})},[oe,Ee]);const Yt=(0,s.Kr)(()=>({onTrigger:e,isOpen:t})=>(0,se.Y)(X.A,{round:!0,ripple:!pe,size:"tiny",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",iconName:"more"}),[pe]),Ft=(0,Se.A)(()=>{if(!Ve)return;const e=h-(t=a(),Xu.innerHTML=t,(0,Uu.g4)(Xu),Xu.querySelectorAll("br").forEach(e=>{e.replaceWith("\n")}),Xu.textContent?.trim().length||0);var t;return e<=100?e:void 0},[h,a,Ve]),Dt=Fe&&Ge,{areAllPhotos:Mt,areAllVideos:Tt,areAllAudios:Bt,hasAnyPhoto:Lt}=(0,s.Kr)(()=>Dt&&he?{areAllPhotos:he.every(e=>o.gex.has(e.mimeType)),areAllVideos:he.every(e=>o.fNs.has(e.mimeType)),areAllAudios:he.every(e=>o.IH3.has(e.mimeType)),hasAnyPhoto:he.some(e=>o.gex.has(e.mimeType))}:{areAllPhotos:!1,areAllVideos:!1,areAllAudios:!1,hasAnyPhoto:!1},[he,Dt]),Rt=(0,s.Kr)(()=>!!he&&he.some(e=>!o.IH3.has(e.mimeType)),[he]);if((0,s.vJ)(()=>{if(Be!==Re)return Ke.current&&clearTimeout(Ke.current),Ke.current=window.setTimeout(()=>{xe(Be)},200),()=>{Ke.current&&(clearTimeout(Ke.current),Ke.current=void 0)}},[Be,Re]),!he)return;const xt=he.length>1,Et=!(ve||!Je||!(P||I||Fe)||xt&&De);let Vt="";const _t=he.length;Vt=oe(Mt?`Attachment${ve?"Replace":"Send"}Photo`:Tt?`Attachment${ve?"Replace":"Send"}Video`:Bt?`Attachment${ve?"Replace":"Send"}Audio`:`Attachment${ve?"Replace":"Send"}File`,{count:_t},{pluralValue:_t});const Ut=R?(0,wi.U2)(oe,_t*R,{asFont:!0}):void 0;return(0,se.FD)(te.A,{isOpen:Ee,header:function(){if(he)return(0,se.FD)("div",{className:"modal-header-condensed-wide",dir:oe.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:"Cancel attachments",onClick:O,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:Vt}),fe&&!Ae&&(0,se.FD)(me.A,{className:"with-menu-transitions",trigger:Yt,positionX:"right",children:[Boolean(!c)&&!Ce&&(0,se.Y)(ue.A,{icon:"add",onClick:At,children:oe("Add")}),Je&&(0,se.FD)(se.FK,{children:[Et&&(Te?(0,se.Y)(ue.A,{icon:"move-caption-down",onClick:()=>ot(void 0),children:oe("ContextMoveTextDown")}):(0,se.Y)(ue.A,{icon:"move-caption-up",onClick:()=>ot(!0),children:oe("ContextMoveTextUp")})),!P&&!I&&!Ce&&(Fe?(0,se.Y)(ue.A,{icon:"document",onClick:bt,children:oe(xt?"AttachmentMenuSendAllAsFiles":"AttachmentMenuSendAsFiles")}):(0,se.Y)(ue.A,{icon:"photo",onClick:bt,children:oe(xt?"AttachmentMenuSendAllAsMedia":"AttachmentMenuSendAsMedia")})),Fe&&!c&&Lt&&(0,se.Y)(ue.A,{icon:Re?"sd-photo":"hd-photo",onClick:yt,children:oe(Re?"SendInStandardQuality":"SendInHighQuality")}),Fe&&Rt&&Boolean(!c)&&(je?(0,se.Y)(ue.A,{icon:"spoiler-disable",onClick:St,children:oe("AttachmentMenuDisableSpoiler")}):(0,se.Y)(ue.A,{icon:"spoiler",onClick:Ct,children:oe("AttachmentMenuEnableSpoiler")}))]}),xt&&(De?(0,se.Y)(ue.A,{icon:"grouped-disable",onClick:()=>Me(!1),children:oe("AttachmentMenuUngroupAllMedia")}):(0,se.Y)(ue.A,{icon:"grouped",onClick:()=>Me(!0),children:oe("AttachmentMenuGroupAllMedia")}))]})]})}(),className:(0,ge.A)("a27O2Qlr",_e&&Np,pe&&"khvUZbGZ",be&&"ir5kkMy1",M&&"component-theme-dark"),hasAbsoluteCloseButton:Boolean(he),noBackdropClose:!0,isLowStackPriority:!0,onClose:O,children:[(0,se.FD)("div",{className:Sp,onDragEnter:Ue,onDrop:vt,onDragOver:function(e){e.preventDefault(),ce.current&&(window.clearTimeout(ce.current),ce.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:i}=e;i.matches(`.${Sp}`)&&!t&&(ce.current=window.setTimeout(Oe,150)),i&&i.closest(`.${Np}`)||(t&&e.stopPropagation(),Oe())},onClick:Oe,"data-attach-description":oe("AttachmentDragAddItems"),"data-dropzone":!0,children:[(0,se.Y)("svg",{className:"d9O65j_I",children:(0,se.Y)("rect",{className:"jzCBDWMw",x:"0",y:"0",width:"100%",height:"100%",rx:"8"})}),(0,se.Y)("div",{className:(0,ge.A)("_bxSIFgj","custom-scroll",!Fe&&"xo5WijLn"),children:he.map((e,t)=>(0,se.Y)(hp,{attachment:e,shouldDisplayCompressed:Fe,shouldDisplayGrouped:De,isSingle:1===he.length,index:t,onDelete:ft,onToggleSpoiler:Nt,onEdit:pe?void 0:kt},e.uniqueId||t))}),(0,se.FD)("div",{className:(0,ge.A)("EtmiUn2k"),children:[(0,se.Y)(Cp,{isOpen:it,filteredUsers:at,onInsertUserName:nt,onClose:st}),(0,se.Y)(pp.A,{isOpen:$e,emojis:qe,customEmojis:We,addRecentEmoji:ee,addRecentCustomEmoji:Z,onEmojiSelect:Qe,onCustomEmojiSelect:Qe,onClose:Ze}),(0,se.Y)(mp.A,{chatId:e,isOpen:Xe,addRecentCustomEmoji:Z,onCustomEmojiSelect:et,onClose:tt}),(0,se.FD)("div",{className:"Te7lIfpB",children:[(0,se.Y)(yp.A,{chatId:e,threadId:t,isMobile:pe,isReady:m,isSymbolMenuOpen:be,openSymbolMenu:ye,closeSymbolMenu:Ne,onCustomEmojiSelect:j,onRemoveSymbol:H,onEmojiSelect:$,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:M}),(0,se.Y)(bp.A,{ref:le,id:kp,chatId:e,threadId:t,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:m,isActive:Ee,getHtml:a,editableInputId:o.e0F,placeholder:oe("AttachmentCaptionPlaceholder"),onUpdate:V,onSend:ut,canAutoFocus:Boolean(m&&F&&i.length),captionLimit:Ft,shouldSuppressFocus:pe&&be,onSuppressedFocus:Ne}),(0,se.FD)("div",{className:"wDqWK9MD",children:[(0,se.Y)(X.A,{ref:re,className:"kNlWmBJI",size:"smaller",inline:!0,onClick:ut,onContextMenu:d?lt:void 0,iconName:c||y||R?void 0:"new-send",iconClassName:"YhSs6nkg",children:y&&!c?oe("Next"):c?oe("Save"):Ut}),d&&(0,se.Y)(up.A,{isOpen:rt,canSchedule:L&&b,onSendSilent:p?void 0:mt,onSendSchedule:pt,onClose:ct,onCloseAnimationEnd:dt,isSavedMessages:p,onSendWhenOnline:q,canScheduleUntilOnline:B})]})]})]})]}),(0,se.Y)(np.A,{isOpen:Boolean(Pe),imageUrl:Pe?.blobUrl,mimeType:Pe?.mimeType,filename:Pe?.filename,onClose:wt,onSave:It})]})})),Ip=(0,s.ph)(({isOpen:e,isQuiz:t,shouldBeAnonymous:i,maxOptionsCount:n=12,onSend:a,onClear:o})=>{const l=(0,s.li)(),c=(0,s.li)(),[d,h]=(0,s.J0)(""),[m,p]=(0,s.J0)([""]),[v,g]=(0,s.J0)(!0),[A,f]=(0,s.J0)(!1),[C,b]=(0,s.J0)(t||!1),[y,S]=(0,s.J0)(""),[N,k]=(0,s.J0)(),[w,I]=(0,s.J0)(!1),P=(0,B.A)(),Y=(0,T.A)(e=>{S(e.target.value)}),F=(0,T.A)(t=>{e&&t.current&&t.current.focus()});(0,s.vJ)(()=>e?(0,u.A)(o):void 0,[e,o]),(0,s.vJ)(()=>{e||(h(""),p([""]),g(!0),f(!1),b(t||!1),S(""),k(void 0),I(!1))},[t,e]),(0,s.vJ)(()=>F(l),[F,e]);const D=(0,T.A)((e=[])=>{p([...e,""]),(0,r.Uz)(()=>{const e=c.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),M=(0,T.A)(()=>{if(I(!1),!e)return;const t=C&&(void 0===N||!m[N].trim()),i=m.map((e,t)=>{if(e=e.trim())return{text:{text:e},option:String(t),...t===N&&{correct:!0}}}).filter(Boolean),s=d.trim().substring(0,255);if(!s||i.length<2){if(h(s),i.length){const e=m.map(e=>e.trim().substring(0,100)).filter(Boolean);e.length<2?D(e):p(e)}else D();return void I(!0)}if(t)return void I(!0);const n={summary:{question:{text:s},answers:i,...!v&&{isPublic:!0},...A&&{multipleChoice:!0},...C&&{quiz:!0}}};if(C){const{text:e,entities:t}=y&&(0,Uu.Ay)(y.substring(0,200))||{};n.quiz={correctAnswers:[String(N)],...e&&{solution:e},...t&&{solutionEntities:t}}}a(n)}),L=(0,T.A)((e,t)=>{const i=[...m];i[e]=t,i[i.length-1].trim().length&&i.length<n?D(i):p(i)}),R=(0,T.A)(e=>{const t=[...m];t.splice(e,1),p(t),void 0!==N&&(N===e?k(void 0):e<N&&k(N-1)),(0,r.Uz)(()=>{c.current&&c.current.classList.toggle("overflown",c.current.scrollHeight>320)})}),x=(0,T.A)(e=>{k(Number(e))}),E=(0,T.A)(e=>{g(e.target.checked)}),V=(0,T.A)(e=>{f(e.target.checked)}),_=(0,T.A)(e=>{b(e.target.checked)}),U=(0,T.A)(e=>{13===e.keyCode&&M()}),O=(0,T.A)(e=>{h(e.target.value)}),K=(0,T.A)(()=>{if(w&&!d.trim().length)return P("lng_polls_choose_question")}),J=(0,T.A)(e=>{const t=m.map(e=>e.trim()).filter(e=>e.length);if(w&&t.length<2&&!m[e].trim().length)return P("lng_polls_choose_answers")});function G(){return m.map((e,t)=>(0,se.FD)("div",{className:"option-wrapper",children:[(0,se.Y)(ee.A,{maxLength:100,label:t!==m.length-1||m.length===n?P("OptionHint"):P("CreatePoll.AddOption"),error:J(t),value:e,onChange:e=>L(t,e.currentTarget.value),onKeyPress:U}),t!==m.length-1&&(0,se.Y)(X.A,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:P("Delete"),onClick:()=>R(t),iconName:"close"})]}))}return(0,se.FD)(te.A,{isOpen:e,onClose:o,header:(0,se.FD)("div",{className:"modal-header-condensed",children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:"Cancel poll creation",onClick:o,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:P("NewPoll")}),(0,se.Y)(X.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:M,children:P("Create")})]}),className:"PollModal",children:[(0,se.Y)(ee.A,{ref:l,label:P("AskAQuestion"),value:d,error:K(),onChange:O,onKeyPress:U}),(0,se.Y)("div",{className:"options-divider"}),(0,se.FD)("div",{className:"options-list custom-scroll",ref:c,children:[(0,se.Y)("h3",{className:"options-header",children:P("PollOptions")}),w&&function(){const e=m.map(e=>e.trim()).filter(e=>e.length);return C&&(void 0===N||!e[N])&&(0,se.Y)("p",{className:"poll-error",children:P("lng_polls_choose_correct")})}(),C?(0,se.Y)(ie.A,{name:"correctOption",options:G().map((e,t)=>({value:String(t),label:e,hidden:!m[t].trim()})),selected:String(N),onChange:x}):G()]}),(0,se.Y)("div",{className:"options-divider"}),(0,se.FD)("div",{className:"quiz-mode",children:[(0,se.FD)("div",{className:"dialog-checkbox-group",children:[!i&&(0,se.Y)(js.A,{label:P("PollAnonymous"),checked:v,onChange:E}),(0,se.Y)(js.A,{label:P("PollMultiple"),checked:A,disabled:C,onChange:V}),(0,se.Y)(js.A,{label:P("PollQuiz"),checked:C,disabled:A||void 0!==t,onChange:_})]}),C&&(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:"options-header",children:P("lng_polls_solution_title")}),(0,se.Y)(fn.A,{value:y,onChange:Y,noReplaceNewlines:!0}),(0,se.Y)("div",{className:"note",children:P("CreatePoll.ExplanationInfo")})]})]})]})});var Pp=i(14235);const Yp=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const{appConfig:i}=e;return{editingMessage:t?.messageId?(0,c.O5q)(e,t.chatId,t.messageId):void 0,maxItemsCount:i.todoItemsMax,maxTitleLength:i.todoTitleLengthMax,maxItemLength:i.todoItemLengthMax}})(({modal:e,maxItemsCount:t,maxTitleLength:i,maxItemLength:a,editingMessage:o,onSend:l,onClear:c})=>{const{editTodo:d,closeTodoListModal:h,appendTodoList:m}=(0,n.ko)(),p=(0,s.li)(),v=(0,s.li)(),[g,A]=(0,s.J0)(""),[f,C]=(0,s.J0)(()=>[{id:(0,Pp.t)(),text:""}]),[b,y]=(0,s.J0)(!0),[S,N]=(0,s.J0)(!0),[k,w]=(0,s.J0)(!1),I=(0,Fi.A)(),P=Boolean(e),Y=(0,Si.A)(e),F=Y?.forNewTask&&!o?.isOutgoing,D=o?.content.todo?.todo,M=(0,s.Kr)(()=>F&&D?D.items.map(e=>({id:e.id,text:e.title.text,isDisabled:!0})):hi.p,[F,D]),B=(0,T.A)(e=>{P&&e.current&&e.current.focus()});(0,s.Nf)(()=>{if(D&&(A(D.title.text),y(D.othersCanAppend??!1),N(D.othersCanComplete??!1),!F)){const e=D.items.map(e=>({id:e.id,text:e.title.text}));e.length<t&&e.push({id:(0,Pp.t)(),text:""}),C(e)}},[D,F,t]),(0,s.vJ)(()=>P?(0,u.A)(c):void 0,[P,c]),(0,s.vJ)(()=>{P||(A(""),C([{id:(0,Pp.t)(),text:""}]),y(!0),N(!0),w(!1))},[P]),(0,s.vJ)(()=>{P&&(0,r.YS)(()=>{if(Y?.forNewTask){const e=v.current?.querySelectorAll("input"),t=e?.[e.length-1];t?.focus()}else B(p)})},[B,P,Y?.forNewTask]);const L=(0,T.A)(e=>{const t=(0,Pp.t)();C([...e,{id:t,text:""}]),(0,r.Uz)(()=>{const e=v.current;e&&(0,r.YS)(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})})}),R=(0,T.A)(()=>{if(w(!1),!P)return;const e=f.map(e=>{const t=e.text.trim();if(t)return{id:e.id,title:{text:t.substring(0,a)}}}).filter(Boolean),t=g.trim().substring(0,i);if(!t||0===e.length){if(A(t),e.length){const e=f.map(e=>({...e,text:e.text.trim().substring(0,a)})).filter(e=>e.text.length);0===e.length?L([]):C([...e,{id:(0,Pp.t)(),text:""}])}else L([]);return void w(!0)}if(F&&o)return m({chatId:o.chatId,messageId:o.id,items:e}),void h();const s={todo:{title:{text:t},items:e,othersCanAppend:b,othersCanComplete:S}};o?d({chatId:o.chatId,todo:s,messageId:o.id}):l(s),h()}),x=(0,T.A)((e,i)=>{const s=[...f];s[e]={...s[e],text:i},s[s.length-1].text.trim().length&&s.length<t?L(s):C(s)}),E=(0,T.A)(e=>{const t=[...f];t.splice(e,1),C(t),(0,r.Uz)(()=>{v.current&&v.current.classList.toggle("overflown",v.current.scrollHeight>320)})}),V=(0,T.A)(e=>{y(e.target.checked)}),_=(0,T.A)(e=>{N(e.target.checked)}),U=(0,T.A)(e=>{"Enter"===e.key&&R()}),O=(0,T.A)(e=>{A(e.target.value)}),K=(0,T.A)(()=>{if(k&&!g.trim().length)return I("ToDoListErrorChooseTitle")}),J=(0,T.A)(e=>{const t=f.map(e=>e.text.trim()).filter(e=>e.length);if(k&&t.length<1&&!f[e].text.trim().length)return I("ToDoListErrorChooseTasks")}),G=t-f.length-(F&&D?D.items.length:0);return(0,se.FD)(te.A,{isOpen:P,onClose:c,header:function(){const e=F?"TitleAppendToDoList":o?"TitleEditToDoList":"TitleNewToDoList";return(0,se.FD)("div",{className:"modal-header-condensed",children:[(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:I("AriaToDoCancel"),onClick:c,iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:I(e)}),(0,se.Y)(X.A,{color:"primary",size:"tiny",className:"modal-action-button",onClick:R,children:I(F?"Add":o?"Save":"Create")})]})}(),className:"ToDoListModal",children:[!F&&(0,se.Y)(ee.A,{ref:p,label:I("InputTitle"),value:g,error:K(),onChange:O,onKeyPress:U}),F&&(0,se.Y)("div",{className:"readonly-title",children:g}),(0,se.Y)("div",{className:"options-divider"}),(0,se.FD)("div",{className:"options-list custom-scroll",ref:v,children:[(0,se.Y)("h3",{className:"items-header",children:I("TitleToDoList")}),function(){const e=[...M,...f];return e.map((i,s)=>{const n=s-M.length;return(0,se.FD)("div",{className:"item-wrapper",children:[(0,se.Y)(ee.A,{maxLength:100,label:s!==e.length-1||e.length===t?I("TitleTask"):I("TitleAddTask"),error:J(n),value:i.text,disabled:i.isDisabled,onChange:e=>x(n,e.currentTarget.value),onKeyPress:U}),s!==e.length-1&&!i.isDisabled&&(0,se.Y)(X.A,{className:"item-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:I("Delete"),onClick:()=>E(n),iconName:"close"})]})})}()]}),(0,se.Y)("div",{className:"items-count-hint",children:I("HintTodoListTasksCount2",{count:G},{pluralValue:G})}),(0,se.Y)("div",{className:"options-divider"}),!F&&(0,se.Y)("div",{className:"options-footer",children:(0,se.FD)("div",{className:"dialog-checkbox-group",children:[(0,se.Y)(js.A,{label:I("AllowOthersAddTasks"),checked:b,onChange:V}),(0,se.Y)(js.A,{label:I("AllowOthersMarkAsDone"),checked:S,onChange:_})]})})]})}));var Fp=i(36680),Dp=i(52491);const Mp=(0,s.ph)(({emoji:e,focus:t,onClick:i})=>{const s=(0,T.A)(t=>{t.preventDefault(),i(e.native,e.id)}),n=(0,ge.A)("EmojiButton",t&&"focus"),a=`./img-apple-64/${e.image}.png`,o=Dp.On.has(a);return(0,se.Y)("div",{className:n,onMouseDown:s,title:`:${e.names[0]}:`,children:m.TL?e.native:(0,se.Y)("img",{src:a,className:o?void 0:"opacity-transition shown",alt:e.native,loading:"lazy","data-path":a,onLoad:o?void 0:Dp.P_,draggable:!1})})}),Tp=.625*g.$,Bp=.25*g.$,Lp=.5*g.$,Rp=.5*g.$,xp=(0,s.ph)(({category:e,index:t,allEmojis:i,observeIntersection:n,shouldRender:a,onEmojiSelect:r})=>{const l=(0,s.li)();(0,hr.mv)(l,n);const c=(0,Mi.A)(a),d=(0,B.A)(),{isMobile:h}=(0,Y.Ay)(),m=h?Math.floor((k.A.get().width-Rp+Tp)/(o.g0Q+Tp)):8,u=Math.ceil(e.emojis.length/m)*(o.g0Q+(h?Lp:Bp));return(0,se.FD)("div",{ref:l,id:`emoji-category-${t}`,className:"symbol-set",children:[(0,se.Y)("div",{className:"symbol-set-header",children:(0,se.Y)("p",{className:"symbol-set-name",dir:"auto",children:d(e.id===o.sR2?"RecentStickers":`Emoji${t}`)})}),(0,se.Y)("div",{className:(0,ge.A)("symbol-set-container",c),style:`height: ${u}px;`,dir:d.isRtl?"rtl":void 0,children:a&&e.emojis.map(e=>{const t=i[e];if(!t)return;const s="id"in t?t:t[1];return(0,se.Y)(Mp,{emoji:s,onClick:r},s.id)})})]},e.id)}),Ep={recent:"recent",people:"smile",nature:"animals",foods:"eats",activity:"sport",places:"car",objects:"lamp",symbols:"language",flags:"flag"},Vp=3.25*g.$,_p=2.625*g.$,Up=[];let Op,Kp,Jp;const Gp=(0,s.ph)((0,n.EK)(e=>(0,di.Up)(e,["recentEmojis"]))(({className:e,recentEmojis:t,onEmojiSelect:n})=>{const a=(0,s.li)(),r=(0,s.li)(),[l,c]=(0,s.J0)(),[d,h]=(0,s.J0)(),[u,p]=(0,s.J0)(0),{isMobile:v}=(0,Y.Ay)(),{handleScroll:g,isAtBeginning:A}=(0,rs.A)(),{observe:f}=(0,hr.BL)({rootRef:a,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const i=Number(t.replace("emoji-category-",""));Up[i]=e.isIntersecting});const t=Up.reduce((e,t,i)=>t&&i<e?i:e,1/0);t!==1/0&&p(t)}),C=(0,cr.A)([],o.vVF),b=d&&C;(0,Ks.A)(r,!(v&&b)),(0,s.vJ)(()=>{if(!l)return;const e=r.current;if(!e)return;const t=u*_p-e.offsetWidth/2+_p/2;(0,ya.A)(e,t)},[l,u]);const y=(0,B.A)(),S=(0,s.Kr)(()=>{if(!l)return hi.p;const e=[...l];return t?.length&&e.unshift({id:o.sR2,name:y("RecentStickers"),emojis:t}),e},[l,y,t]);(0,s.vJ)(()=>{setTimeout(()=>{const e=()=>{c(Jp.categories),h(Jp.emojis)};Jp?e():async function(){return Op||(Op=i.e(996).then(i.t.bind(i,20996,19)),Kp=(await Op).default,Jp=(0,Dp.cp)(Kp)),Op}().then(e)},200)},[]);const N=(0,T.A)(e=>{p(e);const t=a.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,dr.Ay)({container:a.current,element:t,position:"start",margin:Vp,maxDistance:100})}),k=(0,T.A)((e,t)=>{n(e,t)}),w=(0,ge.A)("EmojiPicker",e),I=(0,ge.A)("EmojiPicker-header",!A&&"with-top-border");return(0,se.Y)(oe.Ay,{className:w,activeKey:b?1:0,name:"fade",shouldCleanup:!0,children:b?(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{ref:r,className:I,dir:y.isRtl?"rtl":void 0,children:S.map(function(e,t){const i=Ep[e.id];return i&&(0,se.Y)(X.A,{className:"symbol-set-button "+(t===u?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>N(t),ariaLabel:e.name,iconName:i})})}),(0,se.Y)("div",{ref:a,onScroll:g,className:(0,ge.A)("EmojiPicker-main",m.TF?"no-scrollbar":"custom-scroll"),children:S.map((e,t)=>(0,se.Y)(xp,{category:e,index:t,allEmojis:d,observeIntersection:f,shouldRender:u>=t-1&&u<=t+1,onEmojiSelect:k}))})]}):(0,se.Y)(Ls.A,{})})})),jp=(0,s.ph)(({gif:e,isDisabled:t,className:i,observeIntersection:n,isSavedMessages:a,onClick:o,onUnsaveClick:r,onAddCaption:c})=>{const d=(0,s.li)(),h=(0,B.A)(),u=(0,Fi.A)(),p=(0,hr.Vz)(d,n)&&!t,v=!e.hasVideoPreview&&e.thumbnail&&(0,l.sC)(e,"pictogram"),g=(0,q.A)(v,!p),[A]=(0,s.J0)(e.thumbnail?.dataUri&&!g),f=(0,Yi.A)(e.thumbnail?.dataUri,!A),C=(0,l.Ct)(e)||(0,l.sC)(e,"full"),b=(0,q.A)(C,!p),y=Boolean(p&&b),{isBuffered:S,bufferingHandlers:N}=(0,Ge.A)(!0),k=p&&!S,w=p&&S,{isContextMenuOpen:I,contextMenuAnchor:P,handleBeforeContextMenu:Y,handleContextMenu:F,handleContextMenuClose:D,handleContextMenuHide:M}=(0,cn.A)(d),L=(0,T.A)(()=>d.current),R=(0,T.A)(()=>d.current.closest(".custom-scroll, .no-scrollbar")),x=(0,T.A)(()=>d.current.querySelector(".gif-context-menu .bubble")),E=(0,T.A)(()=>({shouldAvoidNegativePosition:!0})),V=(0,T.A)(()=>{!I&&o&&o({...e,blobUrl:b})}),_=(0,T.A)(t=>{t.stopPropagation(),t.preventDefault(),r(e)}),U=(0,T.A)(()=>{r?.(e)}),O=(0,T.A)(()=>{o({...e,blobUrl:b},!0)}),K=(0,T.A)(()=>{o({...e,blobUrl:b},void 0,!0)}),J=(0,T.A)(()=>{c?.({...e,blobUrl:b})}),G=(0,T.A)(e=>{(0,br.u)(e),Y(e)});(0,s.vJ)(()=>{t&&D()},[D,t]);const j=(0,ge.A)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",o&&"interactive",i);return(0,se.FD)("div",{ref:d,className:j,onMouseDown:G,onClick:V,onContextMenu:F,children:[!m.TF&&r&&(0,se.Y)(X.A,{className:"gif-unsave-button",color:"dark",pill:!0,iconName:"close",iconClassName:"gif-unsave-button-icon",noFastClick:!0,onClick:_}),A&&(0,se.Y)("canvas",{ref:f,className:"thumbnail"}),g&&!w&&(0,se.Y)("img",{src:g,alt:"",className:"preview",draggable:!1}),y&&(0,se.Y)(xi.A,{canPlay:!0,src:b,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none",...N}),k&&(0,se.Y)(Ue.A,{color:g||A?"white":"black"}),o&&void 0!==P&&(0,se.FD)(Ze.A,{isOpen:I,anchor:P,getTriggerElement:L,getRootElement:R,getMenuElement:x,getLayout:E,className:"gif-context-menu",autoClose:!0,onClose:D,onCloseAnimationEnd:M,children:[!a&&(0,se.Y)(ue.A,{onClick:O,icon:"mute",children:h("SendWithoutSound")}),(0,se.Y)(ue.A,{onClick:K,icon:"calendar",children:h(a?"SetReminder":"ScheduleMessage")}),c&&(0,se.Y)(ue.A,{icon:"add-caption",onClick:J,children:u("MenuAddCaption")}),r&&(0,se.Y)(ue.A,{destructive:!0,icon:"delete",onClick:U,children:h("Delete")})]})]})}),zp=(0,s.ph)((0,n.EK)(e=>{const{chatId:t}=(0,c.Xf0)(e)||{},i=Boolean(t)&&(0,c.nZ4)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:i}})(({className:e,loadAndPlay:t,canSendGifs:i,savedGifs:a,isSavedMessages:r,onGifSelect:l,onGifAddCaption:c})=>{const{loadSavedGifs:d,saveGif:h}=(0,n.ko)(),u=(0,s.li)(),{observe:p}=(0,hr.BL)({rootRef:u,debounceMs:300});(0,s.vJ)(()=>{t&&d()},[t,d]);const v=(0,T.A)(e=>{h({gif:e,shouldUnsave:!0})}),g=(0,cr.A)([],o.jhd),A=i&&(!g||!a);return(0,se.Y)(oe.Ay,{ref:u,className:(0,ge.A)("GifPicker",e,m.TF?"no-scrollbar":"custom-scroll"),slideClassName:"GifPickerGrid",activeKey:A?0:1,name:"fade",shouldCleanup:!0,children:i?g&&a&&a.length?a.map(e=>(0,se.Y)(jp,{gif:e,observeIntersection:p,isDisabled:!t,isSavedMessages:r,onClick:i?l:void 0,onUnsaveClick:v,onAddCaption:i?c:void 0},e.id)):g&&a?(0,se.Y)("div",{className:"picker-disabled",children:"No saved GIFs."}):(0,se.Y)(Ls.A,{color:"yellow"}):(0,se.Y)("div",{className:"picker-disabled",children:"Sending GIFs is not allowed in this chat."})})}));let Hp=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 $p={[Hp.Emoji]:"Emoji",[Hp.CustomEmoji]:"StickersList.EmojiItem",[Hp.Stickers]:"AccDescrStickers",[Hp.GIFs]:"GifsTab"},qp={[Hp.Emoji]:"icon-smile",[Hp.CustomEmoji]:"icon-favorite",[Hp.Stickers]:"icon-stickers",[Hp.GIFs]:"icon-gifs"},Wp=(0,s.ph)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:i,onSearchOpen:s,isAttachmentModal:n,canSendPlainText:a,canSearch:o})=>{const r=(0,B.A)();function l(i){return(0,se.Y)(X.A,{className:"symbol-tab-button "+(e===i?"activated":""),onClick:()=>t(i),ariaLabel:r($p[i]),round:!0,faded:!0,color:"translucent",children:(0,se.Y)("i",{className:(0,ge.A)("icon",qp[i])})})}const c=(0,T.A)(()=>{s(e===Hp.Stickers?"stickers":"gifs")});return(0,se.FD)("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0,children:[e!==Hp.Emoji&&e!==Hp.CustomEmoji&&o&&(0,se.Y)(X.A,{className:"symbol-search-button",ariaLabel:e===Hp.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:c,iconName:"search"}),a&&l(Hp.Emoji),a&&l(Hp.CustomEmoji),!n&&l(Hp.Stickers),!n&&l(Hp.GIFs),(e===Hp.Emoji||e===Hp.CustomEmoji)&&(0,se.Y)(X.A,{className:"symbol-delete-button",onClick:i,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent",iconName:"delete-left"})]})});let Qp=!1;const Zp=(0,s.ph)((0,n.EK)(e=>({isLeftColumnShown:(0,c.nTw)(e).isLeftColumnShown,isBackgroundTranslucent:(0,c.cwE)(e),animationLevel:(0,Ys.lS)(e).animationLevel}))(({chatId:e,threadId:t,isOpen:i,canSendStickers:n,canSendGifs:a,isMessageComposer:o,idPrefix:l,isAttachmentModal:c,canSendPlainText:d,className:h,onLoad:u,onClose:p,onEmojiSelect:v,onCustomEmojiSelect:g,onStickerSelect:A,onGifSelect:f,onGifAddCaption:C,onRemoveSymbol:b,onSearchOpen:y,addRecentEmoji:S,addRecentCustomEmoji:N,isLeftColumnShown:k,isBackgroundTranslucent:w,animationLevel:I,...P})=>{const[F,D]=(0,s.J0)(Hp.Emoji),[M,L]=(0,s.J0)([]),[R,x]=(0,s.J0)([]),{isMobile:E}=(0,Y.Ay)(),[V,_]=(0,Fp.A)(i,p,void 0,E),{shouldRender:U,transitionClassNames:O}=(0,je.A)(i,p,!1,!1),K=(0,B.A)();!Qp&&i&&(Qp=!0),(0,s.vJ)(()=>{u()},[u]),(0,s.vJ)(()=>{d||D(Hp.Stickers)},[d]),(0,s.Nf)(()=>{if(E&&i&&!c)return document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open"),()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{(0,r.RK)(()=>{document.body.classList.remove("enable-symbol-menu-transforms")})},350)}},[c,E,i]);const J=(0,s.li)(M);J.current=M,(0,s.vJ)(()=>{J.current.length&&!i&&(J.current.forEach(e=>{S({emoji:e})}),L([]))},[i,S]);const G=(0,T.A)((e,t)=>{L(e=>[...e,t]),v(e)}),j=(0,s.li)(R);j.current=R,(0,s.vJ)(()=>{j.current.length&&!i&&(j.current.forEach(e=>{N({documentId:e})}),x([]))},[i,N]);const z=(0,T.A)(e=>{x(t=>[...t,e.id]),g(e)}),H=(0,T.A)(e=>{p(),y(e)}),$=(0,T.A)((e,t,i,s)=>{A?.(e,t,i,!0,s)}),q=(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()},children:Qp&&(0,se.Y)(oe.Ay,{name:(0,Fs.P)("slide",I),activeKey:F,renderCount:Object.values($p).length,children:function(s,r){switch(F){case Hp.Emoji:return(0,se.Y)(Gp,{className:"picker-tab",onEmojiSelect:G});case Hp.CustomEmoji:return(0,se.Y)(_r,{className:"picker-tab",isHidden:!i||!s,idPrefix:l,loadAndPlay:i&&(s||r),chatId:e,isTranslucent:!E&&w,onCustomEmojiSelect:z});case Hp.Stickers:return(0,se.Y)(Gu,{className:"picker-tab",isHidden:!i||!s,loadAndPlay:!!n&&i&&(s||r),idPrefix:l,canSendStickers:n,noContextMenus:!o,chatId:e,threadId:t,isTranslucent:!E&&w,onStickerSelect:$});case Hp.GIFs:return(0,se.Y)(zp,{className:"picker-tab",loadAndPlay:!!a&&i&&(s||r),canSendGifs:a,onGifSelect:f,onGifAddCaption:C})}}})}),E&&(0,se.Y)(X.A,{round:!0,faded:!0,color:"translucent",ariaLabel:K("Close"),className:"symbol-close-button",size:"tiny",onClick:p,iconName:"close"}),(0,se.Y)(Wp,{activeTab:F,onSwitchTab:D,onRemoveSymbol:b,canSearch:o,onSearchOpen:H,isAttachmentModal:c,canSendPlainText:d})]});if(E){if(!U)return;const e=(0,ge.A)("SymbolMenu mobile-menu",O,k&&"left-column-open",c&&"in-attachment-modal",o&&"in-middle-column");return c?(0,se.Y)("div",{className:e,children:q}):(0,se.Y)(Ur.A,{children:(0,se.Y)("div",{className:e,children:q})})}return(0,se.Y)(Ze.A,{isOpen:i,onClose:p,withPortal:c,className:(0,ge.A)("SymbolMenu",h),onCloseAnimationEnd:p,onMouseEnter:m.TF?void 0:V,onMouseLeave:m.TF?void 0:_,noCloseOnBackdrop:!m.TF,noCompact:!0,...c?P:{positionX:"left",positionY:"bottom"},children:q})})),Xp=(0,s.ph)(({withAvatar:e,focus:t,command:i,description:s,peer:n,clickArg:a,onClick:o})=>{const r=(0,T.A)(()=>{o(a)});return(0,se.FD)(li.A,{className:(0,ge.A)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:r,focus:t,children:[e&&(0,se.Y)(Yt.A,{size:"small",peer:n}),(0,se.FD)("div",{className:"content-inner",children:[(0,se.FD)("span",{className:"title",children:["/",i]}),(0,se.Y)("span",{className:"subtitle",children:(0,Pt.A)(s)})]})]},i)}),ev=(0,s.ph)(({isOpen:e,chatId:t,withUsername:i,botCommands:a,quickReplies:o,quickReplyMessages:r,self:c,getHtml:d,onClick:h,onClose:m})=>{const{sendBotCommand:u,sendQuickReply:p}=(0,n.ko)(),v=(0,s.li)(),{shouldRender:g,transitionClassNames:A}=(0,je.A)(e,void 0,void 0,!1),f=(0,T.A)(({botId:e,command:t})=>{const s=(0,n.mS)().users.byId[e];u({command:`/${t}${i&&s?`@${(0,l.Kl)(s)}`:""}`}),h()}),C=(0,T.A)(e=>{p({chatId:t,quickReplyId:e}),h()}),b=(0,s.Kr)(()=>{if(o?.length&&r)return o.map(e=>{const t=r[e.topMessageId];return{id:e.id,command:e.shortcut,description:t?.content.text?.text||""}})},[o,r]),y=(0,T.A)(e=>!!e.command.startsWith(d().slice(1))&&("id"in e?C(e.id):f(e),!0)),S=fp({isActive:e,items:(0,s.Kr)(()=>{if(a||b)return[].concat(b||[],a||[])},[a,b]),onSelect:y,onClose:m}),N=a&&!a.length||o&&!o.length;if((0,s.vJ)(()=>{N&&m()},[N,m]),(0,s.vJ)(()=>{Ap(".chat-item-clickable",S,v)},[S]),!g||N)return;const k=(0,ge.A)("iaTB59vy","composer-tooltip custom-scroll",A);return(0,se.FD)("div",{className:k,ref:v,children:[b?.map((e,t)=>(0,se.Y)(Xp,{command:e.command,description:e.description,peer:c,withAvatar:!0,clickArg:e.id,onClick:C,focus:S===t},`quickReply_${e.id}`)),a?.map((e,t)=>(0,se.Y)(Xp,{command:e.command,description:e.description,peer:(0,n.mS)().users.byId[e.botId],withAvatar:!0,clickArg:e,onClick:f,focus:S+(b?.length||0)===t},`${e.botId}_${e.command}`))]})}),tv=(0,s.ph)(({isOpen:e,botCommands:t,onClose:i})=>{const{sendBotCommand:s}=(0,n.ko)(),{isMobile:a}=(0,Y.Ay)(),[o,r]=(0,Fp.A)(e,i,void 0,a),l=(0,T.A)(e=>{s({command:`/${e}`}),i()});return(0,se.Y)(Ze.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:i,className:"BotCommandMenu",onCloseAnimationEnd:i,onMouseEnter:m.TF?void 0:o,onMouseLeave:m.TF?void 0:r,noCloseOnBackdrop:!m.TF,noCompact:!0,children:t.map(e=>(0,se.Y)(Xp,{command:e.command,description:e.description,clickArg:e.command,onClick:l},e.command))})}),iv=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{stickers:i}=e.stickers.forEmoji;return{stickers:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}})(({chatId:e,threadId:t,isOpen:i,onStickerSelect:n,onClose:a,stickers:r,isSavedMessages:l,isCurrentUserPremium:c})=>{const d=(0,s.li)(),{shouldRender:h,transitionClassNames:m}=(0,je.A)(i,void 0,void 0,!1),p=(0,K.A)(r,!0),v=r||p,g=(0,Ku.A)(e,t),{observe:A}=(0,hr.BL)({rootRef:d,throttleMs:200});(0,s.vJ)(()=>i?(0,u.A)(a):void 0,[i,a]);const f=(0,ge.A)("StickerTooltip composer-tooltip custom-scroll",m,!v?.length&&"hidden");return(0,se.Y)("div",{ref:d,className:f,onMouseMove:()=>{g({type:"chooseSticker"})},children:h&&v?v.map(e=>(0,se.Y)(Nr,{sticker:e,size:o.bkT,observeIntersection:A,onClick:i?n:void 0,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c},e.id)):h?(0,se.Y)(Ls.A,{}):void 0})})),sv={root:"_8sFuAomM",emojiButton:"crWzZ2jr"},nv=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{stickers:i}=e.customEmojis.forEmoji;return{customEmoji:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}})(({isOpen:e,addRecentCustomEmoji:t,onCustomEmojiSelect:i,onClose:a,customEmoji:r,isSavedMessages:l,isCurrentUserPremium:c,noPlay:d})=>{const{clearCustomEmojiForEmoji:h}=(0,n.ko)(),m=(0,s.li)(),{shouldRender:p,transitionClassNames:v}=(0,je.A)(e,void 0,void 0,!1),g=(0,K.A)(r,!0),A=r||g;(0,Ks.A)(m);const{observe:f}=(0,hr.BL)({rootRef:m,throttleMs:200,isDisabled:!e});(0,s.vJ)(()=>e?(0,u.A)(a):void 0,[e,a]);const C=(0,T.A)(s=>{e&&(i(s),t({documentId:s.id}),h())}),b=(0,ge.A)(sv.root,"composer-tooltip no-scrollbar",v,!A?.length&&sv.hidden);return(0,se.Y)("div",{ref:m,className:b,children:p&&A?A.map(e=>(0,se.Y)(Nr,{sticker:e,className:sv.emojiButton,size:o.x6_,observeIntersection:f,onClick:C,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c,noPlay:d},e.id)):p?(0,se.Y)(Ls.A,{}):void 0})}));var av=i(76283);const ov=(0,s.ph)(({isOpen:e,isOpenToBottom:t=!1,isSavedMessages:i,canSchedule:a,canScheduleUntilOnline:o,onSendSilent:r,onSendSchedule:l,onSendWhenOnline:c,onRemoveEffect:d,onClose:h,onCloseAnimationEnd:u,chatId:p,withEffects:v,hasCurrentEffect:g,effectReactions:A,allAvailableReactions:f,onToggleReaction:C,canBuyPremium:b,isCurrentUserPremium:y,isInSavedMessages:S,isInStoryViewer:N,canPlayAnimatedEmojis:k})=>{const{openEffectPicker:w}=(0,n.ko)(),[I,P]=(0,Fp.A)(e,h),[Y,M]=(0,s.J0)(!1),L=(0,B.A)(),R=(0,Fi.A)(),[x,E,V]=(0,D.A)();(0,F.A)(([t])=>{e&&!t&&(V(),M(Boolean(o)))},[e,o]);const[_,U,O]=(0,D.A)(),K=(0,T.A)(e=>{E(),p&&w({chatId:p,position:e})});return(0,s.vJ)(()=>{e?setTimeout(()=>{U()},200):O()},[e,U,O]),(0,se.FD)(Ze.A,{isOpen:e,autoClose:!0,positionX:"right",positionY:t?"top":"bottom",className:(0,ge.A)("CustomSendMenu","fluid","with-menu-transitions",v&&"with-effects"),onClose:h,onCloseAnimationEnd:u,onMouseEnter:m.TF?void 0:I,onMouseLeave:m.TF?void 0:P,noCloseOnBackdrop:!m.TF,children:[v&&!N&&(0,se.Y)(av.A,{allAvailableReactions:f,effectReactions:A,currentReactions:void 0,onToggleReaction:C,isPrivate:!0,isReady:_,canBuyPremium:b,isCurrentUserPremium:y,isInSavedMessages:S,isForEffects:!0,canPlayAnimatedEmojis:k,onShowMore:K,onClose:h,className:(0,ge.A)(x&&"ReactionSelector-hidden")}),(0,se.FD)("div",{className:(0,ge.A)("CustomSendMenu_items",x&&"CustomSendMenu_items-hidden"),dir:R.isRtl?"rtl":void 0,children:[r&&(0,se.Y)(ue.A,{icon:"mute",onClick:r,children:L("SendWithoutSound")}),a&&l&&(0,se.Y)(ue.A,{icon:"schedule",onClick:l,children:L(i?"SetReminder":"ScheduleMessage")}),a&&l&&Y&&(0,se.Y)(ue.A,{icon:"user-online",onClick:c,children:L("SendWhenOnline")}),v&&g&&(0,se.Y)(ue.A,{icon:"delete",onClick:d,children:R("RemoveEffect")})]})]})});var rv=i(41510),lv=i(22802);const cv={B:"bold",STRONG:"bold",I:"italic",EM:"italic",U:"underline",DEL:"strikethrough",CODE:"monospace",SPAN:"spoiler"},dv=document.createElement("div"),hv=(0,s.ph)(({isOpen:e,anchorPosition:t,selectedRange:i,setSelectedRange:n,onClose:a})=>{const r=(0,s.li)(),l=(0,s.li)(),{shouldRender:c,transitionClassNames:d}=(0,je.A)(e),[m,p,v]=(0,D.A)(),[g,A]=(0,s.J0)(""),[f,C]=(0,s.J0)(!1),[b,S]=(0,s.J0)(),[N,k]=(0,s.J0)({}),w=(0,Fi.A)();(0,s.vJ)(()=>e?(0,u.A)(a):void 0,[e,a]),(0,lv.A)(e,r,a,!0),(0,s.vJ)(()=>{m?l.current.focus():(A(""),C(!1))},[m]),(0,s.vJ)(()=>{c||(v(),k({}),S(void 0))},[v,c]),(0,s.vJ)(()=>{if(!e||!i)return;const t={};let{parentElement:s}=i.commonAncestorContainer;for(;s&&s.id!==o.CfG;){const e=cv[s.tagName];e&&(t[e]=!0),s=s.parentElement}k(t)},[e,i,p]);const I=(0,T.A)(()=>{if(!i)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(i))}),P=(0,T.A)(()=>{const e=window.getSelection();e&&n(e.getRangeAt(0))}),Y=(0,T.A)(e=>{if(i)return dv.replaceChildren(i.cloneContents()),e&&dv.querySelectorAll(Ou._p).forEach(e=>{e.replaceWith(e.getAttribute("alt"))}),dv.innerHTML}),F=(0,T.A)(()=>{if(i)return i.commonAncestorContainer.parentElement});function M(){const e=l.current;if(!e)return;const{offsetWidth:t,scrollWidth:i,scrollLeft:s}=e;if(i<=t)return void S(void 0);let n="";s<i-t&&(n="mask-right"),s>0&&(n+=" mask-left"),S(n)}function B(e){if(N[e])return"active";if("monospace"===e||"strikethrough"===e){if(Object.keys(N).some(t=>t!==e&&Boolean(N[t])))return"disabled"}else if(N.monospace||N.strikethrough)return"disabled"}const L=(0,T.A)(()=>{if(N.spoiler){const e=F();if(!i||!e||e.dataset.entityType!==G.C7.Spoiler||!e.textContent)return;return e.replaceWith(e.textContent),void k(e=>({...e,spoiler:!1}))}const e=Y();document.execCommand("insertHTML",!1,`<span class="spoiler" data-entity-type="${G.C7.Spoiler}">${e}</span>`),a()}),R=(0,T.A)(()=>{k(e=>(document.execCommand(e.bold?"removeFormat":"bold"),Object.keys(e).forEach(t=>{"italic"!==t&&"underline"!==t||!Boolean(e[t])||document.execCommand(t)}),P(),{...e,bold:!e.bold}))}),x=(0,T.A)(()=>{document.execCommand("italic"),P(),k(e=>({...e,italic:!e.italic}))}),E=(0,T.A)(()=>{document.execCommand("underline"),P(),k(e=>({...e,underline:!e.underline}))}),V=(0,T.A)(()=>{if(N.strikethrough){const e=F();if(!i||!e||"DEL"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void k(e=>({...e,strikethrough:!1}))}const e=Y();document.execCommand("insertHTML",!1,`<del>${e}</del>`),a()}),_=(0,T.A)(()=>{if(N.monospace){const e=F();if(!i||!e||"CODE"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void k(e=>({...e,monospace:!1}))}const e=Y(!0);document.execCommand("insertHTML",!1,`<code class="text-entity-code" dir="auto">${e}</code>`),a()}),U=(0,T.A)(()=>{const e=((0,Qs.Tc)(g)||"").split("%").map(encodeURI).join("%");if(f){const t=F();if(!t||"A"!==t.tagName)return;return t.href=e,void a()}const t=Y(!0);I(),document.execCommand("insertHTML",!1,`<a href="${e}" class="text-entity-link" dir="auto">${t}</a>`),a()}),O=(0,T.A)(e=>{const t={k:p,b:R,u:E,i:x,m:_,s:V,p:L}[function(e){const t=e.key||e.code;return t.startsWith("Key")?t.slice(3).toLowerCase():t}(e)];!e.altKey&&(e.ctrlKey||e.metaKey)&&t&&(e.preventDefault(),e.stopPropagation(),t())});if((0,s.vJ)(()=>(e&&document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)),[e,O]),!c)return;const K=(0,ge.A)("TextFormatter",d,m&&"link-control-shown"),J=(0,ge.A)("TextFormatter-link-url-confirm",Boolean(g.length)&&"shown"),j=t?`left: ${t.x}px; top: ${t.y}px;--text-formatter-left: ${t.x}px;`:"";return(0,se.FD)("div",{ref:r,className:K,style:j,onKeyDown:function(e){if("Enter"===e.key&&m){if(!g.trim())return;U(),e.preventDefault()}},onMouseDown:y.A,children:[(0,se.FD)("div",{className:"TextFormatter-buttons",children:[(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingSpoilerAria"),className:B("spoiler"),onClick:L,iconName:"eye-crossed"}),(0,se.Y)("div",{className:"TextFormatter-divider"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingBoldAria"),className:B("bold"),onClick:R,iconName:"bold"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingItalicAria"),className:B("italic"),onClick:x,iconName:"italic"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingUnderlineAria"),className:B("underline"),onClick:E,iconName:"underlined"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingStrikethroughAria"),className:B("strikethrough"),onClick:V,iconName:"strikethrough"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingMonospaceAria"),className:B("monospace"),onClick:_,iconName:"monospace"}),(0,se.Y)("div",{className:"TextFormatter-divider"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("FormattingAddLinkAria"),onClick:p,iconName:"link"})]}),(0,se.Y)("div",{className:"TextFormatter-link-control",children:(0,se.FD)("div",{className:"TextFormatter-buttons",children:[(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("Cancel"),onClick:v,iconName:"arrow-left"}),(0,se.Y)("div",{className:"TextFormatter-divider"}),(0,se.Y)("div",{className:(0,ge.A)("TextFormatter-link-url-input-wrapper",b),children:(0,se.Y)("input",{ref:l,className:"TextFormatter-link-url-input",type:"text",value:g,placeholder:w("FormattingEnterUrl"),autoComplete:"off",spellCheck:!h.Vq&&void 0,inputMode:"url",dir:"auto",onChange:function(e){A(e.target.value),M()},onScroll:M})}),(0,se.FD)("div",{className:J,children:[(0,se.Y)("div",{className:"TextFormatter-divider"}),(0,se.Y)(X.A,{color:"translucent",ariaLabel:w("Save"),className:"color-primary",onClick:U,iconName:"check"})]})]})})]})}),mv=(0,s.ph)(({emoji:e,focus:t,onClick:i,observeIntersection:s})=>{const n=(0,T.A)(t=>{t.preventDefault(),i?.(e)}),a=(0,ge.A)("EmojiButton",t&&"focus");return(0,se.Y)("div",{className:a,onMouseDown:n,title:e.emoji,children:(0,se.Y)(sn.A,{documentId:e.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:s})})}),uv=(0,s.ph)(({isOpen:e,emojis:t,customEmojis:i,onClose:n,onEmojiSelect:a,onCustomEmojiSelect:o,addRecentEmoji:r,addRecentCustomEmoji:l})=>{const c=(0,s.li)(),{shouldRender:d,transitionClassNames:h}=(0,je.A)(e,void 0,void 0,!1),m=(0,Ui.A)(t.length?[...t,...i]:void 0,350)||[];(0,Ks.A)(c);const{observe:u}=(0,hr.BL)({rootRef:c,throttleMs:200,isDisabled:!e}),p=(0,T.A)(e=>{a(e.native),r({emoji:e.id})}),v=(0,T.A)(e=>{o(e),l({documentId:e.id})}),g=(0,T.A)(e=>{"native"in e?p(e):v(e)}),A=(0,T.A)((e,t)=>{a(e),r({emoji:t})}),f=(0,T.A)(e=>{o(e),l({documentId:e.id})}),C=fp({isActive:e,isHorizontal:!0,items:m,shouldRemoveSelectionOnReset:!0,onSelect:g,onClose:n});(0,F.A)(([e])=>{void 0!==e&&-1!==e&&function(e,t){const i=t.current;if(!i)return;const{visibleIndexes:s,allElements:n}=gp(i,".EmojiButton",8,!0,!0,!0);if(!n.length||!n[e])return;const a=s[0];if(!s.includes(e)||e===a&&!vp(i,n[a],!0)){const t="start"==(e>s[s.length-1]?"start":"end")?44*e:0;(0,ya.A)(i,t)}}(C,c)},[C]);const b=(0,ge.A)("EmojiTooltip composer-tooltip no-scrollbar",h);return(0,se.Y)("div",{ref:c,className:b,children:d&&m?m.map((e,t)=>"native"in e?(0,se.Y)(Mp,{emoji:e,focus:C===t,onClick:A},e.id):(0,se.Y)(mv,{emoji:e,focus:C===t,onClick:f,observeIntersection:u},e.id)):d?(0,se.Y)(Ls.A,{}):void 0})}),pv=(0,s.ph)(({title:e,description:t,thumbnail:i,thumbUrl:s,focus:n,transitionClassNames:a="",onClick:o})=>{let r;const c=(0,q.A)(i?(0,l.cy)(i):void 0);return(s=s||c)?r=(0,se.Y)("img",{src:s,className:a,alt:"",decoding:"async",draggable:!1}):e&&(r=(0,Fn.Qh)(e,1)),(0,se.FD)(li.A,{focus:n,className:(0,ge.A)("BaseResult chat-item-clickable","string"==typeof r&&"with-text"),onMouseDown:br.u,onClick:o,children:[(0,se.Y)("span",{className:"thumb",children:"string"==typeof r?(0,Pt.A)(r):r}),(0,se.FD)("div",{className:"content-inner",children:[e&&(0,se.Y)("div",{className:"title",children:e}),t&&(0,se.Y)("div",{className:"description",children:t})]})]})}),vv=(0,s.ph)(({focus:e,inlineResult:t,onClick:i})=>{const{title:s,description:n}=t,a="url"in t?t.url:void 0,o="webThumbnail"in t?t.webThumbnail:void 0,r=(0,T.A)(()=>{i(t)});return(0,se.Y)(pv,{focus:e,thumbnail:o,title:s||a,description:n,onClick:r})}),gv=(0,s.ph)(({inlineResult:e,isSavedMessages:t,canSendGifs:i,observeIntersection:s,onClick:n})=>{const{gif:a}=e,o=(0,T.A)((t,i,s)=>{n(e,i,s)});if(a)return(0,se.Y)(jp,{gif:a,observeIntersection:s,className:"chat-item-clickable",onClick:i?o:void 0,isSavedMessages:t})}),Av=(0,s.ph)(({focus:e,isForGallery:t,inlineResult:i,onClick:s})=>{let n,a,o;"photo"in i&&(n=i.photo),"thumbnail"in i&&(a=i.thumbnail),"webThumbnail"in i&&(o=i.webThumbnail);const r=(0,q.A)((0,l.cy)(o)),c=(0,q.A)(n&&(0,l.rI)(n,"pictogram")),d=(0,Mi.A)(c||r),h=(0,T.A)(()=>{s(i)});if(t)return(0,se.FD)("div",{className:"MediaResult chat-item-clickable",onClick:h,children:[(0,se.Y)("img",{src:n?.thumbnail?.dataUri||r,alt:"",draggable:!1}),(0,se.Y)("img",{src:c,className:(0,ge.A)("full-media",d),alt:"",draggable:!1})]});const{title:m,description:u}=i;return(0,se.Y)(pv,{focus:e,thumbnail:o,thumbUrl:c||a?.dataUri,transitionClassNames:d,title:m,description:u,onClick:h})}),fv=(0,s.ph)(({inlineResult:e,isSavedMessages:t,observeIntersection:i,onClick:s,isCurrentUserPremium:n})=>{const{sticker:a}=e;if(a)return(0,se.Y)(Nr,{sticker:a,size:o.mD0,observeIntersection:i,title:a.emoji,className:"chat-item-clickable",onClick:s,clickArg:e,isSavedMessages:t,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:n})}),Cv=(0,Ce.nF)(e=>e(),500,!0),bv=(0,s.ph)(({isOpen:e,botId:t,isGallery:i,inlineBotResults:o,switchPm:r,switchWebview:l,isSavedMessages:c,canSendGifs:d,loadMore:h,onClose:u,onSelectResult:p,isCurrentUserPremium:v})=>{const{openChat:g,startBot:A,requestSimpleWebView:f}=(0,n.ko)(),C=(0,s.li)(),{shouldRender:b,transitionClassNames:y}=(0,je.A)(e,void 0,void 0,!1),S=(0,Si.A)(i,b),{observe:N}=(0,hr.BL)({rootRef:C,debounceMs:200,isDisabled:!e}),k=(0,T.A)(({direction:e})=>{e===a.TN.Backwards&&Cv(h)}),w=fp({isActive:e,shouldRemoveSelectionOnReset:S,noArrowNavigation:S,items:o,onSelect:p,onClose:u});(0,s.vJ)(()=>{Ap(".chat-item-clickable",w,C)},[w]);const I=(0,T.A)(()=>{g({id:t}),A({botId:t,param:r.startParam})}),P=(0,T.A)(()=>{const e=(0,Dn.A)();f({botId:t,url:l.url,buttonText:l.text,theme:e,isFromSwitchWebView:!0})}),Y=(0,K.A)(o?.length?o:void 0,b),F=o?.length?o:Y;if(!b||!(F?.length||r||l))return;const D=(0,ge.A)("InlineBotTooltip composer-tooltip",m.TF?"no-scrollbar":"custom-scroll",S&&"gallery",y);return(0,se.FD)(ls.A,{ref:C,className:D,items:F,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:k,sensitiveArea:160,children:[r&&(0,se.Y)(li.A,{ripple:!0,className:"switch-pm scroll-item",onClick:I,children:(0,se.Y)("span",{className:"title",children:r.text})}),l&&(0,se.Y)(li.A,{ripple:!0,className:"switch-pm scroll-item",onClick:P,children:(0,se.Y)("span",{className:"title",children:l.text})}),Boolean(F?.length)&&F.map((e,t)=>{switch(e.type){case"gif":return(0,se.Y)(gv,{inlineResult:e,observeIntersection:N,onClick:p,isSavedMessages:c,canSendGifs:d},e.id);case"photo":return(0,se.Y)(Av,{isForGallery:S,inlineResult:e,onClick:p},e.id);case"sticker":return(0,se.Y)(fv,{inlineResult:e,observeIntersection:N,onClick:p,isSavedMessages:c,isCurrentUserPremium:v},e.id);case"video":case"file":case"game":return(0,se.Y)(Av,{focus:w===t,inlineResult:e,onClick:p},e.id);case"article":case"audio":case"voice":return(0,se.Y)(vv,{focus:w===t,inlineResult:e,onClick:p},e.id);default:return}})]})}),yv=(0,s.ph)(({isOpen:e,chatId:t,selectedSendAsId:i,sendAsPeerIds:a,isCurrentUserPremium:o,onClose:r})=>{const{saveDefaultSendAs:l,showNotification:c}=(0,n.ko)(),d=(0,n.mS)().users.byId,h=(0,n.mS)().chats.byId,u=(0,B.A)(),p=(0,s.li)(),[v,g,A]=(0,Fp.A)(e,r,void 0);(0,s.vJ)(()=>{e&&A()},[e,A]);const f=(0,T.A)(e=>{r(),l({chatId:t,sendAsId:e})}),C=fp({isActive:e,items:a,onSelect:f,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:r});return(0,s.vJ)(()=>{Ap(".chat-item-clickable",C,p)},[C]),(0,s.vJ)(()=>{a&&!a.length&&r()},[a,r]),(0,se.FD)(Ze.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SendAsMenu",onCloseAnimationEnd:r,onMouseEnter:m.TF?void 0:v,onMouseLeave:m.TF?void 0:g,noCloseOnBackdrop:!m.TF,noCompact:!0,children:[(0,se.Y)("div",{className:"send-as-title",dir:"auto",children:u("SendMessageAsTitle")}),d&&h&&a?.map(({id:e,isPremium:t},s)=>{const n=d[e],a=h[e],r=n||a,l=(0,ge.A)(i===e&&"selected");return(0,se.FD)(li.A,{className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!t||o?f(e):c({message:u("SelectSendAsPeerPremiumHint"),actionText:u("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:C===s,rightElement:!o&&t&&(0,se.Y)(he.A,{name:"lock-badge",className:"send-as-icon-locked"}),children:[(0,se.Y)(Yt.A,{size:"small",peer:r,className:l}),(0,se.FD)("div",{className:"info",children:[r&&(0,se.Y)(Rs.A,{peer:r,noFake:!0}),(0,se.Y)("span",{className:"subtitle",children:n?u("VoipGroupPersonalAccount"):u("Subscribers",a?.membersCount,"i")})]})]},e)})]})}),Sv=(0,s.ph)((0,n.EK)((e,{stickerSetId:t})=>({set:(0,c.ycM)(e,t),shouldPlay:(0,c.ML4)(e),isCurrentUserPremium:(0,c.g29)(e)}))(({stickerSetId:e,observeIntersection:t,set:i,shouldPlay:a,isModalOpen:r,isCurrentUserPremium:l})=>{const{loadStickers:c,toggleStickerSet:d,openStickerSet:h}=(0,n.ko)(),m=(0,s.li)(),u=(0,B.A)(),p=i&&!i.isArchived&&Boolean(i.installedDate),v=Boolean(i?.stickers),g=(0,s.Kr)(()=>{if(!i)return[];const e=(i.stickers?.filter(({hasEffect:e})=>e)??[]).slice(0,3),t=(i.covers||[]).map(({id:e})=>e),s=i.stickers?i.stickers.filter(({id:e})=>!t.includes(e)):[];return[...e,...i.covers||[],...s].slice(0,5)},[i]);(0,s.vJ)(()=>{!v&&g.length<5&&i&&c({stickerSetInfo:{shortName:i.shortName}})},[v,g.length,c,i,e]);const A=(0,s.hb)(()=>{d({stickerSetId:e})},[d,e]),f=(0,s.hb)(e=>{h({stickerSetInfo:e.stickerSetInfo})},[h]);if(!i)return;const C=g.length>0;return(0,se.FD)("div",{className:"sticker-set",dir:u.isRtl?"rtl":void 0,children:[(0,se.FD)("div",{className:"sticker-set-header",children:[(0,se.FD)("div",{className:"title-wrapper",children:[(0,se.Y)("h3",{className:"title",dir:"auto",children:i.title}),(0,se.Y)("p",{className:"count",dir:"auto",children:u("Stickers",i.count,"i")})]}),(0,se.Y)(X.A,{className:p?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:A,children:u(p?"Stickers.Installed":"Stickers.Install")})]}),(0,se.FD)("div",{className:"sticker-set-main shared-canvas-container",children:[(0,se.Y)("canvas",{ref:m,className:"shared-canvas"}),!C&&(0,se.Y)(Ue.A,{}),C&&g.map(e=>(0,se.Y)(Nr,{sticker:e,size:o.Rqe,observeIntersection:t,noPlay:!a||r,clickArg:e,onClick:f,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:m}))]})]},i.id)})),Nv=(0,Ce.nF)(e=>e(),6e4,!0),kv=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.BmE)(e),{query:i,resultIds:s}=t||{},{featured:n}=e.stickers;return{query:i,featuredIds:n.setIds,resultIds:s,isModalOpen:Boolean((0,c.nTw)(e).openedStickerSetShortName)}})(({isActive:e,query:t,featuredIds:i,resultIds:a,isModalOpen:o,onClose:r})=>{const{loadFeaturedStickers:l}=(0,n.ko)(),c=(0,s.li)(),d=(0,B.A)(),{observe:h}=(0,hr.BL)({rootRef:c,throttleMs:200});return(0,s.vJ)(()=>{Nv(()=>{l()})}),(0,Ne.A)({isActive:e,onBack:r}),(0,se.Y)("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0,children:function(){if(void 0!==t)return!t&&i?i.map(e=>(0,se.Y)(Sv,{stickerSetId:e,observeIntersection:h,isModalOpen:o},e)):a?a.length?a.map(e=>(0,se.Y)(Sv,{stickerSetId:e,observeIntersection:h,isModalOpen:o},e)):(0,se.Y)("p",{className:"helper-text",dir:"auto",children:"Nothing found."}):(0,se.Y)(Ls.A,{})}()})})),wv=(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=n?(0,c.ALW)(e,n):void 0,h=Boolean(n)&&(0,c.nZ4)(e,n),m=n&&a?(0,Kl.Vw)(e,n,a):void 0,u=Boolean(!m?.isCommentsInfo&&m?.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,u,r),canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),currentMessageList:(0,c.Xf0)(e)}})(({isActive:e,query:t,results:i,chat:a,chatFullInfo:o,isChatWithBot:r,canScheduleUntilOnline:c,isSavedMessages:d,canPostInChat:h,currentMessageList:u,onClose:p})=>{const{searchMoreGifs:v,sendMessage:g,setGifSearchQuery:A}=(0,n.ko)(),f=(0,s.li)(),[C,b]=(0,yu.A)(c),{observe:y}=(0,hr.BL)({rootRef:f,debounceMs:300}),S=h&&(0,l.Q_)(a,o,r,d).canSendGifs,N=(0,s.hb)((e,t,i)=>{if(S){if(!u)return;i?C((i,s)=>{g({messageList:u,gif:e,scheduledAt:i,scheduleRepeatPeriod:s,isSilent:t})}):g({messageList:u,gif:e,isSilent:t})}m.TF&&A({query:void 0})},[S,u,C]),k=(0,s.hb)(()=>{v()},[v]),w=(0,B.A)();(0,Ne.A)({isActive:e,onBack:p});const I=Boolean(void 0!==t&&i&&i.length);return(0,se.FD)("div",{className:"GifSearch",dir:w.isRtl?"rtl":void 0,children:[(0,se.Y)(ls.A,{ref:f,className:(0,ge.A)("gif-container custom-scroll",I&&"grid"),items:i,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:k,children:function(){if(void 0!==t)return i?i.length?i.map(e=>(0,se.Y)(jp,{gif:e,observeIntersection:y,onClick:S?N:void 0,isSavedMessages:d},e.id)):(0,se.Y)("p",{className:"helper-text",dir:"auto",children:w("NoGIFsFound")}):(0,se.Y)(Ls.A,{})}()}),b]})}));var Iv=i(75319),Pv=i(71950);const Yv="OAKzmAva",Fv="BQ6HUOqN",Dv="U96CW2I7",Mv="vXi2JQlj",Tv="bi3fL59p",Bv="GUK4ajPK",Lv="YH6jeZIh",Rv="q1LnuIUn",xv="PJZzyVLK",Ev="C7NpG5Y9",Vv=(0,s.ph)(function({postStatistic:e}){const t=(0,B.A)(),i=(0,Fi.A)();return(0,se.FD)("div",{className:Lv,children:[e.reactionsCount>0&&(0,se.FD)("span",{className:Rv,children:[(0,se.Y)(he.A,{name:"heart-outline",className:xv}),(0,Fn.Vw)(i,e.reactionsCount)]}),e.forwardsCount>0&&(0,se.FD)("span",{className:Rv,children:[(0,se.Y)(he.A,{name:"forward",className:xv}),(0,Fn.Vw)(i,e.forwardsCount)]}),!e.forwardsCount&&!e.reactionsCount&&t("ChannelStats.SharesCount_ZeroValueHolder")]})});function _v(e,t,i,s){return i?(0,se.FD)("span",{children:[(0,se.Y)("img",{src:i,alt:"",draggable:!1,className:(0,ge.A)(Dv,s&&"yxjDeIct")}),(0,l.zX)(t)&&(0,se.Y)(he.A,{name:"play"}),(0,A.C)(e,t,!0)]}):(0,A.C)(e,t)}const Uv=(0,s.ph)(({postStatistic:e,message:t})=>{const i=(0,Fi.A)(),{toggleMessageStatistics:a}=(0,n.ko)(),o=(0,Hc.A)(t),r=(0,zc.A)(t,"micro"),c=(0,q.A)(r),d=Boolean((0,l.lk)(t)),h=(0,s.hb)(()=>{a({messageId:t.id})},[a,t.id]);return(0,se.FD)("div",{className:(0,ge.A)(Yv,Boolean(c||o)&&Fv),onClick:h,children:[(0,se.FD)("div",{className:Tv,children:[(0,se.Y)("div",{className:Mv,children:_v(i,t,c||o,d)}),(0,se.Y)("div",{className:Lv,children:i("ChannelStatsViewsCount",{count:e.viewsCount},{pluralValue:e.viewsCount})})]}),(0,se.FD)("div",{className:Bv,children:[(0,se.Y)("div",{className:Ev,children:(0,We.L2)(1e3*t.date,i.code)}),(0,se.Y)(Vv,{postStatistic:e})]})]})});function Ov(e,t,i){return(0,se.FD)("span",{children:[i?(0,se.Y)("span",{className:"TmJvv2A6",children:(0,se.Y)("img",{src:i,alt:"",draggable:!1,className:(0,ge.A)(Dv,"cdfiLmXo","BOfHPv20")})}):(0,se.Y)(Yt.A,{peer:t,size:"small",className:Dv,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story")]})}const Kv=(0,s.ph)(function({chat:e,story:t,postStatistic:i}){const s=(0,B.A)(),{toggleStoryStatistics:a}=(0,n.ko)(),o=t&&"content"in t,r=o?t.content.video:void 0,c=o?(0,l.EN)(t):void 0,d=(0,q.A)(c),h=d||r?.thumbnail?.dataUri,m=(0,T.A)(()=>{a({storyId:i.storyId})});return(0,se.FD)("div",{className:(0,ge.A)(Yv,Fv),onClick:m,children:[(0,se.FD)("div",{className:Tv,children:[(0,se.Y)("div",{className:Mv,children:Ov(s,e,d||h)}),(0,se.Y)("div",{className:Lv,children:s("ChannelStats.ViewsCount",i.viewsCount,"i")})]}),(0,se.FD)("div",{className:Bv,children:[(0,se.Y)("div",{className:Ev,children:o&&Boolean(t.date)&&(0,We.L2)(1e3*t.date,s.code)}),(0,se.Y)(Vv,{postStatistic:i})]})]})}),Jv="T1l_4J8z",Gv="S1x1ovkC",jv="WxL3i5PM",zv="aUrozL5_",Hv="QQHwjG88",$v="QGctP1Nk";let qv,Wv;const Qv={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"},Zv=Object.keys(Qv),Xv={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},eg=Object.keys(Xv),tg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.gqw)(e,t),s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t)?.statisticsDcId,a="chatTypeSuperGroup"===s?.type,o=(0,c.zeq)(e,t),r=(0,c._bp)(e,t)?.byId;return{statistics:i,dcId:n,isGroup:a,chat:s,messagesById:o,storiesById:r}})(({chatId:e,chat:t,statistics:a,dcId:o,isGroup:r,messagesById:l,storiesById:c})=>{const d=(0,B.A)(),h=(0,s.li)(),[m,u]=(0,s.J0)(!1),p=(0,s.li)(new Set),v=(0,s.li)(new Set),{loadStatistics:g,loadStatisticsAsyncGraph:A}=(0,n.ko)(),f=(0,M.A)();(0,s.vJ)(()=>{g({chatId:e,isGroup:r})},[e,g,r]);const C=(0,s.Kr)(()=>r?eg:Zv,[r]),b=(0,s.Kr)(()=>r?Xv:Qv,[r]);return(0,s.vJ)(()=>{a&&C.forEach(t=>{const i=a[t];(0,Iv.R)(i)&&"async"===i.graphType&&A({name:t,chatId:e,token:i.token,isPercentage:"languagesGraph"===t})})},[C,e,a,A]),(0,s.vJ)(()=>{(async()=>{await async function(){return qv||(qv=i.e(4810).then(i.bind(i,24810)),Wv=await qv),qv}(),m?a&&h.current&&(C.forEach((e,t)=>{const i=a[e];if(!(0,Iv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||p.current.has(e))return;if(n)return p.current.add(e),void v.current.add(e);const{zoomToken:r}=i;Wv.create(h.current.children[t],{title:d(b[e]),...r?{onZoom:e=>(0,En.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:o}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e),h.current.children[t].classList.remove($v)}),f()):u(!0)})()},[C,b,m,a,d,e,A,o,f]),(0,se.FD)("div",{className:(0,ge.A)(Jv,"panel-content custom-scroll",m&&zv),children:[a&&(0,se.Y)(Pv.A,{statistics:a,type:r?"group":"channel",title:d("StatisticOverview")}),!p.current.size&&(0,se.Y)(Ls.A,{}),(0,se.Y)("div",{ref:h,children:C.map(e=>{const t=p.current.has(e)&&!v.current.has(e);return(0,se.Y)("div",{className:(0,ge.A)(Hv,!t&&$v)})})}),Boolean(a?.recentPosts?.length)&&(0,se.FD)("div",{className:"suY9dEIz",children:[(0,se.Y)("h2",{className:"evQIkAqx",children:d("ChannelStats.Recent.Header")}),a.recentPosts.map(e=>{if("msgId"in e){const t=l[e.msgId];if(!t||!("content"in t))return;return(0,se.Y)(Uv,{message:t,postStatistic:e},`statistic_message_${e.msgId}`)}if("storyId"in e&&t){const i=c?.[e.storyId];return(0,se.Y)(Kv,{chat:t,story:i,postStatistic:e},`statistic_story_${e.storyId}`)}})]})]})})),ig="oXLpD4Y4",sg="paQ2VBe_",ng="WvFuOAIf",ag=(0,s.ph)(({data:e})=>{const t=(0,B.A)(),{openChatByUsername:i}=(0,n.ko)(),a=(0,s.Kr)(()=>e.chat?(0,l.Kl)(e.chat):void 0,[e.chat]),o=(0,s.hb)(()=>{i({username:a,messageId:e.messageId})},[e.messageId,i,a]);return(0,se.FD)("div",{className:(0,ge.A)(ig,"statistic-public-forward"),onClick:o,children:[(0,se.Y)(Yt.A,{size:"medium",peer:e.chat}),(0,se.FD)("div",{children:[(0,se.Y)("div",{className:sg,children:e.title}),(0,se.Y)("div",{className:ng,children:t("ChannelStats.ViewsCount",e.views,"i")})]})]})});let og,rg;const lg={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},cg=Object.keys(lg),dg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e);return{statistics:s.statistics.currentMessage,dcId:i,messageId:s.statistics.currentMessageId}})(function({chatId:e,isActive:t,statistics:o,dcId:r,messageId:l}){const c=(0,B.A)(),d=(0,s.li)(),[h,m]=(0,s.J0)(!1),u=(0,s.li)(new Set),p=(0,s.li)(new Set),{loadMessageStatistics:v,loadMessagePublicForwards:g,loadStatisticsAsyncGraph:A}=(0,n.ko)(),f=(0,M.A)();(0,s.vJ)(()=>{l&&v({chatId:e,messageId:l})},[e,v,l]),(0,s.vJ)(()=>{t&&!l||(u.current.clear(),p.current.clear(),m(!1))},[t,l]),(0,s.vJ)(()=>{o&&cg.forEach(t=>{const i=o[t];(0,Iv.R)(i)&&"async"===i.graphType&&A({name:t,chatId:e,token:i.token})})},[e,o,A]),(0,s.vJ)(()=>{(async()=>{await async function(){return og||(og=i.e(4810).then(i.bind(i,24810)),rg=await og),og}(),h?o&&d.current&&(cg.forEach((e,t)=>{const i=o[e];if(!(0,Iv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||u.current.has(e))return;if(n)return u.current.add(e),void p.current.add(e);const{zoomToken:a}=i;rg.create(d.current.children[t],{title:c(lg[e]),...a?{onZoom:e=>(0,En.px)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...i}),u.current.add(e)}),f()):m(!0)})()},[h,o,c,e,l,A,r,f]);const C=(0,T.A)(({direction:t})=>{t===a.TN.Backwards&&l&&g({chatId:e,messageId:l})});return h&&o&&l?(0,se.FD)("div",{className:(0,ge.A)(Jv,"custom-scroll",h&&zv),children:[(0,se.Y)(Pv.A,{statistics:o,type:"message",title:c("StatisticOverview")}),(!u.current.size||!o.publicForwardsData)&&(0,se.Y)(Ls.A,{}),(0,se.Y)("div",{ref:d,children:cg.map(e=>{const t=u.current.has(e)&&!p.current.has(e);return(0,se.Y)("div",{className:(0,ge.A)(Hv,!t&&$v)})})}),Boolean(o.publicForwards)&&(0,se.FD)("div",{className:Gv,children:[(0,se.Y)("h2",{className:jv,children:c("Stats.Message.PublicShares")}),(0,se.Y)(ls.A,{items:o.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:C,noFastList:!0,children:o.publicForwardsData.map(e=>(0,se.Y)(ag,{data:e},e.messageId))})]})]},`${e}-${l}`):(0,se.Y)(Ls.A,{})})),hg=(0,s.ph)(function({data:e,chatsById:t,usersById:i}){const s=(0,B.A)(),{openChat:a}=(0,n.ko)(),o=i[e.peerId],r=t[e.peerId],c=(0,T.A)(()=>{a({id:o.id})});return(0,se.FD)("div",{className:(0,ge.A)(ig,"statistic-public-forward"),onClick:c,children:[(0,se.Y)(Yt.A,{size:"medium",peer:o||r,withStorySolid:!0,forceUnreadStorySolid:!0}),(0,se.FD)("div",{children:[(0,se.Y)("div",{className:sg,children:o?(0,l.Yg)(o):(0,l.Js)(s,r)}),(0,se.Y)("div",{className:ng,children:e.viewsCount?s("ChannelStats.ViewsCount",e.viewsCount,"i"):s("NoViews")})]})]})});let mg,ug;const pg={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},vg=Object.keys(pg),gg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e),n=s.statistics.currentStory,a=s.statistics.currentStoryId,{byId:o}=e.users,{byId:r}=e.chats;return{statistics:n,dcId:i,storyId:a,usersById:o,chatsById:r}})(function({chatId:e,isActive:t,statistics:a,dcId:o,storyId:r,chatsById:l,usersById:c}){const d=(0,B.A)(),h=(0,s.li)(),[m,u]=(0,s.J0)(!1),p=(0,s.li)(new Set),v=(0,s.li)(new Set),{loadStoryStatistics:g,loadStoryPublicForwards:A,loadStatisticsAsyncGraph:f}=(0,n.ko)(),C=(0,M.A)();(0,s.vJ)(()=>{r&&g({chatId:e,storyId:r})},[e,r]),(0,s.vJ)(()=>{t&&!r||(p.current.clear(),v.current.clear(),u(!1))},[t,r]),(0,s.vJ)(()=>{a&&vg.forEach(t=>{const i=a[t];(0,Iv.R)(i)&&"async"===i.graphType&&f({name:t,chatId:e,token:i.token})})},[e,a,f]),(0,s.vJ)(()=>{(async()=>{await async function(){return mg||(mg=i.e(4810).then(i.bind(i,24810)),ug=await mg),mg}(),m?a&&h.current&&(vg.forEach((e,t)=>{const i=a[e];if(!(0,Iv.R)(i))return;const s="async"===i.graphType,n="error"===i.graphType;if(s||p.current.has(e))return;if(n)return p.current.add(e),void v.current.add(e);const{zoomToken:r}=i;ug.create(h.current.children[t],{title:d(pg[e]),...r?{onZoom:e=>(0,En.px)("fetchStatisticsAsyncGraph",{token:r,x:e,dcId:o}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.add(e)}),C()):u(!0)})()},[m,a,d,e,r,f,o,C]);const b=(0,T.A)(()=>{r&&A({chatId:e,storyId:r})});return m&&a&&r?(0,se.FD)("div",{className:(0,ge.A)(Jv,"custom-scroll",m&&zv),children:[(0,se.Y)(Pv.A,{statistics:a,type:"story",title:d("StatisticOverview")}),!p.current.size&&(0,se.Y)(Ls.A,{}),(0,se.Y)("div",{ref:h,children:vg.map(e=>{const t=p.current.has(e)&&!v.current.has(e);return(0,se.Y)("div",{className:(0,ge.A)(Hv,!t&&$v)})})}),Boolean(a.publicForwards)&&(0,se.FD)("div",{className:Gv,children:[(0,se.Y)("h2",{className:jv,children:d("Stats.Message.PublicShares")}),(0,se.Y)(ls.A,{items:a.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:b,noFastList:!0,children:a.publicForwardsData.map(e=>"messageId"in e?(0,se.Y)(ag,{data:e},`message_${e.messageId}`):(0,se.Y)(hg,{data:e,chatsById:l,usersById:c},`story_${e.storyId}`))})]})]},`${e}-${r}`):(0,se.Y)(Ls.A,{})}));var Ag=i(55573);const fg=(0,s.ph)((0,n.EK)((e,{answer:t})=>{const{votesByOption:i,offsets:s}=(0,c.nTw)(e).pollResults;return{votes:i?.[t.option],offset:s?.[t.option]||""}})(({chat:e,message:t,answer:i,answerVote:a,totalVoters:o,votes:r,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:h}=(0,n.ko)(),m=(0,K.A)(a.votersCount),[u,p]=(0,s.J0)(!0),g=Boolean(r),{option:A,text:f}=i,C=(0,B.A)();(0,s.vJ)(()=>{g&&m===a.votersCount||c({chat:e,messageId:t.id,option:A,offset:l,limit:4,shouldResetVoters:!0})},[a.votersCount,g]);const b=(0,s.hb)(()=>{p(!0),c({chat:e,messageId:t.id,option:A,offset:l,limit:50})},[e,c,t.id,l,A]);(0,s.vJ)(()=>{p(!1)},[r]);const y=(0,s.hb)(e=>{d({id:e}),h()},[h,d]);return(0,se.FD)("div",{className:"PollAnswerResults",children:[(0,se.FD)("div",{className:"poll-voters",children:[r?r.map(({peerId:e,date:t})=>(0,se.FD)(li.A,{className:"chat-item-clickable",onClick:()=>y(e),children:[(0,v.L8)(e)?(0,se.Y)(ms.A,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):(0,se.Y)(hs.A,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0}),(0,se.Y)("span",{className:"vote-date",children:(0,We.fS)(C,1e3*t,!0)})]},e)):(0,se.Y)(Ls.A,{}),r&&function(){const e=a.votersCount-r.length;return a.votersCount>4&&e>0&&(0,se.Y)(Ag.A,{count:e,itemName:"voter",isLoading:u,onClick:b})}()]}),(0,se.FD)("div",{className:"answer-head",dir:C.isRtl?"rtl":void 0,children:[(0,se.Y)("span",{className:"answer-title",dir:"auto",children:(0,Oi.fd)({text:f.text,entities:f.entities})}),(0,se.FD)("span",{className:"answer-percent",dir:C.isRtl?"auto":void 0,children:[(S=a.votersCount,N=o,N>0?(S/N*100).toFixed():0),"%"]})]})]});var S,N})),Cg=(0,s.ph)((0,n.EK)(e=>{const{pollResults:{chatId:t,messageId:i}}=(0,c.nTw)(e),s=t?(0,c.hds)(e,t):void 0,n=t&&i?(0,c.O5q)(e,t,i):void 0;return{chat:s,message:n,poll:n&&(0,c.zcZ)(e,n)}})(({isActive:e,chat:t,message:i,poll:s,onClose:n})=>{const a=(0,B.A)();if((0,Ne.A)({isActive:e,onBack:n}),!i||!s||!t)return(0,se.Y)(Ls.A,{});const{summary:o,results:r}=s;if(!r.results)return;const l=(0,di.dU)(r.results,"option");return(0,se.FD)("div",{className:"PollResults",dir:a.isRtl?"rtl":void 0,children:[(0,se.Y)("h3",{className:"poll-question",dir:"auto",children:(0,Oi.fd)({text:o.question.text,entities:o.question.entities})}),(0,se.Y)("div",{className:"poll-results-list custom-scroll",children:o.answers.map(e=>(0,se.Y)(fg,{chat:t,message:i,answer:e,answerVote:l[e.option],totalVoters:r.totalVoters},`${s.id}-${e.option}`))})]})}));var bg=i(90603);const yg="xrnUE4e6",Sg="z7kF7tij",Ng="T6wFpdQO",kg="CWsWIKQ1",wg="KBl0ycLl",Ig="iJ1U9kDD",Pg="Rk6PT_yc",Yg="qlo3vSEw",Fg="r06zwL42",Dg=5*g.$,Mg=(0,s.ph)((0,n.EK)(e=>{const{createTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,createTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(({isActive:e,chat:t,createTopicPanel:i,isCurrentUserPremium:a,onClose:r})=>{const{createTopic:l,openPremiumModal:c}=(0,n.ko)(),[d,h]=(0,s.J0)(""),[m,u]=(0,s.J0)(0),[p,v]=(0,s.J0)(void 0),g=(0,B.A)(),A=Boolean(d),f=Boolean(i?.isLoading);(0,Ne.A)({isActive:e,onBack:r}),(0,s.vJ)(()=>{e||(h(""),v(void 0))},[e]);const C=(0,s.hb)(e=>{h(e.target.value)},[]),b=(0,s.hb)(()=>{u(e=>(0,Ba.A)((0,bg.e$)().length,e+1))},[]),y=(0,s.hb)(()=>{l({chatId:t.id,title:d,iconColor:(0,bg.e$)()[m],iconEmojiId:p})},[t,l,m,p,d]),S=(0,s.hb)(e=>{e.isFree||a||e.id===o.MyF?e.id!==o.MyF?v(e.id):v(void 0):c({initialSection:"animated_emoji"})},[a,c]),N=(0,s.Kr)(()=>({id:0,title:d,iconColor:(0,bg.e$)()[m],iconEmojiId:p}),[m,p,d]);if(t?.isForum)return(0,se.FD)("div",{className:yg,children:[(0,se.FD)("div",{className:(0,ge.A)(Sg,"custom-scroll"),children:[(0,se.FD)("div",{className:(0,ge.A)(Ng,kg),children:[(0,se.Y)("span",{className:Yg,children:g("CreateTopicTitle")}),(0,se.Y)(oe.Ay,{name:"zoomFade",activeKey:Number(N.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:Ig,children:(0,se.Y)(xs.A,{topic:N,className:(0,ge.A)(Pg,"K1CTKtBS"),onClick:b,size:Dg,noLoopLimit:!0})}),(0,se.Y)(ee.A,{value:d,onChange:C,label:g("lng_forum_topic_title"),disabled:f,teactExperimentControlled:!0})]}),(0,se.Y)("div",{className:(0,ge.A)(Ng,wg),children:(0,se.Y)(_r,{idPrefix:"create-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:S,className:Fg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]}),(0,se.Y)(pi.A,{isShown:A,disabled:f,onClick:y,ariaLabel:g("Save"),iconName:"check",isLoading:f})]})})),Tg=5*g.$,Bg=(0,s.ph)((0,n.EK)(e=>{const{editTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,topic:t?.chatId&&t?.topicId?(0,c.S0q)(e,t.chatId,t.topicId):void 0,editTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}})(({isActive:e,chat:t,topic:i,editTopicPanel:a,isCurrentUserPremium:r,onClose:l})=>{const{editTopic:c,openPremiumModal:d}=(0,n.ko)(),[h,m]=(0,s.J0)(""),[u,p]=(0,s.J0)(void 0),v=(0,B.A)(),g=Boolean(a?.isLoading),A=i?.id===o.HxB;(0,Ne.A)({isActive:e,onBack:l}),(0,s.vJ)(()=>{e||(m(""),p(void 0))},[e]),(0,s.vJ)(()=>{(i?.title||i?.iconEmojiId)&&(m(i.title),p(i.iconEmojiId))},[i]);const f=(0,s.Kr)(()=>h!==i?.title||u!==i?.iconEmojiId,[u,h,i?.iconEmojiId,i?.title]),C=(0,s.hb)(e=>{const t=e.target.value;m(t)},[]),b=(0,s.hb)(()=>{c({chatId:t.id,title:h,topicId:i.id,iconEmojiId:u})},[t,c,u,h,i]),y=(0,s.hb)(e=>{e.isFree||r||e.id===o.MyF?e.id!==o.MyF?p(e.id):p("0"):d({initialSection:"animated_emoji"})},[r,d]),S=(0,s.Kr)(()=>({...i,title:h,iconEmojiId:u}),[u,h,i]);if(t?.isForum)return(0,se.FD)("div",{className:yg,children:[(0,se.FD)("div",{className:(0,ge.A)(Sg,"custom-scroll"),children:[!i&&(0,se.Y)(Ls.A,{}),i&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:(0,ge.A)(Ng,kg,A&&"YftUWqqw"),children:[(0,se.Y)("span",{className:Yg,children:v(A?"CreateGeneralTopicTitle":"CreateTopicTitle")}),(0,se.Y)(oe.Ay,{name:"zoomFade",activeKey:Number(S.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:Ig,children:(0,se.Y)(xs.A,{topic:S,className:Pg,size:Tg,noLoopLimit:!0})}),(0,se.Y)(ee.A,{value:h,onChange:C,label:v("lng_forum_topic_title"),disabled:g,teactExperimentControlled:!0})]}),!A&&(0,se.Y)("div",{className:(0,ge.A)(Ng,wg),children:(0,se.Y)(_r,{idPrefix:"edit-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:y,className:Fg,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]})]}),(0,se.Y)(pi.A,{isShown:f,disabled:g,onClick:b,ariaLabel:v("Save"),iconName:"check",isLoading:g})]})})),Lg="Please provide name",Rg=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=(0,c.yps)(e,t),s=(0,c.vGo)(e,t),{progress:n}=(0,c.nTw)(e).management,a=(0,ys.d)(e,"aboutLength");return{userId:t,user:i,progress:n,currentBio:s?.bio,maxBioLength:a}})(({userId:e,user:t,progress:i,currentBio:o,isActive:r,maxBioLength:c,onClose:d})=>{const{setBotInfo:h,uploadProfilePhoto:m,uploadContactProfilePhoto:u,startBotFatherConversation:p}=(0,n.ko)(),[v,g,A]=(0,D.A)(!1),[f,C,b]=(0,D.A)(!1),[y,S]=(0,s.J0)(),N=(0,B.A)(),k=(0,s.Kr)(()=>t?(0,l.Kl)(t):void 0,[t]);(0,Ne.A)({isActive:r,onBack:d});const w=t?(0,l.u0)(t):"",[I,P]=(0,s.J0)(),[Y,F]=(0,s.J0)(w||""),[M,L]=(0,s.J0)(o||""),R=t&&(0,l.cP)(t),x=(0,q.A)(R,!1,G.qZ.BlobUrl);(0,s.vJ)(()=>{A(),b()},[e]),(0,s.vJ)(()=>{F(w||""),L(o||"")},[w,o,t]),(0,s.vJ)(()=>{P(void 0)},[x]),(0,s.vJ)(()=>{i===a.TD.Complete&&(A(),b(),S(void 0))},[i]);const E=(0,T.A)(e=>{F(e.target.value),g(),y===Lg&&S(void 0)}),V=(0,T.A)(e=>{L(e.target.value),g()}),_=(0,T.A)(e=>{P(e),C()}),U=(0,T.A)(()=>{const e=Y.trim(),i=M.trim();e.length?(h({...v&&{bot:t,name:e,description:i}}),I&&m({file:I,...f&&{bot:t}})):S(Lg)}),O=(0,T.A)(()=>{p({param:`${k}-intro`})}),K=(0,T.A)(()=>{p({param:`${k}-commands`})}),J=(0,T.A)(()=>{p({param:k})}),j=(0,s.li)(),z=(0,s.li)(!1),H=(0,T.A)(t=>{C(),u({userId:e,file:t,isSuggest:z.current})});if(!t)return;const $=i===a.TD.InProgress;return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Bh.A,{currentAvatarBlobUrl:x,onChange:_,title:N("ChatSetPhotoOrVideo"),disabled:$}),(0,se.Y)(ee.A,{id:"user-name",label:N("PaymentCheckoutName"),onChange:E,value:Y,error:y===Lg?y:void 0,teactExperimentControlled:!0}),(0,se.Y)(fn.A,{value:M,onChange:V,label:N("DescriptionPlaceholder"),disabled:$,maxLength:c,maxLengthIndicator:c?(c-M.length).toString():void 0})]}),(0,se.Y)("div",{className:"section",children:(0,se.FD)("div",{className:"dialog-buttons",children:[(0,se.Y)(li.A,{icon:"bot-commands-filled",ripple:!0,onClick:O,children:(0,se.Y)("span",{children:N("BotEditIntro")})}),(0,se.Y)(li.A,{icon:"bot-command",ripple:!0,onClick:K,children:(0,se.Y)("span",{children:N("BotEditCommands")})}),(0,se.Y)(li.A,{icon:"bots",ripple:!0,onClick:J,children:(0,se.Y)("span",{children:N("BotChangeSettings")})}),(0,se.Y)("div",{className:"section-info section-info_push",children:(0,Pt.A)(N("BotManageInfo"),["links"])})]})})]}),(0,se.Y)(pi.A,{isShown:v||f,onClick:U,disabled:$,ariaLabel:N("Save"),iconName:"check",isLoading:$}),(0,se.Y)(Nm.A,{onChange:H,inputRef:j})]})})),xg="Channel title can't be empty",Eg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{management:s}=(0,c.nTw)(e),{progress:n}=s,{invites:a}=s.byChatId[t]||{},o=e.appConfig.channelAutoTranslationLevelMin,r=i?.hasAutoTranslation,d=i?.level,h=!(!d||!o)&&d>=o;return{chat:i,chatFullInfo:(0,c.AWZ)(e,t),progress:n,canChangeInfo:(0,l.ub)(i,"changeInfo"),canInvite:(0,l.ub)(i,"inviteUsers"),exportedInvites:a,availableReactions:e.reactions.availableReactions,hasAutoTranslation:r,canToggleAutoTranslation:h}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:o,canChangeInfo:r,canInvite:d,exportedInvites:h,isActive:m,availableReactions:u,onScreenSelect:p,onClose:v,hasAutoTranslation:g,canToggleAutoTranslation:A})=>{const{updateChat:f,closeManagement:C,leaveChannel:b,deleteChannel:y,openChat:S,loadExportedChatInvites:N,loadChatJoinRequests:k,toggleAutoTranslation:w}=(0,n.ko)(),I=t?.title||"",P=i?.about||"",Y=Boolean(i?.linkedChatId),[F,M,L]=(0,D.A)(),[R,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)(I),[_,U]=(0,s.J0)(P),[O,K]=(0,s.J0)(),[J,j]=(0,s.J0)(),z=t&&(0,l.cP)(t),H=(0,q.A)(z,!1,G.qZ.BlobUrl),$=(0,B.A)(),W=t&&(0,l.WX)(t),Q=(0,T.A)(()=>{w({chatId:e,isEnabled:!g})});(0,Ne.A)({isActive:m,onBack:v}),(0,s.vJ)(()=>{d&&(N({chatId:e}),N({chatId:e,isRevoked:!0}),k({chatId:e}))},[e,d]),(0,s.vJ)(()=>{o===a.TD.Complete&&(x(!1),j(void 0))},[o]);const Z=(0,s.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),X=i?.kickedMembers?.length||0,te=(0,T.A)(()=>{p(a.je.ChatPrivacyType)}),ie=(0,T.A)(()=>{p(a.je.Discussion)}),ne=(0,T.A)(()=>{p(a.je.Reactions)}),ae=(0,T.A)(()=>{p(a.je.ChatAdministrators)}),oe=(0,T.A)(()=>{p(a.je.Invites)}),re=(0,T.A)(()=>{p(a.je.JoinRequests)}),le=(0,T.A)(e=>{K(e),x(!0)}),ce=(0,T.A)(e=>{V(e.target.value),x(!0)}),de=(0,T.A)(e=>{U(e.target.value),x(!0)}),he=(0,T.A)(()=>{const t=E.trim(),i=_.trim();t.length?f({chatId:e,title:t,about:i,photo:O}):j(xg)}),me=(0,T.A)(()=>{p(a.je.ChannelSubscribers)}),ue=(0,T.A)(()=>{p(a.je.ChannelRemovedUsers)}),pe=(0,T.A)(()=>{t.isCreator?y({chatId:t.id}):b({chatId:t.id}),L(),C(),S({id:void 0})}),ve=(0,s.Kr)(()=>{if(!i?.enabledReactions)return $("ReactionsOff");if("all"===i.enabledReactions.type)return $("ReactionsAll");const e=i.enabledReactions.allowed.length,t=u?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[u,i?.enabledReactions,$]),ge=(0,s.Kr)(()=>(0,l.gA)(t),[t]);if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const Ae=o===a.TD.InProgress;return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Bh.A,{currentAvatarBlobUrl:H,onChange:le,disabled:!r}),(0,se.FD)("div",{className:"settings-edit",children:[(0,se.Y)(ee.A,{id:"channel-title",label:$("EnterChannelName"),onChange:ce,value:E,error:J===xg?J:void 0,disabled:!r}),(0,se.Y)(fn.A,{id:"channel-about",label:$("DescriptionPlaceholder"),onChange:de,value:_,maxLength:255,maxLengthIndicator:(255-_.length).toString(),disabled:!r,noReplaceNewlines:!0})]}),t.isCreator&&(0,se.FD)(li.A,{icon:"lock",multiline:!0,onClick:te,children:[(0,se.Y)("span",{className:"title",children:$("ChannelType")}),(0,se.Y)("span",{className:"subtitle",children:$(ge?"TypePublic":"TypePrivate")})]}),(0,se.FD)(li.A,{icon:"message",multiline:!0,onClick:ie,disabled:!r,children:[(0,se.Y)("span",{className:"title",children:$("Discussion")}),(0,se.Y)("span",{className:"subtitle",children:$(Y?"DiscussionUnlink":"Add")})]}),d&&(0,se.FD)(li.A,{icon:"link",onClick:oe,multiline:!0,disabled:!h,children:[(0,se.Y)("span",{className:"title",children:$("GroupInfo.InviteLinks")}),(0,se.Y)("span",{className:"subtitle",children:h?(0,Fn.Sm)(h.length):$("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,se.FD)(li.A,{icon:"add-user-filled",onClick:re,multiline:!0,children:[(0,se.Y)("span",{className:"title",children:$("SubscribeRequests")}),(0,se.Y)("span",{className:"subtitle",children:(0,Fn.Sm)(t.joinRequests.length)})]}),(0,se.FD)(li.A,{icon:"heart-outline",multiline:!0,onClick:ne,disabled:!r,children:[(0,se.Y)("span",{className:"title",children:$("Reactions")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:ve})]}),W&&(0,se.FD)(li.A,{icon:"language",narrow:!0,ripple:!0,disabled:!A,onClick:Q,children:[(0,se.Y)("span",{children:$("AutomaticTranslation")}),(0,se.Y)(ci.A,{id:"auto-translation",label:$("AutomaticTranslation"),checked:g})]})]}),(0,se.FD)("div",{className:"section",children:[(0,se.FD)(li.A,{icon:"admin",multiline:!0,onClick:ae,children:[(0,se.Y)("span",{className:"title",children:$("ChannelAdministrators")}),(0,se.Y)("span",{className:"subtitle",children:Z})]}),(0,se.FD)(li.A,{icon:"group",multiline:!0,onClick:me,children:[(0,se.Y)("span",{className:"title",dir:"auto",children:$("ChannelSubscribers")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:(0,Fn.Sm)(t.membersCount)})]}),(0,se.FD)(li.A,{icon:"delete-user",multiline:!0,onClick:ue,children:[(0,se.Y)("span",{className:"title",children:$("ChannelBlockedUsers")}),(0,se.Y)("span",{className:"subtitle",children:X})]})]}),(0,se.Y)("div",{className:"section",children:(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:M,children:t.isCreator?$("ChannelDelete"):$("LeaveChannel")})})]}),(0,se.Y)(pi.A,{isShown:R,onClick:he,disabled:Ae,ariaLabel:$("Save"),iconName:"check",isLoading:Ae}),(0,se.Y)(ai.A,{isOpen:F,onClose:L,text:t.isCreator?$("ChannelDeleteAlert"):$("ChannelLeaveAlert"),confirmLabel:t.isCreator?$("ChannelDelete"):$("LeaveChannel"),confirmHandler:pe,confirmIsDestructive:!0})]})})),Vg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,currentUserId:e.currentUserId,isChannel:i&&(0,l.WX)(i),adminMembersById:(0,c.AWZ)(e,t)?.adminMembersById}})(({isActive:e,chat:t,isChannel:i,currentUserId:o,adminMembersById:r,onScreenSelect:c,onChatMemberSelect:d,onClose:h})=>{const{toggleSignatures:m}=(0,n.ko)(),u=(0,B.A)();(0,Ne.A)({isActive:e,onBack:h});const p=Boolean(t?.areSignaturesShown),v=Boolean(t?.areProfilesShown),g=Boolean(t?.isCreator||t&&(0,l.ub)(t,"addAdmins")),A=i&&(0,l.ub)(t,"postMessages"),f=(0,s.Kr)(()=>{if(!r)return[];const[e,t]=(0,di.jB)(Object.values(r),e=>e.isOwner);return[...e,...t]},[r]),C=(0,T.A)(e=>{d(e.userId,e.promotedByUserId===o),c(a.je.ChatAdminRights)}),b=(0,T.A)(()=>{m({chatId:t.id,areProfilesEnabled:v,areSignaturesEnabled:!p})}),y=(0,T.A)(()=>{m({chatId:t.id,areProfilesEnabled:!v,areSignaturesEnabled:p})}),S=(0,T.A)(()=>{c(a.je.GroupAddAdmins)}),N=(0,T.A)(e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,n.mS)().users.byId,i=e.promotedByUserId?t[e.promotedByUserId]:void 0;return i?u("EditAdminPromotedBy",(0,l.Yg)(i)):u("ChannelAdmin")});return(0,se.Y)("div",{className:"Management",children:(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.Y)("div",{className:"section",children:(0,se.FD)(li.A,{icon:"recent",multiline:!0,disabled:!0,children:[(0,se.Y)("span",{className:"title",children:u("EventLog")}),(0,se.Y)("span",{className:"subtitle",children:u(i?"EventLogInfoDetailChannel":"EventLogInfoDetail")})]})}),(0,se.FD)("div",{className:"section",dir:u.isRtl?"rtl":void 0,children:[(0,se.Y)("p",{className:"section-help",dir:"auto",children:u(i?"Channel.Management.AddModeratorHelp":"Group.Management.AddModeratorHelp")}),f.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable",onClick:()=>C(e),children:(0,se.Y)(ms.A,{userId:e.userId,status:N(e),forceShowSelf:!0})},e.userId)),(0,se.Y)(pi.A,{isShown:g,onClick:S,ariaLabel:u("Channel.Management.AddModerator"),iconName:"add-user-filled"})]}),A&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)("div",{className:"ListItem narrow",children:(0,se.Y)(js.A,{checked:p,label:u("ChannelSignMessages"),onChange:b})}),p&&(0,se.FD)(se.FK,{children:[(0,se.Y)("div",{className:"ListItem narrow",children:(0,se.Y)(js.A,{checked:v,label:u("ChannelSignMessagesWithProfile"),onChange:y})}),(0,se.Y)("p",{className:"section-info section-info_push",children:u("ChannelSignProfilesInfo")})]})]})]})})})),_g=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{isUsernameAvailable:s,checkedUsername:n,error:a}=(0,c.YK)(e,t);return{chat:i,isChannel:(0,l.WX)(i),progress:(0,c.nTw)(e).management.progress,error:a,isUsernameAvailable:s,checkedUsername:n,isProtected:i?.isProtected,maxPublicLinks:(0,ys.d)(e,"channelsPublic"),privateInviteLink:(0,c.AWZ)(e,t)?.inviteLink}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)&&(0,c.YK)(e,t)))(({chat:e,isActive:t,isChannel:i,progress:r,isUsernameAvailable:c,checkedUsername:d,error:h,isProtected:m,maxPublicLinks:u,privateInviteLink:p,onClose:v})=>{const{updatePublicLink:g,updatePrivateLink:A,toggleIsProtected:f,openLimitReachedModal:C,resetManagementError:b}=(0,n.ko)(),y=(0,s.Kr)(()=>e.usernames?.find(({isEditable:e})=>e),[e.usernames]),S=y?.username||"",N=(0,s.Kr)(()=>(0,l.gA)(e),[e]),[k,w]=(0,s.J0)(!1),[I,P]=(0,s.J0)(N?"public":"private"),[Y,F]=(0,s.J0)(),[M,T,L]=(0,D.A)(),[R,x,E]=(0,D.A)(),V=(0,K.A)(c),_=k&&Boolean("public"===I&&(Y||S&&""===Y)&&(c??V)||"private"===I&&N);(0,Ne.A)({isActive:t,onBack:v}),(0,s.vJ)(()=>{w(!1)},[S]),(0,s.vJ)(()=>{I&&!p&&A()},[I,p,A]);const U=(0,s.hb)(t=>{F(t),w(!0),h&&b({chatId:e.id})},[e.id,h]),O=(0,s.hb)((e,t)=>{if(Object.values((0,n.mS)().chats.byId).filter(({isCreator:e,usernames:t})=>e&&t?.some(e=>e.isActive)).length>=u&&"public"===e){C({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}P(e),w(!0)},[u,C]),J=(0,s.hb)(t=>{f({chatId:e.id,isProtected:"protected"===t})},[e.id,f]),G=(0,s.hb)(()=>{N&&"private"===I?x():g({username:"public"===I&&Y||""})},[N,x,I,g,Y]),j=(0,s.hb)(()=>{g({username:"",shouldDisableUsernames:!0}),E()},[E,g]),z=(0,s.hb)(()=>{L(),A()},[L,A]),H=(0,B.A)(),$=i?"Channel":"Mega",q=i?"Channel":"Group",W=[{value:"private",label:H(`${$}Private`),subLabel:H(`${$}PrivateInfo`)},{value:"public",label:H(`${$}Public`),subLabel:H(`${$}PublicInfo`)}],Q=[{value:"allowed",label:H("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:H("ChannelVisibility.Forwarding.Disabled")}],Z=r===a.TD.InProgress,X="public"===I&&e.usernames&&e.usernames.length>0;return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,se.Y)("h3",{className:"section-heading",children:H(`${q}Type`)}),(0,se.Y)(ie.A,{selected:I,name:"channel-type",options:W,onChange:O})]}),"private"===I?(0,se.Y)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:p?(0,se.FD)(se.FK,{children:[(0,se.Y)(qr.A,{link:p,className:"invite-link"}),(0,se.Y)("p",{className:"section-info",dir:H.isRtl?"rtl":void 0,children:H(`${$}PrivateLinkHelp`)}),(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:T,children:H("RevokeLink")}),(0,se.Y)(ai.A,{isOpen:M,onClose:L,text:H("RevokeAlert"),confirmLabel:H("RevokeButton"),confirmHandler:z,confirmIsDestructive:!0})]}):(0,se.Y)(Ls.A,{})}):(0,se.FD)("div",{className:"section no-border",children:[(0,se.Y)("div",{className:"settings-input",children:(0,se.Y)(Th,{asLink:!0,currentUsername:S,isLoading:Z,isUsernameAvailable:c,checkedUsername:d,onChange:U})}),h===o.Y3M&&function(){const e=`${o.jsp}${o.NjX}`;return(0,se.Y)("p",{className:"section-info",dir:"auto",children:H("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map(t=>"PURCHASE_LINK"===t?(0,se.Y)(nn.A,{url:e,text:`@${o.NjX}`}):t)})}(),(0,se.Y)("p",{className:"section-info",dir:"auto",children:H(`${q}.Username.CreatePublicLinkHelp`)})]}),X&&(0,se.Y)(Yh,{chatId:e.id,usernames:e.usernames,onEditUsername:U}),(0,se.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,se.Y)("h3",{className:"section-heading",children:H(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")}),(0,se.Y)(ie.A,{selected:m?"protected":"allowed",name:"forwarding-type",options:Q,onChange:J}),(0,se.Y)("p",{className:"section-info section-info_push",children:H(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")})]})]}),(0,se.Y)(pi.A,{isShown:_,disabled:Z,ariaLabel:H("Save"),onClick:G,iconName:"check",isLoading:Z}),(0,se.Y)(ai.A,{isOpen:R,onClose:E,text:H("ChannelVisibility.Confirm.MakePrivate.Channel",S),confirmHandler:j,confirmIsDestructive:!0})]})})),Ug=(0,s.ph)((0,n.EK)((e,{chat:t})=>{const{currentUserId:i}=e;return{currentUserId:i,chatMembers:(0,c.AWZ)(e,t.id)?.members}})(({chat:e,currentUserId:t,chatMembers:i,isOpen:a,onClose:o})=>{const{loadMoreMembers:r,deleteChatMember:l}=(0,n.ko)(),c=(0,Fi.A)(),[d,h]=(0,s.J0)(""),m=(0,s.Kr)(()=>{const e=(i||[]).reduce((e,i)=>(i.isAdmin||i.isOwner||i.userId===t||e.push(i.userId),e),[]);return(0,It.PU)({ids:e,query:d,type:"user"})},[i,t,d]),u=(0,T.A)(()=>{r({chatId:e.id})}),p=(0,T.A)(t=>{l({chatId:e.id,userId:t}),o()});return(0,se.Y)(Os,{isOpen:a,chatOrUserIds:m,title:c("ChannelBlockUser"),searchPlaceholder:c("Search"),search:d,onSearchChange:h,loadMore:u,onSelectChatOrUser:p,onClose:o})})),Og=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s}=e.users;return{chat:i,usersById:s,canDeleteMembers:i&&((0,l.ub)(i,"banUsers")||i.isCreator),removedMembers:(0,c.AWZ)(e,t)?.kickedMembers||hi.p,isChannel:i&&(0,l.WX)(i)}})(({chat:e,usersById:t,canDeleteMembers:i,removedMembers:a,isChannel:o,onClose:r,isActive:c})=>{const{updateChatMemberBannedRights:d}=(0,n.ko)(),h=(0,B.A)(),[m,u,p]=(0,D.A)();(0,Ne.A)({isActive:c,onBack:r});const v=(0,s.hb)(e=>{if(!e.kickedByUserId)return;const i=t[e.kickedByUserId];return i?h("UserRemovedBy",(0,l.Yg)(i)):void 0},[h,t]),g=(0,s.hb)(t=>{if(e)return[{title:h("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[h,e,d]);return(0,se.Y)("div",{className:"Management",children:(0,se.Y)("div",{className:"panel-content custom-scroll",children:(0,se.FD)("div",{className:"section",dir:h.isRtl?"rtl":void 0,children:[(0,se.Y)("p",{className:"section-help",children:h(o?"NoBlockedChannel2":"NoBlockedGroup2")}),a.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable",ripple:!0,contextActions:g(e),children:(0,se.Y)(ms.A,{userId:e.userId,status:v(e),forceShowSelf:!0})},e.userId)),i&&(0,se.Y)(pi.A,{isShown:!0,onClick:u,ariaLabel:h("Channel.EditAdmin.Permission.BanUsers"),iconName:"add-user-filled"}),e&&i&&(0,se.Y)(Ug,{chat:e,isOpen:m,onClose:p})]})})})})),Kg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{linkedChatId:s}=(0,c.AWZ)(e,t)||{},{forDiscussionIds:n,byId:a}=e.chats;return{chat:i,chatsByIds:a,forDiscussionIds:n,linkedChat:s?(0,c.hds)(e,s):void 0,isChannel:i&&(0,l.WX)(i)}})(({chat:e,onClose:t,isActive:i,chatId:r,chatsByIds:c,linkedChat:d,forDiscussionIds:h,isChannel:m,onScreenSelect:u})=>{const{loadGroupsForDiscussion:p,linkDiscussionGroup:v,unlinkDiscussionGroup:g,toggleJoinRequest:A,toggleJoinToSend:f}=(0,n.ko)(),[C,b]=(0,s.J0)(),[y,S,N]=(0,D.A)(),[k,w,I]=(0,D.A)(),[P,Y]=(0,s.J0)(Boolean(d?.isJoinToSend)),[F,M]=(0,s.J0)(Boolean(d?.isJoinRequest)),L=(0,B.A)(),R=d?.id;(0,Ne.A)({isActive:i,onBack:t}),(0,s.vJ)(()=>{p()},[p]),(0,s.vJ)(()=>{i&&(Y(d?.isJoinToSend||!1),M(d?.isJoinRequest||!1))},[d,i]);const x=(0,s.hb)(()=>{N(),g({channelId:m?r:R}),m||u(a.je.Initial)},[N,g,m,r,R,u]),E=(0,s.hb)(()=>{I(),v({channelId:r,chatId:C})},[I,v,r,C]),V=(0,s.hb)(e=>{Y(e),f({chatId:R,isEnabled:e}),e||M(!1)},[R,f]),_=(0,s.hb)(e=>{M(e),A({chatId:R,isEnabled:e})},[R,A]);const U=(0,T.A)(()=>{u(a.je.NewDiscussionGroup)});return(0,se.Y)("div",{className:"Management",children:(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.DiscussionGroups,size:o.Uyp,className:"section-icon"}),d&&(0,se.FD)("div",{children:[d&&(0,se.Y)(li.A,{className:"chat-item-clickable",inactive:!0,children:(0,se.Y)(hs.A,{chatId:d.id})}),(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")}),(0,se.Y)(ai.A,{isOpen:y,onClose:N,header:(0,se.FD)("div",{className:"modal-header",children:[(0,se.Y)(Yt.A,{size:"tiny",peer:d}),(0,se.Y)("div",{className:"modal-title",children:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")})]}),textParts:(0,Pt.A)(L(m?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",d?.title),["br","simple_markdown"]),confirmLabel:L(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:x,confirmIsDestructive:!0})]}),!d&&(0,se.FD)("div",{children:[(0,se.Y)("p",{className:"section-help",dir:"auto",children:L("DiscussionChannelHelp")}),(0,se.FD)("div",{teactFastList:!0,children:[(0,se.Y)(li.A,{icon:"group",ripple:!0,className:"create-item",withPrimaryColor:!0,teactOrderKey:0,onClick:U,children:L("DiscussionCreateGroup")},"create-group"),h?h.map((e,t)=>(0,se.Y)(li.A,{teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{b(e),w()},children:(0,se.Y)(hs.A,{chatId:e})},e)):(0,se.Y)(Lc.A,{teactOrderKey:0,text:"No discussion groups found"},"nothing-found")]}),(0,se.Y)("p",{className:"mt-4 mb-0 section-help",dir:"auto",children:L("DiscussionChannelHelp2")}),(0,se.Y)(ai.A,{isOpen:k,onClose:I,header:function(){if(!C)return;const e=c[C];return e?(0,se.FD)("div",{className:"modal-header",children:[(0,se.Y)(Yt.A,{size:"tiny",peer:e}),(0,se.Y)("div",{className:"modal-title",children:L("Channel.DiscussionGroup.LinkGroup")})]}):void 0}(),textParts:function(){if(!C)return;const t=c[C];return t?(0,l.gA)(t)?(0,Pt.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?`,["br","simple_markdown"]):(0,Pt.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"]):void 0}(),confirmLabel:L("DiscussionLinkGroup"),confirmHandler:E})]})]}),d&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)("h3",{className:"section-heading",children:L("ChannelSettingsJoinTitle")}),(0,se.Y)("div",{className:"ListItem narrow",children:(0,se.Y)(js.A,{checked:P,onCheck:V,label:L("ChannelSettingsJoinToSend")})}),P&&(0,se.Y)("div",{className:"ListItem narrow",children:(0,se.Y)(js.A,{checked:F,onCheck:_,label:L("ChannelSettingsJoinRequest")})}),(0,se.Y)("p",{className:"section-info section-info_push",children:L(P?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")})]})]})})})),Jg="Group title can't be empty",Gg=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],jg=Gg.length+1,zg=(0,Ce.sg)(e=>e(),500,!1),Hg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{management:n,limitReachedModal:a}=(0,c.nTw)(e),{progress:o}=n,r=Boolean(s?.linkedChatId),d=(0,l.yn)(i),{invites:h}=n.byChatId[t]||{},m=!r&&((0,l.ub)(i,"changeInfo")||i.isCreator);return{chat:i,chatFullInfo:s,progress:o,isBasicGroup:d,hasLinkedChannel:r,canChangeInfo:i.isCreator||(0,l.ub)(i,"changeInfo"),canBanUsers:i.isCreator||(0,l.ub)(i,"banUsers"),canInvite:i.isCreator||(0,l.ub)(i,"inviteUsers"),exportedInvites:h,isChannelsPremiumLimitReached:"channels"===a?.limit,availableReactions:e.reactions.availableReactions,canEditForum:m}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chatId:e,chat:t,chatFullInfo:i,progress:o,isBasicGroup:r,hasLinkedChannel:d,canChangeInfo:h,canBanUsers:m,canInvite:u,canEditForum:p,isActive:v,exportedInvites:g,isChannelsPremiumLimitReached:A,availableReactions:f,onScreenSelect:C,onClose:b})=>{const{togglePreHistoryHidden:y,updateChat:S,deleteChat:N,leaveChannel:k,deleteChannel:w,closeManagement:I,openChat:P,loadExportedChatInvites:Y,loadChatJoinRequests:F,toggleForum:M}=(0,n.ko)(),[L,R,x]=(0,D.A)(),E=t.title,V=i?.about||"",[_,U]=(0,s.J0)(!1),[O,K]=(0,s.J0)(E),[J,j]=(0,s.J0)(V),[z,H]=(0,s.J0)(),[$,W]=(0,s.J0)(),[Q,Z]=(0,s.J0)(t.isForum),X=(0,l.cP)(t),te=(0,q.A)(X,!1,G.qZ.BlobUrl),ie=(0,s.Kr)(()=>(0,l.gA)(t),[t]),ne=(0,B.A)(),ae=(0,s.li)();(0,Ne.A)({isActive:v,onBack:b}),(0,s.vJ)(()=>{u&&(Y({chatId:e}),Y({chatId:e,isRevoked:!0}),F({chatId:e}))},[e,u]),(0,s.vJ)(()=>{Z(Boolean(t.isForum))},[t.isForum]),(0,s.vJ)(()=>{o===a.TD.Complete&&(U(!1),W(void 0))},[o]);const oe=(0,T.A)(()=>{C(a.je.ChatPrivacyType)}),re=(0,T.A)(()=>{C(a.je.Discussion)}),le=(0,T.A)(()=>{C(a.je.Reactions)}),ce=(0,T.A)(()=>{C(a.je.GroupPermissions)}),de=(0,T.A)(()=>{C(a.je.ChatAdministrators)}),he=(0,T.A)(()=>{C(a.je.Invites)}),me=(0,T.A)(()=>{C(a.je.JoinRequests)}),ue=(0,T.A)(e=>{H(e),U(!0)}),pe=(0,T.A)(e=>{K(e.target.value),U(!0)}),ve=(0,T.A)(e=>{j(e.target.value),U(!0)}),ge=(0,T.A)(()=>{const t=O.trim(),i=J.trim();t.length?S({chatId:e,title:t,about:i,photo:z}):W(Jg)}),Ae=(0,T.A)(()=>{C(a.je.GroupMembers)}),fe=(0,T.A)(()=>{if(!i)return;const{isPreHistoryHidden:e}=i;y({chatId:t.id,isEnabled:!e})}),Ce=(0,T.A)(()=>{Z(t=>{const i=!t;return zg(()=>{M({chatId:e,isEnabled:i})}),i})});(0,s.vJ)(()=>{if(!A)return;const e=ae.current?.querySelector("input");e.checked=!i?.isPreHistoryHidden},[A,i?.isPreHistoryHidden]);const be=(0,s.Kr)(()=>{if(!i?.enabledReactions)return ne("ReactionsOff");if("all"===i.enabledReactions.type)return ne("ReactionsAll");const e=i.enabledReactions.allowed.length,t=f?.filter(e=>!e.isInactive).length||0;return t?`${e} / ${t}`:e.toString()},[f,i?.enabledReactions,ne]),ye=(0,s.Kr)(()=>{if(!t.defaultBannedRights)return 0;let e=Gg.filter(e=>!("manageTopics"===e&&!Q||t.defaultBannedRights[e])).length;const{sendStickers:i,sendGifs:s}=t.defaultBannedRights;return i||s||(e+=1),e},[t.defaultBannedRights,Q]),Se=(0,s.Kr)(()=>Object.keys(i?.adminMembersById||{}).length,[i?.adminMembersById]),ke=(0,T.A)(()=>{r?N({chatId:t.id}):t.isCreator?w({chatId:t.id}):k({chatId:t.id}),x(),I(),P({id:void 0})});if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const we=o===a.TD.InProgress;return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Bh.A,{isForForum:Q,currentAvatarBlobUrl:te,onChange:ue,disabled:!h}),(0,se.FD)("div",{className:"settings-edit",children:[(0,se.Y)(ee.A,{id:"group-title",label:ne("GroupName"),onChange:pe,value:O,error:$===Jg?$:void 0,disabled:!h}),(0,se.Y)(fn.A,{id:"group-about",label:ne("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-J.length).toString(),onChange:ve,value:J,disabled:!h,noReplaceNewlines:!0})]}),t.isCreator&&(0,se.FD)(li.A,{icon:"lock",multiline:!0,onClick:oe,children:[(0,se.Y)("span",{className:"title",children:ne("GroupType")}),(0,se.Y)("span",{className:"subtitle",children:ne(ie?"TypePublic":"TypePrivate")})]}),d&&(0,se.FD)(li.A,{icon:"message",multiline:!0,onClick:re,children:[(0,se.Y)("span",{className:"title",children:ne("LinkedChannel")}),(0,se.Y)("span",{className:"subtitle",children:ne("DiscussionUnlink")})]}),(0,se.FD)(li.A,{icon:"permissions",multiline:!0,onClick:ce,disabled:!m,children:[(0,se.Y)("span",{className:"title",children:ne("ChannelPermissions")}),(0,se.FD)("span",{className:"subtitle",dir:"auto",children:[ye,"/",jg-(Q?0:1)]})]}),(0,se.FD)(li.A,{icon:"heart-outline",multiline:!0,onClick:le,disabled:!h,children:[(0,se.Y)("span",{className:"title",children:ne("Reactions")}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:be})]}),(0,se.FD)(li.A,{icon:"admin",multiline:!0,onClick:de,children:[(0,se.Y)("span",{className:"title",children:ne("ChannelAdministrators")}),(0,se.Y)("span",{className:"subtitle",children:(0,Fn.Sm)(Se)})]}),u&&(0,se.FD)(li.A,{icon:"link",onClick:he,multiline:!0,disabled:!g,children:[(0,se.Y)("span",{className:"title",children:ne("GroupInfo.InviteLinks")}),(0,se.Y)("span",{className:"subtitle",children:g?(0,Fn.Sm)(g.length):ne("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,se.FD)(li.A,{icon:"add-user-filled",onClick:me,multiline:!0,children:[(0,se.Y)("span",{className:"title",children:ne("MemberRequests")}),(0,se.Y)("span",{className:"subtitle",children:(0,Fn.Sm)(t.joinRequests.length)})]}),p&&(0,se.FD)(se.FK,{children:[(0,se.FD)(li.A,{icon:"forums",ripple:!0,onClick:Ce,children:[(0,se.Y)("span",{children:ne("ChannelTopics")}),(0,se.Y)(ci.A,{id:"group-notifications",label:ne("ChannelTopics"),checked:Q,inactive:!0})]}),(0,se.Y)("div",{className:"section-info section-info_push",children:ne("ForumToggleDescription")})]})]}),(0,se.FD)("div",{className:"section",children:[(0,se.FD)(li.A,{icon:"group",multiline:!0,onClick:Ae,children:[(0,se.Y)("span",{className:"title",children:ne("GroupMembers")}),(0,se.Y)("span",{className:"subtitle",children:(0,Fn.Sm)(t.membersCount??0)})]}),!ie&&!d&&Boolean(i)&&(0,se.Y)("div",{className:"ListItem narrow",ref:ae,children:(0,se.Y)(js.A,{className:"align-checkbox-with-list-buttons",checked:!i.isPreHistoryHidden,label:ne("ChatHistory"),onChange:fe,subLabel:i.isPreHistoryHidden?ne("ChatHistoryHiddenInfo2"):ne("ChatHistoryVisibleInfo"),disabled:!m})})]}),(0,se.Y)("div",{className:"section",children:(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:R,children:ne("DeleteMega")})})]}),(0,se.Y)(pi.A,{isShown:_,onClick:ge,disabled:we,ariaLabel:ne("Save"),iconName:"check",isLoading:we}),(0,se.Y)(ai.A,{isOpen:L,onClose:x,textParts:(0,Pt.A)(r||!t.isCreator?ne("AreYouSureDeleteAndExit"):ne("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:r||!t.isCreator?ne("DeleteMega"):ne("DeleteGroupForAll"),confirmHandler:ke,confirmIsDestructive:!0})]})})),$g=(0,s.ph)((0,n.EK)(e=>{const{errorKey:t,hint:i,isLoading:s}=e.twoFaSettings;return{error:t,hint:i,isLoading:s}})(({isOpen:e,title:t,confirmLabel:i,description:a,error:o,hint:r,isLoading:l,onClose:c,onSubmit:d})=>{const{checkPassword:h,clearTwoFaError:m}=(0,n.ko)(),u=(0,Fi.A)(),[p,v]=(0,s.J0)(!1),[g,A]=(0,s.J0)(""),f=(0,T.A)(e=>{A(e)}),C=(0,T.A)(()=>{h({currentPassword:g,onSuccess:()=>{d(g),A(""),v(!1)}})}),b=(0,T.A)(()=>{c(),m(),A(""),v(!1)});return(0,se.FD)(ai.A,{isOpen:e,title:t||u("EnterPassword"),confirmLabel:i||u("AutoDeleteConfirm"),confirmHandler:C,confirmIsDestructive:!0,onClose:b,children:[(0,se.Y)(Wd.A,{isBig:!0,isPasswordVisible:p}),a&&(0,se.Y)("p",{className:"vRYK2vZu",children:a}),(0,se.Y)(Il.A,{error:o&&u.withRegular(o),hint:r,isLoading:l,isPasswordVisible:p,onChangePasswordVisibility:v,onClearError:m,onInputChange:f})]})})),qg=(0,s.ph)((0,n.EK)((e,{chatId:t,isPromotedByCurrentUser:i,selectedUserId:s})=>{const n=(0,c.hds)(e,t),a=(0,c.AWZ)(e,t),{byId:o}=e.users,{currentUserId:r}=e,l=!(n.isCreator||i),d=a?.adminMembersById,h=s?d?.[s]:void 0,m=h&&(0,c.b0v)(e,{chatId:t,userId:h.userId,isAdmin:h.isAdmin,isOwner:h.isOwner});return{chat:n,usersById:o,currentUserId:r,isFormFullyDisabled:l,defaultRights:n.adminRights,hasFullInfo:Boolean(a),selectedAdminMember:h,canEditRank:m}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({isActive:e,isNewAdmin:t,selectedUserId:i,defaultRights:o,chat:r,usersById:c,currentUserId:d,selectedAdminMember:h,hasFullInfo:m,isFormFullyDisabled:u,canEditRank:p,onClose:v,onScreenSelect:g})=>{const{updateChatAdmin:A,transferChatOwnership:f,showNotification:C,openTwoFaCheckModal:b,verifyTransferOwnership:y}=(0,n.ko)(),[S,N]=(0,s.J0)({}),[k,w]=(0,s.J0)(Boolean(t)),[I,P]=(0,s.J0)(!1),[Y,F,M]=(0,D.A)(),[B,L,R]=(0,D.A)(),[x,E,V]=(0,D.A)(),[_,U]=(0,s.J0)(""),O=(0,Fi.A)(),K=(0,l.WX)(r),J=r.isForum,G=Boolean(r.linkedMonoforumId);(0,Ne.A)({isActive:e,onBack:v});const j=(0,s.Kr)(()=>{if(!t||!h&&i){if(t){const e=(0,n.mS)().users.byId[i];return e?{userId:e.id,adminRights:o,rank:O("ChannelAdmin"),isOwner:void 0,promotedByUserId:void 0}:void 0}return h}},[h,o,t,O,i]);(0,s.vJ)(()=>{m&&i&&!j&&g(a.je.ChatAdministrators)},[r,m,g,j,i]),(0,s.vJ)(()=>{N(j?.adminRights||{}),U((j?.rank||"").slice(0,16)),w(Boolean(t)),P(!1)},[o,t,j]);const z=(0,T.A)(e=>{const{name:t}=e.target;N(e=>{return{...e,[t]:(i=e[t],!i||void 0)};var i}),w(!0)}),H=(0,T.A)(()=>{if(!i)return;const e=_!==h?.rank;P(!0),A({chatId:r.id,userId:i,adminRights:S,rank:e?_:void 0})}),$=(0,T.A)(()=>{i&&(A({chatId:r.id,userId:i,adminRights:{}}),M())}),q=(0,T.A)(e=>!((0,l.yn)(r)||!u&&r.adminRights&&(r.isCreator||r.adminRights[e]))),W=(0,s.Kr)(()=>{if(t||!j)return;if(j.isOwner)return O("ChannelCreator");const e=j.promotedByUserId?c[j.promotedByUserId]:void 0;return e?O("EditAdminPromotedBy",{user:(0,l.Yg)(e)}):O("ChannelAdmin")},[t,j,c,O]),Q=(0,T.A)(e=>{const{value:t}=e.target;U(t),w(!0)}),Z=(0,T.A)(()=>{i&&y({chatId:r.id,userId:i,onSuccess:L,onPasswordMissing:b,onPasswordTooFresh:b,onSessionTooFresh:b})}),X=(0,T.A)(()=>{R(),E()}),te=(0,T.A)(e=>{if(!i)return;const t=c[i],s=t?(0,l.Yg)(t):"";f({chatId:r.id,userId:i,password:e,onSuccess:()=>{C({message:O(K?"EditAdminTransferChannelOwnershipSuccess":"EditAdminTransferGroupOwnershipSuccess",{user:s})})}}),V()}),ie=i?c[i]:void 0,ne=Boolean(r.isCreator&&ie&&!(0,l.tv)(ie)&&i!==d);if(j)return(0,se.FD)("div",{className:"Management",children:[(0,se.Y)("div",{className:"panel-content custom-scroll",children:(0,se.FD)("div",{className:"section",children:[(0,se.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,se.Y)(ms.A,{userId:j.userId,status:W,forceShowSelf:!0})}),(0,se.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:O("EditAdminWhatCanDo")}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"changeInfo",checked:Boolean(S.changeInfo),label:O(K?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:q("changeInfo"),onChange:z})}),K&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"postMessages",checked:Boolean(S.postMessages),label:O("EditAdminPostMessages"),blocking:!0,disabled:q("postMessages"),onChange:z})}),K&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"editMessages",checked:Boolean(S.editMessages),label:O("EditAdminEditMessages"),blocking:!0,disabled:q("editMessages"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"deleteMessages",checked:Boolean(S.deleteMessages),label:O(K?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:q("deleteMessages"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"postStories",checked:Boolean(S.postStories),label:O("EditAdminPostStories"),blocking:!0,disabled:q("postStories"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"editStories",checked:Boolean(S.editStories),label:O("EditAdminEditStories"),blocking:!0,disabled:q("editStories"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"deleteStories",checked:Boolean(S.deleteStories),label:O("EditAdminDeleteStories"),blocking:!0,disabled:q("deleteStories"),onChange:z})}),G&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"manageDirectMessages",checked:Boolean(S.manageDirectMessages),label:O("EditAdminManageDirect"),blocking:!0,disabled:q("manageDirectMessages"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"banUsers",checked:Boolean(S.banUsers),label:O("EditAdminBanUsers"),blocking:!0,disabled:q("banUsers"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"inviteUsers",checked:Boolean(S.inviteUsers),label:O("EditAdminAddUsers"),blocking:!0,disabled:q("inviteUsers"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"editRank",checked:Boolean(S.manageRanks),label:O("EditAdminEditRank"),blocking:!0,disabled:q("manageRanks"),onChange:z})}),!K&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"pinMessages",checked:Boolean(S.pinMessages),label:O("EditAdminPinMessages"),blocking:!0,disabled:q("pinMessages"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"addAdmins",checked:Boolean(S.addAdmins),label:O("EditAdminAddAdmins"),blocking:!0,disabled:q("addAdmins"),onChange:z})}),(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"manageCall",checked:Boolean(S.manageCall),label:O("StartVoipChatPermission"),blocking:!0,disabled:q("manageCall"),onChange:z})}),J&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"manageTopics",checked:Boolean(S.manageTopics),label:O("EditAdminManageTopics"),blocking:!0,disabled:q("manageTopics"),onChange:z})}),!K&&(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:"anonymous",checked:Boolean(S.anonymous),label:O("EditAdminSendAnonymously"),blocking:!0,disabled:q("anonymous"),onChange:z})}),u&&(0,se.Y)("p",{className:"section-info mb-4",dir:"auto",children:O("EditAdminUnavailable")}),!K&&(0,se.Y)(ee.A,{id:"admin-title",label:O("EditAdminRank"),className:"input-admin-title",onChange:Q,value:_,disabled:u||!p,maxLength:16}),ne&&d!==i&&!u&&!t&&(0,se.Y)(li.A,{icon:"key",ripple:!0,onClick:Z,children:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership")}),d!==i&&!u&&!t&&(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:F,children:O("EditAdminRemoveAdmin")})]})}),(0,se.Y)(pi.A,{isShown:k,onClick:H,ariaLabel:O("Save"),disabled:I,iconName:"check",isLoading:I}),!t&&(0,se.Y)(ai.A,{isOpen:Y,onClose:M,text:O("EditAdminConfirmDismissText"),confirmLabel:O("EditAdminConfirmDismiss"),confirmHandler:$,confirmIsDestructive:!0}),(0,se.Y)(ai.A,{isOpen:B,onClose:R,title:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership"),textParts:O("EditAdminTransferOwnershipText",{chat:r.title,user:i?(0,l.Yg)(c[i]):""},{withNodes:!0,withMarkdown:!0}),confirmLabel:O("EditAdminTransferChangeOwner"),confirmHandler:X}),(0,se.Y)($g,{isOpen:x,title:O(K?"EditAdminTransferChannelOwnership":"EditAdminTransferGroupOwnership"),confirmLabel:O("EditAdminTransferChangeOwner"),onClose:V,onSubmit:te})]})}));var Wg=i(23459),Qg=i(285);const Zg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{statusesById:s}=e.users,{members:n,adminMembersById:a,areParticipantsHidden:o}=(0,c.AWZ)(e,t)||{},r=i&&(0,l.WX)(i),{userIds:d}=e.contactList||{},h=e.appConfig.hiddenMembersMinCount,m=i&&(i.isCreator||(0,l.ub)(i,"banUsers")),u=m&&!(0,l.yn)(i)&&void 0!==i.membersCount&&void 0!==h&&i.membersCount>=h,p=i&&((0,l.ub)(i,"inviteUsers")||!r&&!(0,l.Sq)(i,"inviteUsers")||i.isCreator),{query:v,fetchingStatus:g,globalUserIds:A,localUserIds:f}=(0,c.nTw)(e).userSearch;return{areParticipantsHidden:Boolean(i&&o),members:n,canAddMembers:p,adminMembersById:a,userStatusesById:s,isChannel:r,localContactIds:d,searchQuery:v,isSearching:g,globalUserIds:A,localUserIds:f,canDeleteMembers:m,currentUserId:e.currentUserId,canHideParticipants:u}})(({chatId:e,noAdmins:t,members:i,canAddMembers:o,adminMembersById:r,userStatusesById:c,isChannel:d,isActive:h,globalUserIds:m,localContactIds:u,localUserIds:p,isSearching:v,searchQuery:g,currentUserId:A,canDeleteMembers:f,areParticipantsHidden:C,canHideParticipants:b,onClose:y,onScreenSelect:S,onChatMemberSelect:N})=>{const{openChat:k,setUserSearchQuery:w,closeManagement:I,toggleParticipantsHidden:P,setNewChatMembersDialogState:Y,toggleManagement:F}=(0,n.ko)(),D=(0,B.A)(),M=(0,s.li)(),L=(0,s.li)(),[R,x]=(0,s.J0)(),E=(0,s.Kr)(()=>t&&r?Object.keys(r):[],[r,t]),V=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId;if(!i||!e)return[];const s=(0,l.UB)(i.map(({userId:e})=>e),e,c);return t?s.filter(e=>!E.includes(e)):s},[i,c,t,E]);(0,Wg.A)(V);const _=(0,s.Kr)(()=>{const e=(0,n.mS)().users.byId,i=Boolean(g),s=i?u?(0,It.PU)({ids:u,query:g,type:"user"}):[]:V;return(0,Ss.A)((0,di.Am)([...s,...i&&p||[],...i&&m||[]]).filter(i=>{const s=e[i];return!s||(d||s.canBeInvitedToGroup||!(0,l.tv)(s))&&(!t||!E.includes(i))}),!0)},[V,u,g,p,m,d,t,E]),[U,O]=(0,Ms.A)(void 0,_,Boolean(g)),K=(0,T.A)(e=>{t?(N(e,!0),S(a.je.ChatNewAdminRights)):(I(),k({id:e}))}),J=(0,T.A)(e=>{w({query:e.target.value})}),G=(0,Bs.A)(L,h,e=>{U&&U.length>0&&K(U[-1===e?0:e])},".ListItem-button",!0),j=(0,T.A)(()=>{x(void 0)}),z=(0,T.A)(()=>{P({chatId:e,isEnabled:!C})}),H=(0,T.A)(()=>{F(),Y({newChatMembersProgress:a.D7.InProgress})});return(0,Ne.A)({isActive:h,onBack:y}),(0,se.FD)("div",{className:"Management",children:[t&&(0,se.Y)("div",{className:"Management__filter",dir:D.isRtl?"rtl":void 0,children:(0,se.Y)(ee.A,{ref:M,value:g,onChange:J,placeholder:D("Search")})}),(0,se.FD)("div",{className:"panel-content custom-scroll",children:[b&&!d&&(0,se.FD)("div",{className:"section",children:[(0,se.FD)(li.A,{icon:"group",ripple:!0,onClick:z,children:[(0,se.Y)("span",{children:D("ChannelHideMembers")}),(0,se.Y)(ci.A,{label:D("ChannelHideMembers"),checked:C})]}),(0,se.Y)("p",{className:"section-info",children:D(C?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff")})]}),(0,se.Y)("div",{className:"section",children:U?.length?(0,se.Y)(ls.A,{className:"picker-list custom-scroll",items:_,onLoadMore:O,noScrollRestore:Boolean(g),ref:L,onKeyDown:G,children:U.map(e=>{return(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item",onClick:()=>K(e),contextActions:(t=e,t!==A&&f?[{title:D("lng_context_remove_from_group"),icon:"stop",handler:()=>{x(t)}}]:void 0),withPortalForMenu:!0,children:(0,se.Y)(ms.A,{userId:e,forceShowSelf:!0,withStory:!0})},e);var t})}):v||!U||U.length?(0,se.Y)(Ls.A,{}):(0,se.Y)(Lc.A,{teactOrderKey:0,text:d?"No subscribers found":"No members found"},"nothing-found")})]}),o&&(0,se.Y)(pi.A,{isShown:!0,onClick:H,ariaLabel:D("lng_channel_add_users"),iconName:"add-user-filled"}),f&&(0,se.Y)(Qg.A,{isOpen:Boolean(R),userId:R,onClose:j})]})})),Xg=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{progress:n}=(0,c.nTw)(e).management,a=i?.paidMessagesStars,r=e.appConfig.starsPaidMessageCommissionPermille;return{chat:i,progress:n,currentUserId:e.currentUserId,removedUsersCount:s?.kickedMembers?.length||0,members:s?.members,arePaidMessagesAvailable:Boolean(s?.arePaidMessagesAvailable&&r),canChargeForMessages:Boolean(a&&r),groupPeersPaidStars:a||o.wZe}})(({onScreenSelect:e,onChatMemberSelect:t,chat:i,progress:o,currentUserId:r,removedUsersCount:l,members:c,onClose:d,isActive:h,arePaidMessagesAvailable:m,canChargeForMessages:u,groupPeersPaidStars:p})=>{const{updateChatDefaultBannedRights:v,updatePaidMessagesPrice:g}=(0,n.ko)(),{permissions:A,havePermissionChanged:f,isLoading:C,handlePermissionChange:b,setIsLoading:y}=ql(i?.defaultBannedRights),S=(0,B.A)(),N=(0,Fi.A)();(0,Ne.A)({isActive:h,onBack:d});const k=(0,s.hb)(()=>{e(a.je.GroupRemovedUsers)},[e]),w=(0,s.hb)(()=>{e(a.je.GroupUserPermissionsCreate)},[e]),I=(0,s.hb)(i=>{t(i.userId,i.promotedByUserId===r),e(a.je.GroupUserPermissions)},[r,t,e]),[P,Y]=(0,s.J0)(!1),[F,M,L]=(0,D.A)(),[R,x]=(0,s.J0)(u),[E,V]=(0,s.J0)(p);(0,s.vJ)(()=>{o===a.TD.Complete&&L()},[o]);const _=(0,T.A)(()=>{i&&(y(!0),v({chatId:i.id,bannedRights:A}))}),U=(0,T.A)(()=>{i&&g({chatId:i?.id,paidMessagesStars:R?E:0})}),O=(0,T.A)(()=>{F&&U(),f&&_()}),K=(0,s.Kr)(()=>c?c.filter(({bannedRights:e})=>Boolean(e)):[],[c]),J=(0,s.hb)(e=>{const{bannedRights:t}=e;if(!t||!i)return;const{defaultBannedRights:s}=i;return Object.keys(t).reduce((e,i)=>{const n=i;if(!t[n]||s?.[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)return e;const a=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";case"manageTopics":return"GroupPermission.NoManageTopics";case"sendPlain":return"UserRestrictionsNoSendText";case"sendDocs":return"UserRestrictionsNoSendDocs";case"sendRoundvideos":return"UserRestrictionsNoSendRound";case"sendVoices":return"UserRestrictionsNoSendVoice";case"sendAudios":return"UserRestrictionsNoSendMusic";case"sendVideos":return"UserRestrictionsNoSendVideos";case"sendPhotos":return"UserRestrictionsNoSendPhotos";default:return}}(n);if(!a)return e;const o=S(a);return`${e}${e.length?`, ${o}`:o}`},"")},[i,S]),G=(0,T.A)(()=>{x(!R),M()}),j=(0,T.A)(e=>{V(e),M()}),z=F||f,H=o===a.TD.InProgress||C;return(0,se.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 432px;--before-shift-height: 96px;",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section without-bottom-shadow",children:[(0,se.Y)("h3",{className:"section-heading",dir:"auto",children:N("ChannelPermissionsHeader")}),(0,se.Y)(Ql,{chatId:i?.id,isMediaDropdownOpen:P,setIsMediaDropdownOpen:Y,handlePermissionChange:b,permissions:A,dropdownClassName:"DropdownListTrap",className:(0,ge.A)("DropdownList",P&&"DropdownList--open"),shiftedClassName:(0,ge.A)("part",P&&"shifted")})]}),m&&(0,se.FD)("div",{className:(0,ge.A)("section",P&&"shifted"),children:[(0,se.FD)(li.A,{onClick:G,children:[(0,se.Y)("span",{children:N("GroupMessagesChargePrice")}),(0,se.Y)(ci.A,{id:"charge_for_messages",label:N("GroupMessagesChargePrice"),checked:R})]}),(0,se.Y)("p",{className:"settings-item-description-larger",dir:N.isRtl?"rtl":void 0,children:N("RightsChargeStarsAbout")})]}),R&&(0,se.Y)("div",{className:(0,ge.A)("section",P&&"shifted"),children:(0,se.Y)(rh,{canChangeChargeForMessages:!0,isGroupChat:!0,chargeForMessages:E,onChange:j})}),(0,se.Y)("div",{className:(0,ge.A)("section",P&&"shifted"),children:(0,se.FD)(li.A,{icon:"delete-user",multiline:!0,narrow:!0,onClick:k,children:[(0,se.Y)("span",{className:"title",children:N("ChannelBlockedUsers")}),(0,se.Y)("span",{className:"subtitle",children:l})]})}),(0,se.FD)("div",{className:(0,ge.A)("section",P&&"shifted"),children:[(0,se.Y)("h3",{className:"section-heading",dir:"auto",children:N("PrivacyExceptions")}),(0,se.Y)(li.A,{icon:"add-user",onClick:w,children:N("ChannelAddException")}),K.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable exceptions-member",onClick:()=>I(e),children:(0,se.Y)(ms.A,{userId:e.userId,status:J(e),forceShowSelf:!0})},e.userId))]})]}),(0,se.Y)(pi.A,{isShown:z,onClick:O,ariaLabel:N("Save"),disabled:H,iconName:"check",isLoading:H})]})})),eA=(0,s.ph)((0,n.EK)((e,{chatId:t,isPromotedByCurrentUser:i})=>{const s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t);return{chat:s,isFormFullyDisabled:!(s.isCreator||i),hasFullInfo:Boolean(n),members:n?.members}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({chat:e,selectedChatMemberId:t,hasFullInfo:i,members:o,onScreenSelect:r,isFormFullyDisabled:l,onClose:c,isActive:d})=>{const{updateChatMemberBannedRights:h}=(0,n.ko)(),m=(0,s.Kr)(()=>{if(o)return o.find(({userId:e})=>e===t)},[o,t]),{permissions:u,havePermissionChanged:p,isLoading:v,handlePermissionChange:g,setIsLoading:A}=ql(m?.bannedRights||e?.defaultBannedRights),[f,C,b]=(0,D.A)(),y=(0,Fi.A)(),S=(0,B.A)();(0,Ne.A)({isActive:d,onBack:c}),(0,s.vJ)(()=>{i&&t&&!m&&r(a.je.GroupPermissions)},[e,i,r,m,t]);const N=(0,s.hb)(()=>{e&&t&&(A(!0),h({chatId:e.id,userId:t,bannedRights:u}))},[e,t,A,h,u]),k=(0,s.hb)(()=>{e&&t&&h({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,h]),w=(0,s.hb)(t=>!!l||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,l]),[I,P]=(0,s.J0)(!1);if(m)return(0,se.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 431px;--before-shift-height: 192px;",children:[(0,se.FD)("div",{className:"custom-scroll",children:[(0,se.FD)("div",{className:"section without-bottom-shadow",children:[(0,se.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,se.Y)(ms.A,{userId:m.userId,forceShowSelf:!0})}),(0,se.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:S("UserRestrictionsCanDo")}),(0,se.Y)(Ql,{chatId:e?.id,isMediaDropdownOpen:I,setIsMediaDropdownOpen:P,handlePermissionChange:g,permissions:u,className:(0,ge.A)("DropdownList",I&&"DropdownList--open"),dropdownClassName:"DropdownListTrap",shiftedClassName:(0,ge.A)("part",I&&"shifted"),getControlIsDisabled:w})]}),!l&&(0,se.Y)("div",{className:(0,ge.A)("section",I&&"shifted"),children:(0,se.Y)(li.A,{icon:"delete-user",ripple:!0,destructive:!0,onClick:C,children:S("UserRestrictionsBlock")})})]}),(0,se.Y)(pi.A,{isShown:p,onClick:N,ariaLabel:S("Save"),disabled:v,iconName:"check",isLoading:v}),(0,se.Y)(ai.A,{isOpen:f,onClose:b,text:y("GroupManagementBanUserConfirm"),confirmLabel:"Remove",confirmHandler:k,confirmIsDestructive:!0})]})})),tA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s,statusesById:n}=e.users,a=(0,c.AWZ)(e,t)?.members;return{members:a,usersById:s,userStatusesById:n,isChannel:i&&(0,l.WX)(i)}})(({usersById:e,userStatusesById:t,members:i,isChannel:n,onScreenSelect:o,onChatMemberSelect:r,onClose:c,isActive:d})=>{(0,Ne.A)({isActive:d,onBack:c});const h=(0,s.Kr)(()=>{if(i&&e)return(0,l.UB)(i.filter(e=>!e.isOwner).map(({userId:e})=>e),e,t)},[i,e,t]),m=(0,s.hb)(e=>{r(e),o(a.je.GroupUserPermissions)},[r,o]);return(0,se.Y)("div",{className:"Management",children:(0,se.Y)("div",{className:"custom-scroll",children:(0,se.Y)("div",{className:"section",teactFastList:!0,children:h?h.map((e,t)=>(0,se.Y)(li.A,{teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e),children:(0,se.Y)(ms.A,{userId:e,forceShowSelf:!0})},e)):(0,se.Y)(Lc.A,{teactOrderKey:0,text:n?"No subscribers found":"No members found"},"nothing-found")})})})})),iA=[1,10,100],sA={hour:36e5,day:864e5,week:6048e5},nA=sA.hour,aA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{editingInvite:i}=(0,c.nTw)(e).management.byChatId[t]||{};return{editingInvite:i}})(({chatId:e,editingInvite:t,isActive:i,onClose:o,onScreenSelect:r})=>{const{editExportedChatInvite:l,exportChatInvite:c}=(0,n.ko)(),d=(0,B.A)(),[h,m,u]=(0,D.A)(),[p,v]=(0,s.J0)(!1),[g,A]=(0,s.J0)(""),[f,C]=(0,s.J0)(()=>Date.now()+nA),[b,y]=(0,s.J0)("unlimited"),[S,N]=(0,s.J0)(10),[k,w]=(0,s.J0)("0"),[I,P]=(0,s.J0)(!1);(0,Ne.A)({isActive:i,onBack:o}),(0,$.A)(([e])=>{if(e!==t)if(t){const{title:e,usageLimit:i,expireDate:s,isRequestNeeded:n}=t;if(e&&A(e),i&&(w(iA.includes(i)?i.toString():"custom"),N(i)),s){const e=(0,Ii.Fm)()+nA;y("custom"),C(1e3*Math.max(s,e))}n&&v(!0)}else A(""),y("unlimited"),w("0"),C(1e3*(0,Ii.Fm)()+nA),N(10),v(!1)},[t]);const Y=(0,s.hb)(e=>{v(e.target.checked)},[]),F=(0,s.hb)(e=>{A(e.target.value)},[]),M=(0,s.hb)(e=>{N(Number.parseInt(e.target.value,10))},[]),T=(0,s.hb)(e=>{C(e.getTime()),u()},[u]),L=(0,s.hb)(()=>{P(!0);const i="custom"===k?S:Number(k);let s;switch(b){case"custom":s=(0,Ii.Fm)()+(f-Date.now())/1e3;break;case"hour":case"day":case"week":s=(0,Ii.Fm)()+sA[b]/1e3;break;case"unlimited":s=0;break;default:s=void 0}t?l({link:t.link,chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}):c({chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}),r(a.je.Invites)},[e,f,S,l,t,c,p,b,k,g,r]);return(0,se.FD)("div",{className:"Management ManageInvite",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.Y)("div",{className:"section",children:(0,se.Y)(js.A,{label:d("ApproveNewMembers"),subLabel:d("ApproveNewMembersDescription"),checked:p,onChange:Y})}),(0,se.FD)("div",{className:"section",children:[(0,se.Y)(ee.A,{className:"link-name",placeholder:d("LinkNameHint"),value:g,onChange:F}),(0,se.Y)("p",{className:"section-help hint",children:d("LinkNameHelp")})]}),(0,se.FD)("div",{className:"section",children:[(0,se.Y)("div",{className:"section-heading",children:d("LimitByPeriod")}),(0,se.Y)(ie.A,{name:"expireOptions",options:[{value:"hour",label:d("Hours",1)},{value:"day",label:d("Days",1)},{value:"week",label:d("Weeks",1)},{value:"unlimited",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_expire_custom")}],onChange:y,selected:b}),"custom"===b&&(0,se.FD)(X.A,{className:"expire-limit",isText:!0,onClick:m,children:[(0,We.Lu)(d,f)," ",(0,We.fU)(d,f)]}),(0,se.Y)("p",{className:"section-help hint",children:d("TimeLimitHelp")})]}),!p&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)("div",{className:"section-heading",children:d("LimitNumberOfUses")}),(0,se.Y)(ie.A,{name:"usageOptions",options:[...iA.map(e=>({value:e.toString(),label:e})),{value:"0",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_usage_custom")}],onChange:w,selected:k}),"custom"===k&&(0,se.Y)("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:M}),(0,se.Y)("p",{className:"section-help hint",children:d("UsesLimitHelp")})]}),(0,se.Y)(pi.A,{isShown:!0,onClick:L,disabled:I,ariaLabel:d(t?"SaveLink":"CreateLink"),iconName:"check"})]}),(0,se.Y)(vn,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:u,onSubmit:T,selectedAt:f,submitButtonLabel:d("Save")})]})})),oA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{inviteInfo:i}=(0,c.nTw)(e).management.byChatId[t]||{},{invite:s,importers:n,requesters:a}=i||{},o=(0,c.hds)(e,t);return{invite:s,importers:n,requesters:a,isChannel:o&&(0,l.WX)(o)}})(({chatId:e,invite:t,importers:i,requesters:a,isChannel:o,isActive:r,onClose:l})=>{const{loadChatInviteImporters:c,loadChatInviteRequesters:d,openChat:h}=(0,n.ko)(),m=(0,B.A)(),{usage:u=0,usageLimit:p,link:v,adminId:g}=t||{},A=t?.expireDate&&1e3*(t.expireDate-(0,Ii.Fm)())+Date.now(),f=(t?.expireDate||0)-(0,Ii.Fm)()<0;return(0,s.vJ)(()=>{v&&(c({chatId:e,link:v}),d({chatId:e,link:v}))},[e,v,c,d]),(0,Ne.A)({isActive:r,onBack:l}),(0,se.Y)("div",{className:"Management ManageInviteInfo",children:(0,se.FD)("div",{className:"panel-content custom-scroll",children:[!t&&(0,se.Y)("p",{className:"section-help",children:m("Loading")}),t&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(qr.A,{title:t.title,link:t.link,className:"invite-link"}),Boolean(A)&&(0,se.Y)("p",{className:"section-help",children:f?m("ExpiredLink"):m("LinkExpiresIn",`${(0,We.Lu)(m,A)} ${(0,We.fU)(m,A)}`)})]}),g&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)("p",{className:"section-heading",children:m("LinkCreatedeBy")}),(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:g}),children:(0,se.Y)(ms.A,{userId:g,status:(0,We.fS)(m,1e3*t.date,!0),forceShowSelf:!0})})]}),(()=>{if(i?.length||!a?.length)return i?(0,se.FD)("div",{className:"section",children:[(0,se.Y)("p",{className:"section-heading",children:i.length?m("PeopleJoined",u):m("NoOneJoined")}),(0,se.FD)("p",{className:"section-help",children:[!i.length&&(p?m("PeopleCanJoinViaLinkCount",p-u):m("NoOneJoinedYet")),i.map(e=>{const t=(0,We.fS)(m,1e3*e.date,!0),i=e.isFromChatList?`${t}${m("JoinedViaFolder")}`:t;return(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,se.Y)(ms.A,{userId:e.userId,status:i,forceShowSelf:!0})})})]})]}):(0,se.Y)(Ue.A,{})})(),(()=>{if(!t?.isRevoked){if(!a&&i)return(0,se.Y)(Ue.A,{});if(a?.length)return(0,se.FD)("div",{className:"section",children:[(0,se.Y)("p",{className:"section-heading",children:m(o?"SubscribeRequests":"MemberRequests")}),(0,se.Y)("p",{className:"section-help",children:a.map(e=>(0,se.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,se.Y)(ms.A,{userId:e.userId,status:(0,We.fS)(m,1e3*e.date,!0),forceShowSelf:!0})}))})]})}})()]})]})})})),rA="•";function lA(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 cA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{invites:i,revokedInvites:s}=(0,c.nTw)(e).management.byChatId[t]||{},n=(0,c.hds)(e,t);return{exportedInvites:i,revokedExportedInvites:s,chat:n,isChannel:n&&(0,l.WX)(n)}})(({chatId:e,chat:t,exportedInvites:i,revokedExportedInvites:r,isActive:c,isChannel:d,onClose:h,onScreenSelect:m})=>{const{setEditingExportedInvite:u,showNotification:p,editExportedChatInvite:v,deleteExportedChatInvite:g,deleteRevokedExportedChatInvites:A,setOpenedInviteInfo:f}=(0,n.ko)(),C=(0,Fi.A)(),b=(0,B.A)(),[y,S,N]=(0,D.A)(),[k,w,I]=(0,D.A)(),[P,Y]=(0,s.J0)(),[F,T,L]=(0,D.A)(),[R,x]=(0,s.J0)();(0,Ne.A)({isActive:c,onBack:h});const E=(0,s.Kr)(()=>{if(i)return i.some(({expireDate:e})=>e&&e-(0,Ii.Fm)()<We.il/1e3)},[i]),V=(0,M.A)();(0,Sn.A)(V,E?1e3:void 0);const _=(0,s.Kr)(()=>t&&(0,l.Kl)(t),[t]),U=i?.find(({isPermanent:e})=>e),O=_?`${o.jsp}${_}`:U?.link,K=(0,s.Kr)(()=>{const e=t?.hasUsername?i:i?.filter(({isPermanent:e})=>!e);return e?.sort(lA)},[t?.hasUsername,i]),J=(0,s.hb)(t=>{const{link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o}=t;v({chatId:e,link:i,title:s,isRequestNeeded:n,expireDate:a,usageLimit:o,isRevoked:!0})},[e,v]),G=(0,s.hb)(e=>{Y(e),w()},[w]),j=(0,s.hb)(()=>{P&&(J(P),Y(void 0),I())},[I,J,P]),z=(0,s.hb)(()=>{m(a.je.EditInvite)},[m]),H=(0,s.hb)(()=>{U&&G(U)},[G,U]),$=(0,s.hb)(()=>{A({chatId:e}),N()},[e,N,A]),q=(0,s.hb)(t=>{f({chatId:e,invite:t}),m(a.je.InviteInfo)},[e,m,f]),W=(0,s.hb)(t=>{g({chatId:e,link:t.link})},[e,g]),Q=(0,s.hb)(e=>{x(e),T()},[T]),Z=(0,s.hb)(()=>{R&&(W(R),x(void 0),L())},[L,W,R]),X=(0,s.hb)(e=>{(0,wc.eM)(e),p({message:b("LinkCopied")})},[b,p]),ee=e=>{const{usage:t=0,usageLimit:i,expireDate:s,isPermanent:n,requested:a,isRevoked:o}=e;let r="";if(r=!o&&i&&t<i?b("CanJoin",i-t):t?b("PeopleJoined",t):b("NoOneJoined"),o)return r+=` ${rA} ${b("Revoked")}`,r;if(a&&(r+=` ${rA} ${b("JoinRequests",a)}`),void 0!==i&&t===i)r+=` ${rA} ${b("LinkLimitReached")}`;else if(s){const e=s-(0,Ii.Fm)();r+=` ${rA} `,r+=e>0?b("InviteLink.ExpiresIn",(0,We.zt)(C,e)):b("InviteLink.Expired")}else n&&(r+=` ${rA} ${b("Permanent")}`);return r},te=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,Ii.Fm)())<=0?"link-status-icon-red":"link-status-icon-blue"},ie=t=>{const i=[];return i.push({title:b("Copy"),icon:"copy",handler:()=>X(t.link)}),t.isPermanent||t.isRevoked||i.push({title:b("Edit"),icon:"edit",handler:()=>(t=>{u({chatId:e,invite:t}),m(a.je.EditInvite)})(t)}),t.isRevoked?i.push({title:b("DeleteLink"),icon:"delete",handler:()=>Q(t),destructive:!0}):i.push({title:b("RevokeButton"),icon:"delete",handler:()=>G(t),destructive:!0}),i};return(0,se.FD)("div",{className:"Management ManageInvites",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.Invite,size:o.xMZ,className:"section-icon"}),(0,se.Y)("p",{className:"section-help",children:b(d?"PrimaryLinkHelpChannel":"PrimaryLinkHelp")})]}),O&&(0,se.Y)("div",{className:"section",children:(0,se.Y)(qr.A,{className:"settings-input",link:O,withShare:!0,onRevoke:t?.usernames?void 0:H,title:b(t?.usernames?"PublicLink":"lng_create_permanent_link_title")})}),(0,se.FD)("div",{className:"section",teactFastList:!0,children:[(0,se.Y)(li.A,{icon:"add",withPrimaryColor:!0,className:"create-item",onClick:z,children:b("CreateNewLink")},"create"),(!K||!K.length)&&(0,se.Y)(Lc.A,{text:"No links found"},"nothing"),K?.map(e=>(0,se.FD)(li.A,{leftElement:(0,se.Y)(he.A,{name:"link",className:`link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ie(e),children:[(0,se.Y)("span",{className:"title invite-title",children:e.title||e.link}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:ee(e)})]},e.link)),(0,se.Y)("p",{className:"section-help hint",children:b("ManageLinksInfoHelp")},"links-hint")]}),r&&Boolean(r.length)&&(0,se.FD)("div",{className:"section",teactFastList:!0,children:[(0,se.Y)("p",{className:"section-help",children:b("RevokedLinks")},"title"),(0,se.Y)(li.A,{icon:"delete",destructive:!0,onClick:S,children:(0,se.Y)("span",{className:"title",children:b("DeleteAllRevokedLinks")})},"delete"),r?.map(e=>(0,se.FD)(li.A,{leftElement:(0,se.Y)(he.A,{name:"link",className:`link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>q(e),contextActions:ie(e),children:[(0,se.Y)("span",{className:"title",children:e.title||e.link}),(0,se.Y)("span",{className:"subtitle",dir:"auto",children:ee(e)})]},e.link))]})]}),(0,se.Y)(ai.A,{isOpen:y,onClose:N,title:b("DeleteAllRevokedLinks"),text:b("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("DeleteAll"),confirmHandler:$}),(0,se.Y)(ai.A,{isOpen:k,onClose:I,title:b("RevokeLink"),text:b("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:b("RevokeButton"),confirmHandler:j}),(0,se.Y)(ai.A,{isOpen:F,onClose:L,title:b("DeleteLink"),text:b("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:b("Delete"),confirmHandler:Z})]})})),dA=(0,s.ph)((0,n.EK)((e,{userId:t})=>({user:(0,c.mBe)(e,t)}))(({userId:e,chatId:t,about:i,date:a,isChannel:o,user:r})=>{const{openChat:c,hideChatJoinRequest:d}=(0,n.ko)(),h=(0,ge.x)("JoinRequest"),m=(0,B.A)(),u=(0,l.Yg)(r),p=1e3*(a-(0,Ii.Fm)())+Date.now(),v=(0,We.cK)(new Date(p))?(0,We.fU)(m,p):(0,We.F5)(m,p,!0,!1,!0),g=(0,s.hb)(()=>{d({chatId:t,userId:e,isApproved:!0})},[t,d,e]),A=(0,s.hb)(()=>{d({chatId:t,userId:e,isApproved:!1})},[t,d,e]);return(0,se.FD)("div",{className:h("&"),children:[(0,se.FD)("div",{className:h("top"),children:[(0,se.FD)("div",{className:h("user"),onClick:()=>{c({id:e})},children:[(0,se.Y)(Yt.A,{size:"medium",peer:r},e),(0,se.FD)("div",{className:h("user-info"),children:[(0,se.Y)("div",{className:h("user-name"),children:u}),(0,se.Y)("div",{className:h("user-subtitle"),children:i})]})]}),(0,se.Y)("div",{className:h("date"),children:v})]}),(0,se.FD)("div",{className:h("buttons"),children:[(0,se.Y)(X.A,{className:h("button"),onClick:g,children:m(o?"ChannelAddToChannel":"ChannelAddToGroup")}),(0,se.Y)(X.A,{className:h("button"),isText:!0,onClick:A,children:m("DismissRequest")})]})]})})),hA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,isChannel:i&&(0,l.WX)(i)}})(({chat:e,chatId:t,isActive:i,isChannel:a,onClose:r})=>{const{hideAllChatJoinRequests:l,loadChatJoinRequests:c}=(0,n.ko)(),[d,h,m]=(0,D.A)(),[u,p,g]=(0,D.A)(),A=(0,B.A)();(0,Ne.A)({isActive:i,onBack:r}),(0,s.vJ)(()=>{e?.joinRequests||(0,v.L8)(t)||c({chatId:t})},[e,t,c]);const f=(0,s.hb)(()=>{l({chatId:t,isApproved:!0}),m()},[l,t,m]),C=(0,s.hb)(()=>{l({chatId:t,isApproved:!1}),g()},[l,t,g]);return(0,se.FD)("div",{className:"Management ManageJoinRequests",children:[(0,se.FD)("div",{className:"custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(Ma.A,{tgsUrl:Da.w.JoinRequest,size:o.OMf,className:"section-icon"}),Boolean(e?.joinRequests?.length)&&(0,se.FD)("div",{className:"bulk-actions",children:[(0,se.Y)(X.A,{className:"bulk-action-button",onClick:h,children:"Accept all"}),(0,se.Y)(X.A,{className:"bulk-action-button",onClick:p,isText:!0,children:"Dismiss all"})]})]}),(0,se.FD)("div",{className:"section",teactFastList:!0,children:[(0,se.Y)("p",{children:e?.joinRequests?e.joinRequests.length?A("JoinRequests",e.joinRequests.length):A("NoMemberRequests"):A("Loading")},"title"),!e?.joinRequests&&(0,se.Y)(Ue.A,{},"loading"),0===e?.joinRequests?.length&&(0,se.Y)("p",{className:"section-help",children:A(a?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")},"empty"),e?.joinRequests?.map(({userId:e,about:i,date:s})=>(0,se.Y)(dA,{userId:e,about:i,date:s,isChannel:a,chatId:t},e))]})]}),(0,se.Y)(ai.A,{isOpen:d,onClose:m,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:f}),(0,se.Y)(ai.A,{isOpen:u,onClose:g,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:C})]})})),mA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{maxUniqueReactions:s}=e.appConfig,n=(0,c.AWZ)(e,t),a=n?.reactionsLimit||s,o=(0,l.WX)(i);return{enabledReactions:n?.enabledReactions,availableReactions:e.reactions.availableReactions,chat:i,maxUniqueReactions:s,reactionsLimit:a,isChannel:o}},(e,{chatId:t})=>Boolean((0,c.hds)(e,t)))(({availableReactions:e,enabledReactions:t,chat:i,isActive:a,onClose:o,maxUniqueReactions:r,reactionsLimit:c,isChannel:d})=>{const{setChatEnabledReactions:h}=(0,n.ko)(),m=(0,B.A)(),[u,p]=(0,s.J0)(!1),[v,g]=(0,s.J0)(!1),[A,f]=(0,s.J0)(t),[C,b]=(0,s.J0)(c);(0,Ne.A)({isActive:a,onBack:o});const y=(0,s.Kr)(()=>[{value:"all",label:m("AllReactions")},{value:"some",label:m("SomeReactions")},{value:"none",label:m("NoReactions")}],[m]),S=(0,s.hb)(()=>{i&&(g(!0),h({chatId:i.id,enabledReactions:A,reactionsLimit:C}))},[i,A,h,C]);(0,s.vJ)(()=>{g(!1),p(!1),f(t),b(c)},[t,c]);const N=(0,s.Kr)(()=>e?.filter(({isInactive:e})=>!e),[e]);(0,s.vJ)(()=>{if(void 0===C||C===c){if("some"===A?.type&&"all"!==t?.type&&"some"!==t?.type&&0===A.allowed.length)return void p(!1);if(A?.type===t?.type){if("some"===A?.type&&"some"===t?.type){const e=A.allowed,i=t?.allowed;if(e.length!==i.length||e.reverse().some(e=>!i.find(t=>(0,l.a0)(e,t))))return void p(!0)}p(!1)}else p(!0)}else p(!0)},[C,c,A,t]);const k=(0,s.hb)(e=>{"all"===e?(f({type:"all"}),b(c)):"some"===e?(f({type:"some",allowed:"some"===t?.type?t.allowed:[]}),b(c)):(f(void 0),b(void 0))},[t,c]),w=(0,s.hb)(e=>{if(!i||!N)return;const{name:t,checked:s}=e.currentTarget;if("some"===A?.type){const e={emoticon:t};f(s?{type:"some",allowed:[...A.allowed,e]}:{type:"some",allowed:A.allowed.filter(t=>!(0,l.a0)(t,e))})}},[N,i,A]),I=(0,s.hb)(e=>{b(e)},[]),P=(0,s.hb)(e=>m("PeerInfo.AllowedReactions.MaxCountValue",e),[m]),Y=d&&("all"===A?.type||"some"===A?.type);return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"panel-content custom-scroll",children:[Boolean(C&&Y)&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)("h3",{className:"section-heading",children:m("MaximumReactionsHeader")}),(0,se.Y)(Xe.A,{min:1,max:r,value:C,onChange:I,renderValue:P,isCenteredLayout:!0}),(0,se.Y)("p",{className:"section-info section-info_push",children:m("ChannelReactions.MaxCount.Info")})]}),(0,se.FD)("div",{className:"section",children:[(0,se.Y)("h3",{className:"section-heading",children:m("AvailableReactions")}),(0,se.Y)(ie.A,{selected:A?.type||"none",name:"reactions",options:y,onChange:k}),(0,se.FD)("p",{className:"section-info section-info_push",children:["all"===A?.type&&m("EnableAllReactionsInfo"),"some"===A?.type&&m("EnableSomeReactionsInfo"),!A&&m("DisableReactionsInfo")]})]}),"some"===A?.type&&(0,se.FD)("div",{className:"section section-with-fab",children:[(0,se.Y)("h3",{className:"section-heading",children:m("OnlyAllowThisReactions")}),N?.map(({reaction:t,title:i})=>(0,se.Y)("div",{className:"ListItem",children:(0,se.Y)(js.A,{name:t.emoticon,checked:A?.allowed.some(e=>(0,l.a0)(t,e)),label:(0,se.FD)("div",{className:"Reaction",children:[(0,se.Y)(us.A,{reaction:t,availableReactions:e}),i]}),withIcon:!0,onChange:w})}))]})]}),(0,se.Y)(pi.A,{isShown:u,onClick:S,ariaLabel:m("Save"),disabled:v,iconName:"check",isLoading:v})]})})),uA="Please provide first name",pA=(0,s.ph)((0,n.EK)((e,{userId:t})=>{const i=(0,c.mBe)(e,t),s=(0,c.hds)(e,t),n=(0,c.vGo)(e,t),{progress:a}=(0,c.nTw)(e).management,o=s&&(0,Ec.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),r=n?.personalPhoto,l=n?.profilePhoto||n?.fallbackPhoto,d=n?.note?.text;return{user:i,progress:a,isMuted:o,personalPhoto:r,notPersonalPhoto:l,noteText:d,contactNoteLimit:e.appConfig?.contactNoteLimit||An.tI}})(({userId:e,user:t,progress:i,isMuted:r,onClose:c,isActive:d,personalPhoto:h,notPersonalPhoto:m,noteText:u,contactNoteLimit:p})=>{const{updateContact:v,updateContactNote:g,deleteContact:A,closeManagement:f,uploadContactProfilePhoto:C,updateChatMutedState:b}=(0,n.ko)(),[y,S,N]=(0,D.A)(),[k,w,I]=(0,D.A)(),[P,Y,F]=(0,D.A)(),[M,T]=(0,s.J0)(),[L,R,x]=(0,D.A)(),E=(0,B.A)(),V=(0,Fi.A)();(0,Ne.A)({isActive:d,onBack:c});const _=t&&t.firstName||"",U=t&&t.lastName||"",O=u||"",[K,J]=(0,s.J0)(_),[G,j]=(0,s.J0)(U),[z,H]=(0,s.J0)(O),[$,q]=(0,s.J0)(!r);(0,s.vJ)(()=>{q(!r)},[r]),(0,s.vJ)(()=>{F(),x(),N()},[N,e]),(0,s.vJ)(()=>{J(_),j(U),H(O)},[_,U,O]),(0,s.vJ)(()=>{i===a.TD.Complete&&(F(),T(void 0),N())},[N,i]);const W=(0,s.hb)(e=>{J(e.target.value),Y(),M===uA&&T(void 0)},[M]),Q=(0,s.hb)(e=>{j(e.target.value),Y()},[]),Z=(0,s.hb)(e=>{H(e.target.value),Y()},[]),X=(0,s.hb)(e=>{q(e.target.checked),R(),Y()},[]),te=(0,s.hb)(()=>{const t=K.trim(),i=G.trim(),s=z.trim();t.length?(ne.current?.blur(),ae.current?.blur(),oe.current?.blur(),v({userId:e,firstName:t,lastName:i}),s!==O&&g({userId:e,note:{text:s,entities:[]}}),L&&b({chatId:e,mutedUntil:$?o.Os5:o.xEh})):T(uA)},[O,K,$,L,G,z,e]),ie=(0,s.hb)(()=>{A({userId:e}),N(),f()},[N,f,A,e]),ne=(0,s.li)(),ae=(0,s.li)(),oe=(0,s.li)(),re=(0,s.li)(),le=(0,s.li)(!1),ce=(0,s.hb)(()=>{re.current?.click(),le.current=!0},[]),de=(0,s.hb)(()=>{re.current?.click(),le.current=!1},[]),he=(0,s.hb)(()=>{I(),Y(),C({userId:e})},[I,C,e]),me=(0,s.hb)(t=>{Y(),C({userId:e,file:t,isSuggest:le.current})},[C,e]);if(!t)return;const ue=!(0,l.tv)(t)&&t.id!==o.zv8,pe=i===a.TD.InProgress,ve=p-z.length;return(0,se.FD)("div",{className:"Management",children:[(0,se.FD)("div",{className:"custom-scroll",children:[(0,se.FD)("div",{className:"section",children:[(0,se.Y)(ms.A,{userId:t.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),(0,se.FD)("div",{className:"settings-edit",children:[(0,se.Y)(ee.A,{ref:ne,id:"user-first-name",label:E("UserInfo.FirstNamePlaceholder"),onChange:W,value:K,error:M===uA?M:void 0}),(0,se.Y)(ee.A,{ref:ae,id:"user-last-name",label:E("UserInfo.LastNamePlaceholder"),onChange:Q,value:G}),(0,se.Y)(fn.A,{ref:oe,id:"user-note",label:V("UserNoteTitle"),onChange:Z,value:z,maxLength:p,maxLengthIndicator:ve.toString(),noReplaceNewlines:!0})]}),(0,se.Y)("p",{className:"section-edit-info",dir:"auto",children:V("EditUserNoteHint")}),(0,se.Y)("div",{className:"ListItem narrow",children:(0,se.Y)(js.A,{checked:$,label:E("Notifications"),subLabel:E($?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:X})})]}),ue&&(0,se.FD)("div",{className:"section",children:[(0,se.Y)(li.A,{icon:"camera-add",ripple:!0,onClick:ce,children:(0,se.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SuggestPhoto",t.firstName)})}),(0,se.Y)(li.A,{icon:"camera-add",ripple:!0,onClick:de,children:(0,se.Y)("span",{className:"list-item-ellipsis",children:E("UserInfo.SetCustomPhoto",t.firstName)})}),h&&(0,se.Y)(li.A,{leftElement:(0,se.Y)(Yt.A,{photo:m,noPersonalPhoto:!0,peer:t,size:"mini",className:"personal-photo"}),ripple:!0,onClick:w,children:E("UserInfo.ResetCustomPhoto")}),(0,se.Y)("p",{className:"section-help",dir:"auto",children:E("UserInfo.CustomPhotoInfo",t.firstName)})]}),(0,se.Y)("div",{className:"section",children:(0,se.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:S,children:E("DeleteContact")})})]}),(0,se.Y)(pi.A,{isShown:P,onClick:te,disabled:pe,ariaLabel:E("Save"),iconName:"check",isLoading:pe}),(0,se.Y)(ai.A,{isOpen:y,onClose:N,text:E("AreYouSureDeleteContact"),confirmLabel:E("DeleteContact"),confirmHandler:ie,confirmIsDestructive:!0}),(0,se.Y)(ai.A,{isOpen:k,onClose:I,text:E("UserInfo.ResetToOriginalAlertText",t.firstName),confirmLabel:E("Reset"),confirmHandler:he,confirmIsDestructive:!0}),(0,se.Y)(Nm.A,{onChange:me,inputRef:re})]})})),vA=(0,s.ph)((0,n.EK)((e,{chatId:t})=>{const{progress:i,error:s}=(0,c.nTw)(e).chatCreation||{};return{chat:(0,c.hds)(e,t),creationProgress:i,creationError:s}})(({chat:e,onClose:t,isActive:i,creationProgress:o,creationError:r})=>{const{createChannel:l}=(0,n.ko)(),c=(0,Fi.A)();(0,Ne.A)({isActive:i,onBack:t});const[d,h]=(0,s.J0)(()=>c("NewDiscussionChatTitle",{name:e?.title})),[m,u]=(0,s.J0)(),[p,v]=(0,s.J0)(),g=o===a.n7.InProgress,A=(0,T.A)(e=>{const{value:t}=e.currentTarget,i=t.trimStart();h(i),i!==t&&(e.currentTarget.value=i)}),f=r&&c("NewChatTitleEmptyError")||(p!==c("NewChatTitleEmptyError")&&p!==c("NewChannelTitleEmptyError")?p:void 0),C=(0,T.A)(()=>{d.length?e&&l({discussionChannelId:e.id,title:d,photo:m,isSuperGroup:!0}):v(c("NewChatTitleEmptyError"))});return(0,se.Y)("div",{className:"Management",children:(0,se.Y)("div",{className:"panel-content custom-scroll",children:(0,se.FD)("div",{className:"NewChat",children:[(0,se.FD)("div",{className:"NewChat-inner step-2",children:[(0,se.Y)(Bh.A,{onChange:u,title:c("AddPhoto")}),(0,se.Y)(ee.A,{value:d,onChange:A,label:c("GroupName"),error:p===c("NewChatTitleEmptyError")||p===c("NewChannelTitleEmptyError")?p:void 0}),f&&(0,se.Y)("p",{className:"error",children:f})]}),(0,se.Y)(pi.A,{isShown:0!==d.length,onClick:C,disabled:g,ariaLabel:c("DiscussionCreateGroup"),iconName:"arrow-right",isLoading:g})]})})})})),gA=(0,s.ph)((0,n.EK)(e=>({managementType:(0,c.vn8)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,onChatMemberSelect:o,onClose:r,isActive:l,managementType:c})=>{switch(t){case a.je.Initial:switch(c){case"bot":return(0,se.Y)(Rg,{userId:e,onClose:r,isActive:l},e);case"user":return(0,se.Y)(pA,{userId:e,onClose:r,isActive:l},e);case"group":return(0,se.Y)(Hg,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[a.je.ChatPrivacyType,a.je.Discussion,a.je.GroupPermissions,a.je.ChatAdministrators,a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t)},e);case"channel":return(0,se.Y)(Eg,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[a.je.ChannelSubscribers,a.je.ChatAdministrators,a.je.ChannelRemovedUsers,a.je.Discussion,a.je.ChatPrivacyType,a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t)},e)}break;case a.je.ChatPrivacyType:return(0,se.Y)(_g,{chatId:e,isActive:l,onClose:r});case a.je.Discussion:return(0,se.Y)(Kg,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case a.je.GroupPermissions:return(0,se.Y)(Xg,{chatId:e,onScreenSelect:n,onChatMemberSelect:o,isActive:l||[a.je.GroupRemovedUsers,a.je.GroupUserPermissionsCreate,a.je.GroupUserPermissions].includes(t),onClose:r});case a.je.ChannelRemovedUsers:case a.je.GroupRemovedUsers:return(0,se.Y)(Og,{chatId:e,isActive:l,onClose:r});case a.je.GroupUserPermissionsCreate:return(0,se.Y)(tA,{chatId:e,onChatMemberSelect:o,onScreenSelect:n,isActive:l||[a.je.GroupUserPermissions].includes(t),onClose:r});case a.je.GroupUserPermissions:return(0,se.Y)(eA,{chatId:e,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChatAdministrators:return(0,se.Y)(Vg,{chatId:e,onScreenSelect:n,onChatMemberSelect:o,isActive:l||[a.je.ChatAdminRights,a.je.ChatNewAdminRights,a.je.GroupRecentActions].includes(t),onClose:r});case a.je.NewDiscussionGroup:return(0,se.Y)(vA,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChatNewAdminRights:case a.je.ChatAdminRights:return(0,se.Y)(qg,{chatId:e,isNewAdmin:t===a.je.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case a.je.ChannelSubscribers:case a.je.GroupMembers:return(0,se.Y)(Zg,{chatId:e,isActive:l,onClose:r});case a.je.Invites:return(0,se.Y)(cA,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case a.je.EditInvite:return(0,se.Y)(aA,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case a.je.GroupAddAdmins:return(0,se.Y)(Zg,{chatId:e,noAdmins:!0,isActive:l,onClose:r,onScreenSelect:n,onChatMemberSelect:o});case a.je.Reactions:return(0,se.Y)(mA,{chatId:e,isActive:l,onClose:r});case a.je.InviteInfo:return(0,se.Y)(oA,{chatId:e,isActive:l,onClose:r});case a.je.JoinRequests:return(0,se.Y)(hA,{chatId:e,isActive:l,onClose:r})}})),AA=/^4\d/,fA=/^5[1-5]/,CA=/^2[2-7]\d{2}/,bA=/^220[0-4]/;let yA=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 SA={[yA.Default]:"",[yA.Visa]:"visa",[yA.Mastercard]:"mastercard",[yA.Mir]:"mir"};function NA(e){return e=e.replace(/\s/g,""),AA.test(e)?yA.Visa:bA.test(e)?yA.Mir:fA.test(e)||CA.test(e)?yA.Mastercard:yA.Default}const kA={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},wA=(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{...kA};default:return e}};var IA=i(37960);const PA={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"},YA=(0,s.ph)(({title:e,description:t,photo:i,invoice:o,shippingPrices:r,checkoutInfo:c,totalPrice:d,isTosAccepted:h,dispatch:m,onAcceptTos:u,tipAmount:p,needAddress:v,hasShippingOptions:g,savedCredentials:A,isPaymentFormUrl:f,botName:C})=>{const{setPaymentStep:b}=(0,n.ko)(),y=(0,B.A)(),S=(0,Fi.A)(),N=Boolean(m),{termsUrl:k,suggestedTipAmounts:w,maxTipAmount:I}=o||{},{paymentMethod:P,paymentProvider:Y,shippingAddress:F,name:D,phone:M,shippingMethod:T}=c||{},L=(0,q.A)((0,l.cy)(i)),{ref:R}=(0,IA.A)({hasMediaData:Boolean(L)}),x=(0,s.hb)(e=>{m({type:"setTipAmount",payload:I?Math.min(e,I):e})},[m,I]),E=(0,s.hb)(()=>{b({step:A?.length?a.tn.SavedPayments:a.tn.PaymentInfo})},[A?.length,b]),V=(0,s.hb)(()=>{b({step:a.tn.ShippingInfo})},[b]),_=(0,s.hb)(()=>{b({step:a.tn.Shipping})},[b]);return(0,se.FD)("div",{className:PA.root,children:[(0,se.FD)("div",{className:PA.description,children:[L&&(0,se.Y)("img",{ref:R,className:PA.checkoutPicture,src:L,draggable:!1,width:i.dimensions?.width,height:i.dimensions?.height,alt:""}),!L&&i&&(0,se.Y)(Ei.A,{width:i.dimensions?.width,height:i.dimensions?.height,className:PA.checkoutPicture,animation:"pulse",forceAspectRatio:!0}),(0,se.FD)("div",{className:PA.text,children:[(0,se.Y)("h5",{className:PA.checkoutTitle,children:e}),t&&(0,se.Y)("div",{className:PA.checkoutDescription,children:(0,Pt.A)(t,["br","links","emoji"])})]})]}),(0,se.FD)("div",{className:PA.priceInfo,children:[o.prices.map(e=>FA(S,e.label,e.amount,o.currency)),r&&r.map(e=>FA(S,e.label,e.amount,o.currency)),w&&w.length>0&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:PA.priceInfoItem,children:[(0,se.Y)("div",{className:PA.priceInfoItemTitle,children:e}),(0,se.Y)("div",{children:(0,va.vv)(S,p,o.currency)})]}),(0,se.Y)("div",{className:PA.tipsList,children:w.map(e=>(0,se.Y)("div",{className:(0,ge.A)(PA.tipsItem,e===p&&PA.tipsItem_active),onClick:m?()=>x(e===p?0:e):void 0,children:(0,va.vv)(S,e,o.currency,{shouldOmitFractions:!0})},e))})]}),void 0!==d&&FA(S,y("Checkout.TotalAmount"),d,o.currency,!0)]}),(0,se.FD)("div",{className:PA.invoiceInfo,children:[!f&&DA({title:P||A?.[0].title,label:y("PaymentCheckoutMethod"),icon:"card",onClick:N?E:void 0}),Y&&DA({title:Y,label:y("PaymentCheckoutProvider"),customIcon:(0,ge.A)(PA.provider,PA[Y.toLowerCase()])}),(v||!N&&F)&&DA({title:F,label:y("PaymentShippingAddress"),icon:"location",onClick:N?V:void 0}),D&&DA({title:D,label:y("PaymentCheckoutName"),icon:"user"}),M&&DA({title:M,label:y("PaymentCheckoutPhoneNumber"),icon:"phone"}),(g||!N&&T)&&DA({title:T,label:y("PaymentCheckoutShippingMethod"),icon:"truck",onClick:N?_:void 0}),k&&(U=k,(0,se.Y)(js.A,{label:function(e,t){const i=y("PaymentCheckoutAcceptRecurrent",C).split("*");return(0,se.FD)(se.FK,{children:[i[0],(0,se.Y)(nn.A,{url:e,text:i[1],isRtl:t}),i.slice(2)]})}(U,S.isRtl),name:"checkout_tos",checked:Boolean(h),className:PA.tosCheckbox,tabIndex:0,onCheck:u}))]})]});var U});function FA(e,t,i,s,n=!1){return(0,se.FD)("div",{className:(0,ge.A)(PA.priceInfoItem,n&&PA.priceInfoItemMain),children:[(0,se.Y)("div",{className:PA.priceInfoItemTitle,children:t}),(0,se.Y)("div",{children:(0,va.vv)(e,i,s)})]})}function DA({title:e,label:t,icon:i,customIcon:s,onClick:n}){const a=Boolean(e&&t!==e);return(0,se.FD)(li.A,{className:PA.list,narrow:!0,multiline:a,icon:i,inactive:!n,onClick:n,leftElement:s&&(0,se.Y)("i",{className:(0,ge.A)("icon",s)}),children:[(0,se.Y)("div",{className:PA.checkoutInfoItemInfoTitle,children:e||t}),e&&t!==e&&(0,se.Y)("p",{className:PA.checkoutInfoItemInfoData,children:t})]})}const MA=(0,s.ph)(({url:e,noRedirect:t,onClose:i,onPaymentFormSubmit:a})=>{const{openTelegramLink:r}=(0,n.ko)(),l=(0,B.A)(),c=(0,s.hb)(e=>{try{const s=JSON.parse(e.data),{eventType:n,eventData:l}=s;switch(n){case"web_app_open_tg_link":if(!t){const e=o.jsp+l.path_full;r({url:e})}i();break;case"payment_form_submit":a&&a(l);break;default:i()}}catch(e){}},[i,t,r,a]);return(0,s.vJ)(()=>(window.addEventListener("message",c),()=>window.removeEventListener("message",c)),[c]),(0,se.Y)("div",{className:"ConfirmPayment",children:(0,se.Y)("iframe",{src:e,title:l("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"})})}),TA=(0,s.ph)((0,n.EK)(e=>{const{payment:t}=(0,c.nTw)(e);return{errorKey:t.error?.messageKey,passwordHint:e.twoFaSettings.hint,savedCredentials:"regular"===t.form?.type?t.form.savedCredentials:void 0}})(({isActive:e,errorKey:t,state:i,savedCredentials:a,passwordHint:o,onPasswordChange:r})=>{const{clearPaymentError:l}=(0,n.ko)(),c=(0,B.A)(),d=(0,Fi.A)(),[h,m]=(0,s.J0)(!1),u=(0,s.Kr)(()=>a?.length&&i.savedCredentialId?a.find(({id:e})=>e===i.savedCredentialId)?.title:void 0,[a,i.savedCredentialId]);return(0,se.FD)("div",{className:"PaymentInfo",children:[(0,se.Y)(Wd.A,{isBig:!0,isPasswordVisible:h}),(0,se.Y)(Il.A,{error:t&&d.withRegular(t),hint:o,description:c("PaymentConfirmationMessage",u),placeholder:c("Password"),onClearError:l,shouldShowSubmit:!1,shouldResetValue:e,isPasswordVisible:h,onChangePasswordVisibility:m,onInputChange:r})]})}));var BA=i(63173);const LA=i.p+"mastercard.790db81f7978635f77d8.svg",RA=i.p+"mir.e3a390b90e2e3e292621.svg",xA=i.p+"visa.fb39984c9532c0336be9.svg",EA=(0,s.ph)(({value:e,error:t,onChange:i,isActive:n})=>{const a=(0,B.A)(),o=(0,s.li)();(0,s.vJ)(()=>{n&&!m.TF&&(0,r.YS)(()=>{(0,uc.A)(o.current)})},[n]);const[l,c]=(0,s.J0)(yA.Default);(0,s.vJ)(()=>{const t=NA(e);c(t)},[]);const d=(0,s.hb)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),s=NA(e.target.value);c(s),i(t)},[i]),h=function(e){switch(e){case yA.Mastercard:return(0,se.Y)("img",{src:LA,draggable:!1,alt:""});case yA.Visa:return(0,se.Y)("img",{src:xA,draggable:!1,alt:""});case yA.Mir:return(0,se.Y)("img",{src:RA,draggable:!1,alt:""});default:return}}(l);return(0,se.FD)("div",{className:"CardInput",children:[(0,se.Y)(ee.A,{ref:o,label:a("PaymentCardNumber"),onChange:d,value:e,inputMode:"numeric",className:l?"has-right-addon":"",error:t,tabIndex:0,maxLength:19,teactExperimentControlled:!0}),(0,se.Y)("span",{className:"right-addon",children:h})]})}),VA=(0,s.ph)(({value:e,error:t,onChange:i})=>{const n=(0,B.A)(),a=(0,s.hb)(t=>{const s=t.target.value;e.endsWith("/")&&e.length>s.length?i(s):i(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t?.[0]&&Number(t[0])>12&&(t[0]="12"),t?.[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(t.target.value))},[i,e]);return(0,se.Y)(ee.A,{label:n("PaymentCardExpireDate"),onChange:a,value:e,error:t,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})}),_A=(0,s.ph)(({state:e,canSaveCredentials:t,needCardholderName:i,needCountry:n,needZip:a,countryList:o,dispatch:r,isActive:l})=>{const c=(0,s.li)();(0,s.vJ)(()=>{c.current&&c.current.value!==e.billingCountry&&(c.current.value=e.billingCountry)},[e.billingCountry]);const d=(0,s.hb)(e=>{r({type:"changeCardNumber",payload:e})},[r]),h=(0,s.hb)(e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[r]),m=(0,s.hb)(e=>{r({type:"changeExpiryDate",payload:e})},[r]),u=(0,s.hb)(e=>{const t=e.target.value.replace(/[^0-9]/g,"");r({type:"changeCvvCode",payload:t})},[r]),p=(0,s.hb)(e=>{r({type:"changeBillingCountry",payload:e.target.value})},[r]),v=(0,s.hb)(e=>{r({type:"changeBillingZip",payload:e.target.value})},[r]),g=(0,s.hb)(e=>{r({type:"changeSaveCredentials",payload:e.target.value})},[r]),A=(0,B.A)(),f=(0,Fi.A)(),{formErrors:C={}}=e;return(0,se.Y)("div",{className:"PaymentInfo",children:(0,se.FD)("form",{children:[(0,se.Y)("h5",{children:A("PaymentCardTitle")}),(0,se.Y)(EA,{onChange:d,value:e.cardNumber,error:C.cardNumber&&f.withRegular(C.cardNumber),isActive:l}),i&&(0,se.Y)(ee.A,{label:A("Checkout.NewCard.CardholderNamePlaceholder"),onChange:h,value:e.cardholder,inputMode:"text",tabIndex:0,error:C.cardholder&&f.withRegular(C.cardholder)}),(0,se.FD)("section",{className:"inline-inputs",children:[(0,se.Y)(VA,{value:e.expiry,onChange:m,error:C.expiry&&f.withRegular(C.expiry)}),(0,se.Y)(ee.A,{label:A("lng_payments_card_cvc"),onChange:u,value:e.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:C.cvv&&f.withRegular(C.cvv),teactExperimentControlled:!0})]}),n||a?(0,se.Y)("h5",{children:A("PaymentBillingAddress")}):void 0,(0,se.FD)("section",{className:"inline-inputs",children:[n&&(0,se.Y)(BA.A,{label:A("PaymentShippingCountry"),onChange:p,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:C.billingCountry&&f.withRegular(C.billingCountry),tabIndex:0,ref:c,children:o.map(({defaultName:t,name:i})=>(0,se.Y)("option",{value:t,className:"county-item",selected:t===e.billingCountry,children:t||i}))}),a&&(0,se.Y)(ee.A,{label:A("PaymentShippingZipPlaceholder"),onChange:v,value:e.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:C.billingZip&&f.withRegular(C.billingZip)})]}),(0,se.Y)("div",{className:"checkbox",children:(0,se.Y)(js.A,{label:A("PaymentCardSavePaymentInformation"),checked:!!t&&e.saveCredentials,tabIndex:0,subLabel:A(t?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"),onChange:g,disabled:!t})})]})})}),UA=(0,s.ph)(({state:e,savedCredentials:t,dispatch:i,onNewCardClick:n})=>{const a=(0,B.A)(),o=(0,s.Kr)(()=>t?.length?t.map(({id:e,title:t})=>({label:t,value:e})):hi.p,[t]),r=(0,s.hb)(e=>{i({type:"changeSavedCredentialId",payload:e})},[i]);return(0,se.Y)("div",{className:"PaymentInfo",children:(0,se.FD)("form",{children:[(0,se.Y)("h5",{children:a("PaymentCardTitle")}),(0,se.Y)(ie.A,{name:"saved-credentials",options:o,selected:e.savedCredentialId,onChange:r}),(0,se.Y)(X.A,{isText:!0,onClick:n,children:a("PaymentCheckoutMethodNewCard")})]})})}),OA=(0,s.ph)(({state:e,shippingOptions:t,currency:i,dispatch:n})=>{const a=(0,B.A)(),o=(0,Fi.A)();(0,s.vJ)(()=>{t&&t.length&&!e.shipping&&n({type:"changeShipping",payload:t[0].id})},[t,e.shipping,n]);const r=(0,s.hb)(e=>{n({type:"changeShipping",payload:e})},[n]),l=(0,s.Kr)(()=>t.map(({id:e,title:t,amount:s})=>({label:t,subLabel:(0,va.vv)(o,s,i),value:e})),[t,i,o]);return(0,se.Y)("div",{className:"Shipping",children:(0,se.FD)("form",{children:[(0,se.Y)("p",{children:a("PaymentShippingMethod")}),(0,se.Y)(ie.A,{name:"shipping-options",options:l,onChange:r,selected:e.shipping})]})})}),KA=(0,s.ph)(({state:e,needEmail:t,needPhone:i,needName:n,needAddress:a,countryList:o,dispatch:l})=>{const c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)();(0,s.vJ)(()=>{h.current&&h.current.value!==e.countryIso2&&(h.current.value=e.countryIso2)},[e.countryIso2]);const u=(0,B.A)(),p=(0,Fi.A)();(0,s.vJ)(()=>{m.TF||(0,r.YS)(()=>{(0,uc.A)(c.current)})},[c]);const v=(0,s.hb)(e=>{l({type:"changeAddress1",payload:e.target.value})},[l]),g=(0,s.hb)(e=>{l({type:"changeAddress2",payload:e.target.value})},[l]),A=(0,s.hb)(e=>{l({type:"changeCity",payload:e.target.value})},[l]),f=(0,s.hb)(e=>{l({type:"changeState",payload:e.target.value})},[l]),C=(0,s.hb)(e=>{l({type:"changeCountry",payload:o.find(t=>t.iso2===e.target.value)})},[o,l]),b=(0,s.hb)(e=>{l({type:"changePostCode",payload:e.target.value})},[l]),y=(0,s.hb)(e=>{l({type:"changeFullName",payload:e.target.value})},[l]),S=(0,s.hb)(e=>{l({type:"changeEmail",payload:e.target.value})},[l]),N=(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}=e;return(0,se.Y)("div",{className:"ShippingInfo",children:(0,se.FD)("form",{children:[a?(0,se.FD)("div",{children:[(0,se.Y)("h5",{children:u("PaymentShippingAddress")}),(0,se.Y)(ee.A,{ref:c,label:u("PaymentShippingAddress1Placeholder"),onChange:v,value:e.streetLine1,inputMode:"text",tabIndex:0,error:w.streetLine1&&p.withRegular(w.streetLine1)}),(0,se.Y)(ee.A,{label:u("PaymentShippingAddress2Placeholder"),onChange:g,value:e.streetLine2,inputMode:"text",tabIndex:0,error:w.streetLine2&&p.withRegular(w.streetLine2)}),(0,se.Y)(ee.A,{label:u("PaymentShippingCityPlaceholder"),onChange:A,value:e.city,inputMode:"text",tabIndex:0,error:w.city&&p.withRegular(w.city)}),(0,se.Y)(ee.A,{label:u("PaymentShippingStatePlaceholder"),onChange:f,value:e.state,inputMode:"text",error:w.state&&p.withRegular(w.state)}),(0,se.Y)(BA.A,{label:u("PaymentShippingCountry"),onChange:C,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:w.countryIso2&&p.withRegular(w.countryIso2),ref:h,tabIndex:0,children:o.map(({defaultName:t,name:i,iso2:s})=>(0,se.Y)("option",{value:s,className:"county-item",selected:s===e.countryIso2,children:t||i}))}),(0,se.Y)(ee.A,{label:u("PaymentShippingZipPlaceholder"),onChange:b,value:e.postCode,inputMode:"text",tabIndex:0,error:w.postCode&&p.withRegular(w.postCode)})]}):void 0,n||t||i?(0,se.Y)("h5",{children:u("PaymentShippingReceiver")}):void 0,n&&(0,se.Y)(ee.A,{label:u("PaymentShippingName"),onChange:y,value:e.fullName,inputMode:"text",tabIndex:0,error:w.fullName&&p.withRegular(w.fullName)}),t&&(0,se.Y)(ee.A,{label:u("PaymentShippingEmailPlaceholder"),onChange:S,value:e.email,inputMode:"email",tabIndex:0,error:w.email&&p.withRegular(w.email)}),i&&(0,se.Y)(ee.A,{label:u("PaymentShippingPhoneNumber"),onChange:N,value:e.phone,inputMode:"tel",tabIndex:0,error:w.phone&&p.withRegular(w.phone),ref:d}),(0,se.Y)(js.A,{label:u("PaymentShippingSave"),subLabel:u("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),tabIndex:0,onChange:k})]})})}),JA="stripe",GA="smartglocal",jA=new Set([JA,GA]),zA=(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:m,isExtendedMedia:u,url:p}=(0,c.nTw)(e).payment,{invoice:v,nativeParams:g,nativeProvider:A}=t||{},f=e.countryList.general;let C=t?.nativeProvider;!C&&p&&(C=p.startsWith("https://payment.smart-glocal.com")?GA:void 0);const b=o&&"chatId"in o?(0,c.hds)(e,o.chatId):void 0,y=Boolean(v&&(!C||!jA.has(C))),{needCardholderName:S,needCountry:N,needZip:k}=g||{},w=t?.botId?(0,c.mBe)(e,t.botId):void 0,I=(0,l.Yg)(w);return{step:i,chat:b,shippingOptions:s,nativeProvider:C,isProviderError:y,form:t,invoice:v,needCardholderName:S,needCountry:N,needZip:k,error:n,confirmPaymentUrl:a??p,isPaymentFormUrl:Boolean(!A&&p),countryList:f,requestId:r,hasShippingOptions:Boolean(s?.length),smartGlocalToken:h?.token,stripeId:d?.id,passwordValidUntil:m?.validUntil,isExtendedMedia:u,botName:I}})(({isOpen:e,onClose:t,step:i,shippingOptions:o,form:r,isProviderError:l,invoice:c,nativeProvider:d,needCardholderName:h,needCountry:m,needZip:u,confirmPaymentUrl:p,error:v,countryList:g,hasShippingOptions:A,requestId:f,smartGlocalToken:C,stripeId:b,passwordValidUntil:y,isExtendedMedia:S,isPaymentFormUrl:N,botName:k})=>{const{loadPasswordInfo:w,validateRequestedInfo:I,sendPaymentForm:P,setPaymentStep:Y,sendCredentialsInfo:F,clearPaymentError:M,validatePaymentPassword:L,setSmartGlocalCardInfo:R}=(0,n.ko)(),x=(0,B.A)(),E=(0,Fi.A)(),[V,_,U]=(0,D.A)(),[O,J]=(0,Dd.A)(wA,kA),[G,j]=(0,s.J0)(!1),[z,H]=(0,s.J0)(!1),[$,q]=(0,s.J0)(""),W=(0,K.A)(i,!0),Q=(0,K.A)(f),Z=i!==a.tn.ConfirmPayment,ee=(0,s.hb)(e=>{Y({step:e})},[Y]);(0,s.vJ)(()=>{e&&(q(""),w(),_())},[e,w,_]),(0,s.vJ)(()=>{!e&&V&&U()},[U,V,e]),(0,s.vJ)(()=>{(void 0!==i||v)&&j(!1)},[i,v,f]),(0,s.vJ)(()=>{i!==a.tn.Checkout||i!==W||f===Q||O.savedCredentialId||O.cardNumber||ee(a.tn.PaymentInfo)},[O.cardNumber,O.savedCredentialId,Q,W,f,ee,i]),(0,s.vJ)(()=>{v?.field&&J({type:"setFormErrors",payload:{[v.field]:v.messageKey}})},[v,J]),(0,s.vJ)(()=>{if(r?.savedInfo){const{name:e,phone:t,email:i,shippingAddress:s}=r.savedInfo,{countryIso2:n,...a}=s||{},o=n&&g.find(({iso2:e})=>e===n).defaultName;J({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:i,...o&&{country:o,countryIso2:n,...a}}})}},[r,J,g]),(0,s.vJ)(()=>{r?.savedCredentials?.length&&J({type:"changeSavedCredentialId",payload:r.savedCredentials[0].id})},[J,r?.savedCredentials]);const ie=(0,s.hb)(()=>{M()},[M]),ne=(0,s.Kr)(()=>i!==a.tn.Checkout?0:function(e=[],t,i,s){const n=t?$A(t,i):[];let a=s;return a=e.concat(n||[]).reduce((e,t)=>e+t.amount,a),a}(c?.prices,o,O.shipping,O.tipAmount),[i,c?.prices,o,O.shipping,O.tipAmount]),ae=(0,s.Kr)(()=>{if(i===a.tn.Checkout)return function(e,t,i){const s=function(e){const t=NA(e);return SA[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?HA(t,e.shipping):void 0,c=l?.title;return{paymentMethod:n,paymentProvider:i,shippingAddress:a,name:r,phone:o,shippingMethod:c}}(O,o,d||"")},[i,O,o,d]),re=(0,s.hb)(()=>{ee(a.tn.PaymentInfo)},[ee]),le=(0,s.hb)(()=>{M()},[M]),ce=(0,s.hb)(()=>{P({shippingOptionId:O.shipping,saveCredentials:O.saveCredentials,savedCredentialId:O.savedCredentialId,tipAmount:O.tipAmount})},[P,O]),de=(0,s.hb)(e=>{const{credentials:t}=e;R(t),ce()},[ce]);function he(e,t){switch(e){case a.tn.Checkout:return(0,se.Y)(YA,{title:r.title,description:r.description,photo:r.photo,dispatch:J,shippingPrices:O.shipping&&o?$A(o,O.shipping):void 0,totalPrice:ne,invoice:c,checkoutInfo:ae,isPaymentFormUrl:N,hasShippingOptions:A,tipAmount:O.tipAmount,needAddress:Boolean(c?.isShippingAddressRequested),savedCredentials:r.savedCredentials,isTosAccepted:z,onAcceptTos:H,botName:k});case a.tn.SavedPayments:return(0,se.Y)(UA,{state:O,savedCredentials:r.savedCredentials,dispatch:J,onNewCardClick:re});case a.tn.ConfirmPassword:return(0,se.Y)(TA,{state:O,savedCredentials:r.savedCredentials,onPasswordChange:q,isActive:e===i});case a.tn.PaymentInfo:return(0,se.Y)(_A,{state:O,dispatch:J,canSaveCredentials:Boolean(!r.isPasswordMissing&&r.canSaveCredentials),needCardholderName:h,needCountry:m,needZip:u,countryList:g,isActive:t});case a.tn.ShippingInfo:return(0,se.Y)(KA,{state:O,dispatch:J,needAddress:Boolean(c?.isShippingAddressRequested),needEmail:Boolean(c?.isEmailRequested||c?.isEmailSentToProvider),needPhone:Boolean(c?.isPhoneRequested||c?.isPhoneSentToProvider),needName:Boolean(c?.isNameRequested),countryList:g});case a.tn.Shipping:return(0,se.Y)(OA,{state:O,dispatch:J,shippingOptions:o||[],currency:c.currency});case a.tn.ConfirmPayment:return(0,se.Y)(MA,{url:p,noRedirect:S,onPaymentFormSubmit:de,onClose:U});default:return}}const me=(0,s.hb)(()=>{const{saveInfo:e}=O,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}}}(O);I({requestInfo:t,saveInfo:e})},[I,O]),ue=(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}}}(O);F({credentials:e})},[F,O]),pe=(0,T.A)(()=>{switch(i){case a.tn.ShippingInfo:j(!0),me();break;case a.tn.Shipping:ee(a.tn.Checkout);break;case a.tn.SavedPayments:ee(a.tn.ConfirmPassword);break;case a.tn.ConfirmPassword:if(""===$)return;j(!0),L({password:$});break;case a.tn.PaymentInfo:j(!0),ue(),J({type:"changeSavedCredentialId",payload:""});break;case a.tn.Checkout:{if(N)return j(!0),void ee(a.tn.ConfirmPayment);if(r?.savedInfo&&!f&&!O.shipping)return j(!0),void me();if(O.savedCredentialId&&(!y||y<=Date.now()/1e3-3))return void ee(a.tn.ConfirmPassword);if(!O.savedCredentialId&&(d===JA&&!b||d===GA&&!C))return void ee(a.tn.PaymentInfo);const{phone:e,email:t,fullName:i}=O,s=c?.isEmailRequested&&!t||c?.isPhoneRequested&&!e||c?.isNameRequested&&!i;if(c?.isShippingAddressRequested&&!f||s)return void ee(a.tn.ShippingInfo);if(c?.isShippingAddressRequested&&!O.shipping&&o?.length)return void ee(a.tn.Shipping);j(!0),ce();break}}});(0,s.vJ)(()=>i===a.tn.ConfirmPassword?(0,Ni.A)({onEnter:pe}):void 0,[pe,i]);const ve=(0,s.hb)(()=>{J({type:"resetState"}),H(!1),t()},[t,J]),Ae=(0,s.hb)(()=>{ee(i===a.tn.ConfirmPassword?a.tn.SavedPayments:a.tn.Checkout)},[ee,i]),fe=(0,s.Kr)(()=>{switch(i){case a.tn.Checkout:return x("PaymentCheckout");case a.tn.ShippingInfo:return x("PaymentShippingInfo");case a.tn.Shipping:return x("PaymentShippingMethod");case a.tn.SavedPayments:return x("PaymentCheckoutMethod");case a.tn.ConfirmPassword:return x("Checkout.PasswordEntry.Title");case a.tn.PaymentInfo:return x("PaymentCardInfo");case a.tn.ConfirmPayment:return x("Checkout.WebConfirmation.Title");default:return""}},[i,x]),Ce=i===a.tn.Checkout?x("Checkout.PayPrice",(0,va.Ad)(ne,c.currency,x.code)):E("PaymentInfoDone");if(l)return(0,se.FD)(te.A,{className:"error",isOpen:V,onClose:U,onCloseAnimationEnd:ve,children:[(0,se.Y)("p",{children:E("PaymentsProvidesNotSupported",void 0,{withNodes:!0,renderTextFilters:["br"]})}),(0,se.Y)("div",{className:"dialog-buttons mt-2",children:(0,se.Y)(X.A,{isText:!0,onClick:U,children:x("OK")})})]});const be=function(){if(G)return!0;switch(i){case a.tn.Checkout:return Boolean(c?.termsUrl)&&!z;case a.tn.PaymentInfo:return Boolean(""===O.cardNumber||h&&""===O.cardholder||""===O.cvv||""===O.expiry);default:return!1}}();return(0,se.FD)(te.A,{className:(0,ge.A)("PaymentModal",c?.isRecurring&&"recurring"),isOpen:V,onClose:U,onCloseAnimationEnd:ve,children:[(0,se.FD)("div",{className:"header",dir:E.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",iconName:i===a.tn.Checkout?"close":"arrow-left",onClick:i===a.tn.Checkout?U:Ae,ariaLabel:E("Close")}),(0,se.Y)("h3",{children:fe})]}),void 0!==i?(0,se.Y)(oe.Ay,{name:"slide",activeKey:i,shouldCleanup:!0,cleanupOnlyKey:a.tn.ConfirmPayment,children:e=>(0,se.Y)("div",{className:"content custom-scroll",children:he(i,e)})}):(0,se.Y)("div",{className:"empty-content",children:(0,se.Y)(Ue.A,{color:"gray"})}),Z&&(0,se.Y)("div",{className:"footer",children:(0,se.Y)(X.A,{className:"button-text",type:"submit",onClick:pe,disabled:be,isLoading:G,children:Ce})}),v&&!v.field&&function(){if(v)return(0,se.FD)(te.A,{className:"error",isOpen:Boolean(v),onClose:ie,children:[(0,se.Y)("h4",{children:v.descriptionKey?E.withRegular(v.descriptionKey):E("ErrorUnspecified")}),(0,se.Y)("div",{className:"dialog-buttons mt-2",children:(0,se.Y)(X.A,{isText:!0,onClick:le,children:E("OK")})})]})}()]})}));function HA(e,t){return e.find(({id:e})=>e===t)}function $A(e,t){const i=HA(e,t);return i?.prices}const qA=(0,s.ph)((0,n.EK)(e=>{const{receipt:t}=(0,c.nTw)(e).payment;return{receipt:t}})(({isOpen:e,onClose:t,receipt:i})=>{const n=(0,Fi.A)(),[a,o,r]=(0,D.A)();(0,s.vJ)(()=>{e&&o()},[e,o]);const l=(0,O.A)(i),c=i||l,d=(0,s.Kr)(()=>{if(c)return function(e,t,i){if(!t)return{paymentMethod:e};const{shippingAddress:s}=t,n=s?.streetLine1?`${s.streetLine1}, ${s.city}, ${s.countryIso2}`:void 0,{phone:a,name:o}=t;return{paymentMethod:e,shippingAddress:n,name:o,phone:a,shippingMethod:i}}(c.credentialsTitle,c.info,c.shippingMethod)},[c]);return(0,se.Y)(te.A,{className:"PaymentModal PaymentModal-receipt",isOpen:a,onClose:r,onCloseAnimationEnd:t,children:c&&(0,se.FD)(se.FK,{children:[(0,se.FD)("div",{className:"header",dir:n.isRtl?"rtl":void 0,children:[(0,se.Y)(X.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:r,ariaLabel:"Close",iconName:"close"}),(0,se.FD)("h3",{children:[" ",n("PaymentReceipt")," "]})]}),(0,se.Y)("div",{className:"receipt-content custom-scroll",children:(0,se.Y)(YA,{shippingPrices:c.shippingPrices,totalPrice:c.totalAmount,tipAmount:c.tipAmount,invoice:c.invoice,checkoutInfo:d,title:c.title,description:c.description,photo:c.photo})})]})})})),WA="Qo4PtFZI",QA="wtfpombl",ZA=(0,s.ph)((0,n.EK)((e,{modal:t})=>({chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0}))(({modal:e,chat:t})=>{const{sendInviteMessages:i,closeInviteViaLinkModal:a,openPremiumModal:o}=(0,n.ko)(),{missingUsers:r}=e||{},d=(0,Fi.A)(),[h,m]=(0,s.J0)([]),u=(0,s.Kr)(()=>r?.map(e=>e.id)||hi.p,[r]),[p,v]=(0,s.Kr)(()=>{if(!r?.length)return[[],[]];const[e,t]=(0,di.jB)(r,e=>e.isRequiringPremiumToMessage);return[e.map(e=>e.id),t.map(e=>e.id)]},[r]),g=(0,s.Kr)(()=>{const e=(0,n.mS)();return r?.filter(e=>e.isRequiringPremiumToInvite||e.isRequiringPremiumToMessage).map(t=>(0,c.mBe)(e,t.id)).filter(Boolean)},[r]);(0,s.vJ)(()=>{m(v)},[v]);const A=(0,T.A)(()=>a()),f=(0,T.A)(()=>{i({chatId:t.id,userIds:h}),a()}),C=(0,T.A)(()=>{o()}),b=(0,s.Kr)(()=>{if(t)return Boolean(t?.isCreator||t?.adminRights?.inviteUsers)},[t]),y=(0,s.Kr)(()=>b?d(1===r?.length?"InviteBlockedOneMessage":"InviteBlockedManyMessage"):d("InviteRestrictedUsers",{count:r?.length},{pluralValue:r?.length||0,withMarkdown:!0,withNodes:!0}),[b,d,r?.length]),S=(0,s.Kr)(()=>{if(g?.length){if(1===g.length)return d("InviteRestrictedPremiumReasonSingle",{user:(0,l.Yg)(g[0])},{withMarkdown:!0,withNodes:!0});if(g.length<=3){const e=d.conjunction(g.map(e=>(0,l.Yg)(e)).filter(Boolean));return d("InviteRestrictedPremiumReasonMultiple",{list:e},{withMarkdown:!0,withNodes:!0})}if(g.length>3){const e=g.length-2,t=g.slice(0,2),i=d.conjunction(t.map(e=>(0,l.Yg)(e)).filter(Boolean));return d("InviteRestrictedPremiumReasonMultipleMore",{list:i,count:e},{pluralValue:e,withMarkdown:!0,withNodes:!0})}}},[g,d]),N=Boolean(g?.length),k=Boolean(v?.length);return(0,se.FD)(te.A,{isOpen:Boolean(u&&t),contentClassName:"n8eENbaR",hasAbsoluteCloseButton:!0,onClose:A,isSlim:!0,children:[N&&(0,se.FD)(se.FK,{children:[(0,se.Y)(qi.A,{className:"Nc3SOtKd",peers:g,size:"large"}),(0,se.Y)("h3",{className:QA,children:d(b?"InviteBlockedPremiumTitle":"InviteBlockedNoLinkTitle")}),(0,se.Y)("p",{className:WA,children:S}),(0,se.Y)(X.A,{withPremiumGradient:!0,isShiny:!0,onClick:C,children:d("InviteBlockedPremiumButton")})]}),N&&k&&(0,se.Y)(rc.A,{className:"UoMeVIyC",children:d("InviteBlockedOr")}),k&&(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:QA,children:d("InviteBlockedTitle")}),(0,se.Y)("p",{className:WA,children:y}),(0,se.Y)(mi.A,{className:"nEYyTS_m",itemIds:u,selectedIds:h,lockedUnselectedIds:p,lockedUnselectedSubtitle:d("InviteRestrictedPremiumReason"),onSelectedIdsChange:m,isViewOnly:!b,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),b&&(0,se.Y)(X.A,{className:"Ttkq3nqt",onClick:f,disabled:!h.length,children:d("InviteViaLinkButton")})]})]})}));var XA=i(84555);const ef=(0,s.ph)(({modal:e})=>{const{closeOneTimeMediaModal:t}=(0,n.ko)(),i=(0,B.A)(),s=(0,Si.A)(e?.message,!0),{shouldRender:o,transitionClassNames:r}=(0,je.A)(Boolean(e)),d=(0,T.A)(()=>{}),h=(0,T.A)(()=>{t()});if(!o||!s)return;const m=(0,l.Ie)(s),u=(0,c.SJA)((0,n.mS)()),p=i(m?"Chat.Voice.Single.Close":"Chat.Voice.Single.DeleteAndClose");return(0,se.FD)("div",{className:(0,ge.A)("c3xMWwzW",r),children:[function(){if(!s?.content)return;const{voice:e,video:t}=s.content;return e?(0,se.Y)(Bc.Ay,{className:"VLiJWMs0",theme:u,message:s,origin:a.d9.OneTimeModal,autoPlay:!0,onPlay:d,onPause:h}):t?.isRound?(0,se.Y)(XA.A,{className:"ML2YEpGq",message:s,origin:"oneTimeModal",onStop:h}):void 0}(),(0,se.Y)("div",{className:"VWy1qXJL",children:(0,se.Y)(X.A,{faded:!0,onClick:h,pill:!0,size:"smaller",color:"dark"===u?"dark":"secondary",className:"FfMrCmD9",children:p})})]})}),tf=(0,s.ph)(({modal:e})=>{const{closeWebAppsCloseConfirmationModal:t,closeWebAppModal:i}=(0,n.ko)(),a=(0,B.A)(),o=(0,Fi.A)(),r=Boolean(e),[l,c]=(0,s.J0)(!1),d=(0,s.li)(),h=(0,s.hb)(()=>{t({shouldSkipInFuture:l})},[l]),m=(0,s.hb)(()=>{i({shouldSkipConfirmation:!0}),t({shouldSkipInFuture:l})},[l]),u=(0,s.hb)(e=>{-1===e&&m()},[m]),p=(0,Bs.A)(d,r,u,".Button");return(0,se.FD)(te.A,{className:(0,ge.A)("confirm"),title:o("CloseMiniApps"),isOpen:r,onClose:h,children:[(0,se.Y)("p",{children:o("AreYouSureCloseMiniApps")}),(0,se.Y)(js.A,{className:"dialog-checkbox",label:o("DoNotAskAgain"),checked:l,onCheck:c}),(0,se.FD)("div",{className:"dialog-buttons mt-2",ref:d,onKeyDown:p,children:[(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:m,color:"danger",children:a("Confirm")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:h,children:a("Cancel")})]})]})}),sf=(0,s.ph)((0,n.EK)(e=>{const t=e.appConfig.freezeUntilDate,i=e.appConfig.freezeAppealUrl,s=e.botFreezeAppealId?(0,c.mBe)(e,e.botFreezeAppealId):void 0;return{freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:s&&(0,l.Kl)(s)}})(({modal:e,freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:a})=>{const{closeFrozenAccountModal:o,openUrl:r}=(0,n.ko)(),l=(0,Fi.A)(),c=Boolean(e),d=(0,T.A)(()=>{o()}),h=(0,T.A)(()=>{o(),i&&r({url:i})}),m=(0,s.Kr)(()=>(0,se.FD)("div",{className:"cW2rtp6M",children:[(0,se.Y)(Ma.A,{size:130,tgsUrl:Da.w.BannedDuck,noLoop:!0}),(0,se.Y)("div",{className:"qLSm0uyC",children:l("FrozenAccountModalTitle")})]}),[l]),u=(0,s.Kr)(()=>{if(c)return(0,se.FD)("div",{className:"Vj3QQ_JQ",children:[(0,se.Y)(X.A,{className:"anvg3JaY",onClick:h,children:l("ButtonAppeal")}),(0,se.Y)(X.A,{isText:!0,onClick:d,children:l("ButtonUnderstood")})]})},[l,c]),p=(0,s.Kr)(()=>{if(!t||!a)return;const e=new Date(1e3*t),i=(0,se.Y)(Mo.A,{onClick:h,isPrimary:!0,children:(0,Ic.A)(a)});return[["hand-stop",l("FrozenAccountViolationTitle"),l("FrozenAccountViolationSubtitle")],["lock",l("FrozenAccountReadOnlyTitle"),l("FrozenAccountReadOnlySubtitle")],["frozen-time",l("FrozenAccountAppealTitle"),l("FrozenAccountAppealSubtitle",{botLink:i,date:(0,We.A)(e,l.code)},{withNodes:!0})]]},[l,a,t]);if(p)return(0,se.Y)(ml.A,{isOpen:c,header:m,listItemData:p,footer:u,onClose:d})})),nf={header:"ChJT6ggP",description:"ravQhVQQ",descriptionPreview:"_K5HhOM0",negative:"X6iX4F56",previewLink:"yY4hj8r_",backLink:"dcNVNCXo",title:"IvsV0tkW",ratingProgress:"XYpzs7CQ",withPreview:"UgviXkNW",footer:"XtZPIDLP",badge:"JdeFDQBI",understoodIcon:"Lwz8rpdL",badgeAdded:"Lr6JUU14",badgeDeducted:"OxZxdqcn"},af=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=e.currentUserId,s=t?.userId?(0,c.mBe)(e,t.userId):void 0,n=t?.userId?(0,c.vGo)(e,t.userId):void 0,a=n?.starsRating,o=n?.starsMyPendingRating,r=n?.starsMyPendingRatingDate;return{user:s,currentUserId:i,starsRating:a,pendingRating:o,pendingRatingDate:r}})(({modal:e,user:t,currentUserId:i,starsRating:a,pendingRating:o,pendingRatingDate:r})=>{const{closeProfileRatingModal:l}=(0,n.ko)(),c=(0,Fi.A)(),d=Boolean(e),h=(0,Si.A)(t),m=(0,Si.A)(a),u=(0,Si.A)(o),p=(0,Si.A)(r),[v,g]=(0,s.J0)(!1),A=(0,T.A)(()=>{l()});(0,s.vJ)(()=>{d||g(!1)},[d]);const f=(0,T.A)(()=>{g(!0)}),C=(0,T.A)(()=>{g(!1)}),b=e=>{const t="added"===e,i=c(t?"RatingBadgeAdded":"RatingBadgeDeducted"),s=t?nf.badgeAdded:nf.badgeDeducted;return(0,se.Y)("span",{className:(0,ge.A)(nf.badge,s),children:i})},y=(0,s.Kr)(()=>{if(!h||!m)return;const e=v&&u?u:m,t=e.stars,s=e.currentLevelStars,n=e.nextLevelStars,a=e.level,o=a+1,r=a<0,l=!v&&u?u.level:m.level;let d=0;d=n&&n>s?Math.max(.03,(t-s)/(n-s)):1;const g=r?.5:Math.max(0,Math.min(1,d)),A=p?p-(0,Ii.Fm)():0,b=u?u.stars-m.stars:0,y=u&&p;let S="none";a>=0&&l>=0&&a!==l&&(S=a>l?"forward":"backward"),a<0&&l<0&&a!==l&&(S=a<l?"backward":"forward");const N=c("ActionFallbackUser");return(0,se.FD)("div",{className:nf.header,children:[(0,se.Y)(jr.A,{leftText:r?void 0:c("RatingLevel",{level:a}),rightText:r?c("RatingNegativeLevel"):c("RatingLevel",{level:o}),floatingBadgeIcon:r?"warning":"crown-wear",floatingBadgeText:r?a.toString():`${c.number(t)} / ${c.number(n||t)}`,progress:g,isPrimary:a>=0,isNegative:a<0,animationDirection:S,className:(0,ge.A)(nf.ratingProgress,y&&nf.withPreview)}),(()=>{if(y)return(0,se.Y)(oe.Ay,{name:"fade",className:(0,ge.A)(nf.descriptionPreview,r&&nf.negative),activeKey:v?1:0,shouldCleanup:!0,shouldRestoreHeight:!0,children:v?(0,se.Y)("p",{children:c("DescriptionFutureRating",{time:(0,We.A$)(c,A),points:Math.abs(b),link:(0,se.Y)("span",{className:nf.backLink,onClick:C,children:c("LinkDescriptionRatingBack",void 0,{withNodes:!0,specialReplacement:(0,wi.dE)()})})},{pluralValue:Math.abs(b),withNodes:!0})}):(0,se.Y)("p",{children:c("DescriptionPendingRating",{time:(0,We.A$)(c,A),points:Math.abs(b),link:(0,se.Y)("span",{className:nf.previewLink,onClick:f,children:c("LinkDescriptionRatingPreview",void 0,{withNodes:!0,specialReplacement:(0,wi.dE)()})})},{pluralValue:Math.abs(b),withNodes:!0})})})})(),(0,se.Y)("div",{className:nf.title,children:c("TitleRating")}),(0,se.Y)("p",{className:nf.description,children:h?.id===i?c("RatingYourReflectsActivity"):c("RatingReflectsActivity",{name:(0,It.F9)(c,h)||N},{withMarkdown:!0,withNodes:!0})})]})},[h,i,m,u,p,v,c,f,C]),S=[["closed-gift",c("RatingGiftsFromTelegram"),(0,se.FD)("span",{children:[b("added"),c("RatingGiftsFromTelegramDesc")]})],["user-stars",c("RatingGiftsAndPostsFromUsers"),(0,se.FD)("span",{children:[b("added"),c("RatingGiftsAndPostsFromUsersDesc")]})],["stars-refund",c("RatingRefundsAndConversions"),(0,se.FD)("span",{children:[b("deducted"),c("RatingRefundsAndConversionsDesc")]})]],N=(0,s.Kr)(()=>(0,se.Y)("div",{className:nf.footer,children:(0,se.Y)(X.A,{onClick:A,iconName:"understood",iconClassName:nf.understoodIcon,children:c("ButtonUnderstood")})}),[c,A]);return(0,se.Y)(ml.A,{contentClassName:nf.content,isOpen:d,header:y,listItemData:S,footer:N,onClose:A})})),of="XSwOIbEp",rf=(0,s.ph)((0,n.EK)(e=>({isCurrentUserPremium:(0,c.g29)(e)}))(({modal:e,isCurrentUserPremium:t})=>{const{closeDisableSharingAboutModal:i,toggleNoForwards:a,openPremiumModal:o}=(0,n.ko)(),r=(0,Fi.A)(),l=Boolean(e),c=(0,Si.A)(e),d=c?.userId,h=(0,T.A)(()=>{i()}),m=(0,T.A)(()=>{d&&a({userId:d,isEnabled:!0}),i()}),u=(0,T.A)(()=>{i(),o({initialSection:"pm_noforwards"})}),p=(0,s.Kr)(()=>(0,se.FD)("div",{className:"FyLfOtHh",children:[(0,se.Y)(Ma.A,{size:100,tgsUrl:Da.w.HandStop,previewUrl:Da.d.HandStop,noLoop:!0}),(0,se.Y)("h3",{className:"Hvg4WB1e",children:r("DisableSharing")})]}),[r]),v=(0,s.Kr)(()=>[["no-share",r("NoForwardingTitle"),r("NoForwardingDescription")],["no-download",r("NoSavingTitle"),r("NoSavingDescription")]],[r]),g=(0,s.Kr)(()=>t?(0,se.Y)("div",{className:of,children:(0,se.Y)(X.A,{onClick:m,noForcedUpperCase:!0,children:r("DisableSharing")})}):(0,se.Y)("div",{className:of,children:(0,se.Y)(X.A,{onClick:u,iconName:"unlock-badge",iconClassName:"ilfQdSuX",noForcedUpperCase:!0,children:r("UnlockButtonTitle")})}),[t,r,m,u]);return(0,se.Y)(ml.A,{isOpen:l,header:p,listItemData:v,footer:g,onClose:h})}));var lf=i(38353);const cf=({children:e,className:t,style:i})=>(0,se.Y)("span",{className:(0,ge.A)("KI89OAqO",t),style:i,children:e}),df=(0,s.ph)(({children:e,className:t,style:i,bubbleClassName:s,bubbleStyle:n,headerClassName:a,bodyClassName:o,footerClassName:r,avatar:l,sender:c,badge:d,footer:h,time:m,senderColor:u,backgroundColor:p})=>{const v=void 0!==l,g=void 0!==c,A=void 0!==d,f=void 0!==e,C=void 0!==h,b=g||A,y=C||void 0!==m,S=(0,tt.A)(u&&`--preview-message-sender-color: ${u}`,p&&`--preview-message-background: ${p}`,n),N=(0,se.FD)(se.FK,{children:[b?(0,se.FD)("div",{className:(0,ge.A)("zJaPC7y5",a),children:[g?(0,se.Y)("span",{className:"v2NetMb9",children:c}):void 0,(0,se.Y)("span",{className:"gzRZqAxQ"}),A?(0,se.Y)("span",{className:"UDfkjpOF",children:d}):void 0]}):void 0,f?(0,se.Y)("div",{className:(0,ge.A)("mefiK4L6",o),children:e}):void 0,y?(0,se.Y)("div",{className:(0,ge.A)("A1Z7v6Cx",r),children:C?h:(0,se.Y)(cf,{children:m})}):void 0]});return v?(0,se.FD)("div",{className:(0,ge.A)("UiuHfSVq",t),style:i,children:[(0,se.Y)("div",{className:"TPmuwqIE",children:l}),(0,se.Y)("div",{className:(0,ge.A)("oW4cs2hK",s),style:S,children:N})]}):(0,se.Y)("div",{className:(0,ge.A)("HciDIlt7",t,s),style:(0,tt.A)(u&&`--preview-message-sender-color: ${u}`,p&&`--preview-message-background: ${p}`,n,i),children:N})});df.Time=(0,s.ph)(cf);const hf=(0,s.ph)((0,n.EK)(e=>{const t=(0,c.SJA)(e),{isBlurred:i,background:s,backgroundColor:n,patternColor:a}=(0,c.Gyz)(e,t)||{};return{theme:t,themeBackgroundColor:n,themePatternColor:a,themeCustomBackground:s,themeIsBackgroundBlurred:i}})(({children:e,className:t,style:i,contentClassName:s,backgroundClassName:n,backgroundStyle:a,backgroundColor:o,patternColor:r,customBackground:l,isBackgroundBlurred:c,theme:d,themeBackgroundColor:h,themePatternColor:m,themeCustomBackground:u,themeIsBackgroundBlurred:p})=>{const v=o??h,g=r??m,A=l??u,f=c??p,C=(0,xl.A)(d,A),b=(0,ge.A)("sy_9LIYH",lf.A.background,A&&lf.A.customBgImage,v&&lf.A.customBgColor,A&&f&&lf.A.blurred,n);return(0,se.FD)("div",{className:(0,ge.A)("q59teiLv",t),style:(0,tt.A)(g&&`--pattern-color: ${g}`,v&&`--theme-background-color: ${v}`,i),children:[(0,se.Y)("div",{className:b,style:(0,tt.A)(C&&`--custom-background: ${C}`,a)}),(0,se.Y)("div",{className:(0,ge.A)("B03WTep4",s),children:e})]})}));hf.Message=df;const mf=hf;var uf=i(85223);const pf={content:"UthamjcO",previewMessage:"jXRNsLif",previewBlock:"NK3RPafN",previewRankBadge:"WYistCid",previewLine:"cKaseNE2",input:"HCTMnW7y",description:"tQv6OTNu"},vf=(0,s.ph)((0,n.EK)((e,{modal:t})=>({user:t?.userId?(0,c.mBe)(e,t.userId):void 0,chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,canEditRank:t&&(0,c.b0v)(e,{chatId:t.chatId,userId:t.userId,isAdmin:t.isAdmin,isOwner:t.isOwner}),isOwn:t&&t.userId===e.currentUserId}))(({modal:e,user:t,chat:i,canEditRank:a,isOwn:o})=>{const{closeEditRankModal:r,editChatParticipantRank:c}=(0,n.ko)(),d=(0,Fi.A)(),h=Boolean(e),m=(0,Si.A)(e),[u,p]=(0,s.J0)("");(0,s.vJ)(()=>{h&&p((m?.rank||"").slice(0,16))},[m?.chatId,m?.rank,m?.userId,h]);const v=(0,T.A)(()=>{r()}),g=(0,T.A)(e=>{p(e.target.value)}),{userId:A,chatId:f,isAdmin:C,isOwner:b}=m||{},y=(m?.rank||"").slice(0,16),S=Boolean(u||C||b),N=!a||u===y,k=(0,T.A)(()=>{N||f&&A&&(c({chatId:f,userId:A,rank:u}),v())}),w=(0,T.A)(e=>{"Enter"===e.key&&(e.preventDefault(),k())});if(f&&A)return(0,se.FD)(te.A,{isOpen:h,title:d(o?"RankModalEditMy":"RankModalEdit"),contentClassName:pf.content,isSlim:!0,hasCloseButton:!0,onClose:v,children:[(0,se.Y)(mf,{className:pf.previewBlock,contentClassName:pf.previewBlockContent,children:(0,se.Y)(mf.Message,{className:pf.previewMessage,avatar:t?(0,se.Y)(Yt.A,{peer:t,size:"small"}):void 0,sender:t&&(0,It.F9)(d,t),badge:S?(0,se.Y)(uf.A,{chatId:f,userId:A,className:pf.previewRankBadge,isAdmin:C,isOwner:b,rank:u||void 0}):void 0,time:"9:37",children:(0,se.FD)(se.FK,{children:[(0,se.Y)("span",{className:pf.previewLine,children:(0,se.Y)(Ei.A,{variant:"rounded-rect",height:10,inline:!0})}),(0,se.Y)("span",{className:pf.previewLine,children:(0,se.Y)(Ei.A,{variant:"rounded-rect",width:128,height:10,inline:!0})})]})})}),(0,se.Y)(ee.A,{id:"edit-rank",label:d("EditAdminRank"),className:pf.input,value:u,maxLength:16,disabled:!i||!t||!a,teactExperimentControlled:!0,onChange:g,onKeyDown:w}),(0,se.Y)("p",{className:pf.description,children:o?d("RankEditTextOwn"):d("RankEditText",{user:t&&(0,l.u0)(t)})}),(0,se.Y)(X.A,{disabled:N,onClick:k,children:d("RankEditSave")})]})})),gf={root:"erQTz5ob",content:"l37Sd63y",body:"L6WY6MuJ",previewGrid:"qrm1gxH_",previewBlockContent:"yOQv_e83",previewMessage:"WPZnugFj",previewLine:"Loopjhr6",previewMetaLine:"uGDe3Pb9",memberTag:"YSR6b5e4",previewRankBadge:"B7u4ktQU",footer:"RQamY3BU",understoodIcon:"gzMuqcO5",topIcon:"TsyEXLgZ"},Af="placeholder";function ff(){return(0,se.FD)(se.FK,{children:[(0,se.Y)("span",{className:gf.previewLine,children:(0,se.Y)(Ei.A,{variant:"rounded-rect",width:168,height:10,inline:!0})}),(0,se.FD)("span",{className:gf.previewMetaLine,children:[(0,se.Y)(Ei.A,{variant:"rounded-rect",width:104,height:10,inline:!0}),(0,se.Y)(mf.Message.Time,{children:"9:37"})]})]})}const Cf=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.chatId?(0,c.AWZ)(e,t.chatId):void 0,s=i?.adminMembersById?.[e.currentUserId]||i?.members?.find(t=>t.userId===e.currentUserId);return{user:t?.userId?(0,c.mBe)(e,t.userId):void 0,chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,canEditRank:t&&(0,c.b0v)(e,{chatId:t.chatId,userId:t.userId,isAdmin:t.isAdmin,isOwner:t.isOwner}),canEditOwnRank:t&&(0,c.D9y)(e,t.chatId),currentUserMember:s}})(({modal:e,user:t,chat:i,canEditRank:a,canEditOwnRank:o,currentUserMember:r})=>{const{closeRankModal:l,openEditRankModal:c}=(0,n.ko)(),d=(0,Fi.A)(),h=Boolean(e),m=(0,Si.A)(e),u=m?.userId===r?.userId,p=(0,T.A)(()=>{l()}),v=(0,T.A)(()=>{m&&(a?c(m):o&&r&&c({chatId:m.chatId,userId:r.userId,isAdmin:r.isAdmin,isOwner:r.isOwner,rank:r.rank}),l())}),g=(0,s.Kr)(()=>d(a?u?"RankModalEditMy":"RankModalEdit":o?"RankModalEditMy":"ButtonUnderstood"),[a,o,u,d]);if(!m)return;const{userId:A,chatId:f,isAdmin:C,isOwner:b,rank:y}=m;return(0,se.Y)(te.A,{isOpen:h,className:gf.root,contentClassName:gf.content,hasAbsoluteCloseButton:!0,onClose:p,children:(0,se.FD)("div",{className:gf.body,children:[(0,se.Y)("div",{className:gf.topIcon,children:(0,se.Y)(he.A,{name:"user-tag"})}),(0,se.FD)("div",{children:[(0,se.Y)("h3",{className:gf.previewTitle,children:d(b?"RankModalOwnerTagTitle":C?"RankModalAdminTagTitle":"RankModalMemberTagTitle")}),(0,se.Y)("div",{className:gf.previewText,children:d(b?"RankModalOwnerText":C?"RankModalAdminText":"RankModalMemberText",{tag:(0,se.Y)(uf.A,{chatId:f,userId:A,isAdmin:C,isOwner:b,rank:y}),author:t&&(0,It.F9)(d,t),group:i&&(0,It.F9)(d,i)},{withNodes:!0,withMarkdown:!0})})]}),(0,se.FD)("div",{className:gf.previewGrid,children:[(0,se.Y)(mf,{contentClassName:gf.previewBlockContent,children:(0,se.Y)(mf.Message,{className:gf.previewMessage,badge:(0,se.Y)(uf.A,{chatId:Af,userId:Af,className:gf.previewRankBadge,rank:d("RankMemberTag")}),children:ff()})}),(0,se.Y)(mf,{contentClassName:gf.previewBlockContent,children:(0,se.Y)(mf.Message,{className:gf.previewMessage,badge:(0,se.Y)(uf.A,{className:gf.previewRankBadge,chatId:Af,userId:Af,isAdmin:!0,rank:d("RankAdminTag")}),children:ff()})})]}),(0,se.Y)("div",{className:gf.footer,children:(0,se.Y)(X.A,{iconName:a?void 0:"understood",iconClassName:gf.understoodIcon,onClick:v,children:g})})]})})}));var bf=i(46442),yf=i(76786);const Sf=(0,s.ph)((0,n.EK)((e,{chatId:t,threadId:i})=>{const s=(0,c.hds)(e,t),n=(0,Kl._X)(e,t,i||G.l3,"typingStatus"),a=(0,l.cG)(t,i||G.l3,e.currentUserId),o=(0,Kl.a1)(e,t,i||G.l3),r=o?.unreadCount;return{chat:s,connectionState:e.connectionState,isSyncing:e.isSyncing,isFetchingDifference:e.isFetchingDifference,typingStatus:n,isSavedDialog:a,unreadCount:r,hasUnreadMark:o?.hasUnreadMark}})(({chatId:e,threadId:t,chat:i,connectionState:s,isSyncing:a,isFetchingDifference:o,typingStatus:r,isSavedDialog:l,unreadCount:c,hasUnreadMark:d,onClose:h})=>{const m=(0,Fi.A)(),u=(0,B.A)(),{markChatMessagesRead:p}=(0,n.ko)(),{connectionStatusText:g}=(0,yf.A)(u,s,a||o,!0),A=(0,T.A)(()=>{p({id:e})}),f=l?m("SavedMessages"):void 0,C=l?String(G.l3):e,b=i?.isMonoforum?i.linkedMonoforumId:C;return(0,se.FD)("div",{className:"LyrhszzE",children:[Boolean(c||d)&&(0,se.Y)(X.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("ChatListContextMarkAsRead"),onClick:A,className:"Bp8eDIso",iconName:"readchats"}),(0,se.Y)(X.A,{round:!0,color:"translucent",size:"tiny",ariaLabel:m("Close"),onClick:h,className:"jHVcj192",iconName:"close"}),(0,se.Y)("div",{className:"modal-title",children:(0,se.Y)("div",{className:"FsTceiGs",children:(0,v.L8)(b)?(0,se.Y)(ms.A,{userId:b,typingStatus:r,status:g||f,withDots:Boolean(g),withFullInfo:!1,withMediaViewer:!1,withStory:!1,withUpdatingStatus:!0,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},b):(0,se.Y)(hs.A,{chatId:b,threadId:l?void 0:t,typingStatus:r,withMonoforumStatus:i?.isMonoforum,status:g||f,withDots:Boolean(g),withMediaViewer:!1,withFullInfo:!1,withUpdatingStatus:!0,withStory:!1,isSavedDialog:l,emojiStatusSize:22,noRtl:!0},b)})})]})})),Nf=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:s,background:n,backgroundColor:a,patternColor:o}=(0,c.Gyz)(e,i)||{};return{theme:i,customBackground:n,backgroundColor:a,patternColor:o,isBackgroundBlurred:s}})(({modal:e,theme:t,customBackground:i,backgroundColor:a,patternColor:o,isBackgroundBlurred:r})=>{const{closeQuickPreview:l,openChat:c,openThread:d}=(0,n.ko)(),h=e?.chatId,m=e?.threadId,p=Boolean(h),v=(0,xl.A)(t,i),g=(0,T.A)(()=>{l()}),A=(0,T.A)(()=>{h&&(m?d({chatId:h,threadId:m,shouldReplaceHistory:!0}):c({id:h,shouldReplaceHistory:!0}),l())});(0,s.vJ)(()=>p?(0,u.A)(g):void 0,[p,g]),(0,Ne.A)({isActive:p,onBack:g});const{chatId:f,threadId:C}=(0,Si.A)(e,!0)||{},b=(0,ge.A)(lf.A.background,i&&lf.A.customBgImage,a&&lf.A.customBgColor,i&&r&&lf.A.blurred);if(f)return(0,se.Y)(te.A,{isOpen:p,onClose:g,header:(0,se.Y)(Sf,{chatId:f,threadId:C,onClose:g}),className:"hJTLQd8O",contentClassName:"zUonvDbp",children:(0,se.FD)("div",{className:"NYlix6SL",style:(0,tt.A)(`--pattern-color: ${o}`,a&&`--theme-background-color: ${a}`),onClick:A,children:[(0,se.Y)("div",{className:b,style:v?`--custom-background: ${v}`:void 0}),(0,se.Y)("div",{className:"IJ0EBwJk",children:(0,se.Y)(bf.A,{chatId:f,threadId:C||G.l3,type:"thread",canPost:!1,isReady:!0,withDefaultBg:Boolean(!i&&!a),isQuickPreview:!0})})]})})})),kf=(0,s.ph)((0,n.EK)(e=>({isStoryViewerOpen:(0,c.gd2)(e),stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,c.g29)(e)}))(({modal:e,isStoryViewerOpen:t,stealthMode:i,isCurrentUserPremium:a})=>{const{closeStealthModal:o,activateStealthMode:r,showNotification:l,openPremiumModal:c,openStoryViewer:d}=(0,n.ko)(),h=(0,Fi.A)(),m=(0,M.A)(),u=Boolean(i?.cooldownUntil&&i.cooldownUntil>(0,Ii.Fm)()),p=Boolean(e),v=(0,Si.A)(e),{targetPeerId:g}=v||{},A=(0,T.A)(()=>{m()}),f=(0,T.A)(()=>{o()}),C=(0,T.A)(()=>{if(!a)return c({initialSection:"stories"}),void f();r(),l({title:{key:"StealthModeOnTitle"},message:{key:"StealthModeOnHintEnabled"}}),g&&d({peerId:g}),f()}),b=(0,s.Kr)(()=>(0,se.FD)(se.FK,{children:[(0,se.Y)("h3",{className:"WJuiuEDm",children:h("StealthModeTitle")}),(0,se.Y)("div",{className:"G9N9Bt0G",children:h(a?"StealthModeDescription":"StealthModeDescriptionPremium")})]}),[h,a]),y=(0,s.Kr)(()=>[["stealth-past",h("StealthModeHideRecentTitle"),h("StealthModeHideRecentDescription")],["stealth-future",h("StealthModeHideFutureTitle"),h("StealthModeHideFutureDescription")]],[h]),S=(0,s.Kr)(()=>a?u?h("StealthModeButtonRecharge",{timer:(0,se.Y)(yd.A,{endsAt:i.cooldownUntil,onEnd:A})},{withNodes:!0}):h(g?"StealthModeButtonToStory":"StealthModeButton"):h("StealthModeButtonPremium"),[a,u,h,i,g]);return(0,se.Y)(ml.A,{isOpen:p,className:(0,ge.A)(t&&"component-theme-dark"),header:b,headerIconName:"eye-crossed-outline",listItemData:y,buttonText:S,onButtonClick:C,onClose:f})}));var wf=i(69881);const If=(0,s.ph)((0,n.EK)((e,{modal:t})=>{const i=t?.chatId?(0,c.hds)(e,t.chatId):void 0,s=e.currentUserId?(0,c.PVB)(e,e.currentUserId):void 0,n=t?.nextOwnerId?(0,c.PVB)(e,t.nextOwnerId):void 0,a=t?.chatId?(0,c.AWZ)(e,t.chatId):void 0;return{chat:i,currentUser:s,currentUserId:e.currentUserId,nextOwner:n,chatFullInfo:a}})(({modal:e,chat:t,currentUser:i,currentUserId:a,nextOwner:o,chatFullInfo:r})=>{const{closeLeaveGroupModal:d,leaveChannel:h,leaveBasicGroup:m,loadMoreMembers:u,loadFullChat:p,transferChatOwnership:v,verifyTransferOwnership:g,openTwoFaCheckModal:A}=(0,n.ko)(),f=(0,Fi.A)(),[C,b,y]=(0,D.A)(),[S,N,k]=(0,D.A)(),[w,I]=(0,s.J0)(e?.nextOwnerId),[P,Y]=(0,s.J0)(""),F=Boolean(e),M=(0,Si.A)(t),B=M&&(0,l.yn)(M),L=(0,Si.A)(i);(0,s.vJ)(()=>{t&&!r&&p({chatId:t.id})},[t,r]);const R=w&&w!==e?.nextOwnerId?void 0:o,x=(0,Si.A)(R),E=(0,s.hb)(e=>w?(0,c.PVB)(e,w):void 0,[w]),V=(0,Ds.Ay)(E)||x,{adminIds:_,memberIds:U,allIds:O}=(0,s.Kr)(()=>{if(!a)return{adminIds:[],memberIds:[],allIds:[]};const e=r?.adminMembersById,t=r?.members,i=e?Object.values(e).filter(e=>e.userId!==a&&!e.isOwner).map(e=>e.userId):[],s=(t||[]).filter(e=>e.userId!==a&&!e.isOwner&&!e.isAdmin).map(e=>e.userId);return{adminIds:i,memberIds:s,allIds:[...i,...s]}},[a,r]),K=_.length>0,J=Boolean(w&&w!==e?.nextOwnerId),G=(0,s.Kr)(()=>t?(0,Fu.qS)(t):void 0,[t]),{result:j,isLoading:z}=(0,Fu.Ay)({query:P,queryFn:G,defaultValue:O,isDisabled:!t}),{sections:H,filteredIds:$}=(0,s.Kr)(()=>P?{sections:void 0,filteredIds:(j||[]).filter(e=>e!==a&&O.includes(e))}:K?U.length>0?{sections:[{key:"admins",title:f("LeaveGroupAdmins"),ids:_},{key:"members",title:f("LeaveGroupMembers"),ids:U}],filteredIds:O}:{sections:void 0,filteredIds:_}:{sections:void 0,filteredIds:O},[P,j,a,O,K,_,U,f]),q=f("LeaveGroupAppointOwner"),W=(0,T.A)(()=>{const t=e?.chatId;t&&(J&&w?g({chatId:t,userId:w,onSuccess:N,onPasswordMissing:A,onPasswordTooFresh:A,onSessionTooFresh:A}):N())}),Q=(0,T.A)(t=>{const i=e?.chatId;if(!i)return;const s=B?m:h;J&&w?v({chatId:i,userId:w,password:t,onSuccess:()=>s({chatId:i,shouldSkipOwnershipCheck:!0})}):s({chatId:i,shouldSkipOwnershipCheck:!0}),d()}),Z=(0,T.A)(()=>{b()}),ee=(0,T.A)(e=>{I(e),y()}),ie=(0,T.A)(()=>{y()}),ne=(0,T.A)(()=>{e?.chatId&&u({chatId:e.chatId})});if(!M||!L)return;const ae=(0,It.F9)(f,M),oe=V?(0,It.F9)(f,V):void 0;return(0,se.FD)(se.FK,{children:[(0,se.FD)(te.A,{isOpen:F&&!C&&!S,dialogClassName:"LnA5oc8_",onClose:d,children:[V&&(0,se.Y)(wf.A,{fromPeer:L,toPeer:V}),(0,se.Y)("h3",{children:f("LeaveGroupTitle",{group:ae})}),(0,se.Y)("p",{children:f(B?"LeaveBasicGroupDescription":"LeaveGroupDescription",{nextOwner:oe,group:ae},{withNodes:!0,withMarkdown:!0})}),(0,se.FD)("div",{className:"dialog-buttons-column",children:[(0,se.Y)(X.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:W,children:f("GroupLeaveGroup")}),O.length>0&&(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:Z,children:f("LeaveGroupAppointOwner")}),(0,se.Y)(X.A,{className:"confirm-dialog-button",isText:!0,onClick:()=>d(),children:f("Cancel")})]})]}),(0,se.Y)(Bo.A,{isOpen:C,title:q,hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,onClose:ie,children:H?(0,se.Y)(mi.A,{sections:H,filterValue:P,filterPlaceholder:f("Search"),isSearchable:!0,isLoading:z,withStatus:!0,withDefaultPadding:!0,onFilterChange:Y,onSelectedIdChange:ee,onLoadMore:ne}):(0,se.Y)(mi.A,{itemIds:$,filterValue:P,filterPlaceholder:f("Search"),isSearchable:!0,isLoading:z,withStatus:!0,withDefaultPadding:!0,onFilterChange:Y,onSelectedIdChange:ee,onLoadMore:ne})}),(0,se.Y)($g,{isOpen:S,title:f("EnterPassword"),confirmLabel:f("Transfer"),description:f("EnterPasswordDescription"),onClose:k,onSubmit:Q})]})})),Pf=(0,s.ph)((0,n.EK)(e=>({hasPassword:e.settings.byKey.hasPassword}))(({modal:e,hasPassword:t})=>{const{closeTwoFaCheckModal:i,openSettingsScreen:s}=(0,n.ko)(),o=(0,Fi.A)(),r=Boolean(e),l=(0,T.A)(()=>{s({screen:a.VS.TwoFaDisabled}),i()});return(0,se.FD)(ai.A,{isOpen:r,title:o("SecurityCheck"),className:"QDpfwPcz",confirmLabel:o(t?"OK":"SecurityCheckEnableTwoStep"),confirmHandler:t?i:l,isOnlyConfirm:t,areButtonsInColumn:!t,onClose:i,children:[(0,se.Y)("p",{children:o("SecurityCheckInfo")}),(0,se.FD)("ul",{className:"SMPg7E95",children:[(0,se.Y)("li",{children:o("SecurityCheckTwoStepEnabled",void 0,{withNodes:!0,withMarkdown:!0})}),(0,se.Y)("li",{children:o("SecurityCheckTwoStepNotChanged",void 0,{withNodes:!0,withMarkdown:!0})}),(0,se.Y)("li",{children:o("SecurityCheckLoggedIn",void 0,{withNodes:!0,withMarkdown:!0})})]})]})})),Yf=(0,s.ph)(({modal:e})=>{const{closeQuickChatPicker:t,openChat:i}=(0,n.ko)(),s=(0,Fi.A)(),a=Boolean(e),o=(0,T.A)(e=>{i({id:e,shouldReplaceHistory:!0}),t()});return(0,se.Y)(Gs,{isOpen:a,title:s("SelectChat"),searchPlaceholder:s("Search"),onSelectRecipient:o,onClose:t})}),Ff=(0,s.ph)(({modal:e})=>{const{closeCocoonModal:t,openTelegramLink:i}=(0,n.ko)(),a=Boolean(e),o=(0,Fi.A)(),r=(0,T.A)(()=>{t()}),l=(0,T.A)(e=>{i({url:e}),r()}),c=(0,s.Kr)(()=>{const e=o("CocoonFeature1Text",{username:(0,se.Y)(Mo.A,{isPrimary:!0,onClick:()=>{l(o("CocoonFeature1UsernameLink"))},children:o("CocoonFeature1Username")})},{withNodes:!0,withMarkdown:!0}),t=o("CocoonFeature3Text",{link:(0,se.Y)(nn.A,{url:o("CocoonFeature3Link"),text:o("CocoonFeature3LinkText")})},{withNodes:!0,withMarkdown:!0});return[["lock",o("CocoonFeature1Title"),e],["stats",o("CocoonFeature2Title"),o("CocoonFeature2Text")],["gift",o("CocoonFeature3Title"),t]]},[o]),d=(0,s.Kr)(()=>(0,se.Y)(Aa.A,{className:"HMfVcNfv",modelClassName:"W2Ujdwo0",model:"ai-egg",color:"purple",title:o("CocoonTitle"),description:o("CocoonDescription",void 0,{withNodes:!0,withMarkdown:!0})}),[o]),h=(0,s.Kr)(()=>(0,se.FD)("div",{className:"FUJ4PH8B",children:[(0,se.Y)("span",{className:"uVgm33C1",children:o("CocoonFooterText",{link:(0,se.Y)(Mo.A,{isPrimary:!0,onClick:()=>l(o("CocoonFooterLink")),children:o("CocoonFooterLinkText")})},{withNodes:!0,withMarkdown:!0})}),(0,se.Y)(X.A,{iconName:"understood",onClick:r,children:o("ButtonUnderstood")})]}),[o]);return(0,se.Y)(ml.A,{isOpen:a,onClose:t,listItemData:c,withSeparator:!0,header:d,footer:h})})},3178(e,t,i){i.d(t,{A:()=>p});var s=i(84051),n=i(31481),a=i(7972),o=i(14737),r=i(43874),l=i(37661),c=i(18104),d=i(20021);const h=[0,50],m=[0,20],u=[20,0],p=(0,s.ph)(({isPasswordVisible:e,isBig:t})=>{const[i,p]=(0,l.A)(!1),[v,g]=(0,l.A)(!1),{isMobile:A}=(0,r.Ay)(),f=A?n.UyP:n.H6l;(0,o.A)(g,2e3);const C=(0,s.hb)(p,[p]);return(0,d.FD)("div",{id:"monkey",className:t?"big":"",children:[!i&&(0,d.Y)("div",{className:"monkey-preview"}),(0,d.Y)(c.A,{size:t?n.r2x:f,className:v?"hidden":"shown",tgsUrl:a.w.MonkeyClose,playSegment:h,noLoop:!0,onLoad:C}),(0,d.Y)(c.A,{size:t?n.r2x:f,className:v?"shown":"hidden",tgsUrl:a.w.MonkeyPeek,playSegment:e?m:u,noLoop:!0})]})})}}]);
//# sourceMappingURL=9451.f4f67251aef9823ca736.js.map