TelegramPWA/dist/5769.2c6bc8329d7f052953ae.js
Alexander Zinchuk fd227480e1 [Build]
2023-01-10 18:37:14 +01:00

2 lines
342 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([[5769],{4009:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>kc,Main:()=>Ec});var s=n(33555),a=n(83716),o=n(14050),i=(n(89005),n(6137)),r=n(5161),c=n(11192),d=n(70735),l=n(56112);function u(e){const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};return t&&n?(e=(0,r.qr)(e,t,n,!1),e=(0,r.Pb)(e,t,n,void 0)):e}(0,s.iw)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(t&&n)return(0,r.qr)(e,t,n,!0)})),(0,s.iw)("closeLocalTextSearch",u),(0,s.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:s,threadId:a}=(0,c.Bt)(e)||{};if(!s||!a)return;const{query:o}=n,i=(0,l.uw)(s,a),{query:u}=e.localTextSearch.byChatThreadKey[i]||{};return o!==u&&(e=(0,r.Pb)(e,s,a,d.D)),(0,r.qr)(e,s,a,!0,o)})),(0,s.iw)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:s,threadId:a}=(0,c.Bt)(e)||{};if(!s||!a)return;const{mediaType:o}=n;return(0,r.z5)(e,s,a,o)})),(0,s.iw)("openChat",((e,t,n)=>{const{id:s,threadId:a=i._f,type:o="thread",shouldReplaceHistory:d=!1}=n,l=(0,c.Bt)(e);return e.premiumModal?.promo&&e.premiumModal?.isOpen&&(e={...e,premiumModal:{...e.premiumModal,isOpen:!1}}),l&&l.chatId===s&&l.threadId===a&&l.type===o||(s&&(e=(0,r.pf)(e,s,a,"replyStack",[])),e=u(e=(0,r.i9)(e)),e={...e,isStatisticsShown:!1,messages:{...e.messages,contentToBeScheduled:void 0},...s!==e.forwardMessages.toChatId&&{forwardMessages:{}}}),s&&s!==e.forumPanelChatId&&t.closeForumPanel(),(0,r.Wy)(e,s,a,o,d)})),(0,s.iw)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,s.iw)("openChatWithInfo",((e,t,n)=>{(0,s.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,s.iw)("openChatWithDraft",((e,t,n)=>{const{chatId:s,threadId:a,text:o,files:i}=n;return s&&t.openChat({id:s,threadId:a}),{...e,requestedDraft:{chatId:s,text:o,files:i}}})),(0,s.iw)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,s.iw)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,s.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:s,orderedIds:a}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return void t.openChat({id:a[0]});const i=a.indexOf(o);if(-1===i)return;const r=a[i+s];t.openChat({id:r,shouldReplaceHistory:!0})})),(0,s.iw)("openDeleteChatFolderModal",((e,t,n)=>{const{folderId:s}=n;return{...e,deleteFolderDialogModal:s}})),(0,s.iw)("closeDeleteChatFolderModal",(e=>({...e,deleteFolderDialogModal:void 0})));var m=n(91713),h=n(77361),g=n(60782),p=n(82267),f=n(83099),I=n(50711),v=n(64319),w=n(996),y=n(42986);const P=a.ckE+a.fK3;let Z;function C(e,t,n){const{type:s,threadId:a}=(0,c.Bt)(e)||{},o=I.i0,i="scheduled"===s?(0,c.yB)(e,t):(0,c.Zw)(e,t);if(!i||!a)return;const r=n.map((e=>i[e])).filter((t=>(0,c._k)(e,t,a).canCopy)).sort(((e,t)=>e.id-t.id)),d=r.reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,l.OU)(o,s):""}:`),t.push(`${function(e,t){const n=(0,y.Eb)(t),s=n?`${n} `:"",a=(0,w.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${s}${(0,y.Kk)(e,t,a,!0,!0)}`}(o,n)}\n`),t}),[]),u=r.reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,l.OU)(o,s):""}:`),t.push(`${(0,l.MK)(o,n,!1,0,void 0,!0)}\n`),t}),[]);(0,v.qN)(d.join("\n"),u.join("\n"))}(0,s.iw)("setScrollOffset",((e,t,n)=>{const{chatId:s,threadId:a,scrollOffset:o}=n;return(0,r.pf)(e,s,a,"scrollOffset",o)})),(0,s.iw)("setReplyingToId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o,threadId:i}=a;return(0,r.pf)(e,o,i,"replyingToId",s)})),(0,s.iw)("setEditingId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o,threadId:i,type:d}=a,l="scheduled"===d?"editingScheduledId":"editingId";return(0,r.pf)(e,o,i,l,s)})),(0,s.iw)("setEditingDraft",((e,t,n)=>{const{text:s,chatId:a,threadId:o,type:i}=n,c="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,r.pf)(e,a,o,c,s)})),(0,s.iw)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(!t||!n)return;const s=(0,c.Zw)(e,t),a=(0,c.Cb)(e,t,n);if(!s||!a)return;const o=(0,g.dF)(a,(t=>Boolean(s[t]&&(0,c._k)(e,s[t],n).canEdit)));return o?(0,r.pf)(e,t,n,"editingId",o):void 0})),(0,s.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:s}=n,{chatId:a,threadId:o}=(0,c.Bt)(e)||{};if(!a||!o)return;const r=(0,c.Zw)(e,a),d=(0,c.Cb)(e,a,o);if(!r||!d)return;const l=(0,c.Yy)(e,a,o);let u;if((0,c.b9)(e,a,o)&&l){const e=Object.keys(r),t=e.indexOf(l.toString())+s;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else u=o===i._f?(0,c.Z1)(e,a)?.lastMessage?.id:(0,c.tZ)(e,a,o)?.lastMessageId;t.setReplyingToId({messageId:u}),t.focusMessage({chatId:a,threadId:o,messageId:u})})),(0,s.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:s,threadId:a,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d}=n;return{...e,audioPlayer:{chatId:s,threadId:a,messageId:o,origin:null!=i?i:e.audioPlayer.origin,volume:null!=r?r:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:d||e.audioPlayer.isMuted}}})),(0,s.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:s,isMuted:!1}}})),(0,s.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:s}}})),(0,s.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:s}}})),(0,s.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:s}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:s}}})),(0,s.iw)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,s.iw)("openPollResults",((e,t,n)=>{const{chatId:a,messageId:o}=n;if((0,c.Jf)(e)){if(a!==e.pollResults.chatId||o!==e.pollResults.messageId)return{...e,pollResults:{chatId:a,messageId:o,voters:{}}}}else window.setTimeout((()=>{e=(0,s.Rd)(),(0,s.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}})}),450)})),(0,s.iw)("closePollResults",(e=>({...e,pollResults:{}}))),(0,s.iw)("focusLastMessage",((e,t,n)=>{const{noForumTopicPanel:s}=n||{},a=(0,c.Bt)(e);if(!a)return;const{chatId:o,threadId:r}=a;let d;d=r===i._f?(0,c.Z1)(e,o)?.lastMessage?.id:(0,c.tZ)(e,o,r)?.lastMessageId,d&&t.focusMessage({chatId:o,threadId:r,messageId:d,noHighlight:!0,noForumTopicPanel:s})})),(0,s.iw)("focusNextReply",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:a,threadId:o}=n,i=(0,c.p9)(e,a,o);if(i&&0!==i.length){const n=i.pop();e=(0,r.pf)(e,a,o,"replyStack",[...i]),(0,s.R3)(e),t.focusMessage({chatId:a,threadId:o,messageId:n,noForumTopicPanel:!0})}else t.focusLastMessage({noForumTopicPanel:!0})})),(0,s.iw)("focusMessage",((e,t,n)=>{const{chatId:a,threadId:o=i._f,messageListType:d="thread",noHighlight:l,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f,noForumTopicPanel:I}=n;let{messageId:v}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);t?.length&&([v]=t)}const w=(0,c.Bt)(e),y=!w||a!==w.chatId||o!==w.threadId||d!==w.type;if(Z&&(clearTimeout(Z),Z=void 0),Z=window.setTimeout((()=>{let e=(0,s.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,s.R3)(e)}),l?P:1500),e=(0,r.cq)(e,a,v,l,p),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,a,o)||[];e=(0,r.pf)(e,a,o,"replyStack",[...t,g])}y&&(e=(0,r.wV)(e,m.fo.Static));const C=(0,c.Cb)(e,a,o);if(C&&C.includes(v))return(0,s.R3)(e),void t.openChat({id:a,threadId:o,shouldReplaceHistory:f,noForumTopicPanel:I});if(y&&(e=(0,r.pf)(e,a,o,"viewportIds",void 0)),e=(0,r.pf)(e,a,o,"outlyingIds",void 0),C&&!y){const t=v>C[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,s.R3)(e),t.openChat({id:a,threadId:o,shouldReplaceHistory:f,noForumTopicPanel:I}),t.loadViewportMessages()})),(0,s.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:s,messageIds:a,groupedId:o,withMyScore:i}=n;let r;return o&&(r=(0,c.xH)(e,s,o)),{...e,forwardMessages:{fromChatId:s,messageIds:r||a,isModalShown:!0,withMyScore:i}}})),(0,s.iw)("changeForwardRecipient",(e=>({...e,forwardMessages:{...e.forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}}))),(0,s.iw)("setForwardNoAuthors",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noAuthors:n,noCaptions:n&&e.forwardMessages.noCaptions}}))),(0,s.iw)("setForwardNoCaptions",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noCaptions:n,noAuthors:n}}))),(0,s.iw)("exitForwardMode",(e=>{(0,s.R3)({...e,forwardMessages:{}})})),(0,s.iw)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:s})})),(0,s.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:a}=n,o=e.activeDownloads.byChatId[a.chatId];o&&o.length&&(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:o.filter((e=>e!==a.id))}}})})),(0,s.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:s}=n,a=e.activeDownloads.byChatId,o={};return Object.keys(a).forEach((e=>{o[e]=a[e].filter((e=>!s.find((t=>t.id===e))))})),{...e,activeDownloads:{byChatId:o}}})),(0,s.iw)("downloadMessageMedia",((e,t,n)=>{const{message:a}=n;(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:[...e.activeDownloads.byChatId[a.chatId]||[],a.id]}}})})),(0,s.iw)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages,{threadId:a}=(0,c.Bt)(e)||{},o=(0,c.Zw)(e,n);o&&a&&s.map((e=>o[e])).filter((t=>(0,c._k)(e,t,a).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,s.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:s}=n||{},a=(0,c.jr)(e);return a?(0,r.M6)(e,a.id,s):e})),(0,s.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:a,groupedId:o,childMessageIds:i,withShift:d}=n,l=(0,c.Bt)(e);if(!l)return;const{chatId:u,threadId:m,type:g}=l;e=(0,r.Ob)(e,u,m,g,a,o,i,d),(0,s.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.$b?"long tap":"right click"} on a message.`}))})),(0,s.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,s.iw)("exitMessageSelectMode",r.i9),(0,s.iw)("openPollModal",((e,t,n)=>{const{isQuiz:s}=n||{};return{...e,pollModal:{isOpen:!0,isQuiz:s}}})),(0,s.iw)("closePollModal",(e=>({...e,pollModal:{isOpen:!1}}))),(0,s.iw)("checkVersionNotification",((e,t)=>{if(a.V61&&Date.now()>Number(a.V61)+2592e5)return;const n=a.JiC.split(".").slice(0,2).join("."),{serviceNotifications:s}=e;if(s.find((e=>{let{version:t}=e;return t===n})))return;const o={chatId:a.awM,date:(0,p.b)(e.serverTimeOffset),content:{text:(0,f.ZP)("**Telegram Web Z was updated to version 1.58**\n\n[👏](customEmoji:5471921242866981303) **Harder**\n• Topics in groups are now supported.\n• Collectible usernames now appear on profiles, and can be managed in Settings.\n• Custom reactions are properly displayed.\n• Premium users can react multiple times with different emoji.\n\n[🤩](customEmoji:5373026167722876724) **Better**\n• Animations can be disabled from the main menu.\n\n[💪](customEmoji:5471883477219549006) **Stronger**\n• Fixed missing Quick Reaction buttons.\n• Fixed issues with the Chat History for New Members setting.\n• Fixed issues when changing display name.\n• Fixed issues with emoji in display names on Windows.\n• Fixed inline bot query parsing on Windows.\n• Various layout improvements.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,s.iw)("createServiceNotification",((e,t,n)=>{const{message:o,version:i}=n,{serviceNotifications:r}=e,d=(0,c.Z1)(e,a.awM),l=Math.max(d.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),u=(r.length+1)/1e3,m=Math.floor(l)+u;o.previousLocalId=o.id,o.id=m;const h={id:m,message:o,version:i,isUnread:!0};(0,s.R3)({...e,serviceNotifications:[...r.slice(-1e3),h]}),t.apiUpdate({"@type":"newMessage",id:o.id,chatId:o.chatId,message:o})})),(0,s.iw)("openReactorListModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,reactorModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,s.iw)("openSeenByModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,seenByModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,s.iw)("copySelectedMessages",(e=>{if(!e.selectedMessages)return;const{chatId:t,messageIds:n}=e.selectedMessages;C(e,t,n)})),(0,s.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.jr)(e);s&&0!==s.length&&a&&C(e,a.id,s)})),(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s}=n,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:s})})),(0,s.iw)("setGlobalSearchClosing",((e,t,n)=>(0,r.No)(e,{isClosing:n}))),(0,s.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:s}=n,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[s]});const o=a.filter((e=>e!==s));return o.unshift(s),o.length>10&&o.pop(),(0,r.No)(e,{recentlyFoundChatIds:o})})),(0,s.iw)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,s.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:s}=n;return(0,r.Og)(e,s)})),(0,s.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:s}=n;return(0,r.No)(e,{chatId:s,query:void 0,resultsByType:void 0})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s})})),(0,s.iw)("openAddContactDialog",((e,t,n)=>{const{userId:s}=n;return{...e,newContact:{userId:s}}})),(0,s.iw)("openNewContactDialog",(e=>({...e,newContact:{isByPhoneNumber:!0}}))),(0,s.iw)("closeNewContactDialog",(e=>(0,r.ft)(e))),n(73456);var b=n(91947),E=n(26926);(0,s.iw)("toggleChatInfo",((e,t,n)=>({...e,isChatInfoShown:void 0!==n?n:!e.isChatInfoShown}))),(0,s.iw)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,s.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,s.iw)("toggleManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,s.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:s}=n||{},{chatId:a}=(0,c.Bt)(e)||{};if(a)return{...e,management:{byChatId:{...e.management.byChatId,[a]:{...e.management.byChatId[a],isActive:!0,nextScreen:s}}}}})),(0,s.iw)("closeManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,s.iw)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,s.iw)("toggleStatistics",(e=>({...e,isStatisticsShown:!e.isStatisticsShown,statistics:{...e.statistics,currentMessageId:void 0}}))),(0,s.iw)("toggleMessageStatistics",((e,t,n)=>({...e,statistics:{...e.statistics,currentMessageId:n?.messageId}}))),(0,s.iw)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,s.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:s}=n,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[s]};const o=a.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentEmojis:o}})),(0,s.iw)("addRecentSticker",((e,t,n)=>{const{sticker:s}=n,{recent:a}=e.stickers;if(!a)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[s]}}};const o=a.stickers.filter((e=>e.id!==s.id));return o.unshift(s),{...e,stickers:{...e.stickers,recent:{...a,stickers:o}}}})),(0,s.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:s}=n,{recentCustomEmojis:a}=e;if(!a)return{...e,recentCustomEmojis:[s]};const o=a.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentCustomEmojis:o}})),(0,s.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,s.iw)("reorderStickerSets",((e,t,n)=>{const{order:s,isCustomEmoji:a}=n;return{...e,stickers:{...e.stickers,added:{setIds:a?e.stickers.added.setIds:s}},customEmojis:{...e.customEmojis,added:{setIds:a?s:e.customEmojis.added.setIds}}}})),(0,s.iw)("showNotification",((e,t,n)=>{const s=n;s.localId=(0,E.Z)({});const a=[...e.notifications],o=a.findIndex((e=>e.message===s.message));return-1!==o&&a.splice(o,1),a.push(s),{...e,notifications:a}})),(0,s.iw)("dismissNotification",((e,t,n)=>{const s=e.notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return{...e,notifications:s}})),(0,s.iw)("showDialog",((e,t,n)=>{const{data:s}=n;if("message"in s&&s.hasErrorKey&&!(0,b.ZP)(s))return e;const a=[...e.dialogs];if("message"in s){const e=a.findIndex((e=>e.message===s.message));-1!==e&&a.splice(e,1)}return a.push(s),{...e,dialogs:a}})),(0,s.iw)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,s.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:s}=n;return{...e,safeLinkModalUrl:s}})),(0,s.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:s}=n;return{...e,historyCalendarSelectedAt:s}})),(0,s.iw)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,s.iw)("openGame",((e,t,n)=>{const{url:a,chatId:o,messageId:i}=n,r=(0,c.hj)(e,o,i);if(!r)return;const d=r.viaBotId||r.senderId;d&&((0,c.LM)(e,d)?(0,s.R3)({...e,openedGame:{url:a,chatId:o,messageId:i}}):(0,s.R3)({...e,botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:n}}}))})),(0,s.iw)("closeGame",(e=>({...e,openedGame:void 0}))),(0,s.iw)("requestConfetti",((e,t,n)=>{const{top:s,left:a,width:o,height:i}=n||{},{animationLevel:r}=e.settings.byKey;if(0!==r)return{...e,confetti:{lastConfettiTime:Date.now(),top:s,left:a,width:o,height:i}}})),(0,s.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:s}=n;return{...e,limitReachedModal:{limit:s}}})),(0,s.iw)("closeLimitReachedModal",(e=>({...e,limitReachedModal:void 0}))),(0,s.iw)("closeStickerSetModal",(e=>({...e,openedStickerSetShortName:void 0}))),(0,s.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:s}=n;return{...e,openedCustomEmojiSetIds:s}})),(0,s.iw)("closeCustomEmojiSets",(e=>({...e,openedCustomEmojiSetIds:void 0}))),(0,s.iw)("updateLastRenderedCustomEmojis",((e,t,n)=>{const{ids:s}=n,{lastRendered:o}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,g.Tw)([...o,...s]).slice(0,a.j7i)}}})),(0,s.iw)("openCreateTopicPanel",((e,t,n)=>{const{chatId:s}=n;return(0,c.jr)(e)||t.openChat({id:s,threadId:i._f}),{...e,createTopicPanel:{chatId:s}}})),(0,s.iw)("closeCreateTopicPanel",(e=>({...e,createTopicPanel:void 0}))),(0,s.iw)("openEditTopicPanel",((e,t,n)=>{const{chatId:s,topicId:a}=n;return(0,c.jr)(e)||t.openChat({id:s}),{...e,editTopicPanel:{chatId:s,topicId:a}}})),(0,s.iw)("closeEditTopicPanel",(e=>({...e,editTopicPanel:void 0}))),(0,s.iw)("checkAppVersion",(()=>{const e=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{t=t.trim(),e.test(t)&&t!==a.JiC&&(0,s.R3)({...(0,s.Rd)(),isUpdateAvailable:!0})})).catch((e=>{a.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,s.iw)("closePaymentModal",(e=>{const t=e.payment.status;return e=(0,r.bp)(e),e=(0,r.WY)(e),{...e,payment:{...e.payment,status:t}}})),(0,s.iw)("addPaymentError",((e,t,n)=>{const{error:s}=n;return{...e,payment:{...e.payment,status:"failed",error:s}}}));var S=n(88422);(0,s.iw)("openMediaViewer",((e,t,n)=>{const{chatId:s,threadId:a,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:d,playbackRate:l,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:s,threadId:a,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=d?d:e.mediaViewer.volume,playbackRate:l||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,s.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:s,isHidden:a}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,isHidden:a,playbackRate:s}}})),(0,s.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:s,isMuted:!1}}})),(0,s.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:s}}})),(0,s.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:s}}})),(0,s.iw)("setMediaViewerHidden",((e,t,n)=>{const s=n;return{...e,mediaViewer:{...e.mediaViewer,isHidden:s}}}));var M=n(50214),R=n(95281),k=n(5872),T=n(69118),N=n(35369);let A=!1;(0,T.Gq)((()=>{(0,s.Rd)().passcode.hasPasscode&&!A&&(0,M.jv)()})),(0,s.iw)("setPasscode",(async(e,t,n)=>{let{passcode:a}=n;(0,s.R3)((0,r.vu)(e,{isLoading:!0})),await(0,R.AU)(a);const o=JSON.stringify({...(0,M.K8)(),userId:e.currentUserId}),i=(0,k.Uf)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,R.H4)(o,i),(0,s.R3)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1})),(0,k.jA)(!0)})),(0,s.iw)("clearPasscode",(e=>((0,R.C8)(),(0,r.Kn)(e)))),(0,s.iw)("unlockScreen",((e,t,n)=>{let{sessionJson:a,globalJson:o}=n;const i=JSON.parse(a);(0,M.wX)(i,i.userId),e=JSON.parse(o),(0,k.nE)(e,(0,g.Xh)(N.Y)),(0,s.R3)((0,r.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0})),t.initApi()})),(0,s.iw)("logInvalidUnlockAttempt",(e=>{var t;return(0,r.vu)(e,{invalidAttemptsCount:(null!==(t=e.passcode?.invalidAttemptsCount)&&void 0!==t?t:0)+1})})),(0,s.iw)("resetInvalidUnlockAttempts",(e=>(0,r.vu)(e,{invalidAttemptsCount:0}))),(0,s.iw)("setPasscodeError",((e,t,n)=>{const{error:s}=n;return(0,r.vu)(e,{error:s})})),(0,s.iw)("clearPasscodeError",(e=>(0,r.vu)(e,{error:void 0}))),(0,s.iw)("skipLockOnUnload",(()=>{A=!0})),n(65456);var x=n(27225),B=n(71226),L=n(81396);const O=new Map,F=(0,T.Ds)((e=>e()),500,!1);async function U(e,t,n,o){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],d=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=e.id;let u;switch(o){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(a.hT6/2)+1);break;case m.Uq.Forwards:u=-(a.hT6+1)}const h=await(0,B.t9)("fetchMessages",{chat:(0,c.Cm)((0,s.Rd)(),l,t),offsetId:n,addOffset:u,limit:a.hT6,threadId:t});if(!h)return;const{messages:p,users:f,chats:I,repliesThreadInfos:v}=h;let w=(0,s.Rd)();const y=l===a.awM?w.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],P=[].concat(p,y),Z=(0,g.ee)(P,"id"),C=Object.keys(Z).map(Number);w=(0,r.c_)(w,l,Z),w=i?(0,r.ff)(w,l,t,C):(0,r.xj)(w,l,t,C),w=(0,r.Sh)(w,(0,g.ee)(f,"id")),w=(0,r.fZ)(w,(0,g.ee)(I,"id")),w=(0,r.j6)(w,l,v);let b=(0,c.gb)(w,l,t);const E=(0,c.qC)(w,l,t);if(i&&b&&E&&(E.length&&!(0,g.YE)(b,E)||(w=(0,r.xj)(w,l,t,E),b=(0,c.gb)(w,l,t),w=(0,r.pf)(w,l,t,"outlyingIds",void 0),i=!1)),!d){const e=i?E:b,{newViewportIds:s}=j(e,n,o);w=(0,r.y9)(w,l,t,s)}(0,s.R3)(w)}function j(e,t,n){const{length:s}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,s)=>n===t||n<t&&e[s+1]>t))}(e,t):-1,i=n===m.Uq.Backwards?o:o+1||s,r=i-a.hT6,c=i+a.hT6-1,d=e.slice(Math.max(0,r),c+1);let l,u;switch(n){case m.Uq.Backwards:l=i>0,u=r>=0;break;case m.Uq.Forwards:l=i<s,u=c<=s-1;break;case m.Uq.Around:default:l=d.length>0,u=d.length===a.hT6}return{newViewportIds:d,areSomeLocal:l,areAllLocal:u}}async function D(e){let t;const n=e.attachment?(e,a)=>{O.has(a)||(t=a,O.set(a,n));const o=(0,s.Rd)();(0,s.R3)({...o,fileUploads:{byMessageLocalId:{...o.fileUploads.byMessageLocalId,[a]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,T.Pn)();const a=(0,s.Rd)();e.serverTimeOffset=a.serverTimeOffset;const o=(0,c.Bt)(a);if(!o)return;const{threadId:r}=o;e.replyingTo||r===i._f||(e.replyingTo=(0,c.qS)(a,e.chat.id,r)),e.replyingTo&&!e.replyingToTopId&&r!==i._f&&(e.replyingToTopId=(0,c.qS)(a,e.chat.id,r)),await(0,B.t9)("sendMessage",e,n),n&&t&&O.delete(t)}(0,s.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:i,threadId:d}=n||{};if(!i){const t=(0,c.Bt)(e);if(!t)return;i=t.chatId,d=t.threadId}const l=(0,c.Z1)(e,i);if(!l||l.isRestricted)return;const u=(0,c.Cb)(e,i,d),h=(0,c.gb)(e,i,d),g=(0,c.qC)(e,i,d);if(u&&u.length&&s!==m.Uq.Around){const n=s===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),c=a?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:I}=j(c,n,s);if(f&&(e=(0,r.y9)(e,i,d,p)),(0,T.R3)((()=>{!async function(e,t,n,s,a,o,i,r){t||await U(a,o,r,i,n,s),s||e.loadViewportMessages({chatId:a.id,threadId:o,direction:i,isBudgetPreload:!0})}(t,I,a,o,l,d,s,n)})),o)return}else{const t=(0,c.G$)(e,i)||(0,c.rd)(e,i,d),n=Boolean(t&&h&&!h.includes(t)),s=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=j(s,t,m.Uq.Around);p&&u.length>=a.hT6&&(e=(0,r.y9)(e,i,d,u)),f||(0,T.R3)((()=>{U(l,d,t,m.Uq.Around,n,o)}))}return e})),(0,s.iw)("loadMessage",(async(e,t,n)=>{const{chatId:a,messageId:o,replyOriginForId:d,threadUpdate:l}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await async function(e,t,n){const a=await(0,B.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===i._Q){if(n){let t=(0,s.Rd)();const a=(0,c.hj)(t,e.id,n);t=(0,r.cY)(t,e.id,n,{...a,replyToMessageId:void 0}),(0,s.R3)(t)}return}let o=(0,s.Rd)();return o=(0,r.cY)(o,e.id,t,a.message),o=(0,r.Sh)(o,(0,g.ee)(a.users,"id")),(0,s.R3)(o),a.message}(u,o,d);if(m&&l){const{lastMessageId:e,isDeleting:t}=l;(0,s.R3)((0,r.lG)((0,s.Rd)(),m,a,e,t))}})),(0,s.iw)("sendMessage",((e,t,n)=>{const s=(0,c.Bt)(e);if(!s)return;const{chatId:o,threadId:i,type:r}=s;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const d=(0,c.Z1)(e,o),l=d.isForum?(0,c.qS)(e,o,i):void 0,u={...n,chat:d,replyingTo:(0,c.Yy)(e,o,i),replyingToTopId:l,noWebPage:(0,c.tV)(e,o,i),sendAs:(0,c._5)(e,o)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1});const m=!n.attachments||n.attachments.length<=1,h=!m&&n.attachments&&n.attachments.length>1;if(m){const{attachments:e,...t}=u;D({...t,attachment:e?e[0]:void 0})}else if(h){const{text:e,entities:t,attachments:n,...s}=u,o=(0,g.Vl)(n,a.DUi);for(let n=0;n<o.length;n++){const[a,...i]=o[n],r=`${Date.now()}${n}`;D({...s,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:a,groupedId:i.length>0?r:void 0}),i.forEach((e=>{D({...s,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:s,...a}=u;e&&D({...a,text:e,entities:t,replyingTo:s}),n.forEach((e=>{D({...a,attachment:e})}))}})),(0,s.iw)("editMessage",((e,t,n)=>{const{serverTimeOffset:s}=e,{text:a,entities:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r,threadId:d,type:l}=i,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,d,l);u&&m&&((0,B.t9)("editMessage",{chat:u,message:m,text:a,entities:o,noWebPage:(0,c.tV)(e,r,d),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))})),(0,s.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.hj)(e,s,a),i=o&&O.get((0,l.KK)(o));i&&(0,B.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:s})})),(0,s.iw)("saveDraft",(async(e,t,n)=>{const{chatId:a,threadId:o,draft:i}=n;if(!i)return;const{text:d,entities:u}=i,m=(0,c.Z1)(e,a),h=(0,c.dy)(e,a);h&&(0,l.NB)(h)||(await(0,B.t9)("saveDraft",{chat:m,text:d,entities:u,replyToMsgId:(0,c.Yy)(e,a,o),threadId:(0,c.qS)(e,a,o)})||(i.isLocal=!0),e=(0,s.Rd)(),e=(0,r.pf)(e,a,o,"draft",i),e=(0,r.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)}),(0,s.R3)(e))})),(0,s.iw)("clearDraft",((e,t,n)=>{const{chatId:s,threadId:a,localOnly:o}=n;if(!(0,c.Ms)(e,s,a))return;const i=(0,c.Z1)(e,s);return o||(0,B.t9)("clearDraft",i,(0,c.qS)(e,s,a)),e=(0,r.pf)(e,s,a,"draft",void 0),(0,r.a4)(e,s,{draftDate:void 0})})),(0,s.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:s,threadId:a,noWebPage:o}=n;return(0,r.pf)(e,s,a,"noWebPage",o)})),(0,s.iw)("pinMessage",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageId:a,isUnpin:o,isOneSide:i,isSilent:r}=n;(0,B.t9)("pinMessage",{chat:s,messageId:a,isUnpin:o,isOneSide:i,isSilent:r})})),(0,s.iw)("unpinAllMessages",((e,t,n)=>{const{chatId:a,threadId:o}=n,d=(0,c.Z1)(e,a);d&&async function(e,t){await(0,B.t9)("unpinAllMessages",{chat:e,threadId:t});let n=(0,s.Rd)();n=(0,r.pf)(n,e.id,t||i._f,"pinnedIds",[]),(0,s.R3)(n)}(d,(0,c.qS)(e,a,o))})),(0,s.iw)("deleteMessages",((e,t,n)=>{const{messageIds:s,shouldDeleteForAll:a}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:i,threadId:r}=o,d=(0,c.Z1)(e,i);(0,B.t9)("deleteMessages",{chat:d,messageIds:s,shouldDeleteForAll:a});const l=(0,c._$)(e,i,r);s.includes(l)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o}=a,i=(0,c.Z1)(e,o);(0,B.t9)("deleteScheduledMessages",{chat:i,messageIds:s});const r=(0,c.wU)(e,o);s.includes(r)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:a}=n,o=(0,c.Z1)(e,s);if(!o)return;await(0,B.t9)("deleteHistory",{chat:o,shouldDeleteForAll:a});const i=(0,c.Bt)(e);i&&i.chatId===s&&t.openChat({id:void 0})})),(0,s.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:s,reason:a,description:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r}=i,d=(0,c.Z1)(e,r),l=await(0,B.t9)("reportMessages",{peer:d,messageIds:s,reason:a,description:o});t.showNotification({message:l?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("sendMessageAction",(async(e,t,n)=>{const{action:s,chatId:a,threadId:o}=n;if(a===e.currentUserId)return;const i=(0,c.Z1)(e,a);if(!i)return;const r=(0,c.dy)(e,a);r&&((0,l.cS)(r)||(0,l.NB)(r))||await(0,B.t9)("sendMessageAction",{peer:i,threadId:o,action:s})})),(0,s.iw)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:s}=e,o=(0,c.Bt)(e);if(!o)return;const{chatId:d,threadId:l}=o,u=(0,c.Cm)(e,d,l);if(!u)return;const{maxId:m}=n;F((()=>{(0,B.t9)("markMessageListRead",{serverTimeOffset:s,chat:u,threadId:l,maxId:m})})),d===a.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,c.Cb)(e,d,l),g=(0,c.It)(e,d,l);if(!h||!g||!u.unreadCount)return e;const p=function(e,t,n){let s=0;for(let a=0,o=e.length;a<o&&(e[a]>=t&&e[a]<=n&&s++,!(e[a]>=n));a++);return s}(h,g,m);if(!p)return e;if(u.isForum&&u.topics?.[l]){const t=u.topics[l];e=(0,r.Xg)(e,d,l,{lastReadInboxMessageId:m});const n=Math.max(0,t.unreadCount-p);return 0===n&&(e=(0,r.a4)(e,d,{unreadCount:Math.max(0,u.unreadCount-1)})),(0,r.Cn)(e,d,l,{unreadCount:n})}return l===i._f?(0,r.a4)(e,d,{lastReadInboxMessageId:m,unreadCount:Math.max(0,u.unreadCount-p)}):void 0})),(0,s.iw)("markMessagesRead",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageIds:a}=n;(0,B.t9)("markMessagesRead",{chat:s,messageIds:a})})),(0,s.iw)("loadWebPagePreview",((e,t,n)=>{const{text:a}=n;!async function(e){const t=await(0,B.t9)("fetchWebPagePreview",{message:e});(0,s.R3)({...(0,s.Rd)(),webPagePreview:t})}(a)})),(0,s.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,s.iw)("sendPollVote",((e,t,n)=>{const{chatId:s,messageId:a,options:o}=n,i=(0,c.Z1)(e,s);i&&(0,B.t9)("sendPollVote",{chat:i,messageId:a,options:o})})),(0,s.iw)("cancelPollVote",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.Z1)(e,s);o&&(0,B.t9)("sendPollVote",{chat:o,messageId:a,options:[]})})),(0,s.iw)("closePoll",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.Z1)(e,s),i=(0,c.hj)(e,s,a)?.content.poll;o&&i&&(0,B.t9)("closePoll",{chat:o,messageId:a,poll:i})})),(0,s.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:a,messageId:o,option:i,offset:c,limit:d,shouldResetVoters:l}=n;!async function(e,t,n,a,o,i){const c=await(0,B.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:a,limit:o});if(!c)return;let d=(0,s.Rd)();d=(0,r.Sh)(d,(0,g.ee)(c.users,"id"));const{voters:l}=d.pollResults;(0,s.R3)({...d,pollResults:{...d.pollResults,voters:{...l,[n]:(0,g.Tw)([...!i&&l&&l[n]?l[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...d.pollResults.offsets?d.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(a,o,i,c,d,l)})),(0,s.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:s,ids:a}=n,o=(0,c.Z1)(e,s);o&&(0,B.t9)("fetchExtendedMedia",{chat:o,ids:a})})),(0,s.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:a,messageIds:o,toChatId:i,withMyScore:r,noAuthors:d,noCaptions:u,toThreadId:m}=e.forwardMessages,h=(0,c.wV)(e),g=a?(0,c.Z1)(e,a):void 0,p=i?(0,c.Z1)(e,i):void 0,f=a&&o?o.sort(((e,t)=>e-t)).map((t=>(0,c.hj)(e,a,t))).filter(Boolean):void 0;if(!g||!p||!f||m&&!p.isForum)return;const{isSilent:I,scheduledAt:v}=n,w=(0,c._5)(e,i),y=f.filter((e=>!(0,l.jM)(e)));y.length&&(0,B.t9)("forwardMessages",{fromChat:g,toChat:p,toThreadId:m,messages:y,serverTimeOffset:(0,s.Rd)().serverTimeOffset,isSilent:I,scheduledAt:v,sendAs:w,withMyScore:r,noAuthors:d,noCaptions:u,isCurrentUserPremium:h}),f.filter((e=>(0,l.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:s,poll:a}=e.content;D({chat:p,replyingToTopId:m,text:t,entities:n,sticker:s,poll:a,isSilent:I,scheduledAt:v,sendAs:w})})),(0,s.R3)({...(0,s.Rd)(),forwardMessages:{}})})),(0,s.iw)("loadScheduledHistory",((e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&async function(e){const t=await(0,B.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,a=(0,g.ee)(n,"id"),o=Object.keys(a).map(Number).sort(((e,t)=>t-e));let d=(0,s.Rd)();if(d=(0,r.w3)(d,e.id,a),d=(0,r.pf)(d,e.id,i._f,"scheduledIds",o),e?.isForum){const t={};n.forEach((e=>{const n=(0,c.nr)(d,e),s=t[n]||[];s.push(e.id),t[n]=s})),Object.entries(t).forEach((t=>{let[n,s]=t;d=(0,r.pf)(d,e.id,Number(n),"scheduledIds",s)}))}(0,s.R3)(d)}(o)})),(0,s.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:s,id:a}=n,o=(0,c.Z1)(e,s);o&&(0,B.t9)("sendScheduledMessages",{chat:o,ids:[a]})})),(0,s.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:s,messageId:a,scheduledAt:o}=n,i=(0,c.Z1)(e,s),r=i&&(0,c.Tm)(e,i.id,a);i&&r&&(0,B.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,s.iw)("requestThreadInfoUpdate",(async(e,t,n)=>{const{chatId:a,threadId:o}=n,i=(0,c.Cm)(e,a,o);if(!i)return;const d=await(0,B.t9)("requestThreadInfoUpdate",{chat:i,threadId:o});d&&(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(d.users,"id")),(0,s.R3)(e))})),(0,s.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:a,chatId:o}=n,i=(0,c.Z1)(e,o);if(!i)return;e=(0,r.cY)(e,o,a,{transcriptionId:""}),(0,s.R3)(e);const d=await(0,B.t9)("transcribeAudio",{chat:i,messageId:a});e=(0,r.cY)((0,s.Rd)(),o,a,{transcriptionId:d,isTranscriptionError:!d}),(0,s.R3)(e)})),(0,s.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:a,ignoreCache:o}=n,i=o?a:(0,g.Tw)(a.filter((t=>!e.customEmojis.byId[t]))),r=await(0,B.t9)("fetchCustomEmoji",{documentId:i});r&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,g.ee)(r,"id")}}}))})),(0,s.iw)("loadPinnedMessages",((e,t,n)=>{const{chatId:a,threadId:o}=n,d=(0,c.Z1)(e,a);d&&async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i._f;const n=await(0,B.t9)("fetchPinnedMessages",{chat:e,threadId:t});if(!n)return;const{messages:a,chats:o,users:c}=n,d=(0,g.ee)(a,"id"),l=Object.keys(d).map(Number).sort(((e,t)=>t-e));let u=(0,s.Rd)();u=(0,r.c_)(u,e.id,d),u=(0,r.pf)(u,e.id,t,"pinnedIds",l),u=(0,r.Sh)(u,(0,g.ee)(c,"id")),u=(0,r.fZ)(u,(0,g.ee)(o,"id")),(0,s.R3)(u)}(d,o)})),(0,s.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,B.t9)("fetchSeenBy",{chat:i,messageId:o});d&&(0,s.R3)((0,r.cY)((0,s.Rd)(),a,o,{seenByUserIds:d}))})),(0,s.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:s,sendAsId:a}=n,o=(0,c.Z1)(e,s),i=(0,c.Z1)(e,a)||(0,c.dy)(e,a);if(o&&i)return(0,B.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,r.a4)(e,s,{fullInfo:{...o.fullInfo,sendAsId:a}})})),(0,s.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);if(!o)return;const i=await(0,B.t9)("fetchSendAs",{chat:o});i?(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),e=(0,r.a4)(e,a,{sendAsPeerIds:i.sendAs}),(0,s.R3)(e)):(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{sendAsPeerIds:[]}))})),(0,s.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);if(!o)return;const i=await(0,B.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,s.Rd)(),e=(0,r.Fn)(e,a,i.messages[0]),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),(0,s.R3)(e))})),(0,s.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:s}=n,a=(0,c.Z1)(e,s),o=(0,c.fS)(e,s);a&&o&&(0,B.t9)("viewSponsoredMessage",{chat:a,random:o.randomId})})),(0,s.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:a,offsetId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,B.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!d)return;const{messages:l,chats:u,users:m}=d,h=(0,g.ee)(l,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=(0,r.fZ)(e,(0,g.ee)(u,"id")),e=(0,r.a4)(e,a,{unreadMentions:[...i.unreadMentions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:a}=n,o=(0,c.jr)(e);if(!o)return;const i=(o.unreadMentions||[]).filter((e=>!a.includes(e)));e=(0,r.a4)(e,o.id,{unreadMentions:i}),(0,s.R3)(e),t.markMessagesRead({messageIds:a})})),(0,s.iw)("focusNextMention",((e,t)=>{const n=(0,c.jr)(e);n?.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0]})})),(0,s.iw)("readAllMentions",(e=>{const t=(0,c.jr)(e);if(t)return(0,B.t9)("readAllMentions",{chat:t}),(0,r.a4)(e,t.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,s.iw)("openUrl",((e,t,n)=>{const{url:s,shouldSkipModal:o}=n,i=(0,L.X)(s);if(i.match(a.FSu)||i.match(a.g$l))return void t.openTelegramLink({url:s});const{appConfig:r}=e;if(r){const e=new URL(i);if(r.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",r.autologinToken),void window.open(e.href,"_blank","noopener");if(r.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:s})}i.match(a.jL5)||o?window.open(i,"_blank","noopener"):t.toggleSafeLinkModal({url:i})})),(0,s.iw)("setForwardChatOrTopic",(async(e,t,n)=>{const{chatId:a,topicId:o}=n;let i=(0,c.dy)(e,a);if(i&&(0,c.Nm)(e)){if(!i.fullInfo){const{accessHash:t}=i;i=await(0,B.t9)("fetchFullUser",{id:a,accessHash:t}),e=(0,s.Rd)()}if(i?.fullInfo.noVoiceMessages)return void t.showDialog({data:{message:(0,I.i0)("VoiceMessagesRestrictedByPrivacy",(0,l.Js)(i))}})}(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,toThreadId:o,isModalShown:!1}}),t.openChat({id:a,threadId:o}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,s.iw)("forwardToSavedMessages",((e,t)=>{(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:e.currentUserId}}),t.exitMessageSelectMode(),t.forwardMessages({isSilent:!0})}));var q=n(85765),$=n(9211);const G=(0,T.P2)((e=>e()),500,!1);async function H(e){const t=await(0,B.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,recent:t}})}async function _(e){const t=await(0,B.t9)("fetchStickers",{stickerSetInfo:e});let n=(0,s.Rd)();if(!t)return(0,T.R3)((()=>{(0,s.Sv)().showNotification({message:(0,I.i0)("StickerPack.ErrorNotFound")})})),void("shortName"in e&&n.openedStickerSetShortName===e.shortName&&(0,s.R3)({...n,openedStickerSetShortName:void 0}));const{set:a,stickers:o,packs:i}=t;n=(0,r.Rg)(n,a.id,{...a,stickers:o,packs:i});const c=n.stickers.forEmoji.emoji;c&&i[c]&&(n=(0,r.vy)(n)),(0,s.R3)(n)}async function V(e,t,n){const a=await(0,B.t9)("searchGifs",{query:e,offset:n,username:t});a&&(0,s.R3)((0,r.rq)((0,s.Rd)(),!n,a.gifs,a.nextOffset))}(0,s.iw)("loadStickerSets",(async(e,t)=>{const[n,a]=await Promise.all([(0,B.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,B.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);a&&n&&(e=(0,s.Rd)(),e=(0,r.z3)(e,"added",n.hash,n.sets),e=(0,r.cU)(e,a.hash,a.sets),(0,s.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,s.iw)("loadAddedStickers",(async(e,t)=>{const{added:{setIds:n=[]},setsById:s}=e.stickers,{added:{setIds:a=[]}}=e.customEmojis,o=[...n,...a];if(o.length)for(let e=0;e<o.length;e++){const n=o[e];s[n]?.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:s[n].accessHash}}),e%10==0&&e>0&&await(0,T.wO)(200))}})),(0,s.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};H(t)})),(0,s.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,B.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,s.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,B.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,premium:{hash:n.hash,stickers:n.stickers}}}))})),(0,s.iw)("loadPremiumSetStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,B.t9)("fetchStickersForEmoji",{emoji:"📂⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,premiumSet:{hash:n.hash,stickers:n.stickers}}}))})),(0,s.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,B.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}}))})),(0,s.iw)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},n=await(0,B.t9)("fetchFeaturedStickers",{hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)((0,r.z3)(e,"featured",n.hash,n.sets)))})),(0,s.iw)("loadPremiumGifts",(async()=>{const e=await(0,B.t9)("fetchPremiumGifts");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)({...(0,s.Rd)(),premiumGifts:{...t,stickers:n}})})),(0,s.iw)("loadDefaultTopicIcons",(async e=>{const t=await(0,B.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,s.Rd)();const{set:n,stickers:a}=t,o={...n,stickers:a};e=(0,r.Rg)(e,o.id,o),(0,s.R3)({...e,defaultTopicIconsId:o.id})})),(0,s.iw)("loadStickers",((e,t,n)=>{const{stickerSetInfo:s}=n,a=(0,c.Ny)(e,s);a&&a.count===a?.stickers?.length||_(s)})),(0,s.iw)("loadAnimatedEmojis",(async e=>{const[t,n]=await Promise.all([(0,B.t9)("fetchAnimatedEmojis"),(0,B.t9)("fetchAnimatedEmojiEffects")]);t&&n&&(e=(0,s.Rd)(),e=(0,r.g_)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...n.set,stickers:n.stickers}},(0,s.R3)(e))})),(0,s.iw)("loadGenericEmojiEffects",(async e=>{const t=await(0,B.t9)("fetchGenericEmojiEffects");if(!t)return;e=(0,s.Rd)();const{set:n,stickers:a}=t;(0,s.R3)({...e,genericEmojiEffects:{...n,stickers:a}})})),(0,s.iw)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,B.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,s.iw)("saveGif",(async(e,t,n)=>{const{gif:a,shouldUnsave:o}=n,i=e.gifs.saved.gifs?.length,r=(0,$.M)(e,"savedGifs"),d=(0,$.P)(e,"savedGifs"),l=(0,c.wV)(e);if(!o&&i&&i>=r&&t.showNotification({title:I.i0("LimitReachedFavoriteGifs",r.toString()),message:l?I.i0("LimitReachedFavoriteGifsSubtitlePremium"):I.i0("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:t.openPremiumModal},className:"bold-link"}),!await(0,B.t9)("saveGif",{gif:a,shouldUnsave:o}))return;const u=(e=(0,s.Rd)()).gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==a.id}))||[],m=o?u:[a,...u];(0,s.R3)({...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:m}}})})),(0,s.iw)("faveSticker",((e,t,n)=>{const{sticker:s}=n,a=e.stickers.favorite.stickers.length,o=(0,$.M)(e,"stickersFaved"),i=(0,$.P)(e,"stickersFaved"),r=(0,c.wV)(e);a>=o&&t.showNotification({title:I.i0("LimitReachedFavoriteStickers",o.toString()),message:r?I.i0("LimitReachedFavoriteStickersSubtitlePremium"):I.i0("LimitReachedFavoriteStickersSubtitle",i.toString()),...!r&&{action:t.openPremiumModal},className:"bold-link"}),s&&(0,B.t9)("faveSticker",{sticker:s})})),(0,s.iw)("unfaveSticker",((e,t,n)=>{const{sticker:a}=n;a&&function(e){const t=(0,s.Rd)();(0,s.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((t=>{let{id:n}=t;return n!==e.id}))}}}),(0,B.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,s.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,B.t9)("removeRecentSticker",{sticker:s})&&H()})),(0,s.iw)("clearRecentStickers",(async e=>{await(0,B.t9)("clearRecentStickers")&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,recent:{stickers:[]}}}))})),(0,s.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:s}=n,a=(0,c.Ny)(e,s);if(!a)return;const{accessHash:o,installedDate:i}=a;(0,B.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:o})})),(0,s.iw)("loadEmojiKeywords",(async(e,t,n)=>{const{language:a}=n;let o=e.emojiKeywords[a];if(o?.isLoading)return;(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{...o,isLoading:!0}}});const i=await(0,B.t9)("fetchEmojiKeywords",{language:a,fromVersion:o?o.version:0});o=(e=(0,s.Rd)()).emojiKeywords[a],i?(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{isLoading:!1,version:i.version,keywords:{...o?.keywords,...i.keywords}}}}):(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{...o,isLoading:!1}}})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;a&&G((()=>{!async function(e,t){const n=await(0,B.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const a=(0,s.Rd)(),{setsById:o,added:i}=a.stickers,c=n.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=o[t]||{};n&&(0,q.Z)(n,e)&&c.unshift(t)}})),(0,s.R3)((0,r.z3)(a,"search",n.hash,n.sets,c))}(a)}))})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;"string"==typeof s&&G((()=>{V(s,e.config?.gifSearchUsername)}))})),(0,s.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&G((()=>{V(t,e.config?.gifSearchUsername,n)}))})),(0,s.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:a}=n,{hash:o}=e.stickers.forEmoji;G((()=>{!async function(e,t){let n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const a=await(0,B.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,s.Rd)(),a&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,a.stickers,a.hash),(0,s.R3)(n))}(a,o)}))})),(0,s.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,s.iw)("loadCustomEmojiForEmoji",((e,t,n)=>{const{emoji:s}=n;return(0,r.AA)(e,s)})),(0,s.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,s.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,B.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,g.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,g.ee)(t.sets,"id")}}}))})),(0,s.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:a}=n;(0,c.Ny)(e,a)||await _(a),e=(0,s.Rd)();const o=(0,c.Ny)(e,a);o?.shortName?(0,s.R3)({...e,openedStickerSetShortName:o.shortName}):t.showNotification({message:(0,I.i0)("StickerPack.ErrorNotFound")})}));var z=n(790);const W=(0,T.P2)((e=>e()),500,!1);async function X(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0;if(i){const s=(0,B.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:a.Hkl,offsetId:o,minDate:l,maxDate:d}),r=i.isForum?(0,B.t9)("fetchTopics",{chat:i,query:t,limit:a.XM3}):void 0,[c,u]=await Promise.all([s,r]);if(c){const{messages:t,users:n,totalCount:s,nextOffsetId:a}=c,{topics:o,count:i}=u||{};e={topics:o,totalTopicsCount:i,messages:t,users:n,chats:[],totalCount:s,nextRate:a}}}else e=await(0,B.t9)("searchMessagesGlobal",{query:t,offsetRate:o,limit:a.Hkl,type:n,maxDate:d,minDate:l});let u=(0,s.Rd)();const m=(0,c.JX)(u);if(!e||""!==t&&t!==m)return void(0,s.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:I,nextRate:v}=e;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,I,n,v),e.topics&&(u=(0,r.XG)(u,i.id,e.totalTopicsCount,e.topics));const w=e.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));u=(0,r.No)(u,{foundTopicIds:w}),(0,s.R3)(u)}async function Y(e,t,n,o){let d=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const l=await(0,B.t9)("searchMessagesLocal",{chat:e,type:n,limit:2*a.ENB,topMessageId:t===i._f?void 0:t,offsetId:o});if(!l)return;const{chats:u,users:m,messages:h,totalCount:p,nextOffsetId:f}=l,I=(0,g.ee)(h,"id"),v=Object.keys(I).map(Number);let w=(0,s.Rd)();const y=(0,c.we)(w);y&&(w=(0,r.fZ)(w,(0,g.ee)(u,"id")),w=(0,r.Sh)(w,(0,g.ee)(m,"id")),w=(0,r.c_)(w,e.id,I),w=(0,r.c1)(w,e.id,t,n,v,p,f),w=(0,r.xj)(w,e.id,t,v),(0,s.R3)(w),d||Y(e,t,n,f,!0))}(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:a}=e.globalSearch,{query:o}=n;o&&!a&&W((()=>{!async function(e){const t=await(0,B.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=(0,c.JX)(n);if(!t||!a||e!==a)return void(0,s.R3)((0,r.xv)(n,{chats:!1}));const{localChats:o,localUsers:i,globalChats:d,globalUsers:l}=t;(o.length||d.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...o,...d],"id"))),(i.length||l.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...i,...l],"id"))),n=(0,r.xv)(n,{chats:!1}),n=(0,r.No)(n,{localResults:{chatIds:o.map((e=>{let{id:t}=e;return t})),userIds:i.map((e=>{let{id:t}=e;return t}))},globalResults:{...n.globalSearch.globalResults,chatIds:d.map((e=>{let{id:t}=e;return t})),userIds:l.map((e=>{let{id:t}=e;return t}))}}),(0,s.R3)(n)}(o)}))})),(0,s.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:a}=n,o=a?(0,z.IS)(a):a;e=(0,r.No)(e,{date:a,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}}),(0,s.R3)(e);const{chatId:i}=e.globalSearch;X("","text",void 0,i?(0,c.Z1)(e,i):void 0,o,a)})),(0,s.iw)("searchMessagesGlobal",((e,t,n)=>{const{query:s,resultsByType:a,chatId:o,date:i}=e.globalSearch,r=i?(0,z.IS)(i):i,{type:d}=n,l=a?.[d]?.nextOffsetId;X(s,d,l,o?(0,c.Z1)(e,o):void 0,r,i)})),(0,s.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},o=t?(0,c.Z1)(e,t):void 0,d=(0,c.n5)(e);if(!o||!d||!n)return;const{query:l,results:u}=d,m=u?.nextOffsetId;let h;n!==i._f&&(h=(0,c.tZ)(e,t,n)?.topMessageId),async function(e,t,n,o,i){if(!o)return;const d=await(0,B.t9)("searchMessagesLocal",{chat:e,type:"text",query:o,topMessageId:n,limit:a.pnA,offsetId:i});if(!d)return;const{chats:l,users:u,messages:m,totalCount:h,nextOffsetId:p}=d,f=(0,g.ee)(m,"id"),I=Object.keys(f).map(Number);let v=(0,s.Rd)();const w=(0,c.n5)(v);w&&o===w.query&&(v=(0,r.fZ)(v,(0,g.ee)(l,"id")),v=(0,r.Sh)(v,(0,g.ee)(u,"id")),v=(0,r.c_)(v,e.id,f),v=(0,r.dx)(v,e.id,t,I,h,p),(0,s.R3)(v))}(o,n,h,l,m)})),(0,s.iw)("searchMediaMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(!t||!n)return;const s=(0,c.Z1)(e,t),a=(0,c.we)(e);if(!s||!a)return;const{currentType:o,resultsByType:i}=a,r=(o&&i&&i[o])?.nextOffsetId;o&&Y(s,n,o,r)})),(0,s.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:a}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.Z1)(e,o);i&&async function(e,t){const n=await(0,B.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,s.Sv)().focusMessage({chatId:e.id,messageId:n})}(i,a)})),(0,s.iw)("checkPublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};if(!a)return;if(e.management.progress===m.wv.InProgress)return;const{username:o}=n;e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0}),(0,s.R3)(e);const{result:i,error:d}=await(0,B.t9)("checkChatUsername",{username:o});e=(0,s.Rd)(),e=(0,r.H9)(e,!0===i?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:!0===i,checkedUsername:o,error:d}),(0,s.R3)(e),void 0===i&&t.openLimitReachedModal({limit:"channelsPublic"})})),(0,s.iw)("updatePublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};let o=a&&(0,c.Z1)(e,a);if(!a||!o)return;const{username:i}=n;if(e=(0,r.H9)(e,m.wv.InProgress),(0,s.R3)(e),(0,l.G9)(o)){if(o=await(0,x.bZ)(o),!o)return;t.openChat({id:o.id})}const d=await(0,B.t9)("setChatUsername",{chat:o,username:i});e=(0,s.Rd)(),e=(0,r.H9)(e,d?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0}),(0,s.R3)(e)})),(0,s.iw)("updatePrivateLink",(e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t&&(0,c.Z1)(e,t);t&&n&&(0,B.t9)("updatePrivateLink",{chat:n})})),(0,s.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:a,invite:o}=n;(0,s.R3)((0,r.fw)(e,a,{editingInvite:o}))})),(0,s.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:a,invite:o}=n,i=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};(0,s.R3)((0,r.fw)(e,a,i))})),(0,s.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:o,isRevoked:i,limit:d}=n,l=(0,c.Z1)(e,a),u=(0,c.dy)(e,o||e.currentUserId);if(!l||!u)return;const m=await(0,B.t9)("fetchExportedChatInvites",{peer:l,admin:u,isRevoked:i,limit:d});if(!m)return;e=(0,s.Rd)();const{invites:h,users:p}=m;e=(0,r.Sh)(e,(0,g.ee)(p,"id"));const f=i?{revokedInvites:h}:{invites:h};(0,s.R3)((0,r.fw)(e,a,f))})),(0,s.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:a,link:o,isRevoked:i,expireDate:d,usageLimit:l,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,a);if(!h)return;const p=await(0,B.t9)("editExportedChatInvite",{peer:h,link:o,isRevoked:i,expireDate:d,usageLimit:l,isRequestNeeded:u,title:m});if(!p)return;const{oldInvite:f,newInvite:I,users:v}=p,w=((e=(0,s.Rd)()).management.byChatId[a].invites||[]).filter((e=>e.link!==f.link)),y=[...e.management.byChatId[a].revokedInvites||[]];I.isRevoked?y.unshift(I):w.push(I),e=(0,r.Sh)(e,(0,g.ee)(v,"id")),(0,s.R3)((0,r.fw)(e,a,{invites:w,revokedInvites:y}))})),(0,s.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:a,expireDate:o,usageLimit:i,isRequestNeeded:d,title:l}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await(0,B.t9)("exportChatInvite",{peer:u,expireDate:o,usageLimit:i,isRequestNeeded:d,title:l});if(!m)return;const h=(e=(0,s.Rd)()).management.byChatId[a].invites||[];(0,s.R3)((0,r.fw)(e,a,{invites:[...h,m]}))})),(0,s.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:a,link:o}=n,i=(0,c.Z1)(e,a);if(!i)return;if(!await(0,B.t9)("deleteExportedChatInvite",{peer:i,link:o}))return;const d=(e=(0,s.Rd)()).management.byChatId[a];(0,s.R3)((0,r.fw)(e,a,{invites:d?.invites?.filter((e=>e.link!==o)),revokedInvites:d?.revokedInvites?.filter((e=>e.link!==o))}))})),(0,s.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:o}=n,i=(0,c.Z1)(e,a),d=(0,c.dy)(e,o||e.currentUserId);i&&d&&await(0,B.t9)("deleteRevokedExportedChatInvites",{peer:i,admin:d})&&(e=(0,s.Rd)(),(0,s.R3)((0,r.fw)(e,a,{revokedInvites:[]})))})),(0,s.iw)("loadChatInviteImporters",(async(e,t,n)=>{const{chatId:a,link:o,offsetDate:i,offsetUserId:d,limit:l}=n,u=(0,c.Z1)(e,a),m=(0,c.dy)(e,d);if(!u||d&&!m)return;const h=await(0,B.t9)("fetchChatInviteImporters",{peer:u,link:o,offsetDate:i,offsetUser:m,limit:l});if(!h)return;const{importers:g,users:p}=h,f=(e=(0,s.Rd)()).management.byChatId[a]?.inviteInfo;f?.invite&&f.invite.link===o&&(e=(0,r.fw)(e,a,{inviteInfo:{...f,importers:g}}),e=(0,r.Sh)(e,p),(0,s.R3)(e))})),(0,s.iw)("loadChatInviteRequesters",(async(e,t,n)=>{const{chatId:a,link:o,offsetDate:i,offsetUserId:d,limit:l}=n,u=(0,c.Z1)(e,a),m=(0,c.dy)(e,d);if(!u||d&&!m)return;const h=await(0,B.t9)("fetchChatInviteImporters",{peer:u,link:o,offsetDate:i,offsetUser:m,limit:l,isRequested:!0});if(!h)return;const{importers:g,users:p}=h,f=(e=(0,s.Rd)()).management.byChatId[a]?.inviteInfo;f?.invite&&f.invite.link===o&&(e=(0,r.fw)(e,a,{inviteInfo:{...f,requesters:g}}),e=(0,r.Sh)(e,p),(0,s.R3)(e))})),(0,s.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:a,offsetDate:o,offsetUserId:i,limit:d}=n,l=(0,c.Z1)(e,a),u=(0,c.dy)(e,i);if(!l||i&&!u)return;const m=await(0,B.t9)("fetchChatInviteImporters",{peer:l,offsetDate:o,offsetUser:u,limit:d,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,s.Rd)(),e=(0,r.a4)(e,a,{joinRequests:h}),e=(0,r.Sh)(e,g),(0,s.R3)(e)})),(0,s.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:a,userId:o,isApproved:i}=n,d=(0,c.Z1)(e,a),l=(0,c.dy)(e,o);if(!d||!l)return;if(!await(0,B.t9)("hideChatJoinRequest",{peer:d,user:l,isApproved:i}))return;e=(0,s.Rd)();const u=(0,c.Z1)(e,a);u&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:u.joinRequests?.filter((e=>e.userId!==o))}))})),(0,s.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:a,isApproved:o,link:i}=n,d=(0,c.Z1)(e,a);if(!d)return;if(!await(0,B.t9)("hideAllChatJoinRequests",{peer:d,isApproved:o,link:i}))return;e=(0,s.Rd)();const l=(0,c.Z1)(e,a);l&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:[],fullInfo:{...l.fullInfo,recentRequesterIds:[],requestsPending:0}}))})),(0,s.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&await(0,B.t9)("hideChatReportPanel",o)&&(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{settings:void 0}))}));var K=n(65116),J=n(16974);let Q,ee;(0,s.iw)("sync",(()=>{a.eMD&&console.log(">>> START SYNC"),Q&&clearTimeout(Q),(0,s.R3)({...(0,s.Rd)(),isSyncing:!0}),Q=window.setTimeout((()=>{(0,s.R3)({...(0,s.Rd)(),isSyncing:!1}),Q=void 0}),15e3);const{loadAllChats:e,preloadTopChatMessages:t}=(0,s.Sv)();e({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(){let e=!1,t=(0,s.Rd)();const{chatId:n,threadId:o}=(0,c.Bt)(t)||{},d=o||i._f,l=o&&n?(0,c.tZ)(t,n,o):void 0,u=l?.originChannelId||n,m=Object.keys(t.messages.byChatId).reduce(((e,n)=>(e[n]={},e[n].draft=(0,c.Ms)(t,n,d),e[n].editingId=(0,c._$)(t,n,d),e[n].editingDraft=(0,c.s)(t,n,d),e)),{}),h=u?t.chats.byId[u]:void 0;if(u&&h){const o=await(p=h,f=d,I=l?.lastReadInboxMessageId,(0,B.t9)("fetchMessages",{chat:p,threadId:f,offsetId:I||p.lastReadInboxMessageId,addOffset:-(Math.round(a.hT6/2)+1),limit:a.hT6}));t=(0,s.Rd)();const{chatId:i}=(0,c.Bt)(t)||{};if(o&&i===n){const s=(0,c.Zw)(t,u),i=n===a.awM?t.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],l=h.isForum&&h.topics?Object.values(h.topics).map((e=>{let{lastMessageId:t}=e;return s[t]})).filter(Boolean):[],m=[].concat(o.messages,i,l),p=(0,g.ee)(m,"id"),f=Object.keys(p).map(Number);t={...t,messages:{...t.messages,byChatId:{}}},t=(0,r.c_)(t,u,p),t=(0,r.xj)(t,u,d,f),t=(0,r.y9)(t,u,d,f),t=(0,r.GL)(t,(0,g.ee)(o.chats,"id")),t=(0,r.eD)(t,(0,g.ee)(o.users,"id")),t=(0,r.j6)(t,u,o.repliesThreadInfos),e=!0}}var p,f,I;e||(t={...t,messages:{...t.messages,byChatId:{}}}),Object.keys(m).forEach((e=>{t=(0,r.sN)(t,e,d,m[e])})),(0,s.R3)(t),h?.isForum&&((0,s.Sv)().loadTopics({chatId:u,force:!0}),o&&o!==i._f&&(0,s.Sv)().loadTopicById({chatId:u,topicId:o,shouldCloseChatOnError:!0}));const{chatId:v,messageId:w}=t.audioPlayer;v&&w&&!(0,c.hj)(t,v,w)&&(0,s.Sv)().closeAudioPlayer()}(),(0,s.R3)({...(0,s.Rd)(),lastSyncTime:Date.now(),isSyncing:!1}),a.eMD&&console.log(">>> FINISH SYNC"),(0,J.S1)(),e({listType:"archived",shouldReplace:!0}),(0,B.t9)("fetchCurrentUser"),t()}})})),(0,K.ll)((e=>{const{connectionState:t,authState:n}=e;ee?.connectionState===t&&ee?.authState===n||("connectionStateReady"===t&&"authorizationStateReady"===n&&(0,s.Sv)().sync(),ee=e)})),(0,s.iw)("reportPeer",(async(e,t,n)=>{const{chatId:s,reason:a,description:o}=n;if(!s)return;const i=(0,c.Z1)(e,s);if(!i)return;const r=await(0,B.t9)("reportPeer",{peer:i,reason:a,description:o});t.showNotification({message:r?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:s,reason:a,description:o,photo:i}=n;if(!s)return;const r=(0,c.Z1)(e,s);if(!r||!i)return;const d=await(0,B.t9)("reportProfilePhoto",{peer:r,photo:i,reason:a,description:o});t.showNotification({message:d?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("loadAuthorizations",(async()=>{const e=await(0,B.t9)("fetchAuthorizations");e&&(0,s.R3)({...(0,s.Rd)(),activeSessions:{byHash:e.authorizations,orderedHashes:Object.keys(e.authorizations),ttlDays:e.ttlDays}})})),(0,s.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,B.t9)("terminateAuthorization",a))return;e=(0,s.Rd)();const{[a]:o,...i}=e.activeSessions.byHash;(0,s.R3)({...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,B.t9)("terminateAllAuthorizations"))return;const t=(e=(0,s.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];(0,s.R3)({...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}})})),(0,s.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:a,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,B.t9)("changeSessionSettings",{hash:a,areCallsEnabled:o,areSecretChatsEnabled:i})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[a]:{...e.activeSessions.byHash[a],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0}}}}))})),(0,s.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:a}=n;await(0,B.t9)("changeSessionTtl",{days:a})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,ttlDays:a}}))})),(0,s.iw)("loadWebAuthorizations",(async e=>{const t=await(0,B.t9)("fetchWebAuthorizations");if(!t)return;const{users:n,webAuthorizations:a}=t;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(n,"id")),(0,s.R3)({...e,activeWebSessions:{byHash:a,orderedHashes:Object.keys(a)}})})),(0,s.iw)("terminateWebAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,B.t9)("terminateWebAuthorization",a))return;e=(0,s.Rd)();const{[a]:o,...i}=e.activeWebSessions.byHash;(0,s.R3)({...e,activeWebSessions:{byHash:i,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllWebAuthorizations",(async e=>{await(0,B.t9)("terminateAllWebAuthorizations")&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeWebSessions:{byHash:{},orderedHashes:[]}}))}));const te=(0,T.P2)((e=>e()),500,!1);function ne(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function se(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,s.iw)("loadFullUser",((e,t,n)=>{const{userId:s}=n,a=(0,c.dy)(e,s);if(!a)return;const{id:o,accessHash:i}=a;(0,B.t9)("fetchFullUser",{id:o,accessHash:i})})),(0,s.iw)("loadUser",(async(e,t,n)=>{const{userId:a}=n,o=(0,c.dy)(e,a);if(!o)return;const i=await(0,B.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:d,userStatusesById:l}=i;e=(0,s.Rd)(),e=(0,r.eD)(e,(0,g.ee)(d,"id")),e=(0,r.ps)(e,{...e.users.statusesById,...l}),(0,s.R3)(e)})),(0,s.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,B.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let a=(0,s.Rd)();a=(0,r.Sh)(a,(0,g.ee)(n,"id")),a={...a,topPeers:{...a.topPeers,userIds:t,lastRequestedAt:(0,p.b)(a.serverTimeOffset)}},(0,s.R3)(a)}()})),(0,s.iw)("loadContactList",(()=>{!async function(){const e=await(0,B.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,s.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id")),t=(0,r.zn)(t,e.userStatusesById);const n=e=>e.lastName||e.firstName||"",a=new Intl.Collator("en-US"),o=e.users.sort(((e,t)=>a.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,s.R3)({...t,contactList:{userIds:o.map((e=>e.id))}})}()})),(0,s.iw)("loadCurrentUser",(()=>{(0,B.t9)("fetchCurrentUser")})),(0,s.iw)("loadCommonChats",(async e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t?(0,c.dy)(e,t):void 0;if(!n||(0,l.cS)(n)||n.commonChats?.isFullyLoaded)return;const a=n.commonChats?.maxId,o=await(0,B.t9)("fetchCommonChats",n.id,n.accessHash,a);if(!o)return;const{chats:i,chatIds:d,isFullyLoaded:u}=o;e=(0,s.Rd)(),i.length&&(e=(0,r.fZ)(e,(0,g.ee)(i,"id"))),e=(0,r.Nq)(e,n.id,{commonChats:{maxId:d.length?d[d.length-1]:"0",ids:(0,g.Tw)((n.commonChats?.ids||[]).concat(d)),isFullyLoaded:u}}),(0,s.R3)(e)})),(0,s.iw)("updateContact",((e,t,n)=>{const{userId:a,isMuted:o=!1,firstName:i,lastName:d,shouldSharePhoneNumber:l}=n;!async function(e,t,n,a,o){let i=(0,s.Rd)();const d=(0,c.dy)(i,e);if(!d)return;let l;if((0,s.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,s.R3)((0,r.H9)((0,s.Rd)(),m.wv.InProgress)),!d.isContact&&d.phoneNumber)l=await(0,B.t9)("importContact",{phone:d.phoneNumber,firstName:n,lastName:a});else{const{id:e,accessHash:t}=d;l=await(0,B.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:a,shouldSharePhoneNumber:o})}l&&((0,s.Sv)().loadChatSettings({chatId:e}),(0,s.R3)((0,r.Nq)((0,s.Rd)(),d.id,{firstName:n,lastName:a}))),i=(0,s.Rd)(),i=(0,r.H9)(i,m.wv.Complete),i=(0,r.ft)(i),(0,s.R3)(i)}(a,o,i,d,l)})),(0,s.iw)("deleteContact",((e,t,n)=>{const{userId:a}=n;!async function(e){const t=(0,s.Rd)(),n=(0,c.dy)(t,e);if(!n)return;const{id:a,accessHash:o}=n;await(0,B.t9)("deleteContact",{id:a,accessHash:o})}(a)})),(0,s.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:a}=n,o=(0,l.YC)(a),i=o?(0,c.dy)(e,a):void 0,d=o?void 0:(0,c.Z1)(e,a);if(!i&&!d)return;const u=await(0,B.t9)("fetchProfilePhotos",i,d);if(!u||!u.photos)return;e=(0,s.Rd)();const m=i||d,{photos:h,users:p}=u;h.sort((e=>e.id===m?.avatarHash?-1:1)),e=(0,r.Sh)(e,(0,g.ee)(p,"id")),e=o?(0,r.Nq)(e,a,{photos:h}):(0,r.a4)(e,a,{photos:h}),(0,s.R3)(e)})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;a&&te((()=>{!async function(e){const t=await(0,B.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=n.userSearch.query;if(!t||!a||e!==a)return void(0,s.R3)((0,r.Q3)(n,!1));const{localUsers:o,globalUsers:i}=t;let c,d;o.length&&(n=(0,r.Sh)(n,(0,g.ee)(o,"id")),c=o.map((e=>{let{id:t}=e;return t}))),i.length&&(n=(0,r.Sh)(n,(0,g.ee)(i,"id")),d=i.map((e=>{let{id:t}=e;return t}))),n=(0,r.Q3)(n,!1),n=(0,r.Lm)(n,{localUserIds:c,globalUserIds:d}),(0,s.R3)(n)}(a)}))})),(0,s.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:a,firstName:o,lastName:i}=n,c=await(0,B.t9)("importContact",{phone:a,firstName:o,lastName:i});c?(t.openChat({id:c}),(0,s.R3)((0,r.ft)((0,s.Rd)()))):t.showNotification({message:I.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,s.iw)("reportSpam",((e,t,n)=>{const{chatId:s}=n,a=(0,l.YC)(s)?(0,c.dy)(e,s):(0,c.Z1)(e,s);a&&(0,B.t9)("reportSpam",a)}));var ae=n(18629);const oe=h.cj||h.wZ;class ie{constructor(e,t){var n,s,a;this.features=e,this.onFail=t,n=this,a=void 0,(s=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(s="preOpened"))in n?Object.defineProperty(n,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[s]=a}preOpenIfNeeded(){oe&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():this.onFail?.())}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!oe){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const re="https://prizes.gamee.com/",ce=(0,T.Ds)((e=>e()),500,!1);async function de(e,t){await(0,B.t9)("toggleAttachBot",{bot:e,isEnabled:t}),await le()}async function le(e){const t=await(0,B.t9)("loadAttachBots",{hash:e});if(!t)return;let n=(0,s.Rd)();n=(0,r.Sh)(n,(0,g.ee)(t.users,"id")),(0,s.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}function ue(e,t){if("request"===t.type){const e=(0,s.Rd)();if(!e.urlAuth)return;const{domain:n,bot:a,shouldRequestWriteAccess:o}=t;return void(0,s.R3)({...e,urlAuth:{...e.urlAuth,request:{domain:n,botId:a.id,shouldRequestWriteAccess:o}}})}const n="accepted"===t.type?t.url:e;window.open(n,"_blank","noopener"),(0,s.Sv)().closeUrlAuthModal()}async function me(e,t,n,s,a){await(0,B.t9)("sendMessage",{chat:e,text:n,replyingTo:s,sendAs:a})}let he;async function ge(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{showDialog:o,showNotification:i,openUrl:r,openGame:c}=(0,s.Sv)();a&&(he||(he=new ie("popup,width=800,height=600",(()=>{i({message:"Allow browser to open popup window"})}))),he.preOpenIfNeeded());const d=await(0,B.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n,isGame:a});if(!d)return;const{message:l,alert:u,url:m}=d;u?o({data:{message:l||"Error"}}):l?i({message:l}):m&&(a?m.includes(re)?he.open(m):(he.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}async function pe(e){const t=await(0,B.t9)("getPaymentForm",e);if(!t)return;const{form:n,invoice:a,users:o}=t;let i=(0,r._7)((0,s.Rd)(),n);return i=(0,r.Q$)(i,m.KB.Checkout),i=(0,r.Sh)(i,(0,g.ee)(o,"id")),(0,s.R3)(i),a}async function fe(e,t,n){const a=await(0,B.t9)("validateRequestedInfo",{inputInvoice:e,requestInfo:t,shouldSave:n});if(!a)return;const{id:o,shippingOptions:i}=a;let c=(0,r.vT)((0,s.Rd)(),o);i?(c=(0,r.TM)(c,i),c=(0,r.Q$)(c,m.KB.Shipping)):c=(0,r.Q$)(c,m.KB.Checkout),(0,s.R3)(c)}(0,s.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:s,button:a}=n;switch(a.type){case"command":t.sendBotCommand({command:a.text});break;case"url":{const{url:e}=a;t.openUrl({url:e});break}case"callback":{const t=(0,c.jr)(e);if(!t)return;ge(t,s,a.data);break}case"requestPoll":t.openPollModal({isQuiz:a.isQuiz});break;case"requestPhone":{const n=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id}});break}case"receipt":{const n=(0,c.jr)(e);if(!n)return;const{receiptMessageId:o}=a;t.getReceipt({receiptMessageId:o,chatId:n.id,messageId:s});break}case"buy":{const n=(0,c.jr)(e);if(!n)return;t.openInvoice({chatId:n.id,messageId:s});break}case"game":{const t=(0,c.jr)(e);if(!t)return;ge(t,s,void 0,!0);break}case"switchBotInline":{const{query:e,isSamePeer:n}=a;t.switchBotInline({query:e,isSamePeer:n,messageId:s});break}case"userProfile":{const{userId:e}=a;t.openChatWithInfo({id:e});break}case"simpleWebView":{const{url:n}=a,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.hj)(e,o,s);if(!i?.senderId)return;const r=(0,ae.BS)();t.requestSimpleWebView({url:n,botId:i?.senderId,theme:r,buttonText:a.text});break}case"webView":{const{url:n}=a,o=(0,c.jr)(e);if(!o)return;const i=(0,c.hj)(e,o.id,s);if(!i)return;const r=i.viaBotId||i.senderId;if(!r)return;const d=(0,ae.BS)();t.requestWebView({url:n,botId:r,peerId:o.id,theme:d,buttonText:a.text});break}case"urlAuth":{const{url:n}=a,o=(0,c.jr)(e);if(!o)return;t.requestBotUrlAuth({chatId:o.id,messageId:s,buttonId:a.buttonId,url:n});break}}})),(0,s.iw)("sendBotCommand",((e,t,n)=>{const{command:s,chatId:a}=n,{currentUserId:o}=e,i=a?(0,c.Z1)(e,a):(0,c.jr)(e),r=(0,c.Bt)(e);if(!o||!i||!r)return;const{threadId:d}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:d,value:!1}),me(i,0,s,(0,c.Yy)(e,i.id,d),(0,c._5)(e,a))})),(0,s.iw)("restartBot",(async(e,t,n)=>{const{chatId:a}=n,{currentUserId:o}=e,i=(0,c.jr)(e),d=o&&(0,c.IK)(e,a);o&&i&&d&&await(0,B.t9)("unblockContact",d.id,d.accessHash)&&((0,s.R3)((0,r.rB)((0,s.Rd)(),d.id)),me(i,0,"/start",void 0,(0,c._5)(e,a)))})),(0,s.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,p.b)(e.serverTimeOffset)-t<60)return;const n=await(0,B.t9)("fetchTopInlineBots");if(!n)return;const{ids:a,users:o}=n;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:a,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,s.R3)(e)})),(0,s.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:a,username:o,query:i,offset:d}=n;let l=e.inlineBots.byUsername[o];if(!1!==l){if(void 0===l){const{user:t,chat:n}=await(0,B.t9)("fetchInlineBot",{username:o})||{};if(e=(0,s.Rd)(),!t||!n)return void(0,s.R3)(ne(e,o,!1));e=(0,r.Sh)(e,{[t.id]:t}),e=(0,r.fZ)(e,{[n.id]:n}),l={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=ne(e,o,l),(0,s.R3)(e)}(i!==l.query||l.canLoadMore)&&ce((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:a,query:o,offset:i}=e,r=(0,s.Rd)();const d=(0,c.dy)(r,n.id),l=(0,c.Z1)(r,a);if(!d||!l)return;const u=n.query!==o;r=se(r,!0),r=ne(r,t,{...n,query:o,...u&&{offset:void 0,results:[]}}),(0,s.R3)(r);const m=await(0,B.t9)("fetchInlineBotResults",{bot:d,chat:l,query:o,offset:u?void 0:i}),h=r.inlineBots.byUsername[t];if(r=se((0,s.Rd)(),!1),!m||!h||o!==h.query)return void(0,s.R3)(r);const g=new Set((h.results||[]).map((e=>e.id))),p=m.results.filter((e=>!g.has(e.id)));r=ne(r,t,{...h,help:m.help,...p.length&&{isGallery:m.isGallery},...m.switchPm&&{switchPm:m.switchPm},canLoadMore:m.results.length>0&&Boolean(m.nextOffset),results:""===h.offset||h.offset===m.nextOffset?m.results:(h.results||[]).concat(p),offset:p.length?m.nextOffset:""}),(0,s.R3)(r)}({username:o,inlineBotData:l,chatId:a,query:i,offset:d})}))}})),(0,s.iw)("switchBotInline",((e,t,n)=>{const{query:s,isSamePeer:a,messageId:o}=n,i=(0,c.jr)(e);if(!i)return;const r=(0,c.hj)(e,i.id,o);if(!r)return;const d=(0,c.dy)(e,r.viaBotId||r.senderId);d&&t.openChatWithDraft({text:`@${d.usernames[0].username} ${s}`,chatId:a?i.id:void 0})})),(0,s.iw)("sendInlineBotResult",((e,t,n)=>{const{id:s,queryId:a,isSilent:o,scheduledAt:r}=n,d=(0,c.Bt)(e);if(!d||!s)return;const{chatId:l,threadId:u}=d,m=(0,c.Z1)(e,l),h=(0,c.Yy)(e,l,u);let g;h&&u!==i._f&&(g=(0,c.qS)(e,l,u)),t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:l,threadId:u,value:!1}),(0,B.t9)("sendInlineBotResult",{chat:m,resultId:s,queryId:a,replyingTo:h,replyingToTopId:g,sendAs:(0,c._5)(e,l),isSilent:o,scheduleDate:r})})),(0,s.iw)("resetInlineBot",((e,t,n)=>{const{username:a}=n;let o=e.inlineBots.byUsername[a];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,s.R3)(ne(e,a,o)))})),(0,s.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:o}=n;let i=(0,c.dy)(e,a);i&&(i.fullInfo||await(0,B.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash}),i=(0,c.dy)((0,s.Rd)(),a),i.fullInfo?.isBlocked&&await(0,B.t9)("unblockContact",i.id,i.accessHash),await(0,B.t9)("startBot",{bot:i,startParam:o}))})),(0,s.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:a,botId:o,theme:i,buttonText:r}=n,d=(0,c.dy)(e,o);if(!d)return;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}});const l=await(0,B.t9)("requestSimpleWebView",{url:a,bot:d,theme:i});l&&(e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:l,botId:o,buttonText:r}}))})),(0,s.iw)("requestWebView",(async(e,t,n)=>{const{url:a,botId:o,peerId:i,theme:r,isSilent:d,buttonText:l,isFromBotMenu:u,startParam:m}=n,h=(0,c.dy)(e,o);if(!h)return;const g=(0,c.Z1)(e,i);if(!g)return;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}});const p=(0,c.Bt)(e);if(!p)return;const{chatId:f,threadId:I}=p,v=f&&(0,c.Yy)(e,f,I),w=(0,c._5)(e,f),y=await(0,B.t9)("requestWebView",{url:a,bot:h,peer:g,theme:r,isSilent:d,replyToMessageId:v||void 0,threadId:I,isFromBotMenu:u,startParam:m,sendAs:w});if(!y)return;const{url:P,queryId:Z}=y;e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:P,botId:o,queryId:Z,replyToMessageId:v||void 0,threadId:I,buttonText:l}})})),(0,s.iw)("prolongWebView",(async(e,t,n)=>{const{botId:s,peerId:a,isSilent:o,replyToMessageId:i,queryId:r,threadId:d}=n,l=(0,c.dy)(e,s);if(!l)return;const u=(0,c.Z1)(e,a);if(!u)return;const m=(0,c._5)(e,a);await(0,B.t9)("prolongWebView",{bot:l,peer:u,isSilent:o,replyToMessageId:i,threadId:d,queryId:r,sendAs:m})||t.closeWebApp()})),(0,s.iw)("sendWebViewData",((e,t,n)=>{const{bot:s,data:a,buttonText:o}=n;(0,B.t9)("sendWebViewData",{bot:s,data:a,buttonText:o})})),(0,s.iw)("closeWebApp",(e=>({...e,webApp:void 0}))),(0,s.iw)("setWebAppPaymentSlug",((e,t,n)=>{if(e.webApp?.url)return{...e,webApp:{...e.webApp,slug:n.slug}}})),(0,s.iw)("cancelBotTrustRequest",(e=>({...e,botTrustRequest:void 0}))),(0,s.iw)("markBotTrusted",((e,t,n)=>{const{botId:a}=n,{trustedBotIds:o}=e,i=new Set(o);if(i.add(a),(0,s.R3)({...e,botTrustRequest:void 0,trustedBotIds:Array.from(i)}),e.botTrustRequest?.onConfirm){const{action:n,payload:s}=e.botTrustRequest.onConfirm;t[n](s)}})),(0,s.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:s}=n||{};await le(s)})),(0,s.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:s,isEnabled:a}=n,o=(0,c.dy)(e,s);o&&await de(o,a)})),(0,s.iw)("callAttachBot",((e,t,n)=>{const{chatId:s,botId:a,isFromBotMenu:o,url:i,startParam:r,threadId:c}=n,{attachMenu:{bots:d}}=e;if(!o&&!d[a])return{...e,requestedAttachBotInstall:{botId:a,onConfirm:{action:"callAttachBot",payload:{chatId:s,botId:a,startParam:r,threadId:c}}}};const l=(0,ae.BS)();t.openChat({id:s,threadId:c}),t.requestWebView({url:i,peerId:s,botId:a,theme:l,buttonText:"",isFromBotMenu:o,startParam:r})})),(0,s.iw)("confirmAttachBotInstall",(async e=>{const{requestedAttachBotInstall:t}=e,{botId:n,onConfirm:a}=t;(0,s.R3)({...e,requestedAttachBotInstall:void 0});const o=(0,c.dy)(e,n);if(o&&(await de(o,!0),a)){const{action:e,payload:t}=a;(0,s.Sv)()[e](t)}})),(0,s.iw)("cancelAttachBotInstall",(e=>({...e,requestedAttachBotInstall:void 0}))),(0,s.iw)("requestAttachBotInChat",((e,t,n)=>{const{botId:a,filter:o,startParam:i}=n,r=(0,c.Bt)(e)?.chatId,{attachMenu:{bots:d}}=e,l=d[a];if(!l)return;const u=l.peerTypes.filter((e=>"self"!==e&&o.includes(e)));u.length?(0,s.R3)({...e,requestedAttachBotInChat:{botId:a,filter:u,startParam:i}}):t.callAttachBot({chatId:r||a,botId:a,startParam:i})})),(0,s.iw)("cancelAttachBotInChat",(e=>({...e,requestedAttachBotInChat:void 0}))),(0,s.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:a,buttonId:o,messageId:i,url:r}=n,d=(0,c.Z1)(e,a);if(!d)return;const l=await(0,B.t9)("requestBotUrlAuth",{chat:d,buttonId:o,messageId:i});l&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:d.id}}}),ue(r,l))})),(0,s.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s}=n;if(!e.urlAuth?.button)return;const{button:a,url:o}=e.urlAuth,{chatId:i,messageId:r,buttonId:d}=a,l=(0,c.Z1)(e,i);if(!l)return;const u=await(0,B.t9)("acceptBotUrlAuth",{chat:l,messageId:r,buttonId:d,isWriteAllowed:s});u&&ue(o,u)})),(0,s.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:a}=n,o=await(0,B.t9)("requestLinkUrlAuth",{url:a});o&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:a}}),ue(a,o))})),(0,s.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s}=n;if(!e.urlAuth?.url)return;const{url:a}=e.urlAuth,o=await(0,B.t9)("acceptLinkUrlAuth",{url:a,isWriteAllowed:s});o&&ue(a,o)})),(0,s.iw)("closeUrlAuthModal",(e=>({...e,urlAuth:void 0}))),n(55282),(0,s.iw)("loadPasswordInfo",(async e=>{const t=await(0,B.t9)("getPasswordInfo");t&&(e=(0,s.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),e=(0,r.IE)(e,{hint:t.hint}),(0,s.R3)(e))})),(0,s.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,B.t9)("checkPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),i&&o()})),(0,s.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,B.t9)("clearPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),i&&o()})),(0,s.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:a,password:o,hint:i,email:c,onSuccess:d}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const l=await(0,B.t9)("updatePassword",a,o,i,c);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),l&&d()})),(0,s.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:a,email:o,onSuccess:i}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,B.t9)("updateRecoveryEmail",a,o);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),c&&i()})),(0,s.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:s}=n;(0,B.t9)("provideRecoveryEmailCode",s)})),(0,s.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,s.iw)("validateRequestedInfo",((e,t,n)=>{const s=(0,c.kb)(e);if(!s)return;const{requestInfo:a,saveInfo:o}=n;if("slug"in s)fe(s,a,o);else{const t=(0,c.Z1)(e,s.chatId);if(!t)return;fe({chat:t,messageId:s.messageId},a,o)}})),(0,s.iw)("openInvoice",(async(e,t,n)=>{let a;if("slug"in n)a=await pe({slug:n.slug});else{const t=(0,c.Z1)(e,n.chatId);if(!t)return;a=await pe({chat:t,messageId:n.messageId})}a&&(e=(0,s.Rd)(),e=(0,r.bs)(e,a),(0,s.R3)({...e,payment:{...e.payment,inputInvoice:n,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:n.isExtendedMedia}}))})),(0,s.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:a,chatId:o,messageId:i}=n,d=o&&(0,c.Z1)(e,o);i&&a&&d&&async function(e,t,n){const a=await(0,B.t9)("getReceipt",e,n);if(!a)return;let o=(0,s.Rd)();const i=(0,c.hj)(o,e.id,t);o=(0,r.Sh)(o,(0,g.ee)(a.users,"id")),o=(0,r.Dq)(o,a.receipt,i),(0,s.R3)(o)}(d,i,a)})),(0,s.iw)("clearPaymentError",(e=>{(0,s.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,s.iw)("clearReceipt",(e=>{(0,s.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,s.iw)("sendCredentialsInfo",((e,t,n)=>{const{nativeProvider:o}=e.payment,{credentials:i}=n,{data:d}=i;if("stripe"===o){const t=(0,c.$$)(e);if(!t)return;!async function(e,t){const n=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),a=await fetch(`https://api.stripe.com/v1/tokens${n}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),o=await a.json();if(o.error){const e=(0,l.Ow)(o.error),t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let i=(0,r.QH)((0,s.Rd)(),{type:o.type,id:o.id});i=(0,r.Q$)(i,m.KB.Checkout),(0,s.R3)(i)}(d,t)}else if("smartglocal"===o){const t=(0,c.EB)(e);if(!t)return;!async function(e,t){const n={card:{number:e.cardNumber.replace(/\D+/g,""),expiration_month:e.expiryMonth,expiration_year:e.expiryYear,security_code:e.cvv.replace(/\D+/g,"")}},o=a.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",i=await fetch(o,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":t},body:JSON.stringify(n)}),c=await i.json();if("ok"!==c.status){const e={description:"payment error"},t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let d=(0,r.QD)((0,s.Rd)(),{type:"card",token:c.data.token});d=(0,r.Q$)(d,m.KB.Checkout),(0,s.R3)(d)}(d,t)}})),(0,s.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:a,saveCredentials:o,savedCredentialId:i,tipAmount:d}=n,l=(0,c.kb)(e),u=(0,c.eh)(e),m=(0,c.sp)(e),{nativeProvider:h,temporaryPassword:g}=e.payment,p="stripe"===h?(0,c.$$)(e):(0,c.EB)(e);if(!(l&&p&&u&&h))return;let f;if("slug"in l)f={slug:l.slug};else{const t=(0,c.Z1)(e,l.chatId);if(!t)return;f={chat:t,messageId:l.messageId}}(0,s.R3)((0,r.cQ)(e,{status:"pending"}));const I={save:o,data:"stripe"===h?(0,c.i3)(e):(0,c.Jg)(e)};await(0,B.t9)("sendPaymentForm",{inputInvoice:f,formId:u,credentials:I,requestedInfoId:m,shippingOptionId:a,savedCredentialId:i,temporaryPassword:g?.value,tipAmount:d})&&(e=(0,s.Rd)(),e=(0,r.cQ)(e,{status:"paid"}),e=(0,r.WY)(e),(0,s.R3)(e))})),(0,s.iw)("setPaymentStep",(function(e,t){var n;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,null!==(n=s.step)&&void 0!==n?n:m.KB.Checkout)})),(0,s.iw)("closePremiumModal",((e,t,n)=>{if(!e.premiumModal)return;const{isClosed:s}=n||{};return{...e,premiumModal:{...e.premiumModal,...s&&{isOpen:!1},isClosing:!s}}})),(0,s.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:a,fromUserId:o,isSuccess:i,isGift:c,monthsAmount:d,toUserId:l}=n||{};t.loadPremiumStickers();const u=await(0,B.t9)("fetchPremiumPromo");u&&(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),(0,s.R3)({...e,premiumModal:{promo:u.promo,initialSection:a,isOpen:!0,fromUserId:o,toUserId:l,isGift:c,monthsAmount:d,isSuccess:i}}))})),(0,s.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:a}=n||{},o=await(0,B.t9)("fetchPremiumPromo");if(!o)return;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id"));const i=o.promo.options.find((e=>1===e.months));(0,s.R3)({...e,giftPremiumModal:{isOpen:!0,forUserId:a,monthlyCurrency:i.currency,monthlyAmount:i.amount}})})),(0,s.iw)("closeGiftPremiumModal",(e=>{(0,s.R3)({...e,giftPremiumModal:{isOpen:!1}})})),(0,s.iw)("validatePaymentPassword",(async(e,t,n)=>{let{password:a}=n;const o=await(0,B.t9)("fetchTemporaryPaymentPassword",a);e=(0,s.Rd)(),e=o?"error"in o?(0,r.cQ)(e,{error:{message:o.error,field:"password"}}):(0,r.cQ)(e,{temporaryPassword:o,step:m.KB.Checkout}):(0,r.cQ)(e,{error:{message:"Unknown Error",field:"password"}}),(0,s.R3)(e)}));var Ie=n(40647),ve=n(74399);const we=32*ve.Gw,ye=45.5*ve.Gw,Pe=26.5*ve.Gw,Ze=16*ve.Gw,Ce=16.125*ve.Gw;var be=n(43858),Ee=n(53475),Se=n(4907);function Me(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=be.Z.get().width)>a._mX?Math.min(Math.max(.25*n,Ze),.33*n):n>a.ksF?Math.min(Math.max(.33*n,Ze),.4*n):Pe):0);var n}function Re(e,t,n){return(0,Ee.a4)(e,t,n,void 0,!0)}let ke=0;(0,s.iw)("loadAvailableReactions",(async()=>{const e=await(0,B.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&Ie.he(`sticker${e.aroundAnimation.id}`,i.IU.BlobUrl),e.centerIcon&&Ie.he(`sticker${e.centerIcon.id}`,i.IU.BlobUrl)})),(0,s.R3)({...(0,s.Rd)(),availableReactions:e}))})),(0,s.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:s,x:a,y:o,localEffect:i,startSize:r,isReversed:c}=n,d={id:ke++,animatedEffect:s||i,x:Me(e,a)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:r,isReversed:c};return{...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],d]}})),(0,s.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:s,chatId:a,emoji:o,interactions:i,localEffect:r}=n,d=(0,c.Z1)(e,a);d&&(o||r)&&a!==e.currentUserId&&(0,B.t9)("sendEmojiInteraction",{chat:d,messageId:s,emoticon:o||(0,c.ji)(r),timestamps:i})})),(0,s.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.q6)(e,s),i=(0,c.hj)(e,s,a);o&&i&&!(0,l.CI)(i)&&t.toggleReaction({chatId:s,messageId:a,reaction:o})})),(0,s.iw)("toggleReaction",((e,t,n)=>{const{chatId:s,reaction:o}=n;let{messageId:i}=n;const r=(0,c.Z1)(e,s);let d=(0,c.hj)(e,s,i);if(!r||!d)return;const u=Boolean(d.groupedId)&&!d.isInAlbum,m=u?(0,c.xH)(e,s,d.groupedId)[0]:void 0;d=u&&(0,c.hj)(e,s,m)||d,i=d?.id||i;const h=(0,l.UZ)(d),p=h.some((e=>(0,l.Hl)(e,o))),f=p?h.filter((e=>!(0,l.Hl)(e,o))):[...h,o],I=(0,c.oC)(e),v=f.slice(-I);(0,B.t9)("sendReaction",{chat:r,messageId:i,reactions:v});const{animationLevel:w}=e.settings.byKey;if(w===a.zy8){const t=p?(0,g.CE)(e.activeReactions,[i]):{...e.activeReactions,[i]:[...e.activeReactions[i]||[],{messageId:i,reaction:o}]};e={...e,activeReactions:t}}return function(e,t,n){const s=t.reactions||{results:[]},a=s.results.map((e=>(0,l.Bt)(e)?{...e,chosenOrder:void 0,count:e.count-1}:e)).filter((e=>{let{count:t}=e;return t>0}));n.forEach(((e,t)=>{const n=a.findIndex((t=>(0,l.Hl)(t.reaction,e)));n>-1?a[n]={...a[n],chosenOrder:t,count:a[n].count+1}:a.push({reaction:e,chosenOrder:t,count:1})}));let{recentReactions:o=[]}=s;return o.length&&(o=o.filter((t=>{let{userId:n}=t;return n!==e.currentUserId}))),n.forEach((t=>{const{currentUserId:n}=e;o.unshift({userId:n,reaction:t})})),(0,Se.cY)(e,t.chatId,t.id,{reactions:{...s,results:a,recentReactions:o}})}(e,d,v)})),(0,s.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,s.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:s,reaction:a}=n;if(!e.activeReactions[s]?.some((e=>(0,l.Hl)(e.reaction,a))))return e;const o=e.activeReactions[s].filter((e=>!(0,l.Hl)(e.reaction,a))),i=o.length?{...e.activeReactions,[s]:o}:(0,g.CE)(e.activeReactions,[s]);return{...e,activeReactions:i}})),(0,s.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:a}=n;await(0,B.t9)("setDefaultReaction",{reaction:a})&&((e=(0,s.Rd)()).config?(0,s.R3)({...e,config:{...e.config,defaultReaction:a}}):t.loadConfig())})),(0,s.iw)("stopActiveEmojiInteraction",((e,t,n)=>{const{id:s}=n;return{...e,activeEmojiInteractions:e.activeEmojiInteractions?.filter((e=>e.id!==s))}})),(0,s.iw)("loadReactors",(async(e,t,n)=>{const{chatId:a,messageId:o,reaction:i}=n,d=(0,c.Z1)(e,a),l=(0,c.hj)(e,a,o);if(!d||!l)return;const u=l.reactors?.nextOffset,m=await(0,B.t9)("fetchMessageReactionsList",{reaction:i,chat:d,messageId:o,offset:u});m&&(e=(0,s.Rd)(),m.users?.length&&(e=(0,r.Sh)(e,(0,g.ee)(m.users,"id"))),(0,s.R3)((0,r.cY)(e,a,o,{reactors:m})))})),(0,s.iw)("loadMessageReactions",((e,t,n)=>{const{ids:s,chatId:a}=n,o=(0,c.Z1)(e,a);o&&(0,B.t9)("fetchMessageReactions",{ids:s,chat:o})})),(0,s.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:s,emoticon:a,x:o,y:i,startSize:r,isReversed:d,id:l}=n,u=(0,c.Z1)(e,s);if(u&&e.activeEmojiInteractions?.some((e=>e.id===l))&&s!==e.currentUserId)return(0,B.t9)("sendWatchingEmojiInteraction",{chat:u,emoticon:a}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===l?{...t,x:Me(e,o),y:i,startSize:r,isReversed:d}:t))}})),(0,s.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:a,offsetId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,B.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!d||!d.messages.length)return e=Re(e=(0,s.Rd)(),a,{unreadReactionsCount:0}),void(0,s.R3)(e);const{messages:l,chats:u,users:m}=d,h=(0,g.ee)(l,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=Re(e=(0,r.fZ)(e,(0,g.ee)(u,"id")),a,{unreadReactions:[...i.unreadReactions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:o}=n,{animationLevel:i}=e.settings.byKey,r=(0,c.jr)(e);if(r){if(r.unreadReactionsCount){const n=r.unreadReactionsCount-o.length,a=(r.unreadReactions||[]).filter((e=>!o.includes(e)));e=Re(e,r.id,{unreadReactions:a}),(0,s.R3)(e),!a.length&&n&&t.fetchUnreadReactions({chatId:r.id,offsetId:Math.min(...o)})}if(t.markMessagesRead({messageIds:o}),i===a.zy8)return e=(0,s.Rd)(),{...e,activeReactions:{...e.activeReactions,...Object.fromEntries(o.map((t=>{const n=(0,c.hj)(e,r.id,t);if(!n)return;const s=n.reactions?.recentReactions?.filter((e=>{let{isUnread:t}=e;return t}));if(!s)return;const a=s.map((e=>e.reaction));return[t,a.map((e=>({messageId:t,reaction:e})))]})).filter(Boolean))}}}})),(0,s.iw)("focusNextReaction",((e,t)=>{const n=(0,c.jr)(e);n?.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0]})})),(0,s.iw)("readAllReactions",(e=>{const t=(0,c.jr)(e);if(t)return(0,B.t9)("readAllReactions",{chat:t}),Re(e,t.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,s.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:a,isGroup:o}=n,i=(0,c.Z1)(e,a);if(!i?.fullInfo)return;const d=await(0,B.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:i});if(!d)return;e=(0,s.Rd)();const{stats:l,users:u}=d;if(e=(0,r.Sh)(e,(0,g.ee)(u,"id")),"recentTopMessages"in l&&l.recentTopMessages.length){const t=(0,c.Zw)(e,a);l.recentTopMessages=l.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}(0,s.R3)((0,r.ze)(e,a,l))})),(0,s.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(!i?.fullInfo)return;let d=await(0,B.t9)("fetchMessageStatistics",{chat:i,messageId:o});d||(d={}),e=(0,s.Rd)();const{views:l,forwards:u}=(0,c.Zw)(e,a)[o];d.views=l,d.forwards=u;const m=i.fullInfo.statisticsDcId,h=await(0,B.t9)("fetchMessagePublicForwards",{chat:i,messageId:o,dcId:m});d.publicForwards=h?.length,d.publicForwardsData=h,e=(0,s.Rd)(),(0,s.R3)((0,r.kM)(e,d))})),(0,s.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:a,token:o,name:i,isPercentage:d}=n,l=(0,c.Z1)(e,a);if(!l?.fullInfo)return;const u=l.fullInfo.statisticsDcId,m=await(0,B.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:u,isPercentage:d});m&&(0,s.R3)((0,r.yC)((0,s.Rd)(),a,i,m))})),n(28304);var Te=n(28406);function Ne(e,t){const n=typeof e;if(n!==typeof t)return!1;if("object"!==n)return e===t;const s=Array.isArray(e);if(s!==Array.isArray(t))return!1;if(s){const n=e,s=t;return n.length===s.length&&n.every(((e,t)=>Ne(e,s[t])))}const a=e,o=t;return Object.keys(a).every((e=>Ne(a[e],o[e])))}(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{const{isForum:a}=(0,c.Z1)(e,n.id)||{},{chatId:o}=(0,c.Bt)(e)||{};return(0,s.R3)((0,r.a4)(e,n.id,n.chat,n.newProfilePhoto)),n.noTopChatsRequest||(0,c.N)(e,n.id)||t.loadTopChats(),n.chat.id&&(0,Te.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}),void(o===n.id&&"isForum"in n.chat&&a!==n.chat.isForum&&(a&&t.closeForumPanel(),t.openChat({id:o})))}case"updateChatJoin":{const a=(0,c.Ek)(e,n.id);if(!a)return;e=(0,r.B1)(e,a,[n.id]),e=(0,r.a4)(e,n.id,{isNotJoined:!1}),(0,s.R3)(e);const o=(0,c.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.id}))}case"updateChatLeave":return(0,r.Dd)(e,n.id);case"updateChatInbox":return(0,r.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,threadId:a=i._f,typingStatus:o}=n;return(0,s.R3)((0,r.pf)(e,t,a,"typingStatus",o)),void setTimeout((()=>{e=(0,s.Rd)();const n=(0,c.WP)(e,t,a,"typingStatus");o&&n&&o.timestamp===n.timestamp&&(0,s.R3)((0,r.pf)(e,t,a,"typingStatus",void 0))}),6e3)}case"newMessage":{const{message:a}=n,{chatId:o,threadId:d,type:l}=(0,c.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const u=(0,c.Z1)(e,n.chatId);if(!u)return;const m="thread"===l&&d===i._f&&n.chatId===o,h=Boolean(n.message.id&&n.message.hasUnreadMention);return m?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):e=(0,r.a4)(e,n.chatId,{unreadCount:(u.unreadCount||0)+1,...h&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1}}),h&&(e=(0,r.a4)(e,n.chatId,{unreadMentions:[...u.unreadMentions||[],n.message.id]})),(0,s.R3)(e),void(0,Te.rh)({chat:u,message:a})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;return t.forEach((t=>{const s="channelId"in n?n.channelId:(0,c.X5)(e,t),a=(0,c.Z1)(e,s);a?.unreadReactionsCount&&(e=Re(e,s,{unreadReactionsCount:a.unreadReactionsCount-1||void 0,unreadReactions:a.unreadReactions?.filter((e=>e!==t))})),a?.unreadMentionsCount&&(e=(0,r.a4)(e,s,{unreadMentionsCount:a.unreadMentionsCount-1||void 0,unreadMentions:a.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,s=e.chats.byId[n.id];if(!s)return;return(0,r.a4)(e,n.id,{fullInfo:{...s.fullInfo,...t}})}case"updatePinnedChatIds":{const{ids:t,folderId:s}=n,o=s===a.WSp?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:s}=n,o=(0,c.Ek)(e,t);if(!o)return;const{[o]:i}=e.chats.orderedPinnedIds;let r=i||[];if(s){if(!r.includes(t)){if("active"===o&&r.length>=a.EGK){const t=e.chats.listIds.active;r=r.filter((e=>t&&t.includes(e)))}r=[t,...r]}}else r=r.filter((e=>e!==t));return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:s}=n;return(0,r.Pi)(e,t,s)}case"updateChatFolder":{const{id:t,folder:s}=n,{byId:a,orderedIds:o}=e.chatFolders,i=s?{...a,[t]:s}:(0,g.ei)(a,Object.keys(a).map(Number).filter((e=>e!==t))),r=s?o&&o.includes(t)?o:[...o||[],t]:o?o.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:r}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:a,deletedMemberId:o}=n;if(!t)return;let i=!1,c=t.fullInfo?.members?[...t.fullInfo.members]:[];if(s)c=s,i=!0;else if(a)c.length&&c.some((e=>e.userId===a.userId))||(c.push(a),i=!0);else if(c.length&&o){const e=c.findIndex((e=>e.userId===o));e>-1&&(c.slice(e,1),i=!0)}if(i){const s=c.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,r.a4)(e,n.id,{membersCount:c.length,fullInfo:{...t.fullInfo,members:c,adminMembersById:(0,g.ee)(s,"userId")}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,a=e.chats.byId[t];return a?.photos?(0,r.a4)(e,t,{photos:a.photos.filter((e=>!s.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:s,date:a,replyingToId:o,threadId:c}=n;if(!e.chats.byId[t])return;return e=(0,r.pf)(e,t,c||i._f,"draft",s),e=(0,r.pf)(e,t,c||i._f,"replyingToId",o),e=(0,r.a4)(e,t,{draftDate:a})}case"showInvite":{const{data:e}=n;return void t.showDialog({data:e})}case"updatePendingJoinRequests":{const{chatId:a,requestsPending:o,recentRequesterIds:i}=n,c=e.chats.byId[a];if(!c)return;return e=(0,r.a4)(e,a,{fullInfo:{...c.fullInfo,requestsPending:o,recentRequesterIds:i}}),(0,s.R3)(e),void t.loadChatJoinRequests({chatId:a})}case"updatePinnedTopic":{const{chatId:t,topicId:a,isPinned:o}=n;if(!e.chats.byId[t])return;return e=(0,r.Cn)(e,t,a,{isPinned:o}),void(0,s.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:a}=n;if(!e.chats.byId[t])return;return e=(0,r.a4)(e,t,{orderedPinnedTopicIds:a}),void(0,s.R3)(e)}case"updateTopic":{const{chatId:s,topicId:a}=n;if(!(0,c.Z1)(e,s)?.isForum)return;return void t.loadTopicById({chatId:s,topicId:a})}case"updateTopics":{const{chatId:s}=n;if(!(0,c.Z1)(e,s)?.isForum)return;return void t.loadTopics({chatId:s,force:!0})}}}));const Ae=350;function xe(e,t,n,s,a,o,i){const d=i?.reactions;if(d&&Ne(s,d))return e;if(e=(0,r.cY)(e,t,n,{reactions:s}),!o)return e;const u=a.unreadReactions?.includes(n);if((0,l.yL)(e,s)&&!u){e=Re(e,t,{unreadReactionsCount:(a?.unreadReactionsCount||0)+1,unreadReactions:[...a?.unreadReactions||[],n]});const s=(0,c.hj)(e,t,n);if(!a||!s)return e;(0,T.R3)((()=>{(0,Te.rh)({chat:a,message:s,isReaction:!0})}))}else u&&(e=Re(e,t,{unreadReactionsCount:(a?.unreadReactionsCount||1)-1,unreadReactions:a?.unreadReactions?.filter((e=>e!==n))}));return e}function Be(e,t,n,s){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=a?(0,c.Tm)(e,t,n):(0,c.hj)(e,t,n);if(o&&s.content){const{photo:e,video:t,sticker:n,document:a}=(0,l.qp)(o);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:n&&s.content.sticker?s.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:a&&s.content.document&&(s.content.document.previewBlobUrl=a.previewBlobUrl)}return a?(0,r.P4)(e,t,n,s):(0,r.cY)(e,t,n,s)}function Le(e,t,n,s){const{chatId:a}=n,{threadInfo:o}=(0,c.Db)(e,n)||{};if(!o&&n.replyToMessageId){const o=(0,c.hj)(e,a,n.replyToMessageId);o?e=(0,r.lG)(e,o,a,n.id,s):t.loadMessage({chatId:a,messageId:n.replyToMessageId,threadUpdate:{isDeleting:s,lastMessageId:n.id}})}return e}function Oe(e,t,n){const{id:s,chatId:a}=n,{threadInfo:o,firstMessageId:d}=(0,c.Db)(e,n)||{},u=(0,c.Z1)(e,a)?.unreadCount&&!(0,c.gb)(e,a,i._f);if(e=Le(e,t,n),o&&(!d&&(0,l.CI)(n)||(e=(0,r.xj)(e,a,o.threadId,[s]),(0,c.b9)(e,a,o.threadId)&&(e=(0,r.$S)(e,a,o.threadId,s),d||(e=(0,r.pf)(e,a,o.threadId,"firstMessageId",n.id)))),e=(0,r.pf)(e,a,o.threadId,"threadInfo",{...o,lastMessageId:n.id,messagesCount:(o.messagesCount||0)+1})),u)return e;if(e=(0,r.xj)(e,a,i._f,[s]),(0,c.b9)(e,a,i._f)){const t=(0,c.It)(e,a,i._f),n=(0,r.$S)(e,a,i._f,s),o=(0,c.Cb)(n,a,i._f);t&&!o.includes(t)||(e=n)}return e}function Fe(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:a}=e,o=a.byId[t],i=o?.lastMessage,d=o?.isForum?(0,c.p$)(e,n):void 0;return d&&(e=(0,r.Cn)(e,t,d.id,{lastMessageId:n.id})),!i||s||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,r.a4)(e,t,{lastMessage:n}):e}function Ue(e,t){const n=(0,c.Zw)(e,t),s=(0,c.gb)(e,t,i._f);if(!n||!s)return;let a=s.length;for(;a--;){const e=n[s[a]];if(!e.isDeleting)return e}}function je(e,t,n,a){if(t){const o=(0,c.Z1)(e,t);if(!o)return;n.forEach((n=>{const s=Ue(e=(0,r.cY)(e,t,n,{isDeleting:!0}),t);s&&(e=Fe(e,t,s,!0)),o.topics?.[n]&&(e=(0,r.BK)(e,t,n))})),a.requestChatUpdate({chatId:t});const i=[];return n.forEach((n=>{const s=(0,c.hj)(e,t,n);if(!s)return;e=Le(e,a,s,!0);const o=(0,c.nr)(e,s);o&&i.push(o)})),(0,s.R3)(e),void setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),t,n)),(0,g.Tw)(i).forEach((e=>{a.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),Ae)}const o=[];n.forEach((t=>{const n=(0,c.X5)(e,t);if(n){o.push(n);const a=Ue(e=(0,r.cY)(e,n,t,{isDeleting:!0}),n);a&&(e=Fe(e,n,a,!0)),setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),n,[t]))}),Ae)}})),(0,s.R3)(e),(0,g.Tw)(o).forEach((e=>{a.requestChatUpdate({chatId:e})}))}(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:a,id:o,message:d,shouldForceReply:u}=n;e=Oe(e=Be(e,a,o,d),t,d),d.repliesThreadInfo&&(e=(0,r.Xg)(e,d.repliesThreadInfo.chatId,d.repliesThreadInfo.threadId,d.repliesThreadInfo));const m=(0,c.hj)(e,a,o);(0,c.Z1)(e,a)?.isForum&&m.isTopicReply&&!(0,c.p$)(e,m)&&m.replyToMessageId&&t.loadTopicById({chatId:a,topicId:m.replyToMessageId});const h=(0,l.CI)(d);if((0,c.KA)(e,a,d)){if(h&&d.isOutgoing&&!d.content?.action){const n=(0,c.Bt)(e);n&&t.focusMessage({chatId:a,threadId:n.threadId,messageId:d.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,d)||{};n&&t.requestThreadInfoUpdate({chatId:a,threadId:n.threadId}),h||setTimeout((()=>{let e=(0,s.Rd)();u&&(e=(0,r.pf)(e,a,i._f,"replyingToId",o)),(0,s.R3)(Fe(e,a,m))}),Ae)}else e=Fe(e,a,m);(0,s.R3)(e),(0,c.N)(e,a)||t.loadTopChats();break}case"updateStartEmojiInteraction":{const{chatId:t}=(0,c.Bt)(e)||{};if(t!==n.id)return;const a=(0,c.hj)(e,t,n.messageId);if(!a)return;if((0,l.UD)(a)!==n.emoji)return;const o=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:e.activeEmojiInteractions?.length||0,animatedEffect:o?(0,c.cu)(o):n.emoji,messageId:n.messageId}]},(0,s.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:a,message:o}=n;e=Be(e,t,a,o,!0);const d=(0,c.qy)(e,t,i._f)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",(0,g.Tw)([...d,a]));const l=(0,c.nr)(e,o);if(l!==i._f){const n=(0,c.qy)(e,t,l)||[];e=(0,r.pf)(e,t,l,"scheduledIds",(0,g.Tw)([...n,a]))}(0,s.R3)(e);break}case"updateMessage":{const{chatId:a,id:o,message:d}=n,l=(0,c.hj)(e,a,o),u=(0,c.Z1)(e,a);e=Be(e,a,o,d);const m=(0,c.hj)(e,a,o);d.repliesThreadInfo&&(e=(0,r.Xg)(e,d.repliesThreadInfo.chatId,d.repliesThreadInfo.threadId,d.repliesThreadInfo)),l&&(e=Fe(e,a,m)),d.reactions&&u&&(e=xe(e,a,o,d.reactions,u,d.isOutgoing,l)),(0,s.R3)(e),l&&u&&!d.isOutgoing&&u.lastMessage?.id===d.id&&(0,c.xo)(e,u)&&(0,c.KA)(e,a,d)&&(0,c.b9)(e,a,d.repliesThreadInfo?.threadId||i._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:a,message:o}=n,d=(0,c.Tm)(e,t,a);if(!d)return;e=Be(e,t,a,o,!0);const l=Object.keys((0,c.yB)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,i._f,"scheduledIds",l);const u=(0,c.nr)(e,d);if(u!==i._f){const n=(0,c.qy)(e,t,u)||[];e=(0,r.pf)(e,t,u,"scheduledIds",n.sort(((e,t)=>t-e)))}(0,s.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:o,message:i}=n;e=Oe(e,t,i);const d=(0,c.hj)(e,a,o);e=(0,r.K4)(e,a,[o]),i.isScheduled&&(e=(0,r.bV)(e,a,[o])),e=(0,r.cY)(e,a,i.id,{...d,...i,previousLocalId:o});const l=(0,c.hj)(e,a,i.id);e=Fe(e,a,l);const u=(0,c.Db)(e,i);u?.threadInfo&&(t.markMessageListRead({maxId:i.id}),e=(0,r.pf)(e,a,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),(0,s.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:a,message:o}=n,d=(0,c.qy)(e,t,i._f)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",[...d,o.id]);const l=(0,c.nr)(e,o);if(l!==i._f){const n=(0,c.qy)(e,t,l)||[];e=(0,r.pf)(e,t,l,"scheduledIds",[...n,o.id])}const u=(0,c.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,o.id,{...u,...o,previousLocalId:a}),(0,s.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:o}=n,d=(0,g.q0)((0,c.Zw)(e,t),o),l={[i._f]:o};Object.values(d).forEach((t=>{const n=(0,c.nr)(e,t);if(n===i._f)return;const s=l[n]||[];s.push(t.id),l[n]=s})),Object.entries(l).forEach((n=>{let[s,o]=n;const d=(0,c.KB)(e,t,i._f)||[],l=a?(0,g.Tw)(d.concat(o)).sort(((e,t)=>t-e)):d.filter((e=>!o.includes(e)));e=(0,r.pf)(e,t,Number(s),"pinnedIds",l)})),(0,s.R3)(e);break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:o,firstMessageId:i}=n,d={...(0,c.tZ)(e,t,a),...o};if(!d.threadId)return;e=(0,r.Xg)(e,t,a,d),i&&(e=(0,r.pf)(e,t,a,"firstMessageId",i)),(0,s.R3)(e);break}case"resetMessages":{const{id:a}=n,o=(0,c.Zw)(e,a);o&&!(0,l.YC)(a)&&(e=(0,r.K4)(e,a,Object.keys(o).map(Number)),(0,s.R3)(e),t.loadFullChat({chatId:a,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:a}=n;je(e,a,s,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:a}=n;!function(e,t,n,a){e&&(t.forEach((t=>{a=(0,r.P4)(a,e,t,{isDeleting:!0})})),(0,s.R3)(a),setTimeout((()=>{a=(0,r.bV)((0,s.Rd)(),e,t);const n=(0,c.yB)(a,e);a=(0,r.pf)(a,e,i._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,s.R3)(a)}),Ae))}(a,t,0,e);break}case"deleteHistory":{const{chatId:o}=n,i=e.messages.byChatId[o];if(o===a.awM&&(0,s.R3)({...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))}),i){const n=Object.keys(i.byId).map(Number);je(e,o,n,t)}else t.requestChatUpdate({chatId:o});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:a}=n;t.forEach((t=>{const n=(0,c.X5)(e,t);n&&(e=(0,r.cY)(e,n,t,a))})),(0,s.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:a,messageUpdate:o}=n;a.forEach((n=>{e=(0,r.cY)(e,t,n,o)})),(0,s.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:a}=n,o=(0,c.ZB)(e,t);if(o?.content.poll){const t=o.content.poll.results;let n=t;a.results?.results&&(t.results&&a.results.isMin?t.results&&(n={...a.results,results:a.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):n=a.results);const i={...o.content.poll,...a,results:n};(0,s.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:i}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:a,options:o}=n,i=(0,c.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:d}=i.content,{recentVoterIds:l,totalVoters:u,results:m}=d.results,h=l?[...l]:[],g=u?u+1:1,p=m?[...m]:[];h.push(a),o.forEach((t=>{const n=p.findIndex((e=>e.option===t)),s=p[n],o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,a===e.currentUserId&&(o.isChosen=!0),n?p[n]=o:p.push(o)})),(0,s.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...d,results:{...d.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:s}=n;(0,c.UW)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:t,id:a,reactions:o}=n,i=(0,c.hj)(e,t,a),r=(0,c.Z1)(e,n.chatId);if(!r||!i)return;(0,s.R3)(xe(e,t,a,o,r,i.isOutgoing,i));break}case"updateMessageExtendedMedia":{const{chatId:t,id:a,media:o,preview:i}=n,d=(0,c.hj)(e,t,a);if(!(0,c.Z1)(e,n.chatId)||!d)return;if(i){if(!d.content.invoice)return;(0,s.R3)((0,r.cY)(e,t,a,{content:{...d.content,invoice:{...d.content.invoice,extendedMedia:i}}}))}else o&&(0,s.R3)((0,r.cY)(e,t,a,{content:{...o}}));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:a,isPending:o}=n;(0,s.R3)({...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:a,isPending:o}}});break}}}));const De=(0,T.P2)((function(){const e=(0,s.Rd)();(0,s.R3)((0,r.ps)(e,{...e.users.statusesById,...qe})),qe={}}),3e3,!0);let qe={};(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,r.GK)(e,n.id);case"updateUser":return n.id===e.currentUserId&&n.user.isPremium&&!(0,c.wV)(e)&&t.openPremiumModal({isSuccess:!0}),(0,r.Nq)(e,n.id,n.user);case"updateUserEmojiStatus":return(0,r.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return s=n.userId,a=n.status,qe[s]=a,void De();case"updateUserFullInfo":{const{id:t,fullInfo:s}=n,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...s}})}case"updateBotMenuButton":{const{botId:t,button:s}=n,a=(0,c.dy)(e,t);if(!a?.fullInfo?.botInfo)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,botInfo:{...a.fullInfo.botInfo,menuButton:s}}})}}var s,a})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,r.Rg)(e,n.id,n.stickerSet)})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,r.O4)((0,s.Rd)(),n.id):(0,r.rB)((0,s.Rd)(),n.id);case"updateResetContactList":(0,s.R3)({...(0,s.Rd)(),contactList:{userIds:[]}});break;case"updateConfig":t.loadConfig();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateMoveStickerSetToTop":{const s=n.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!s)return e;const a=[n.id,...s.filter((e=>e!==n.id))];t.reorderStickerSets({order:a,isCustomEmoji:n.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":t.reorderStickerSets({order:n.order,isCustomEmoji:n.isCustomEmoji});break;case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":(0,s.R3)({...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}});break;case"updatePaymentVerificationNeeded":e=(0,r.fS)((0,s.Rd)(),n.url),e=(0,r.Q$)(e,m.KB.ConfirmPayment),(0,s.R3)(e);break;case"updateWebViewResultSent":e.webApp?.queryId===n.queryId&&(t.setReplyingToId({messageId:void 0}),t.closeWebApp())}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,r.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent:o,shouldShowPreviews:i}=n;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:a})),(0,s.R3)((0,r.aK)(e,t,{isMuted:a,isSilent:o,shouldShowPreviews:i}));break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:a,isMuted:o}=n;e=(0,r.Cn)(e,t,a,{isMuted:o}),(0,s.R3)(e);break}}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:n.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:n.message}}}}));var $e=n(78958),Ge=n(42431);(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":return"discarded"===n.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,$e.dc)(e,n.call.id):(0,$e.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,c.Z1)(e,n.chatId);return t&&(e=(0,r.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:a,nextOffset:o}=n,{currentUserId:i}=e;return e=(0,s.Rd)(),a.forEach((n=>{n.id&&(e=(0,$e.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,$e.AH)(e,t,{nextOffset:o})),e}case"updatePhoneCall":{if(!h.Bi)return;const{phoneCall:a,currentUserId:o}=e,{call:i}=n;if(a)return"discarded"===i.state?(t.playGroupCallSound({sound:"end"}),{...e,...i.needRating&&{ratingPhoneCall:i},isCallPanelVisible:void 0,phoneCall:void 0}):void 0;if(i?.adminId!==o&&"requested"===i.state)return(0,T.R3)((()=>{(0,Te.TO)({call:i,user:(0,Ge.fu)((0,s.Rd)())})})),(0,S.o5)(),(0,S.CW)(i.isVideo),{...e,phoneCall:i,isCallPanelVisible:!1}}}}));var He=n(9937);(0,s.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"]){const{inputInvoice:s}=e.payment;if(s&&"chatId"in s&&"messageId"in s){const n=(0,c.hj)(e,s.chatId,s.messageId);if(n&&n.content.invoice){const{amount:e,currency:s,title:a}=n.content.invoice;t.showNotification({message:I.i0("PaymentInfoHint",[(0,He.x)(e,s,I.i0.code),a])})}}return h.Xp||(e=(0,r.WY)(e)),n.slug&&s&&"slug"in s&&s.slug!==n.slug?h.Xp?void 0:e:{...e,payment:{...e.payment,status:"paid"}}}}));var _e=n(46752),Ve=n(1279),ze=n(53551),We=n(274),Xe=n(45332);function Ye(e){(0,o.d4)((()=>(0,T.Gq)(e)),[e])}var Ke=n(29290);const Je=document.querySelector('meta[name="viewport"]'),Qe=Je?.getAttribute("content")||"",et="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function tt(e){e.preventDefault()}var nt=n(65326),st=n(31212),at=n(18674),ot=n(62357),it=n(15780),rt=n(99203),ct=n(48778);const dt=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"StickerSetModal",!t);return n?o.ZP.createElement(n,e):void 0}));var lt=n(2155),ut=n(95616),mt=n(17358);const ht=(0,o.X$)((e=>{let{isForAppBadge:t}=e;(0,ut.yi)();const n=(0,J.xW)();if((0,o.d4)((()=>{t&&(0,mt.w)(n)}),[t,n]),!t&&n)return o.ZP.createElement("div",{className:"unread-count active"},(0,lt.bi)(n))}));var gt=n(23989),pt=n(53455),ft=n(60706),It=n(73541),vt=n(2255),wt=n(59107),yt=n(54416),Pt=n(27370),Zt=n(706);let Ct;function bt(e,t,n,s,a,i){let r,c,d;return r=function(){const[e,t]=(0,o.eJ)(window.navigator.onLine);return(0,o.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?n?Ct.syncing:Ct.online:Ct.waitingForNetwork,c=r===Ct.online||i?"none":s?"middleHeader":a?"minimized":"overlay",r===Ct.waitingForNetwork?d=e("WaitingForNetwork"):r===Ct.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(Ct||(Ct={}));var Et=n(36046),St=n(73217),Mt=n(53106),Rt=n(58964),kt=n(231),Tt=n(69589),Nt=n(49187),At=n(83321),xt=n(40126),Bt=n(49204);const Lt=(0,o.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:s}=e;const a=(0,wt.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},o.ZP.createElement(Bt.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(vt.Z,{activeKey:t,name:"slide-fade"},n)),o.ZP.createElement(kt.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon-close"})))})),Ot=[0,1,2],Ft=(0,o.X$)((0,s.c$)((e=>{const{query:t,fetchingStatus:n,chatId:s,date:a}=e.globalSearch,{currentUserId:o,connectionState:i,isSyncing:r}=e,{byId:d}=e.chats,{isConnectionStatusMinimized:l,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:o,chatsById:d,globalSearchChatId:s,searchDate:a,theme:(0,c.Pu)(e),animationLevel:u,connectionState:i,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:l,areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(e.canInstall)}}))((e=>{let{shouldHideSearch:t,content:n,contactsFilter:i,onSearchQuery:r,isClosingSearch:c,onSelectSettings:d,onSelectContacts:u,onSelectArchived:g,onReset:p,searchQuery:f,isLoading:I,shouldSkipTransition:v,currentUserId:w,globalSearchChatId:y,searchDate:P,theme:Z,animationLevel:C,chatsById:b,connectionState:E,isSyncing:S,isMessageListOpen:M,isConnectionStatusMinimized:R,areChatsLoaded:k,hasPasscode:T,canInstall:N}=e;const{openChat:A,setGlobalSearchDate:x,setSettingOption:B,setGlobalSearchChatId:L,openChatByUsername:O,lockScreen:F,requestNextSettingsScreen:U,skipLockOnUnload:j}=(0,s.Sv)(),D=(0,wt.Z)(),q=n===m.du.ChatList,$=(0,o.Ye)((()=>P?(0,z.xH)(new Date(1e3*P)):void 0),[P]),G=(0,o.Ye)((()=>q&&b?Object.values(b).reduce(((e,t)=>(0,l.pE)(t)&&t.unreadCount?e+1:e),0):0),[q,b]),{connectionStatus:H,connectionStatusText:_,connectionStatusPosition:V}=bt(D,E,S,M,R,!k),W=(0,o.I4)((e=>{e.preventDefault(),e.stopPropagation(),T?F():U(m.MT.PasscodeDisabled)}),[T,F,U]);(0,It.y)({"Ctrl+Shift+L":W,"Alt+Shift+L":W,"Meta+Shift+L":W,...h.fl&&{"Mod+L":W}});const X=window.location.hostname===a.xHY||a.Cgt,Y=(0,o.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return o.ZP.createElement(kt.Z,{round:!0,ripple:q&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:q?t:()=>p(),ariaLabel:q?D("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,_e.Z)("animated-menu-icon",!q&&"state-back",v&&"no-animation")}))}),[q,D,p,v]),K=(0,o.I4)((()=>{f||r("")}),[f,r]),J=(0,o.I4)((()=>{B({isConnectionStatusMinimized:!R})}),[R,B]),Q=(0,o.I4)((()=>{A({id:w,shouldReplaceHistory:!0})}),[w,A]),ee=(0,o.I4)((e=>{e.stopPropagation();const t="light"===Z?"dark":"light";B({theme:t}),B({shouldUseSystemTheme:!1}),(0,Pt.Z)(t,C===a.zy8)}),[C,B,Z]),te=(0,o.I4)((e=>{e.stopPropagation();const t=0===C?2:0;Ot.forEach(((e,n)=>{document.body.classList.toggle(`animation-level-${n}`,t===n)})),B({animationLevel:t})}),[C,B]),ne=(0,o.I4)((()=>{window.open(a.ulW,"_blank","noopener")}),[]),se=(0,o.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,Zt.W8)(),j()}),[j]),ae=(0,o.I4)((()=>{j()}),[j]),oe=(0,o.I4)((()=>{O({username:D("Settings.TipsUsername")})}),[D,O]),ie=(0,o.I4)((()=>{F()}),[F]),re=Boolean(y)||n===m.du.GlobalSearch||n===m.du.Contacts;(0,o.d4)((()=>re?(0,gt.Z)((()=>p())):void 0),[re,p]);const ce=n===m.du.Contacts?D("SearchFriends"):D("Search"),de=a.Tjg?`${a.JiC} Beta (master)`:a.eMD?"master":a.JiC,{shouldDisableDropdownMenuTransitionRef:le,handleDropdownMenuTransitionEnd:ue}=(0,St.Z)(t);return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},D.isRtl&&o.ZP.createElement("div",{className:"DropdownMenuFiller"}),o.ZP.createElement(Mt.Z,{trigger:Y,footer:`${a.iCi} ${de}`,className:(0,_e.Z)(D.isRtl&&"rtl",t&&D.isRtl&&"right-aligned",le.current&&D.isRtl&&"disable-transition"),positionX:t&&D.isRtl?"right":"left",onTransitionEnd:D.isRtl?ue:void 0},o.ZP.createElement(Rt.Z,{icon:"saved-messages",onClick:Q},D("SavedMessages")),o.ZP.createElement(Rt.Z,{icon:"archive",onClick:g},o.ZP.createElement("span",{className:"menu-item-name"},D("ArchivedChats")),G>0&&o.ZP.createElement("div",{className:"right-badge"},G)),o.ZP.createElement(Rt.Z,{icon:"user",onClick:u},D("Contacts")),o.ZP.createElement(Rt.Z,{icon:"settings",onClick:d},D("Settings")),o.ZP.createElement(Rt.Z,{icon:"darkmode",onClick:ee},o.ZP.createElement("span",{className:"menu-item-name"},D("lng_menu_night_mode")),o.ZP.createElement(At.Z,{id:"darkmode",label:D("dark"===Z?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===Z,noAnimation:!0})),o.ZP.createElement(Rt.Z,{icon:"animations",onClick:te},o.ZP.createElement("span",{className:"menu-item-name capitalize"},D("Appearance.Animations").toLowerCase()),o.ZP.createElement(At.Z,{id:"animations",label:"Toggle Animations",checked:C>0})),o.ZP.createElement(Rt.Z,{icon:"help",onClick:oe},D("TelegramFeatures")),o.ZP.createElement(Rt.Z,{icon:"bug",href:a.mUA},"Report Bug"),a.Tjg&&o.ZP.createElement(Rt.Z,{icon:"permissions",onClick:ne},"Beta Changelog"),X&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Rt.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:se},"Switch to K Version"),o.ZP.createElement(Rt.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:ae},"Switch to Old Version")),N&&o.ZP.createElement(Rt.Z,{icon:"install",onClick:(0,Et.G)()},"Install App")),o.ZP.createElement(Tt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,_e.Z)(y||P?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:c?void 0:i||f,focused:re,isLoading:I||"minimized"===V,spinnerColor:"minimized"===V?"yellow":void 0,spinnerBackgroundColor:"minimized"===V&&"light"===Z?"light":void 0,placeholder:ce,autoComplete:"off",canClose:Boolean(y||P),onChange:r,onReset:p,onFocus:K,onSpinnerClick:"minimized"===V?J:void 0},$&&o.ZP.createElement(Nt.Z,{icon:"calendar",title:$,canClose:!0,isMinimized:Boolean(y),className:"search-date",onClick:x,clickArg:{date:void 0}}),y&&o.ZP.createElement(Nt.Z,{chatOrUserId:y,onClick:L,canClose:!0,clickArg:{id:void 0}})),T&&o.ZP.createElement(kt.Z,{round:!0,ripple:!h.wB,size:"smaller",color:"translucent",ariaLabel:`${D("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:ie,className:"passcode-lock"},o.ZP.createElement("i",{className:"icon-lock"})),o.ZP.createElement(xt.Z,{isOpen:"overlay"===V,isCustom:!0,className:"connection-state-wrapper"},o.ZP.createElement(Lt,{connectionStatus:H,connectionStatusText:_,onClick:J}))))})));var Ut=n(64963),jt=n(46590),Dt=n(93133),qt=n(55993);const $t=(0,o.X$)((0,s.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,activeChatFolder:s},currentUserId:a,lastSyncTime:o,shouldSkipHistoryAnimations:i}=e;return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:s,currentUserId:a,isForumPanelOpen:(0,c.nd)(e),lastSyncTime:o,shouldSkipHistoryAnimations:i,maxFolders:(0,$.M)(e,"dialogFilters")}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:i,orderedFolderIds:r,activeChatFolder:c,currentUserId:d,isForumPanelOpen:l,lastSyncTime:u,shouldSkipHistoryAnimations:m,maxFolders:g,shouldHideFolderTabs:p}=e;const{loadChatFolders:f,setActiveChatFolder:I,openChat:v}=(0,s.Sv)(),w=(0,o.sO)(null),y=(0,wt.Z)();(0,o.d4)((()=>{u&&f()}),[u,f]);const P=(0,o.Ye)((()=>({id:a.NfV,title:r?.[0]===a.NfV?y("FilterAllChatsShort"):y("FilterAllChats")})),[r,y]),Z=(0,o.Ye)((()=>r?r.map((e=>e===a.NfV?P:i[e]||{})).filter(Boolean):void 0),[i,P,r]),C=Z?.findIndex((e=>e.id===a.NfV)),b=C===c,E=0===c,S=(0,ut.yi)(),M=(0,o.Ye)((()=>{if(Z&&Z.length)return Z.map(((e,t)=>{let{id:n,title:s}=e;const o=n!==a.NfV&&t>g-1;return{id:n,title:s,badgeCount:S[n]?.chatsCount,isBadgeActive:Boolean(S[n]?.notificationsCount),isBlocked:o}}))}),[Z,S,g]),R=(0,o.I4)((e=>{I(e,{forceOnHeavyAnimation:!0})}),[I]);(0,o.d4)((()=>{M&&M.length&&c>=M.length&&I(0)}),[c,M,I]),(0,o.d4)((()=>{if(h.$b&&M?.length&&!l)return(0,Ut.sf)(w.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Ut.eM.Left?(I(Math.min(c+1,M.length-1),{forceOnHeavyAnimation:!0}),!0):t===Ut.eM.Right&&(I(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,M,l,I]);const k=(0,o.sO)();k.current=!E,(0,o.d4)((()=>k.current?(0,gt.Z)((()=>{k.current&&I(0)})):void 0),[c,I]),(0,jt.Z)({isActive:!E,onBack:()=>I(0,{forceOnHeavyAnimation:!0})}),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&M){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void v({id:d,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>M.length-1)return;I(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[d,M,v,I]);const{shouldRender:T,transitionClassNames:N}=(0,st.Z)(!r,void 0,!0);function A(e){const s=Object.values(i).find((e=>{let{id:t}=e;return t===M[c].id})),a=s&&!b;return o.ZP.createElement(qt.Z,{folderType:a?"folder":"all",folderId:a?s.id:void 0,isActive:e,isForumPanelOpen:l,lastSyncTime:u,foldersDispatch:t,onScreenSelect:n})}const x=M&&M.length>1;return o.ZP.createElement("div",{className:(0,_e.Z)("ChatFolders",x&&p&&"ChatFolders--tabs-hidden")},x?o.ZP.createElement(Dt.Z,{tabs:M,activeTab:c,onSwitchTab:R,areFolders:!0}):T?o.ZP.createElement("div",{className:(0,_e.Z)("tabs-placeholder",N)}):void 0,o.ZP.createElement(vt.Z,{ref:w,name:m?"none":y.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:x?M.length:void 0},A))})));var Gt=n(34288);const Ht=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),_t=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)}));var Vt=n(52328);const zt=(0,o.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:s,onNewGroup:a}=e;const[i,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{t||r(!1)}),[t]);const c=(0,wt.Z)(),d=(0,_e.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),l=(0,o.I4)((()=>{r(!i)}),[i]),u=(0,o.I4)((()=>{r(!1)}),[]);return o.ZP.createElement("div",{className:d,dir:c.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{round:!0,color:"primary",className:i?"active":"",onClick:l,ariaLabel:c(i?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Vt.Z,{isOpen:i,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},o.ZP.createElement(Rt.Z,{icon:"channel",onClick:s},c("NewChannel")),o.ZP.createElement(Rt.Z,{icon:"group",onClick:a},c("NewGroup")),o.ZP.createElement(Rt.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))}));var Wt=n(59690);const Xt=Object.keys(m.du).length/2;let Yt;const Kt=(0,o.X$)((e=>{let{content:t,searchQuery:n,searchDate:s,isClosingSearch:a,contactsFilter:i,shouldSkipTransition:r,foldersDispatch:c,isUpdateAvailable:d,isForumPanelOpen:l,onSearchQuery:u,onContentChange:g,onScreenSelect:p,onReset:f,onTopicSearch:I}=e;const[v,w]=(0,o.eJ)(h.$b),{shouldRenderForumPanel:y,handleForumPanelAnimationEnd:P}=(0,yt.Z)(l),Z=l&&t===m.du.ChatList,{shouldRender:C,transitionClassNames:b}=(0,st.Z)(d),E=(0,o.sO)(!1),S=(0,o.I4)((()=>{t===m.du.ChatList&&(E.current=!0,w(!0))}),[t]),M=(0,o.I4)((()=>{E.current=!1,Yt&&(clearTimeout(Yt),Yt=void 0),Yt=window.setTimeout((()=>{E.current||w(!1)}),250)}),[]),R=(0,o.I4)((()=>{g(m.du.Settings)}),[g]),k=(0,o.I4)((()=>{g(m.du.Contacts)}),[g]),T=(0,o.I4)((()=>{g(m.du.Archived)}),[g]),N=(0,o.I4)((()=>{window.location.reload()}),[]),A=(0,o.I4)((()=>{g(m.du.NewChannelStep1)}),[g]),x=(0,o.I4)((()=>{g(m.du.NewGroupStep1)}),[g]);(0,o.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{w(!1)}),250):(E.current||h.$b)&&w(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const B=(0,wt.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:S,onMouseLeave:h.$b?void 0:M},o.ZP.createElement(Ft,{shouldHideSearch:Z,content:t,contactsFilter:i,onSearchQuery:u,onSelectSettings:R,onSelectContacts:k,onSelectArchived:T,onReset:f,shouldSkipTransition:r,isClosingSearch:a}),o.ZP.createElement(vt.Z,{name:r?"none":"zoom-fade",renderCount:Xt,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return o.ZP.createElement($t,{shouldHideFolderTabs:Z,onScreenSelect:p,foldersDispatch:c});case m.du.GlobalSearch:return o.ZP.createElement(Ht,{searchQuery:n,searchDate:s,isActive:e,onReset:f});case m.du.Contacts:return o.ZP.createElement(_t,{filter:i,isActive:e,onReset:f});default:return}})),C&&o.ZP.createElement(kt.Z,{fluid:!0,pill:!0,className:(0,_e.Z)("btn-update",b),onClick:N},B("lng_update_telegram")),y&&o.ZP.createElement(Wt.Z,{isOpen:l,isHidden:!Z,onTopicSearch:I,onCloseAnimationEnd:P}),o.ZP.createElement(zt,{isShown:v,onNewPrivateChat:k,onNewChannel:A,onNewGroup:x}))})),Jt=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),Qt=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),en=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)}));var tn;!function(e){e[e.Main=0]="Main",e[e.Settings=1]="Settings",e[e.Archived=2]="Archived",e[e.NewGroup=3]="NewGroup",e[e.NewChannel=4]="NewChannel"}(tn||(tn={}));const nn=Object.keys(tn).length/2,sn=(0,o.X$)((0,s.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:s},shouldSkipHistoryAnimations:a,leftColumnWidth:o,currentUserId:i,passcode:{hasPasscode:r},settings:{nextScreen:d},isUpdateAvailable:l}=e,u=(0,c.jr)(e);return{searchQuery:t,searchDate:n,isFirstChatFolderActive:0===s,shouldSkipHistoryAnimations:a,leftColumnWidth:o,currentUserId:i,hasPasscode:r,nextSettingsScreen:d,isChatOpen:Boolean(u?.id),isUpdateAvailable:l,isForumPanelOpen:(0,c.nd)(e),forumPanelChatId:e.forumPanelChatId,isClosingSearch:e.globalSearch.isClosing}}))((e=>{let{searchQuery:t,searchDate:n,isFirstChatFolderActive:a,shouldSkipHistoryAnimations:i,leftColumnWidth:r,currentUserId:c,hasPasscode:d,nextSettingsScreen:l,isChatOpen:u,isUpdateAvailable:g,isForumPanelOpen:p,forumPanelChatId:f,isClosingSearch:I}=e;const{setGlobalSearchQuery:v,setGlobalSearchClosing:w,setGlobalSearchChatId:y,resetChatCreation:P,setGlobalSearchDate:Z,loadPasswordInfo:C,clearTwoFaError:b,setLeftColumnWidth:E,resetLeftColumnWidth:S,openChat:M,requestNextSettingsScreen:R}=(0,s.Sv)(),k=(0,o.sO)(null),[T,N]=(0,o.eJ)(m.du.ChatList),[A,x]=(0,o.eJ)(m.MT.Main),[B,L]=(0,o.eJ)(""),[O,F]=(0,pt.ZP)(),[U,j]=(0,o.eJ)(0);let D=tn.Main;switch(T){case m.du.Archived:D=tn.Archived;break;case m.du.Settings:D=tn.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:D=tn.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:D=tn.NewGroup}const q=(0,o.I4)((e=>{function t(){N(m.du.ChatList),L(""),w(!0),P(),setTimeout((()=>{v({query:""}),Z({date:void 0}),y({id:void 0}),w(!1),j(Date.now())}),250)}if(!0!==e)if(T!==m.du.NewGroupStep2)if(T!==m.du.NewChannelStep2){if(T===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(T===m.du.Settings)switch(A){case m.MT.EditProfile:case m.MT.Folders:case m.MT.General:case m.MT.Notifications:case m.MT.DataStorage:case m.MT.Privacy:case m.MT.ActiveSessions:case m.MT.Language:case m.MT.Stickers:case m.MT.Experimental:return void x(m.MT.Main);case m.MT.GeneralChatBackground:return void x(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void x(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyPhoneCall:case m.MT.PrivacyPhoneP2P:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyVoiceMessages:case m.MT.PrivacyBlockedUsers:case m.MT.ActiveWebsites:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:case m.MT.PasscodeDisabled:case m.MT.PasscodeEnabled:case m.MT.PasscodeCongratulations:return void x(m.MT.Privacy);case m.MT.PasscodeNewPasscode:return void x(d?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled);case m.MT.PasscodeChangePasscodeCurrent:case m.MT.PasscodeTurnOff:return void x(m.MT.PasscodeEnabled);case m.MT.PasscodeNewPasscodeConfirm:return void x(m.MT.PasscodeNewPasscode);case m.MT.PasscodeChangePasscodeNew:return void x(m.MT.PasscodeChangePasscodeCurrent);case m.MT.PasscodeChangePasscodeConfirm:return void x(m.MT.PasscodeChangePasscodeNew);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void x(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void x(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void x(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void x(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void x(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void x(m.MT.PrivacyForwarding);case m.MT.PrivacyVoiceMessagesAllowedContacts:case m.MT.PrivacyVoiceMessagesDeniedContacts:return void x(m.MT.PrivacyVoiceMessages);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void x(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void x(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void x(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void x(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void x(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void x(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void x(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void x(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void x(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void x(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void x(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void x(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void x(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void x(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return N(m.du.ChatList),void x(m.MT.Main);case m.MT.QuickReaction:case m.MT.CustomEmoji:return void x(m.MT.Stickers)}T===m.du.ChatList&&a?N(m.du.GlobalSearch):t()}else N(m.du.NewChannelStep1);else N(m.du.NewGroupStep1);else t()}),[T,a,w,P,v,Z,y,A,d]),$=(0,o.I4)((e=>{T!==m.du.Contacts?(N(m.du.GlobalSearch),e!==t&&v({query:e})):L(e)}),[T,t,v]),G=(0,o.I4)((()=>{N(m.du.GlobalSearch),v({query:""}),y({id:f})}),[f,y,v]);(0,o.d4)((()=>T!==m.du.ChatList||a&&!u?(0,gt.Z)((()=>q())):void 0),[a,T,q,u]);const H=(0,o.I4)((e=>{T!==m.du.GlobalSearch&&(e.preventDefault(),N(m.du.GlobalSearch))}),[T]),_=(0,o.I4)((e=>{e.preventDefault(),M({id:c,shouldReplaceHistory:!0})}),[c,M]),V=(0,o.I4)((e=>{e.preventDefault(),N(m.du.Settings)}),[]);(0,It.y)({"Mod+Shift+F":H,"Mod+Shift+S":_,"Mod+0":_,...h.jm&&h.fl&&{"Mod+,":V}}),(0,o.d4)((()=>{b(),A===m.MT.Privacy&&C()}),[b,C,A]),(0,Ke.Z)((()=>{l&&(N(m.du.Settings),x(l),R(void 0))}),[l,R]);const{initResize:z,resetResize:W,handleMouseUp:X}=function(e,t,n,s,a){const[i,r,c]=(0,ft.Z)(),[d,l]=(0,o.eJ)(),[u,m]=(0,o.eJ)(),h=(0,o.I4)((t=>{if(!e.current)return;const n=t?`${t}px`:"";e.current.style.width=n,e.current.style.setProperty(a,n)}),[a,e]);function g(){document.body.classList.remove("cursor-ew-resize")}return(0,o.bt)((()=>{e.current&&s&&h(s)}),[a,e,s,h]),(0,o.d4)((()=>{if(!i)return;const n=e=>{const t=Math.ceil(u+e.clientX-d);h(t)};function s(){a(),t(e.current.offsetWidth)}function a(){g(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",s,!1),document.removeEventListener("blur",s,!1),c()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",s,!1),document.addEventListener("blur",s,!1),a}),[u,d,e,t,i,c,h]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),l(t.clientX),m(e.current.offsetWidth),r()},resetResize:function(e){e.preventDefault(),h(void 0),n()},handleMouseUp:g}}(k,E,S,r,"--left-column-width"),Y=(0,o.I4)((e=>{N(m.du.Settings),x(e)}),[]);return o.ZP.createElement("div",{id:"LeftColumn",ref:k},o.ZP.createElement(vt.Z,{name:i?"none":h.s0,renderCount:nn,activeKey:D,shouldCleanup:!0,cleanupExceptionKey:tn.Main},(e=>{switch(D){case tn.Archived:return o.ZP.createElement(en,{isActive:e,onReset:q,onTopicSearch:G,isForumPanelOpen:p});case tn.Settings:return o.ZP.createElement(Jt,{isActive:e,currentScreen:A,foldersState:O,foldersDispatch:F,onScreenSelect:Y,onReset:q,shouldSkipTransition:i});case tn.NewChannel:return o.ZP.createElement(Qt,{key:U,isActive:e,isChannel:!0,content:T,onContentChange:N,onReset:q});case tn.NewGroup:return o.ZP.createElement(Qt,{key:U,isActive:e,content:T,onContentChange:N,onReset:q});default:return o.ZP.createElement(Kt,{content:T,isClosingSearch:I,searchQuery:t,searchDate:n,contactsFilter:B,foldersDispatch:F,onContentChange:N,onSearchQuery:$,onScreenSelect:Y,onReset:q,shouldSkipTransition:i,isUpdateAvailable:g,isForumPanelOpen:p,onTopicSearch:G})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:z,onMouseUp:X,onDoubleClick:W}))})));var an=n(12420),on=n(49524),rn=n(71394);var cn=n(12255),dn=n(52678),ln=n(87204),un=n(3570),mn=n(75790),hn=n(18360),gn=n(6058),pn=n(98799),fn=n(59188),In=n(32340),vn=n(6202),wn=n(2903),yn=n(68512),Pn=n(17551);function Zn(e,t,n,s,a){return`M${e},${t+a}a${a},${a},0,0,1,\n ${n},0v${s-2*a}a${a},${a},0,0,1,${-n},0Z`}const Cn=(0,o.X$)((e=>{let{count:t,index:n}=e;const s=(0,o.sO)(null),a=(0,o.Ye)((()=>function(e,t){const n=e-t-1,s=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),a=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),i=`clipPath${e}`,r=function(e,t,n){let s="";if(3===n)s=Zn(0,0,2,t,1)+Zn(0,12,2,t+1,1)+Zn(0,25,2,t,1);else for(let e=0;e<n;e++)s+=Zn(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(i,s,e),c=function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,s,e),d=function(e,t,n,s){return t<=4||e<=1?0:e>=t-2?s-36:(n+4)/2+(e-2)*(n+2)}(n,e,s,o);return{markHeight:a,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:o,clipPathId:i}}(t,n)),[t,n]);if((0,o.d4)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:o,clipPathId:i,clipPath:r}=a,c=s.current.firstElementChild;if(s?.current){const a=s.current,{style:d}=a;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${n}px`,u.style.transform=`translateY(${o}px)`)}}),[a]),1===t)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:s}));const{trackHeight:i,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=a;return o.ZP.createElement("div",{className:(0,_e.Z)("pinned-message-border",t>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:s,style:`clip-path: url("#${l}"); width: 2px;\n height: ${i}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${c}px; transform: translateY(${d}px);`})))}));var bn=n(45370);const En=(0,o.X$)((e=>{let{message:t,count:n,index:a,customTitle:i,className:r,onUnpinMessage:c,onClick:d,onAllPinnedClick:u}=e;const{clickBotInlineButton:m}=(0,s.Sv)(),g=(0,wt.Z)(),p=(0,wn.Z)(t),f=(0,vn.Z)((0,l.Ti)(t,"pictogram")),[I,v,w]=(0,ft.Z)(),y=(0,o.I4)((()=>{w(),c&&c(t.id)}),[w,c,t.id]),P=(0,l.eH)(t),Z=(0,o.I4)((()=>{P&&m({messageId:t.id,button:P})}),[m,P,t.id]),[C,b,E]=(0,ft.Z)();return o.ZP.createElement("div",{className:(0,_e.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&o.ZP.createElement(kt.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:u},o.ZP.createElement("i",{className:"icon-pin-list"})),c&&o.ZP.createElement(kt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:v},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Pn.Z,{isOpen:I,onClose:w,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:y}),o.ZP.createElement("div",{className:(0,_e.Z)("HeaderPinnedMessage",C&&"no-hover"),onClick:d,dir:g.isRtl?"rtl":void 0},o.ZP.createElement(Cn,{count:n,index:a}),p&&function(e,t){const{width:n,height:s}=(0,ve.W7)();return o.ZP.createElement("img",{src:t||e,width:n,height:s,alt:""})}(p,f),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},i?(0,In.Z)(i):`${g("PinnedMessage")} ${a>0?"#"+(n-a):""}`),o.ZP.createElement("p",{dir:"auto"},o.ZP.createElement(bn.Z,{lang:g,message:t,noEmoji:Boolean(p)})),o.ZP.createElement(yn.Z,null)),P&&o.ZP.createElement(kt.Z,{size:"tiny",className:"inline-button",onClick:Z,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:b,onMouseLeave:h.$b?void 0:E},P.text)))}));var Sn=n(10396),Mn=n(64532),Rn=n(23186),kn=n(75851);const Tn=240;function Nn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,a=new Image;return new Promise((o=>{a.onload=()=>{An(a,a.width*t,a.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},a.src=s}))}async function An(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return xn(e,t,n,void 0,s);try{const a=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(a.height!==n||a.width!==t)throw new Error("Image bitmap resize not supported!");const o=await(0,kn.ix)(e.src),i=(0,kn.rZ)(o)<Tn?"#fff":"#000";return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const n=t.getContext("2d");n.fillStyle=i,n.fillRect(0,0,t.width,t.height);const o=t.getContext("bitmaprenderer");o?o.transferFromImageBitmap(a):n.drawImage(a,0,0),t.toBlob(e,s)}))}catch(a){return xn(e,t,n,void 0,s)}}async function xn(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"image/png";const o=document.createElement("canvas"),i=o.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(o.width=t,o.height=n,e.width*s>t){const n=1/s;let a={width:Math.floor(e.width*s),height:Math.floor(e.height*s)};for(r.width=a.width,r.height=a.height,c.drawImage(e,0,0,a.width,a.height);a.width*s>t;)a={width:Math.floor(a.width*s),height:Math.floor(a.height*s)},c.drawImage(r,0,0,a.width*n,a.height*n,0,0,a.width,a.height);i.drawImage(r,0,0,a.width,a.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);const d=await(0,kn.ix)(e.src),l=(0,kn.rZ)(d)<Tn?"#fff":"#000";return i.fillStyle=l,i.globalCompositeOperation="destination-over",i.fillRect(0,0,o.width,o.height),new Promise((e=>{o.toBlob(e,a)}))}var Bn=n(77510);const Ln=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",On={width:200,height:200},Fn=115;var Un=n(17240),jn=n(18051);const Dn={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8};function qn(e,t,n){return o.ZP.createElement(Rt.Z,{onClick:()=>n(e),icon:t===Dn[e]?"check":void 0,customIcon:t!==Dn[e]?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0},e,"X")}const $n=(0,s.c$)(((e,t)=>{let{message:n}=t;const s=(0,c.Ur)(e,n),a=(0,c.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r}=e.audioPlayer;return{sender:s,chat:a,volume:o,playbackRate:i,isMuted:r}}))((e=>{let{message:t,className:n,noUi:i,sender:r,chat:c,volume:d,playbackRate:u,isMuted:m}=e;const{setAudioPlayerVolume:g,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:I,closeAudioPlayer:v}=(0,s.Sv)(),w=(0,o.sO)(null),y=(0,wt.Z)(),{audio:P,voice:Z,video:C}=(0,l.qp)(t),b=Boolean(Z||C),E=b||(P?.duration||0)>a.J0S,S=r?(0,l.OU)(y,r):void 0,M=Ie.UV((0,l.Ti)(t,"inline")),R=((e,t,n)=>{const s=(0,wt.Z)(),{audio:a,voice:i}=(0,l.qp)(e),r=a?a.title||a.fileName:i?"Voice message":"",c=a?.performer||t&&(0,l.OU)(s,t),d=n&&(0,l.U)(s,n)||"Telegram",u=a&&(0,l.MR)(a)&&(0,l.Ti)(e,"pictogram"),m=t&&(0,l.RT)(t,"big"),h=a&&u||i&&m,g=(0,vn.Z)(h),p=(0,o.Ye)((()=>function(e,t,n){if(!n)return On;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?ve.vY:void 0}(a,i,g)),[a,g,i]),{result:f}=(0,Bn.Z)((()=>function(e,t){if(!e)return Promise.resolve(Ln);if(!t)return function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{An(o,t,n,s).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},o.src=a}))}(e,Fn,Fn);const n=Math.min(t.width,t.height);return n<Fn?Nn(e,Fn/n):Promise.resolve(e)}(g,p)),[g,p],Ln);return(0,o.Ye)((()=>(0,Mn.Of)({title:r,artist:c,album:d,artwork:[{src:f}]})),[d,c,r,f])})(t,r,c),{playPause:k,stop:T,isPlaying:N,requestNextTrack:A,requestPreviousTrack:x,isFirst:B,isLast:L,setVolume:O,toggleMuted:F,setPlaybackRate:U}=(0,Rn.Z)((0,Sn.An)(t),(0,l.XV)(t),b?"voice":"audio",M,void 0,R,void 0,!0,void 0,void 0,(0,l.CI)(t),!0),j=b&&N;(0,o.d4)((()=>{if(j)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[j]);const{isContextMenuOpen:D,handleBeforeContextMenu:q,handleContextMenu:$,handleContextMenuClose:G,handleContextMenuHide:H}=(0,Un.Z)(w),_=(0,o.I4)((()=>{I({chatId:t.chatId,messageId:t.id})}),[I,t.chatId,t.id]),V=(0,o.I4)((()=>{N&&k(),v(),(0,Mn.Ay)(),T()}),[v,N,k,T]),z=(0,o.I4)((e=>{g({volume:e/100}),O(e/100)}),[g,O]),W=(0,o.I4)((()=>{h.$b&&!h.cj||(F(),f({isMuted:!m}))}),[m,f,F]),X=(0,o.I4)((e=>{const t=Dn[e];p({playbackRate:t}),U(t)}),[p,U]),Y=(0,o.I4)((()=>{D||X(1===u?2:1)}),[D,u,X]),K=(0,o.I4)((()=>{const e=Object.entries(Dn).find((e=>{let[,t]=e;return t===u}))?.[0]||1;return o.ZP.createElement(kt.Z,{round:!0,className:(0,_e.Z)("playback-button",1!==u&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:Y,onMouseDown:q,onContextMenu:$},o.ZP.createElement("span",{className:"playback-button-inner"},1===u?2:e,"Х"))}),[q,$,Y,u]),J=(0,o.Ye)((()=>0===d||m?"icon-muted":d<.3?"icon-volume-1":d<.6?"icon-volume-2":"icon-volume-3"),[d,m]);if(!i)return o.ZP.createElement("div",{className:(0,_e.Z)("AudioPlayer",n),dir:y.isRtl?"rtl":void 0,ref:w},o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:_},P?function(e){const{title:t,performer:n,fileName:s}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,In.Z)(t||s)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,In.Z)(n)))}(P):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,In.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(y("AttachAudio"),S),o.ZP.createElement(yn.Z,null)),o.ZP.createElement(kt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:B(),onClick:x,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(kt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,_e.Z)("toggle-play","player-button",N?"pause":"play"),onClick:k,ariaLabel:N?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(kt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:L(),onClick:A,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement(kt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},o.ZP.createElement("i",{className:J,onClick:W}),!h.cj&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"volume-slider-spacer"}),o.ZP.createElement("div",{className:"volume-slider"},o.ZP.createElement(jn.Z,{bold:!0,value:m?0:100*d,onChange:z})))),E&&o.ZP.createElement(Mt.Z,{forceOpen:D,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:K,onClose:G,onHide:H},qn(.5,u,X),qn(.75,u,X),qn(1,u,X),qn(1.5,u,X),qn(2,u,X)),o.ZP.createElement(kt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:V,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var Gn=n(4794),Hn=n(14605);const _n=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,c.Z1)(e,n),user:(0,l.YC)(n)?(0,c.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:a,user:i,settings:r,currentUserId:c}=e;const{openAddContactDialog:d,blockContact:u,reportSpam:m,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:I,hideChatReportPanel:v}=(0,s.Sv)(),w=(0,wt.Z)(),[y,P,Z]=(0,ft.Z)(),[C,b]=(0,o.eJ)(!0),[E,S]=(0,o.eJ)(!0),{accessHash:M}=a||{},{isAutoArchived:R,canReportSpam:k,canAddContact:T,canBlockContact:N}=r||{},A=a&&(0,l.G9)(a),x=(0,o.I4)((()=>{d({userId:t}),R&&I({chatId:t})}),[d,R,I,t]),B=(0,o.I4)((()=>{Z(),u({contactId:t,accessHash:M}),k&&C&&m({chatId:t}),E&&h({chatId:t})}),[M,u,Z,h,m,k,E,C,t]),L=(0,o.I4)((()=>{v({chatId:t})}),[t,v]),O=(0,o.I4)((()=>{Z(),m({chatId:t}),A?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,Z,c,p,f,A,g,m]);if(r)return o.ZP.createElement("div",{className:(0,_e.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&o.ZP.createElement(kt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),N&&o.ZP.createElement(kt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_new_contact_block")),k&&!N&&o.ZP.createElement(kt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_report_spam_and_leave")),o.ZP.createElement(kt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Pn.Z,{isOpen:y,onClose:Z,title:w("BlockUserTitle",i?(0,l.Vl)(i):(0,l.U)(w,a)),text:i?w("UserInfo.BlockConfirmationTitle",(0,l.Js)(i)):w("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:i?B:O},i&&o.ZP.createElement(Hn.Z,{label:w("DeleteThisChat"),checked:E,onCheck:S}),i&&k&&o.ZP.createElement(Hn.Z,{label:w("ReportChat"),checked:C,onCheck:b})))}))),Vn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,messageListType:a}=t;const{isLeftColumnShown:o,lastSyncTime:r,shouldSkipHistoryAnimations:d}=e,u=(0,c.Z1)(e,n),{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,c.hj)(e,m,h):void 0;let p;"pinned"===a?p=(0,c.KB)(e,n,s)?.length:"scheduled"===a?p=(0,c.qy)(e,n,s)?.length:"thread"===a&&s!==i._f&&(p=(0,c.tZ)(e,n,s)?.messagesCount||0);const f="thread"===a&&s===i._f,I=u&&(0,c.xo)(e,u),v=Boolean(I&&(0,c.s4)(e,n)),w=I&&!v&&Boolean((0,c.pk)(e,n)),y=Boolean(u&&(f||u.isForum)&&((0,l.eA)(u)||(0,l.ZV)(u))&&u.isNotJoined),P=Boolean(u?.isNotJoined&&u.isJoinRequest),Z={typingStatus:(0,c.WP)(e,n,s,"typingStatus"),isLeftColumnShown:o,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),audioMessage:g,chat:u,messagesCount:p,isChatWithSelf:(0,c.FM)(e,n),lastSyncTime:r,shouldSkipHistoryAnimations:d,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:w||v||y||P},C=(0,c.Zw)(e,n);if("thread"!==a||!C)return Z;if(Object.assign(Z,{messagesById:C}),s!==i._f&&!u?.isForum){const t=(0,c.qS)(e,n,s),a=t?(0,c.hj)(e,n,t):void 0,o=a?(0,c.cv)(e,a):void 0;return{...Z,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o}}const b=(0,c.KB)(e,n,s);if(b?.length){const t=C[b[0]],{canUnpin:n}=t&&(0,c._k)(e,t,s)||{};return{...Z,pinnedMessageIds:b,canUnpin:n}}return Z}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:d,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:w,chat:y,messagesCount:P,isChatWithSelf:Z,lastSyncTime:C,hasButtonInHeader:b,shouldSkipHistoryAnimations:E,currentTransitionKey:S,connectionState:M,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:T,focusMessage:N,openChat:A,openPreviousChat:x,loadPinnedMessages:B,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,s.Sv)(),F=(0,wt.Z)(),U=(0,o.sO)(!0),[j,D]=(0,o.eJ)(0),q=Array.isArray(d)?d[j]:d,$=u&&q?u[q]:void 0,G=Array.isArray(d)?d.length:d?1:void 0,H=y&&(0,l.U)(F,y).length,_=g?(0,l.OU)(F,g):void 0,{settings:V}=y||{},z=y?.isForum;(0,o.d4)((()=>{C&&c&&(n===i._f||z)&&B({chatId:t,threadId:n})}),[t,B,C,n,c,z]),(0,o.d4)((()=>{D(0)}),[d]),(0,mn.Z)(t,q,$);const{width:W}=(0,cn.Z)(),X=W<=a.ksF,Y=h.p7&&I,K=(0,o.sO)(null),J=(0,o.sO)(!0),Q=(0,o.I4)((()=>{k({id:t,threadId:n})}),[k,t,n]),ee=(0,o.I4)((e=>{T({chatId:t,messageId:e,isUnpin:!0})}),[T,t]),te=(0,o.I4)((()=>{if($){N({chatId:$.chatId,threadId:n,messageId:$.id});const e=(0,un.Z)(G||1,j+1);D(e)}}),[$,N,n,G,j]),ne=(0,o.I4)((()=>{A({id:t,threadId:n,type:"pinned"})}),[A,t,n]),se=(0,o.I4)((()=>{setTimeout((()=>{U.current=!0}),450)}),[]),ae=(0,o.I4)((e=>{if(U.current){if(U.current=!1,h.wB&&document.querySelector(a.Edp)?.blur(),f)return O(),void se();if("thread"===r&&0===S)return h.wB||Y?(e.stopPropagation(),A({id:void 0},{forceOnHeavyAnimation:!0})):L(),void se();x(),se()}}),[r,S,f,x,Y,A,L,O,se]),oe=W>=a.ksF&&W<a.jT7||W>a.l35&&W<a.ksF&&(!H||H>30),ie=oe||W>a._mX&&W<a.QU1,re=Boolean(V?.canAddContact||V?.canBlockContact||V?.canReportSpam),{shouldRender:ce,transitionClassNames:de}=(0,st.Z)(re),le=(0,hn.Z)(re?V:void 0,!0),{shouldRender:ue,transitionClassNames:me}=(0,st.Z)(Boolean(w)),he=(0,hn.Z)(w,!0),{shouldRender:ge,transitionClassNames:pe}=(0,st.Z)(Boolean($)),fe=(0,hn.Z)($,!0),Ie=(0,hn.Z)(G,!0),ve=(0,hn.Z)(m,!0),we=(0,hn.Z)(_),ye=(0,ln.Z)(S),Pe=void 0!==ye&&ye<S?ye:void 0,Ze=ge&&fe||ue&&he;(0,o.d4)((()=>{const e=K.current;if(e)return ie&&Ze?void(v||oe?(J.current&&(e.classList.add("tools-stacked","animated"),J.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),J.current=!0)):(e.classList.remove("tools-stacked","animated"),void(J.current=!0))}),[ie,Ze,oe,v]);const{connectionStatusText:Ce}=bt(F,M,R,!0);function be(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(kt.Z,{round:!0,size:"smaller",color:"translucent",onClick:ae,ariaLabel:F(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,_e.Z)("animated-close-icon",!e&&"state-back")})),t&&o.ZP.createElement(ht,null))}const Ee=Boolean(ue&&he),Se=Ee||!h.wB&&b&&W<a.sgm;return o.ZP.createElement("div",{className:"MiddleHeader",ref:K},o.ZP.createElement(vt.Z,{name:E?"none":"slide-fade",activeKey:S,shouldCleanup:!0,cleanupExceptionKey:Pe},"thread"!==r||n!==i._f&&!y?.isForum?o.ZP.createElement(o.ZP.Fragment,null,be(),o.ZP.createElement("h3",null,void 0!==P?"thread"===r?F("CommentsCount",P,"i"):"pinned"===r?F("PinnedMessagesCount",P,"i"):"scheduled"===r?Z?F("Reminders"):F("messages",P,"i"):void 0:F("Loading"))):o.ZP.createElement(o.ZP.Fragment,null,(X||S>0)&&be(Y,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:Q},(0,l.YC)(t)?o.ZP.createElement(gn.Z,{key:t,userId:t,typingStatus:p,status:Ce,withDots:Boolean(Ce),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:c,emojiStatusSize:22,noRtl:!0}):o.ZP.createElement(pn.Z,{key:t,chatId:t,threadId:n,typingStatus:p,status:Ce,withDots:Boolean(Ce),withMediaViewer:n===i._f,withFullInfo:n===i._f,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0})))),o.ZP.createElement(Gn.Z,{hasPinnedOffset:ge&&Boolean(fe)||ue&&Boolean(he),chatId:t}),ge&&fe&&o.ZP.createElement(En,{key:t,message:fe,count:Ie||0,index:j,customTitle:we,className:(0,_e.Z)(pe,Se&&"full-width"),onUnpinMessage:ve?ee:void 0,onClick:te,onAllPinnedClick:ne}),ce&&o.ZP.createElement(_n,{key:t,chatId:t,settings:le,className:de}),o.ZP.createElement("div",{className:"header-tools"},Ee&&o.ZP.createElement($n,{key:(0,l.Tp)(he),message:he,className:me}),o.ZP.createElement(fn.Z,{chatId:t,threadId:n,messageListType:r,canExpandActions:!Ee})))})));function zn(e){return"albumId"in e}function Wn(e,t){let n,s=[],a={originalDate:e[0].date,datetime:(0,z._F)(1e3*e[0].date),senderGroups:[s]};const o=[a];return e.forEach(((i,r)=>{i.isInAlbum?n?(n.messages.push(i),i.content.text&&(n.mainMessage=i)):n={albumId:i.groupedId,messages:[i],mainMessage:i}:s.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(s.push(n),n=void 0),c){const e=(0,z._F)(1e3*c.date);a.datetime!==e?(a={originalDate:c.date,datetime:e,senderGroups:[]},o.push(a),s=[],a.senderGroups.push(s)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,l.FT)(i)||(0,l.FT)(c)||i.forwardInfo&&c.forwardInfo&&(i.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||i.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||i.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||i.inlineButtons||c.inlineButtons||c.date-i.date>600)&&(s=[],a.senderGroups.push(s))}})),o}var Xn=n(30386),Yn=n(87675),Kn=n(60539),Jn=n(88957);var Qn=n(60998);var es=n(72645),ts=n(78722),ns=n(3657);const ss=h.wZ?1e3:350,as=h.wB?300:500;function os(e,t){return e?t?238:175:t?238:100}function is(e,t,n){const s=(0,l.B4)(e),a=(0,l.O$)(e)||(0,l.F$)(e),o=(0,l.b7)(e),i=Boolean((0,l.F$)(e)),r=Boolean((0,l.Cg)(e)),{width:c,height:d}=a?(0,ve.Eh)(a,s,t,i,n):(0,ve.GC)(o,s,t,r,n),u=os(Boolean((0,l.UD)(e)));let m=1;c<u&&u-c<12&&(m=u/c),d*m<90&&90-d*m<12&&(m=90/d);const h=Math.round(c*m),g=Math.round(d*m);return{width:h,height:g,isSmall:h<u||g<90}}var rs=n(28712);function cs(e,t){return e.reduce(((e,t)=>e+t),t)}function ds(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:s}=e;2&s&&(t.width=n.width+n.x),4&s&&(t.height=n.height+n.y)})),t}function ls(e,t,n,s){const a=function(e){return e.map((e=>{const t=is(e);return t.width/t.height}))}(s.messages),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(a),i=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(a),r=a.length,c=a.some((e=>e>2)),d=(0,ve.kc)(e,t,!1,n)-(t?2.5:0)*ve.Gw;let l;const u={ratios:a,proportions:o,averageRatio:i,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return l=r>=5||c?function(e){let{ratios:t,averageRatio:n,maxWidth:s,minWidth:a,spacing:o,maxHeight:i=4*s/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,rs.uZ)(e,1,2.75):(0,rs.uZ)(e,.6667,1)))}(t,n),c=t.length,d=new Array(c),l=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=cs(r.slice(e,e+t),0);return(s-(t-1)*o)/n})(n,e)),n+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const s=c-e-t;e<=3&&t<=(n<.85?4:3)&&s<=3&&u([e,t,s])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let n=1;n!==c-e-t;++n){const s=c-e-t-n;e<=3&&t<=3&&n<=3&&s<=4&&u([e,t,n,s])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:n}=l[e],s=n.length,r=cs(t,0)+o*(s-1),c=Math.min(...t)<a?1.5:1,d=(()=>{for(let e=1;e!==s;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-i)*c*d;(!m||u<h)&&(m=l[e],h=u)}const g=m.lineCounts,p=m.heights,f=g.length;let I=0,v=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],a=Math.round(n);let i=0;for(let c=0;c!==t;++c){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[I],m=c===t-1?s-i:Math.round(u*n);d[I]={dimensions:{x:i,y:v,width:m,height:a},sides:l},i+=m+o,++I}v+=a+o}return d}(u):2===r?function(e){const{ratios:t,proportions:n,averageRatio:s}=e;return"ww"===n&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(a-s)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:11},{dimensions:{x:0,y:o+s,width:n,height:o},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,o=(n-s)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],a)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:13},{dimensions:{x:o+s,y:0,width:o,height:i},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:s,spacing:a,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(s-a),(s-a)/t[0]/(1/t[0]+1/t[1]))),s-a-i),c=s-r-a,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+a,y:0,width:r,height:d},sides:7}]}(e)}(u):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:s,maxWidth:a,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,s[1]*(a-n)/(s[2]+s[1]))),c=i-r-n,d=Math.max(o,Math.round(Math.min((a-n)/2,Math.min(r*s[2],c*s[1])))),l=Math.min(Math.round(i*s[0]),a-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:s,spacing:a}=e,o=t,i=Math.round(Math.min(o/n[0],.66*(s-a))),r=(t-a)/2,c=Math.min(s-i-a,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+a,width:r,height:c},sides:12},{dimensions:{x:r+a,y:i+a,width:o-r-a,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:s,maxHeight:a,minWidth:o}=e;const i=t,r=Math.round(Math.min(i/n[0],.66*(a-s))),c=Math.round((t-2*s)/(n[1]+n[2]+n[3])),d=Math.max(o,Math.round(Math.min(.4*(t-2*s),c*n[1]))),l=Math.round(Math.max(Math.max(o,.33*(t-2*s)),c*n[3])),u=i-d-l-2*s,m=Math.min(a-r-s,c);return[{dimensions:{x:0,y:0,width:i,height:r},sides:11},{dimensions:{x:0,y:r+s,width:d,height:m},sides:12},{dimensions:{x:d+s,y:r+s,width:u,height:m},sides:4},{dimensions:{x:d+s+u+s,y:r+s,width:l,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:s,spacing:a,minWidth:o}=e;const i=t,r=Math.round(Math.min(i*n[0],.6*(s-a))),c=Math.round((t-2*a)/(1/n[1]+1/n[2]+1/n[3])),d=Math.round(c/n[1]),l=Math.round(c/n[2]),u=i-d-l-2*a,m=Math.max(o,Math.min(s-r-a,c));return[{dimensions:{x:0,y:0,width:r,height:i},sides:13},{dimensions:{x:r+a,y:0,width:m,height:d},sides:3},{dimensions:{x:r+a,y:d+a,width:m,height:l},sides:2},{dimensions:{x:r+a,y:d+l+2*a,width:m,height:u},sides:6}]}(e)}(u),{layout:l,containerStyle:ds(l)}}let us,ms;function hs(e){return ms||(ms=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),us||(us=document.createElement("span"),us.style.font=`400 12px ${ms}`,us.style.whiteSpace="nowrap",us.style.position="absolute",us.style.left="-999px",us.style.opacity=".01",document.body.appendChild(us)),us.textContent=e,us.offsetWidth}function gs(e,t,n,s,a,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Kn.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s,void 0,i)}}),[e,t,n,s,a,i])}var ps=n(3858);const fs=3*ve.Gw,Is=Number(ve.Gw),vs="data-is-document-group-hover";function ws(e,t,n,a,i,r,c,d,l,u,m,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,s.Sv)(),[w,y,P]=(0,ft.Z)(),[Z,C,b]=(0,ft.Z)(),E=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,Ut.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===Ut.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&r&&(I({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,I,C,b,r,m]),{handleMouseDown:i?void 0:function(e){(0,Xn.q)(e),l(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return E.current?(clearInterval(E.current),E.current=void 0,void v({chatId:u,messageId:n})):void(E.current=setTimeout((()=>{E.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;be.Z.getIsKeyboardVisible()?setTimeout((()=>{d(e)}),350):d(e)}}(t)}),200))},handleContextMenu:i?c?ps.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else d(t)},handleDoubleClick:i?void 0:function(){!h.$b&&r&&I({messageId:n})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:s}=e,{x:a,width:o,y:i,height:r}=t.getBoundingClientRect(),c=Math.abs(p?n-a:a+o-n)<fs,d=Math.abs(i+r-s)<Is;c&&d?y():P()},handleSendQuickReaction:function(){v({chatId:u,messageId:n})},handleMouseLeave:function(e){P(),f&&function(e){const t=Ps(e.currentTarget);t&&t.removeAttribute(vs)}(e)},isSwiped:Z,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:ys}}function ys(e){const t=Ps(e.currentTarget);t&&t.setAttribute(vs,"")}function Ps(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Zs=n(55254),Cs=n(44139),bs=n(70172),Es=n(18005);const Ss=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0}));var Ms=n(45601);const Rs=(0,o.X$)((0,s.c$)(((e,t)=>{let{message:n}=t;const{byId:s}=e.users,a=n.senderId,{targetUserIds:o,targetChatId:i}=n.content.action||{},r=n.replyToMessageId,d=r?(0,c.hj)(e,n.chatId,r):void 0,u=(0,c._X)(e,n),{direction:m,noHighlight:h}=u&&e.focusedMessage||{},g=(0,c.Z1)(e,n.chatId),p=g&&((0,l.eA)(g)||a===n.chatId),f=!p&&a?(0,c.dy)(e,a):void 0,I=p?g:void 0,v=e.premiumGifts?.stickers?.[0];return{usersById:s,senderUser:f,senderChat:I,targetChatId:i,targetUserIds:o,targetMessage:d,isFocused:u,premiumGiftSticker:v,topic:(0,c.p$)(e,n),...u&&{focusDirection:m,noFocusHighlight:h}}}))((e=>{let{message:t,isEmbedded:n,appearanceOrder:a=0,isLastInList:i,usersById:r,senderUser:c,senderChat:d,targetUserIds:u,targetMessage:m,targetChatId:h,isFocused:g,focusDirection:p,noFocusHighlight:f,premiumGiftSticker:I,isInsideTopic:v,topic:w,memoFirstUnreadIdRef:y,observeIntersectionForReading:P,observeIntersectionForLoading:Z,observeIntersectionForPlaying:C}=e;const{openPremiumModal:b,requestConfetti:E}=(0,s.Sv)(),S=(0,wt.Z)(),M=(0,o.sO)(null);(0,ns._N)(M,P),(0,mn.Z)(t.chatId,t.replyToMessageId,m),gs(M,t.chatId,g,p,f);const R=a<=0,[k,T]=(0,ft.Z)(R),N=Boolean(t.content.action?.text.startsWith("ActionGift"));(0,o.d4)((()=>{R||setTimeout(T,10*a)}),[a,T,R]);const A=(0,ns.Op)(M,C),x=(0,o.sO)((()=>{const e=y?.current&&t.id>=y.current;return N&&!t.isOutgoing&&e})());(0,o.d4)((()=>{A&&x.current&&(x.current=!1,E())}),[A,E]);const{transitionClassNames:B}=(0,st.Z)(k,void 0,R,!1),L=(0,o.Ye)((()=>u?u.map((e=>r?.[e])).filter(Boolean):void 0),[u,r]),O=(0,Es.D)(S,t,c,d,L,m,h,w,{isEmbedded:n},Z,C),{isContextMenuOpen:F,contextMenuPosition:U,handleBeforeContextMenu:j,handleContextMenu:D,handleContextMenuClose:q,handleContextMenuHide:$}=(0,Un.Z)(M),G=void 0!==U;if(v&&"TopicWasCreatedAction"===t.content.action?.text)return o.ZP.createElement("span",{ref:M});if(n)return o.ZP.createElement("span",{ref:M,className:"embedded-action-message"},O);const H=(0,_e.Z)("ActionMessage message-list-item",g&&!f&&"focused",N&&"premium-gift",G&&"has-menu-open",i&&"last-in-list",B);return o.ZP.createElement("div",{ref:M,id:(0,l.d0)(t.id),className:H,"data-message-id":t.id,onMouseDown:e=>{(0,Xn.q)(e),j(e)},onContextMenu:D},o.ZP.createElement("span",null,O),N&&o.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{b({isGift:!0,fromUserId:c?.id,toUserId:u?.[0],monthsAmount:t.content.action?.months||0})}},o.ZP.createElement(Ms.Z,{key:t.id,sticker:I,play:!0,noLoop:!0,nonInteractive:!0}),o.ZP.createElement("strong",null,S("ActionGiftPremiumTitle")),o.ZP.createElement("span",null,S("ActionGiftPremiumSubtitle",S("Months",t.content.action?.months,"i"))),o.ZP.createElement("span",{className:"action-message-button"},S("ActionGiftPremiumView"))),U&&o.ZP.createElement(Ss,{isOpen:F,anchor:U,message:t,messageListType:"thread",onClose:q,onCloseAnimationEnd:$}))}))),ks=e=>{let{className:t,message:n,sender:s,title:a,customText:i,isProtected:r,noUserColors:c,hasContextMenu:d,observeIntersectionForLoading:u,observeIntersectionForPlaying:m,onClick:h}=e;const g=(0,o.sO)(null),p=(0,ns.Op)(g,u),f=(0,vn.Z)(n&&(0,l.Ti)(n,"pictogram"),!p),I=(0,wn.Z)(n),v=Boolean(n&&(0,l.Y5)(n)),w=(0,wt.Z)(),y=s?(0,l.OU)(w,s):n?.forwardInfo?.hiddenUserName;return o.ZP.createElement("div",{ref:g,className:(0,_e.Z)("EmbeddedMessage",t,s&&!c&&`color-${(0,l.Rs)(s)}`),onClick:n?h:void 0},I&&function(e,t,n,s){const{width:a,height:i}=(0,ve.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{src:t||e,width:a,height:i,alt:"",className:(0,_e.Z)("pictogram",n&&"round"),draggable:!s}),s&&o.ZP.createElement("span",{className:"protector"}))}(I,f,v,r),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},n?(0,l.FT)(n)?o.ZP.createElement(Rs,{message:n,isEmbedded:!0,observeIntersectionForLoading:u,observeIntersectionForPlaying:m}):o.ZP.createElement(bn.Z,{lang:w,message:n,noEmoji:Boolean(I),observeIntersectionForLoading:u,observeIntersectionForPlaying:m}):i||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,In.Z)(y||a||" "))),d&&o.ZP.createElement("i",{className:"embedded-more icon-more"}))};var Ts=n(82535),Ns=n(54752),As=n(8018);const xs=(0,o.X$)((e=>{let{message:t,outgoingStatus:n,signature:a,withReactionOffset:i,onClick:r}=e;const{showNotification:c}=(0,s.Sv)(),d=(0,wt.Z)(),[l,u]=(0,ft.Z)(),m=e=>{e.stopPropagation(),c({message:d("ImportedInfo")})},h=(0,o.Ye)((()=>{if(!l)return;const e=(0,z.SA)(1e3*t.date,d.code),n=t.isEdited&&(0,z.SA)(1e3*t.editDate,d.code),s=t.forwardInfo&&(0,z.SA)(1e3*t.forwardInfo.date,d.code);let a=e;return n&&(a+="\n",a+=d("lng_edited_date").replace("{date}",n)),s&&(a+="\n",a+=d("lng_forwarded_date").replace("{date}",s)),a}),[l,d,t]),g=(0,_e.Z)("MessageMeta",i&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return o.ZP.createElement("span",{className:g,dir:d.isRtl?"rtl":"ltr",onClick:r,"data-ignore-on-paste":!0},Boolean(t.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,lt.bi)(t.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),a&&o.ZP.createElement("span",{className:"message-signature"},(0,In.Z)(a)),o.ZP.createElement("span",{className:"message-time",title:h,onMouseEnter:u},t.forwardInfo?.isImported&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-imported",onClick:m},(0,z.SA)(1e3*t.forwardInfo.date,d.code,!0)),o.ZP.createElement("span",{className:"message-imported",onClick:m},d("ImportedMessage"))),t.isEdited&&`${d("EditedMessage")} `,(0,z.mr)(d,1e3*t.date)),n&&o.ZP.createElement(As.Z,{status:n}))}));var Bs=n(36765),Ls=n(97799);const Os=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:r,lastSyncTime:c,shouldPlayEffect:d,onPlayEffect:u,onStopEffect:m}=e;const{showNotification:g,openStickerSet:p}=(0,s.Sv)(),f=(0,wt.Z)(),I=(0,o.sO)(null),v=t.content.sticker,{stickerSetInfo:w,isVideo:y,hasEffect:P}=v,Z=v.isPreloadedGlobally?void 0:(0,l.Ti)(t,y&&!h.Hh?"pictogram":"inline"),C=(0,ns.Op)(I,n),b=(0,ns.Op)(I,a),E=`sticker${v.id}?size=f`,S=(0,vn.Z)(E,!C||!P,i.IU.BlobUrl,c),[M,R,k]=(0,ft.Z)(),T=(0,o.I4)((()=>{k(),m?.()}),[m,k]);(0,o.d4)((()=>{P&&b&&d&&(R(),u?.())}),[P,b,u,d,R]);const N=(0,o.I4)((()=>{p({stickerSetInfo:v.stickerSetInfo})}),[p,v]),A=(0,o.I4)((()=>{if(P)return M?void g({message:f("PremiumStickerTooltip"),action:N,actionText:f("ViewAction")}):(R(),void u?.());N()}),[P,M,f,u,N,g,R]),x="isMissing"in w,{width:B,height:L}=(0,ve.Wr)(v),O=(0,_e.Z)("Sticker media-inner",x&&"inactive",P&&!t.isOutgoing&&"reversed");return o.ZP.createElement("div",{ref:I,className:O,style:`width: ${B}px; height: ${L}px;`,onClick:x?void 0:A},o.ZP.createElement(Bs.Z,{containerRef:I,sticker:v,fullMediaHash:Z,fullMediaClassName:"full-media",size:B,shouldLoop:r,noLoad:!C,noPlay:!b,withSharedAnimation:!0,cacheBuster:c}),P&&C&&M&&o.ZP.createElement(Ls.Z,{key:E,className:"effect-sticker",tgsUrl:S,size:1.49*B,play:!0,isLowPriority:!0,noLoop:!0,onEnded:T}))};var Fs=n(13365),Us=n(74753),js=n(80036);const Ds=7*ve.Gw;function qs(e,t,n,a,i,r,d,l){const{interactWithAnimatedEmoji:u,sendEmojiInteraction:m,sendWatchingEmojiInteraction:h}=(0,s.Sv)(),g=r||d,p=(0,o.sO)(null),f=(0,o.sO)(null),I=(0,vn.Z)(n?`document${n}`:void 0,!n),v=l||Ds,w=(0,js.Z)(`width: ${v}px`,`height: ${v}px`,(d||r)&&"cursor: pointer"),y=(0,o.sO)(void 0),P=(0,o.sO)(void 0),Z=(0,o.I4)((()=>{p.current&&(m({chatId:e,messageId:t,localEffect:r,emoji:d,interactions:y.current}),P.current=void 0,y.current=void 0)}),[m,e,t,r,d]),C=(0,o.I4)((()=>{const e=f.current;I&&(e&&(e.pause(),e.remove()),f.current=new Audio,f.current.src=I,(0,Us.Z)(f.current),f.current.addEventListener("ended",(()=>{f.current=void 0}),{once:!0}))}),[I]),b=(0,o.I4)((()=>{C();const n=p.current;if(!(g&&n&&t&&e))return;const{x:s,y:a}=n.getBoundingClientRect();u({localEffect:r,emoji:d,x:s,y:a,startSize:v,isReversed:!i}),y.current||(y.current=[],P.current=performance.now(),setTimeout(Z,1e3)),y.current.push(P.current?(performance.now()-P.current)/1e3:0)}),[e,d,g,u,i,r,t,C,Z,v]);return(0,o.d4)((()=>{const n=p.current;n&&a&&a.forEach((s=>{let{id:a,startSize:o,messageId:l}=s;if(o||t!==l)return;const{x:u,y:m}=n.getBoundingClientRect();h({id:a,chatId:e,emoticon:r?(0,c.ji)(r):d,startSize:v,x:u,y:m,isReversed:!i}),C()}))}),[a,e,d,i,r,t,C,h,v]),{ref:p,size:v,style:w,handleClick:b}}var $s=n(21179);const Gs=(0,o.X$)((0,s.c$)(((e,t)=>{let{emoji:n,withEffects:s}=t;const a=(0,c.CP)(e,n);return{sticker:(0,c.zB)(e,n),effect:s?(0,c.tH)(e,n):void 0,soundId:(0,c.Oh)(e,n),localSticker:a,localEffect:a&&s?(0,c.cu)(a):void 0}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:s,forceLoadPreview:a,messageId:i,chatId:r,activeEmojiInteractions:c,sticker:d,effect:l,localSticker:u,localEffect:m,soundId:h}=e;const{ref:g,size:p,style:f,handleClick:I}=qs(r,i,h,c,t,m,l?.emoji),v=(0,ns.Op)(g,n);return u?o.ZP.createElement($s.Z,{tgsUrl:Fs.l[u],size:p,quality:1,play:v,forceOnHeavyAnimation:!0,ref:g,className:"AnimatedEmoji media-inner",style:f,onClick:I}):o.ZP.createElement(Ms.Z,{sticker:d,size:p,quality:1,noLoad:!v,forcePreview:a,lastSyncTime:s,play:v,forceOnHeavyAnimation:!0,ref:g,className:(0,_e.Z)("AnimatedEmoji media-inner",d?.id===ve.wB&&"like-sticker-thumb"),style:f,onClick:I})})));var Hs=n(96459);const _s=(0,o.X$)((0,s.c$)(((e,t)=>{let{customEmojiId:n,withEffects:s}=t;const a=e.customEmojis.byId[n];return{sticker:a,effect:a?.emoji&&s?(0,c.tH)(e,a.emoji):void 0,soundId:a?.emoji&&(0,c.Oh)(e,a.emoji)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:s,chatId:a,activeEmojiInteractions:i,sticker:r,effect:c,soundId:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:g}=qs(a,s,d,i,t,void 0,c?.emoji,(0,Cs.qo)(1));return o.ZP.createElement(Hs.Z,{ref:u,documentId:n,className:(0,_e.Z)("AnimatedEmoji media-inner",r?.id===ve.wB&&"like-sticker-thumb"),style:h,size:m,isBig:!0,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:l,onClick:g})}))),Vs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function zs(e,t,n,s,a){return s?Promise.resolve(Vs[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.crossOrigin="anonymous",n.width||await new Promise((e=>{n.onload=e}));const s=document.createElement("canvas"),a=s.getContext("2d");s.width=n.width,s.height=n.height,a.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(a.getImageData(o,i,1,1).data).join(",")})`}(e,t)}var Ws=n(92566),Xs=n(15866);function Ys(e,t){return(0,Xs.Z)((0,l.DH)(e),Boolean(t),h.wB&&!h.vX)}var Ks=n(70692),Js=n(39196);const Qs=e=>{let{id:t,message:n,observeIntersection:s,noAvatars:i,canAutoLoad:r,isInSelectMode:c,isSelected:d,uploadProgress:u,size:m="inline",dimensions:h,asForwarded:g,nonInteractive:p,shouldAffectAppendix:f,isDownloading:I,isProtected:v,theme:w,onClick:y,onCancelUpload:P}=e;const Z=(0,o.sO)(null),C=((0,l.O$)(n)||(0,l.F$)(n)).blobUrl,b=(0,ns.Op)(Z,s),[E,S]=(0,o.eJ)(r),M=E&&b,{mediaData:R,loadProgress:k}=(0,Ws.Z)((0,l.Ti)(n,m),!M),T=C||R,[N]=(0,o.eJ)(!T),A=Boolean(T),x=Ys(n,A),B=(0,Ks.Z)(!A),{loadProgress:L}=(0,Ws.Z)((0,l.Ti)(n,"download"),!I,(0,l.kG)(n,"download")),{isUploading:O,isTransferring:F,transferProgress:U}=(0,l.Sc)(n,u||(I?L:k),M&&!T),j=!1===(0,ln.Z)(E),{shouldRender:D,transitionClassNames:q}=(0,st.Z)(F,void 0,j,"slow"),{shouldRender:$,transitionClassNames:G}=(0,st.Z)(!T&&!E),H=(0,o.I4)((()=>{O?P&&P(n):T?y&&y(n.id):S((e=>!e))}),[T,O,n,P,y]),_=(0,l.B4)(n);(0,es.Z)((e=>{let[t]=e;if(!f)return void(t&&Z.current.closest(a.be_).removeAttribute(a.s22));const n=Z.current.closest(a.be_);T?zs(T,_,0,d,w).then((e=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(a.s22,"")})):n.classList.add("has-appendix-thumb")}),[f,T,_,c,d,w]);const{width:V,height:z,isSmall:W}=h||is(n,g,i),X=(0,_e.Z)("media-inner",!O&&!p&&"interactive",W&&"small-image",V===z&&"square-image"),Y=h?` width: ${V}px; left: ${h.x}px; top: ${h.y}px;`:"",K="inline"===m?`height: ${z}px;${Y}`:void 0;return o.ZP.createElement("div",{id:t,ref:Z,className:X,style:K,onClick:O?void 0:H},o.ZP.createElement("img",{src:T,className:"full-media",alt:"",draggable:!v}),N&&o.ZP.createElement("canvas",{ref:x,className:(0,_e.Z)("thumbnail",B)}),v&&o.ZP.createElement("span",{className:"protector"}),D&&!$&&o.ZP.createElement("div",{className:`media-loading ${q}`},o.ZP.createElement(Js.Z,{progress:U,onClick:O?H:void 0})),$&&o.ZP.createElement("i",{className:(0,_e.Z)("icon-download",G)}),F&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*U),"%"))};var ea=n(35148);const ta=e=>{let{id:t,message:n,observeIntersectionForLoading:a,observeIntersectionForPlaying:i,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:u,lastSyncTime:m,dimensions:h,asForwarded:g,isDownloading:p,isProtected:f,onClick:I,onCancelUpload:v}=e;const w=(0,o.sO)(null),y=(0,o.sO)(null),P=(0,l.b7)(n)||(0,l.Cg)(n),Z=P.blobUrl,C=(0,ns.Op)(w,a),b=(0,ns.Op)(w,i)&&C,E=(0,o.sO)(C);b&&!E.current&&(E.current=!0);const[S,M]=(0,o.eJ)(c),R=Boolean(S&&C&&m),[k,T]=(0,o.eJ)(d),N=(0,l.Ti)(n,"inline"),[A]=(0,o.eJ)(Boolean(N&&Ie.UV(N))),{mediaData:x,loadProgress:B}=(0,Ws.Z)(N,!R,(0,l.kG)(n,"inline"),m),L=Z||x,[O,F]=(0,ft.Z)(),U=Boolean((0,l.DH)(n)),j=(0,l.Ti)(n,"preview"),[D]=(0,o.eJ)(Boolean(j&&Ie.UV(j))),q=C&&m,$=(0,vn.Z)(j,!q,void 0,m),G=(0,Ks.Z)((U||$)&&!O),H=!U||$||O,_=Ys(n,H),V=(0,Ks.Z)(!H),W=L&&E.current,{loadProgress:X}=(0,Ws.Z)((0,l.Ti)(n,"download"),!p,(0,l.kG)(n,"download"),m),{isUploading:Y,isTransferring:K,transferProgress:J}=(0,l.Sc)(n,u||(p?X:B),R&&!O&&!A||p),Q=!1===(0,ln.Z)(S),{shouldRender:ee,transitionClassNames:te}=(0,st.Z)(K,void 0,Q),{transitionClassNames:ne}=(0,st.Z)(Boolean((S||L)&&!k&&!ee)),[se,ae]=(0,o.eJ)(0),oe=(0,o.I4)((e=>{ae(Math.max(0,e.currentTarget.currentTime-1))}),[]),ie=y.current?.duration||P.duration||0,re=(0,l.B4)(n),ce=Boolean((0,l.Cg)(n)),{width:de,height:le}=h||(0,ve.GC)(P,re,g,ce,r),ue=(0,o.I4)((()=>{Y?v&&v(n):p?(0,s.Sv)().cancelMessageMediaDownload({message:n}):L?L&&!k?T(!0):I&&I(n.id):M((e=>!e))}),[Y,p,L,k,I,v,n]),me=(0,_e.Z)("media-inner dark",!Y&&"interactive"),he=`height: ${le}px;${h?` width: ${de}px; left: ${h.x}px; top: ${h.y}px;`:""}`;return o.ZP.createElement("div",{ref:w,id:t,className:me,style:he,onClick:Y?void 0:ue},W&&o.ZP.createElement(ea.Z,{ref:y,src:L,className:"full-media",canPlay:k&&b,muted:!0,loop:!0,playsInline:!0,draggable:!f,onTimeUpdate:oe,onReady:F}),o.ZP.createElement("img",{src:$,className:(0,_e.Z)("thumbnail",G),alt:"",draggable:!f}),U&&!D&&o.ZP.createElement("canvas",{ref:_,className:(0,_e.Z)("thumbnail",V)}),f&&o.ZP.createElement("span",{className:"protector"}),o.ZP.createElement("i",{className:(0,_e.Z)("icon-large-play",ne)}),ee&&o.ZP.createElement("div",{className:(0,_e.Z)("media-loading",te)},o.ZP.createElement(Js.Z,{progress:J,onClick:ue})),!S&&!L&&o.ZP.createElement("i",{className:"icon-download"}),K?o.ZP.createElement("span",{className:"message-transfer-progress"},Y||p?`${Math.round(100*J)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,z.k9)(Math.max(ie-se,0))))};var na=n(6272);const sa=(0,s.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:s}}=e;return{user:(0,c.dy)(e,n.userId),phoneCodeList:s,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{contact:t,user:n,phoneCodeList:a,animationLevel:i}=e;const{openChat:r}=(0,s.Sv)(),{firstName:c,lastName:d,phoneNumber:l,userId:u}=t,m="0"!==u,h=(0,o.I4)((()=>{r({id:u})}),[r,u]);return o.ZP.createElement("div",{className:(0,_e.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},o.ZP.createElement(bs.Z,{size:"large",user:n,text:c||d,animationLevel:i,withVideo:!0}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},c," ",d),o.ZP.createElement("div",{className:"contact-phone"},(0,na.WZ)(a,l))))}));var aa=n(20230),oa=n(51218),ia=n(14434),ra=n(96937);function ca(e,t){return t>0?(e/t*100).toFixed():0}const da=e=>{let{answer:t,voteResults:n,totalVoters:s,maxVotersCount:a,correctResults:i,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),d=0===i.length||-1!==i.indexOf(t.option),l=i.length>0&&d||c?.isChosen,u=c?ca(c.votersCount,s||0):0,[m,h]=(0,o.eJ)(r?0:u),g=(0,o.sO)(null),p=c?ca(c.votersCount,a||0):0,f=m!==u;if((0,o.d4)((()=>{r&&h(u)}),[r,u]),(0,o.d4)((()=>{const e=g.current;if(e&&r){const t=e.firstElementChild,n=f?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",n):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${n}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[f,r]),!n||!c)return;const I=`width: ${p}%; transform:scaleX(${f?0:1})`;return o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",l&&o.ZP.createElement("span",{className:(0,_e.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},o.ZP.createElement("i",{className:d?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,In.Z)(t.text)),o.ZP.createElement("div",{className:(0,_e.Z)("poll-option-answer",l&&!d&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:g}),o.ZP.createElement("div",{className:"poll-option-line",style:I}))))};function la(e){e.stopPropagation()}const ua=(0,o.X$)((0,s.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:s}=n.results,{serverTimeOffset:a,users:{byId:o}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:o,serverTimeOffset:a}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:a,usersById:i,onSendVote:r,serverTimeOffset:c}=e;const{loadMessage:d,openPollResults:l,requestConfetti:u}=(0,s.Sv)(),{id:m,chatId:h}=t,{summary:g,results:p}=n,[f,I]=(0,o.eJ)(!1),[v,w]=(0,o.eJ)([]),[y,P]=(0,o.eJ)(!1),[Z,C]=(0,o.eJ)(!1),[b,E]=(0,o.eJ)(!g.closed&&g.closeDate&&g.closeDate>0?Math.min(g.closeDate-Math.floor(Date.now()/1e3)+c,g.closePeriod):0),S=(0,o.sO)(null),{results:M,totalVoters:R}=p,k=M&&M.some((e=>e.isChosen)),T=!g.closed&&!k,N=!T&&g.isPublic&&Number(p.totalVoters)>0,A=T&&g.multipleChoice,x=M?Math.max(...M.map((e=>e.votersCount))):R,B=M?M.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],L=g.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(g.quiz&&g.closePeriod&&b<=0)})));(0,o.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));f&&e&&(e.isCorrect&&u(),I(!1))}),[f,n.results.results,u]),(0,o.d4)((()=>{b>0&&setTimeout((()=>E(b-1)),1e3);const e=S.current;if(e){const t=12*Math.PI,n=e.lastElementChild,s=e.firstElementChild;if(b<=5&&e.classList.add("hurry-up"),n&&s){const e=(g.closePeriod-b)/g.closePeriod*t;s.textContent=(0,z.k9)(b),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,z.k9)(b)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[b,g.closePeriod]),(0,o.d4)((()=>{g.quiz&&(b<=0||k&&!g.closed)&&d({chatId:h,messageId:m})}),[h,b,k,d,m,g.closed,g.quiz]),(0,o.d4)((()=>{let e;return g.quiz&&!g.closed&&g.closePeriod&&g.closePeriod>0&&(e=window.setTimeout((()=>{d({chatId:h,messageId:m})}),1e3*g.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[T,h,d,m,g.closePeriod,g.closed,g.quiz]);const O=(0,o.Ye)((()=>a?a.reduce(((e,t)=>{const n=i[t];return n&&e.push(n),e}),[]):[]),[i,a]),F=(0,o.I4)((e=>{w([e]),I(!0),C(!0),r([e])}),[r]),U=(0,o.I4)((e=>{w(e)}),[]),j=(0,o.I4)((()=>{I(!0),C(!0),r(v)}),[r,v]),D=(0,o.I4)((()=>{l({chatId:h,messageId:m})}),[h,m,l]),q=(0,o.I4)((()=>{P(!0)}),[]),$=(0,o.I4)((()=>{P(!1),C(!1)}),[]);(0,o.d4)((()=>{Z&&k&&g.quiz&&p.results&&n.results.solution&&(p.results.find((e=>e.isChosen&&e.isCorrect))||P(!0))}),[k,Z,p.results,g.quiz,n.results.solution]);const G=(0,wt.Z)();return o.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&o.ZP.createElement(ra.Z,{message:(0,aa.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:$,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,In.Z)(g.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},G(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(g)),O.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},O.map((e=>o.ZP.createElement(bs.Z,{size:"micro",user:e})))),b>0&&T&&o.ZP.createElement("div",{ref:S,className:"poll-countdown"}),g.quiz&&n.results.solution&&!T&&o.ZP.createElement(kt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:q,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),T&&o.ZP.createElement("div",{className:"poll-answers",onClick:la},A?o.ZP.createElement(oa.Z,{options:L,onChange:U,disabled:t.isScheduled||f,loadingOptions:f?v:void 0,round:!0}):o.ZP.createElement(ia.Z,{name:`poll-${m}`,options:L,onChange:F,disabled:t.isScheduled||f,loadingOption:f?v[0]:void 0})),!T&&o.ZP.createElement("div",{className:"poll-results"},g.answers.map((function(e){return o.ZP.createElement(da,{key:e.option,shouldAnimate:Z||!T,answer:e,voteResults:M,totalVoters:R,maxVotersCount:x,correctResults:B})}))),!N&&!A&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(G,g.quiz,p.totalVoters)),A&&o.ZP.createElement(kt.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:j},G("PollSubmitVotes")),N&&o.ZP.createElement(kt.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var ma=n(48035),ha=n(10088);const ga=(0,o.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,inPreview:r,asForwarded:c,lastSyncTime:d,isDownloading:u=!1,isProtected:m,theme:h,onMediaClick:g,onCancelMediaTransfer:p}=e;const f=(0,l.s1)(t),I=(0,o.I4)((()=>{g()}),[g]);if(!f)return;const{siteName:v,url:w,displayUrl:y,title:P,description:Z,photo:C,video:b}=f,E=(0,ma.Z)(Z,170),S=Boolean(E||P||v);let M=!1;if(S&&f?.photo&&!f.video){const{width:e,height:n}=is(t);M=e===n}const R=(C||b)&&g&&!M,k=(0,_e.Z)("WebPage",r&&"in-preview",M&&"with-square-photo",!C&&!b&&!r&&"without-media",b&&"with-video",!S&&"no-article");return o.ZP.createElement("div",{className:k,"data-initial":(v||y)[0],dir:"auto"},C&&!b&&o.ZP.createElement(Qs,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,size:M?"pictogram":"inline",asForwarded:c,nonInteractive:!R,isDownloading:u,isProtected:m,theme:h,onClick:R?I:void 0,onCancelUpload:p}),S&&o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(ha.Z,{className:"site-name",url:w,text:v||y}),!r&&P&&o.ZP.createElement("p",{className:"site-title"},(0,In.Z)(P)),E&&o.ZP.createElement("p",{className:"site-description"},(0,In.Z)(E,["emoji","br"]))),!r&&b&&o.ZP.createElement(ta,{message:t,observeIntersectionForLoading:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,lastSyncTime:d,asForwarded:c,isDownloading:u,isProtected:m,onClick:R?I:void 0,onCancelUpload:p}))}));var pa=n(17921);const fa=(0,o.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:s,isSelected:i,theme:r}=e;const c=(0,o.sO)(null),d=(0,wt.Z)(),u=(0,l.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photo:I}=u,v=(0,vn.Z)((0,l.O9)(I));return(0,es.Z)((e=>{let[t]=e;if(n){if(v){const e=c.current.closest(a.be_);zs(v,!1,0,i,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s22,"")}))}}else t&&c.current.closest(a.be_).removeAttribute(a.s22)}),[n,v,s,i,r]),o.ZP.createElement("div",{ref:c,className:"Invoice"},m&&o.ZP.createElement("p",{className:"title"},(0,In.Z)(m)),h&&o.ZP.createElement("div",null,(0,In.Z)(h,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(I?"has-image":"")},v&&o.ZP.createElement("img",{className:"invoice-image",src:v,alt:"",crossOrigin:"anonymous"}),!v&&I&&o.ZP.createElement(pa.Z,{width:I.dimensions?.width,height:I.dimensions?.height,forceAspectRatio:!0}),o.ZP.createElement("p",{className:"description-text"},(0,He.x)(g,p,d.code),f&&o.ZP.createElement("span",null,d("PaymentTestInvoice")))))})),Ia={root:"rwnm0xOh31c2MY4kK2No",dots:"Nlcnrzv_f5cSxFsPOGt2",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",canvas:"a_WnxsI6X0B4j7QRRoOA"},va=(0,o.X$)((e=>{let{message:t,lastSyncTime:n}=e;const{openInvoice:a,loadExtendedMedia:i}=(0,s.Sv)(),r=(0,wt.Z)(),c=(0,l.eO)(t),{chatId:d,id:u}=t,m=(0,o.I4)((()=>{i({chatId:d,ids:[u]})}),[d,u,i]);(0,ot.Z)(m,n?3e4:void 0);const{amount:h,currency:g,extendedMedia:p}=c,{width:f,height:I,thumbnail:v,duration:w}=p,y=(0,Xs.Z)(v?.dataUri,!1,void 0,25,f,I),P=(0,o.I4)((()=>{a({chatId:d,messageId:u,isExtendedMedia:!0})}),[d,u,a]);return o.ZP.createElement("div",{className:(0,_e.Z)(Ia.root,"media-inner"),onClick:P},o.ZP.createElement("canvas",{ref:y,className:Ia.canvas,width:f,height:I}),o.ZP.createElement("div",{className:Ia.dots}),Boolean(w)&&o.ZP.createElement("div",{className:Ia.duration},(0,z.k9)(w)),o.ZP.createElement("div",{className:Ia.buy},o.ZP.createElement("i",{className:(0,_e.Z)("icon-lock",Ia.lock)}),r("Checkout.PayPrice",(0,He.x)(h,g))))})),wa=new Map(Object.entries({"building/medical":"#43b3f4","building/gym":"#43b3f4","education/cafeteria":"#f7943f","travel/bedandbreakfast":"#9987ff","travel/hotel":"#9987ff","travel/hostel":"#9987ff","travel/resort":"#9987ff","travel/hotel_bar":"#e56dd6",arts_entertainment:"#e56dd6",building:"#6e81b2",education:"#a57348",event:"#959595",food:"#f7943f",home:"#00aeef",nightlife:"#e56dd6",parks_outdoors:"#6cc039",shops:"#ffb300",travel:"#1c9fff",work:"#ad7854"})),ya=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"];var Pa=n(28183);const Za=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",Ca=1e-4,ba={width:400,height:300,zoom:16,scale:2},Ea={__html:'<svg version="1.1" class="round-pin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve"><g><circle cx="32" cy="32" r="24.5"/><path d="M32,8c13.23,0,24,10.77,24,24S45.23,56,32,56S8,45.23,8,32S18.77,8,32,8 M32,7C18.19,7,7,18.19,7,32s11.19,25,25,25 s25-11.19,25-25S45.81,7,32,7L32,7z"/></g><g><polygon points="29.38,57.67 27.4,56.08 30.42,54.42 32,51.54 33.58,54.42 36.6,56.08 34.69,57.61 32,60.73"/><path d="M32,52.58l1.07,1.95l0.14,0.26l0.26,0.14l2.24,1.22l-1.33,1.06l-0.07,0.06l-0.06,0.07L32,59.96l-2.24-2.61l-0.06-0.07 l-0.07-0.06l-1.33-1.06l2.24-1.22l0.26-0.14l0.14-0.26L32,52.58 M32,50.5l-1.94,3.56L26.5,56l2.5,2l3,3.5l3-3.5l2.5-2l-3.56-1.94 L32,50.5L32,50.5z"/></g></svg>'},Sa=(0,o.X$)((e=>{let{message:t,peer:n,lastSyncTime:i,isInSelectMode:r,isSelected:c,theme:d,serverTimeOffset:u}=e;const{openUrl:m}=(0,s.Sv)(),h=(0,o.sO)(null),g=(0,o.sO)(null),f=(0,wt.Z)(),I=(0,nt.Z)(),v=(0,l.nf)(t),{type:w,geo:y}=v,P=(0,p.b)(u),Z=(0,l.$R)(t,P),C="geoLive"!==w||Z?void 0:t.date+v.period-P,[b,E]=(0,o.eJ)(y),S="venue"===w||"geoLive"===w&&!Z,{width:M,height:R,zoom:k,scale:T}=ba,N=Boolean(i)&&(0,l.k6)(b,M,R,k,T),A=(0,vn.Z)(N),x=(0,ln.Z)(A),B=A||x,L=n&&(0,l.YC)(n.id),O=n&&L?n:void 0,F=n&&!L?n:void 0,U=(0,l.B4)(t),j=(0,o.Ye)((()=>{if("geoLive"!==w||!b.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=b;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,k)}),[w,b,k]),D=(0,o.I4)((e=>{if("geoLive"!==w)return;const n=24*Math.PI,s=e.lastElementChild,a=e.firstElementChild,o=t.date+v.period-(0,p.b)(u),i=(1-o/v.period)*n,r=(0,z.mB)(f,1e3*o);s&&a?(a.textContent=r,s.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)):e.innerHTML=`\n <span class="geo-countdown-text">${r}</span>\n <svg width="32px" height="32px">\n <circle cx="16" cy="16" r="12" class="geo-countdown-progress" transform="rotate(-90, 16, 16)"\n stroke-dasharray="${n} ${n}"\n stroke-dashoffset="-${i}"\n />\n </svg>`}),[w,t.date,v,u,f]);return(0,o.bt)((()=>{g.current&&D(g.current)}),[D]),(0,es.Z)((e=>{let[t]=e;if(S)t||h.current.closest(a.be_).removeAttribute(a.s22);else if(B){const e=h.current.closest(a.be_);zs(B,U,0,c,d).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(a.s22,"")}))}}),[S,U,r,c,d,B]),(0,o.d4)((()=>{Math.abs(y.lat-b.lat)<Ca&&Math.abs(y.long-b.long)<Ca?b.accuracyRadius!==y.accuracyRadius&&E({...b,accuracyRadius:y.accuracyRadius}):E(y)}),[y,b]),(0,Pa.Z)((()=>{I()}),Z?void 0:1e3*(C||0)),(0,ot.Z)((()=>{const e=g.current;e&&D(e)}),C?1e3:void 0),o.ZP.createElement("div",{ref:h,className:"Location media-inner interactive",onClick:()=>{const e=function(e,t,n){return`https://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(b.lat,b.long,k);m({url:e})}},o.ZP.createElement("div",{className:"map-wrapper"},B?o.ZP.createElement("img",{className:"full-media map",src:B,alt:"Location on a map",style:`width: ${ba.width}px; height: ${ba.height}px;`}):o.ZP.createElement(pa.Z,{width:M,height:R}),function(){if(B)return o.ZP.createElement(o.ZP.Fragment,null,Boolean(j)&&!Z&&o.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*j}px; height: ${2*j}px`}),function(){const e=(0,_e.Z)("pin",w,Z&&"expired");if("geoLive"===w)return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:Ea},o.ZP.createElement(bs.Z,{chat:F,user:O,className:"location-avatar"}),void 0!==v.heading&&o.ZP.createElement("div",{className:"direction",style:`--direction: ${v.heading}deg`}));if("venue"===w){const t=function(e){return e?wa.get(e)||wa.get(e.split("/")[0])||ya[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%ya.length)]:"#008df2";var t}(v.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(v.venueType);return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:Ea,style:`--pin-color: ${t}`},o.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return o.ZP.createElement("img",{className:e,src:Za,alt:""})}())}()),function(){if(S)return"venue"===w?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},v.title),o.ZP.createElement("div",{className:"location-info-subtitle"},v.address)):"geoLive"===w?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},f("AttachLiveLocation")),o.ZP.createElement("div",{className:"location-info-subtitle"},(0,z.dJ)(f,P,t.editDate)),!Z&&o.ZP.createElement("div",{className:"geo-countdown",ref:g})):void 0}())})),Ma=(0,o.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:a}=e;const{clickBotInlineButton:i}=(0,s.Sv)(),r=t.content.game,{title:c,description:d}=r,u=Boolean(a)&&(0,l.N)(r),m=Boolean(a)&&(0,l.Wc)(r),h=(0,vn.Z)(u,!n),g=(0,vn.Z)(m,!n);return o.ZP.createElement("div",{className:"Game"},o.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{i({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&o.ZP.createElement(pa.Z,{className:"skeleton preview-content"}),h&&o.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&o.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:g})),o.ZP.createElement("div",{className:"title"},c),!(0,l.UD)(t)&&o.ZP.createElement("div",{className:"description"},d))}));function Ra(e){return(0,o.X$)((0,s.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,c.CA)(e),isSelected:(0,c.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:a,message:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,s.Sv)(),d=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:e?.shiftKey})}),[c,i]),l=(0,o.Ye)((()=>{const{dimensions:e,onClick:s}=t;return{...t,isInSelectMode:n,isSelected:a,dimensions:{...e,x:0,y:0},onClick:n?void 0:s}}),[t,n,a]);return o.ZP.createElement("div",{className:(0,_e.Z)("album-item-select-wrapper",a&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},a&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,l))})))}const ka=Ra(Qs),Ta=Ra(ta),Na=(0,s.c$)(((e,t)=>{let{album:n}=t;const{chatId:s}=n.mainMessage,a=(0,c.Pu)(e),o=(0,c.xs)(e,s);return{theme:a,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:a,lastSyncTime:i,isOwn:r,isProtected:d,albumLayout:u,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,s.Sv)(),I=t.messages.length,v=(0,o.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:w,height:y}=u.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${y}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,l.qp)(e),y=h[(0,l.KK)(e)]?.progress,{dimensions:P,sides:Z}=u.layout[t],C=(0,c.bH)((0,s.Rd)(),e),b=(0,c.__)((0,s.Rd)(),e);if(f){const s=a&&(r?t===I-1:Boolean(8&Z&&4&Z));return o.ZP.createElement(ka,{id:`album-media-${(0,l.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,shouldAffectAppendix:s,uploadProgress:y,dimensions:P,isProtected:d,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})}if(w)return o.ZP.createElement(Ta,{id:`album-media-${(0,l.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,canAutoPlay:b,uploadProgress:y,lastSyncTime:i,dimensions:P,isProtected:d,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})})))}));let Aa;const xa=e=>{let{message:t,observeIntersection:n,canAutoLoad:a,lastSyncTime:r,isDownloading:c}=e;const d=(0,o.sO)(null),u=(0,o.sO)(null),m=(0,o.sO)(null),h=t.content.video,g=(0,ns.Op)(d,n),[p,f]=(0,o.eJ)(a),I=Boolean(p&&g&&r),{mediaData:v,loadProgress:w}=(0,Ws.Z)((0,l.Ti)(t,"inline"),!I,(0,l.kG)(t,"inline"),r),{loadProgress:y}=(0,Ws.Z)((0,l.Ti)(t,"download"),!c,i.IU.BlobUrl,r),[P,Z]=(0,ft.Z)(),C=!Boolean((0,l.DH)(t))||P,b=Ys(t,C),E=(0,Ks.Z)(!C),S=p&&!P||c,M=!1===(0,ln.Z)(p),{shouldRender:R,transitionClassNames:k}=(0,st.Z)(S,void 0,M),[N,A]=(0,o.eJ)(!1),[x,B]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!N)return;const e=ve.Rj/2,t=2*(e-6)*Math.PI,n=t-x*t,s=m.current,a=u.current,o=a.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${ve.Rj}px" height="${ve.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(s.currentTime/s.duration)}),[N,x]);const L=Boolean(v&&g),O=(0,o.I4)((()=>{m.current&&(A(!1),B(0),(0,Us.Z)(m.current),(0,T.T2)((()=>{u.current.innerHTML=""})))}),[]),F=(0,o.I4)((()=>{Aa?.(),Aa=O}),[O]),U=(0,o.I4)((()=>{if(!v)return void f((e=>!e));if(c)return void(0,s.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;N?e.paused?((0,Us.Z)(e),(0,Sn.Es)()):e.pause():(F(),e.pause(),e.currentTime=0,(0,Us.Z)(e),(0,Sn.Es)(),A(!0))}),[F,N,c,v,t]),j=(0,o.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]);return o.ZP.createElement("div",{ref:d,className:"RoundVideo media-inner",onClick:U},v&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement(ea.Z,{canPlay:L,ref:m,src:v,className:"full-media",width:ve.Rj,height:ve.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?O:void 0,onTimeUpdate:N?j:void 0,onReady:Z})),o.ZP.createElement("canvas",{ref:b,className:(0,_e.Z)("thumbnail",E),style:`width: ${ve.Rj}px; height: ${ve.Rj}px`}),o.ZP.createElement("div",{className:"progress",ref:u}),R&&o.ZP.createElement("div",{className:`media-loading ${k}`},o.ZP.createElement(Js.Z,{progress:c?y:w})),!v&&!p&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},N?(0,z.k9)(m.current.currentTime):(0,z.k9)(h.duration),(!N||m.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},Ba=e=>{let{message:t,onClick:n}=e;const s=(0,wt.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(kt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},o.ZP.createElement("span",{className:"inline-button-text"},(0,In.Z)(s(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!a.FSu.test(e.url))return o.ZP.createElement("i",{className:"icon-arrow-right"});break;case"urlAuth":return o.ZP.createElement("i",{className:"icon-arrow-right"});case"buy":case"receipt":return o.ZP.createElement("i",{className:"icon-cart"});case"switchBotInline":return o.ZP.createElement("i",{className:"icon-share-filled"});case"webView":case"simpleWebView":return o.ZP.createElement("i",{className:"icon-webapp"})}})(e))))))))};var La=n(34076);const Oa=(0,o.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:a}=(0,s.Sv)(),i=(0,wt.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,o.I4)((()=>{a({id:c,threadId:r})}),[a,c,r]),p=(0,o.Ye)((()=>{if(!h?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,s.Rd)();return h.map((n=>(0,l.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===d)return;const f=Boolean(m&&u&&m<u),I=d?i("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?o.ZP.createElement(La.Z,{text:(0,lt.bi)(d)}):e)):void 0;return o.ZP.createElement("div",{"data-cnt":(0,lt.bi)(d),className:(0,_e.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:g},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!p||0===p.length)&&o.ZP.createElement("i",{className:"icon-comments"}),p&&p.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},p.map((e=>o.ZP.createElement(bs.Z,{key:e.id,size:"small",user:(0,l.YC)(e.id)?e:void 0,chat:(0,l.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},d?I:i("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))}));var Fa=n(78046),Ua=n(48198);const ja=(0,o.X$)((e=>{let{reaction:t}=e;const n=(0,l.RK)(t.documentId),s=(0,vn.Z)(n),a=(0,o.Ye)((()=>h._G?Array.from({length:7}).map((()=>function(){const e=(10+60*Math.random())*(Math.random()>.5?1:-1),t=20+80*Math.random();return`M 0 0 C 0 0 ${e} ${-t-20} ${e} ${t}`}())):[]),[]);if(s)return o.ZP.createElement("div",{className:"TaAutZxIFX4go5HmM7Cg"},a.map((e=>{const t=`--offset-path: path('${e}');`;return o.ZP.createElement("img",{src:s,alt:"",className:"b5KMGtz_lQAs58tR80GG",style:t})})))})),Da={root:"JY0NZH9bysPBqR3sIbLu","is-custom-emoji":"T1R9OVCwcfQHR4vN8cx_",isCustomEmoji:"T1R9OVCwcfQHR4vN8cx_","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},qa=1.875*ve.Gw,$a=6.25*ve.Gw,Ga=(0,o.X$)((e=>{let{reaction:t,genericEffects:n,activeReactions:a,availableReactions:i,observeIntersection:r}=e;const{stopActiveReaction:c}=(0,s.Sv)(),d=(0,o.sO)(null),u="documentId"in t,m=(0,o.Ye)((()=>i?.find((e=>(0,l.Hl)(e.reaction,t)))),[i,t]),h=m?.centerIcon?.id,g=(0,Fa.Z)(u?t.documentId:void 0),p=(0,o.Ye)((()=>{if(!u)return m?.aroundAnimation?.id;if(!g)return;const e=i?.find((e=>e.reaction.emoticon===g.emoji))?.aroundAnimation?.id;return e}),[m,i,g,u]),f=(0,o.Ye)((()=>{if(p)return p;if(!n?.stickers)return;const{stickers:e}=n;return e[Math.floor(Math.random()*e.length)].id}),[p,n]),I=(0,ns.Op)(d,r),v=h&&`sticker${h}`,w=f&&`sticker${f}`,y=(0,vn.Z)(v,!h),P=(0,vn.Z)(w,!f),Z=(0,o.Ye)((()=>a?.find((e=>(0,l.Hl)(e.reaction,t)))),[a,t]),C=Boolean(Z&&(u||y)&&P),{shouldRender:b,transitionClassNames:E}=(0,st.Z)(C,void 0,!0,"slow"),S=(0,o.I4)((()=>{Z?.messageId&&c({messageId:Z.messageId,reaction:t})}),[Z?.messageId,t,c]),[M,R,k]=(0,ft.Z)(),T=!(u||C&&M),N=(0,_e.Z)(Da.root,b&&Da.animating,u&&Da.isCustomEmoji);return o.ZP.createElement("div",{className:N,ref:d},T&&o.ZP.createElement(Ua.Z,{reaction:t,availableReactions:i}),u&&o.ZP.createElement(Hs.Z,{documentId:t.documentId,className:Da.customEmoji,observeIntersectionForPlaying:r}),b&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ls.Z,{key:f,className:(0,_e.Z)(Da.effect,E),size:$a,tgsUrl:P,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:S}),u?!p&&I&&o.ZP.createElement(ja,{reaction:t}):o.ZP.createElement(Ls.Z,{key:h,className:(0,_e.Z)(Da.animatedIcon,E),size:qa,tgsUrl:y,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:R,onEnded:k})))})),Ha=(0,o.X$)((e=>{let{reaction:t,message:n,activeReactions:a,availableReactions:i,withRecentReactors:r,genericEffects:c,observeIntersection:d}=e;const{toggleReaction:u}=(0,s.Sv)(),{recentReactions:m}=n.reactions,h=(0,o.Ye)((()=>{if(!r||!m)return;const e=(0,s.Rd)().users.byId;return m.filter((e=>(0,l.Hl)(e.reaction,t.reaction))).map((t=>e[t.userId])).filter(Boolean)}),[t.reaction,m,r]),g=(0,o.I4)((()=>{u({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,u]);return o.ZP.createElement(kt.Z,{className:(0,_e.Z)((0,l.Bt)(t)&&"chosen"),size:"tiny",onClick:g},o.ZP.createElement(Ga,{activeReactions:a,reaction:t.reaction,availableReactions:i,genericEffects:c,observeIntersection:d}),h?.length?o.ZP.createElement("div",{className:"avatars"},h.map((e=>o.ZP.createElement(bs.Z,{user:e,size:"micro"})))):o.ZP.createElement(La.Z,{text:(0,lt.bi)(t.count)}))})),_a=(0,o.X$)((e=>{let{message:t,isOutside:n,activeReactions:s,availableReactions:a,metaChildren:i,genericEffects:r,observeIntersection:c}=e;const d=(0,o.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return o.ZP.createElement("div",{className:(0,_e.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>o.ZP.createElement(Ha,{key:(0,l.$d)(e.reaction),reaction:e,message:t,activeReactions:s,availableReactions:a,withRecentReactors:d<=3,genericEffects:r,observeIntersection:c}))),i)})),Va=(0,o.X$)((e=>{let{phoneCall:t,message:n,chatId:a}=e;const{requestCall:i}=(0,s.Sv)(),r=(0,wt.Z)(),{isOutgoing:c,isVideo:d,reason:l}=t,u="missed"===l,m="busy"===l&&!c,g=(0,o.I4)((()=>{i({isVideo:d,userId:a})}),[a,d,i]),p=(0,o.Ye)((()=>d?m?"CallMessageVideoIncomingDeclined":u?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?"CallMessageIncomingDeclined":u?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":c?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,c,d]),f=(0,o.Ye)((()=>t.duration?(0,z.J_)(r,t.duration):void 0),[r,t.duration]),I=(0,z.mr)(r,1e3*n.date);return o.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},o.ZP.createElement(kt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!h.Bi,ariaLabel:r(c?"CallAgain":"CallBack")},o.ZP.createElement("i",{className:d?"icon-video-outlined":"icon-phone"})),o.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},o.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},r(p)),o.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},o.ZP.createElement("i",{className:(0,_e.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",u&&"V5tKkKZpcY5yq_f5nO8l",!c&&"e0Vhbj8gfzQn1zJQoFLK")}),o.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?r("CallMessageWithDuration",[I,f]):I))))}));var za=n(78780),Wa=n(4863),Xa=n(50685),Ya=n(14612),Ka=n(98138),Ja=n(8381);var Qa=n(69123);const eo=1.125*ve.Gw,to=(0,o.X$)((e=>{let{topic:t,className:n,onClick:s}=e;const a=(0,wt.Z)();return o.ZP.createElement("div",{className:(0,_e.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,Ka.gZ)(t?.iconColor)})`,onClick:s},t?o.ZP.createElement(Ja.Z,{topic:t,size:eo}):o.ZP.createElement("img",{src:Qa,alt:""}),t?.title?(0,In.Z)(t.title):a("Loading"),t?.isClosed&&o.ZP.createElement("i",{className:"icon-lock"}),o.ZP.createElement("i",{className:"icon-next"}))})),no={__html:'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#EEFFDE" class="corner"/></g></svg>'},so={__html:'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z" fill="#000" filter="url(#a)"/><path d="M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z" fill="#FFF" class="corner"/></g></svg>'},ao=1.75*ve.Gw,oo=(0,o.X$)((0,s.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:s,lastSyncTime:a,serverTimeOffset:o}=e,{message:r,album:d,withSenderName:u,withAvatar:m,threadId:h,messageListType:g,isLastInDocumentGroup:p,isFirstInGroup:f}=t,{id:I,chatId:v,viaBotId:w,replyToChatId:y,replyToMessageId:P,isOutgoing:Z,repliesThreadInfo:C,forwardInfo:b,transcriptionId:E}=r,S=(0,c.Z1)(e,v),M=(0,c.FM)(e,v),R=(0,l.pK)(v),k=S&&(0,l.eA)(S),T=S&&(0,l.Bf)(S),N=S?.usernames,A=s.messageIds&&s.messageIds.includes(I),x=!M&&(0,l.Ul)(r),B=u||m||x,L=(0,c.Ur)(e,r),O=(0,c.cv)(e,r),F=w?(0,c.dy)(e,w):void 0,U=L?.id&&T?S.fullInfo?.adminMembersById?.[L?.id]:void 0,j=h?(0,c.qS)(e,v,h):void 0,D=r.id===j,q=P===j,$=P&&!q?(0,c.hj)(e,R&&y?y:v,P):void 0,G=$&&(0,c.Bz)(e,$,Boolean(b)),H="topicCreate"===$?.content.action?.type,_=(0,c.uZ)(e,r),V="thread"===g&&(d?d.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,r)),{direction:z,noHighlight:W,isResizingContainer:X}=V&&n||{},{query:Y}=(0,c.n5)(e)||{},K=(0,l.h_)(r),J=K&&((0,c.zB)(e,K)||(0,c.CP)(e,K))?K:void 0,Q=(0,l.HW)(r);let ee;ee=d?.messages?d.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,I);const{canReply:te}="thread"===g&&(0,c._k)(e,r,h)||{},ne=(0,c.te)(e,r),se=C?(0,c.tZ)(e,C.chatId,C.threadId)||C:void 0,ae=Boolean(r.groupedId)&&!r.isInAlbum,oe=ae?(0,c.xH)(e,v,r.groupedId)[0]:void 0,ie=ae?p?(0,c.hj)(e,v,oe):void 0:r,re=S?.unreadReactions?.includes(r.id),ce=h===i._f?(0,c.p$)(e,r):void 0,de=h===i._f&&S?.isForum&&f;return{theme:(0,c.Pu)(e),chatUsernames:N,forceSenderName:x,sender:L,canShowSender:B,originSender:O,botSender:F,shouldHideReply:q||H,isThreadTop:D,replyMessage:$,replyMessageSender:G,isInDocumentGroup:ae,isProtected:(0,c.EV)(e,r),isChatProtected:(0,c.Am)(e,v),isFocused:V,isForwarding:A,reactionMessage:ie,isChatWithSelf:M,isRepliesChat:R,isChannel:k,isGroup:T,canReply:te,lastSyncTime:a,serverTimeOffset:o,highlight:Y,animatedEmoji:J,animatedCustomEmoji:Q,isInSelectMode:(0,c.CA)(e),isSelected:ee,isGroupSelected:Boolean(r.groupedId)&&!r.isInAlbum&&(0,c.a6)(e,v,r.groupedId),threadId:h,isDownloading:ne,isPinnedList:"pinned"===g,canAutoLoadMedia:(0,c.bH)(e,r),canAutoPlayMedia:(0,c.__)(e,r),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.Cy)(e),repliesThreadInfo:se,availableReactions:e.availableReactions,defaultReaction:(0,l.CI)(r)?void 0:(0,c.q6)(e,v),activeReactions:ie&&e.activeReactions[ie.id],activeEmojiInteractions:e.activeEmojiInteractions,...Z&&{outgoingStatus:(0,c.dT)(e,r,"scheduled"===g)},..."number"==typeof _&&{uploadProgress:_},...V&&{focusDirection:z,noFocusHighlight:W,isResizingContainer:X},hasUnreadReaction:re,isTranscribing:void 0!==E&&e.transcriptions[E]?.isPending,transcribedText:void 0!==E?e.transcriptions[E]?.text:void 0,isPremium:(0,c.wV)(e),animationLevel:e.settings.byKey.animationLevel,senderAdminMember:U,messageTopic:ce,genericEffects:e.genericEmojiEffects,hasTopicChip:de}}))((e=>{let{message:t,chatUsernames:n,observeIntersectionForBottom:r,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,album:u,noAvatars:g,withAvatar:f,withSenderName:I,noComments:v,appearanceOrder:w,isFirstInGroup:y,isPremium:P,isLastInGroup:Z,isFirstInDocumentGroup:C,isLastInDocumentGroup:b,isTranscribing:E,transcribedText:S,isLastInList:M,theme:R,forceSenderName:k,sender:T,canShowSender:N,originSender:A,botSender:x,isThreadTop:B,shouldHideReply:L,replyMessage:O,replyMessageSender:F,outgoingStatus:U,uploadProgress:j,isInDocumentGroup:D,isProtected:q,isChatProtected:$,isFocused:G,focusDirection:H,noFocusHighlight:_,isResizingContainer:V,isForwarding:z,isChatWithSelf:W,isRepliesChat:X,isChannel:Y,isGroup:K,canReply:J,lastSyncTime:Q,serverTimeOffset:ee,highlight:te,animatedEmoji:ne,animatedCustomEmoji:se,genericEffects:ae,isInSelectMode:oe,isSelected:ie,isGroupSelected:re,threadId:ce,reactionMessage:de,availableReactions:le,defaultReaction:ue,activeReactions:me,activeEmojiInteractions:he,messageListType:ge,isPinnedList:pe,isDownloading:fe,canAutoLoadMedia:Ie,canAutoPlayMedia:we,shouldLoopStickers:ye,autoLoadFileMaxSizeMb:Pe,repliesThreadInfo:Ze,hasUnreadReaction:Ce,memoFirstUnreadIdRef:be,animationLevel:Ee,senderAdminMember:Se,messageTopic:Me,hasTopicChip:Re}=e;const{toggleMessageSelection:ke,clickBotInlineButton:Te,disableContextMenuHint:Ne,animateUnreadReaction:Ae,focusLastMessage:xe}=(0,s.Sv)(),Be=(0,o.sO)(null),Le=(0,o.sO)(null),Oe=(0,o.sO)(null),Fe=(0,wt.Z)(),[Ue,je]=(0,o.eJ)(!1),[De,qe,$e]=(0,ft.Z)();(0,ns._N)(Le,r);const{isContextMenuOpen:Ge,contextMenuPosition:He,handleBeforeContextMenu:Ve,handleContextMenu:ze,handleContextMenuClose:We,handleContextMenuHide:Xe}=(0,Un.Z)(Be,h.$b&&oe,!0,h.wZ);(0,o.d4)((()=>{Ge&&Ne()}),[Ge,Ne]);const Ye=w<=0,[Ke,Je]=(0,ft.Z)(Ye);(0,o.d4)((()=>{Ye||setTimeout(Je,10*w)}),[w,Je,Ye]);const{transitionClassNames:Qe}=(0,st.Z)(Ke,void 0,Ye,!1),{id:et,chatId:tt,forwardInfo:nt,viaBotId:at,isTranscriptionError:ot}=t,it=(0,l.CI)(t),rt=(0,l.B4)(t),ct="scheduled"===ge||t.isScheduled,dt=(0,l.ss)(t)&&!L,lt=Boolean(Ze)&&"thread"===ge,ut=(0,l.$D)(t),mt=ut&&(ne||se),ht=de?.reactions&&!(0,l.JE)(de.reactions),gt=nt&&(!W||ct)&&!X&&!nt.isLinkedChannelPost&&!ut,pt=Boolean(u)&&u.messages.length>1&&!u?.messages.some((e=>0===Object.keys(e.content).length)),It=D&&!C,vt=D&&!b,yt=void 0!==He,Pt=!(yt||oe||z||vt),Zt=Y&&!ct&&t.isForwardingAllowed&&!$,Ct=Boolean(pe||nt&&(nt.isChannelPost||W&&!rt||X)&&nt.fromMessageId),bt=Re||dt,Et=(0,o.I4)(((e,t)=>{ke({messageId:et,groupedId:t,...e?.shiftKey&&{withShift:!0},...pt&&{childMessageIds:u.messages.map((e=>{let{id:t}=e;return t}))}})}),[ke,et,pt,u]),St=N?T:void 0,Mt=Boolean(!Ue&&(ot||S)),Rt=nt&&(W||X||!St)?A:St,Tt=nt?A:St,{handleMouseDown:Nt,handleClick:At,handleContextMenu:xt,handleDoubleClick:Bt,handleContentDoubleClick:Lt,handleMouseMove:Ot,handleSendQuickReaction:Ft,handleMouseLeave:Ut,isSwiped:jt,isQuickReactionVisible:Dt,handleDocumentGroupMouseEnter:qt}=ws(Et,Be,et,0,Boolean(oe),Boolean(J),Boolean(q),ze,Ve,tt,yt,Oe,rt,vt),{handleAvatarClick:$t,handleSenderClick:Gt,handleViaBotClick:Ht,handleReplyClick:_t,handleMediaClick:Vt,handleAudioPlay:zt,handleAlbumMediaClick:Wt,handleMetaClick:Xt,handleReadMedia:Yt,handleCancelUpload:Kt,handleVoteSend:Jt,handleGroupForward:Qt,handleForward:en,handleFocus:tn,handleFocusForwarded:nn,handleDocumentGroupSelectAll:sn,handleTopicChipClick:an}=function(e,t,n,a,r,c,d,l,u,h,g,p,f,I){const{openChat:v,showNotification:w,focusMessage:y,openMediaViewer:P,openAudioPlayer:Z,markMessagesRead:C,cancelSendingMessage:b,sendPollVote:E,openForwardMenu:S,focusMessageInComments:M}=(0,s.Sv)(),{id:R,forwardInfo:k,replyToMessageId:T,replyToChatId:N,replyToTopMessageId:A,groupedId:x}=n,B=(0,o.I4)((()=>{g&&v({id:g.id})}),[g,v]),L=(0,o.I4)((()=>{p?d&&k?.channelPostId?y({chatId:p.id,messageId:k.channelPostId}):v({id:p.id}):w({message:e("HidAccount")})}),[d,y,k,e,v,p,w]),O=(0,o.I4)((()=>{f&&v({id:f.id})}),[f,v]),F=(0,o.I4)((()=>{y({chatId:u&&N?N:a,threadId:r,messageId:T,replyMessageId:u&&N?void 0:R})}),[y,u,N,a,r,T,R]),U=(0,o.I4)((()=>{P({chatId:a,threadId:r,mediaId:R,origin:l?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,R,P,l]),j=(0,o.I4)((()=>{Z({chatId:a,messageId:R})}),[a,R,Z]),D=(0,o.I4)((e=>{P({chatId:a,threadId:r,mediaId:e,origin:l?m.bZ.ScheduledAlbum:m.bZ.Album})}),[a,r,P,l]),q=(0,o.I4)((()=>{C({messageIds:[R]})}),[R,C]),$=(0,o.I4)((()=>{b({chatId:a,messageId:R})}),[b,a,R]),G=(0,o.I4)((e=>{E({chatId:a,messageId:R,options:e})}),[a,R,E]),H=(0,o.I4)((()=>{S({fromChatId:a,groupedId:x})}),[S,a,x]),_=(0,o.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:a,messageIds:e})}else S({fromChatId:a,messageIds:[R]})}),[h,S,a,R]),V=(0,o.I4)((()=>{y({chatId:a,threadId:i._f,messageId:R})}),[y,a,R]),z=(0,o.I4)((()=>{c?y({chatId:k.fromChatId,groupedId:x,groupedChatId:a}):u&&N?M({chatId:N,threadId:A,messageId:k.fromMessageId}):y({chatId:k.fromChatId,messageId:k.fromMessageId})}),[c,u,N,y,k,x,a,M,A]),W=(0,o.I4)((e=>{e.stopPropagation(),t(e,x)}),[t,x]);return{handleAvatarClick:B,handleSenderClick:L,handleViaBotClick:O,handleReplyClick:F,handleMediaClick:U,handleAudioPlay:j,handleAlbumMediaClick:D,handleMetaClick:W,handleReadMedia:q,handleCancelUpload:$,handleVoteSend:G,handleGroupForward:H,handleForward:_,handleFocus:V,handleFocusForwarded:z,handleDocumentGroupSelectAll:W,handleTopicChipClick:(0,o.I4)((()=>{I&&y({chatId:u&&N?N:a,threadId:I.id,messageId:R})}),[a,y,u,I,R,N])}}(Fe,Et,t,tt,ce,D,gt,ct,X,u,Rt,Tt,x,Me);(0,o.d4)((()=>{M&&Mt&&S&&xe()}),[xe,M,S,Mt]);const on=(0,_e.Z)("Message message-list-item",y&&"first-in-group",q&&"is-protected",Z&&"last-in-group",C&&"first-in-document-group",b&&"last-in-document-group",M&&"last-in-list",rt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",dt&&"has-reply",yt&&"has-menu-open",G&&!_&&"focused",z&&"is-forwarding",t.isDeleting&&"is-deleting",D&&"is-in-document-group",pt&&"is-album",t.hasUnreadMention&&"has-unread-mention",ie&&"is-selected",oe&&"is-in-selection-mode",B&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",jt&&"is-swiped",Qe,(Boolean(me)||De)&&"has-active-reaction"),{text:rn,photo:cn,video:dn,audio:ln,voice:un,document:hn,sticker:gn,contact:pn,poll:fn,webPage:vn,invoice:wn,location:yn,action:Pn,game:Zn}=(0,l.qp)(t),{phoneCall:Cn}=Pn||{},bn=Ze&&!vt&&"thread"===ge&&!v,En=!h.$b&&!Cn&&!oe&&ue&&!vt,Sn=function(e){let{hasSubheader:t,isCustomShape:n,isLastInGroup:s,asForwarded:o,hasThread:i,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:u,isGeoLiveActive:m,withVoiceTranscription:h}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:g,photo:p,video:f,audio:I,voice:v,document:w,poll:y,webPage:P,contact:Z,location:C,invoice:b}=(0,l.qp)(e),E=[a.gnl],S=p||f||C||b?.extendedMedia,M=g||"venue"===C?.type||m,R=S&&!M,k=Boolean(e.viaBotId);return!S&&e.emojiOnlyCount?(E.push("emoji-only"),e.emojiOnlyCount<=a.L5X&&E.push(`emoji-only-${e.emojiOnlyCount}`)):M&&E.push("text"),d&&E.push("has-action-button"),n&&(E.push("custom-shape"),f?.isRound&&E.push("round"),c&&E.push("has-comments")),S?E.push("media"):I?E.push("audio"):v?(E.push("voice"),h&&E.push("with-voice-transcription")):w?E.push("document"):Z?E.push("contact"):y?E.push("poll"):P&&(E.push("web-page"),(P.photo||P.video)&&E.push("media")),b&&!b.extendedMedia&&E.push("invoice"),o&&E.push("is-forwarded"),t&&E.push("has-subheader"),i&&E.push("has-replies"),u&&E.push("has-reactions"),k&&E.push("is-via-bot"),r&&E.push("force-sender-name"),n||(E.push("has-shadow"),S&&c&&E.push("has-background"),(t||o||k||!R||r)&&E.push("has-solid-background"),s&&(p||C&&!M||!R)&&E.push("has-appendix")),E.join(" ")}(t,{hasSubheader:bt,isCustomShape:ut,isLastInGroup:Z,asForwarded:gt,hasThread:lt,forceSenderName:k,hasComments:Ze&&Ze.messagesCount>0,hasActionButton:Zt||Ct,hasReactions:ht,isGeoLiveActive:"geoLive"===yn?.type&&!(0,l.$R)(t,(0,p.b)(ee)),withVoiceTranscription:Mt}),Mn=Sn.includes("has-appendix"),Rn=(0,l.fY)(t),kn=(0,Cs.qo)(t.emojiOnlyCount);let Tn,Nn;Tn=Cn||vt?"none":!Rn||vn||mt?"standalone":"in-text",ht?ut||(cn||dn)&&!Rn?Nn="outside":gt?(Tn="standalone",Nn="inside"):Nn="inside":Nn="none",(0,mn.Z)(X&&t.replyToChatId?t.replyToChatId:tt,dt?t.replyToMessageId:void 0,O,t.id),gs(Be,tt,G,H,_,V),(0,o.d4)((()=>{const e=Le.current;Ce&&e&&(0,Zs.P)(e)&&Ae({messageIds:[et]})}),[Ce,et,Ae]);let An,xn="",Bn=!1;const Ln=(0,o.Ye)((()=>pt?ls(rt,Boolean(gt),Boolean(g),u):void 0),[pt,rt,gt,g,u]),On=gt?28:0;if(!pt&&(cn||dn||wn?.extendedMedia)){let e;if(cn)e=is(t,gt,g).width;else if(dn)e=dn.isRound?ve.Rj:is(t,gt,g).width;else if(wn?.extendedMedia&&wn.extendedMedia.width&&wn.extendedMedia.height){const{width:t,height:n}=wn.extendedMedia;e=(0,ve.Kf)({width:t,height:n,fromOwnMessage:rt,asForwarded:gt,noAvatars:g}).width}e&&(An=Math.max(os(Boolean(rn),bn),e),wn?.extendedMedia&&An-e>18&&(Bn=!0))}else Ln&&(An=Math.max(os(Boolean(rn),bn),Ln.containerStyle.width),An-Ln.containerStyle.width>18&&(Bn=!0));An&&(xn=`width: ${An+On}px`);const Fn=Y&&t.postAuthorTitle||!gt&&nt?.postAuthorTitle||void 0,jn=(0,o.Ye)((()=>Fn?hs(Fn):void 0),[Fn]);function Dn(){const e=o.ZP.createElement(xs,{message:t,outgoingStatus:U,signature:Fn,withReactionOffset:"inside"===Nn,availableReactions:le,onClick:Xt});return"inside"!==Nn?e:o.ZP.createElement(_a,{activeReactions:me,message:de,metaChildren:e,availableReactions:le,genericEffects:ae,observeIntersection:d})}const qn=K&&gt?t.postAuthorTitle:void 0,$n=(0,o.Ye)((()=>n?.find((e=>e.isActive))),[n]);return o.ZP.createElement("div",{ref:Be,id:(0,l.d0)(t.id),className:on,style:jn?`--meta-safe-author-width: ${jn}px`:void 0,"data-message-id":et,onMouseDown:Nt,onClick:At,onContextMenu:xt,onDoubleClick:Bt,onMouseEnter:vt?qt:void 0,onMouseMove:En?Ot:void 0,onMouseLeave:En||vt?Ut:void 0},o.ZP.createElement("div",{ref:Le,className:"bottom-marker","data-message-id":et,"data-last-message-id":u?u.messages[u.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ce||void 0}),!D&&o.ZP.createElement("div",{className:"message-select-control"},ie&&o.ZP.createElement("i",{className:"icon-select"})),b&&o.ZP.createElement("div",{className:(0,_e.Z)("message-select-control group-select",re&&"is-selected"),onClick:sn},re&&o.ZP.createElement("i",{className:"icon-select"})),f&&function(){const e=Rt&&(0,l.YC)(Rt.id),t=Rt&&e?Rt:void 0,n=Rt&&!e?Rt:void 0,s=!Rt&&nt?nt.hiddenUserName:void 0;return o.ZP.createElement(bs.Z,{size:"small",user:t,chat:n,text:s,lastSyncTime:Q,onClick:t||n?$t:void 0,observeIntersection:c,animationLevel:Ee,withVideo:!0})}(),o.ZP.createElement("div",{className:(0,_e.Z)("message-content-wrapper",Sn.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:Oe,className:Sn,style:xn,dir:"auto"},gt&&!It&&o.ZP.createElement("div",{className:"message-title"},Fe("ForwardedMessage"),qn&&o.ZP.createElement("span",{className:"admin-title",dir:"auto"},qn)),function(){const e=(0,_e.Z)("content-inner",gt&&"forwarded-message",bt&&"with-subheader",Bn&&"no-media-corners"),n=Z&&!Rn&&!gt&&!lt,s=(0,_e.Z)("text-content","in-text"===Tn&&"with-meta",U&&"with-outgoing-icon");return o.ZP.createElement("div",{className:e,onDoubleClick:Lt,dir:"auto"},function(){if(ut&&!at||!(I&&(!(cn||dn||yn)||Re)||gt||at||k)||It||dt&&ut)return;let e,n;!Tt||ut&&at?nt?.hiddenUserName&&(e=nt.hiddenUserName):(e=(0,l.OU)(Fe,Tt),gt||(n=`color-${(0,l.Rs)(Tt)}`));const s=Tt&&"emojiStatus"in Tt&&Tt.emojiStatus,i=Tt&&"isPremium"in Tt&&Tt.isPremium;return o.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?o.ZP.createElement("span",{className:(0,_e.Z)("message-title-name interactive",n),onClick:Gt,dir:"ltr"},(0,In.Z)(e),!gt&&s&&o.ZP.createElement(Hs.Z,{documentId:s.documentId,loopLimit:a.y3O,observeIntersectionForLoading:c,observeIntersectionForPlaying:d}),!gt&&!s&&i&&o.ZP.createElement(Wa.Z,null),Tt?.fakeType&&o.ZP.createElement(Xa.Z,{fakeType:Tt.fakeType})):x?void 0:" ",x&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},Fe("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:Ht},(0,In.Z)(`@${x.usernames[0].username}`))),nt?.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Fe("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&K&&gt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&K&&!gt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):Se&&!gt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Se.customTitle||Fe(Se.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")):void 0)}(),bt&&o.ZP.createElement("div",{className:"message-subheader"},Re&&o.ZP.createElement(to,{topic:Me,onClick:an,className:"message-topic"}),dt&&o.ZP.createElement(ks,{message:O,noUserColors:rt||Y,isProtected:q,sender:F,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,onClick:_t})),gn&&o.ZP.createElement(Os,{message:t,observeIntersection:c,observeIntersectionForPlaying:d,shouldLoop:ye,lastSyncTime:Q,shouldPlayEffect:gn.hasEffect&&(be.current&&et>=be.current||it)||void 0,onPlayEffect:qe,onStopEffect:$e}),mt&&se&&o.ZP.createElement(_s,{customEmojiId:se,withEffects:(0,l.YC)(tt),isOwn:rt,observeIntersection:c,lastSyncTime:Q,forceLoadPreview:it,messageId:et,chatId:tt,activeEmojiInteractions:he}),mt&&ne&&o.ZP.createElement(Gs,{emoji:ne,withEffects:(0,l.YC)(tt),isOwn:rt,observeIntersection:c,lastSyncTime:Q,forceLoadPreview:it,messageId:et,chatId:tt,activeEmojiInteractions:he}),pt&&o.ZP.createElement(Na,{album:u,albumLayout:Ln,observeIntersection:c,isOwn:rt,isProtected:q,hasCustomAppendix:n,lastSyncTime:Q,onMediaClick:Wt}),Cn&&o.ZP.createElement(Va,{message:t,phoneCall:Cn,chatId:tt}),!pt&&cn&&o.ZP.createElement(Qs,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:Ie,uploadProgress:j,shouldAffectAppendix:n,isDownloading:fe,isProtected:q,asForwarded:gt,theme:R,onClick:Vt,onCancelUpload:Kt}),!pt&&dn&&dn.isRound&&o.ZP.createElement(xa,{message:t,observeIntersection:c,canAutoLoad:Ie,lastSyncTime:Q,isDownloading:fe}),!pt&&dn&&!dn.isRound&&o.ZP.createElement(ta,{message:t,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,noAvatars:g,canAutoLoad:Ie,canAutoPlay:we,uploadProgress:j,lastSyncTime:Q,isDownloading:fe,isProtected:q,asForwarded:gt,onClick:Vt,onCancelUpload:Kt}),(ln||un)&&o.ZP.createElement(Ns.ZP,{theme:R,message:t,origin:m.Cr.Inline,uploadProgress:j,lastSyncTime:Q,isSelectable:D,isSelected:ie,noAvatars:g,onPlay:zt,onReadMedia:!un||rt&&!W?void 0:Yt,onCancelUpload:Kt,isDownloading:fe,isTranscribing:E,isTranscriptionHidden:Ue,isTranscribed:Boolean(S),isTranscriptionError:ot,canDownload:!q,onHideTranscription:je,canTranscribe:P}),hn&&o.ZP.createElement(Ts.Z,{message:t,observeIntersection:c,canAutoLoad:Ie,autoLoadFileMaxSizeMb:Pe,uploadProgress:j,isSelectable:D,isSelected:ie,onMediaClick:Vt,onCancelUpload:Kt,isDownloading:fe}),pn&&o.ZP.createElement(sa,{contact:pn}),fn&&o.ZP.createElement(ua,{message:t,poll:fn,onSendVote:Jt}),Zn&&o.ZP.createElement(Ma,{message:t,canAutoLoadMedia:Ie,lastSyncTime:Q}),wn?.extendedMedia&&o.ZP.createElement(va,{message:t,lastSyncTime:Q}),Mt&&o.ZP.createElement("p",{className:(0,_e.Z)("transcription",!Ue&&ot&&"transcription-error"),dir:"auto"},ot?Fe("NoWordsRecognized"):E&&S?o.ZP.createElement(za.Z,{content:S}):S),!mt&&Rn&&o.ZP.createElement("div",{className:s,dir:"auto"},o.ZP.createElement(Ya.Z,{message:t,emojiSize:kn,highlight:te,isProtected:q,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,withTranslucentThumbs:ut}),"in-text"===Tn&&Dn()),vn&&o.ZP.createElement(ga,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:Ie,canAutoPlay:we,asForwarded:gt,lastSyncTime:Q,isDownloading:fe,isProtected:q,theme:R,onMediaClick:Vt,onCancelMediaTransfer:Kt}),wn&&!wn.extendedMedia&&o.ZP.createElement(fa,{message:t,shouldAffectAppendix:n,isInSelectMode:oe,isSelected:ie,theme:R}),yn&&o.ZP.createElement(Sa,{message:t,lastSyncTime:Q,isInSelectMode:oe,isSelected:ie,theme:R,peer:T,serverTimeOffset:ee}))}(),!vt&&"standalone"===Tn&&Dn(),Pt&&Zt?o.ZP.createElement(kt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Fe("lng_context_forward_msg"),onClick:b?Qt:en},o.ZP.createElement("i",{className:"icon-share-filled"})):Pt&&Ct?o.ZP.createElement(kt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:pe?tn:nn},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,bn&&o.ZP.createElement(Oa,{threadInfo:Ze,disabled:v}),Mn&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:rt?no:so}),En&&o.ZP.createElement("div",{className:(0,_e.Z)("quick-reaction",Dt&&!me&&"visible"),onClick:Ft},o.ZP.createElement(Ua.Z,{reaction:ue,size:ao,availableReactions:le,observeIntersection:d}))),t.inlineButtons&&o.ZP.createElement(Ba,{message:t,onClick:Te}),"outside"===Nn&&o.ZP.createElement(_a,{message:de,isOutside:!0,activeReactions:me,availableReactions:le,genericEffects:ae,observeIntersection:d})),He&&o.ZP.createElement(Ss,{isOpen:Ge,anchor:He,message:t,album:u,chatUsername:$n?.username,messageListType:ge,onClose:We,onCloseAnimationEnd:Xe}))}))),io=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"AboutAdsModal",!t);return n?o.ZP.createElement(n,e):void 0})),ro=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),co=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.fS)(e,n),{chatId:a,isBot:o}=s||{};return{message:s,bot:a&&o?(0,c.dy)(e,a):void 0,channel:!o&&a?(0,c.Z1)(e,a):void 0}}))((e=>{let{chatId:t,message:n,containerRef:a,bot:i,channel:r}=e;const{viewSponsoredMessage:c,openChat:d,openChatByInvite:u,startBot:m,focusMessage:g}=(0,s.Sv)(),p=(0,wt.Z)(),f=(0,o.sO)(null),I=(0,o.sO)(null),v=Boolean(n),{observe:w}=(0,ns.S1)({rootRef:a,debounceMs:200,threshold:1}),{isContextMenuOpen:y,contextMenuPosition:P,handleBeforeContextMenu:Z,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:E}=(0,Un.Z)(f,h.$b,!0,h.wZ),[S,M,R]=(0,ft.Z)(!1);(0,o.d4)((()=>v?w(I.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,v,w,c]);const k=(0,o.I4)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?g({chatId:n.chatId,messageId:n.channelPostId}):(d({id:n.chatId}),n.startParam&&m({botId:n.chatId,param:n.startParam})))}),[g,n,d,u,m]);if(n)return o.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Xn.q)(e),Z(e)},onContextMenu:C},o.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},o.ZP.createElement("div",{className:"content-inner",dir:"auto"},o.ZP.createElement("div",{className:"message-title",dir:"ltr"},i&&(0,In.Z)((0,l.Js)(i)||""),r&&(0,In.Z)(n.chatInviteTitle||(0,l.U)(p,r,i)||"")),o.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:I},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,aa.H)(n.text.text,n.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},n.isRecommended?p("Message.RecommendedLabel"):p("SponsoredMessage")))),o.ZP.createElement(kt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),P&&o.ZP.createElement(ro,{isOpen:y,anchor:P,message:n,onAboutAds:M,onClose:b,onCloseAnimationEnd:E}),o.ZP.createElement(io,{isOpen:S,onClose:R}))}))),lo=(0,o.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,threadId:r,messageIds:c,messageGroups:d,isViewportNewest:u,isUnread:p,withUsers:f,noAvatars:I,containerRef:v,anchorIdRef:w,memoUnreadDividerBeforeIdRef:y,memoFirstUnreadIdRef:P,type:Z,isReady:C,isScrollingRef:b,isScrollPatchNeededRef:E,threadTopMessageId:S,hasLinkedChat:M,isSchedule:R,noAppearanceAnimation:k,onFabToggle:N,onNotchToggle:A}=e;const{openHistoryCalendar:x}=(0,s.Sv)(),{observeIntersectionForReading:B,observeIntersectionForLoading:L,observeIntersectionForPlaying:O}=function(e,t,n){const{markMessageListRead:a,markMentionsRead:o,animateUnreadReaction:i}=(0,s.Sv)(),{observe:r,freeze:c,unfreeze:d}=(0,ns.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let s=0;const r=[],c=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:a}=n,o=Number(a.lastMessageId||a.messageId);o>s&&(s=o),a.hasUnreadMention&&r.push(o),a.hasUnreadReaction&&c.push(o)})),n.current&&s>=n.current&&a({maxId:s}),r.length&&o({messageIds:r}),c.length&&i({messageIds:c})}));(0,Xe.Z)(c,d);const{observe:l}=(0,ns.S1)({rootRef:t,throttleMs:ss,margin:as}),{observe:u}=(0,ns.S1)({rootRef:t,throttleMs:ss});return{observeIntersectionForReading:r,observeIntersectionForLoading:l,observeIntersectionForPlaying:u}}(Z,v,P),{backwardsTriggerRef:F,forwardsTriggerRef:U,fabTriggerRef:j}=function(e,t,n,i,r,c,d,l,u,g){const{loadViewportMessages:p}=(0,s.Sv)(),[f,I]=(0,o.Ye)((()=>"thread"===e?[(0,T.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,T.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,n]),v=(0,o.sO)(null),w=(0,o.sO)(null),y=(0,o.sO)(null);function P(){if(!l)return;if(!n||!n.length)return c(!1),void d(!1);if(!i)return c(!0),void d(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:s,scrollTop:a}=t.current,o=Math.round(s-a-e),u=o<=1;c(r?!u:!(o<=50)),d(!u)}const{observe:Z}=(0,ns.S1)({rootRef:t,margin:h.gZ},(e=>{if(!I||!f)return;if(n[0]>a.MPN)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:s}=t;"backwards-trigger"===s.className?(h.i4&&u.current&&n.length<=a.hT6&&(g.current=!0),f()):"forwards-trigger"===s.className&&I()}));(0,ns._N)(v,Z),(0,ns._N)(w,Z);const{observe:C,freeze:b,unfreeze:E}=(0,ns.S1)({rootRef:t,margin:100},P);(0,ns._N)(y,C);const{observe:S,freeze:M,unfreeze:R}=(0,ns.S1)({rootRef:t,margin:1},P);return(0,ns._N)(y,S),(0,Ke.Z)((()=>{l&&P()}),[l]),(0,Ke.Z)((()=>{b(),M(),setTimeout((()=>{R(),E()}),250)}),[n]),{backwardsTriggerRef:v,forwardsTriggerRef:w,fabTriggerRef:y}}(Z,v,c,u,p,N,A,C,b,E),D=(0,wt.Z)(),q=o.ZP.createElement("div",{className:(0,_e.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,D("UnreadMessages"))),$=k?0:d.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let G=0;const H=d.map(((e,t,n)=>{const s=e.senderGroups.map(((e,s,a)=>{if(1===e.length&&!zn(e[0])&&(0,l.FT)(e[0])&&!e[0].content.action?.phoneCall){const c=e[0],d=s===a.length-1&&t===n.length-1;return(0,g.oA)([c.id===y.current&&q,o.ZP.createElement(Rs,{key:c.id,message:c,isInsideTopic:Boolean(r&&r!==i._f),observeIntersectionForReading:B,observeIntersectionForLoading:L,observeIntersectionForPlaying:O,memoFirstUnreadIdRef:P,appearanceOrder:$-++G,isLastInList:d})])}let c;return e.map(((i,d)=>{const u=zn(i)?i.mainMessage:i,m=zn(i)?i:void 0,h=(0,l.B4)(u),p=zn(i),v=e[d+1];u.previousLocalId&&w.current===(0,l.d0)(u.previousLocalId)&&(w.current=(0,l.d0)(u.id));const C=!p&&u.groupedId?u.groupedId:void 0,b=v&&!zn(v)?v.groupedId:void 0,E={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(C&&C!==c),isLastInDocumentGroup:Boolean(C&&C!==b),isLastInList:d===e.length-1&&s===a.length-1&&t===n.length-1};c=C;const R=(0,l.KK)(u),k=(0,l.jM)(u)?`${u.date}_${R}`:R;return(0,g.oA)([u.id===y.current&&q,o.ZP.createElement(oo,{key:k,message:u,observeIntersectionForBottom:B,observeIntersectionForLoading:L,observeIntersectionForPlaying:O,album:m,noAvatars:I,withAvatar:E.isLastInGroup&&f&&!h&&!(u.id===S),withSenderName:E.isFirstInGroup&&f&&!h,threadId:r,messageListType:Z,noComments:!1===M,appearanceOrder:$-++G,isFirstInGroup:E.isFirstInGroup,isLastInGroup:E.isLastInGroup,isFirstInDocumentGroup:E.isFirstInDocumentGroup,isLastInDocumentGroup:E.isLastInDocumentGroup,isLastInList:E.isLastInList,memoFirstUnreadIdRef:P}),u.id===S&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,D("DiscussionStarted")))])})).flat()}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Xn.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,_e.Z)("sticky-date",!R&&"interactive"),key:"date-header",onMouseDown:Xn.q,onClick:R?void 0:()=>x({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===a.t4X&&D("MessageScheduledUntilOnline"),R&&e.originalDate!==a.t4X&&D("MessageScheduledOn",(0,z.j1)(D,e.datetime,void 0,!0)),!R&&(0,z.j1)(D,e.datetime))),s.flat())}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:F,key:"backwards-trigger",className:"backwards-trigger"}),H.flat(),!t&&u&&o.ZP.createElement(co,{key:n,chatId:n,containerRef:v}),o.ZP.createElement("div",{ref:U,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:j,key:"fab-trigger",className:"fab-trigger"}))}));var uo=n(73547);const mo=(0,o.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;const{stickers:s}=e.stickers.greeting,a=(0,l.db)(n)+(0,l.db)(e.currentUserId),o=s?.length?s[a%s.length]:void 0,i=(0,c.Z1)(e,n);return i?{sticker:o,lastUnreadMessageId:i.lastMessage&&i.lastMessage.id!==i.lastReadInboxMessageId?i.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:a}=e;const{loadGreetingStickers:i,sendMessage:r,markMessageListRead:c}=(0,s.Sv)(),d=(0,wt.Z)(),l=(0,o.sO)(null),{observe:u}=(0,ns.S1)({rootRef:l,debounceMs:200});(0,o.d4)((()=>{t||"connectionStateReady"!==n||i()}),[n,i,t]),(0,o.d4)((()=>{"connectionStateReady"===n&&a&&c({maxId:a})}),[n,c,a]);const m=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:l},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},d("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},d("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},t&&o.ZP.createElement(uo.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),ho=3*ve.Gw,go=(0,o.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:s,topic:a}=e;const i=(0,wt.Z)();return"scheduled"===n?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(i):t?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("i",{className:"icon icon-cloud-download"}),o.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),o.ZP.createElement("ul",{className:"description"},o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(i):s?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},o.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),o.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),o.ZP.createElement("ul",{className:"list-checkmarks"},o.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(i):a?function(e,t){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement(Ja.Z,{topic:t,size:ho,className:"icon topic-icon"}),o.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),o.ZP.createElement("p",{className:"description topic-description"},(0,In.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(i,a):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,i("NoMessages")))})),po=(0,T.Ds)((e=>e()),200,!1),fo=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,type:a}=t;const o=(0,c.Z1)(e,n);if(!o)return{};const r=(0,c.$W)(e,n,s,a),d="scheduled"===a?(0,c.yB)(e,n):(0,c.Zw)(e,n),u=(0,c.qS)(e,n,s);if(!(s===i._f||o?.isForum||d&&u&&d[u]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=o,p=(0,c.G$)(e,n),f=s===i._f&&!r&&!o.unreadCount&&!p&&g&&!g.groupedId,I=(0,c.IK)(e,n);let v,w=!1;(0,c.pk)(e,n)&&(I.fullInfo?v=I.fullInfo.botInfo:w=!0);const y=o.topics?.[s];return{isCurrentUserPremium:(0,c.wV)(e),isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,l.eA)(o),isGroupChat:(0,l.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,c.FM)(e,n),isRepliesChat:(0,l.pK)(n),isBot:Boolean(I),messageIds:r,messagesById:d,firstUnreadId:(0,c.It)(e,n,s),isViewportNewest:"thread"!==a||(0,c.b9)(e,n,s),threadFirstMessageId:(0,c.yZ)(e,n,s),focusingId:p,isSelectModeActive:(0,c.CA)(e),isLoadingBotInfo:w,botInfo:v,threadTopMessageId:u,hasLinkedChat:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,topic:y,...f&&{lastMessage:g}}}))((e=>{let{chatId:t,threadId:n,type:i,hasTools:r,onFabToggle:d,onNotchToggle:u,isCurrentUserPremium:p,isChatLoaded:f,isChannelChat:I,isGroupChat:v,canPost:w,isReady:y,isChatWithSelf:P,isRepliesChat:Z,isCreator:C,isBot:b,messageIds:E,messagesById:S,firstUnreadId:M,isViewportNewest:R,threadFirstMessageId:k,isRestricted:N,restrictionReason:A,focusingId:x,isSelectModeActive:B,lastMessage:L,isLoadingBotInfo:O,botInfo:F,threadTopMessageId:U,hasLinkedChat:j,lastSyncTime:D,withBottomShift:q,withDefaultBg:$,topic:G}=e;const{loadViewportMessages:H,setScrollOffset:_,loadSponsoredMessages:V,loadMessageReactions:z,copyMessagesByIds:W}=(0,s.Sv)(),X=(0,o.sO)(null),Y=(0,o.sO)("thread"===i&&(0,c.Vt)((0,s.Rd)(),t,n)||0),K=(0,o.sO)(),J=(0,o.sO)(),Q=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(),se=(0,o.sO)(!1),ae=(0,o.sO)(Boolean(L)),[oe,ie]=(0,o.eJ)(),re=(0,vn.Z)(F?.photo?(0,l.NF)(F.photo):void 0),ce=(0,vn.Z)(F?.gif?(0,l.ym)(F.gif):void 0),de=F?.photo?(0,l.bV)(F.photo):F?.gif?(0,l.jC)(F.gif):void 0,le=de&&{width:de.width/h.cL,height:de.height/h.cL},ue=Boolean(E);(0,Ke.Z)((()=>{ue&&(0,T.R3)((()=>{ae.current=!1}))}),[ue]),(0,Ke.Z)((()=>{ee.current=M}),[M]),(0,Ke.Z)((()=>{!p&&I&&y&&D&&V({chatId:t})}),[p,t,y,I,D]),(0,Ke.Z)((()=>{ue&&(te.current=ee.current)}),[ue]),(0,Ke.Z)((()=>{ne.current=x}),[x]),(e=>{(0,It.y)({"Mod+C":function(t){const n=(0,Qn.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(W);const me=(0,o.Ye)((()=>{if(!E||!S)return;const e=!U||k===U||E[0]&&k!==E[0]?E:[U,...E];if(!e.length)return;const t=e.map((e=>S[e])).filter(Boolean);return Wn((0,g.Xo)(t,["date","id"]),te.current)}),[E,S,k,U]);(0,ot.Z)((()=>{if(!E||!S)return;const e=E.filter((e=>S[e]?.reactions));e.length&&z({chatId:t,ids:e})}),15e3);const he=(0,o.Ye)((()=>{if("thread"===i)return(0,T.Ds)((()=>H({direction:m.Uq.Around})),1e3,!0,!1)}),[H,E]),{isScrolled:ge,updateStickyDates:pe}=function(){const[e,t]=(0,ft.Z)(!1),n=(0,Jn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,T.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,T.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:a}=e,o=n-s;return-a<=o&&o<=(t?60:10)}))}(e,s);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),fe=(0,o.sO)(),Ie=(0,o.sO)(),ve=(0,o.I4)((()=>{if(se.current)return void(se.current=!1);const e=X.current;e&&(fe.current=!0,ne.current||pe(e,r),po((()=>{fe.current=!1,(0,T.T2)((()=>{e.parentElement&&(Y.current=e.scrollHeight-e.scrollTop,"thread"===i&&_({chatId:t,threadId:n,scrollOffset:Y.current}))}))})))}),[pe,r,i,_,t,n]),we=(0,o.I4)((e=>{ie(e.contentRect.height)}),[]);(0,ts.y)(X,we);const{height:ye}=(0,cn.Z)();(0,o.d4)((()=>{X.current.dataset.normalHeight=String(X.current.offsetHeight)}),[ye,w]),(0,o.d4)((()=>{if(!he||!f||N||x)return;if(E&&E[E.length-1]>a.MPN)return;const e=X.current;(!E||E.length<a.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&he()}),[f,E,he,x,N]),(0,Ke.Z)((()=>{if(!E||!Q.current)return;const e=Q.current.filter((e=>E.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(K.current=t.id,J.current=t.getBoundingClientRect().top)}),[E,R,oe,r]),(0,es.Z)((e=>{let[t,n,s]=e;const o=X.current;Q.current=Array.from(o.querySelectorAll(".message-list-item"));const i=E&&t&&E[E.length-1]!==t[t.length-1],c=E?.[0]!==t?.[0]&&E?.length===a.hT6/2+1,d=i&&!c,l=E&&ne.current===E[E.length-1],u=R&&d&&E&&E.length<a.hT6/2&&!o.parentElement.classList.contains("force-messages-scroll")&&o.firstElementChild.clientHeight<=2*o.offsetHeight;u&&(o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&o.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:m,scrollHeight:h,offsetHeight:g}=o,p=Y.current,f=Q.current[Q.current.length-1];let I=p-(s||g);d&&(I-=f?f.offsetHeight:0);const v=R&&n&&I<=50;let w;if(d&&v&&!l&&(f&&(0,T.T2)((()=>{(0,Kn.Z)(o,f,"end",20)})),w=h-g,Y.current=Math.max(Math.ceil(h-w),g),!u))return;const y=void 0!==s&&s!==oe,P=K.current&&o.querySelector(`#${K.current}`),Z=!P&&te.current&&o.querySelector(".unread-divider");if(v&&y){if((0,Kn.N)())return;w=h-g}else P?(Ie.current&&(Ie.current=!1,(0,Yn.z)(o)),w=m+(P.getBoundingClientRect().top-(J.current||0))):w=Z?Math.min(Z.offsetTop-(r?60:10),h-p):h-p;(0,Yn.Z)(o,Math.ceil(w)),ne.current||(se.current=!0,(0,T.T2)((()=>{se.current=!1}))),Y.current=Math.max(Math.ceil(h-w),g)}),[E,R,oe,r]),(0,We.Z)((e=>{let[t]=e;void 0!==t&&(0,at.YW)(200+a.fK3)}),[B]);const Pe=(0,wt.Z)(),Ze=Boolean(t&&(0,l.YC)(t)),Ce=Boolean(!Ze&&!I||P||Z),be=Boolean(!Ce||I),Ee=(0,l.YC)(t)&&!P&&!b&&(!me&&!L&&E&&(!Q.current||0===Q.current.length)||1===E?.length&&"contactSignUp"===S?.[E[0]]?.content.action?.type||"contactSignUp"===L?.content?.action?.type),Se=v&&C&&1===E?.length&&"chatCreate"===S?.[E[0]]?.content.action?.type,Me=1===E?.length&&"topicCreate"===S?.[E[0]]?.content.action?.type,Re=(0,_e.Z)("MessageList custom-scroll",be&&"no-avatars",!w&&"no-composer","pinned"===i&&"type-pinned",q&&"with-bottom-shift",$&&"with-default-bg",B&&"select-mode-active",ge&&"scrolled",!y&&"is-animating");return o.ZP.createElement("div",{ref:X,className:Re,onScroll:ve,onMouseDown:Xn.q},N?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,A?A.text:"This is a private "+(I?"channel":"chat"))):F?o.ZP.createElement("div",{className:"empty"},O&&o.ZP.createElement("span",null,Pe("Loading")),!F&&!O&&o.ZP.createElement("span",null,Pe("NoMessages")),F&&o.ZP.createElement("div",{className:"bot-info",style:le&&`width: ${le.width}px`},re&&o.ZP.createElement("img",{src:re,width:le?.width,height:le?.height,alt:"Bot info"}),ce&&o.ZP.createElement(ea.Z,{canPlay:!0,src:ce,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),de&&!re&&!ce&&o.ZP.createElement(pa.Z,{width:le?.width,height:le?.height}),F.description&&o.ZP.createElement("div",{className:"bot-info-description"},o.ZP.createElement("p",{className:"bot-info-title"},Pe("BotInfoTitle")),(0,In.Z)(F.description,["br","emoji","links"])))):Ee?o.ZP.createElement(mo,{userId:t}):E&&(!me||Se||Me)?o.ZP.createElement(go,{chatId:t,topic:G,type:i,isChatWithSelf:P,isGroupChatJustCreated:Se}):E&&me||L?o.ZP.createElement(lo,{isCurrentUserPremium:p,chatId:t,messageIds:E||[L.id],messageGroups:me||Wn([L]),isViewportNewest:Boolean(R),isUnread:Boolean(M),withUsers:Ce,noAvatars:be,containerRef:X,anchorIdRef:K,memoUnreadDividerBeforeIdRef:te,memoFirstUnreadIdRef:ee,threadId:n,type:i,isReady:y,isScrollingRef:fe,isScrollPatchNeededRef:Ie,threadTopMessageId:U,hasLinkedChat:j,isSchedule:!!me&&"scheduled"===i,noAppearanceAnimation:!me||!ae.current,onFabToggle:d,onNotchToggle:u}):o.ZP.createElement(Gt.Z,{color:"white",backgroundColor:"dark"}))}))),Io=(0,o.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:s,onClick:a,onReadAll:i,className:r}=e;const c=(0,wt.Z)(),d=(0,o.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,Un.Z)(d,!i);return o.ZP.createElement("div",{className:(0,_e.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},o.ZP.createElement(kt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:a,onContextMenu:u,ariaLabel:c(n)},o.ZP.createElement("i",{className:(0,_e.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(s)&&o.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,lt.bi)(s)),i&&o.ZP.createElement(Vt.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},o.ZP.createElement(Rt.Z,{icon:"readchats",onClick:i},c("MarkAllAsRead"))))})),vo=(0,o.X$)((0,s.c$)((e=>{const t=(0,c.Bt)(e);if(!t)return{};const{chatId:n,threadId:s,type:a}=t,o=(0,c.Z1)(e,n),r=o&&s===i._f&&"thread"===a;return{messageListType:a,chatId:n,reactionsCount:r?o.unreadReactionsCount:void 0,mentionsCount:r?o.unreadMentionsCount:void 0,unreadCount:r?o.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:a,chatId:i,unreadCount:r,reactionsCount:c,mentionsCount:d,withExtraShift:l}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:I}=(0,s.Sv)(),v=(0,o.sO)(null),w=Boolean(c),y=Boolean(d);(0,o.d4)((()=>{w&&i&&g({chatId:i})}),[i,g,w]),(0,o.d4)((()=>{y&&i&&I({chatId:i})}),[i,I,y]);const P=(0,o.I4)((()=>{if(t)if("thread"===a)u();else{const e=v.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Kn.Z)(e,n,"end",20)}}),[t,a,u]),Z=(0,_e.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(d))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(d))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!l&&"S98OqutuQVCNVHgTrKv4");return o.ZP.createElement("div",{ref:v,className:Z},w&&o.ZP.createElement(Io,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),y&&o.ZP.createElement(Io,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d}),o.ZP.createElement(Io,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:P,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var wo=n(65723);const yo=1280,Po=/\.[^/.]+$/;async function Zo(e,t,s,o){const i=URL.createObjectURL(t),{type:r,size:c}=t;let d,l,u;if(a.oGt.has(r))if(s){const t=await(0,rn.pt)(i),{width:n,height:s}=t,a=n>yo||s>yo;if(a||"image/jpeg"!==r){const t=await Nn(i,a?yo/Math.max(n,s):1,"image/jpeg");return URL.revokeObjectURL(i),Zo(e,await(0,rn.gm)(t),!0,o)}"image/jpeg"===r&&(e=e.replace(Po,".jpg")),d={width:n,height:s}}else u=i;else if(a.wGh.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,rn.jj)(i);d={width:e,height:t,duration:n},u=await(0,rn.ud)(i)}else if(a.e74.has(r)){const{duration:e,title:t,performer:s,coverUrl:a}=await async function(e){const{fetchFromUrl:t,selectCover:s}=await n.e(8505).then(n.t.bind(n,38505,23)),a=await t(e),{common:{title:o,artist:i,picture:r},format:{duration:c}}=a,d=s(r);return{title:o,performer:i,duration:c,coverUrl:d?`data:${d.format};base64,${d.data.toString("base64")}`:void 0}}(i);l={duration:e||0,title:t,performer:s},u=a}return{blobUrl:i,filename:e,mimeType:r,size:c,quick:d,audio:l,previewBlobUrl:u,...o}}var Co=n(41098),bo=n(96391);let Eo;function So(e){Eo.focus(),e.focus()}h.cj&&(Eo=document.createElement("input"),Eo.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Eo));var Mo=n(74288),Ro=n(94462),ko=n(52400);const To=new RegExp(`^${a.t8f.source}$`,"g");var No=n(56389),Ao=n(70971);const xo={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},Bo={type:"audio/ogg"};let Lo,Oo,Fo;async function Uo(){return Lo||(Lo=n.e(1161).then(n.t.bind(n,1161,23)),Oo=(await Lo).default,Fo=new Oo(xo)),Lo}async function jo(e){await async function(){await Uo(),await Fo.start()}();const t=Date.now();let n;const s=[],a=[];Fo.ondataavailable=e=>{s.push(e)};const o=function(t,n){const s=t.sourceNode,o=s.context.createAnalyser();o.fftSize=64,s.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{a.push(255*t),e(t)})(n<.1?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(Fo);return{stop:()=>new Promise(((e,i)=>{Fo.onstop=()=>{e({blob:new Blob(s,Bo),duration:Math.round(((n||Date.now())-t)/1e3),waveform:a})},Fo.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Fo.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Fo.pause(),n=Date.now(),o()}),e)}}}var Do=n(21262),qo=n(56266);const $o=["image/png","image/jpeg","image/gif"],Go=/<style>(.*?)<\/style>/gs;let Ho,_o;var Vo=n(72162),zo=n(29295);function Wo(e,t,n){const[s,a]=(0,o.eJ)(),{isFrozen:i,updateWhenUnfrozen:r}=function(){const e=(0,o.sO)(!1),t=(0,o.I4)((()=>{e.current=!0}),[]),n=(0,nt.Z)(),s=(0,o.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,at.ZP)(Xo,s),{isFrozen:(0,at.zG)(),updateWhenUnfrozen:t}}(),c=(0,Jn.Z)(t,!0);return(0,Ke.Z)((()=>{i?r():c((()=>{a(e())}))}),[...n,i]),s}function Xo(){}const Yo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Ko=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,Jo={username:"",query:"",canShowHelp:!1,usernameLowered:""},Qo=document.createElement("div");const ei=(0,T.P2)((e=>e()),500,!0),ti=/^[\w@]{1,32}\s?/i;var ni=n(33057),si=n(60130);const ai=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function oi(){return oi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},oi.apply(this,arguments)}let ii,ri=!0;const ci=(0,o.X$)((e=>{let{onActivate:t,...n}=e;const s=(0,o.sO)(!1),a=(0,o.I4)((()=>{if(s.current=!0,ri)return ri=!1,void t();ii&&(clearTimeout(ii),ii=void 0),ii=window.setTimeout((()=>{s.current&&t()}),200)}),[t]),i=(0,o.I4)((()=>{s.current=!1}),[]),r=(0,o.I4)((()=>{s.current=!0,t()}),[t]);return o.ZP.createElement(kt.Z,oi({},n,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:i,onClick:h.$b?r:t}))}));var di=n(85655),li=n(56503),ui=n(62898);const mi="N3E1geoPu1vesCKf545F",hi=/#fff/gi,gi=(0,o.X$)((e=>{let{icon:t,theme:n}=e;const s=(0,vn.Z)((0,l.ym)(t),!1,i.IU.Text),a=(0,o.Ye)((()=>{if(!s)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=s.replace(hi,e),a=(new DOMParser).parseFromString(t,"image/svg+xml");return a.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${a.documentElement.outerHTML}`}),[s,n]);return o.ZP.createElement("i",{className:(0,_e.Z)("vL8HfVVnjTeFmp1ECFj8",h.FW&&mi)},o.ZP.createElement("img",{src:a,alt:"",className:(0,_e.Z)("Fb4aIyDYEwOlaqY8oZkV",h.FW&&mi)}))})),pi=(0,o.X$)((e=>{let{bot:t,theme:n,chatId:a,threadId:i,onMenuOpened:r,onMenuClosed:c}=e;const{callAttachBot:d,toggleAttachBot:l}=(0,s.Sv)(),u=(0,wt.Z)(),m=(0,o.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,ft.Z)(),[f,I]=(0,o.eJ)(void 0),v=(0,o.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()}),[r,g]),w=(0,o.I4)((()=>{p(),c()}),[p,c]),y=(0,o.I4)((()=>{I(void 0)}),[]),P=(0,o.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return o.ZP.createElement(Rt.Z,{key:t.id,customIcon:m&&o.ZP.createElement(gi,{icon:m,theme:n}),icon:m?void 0:"bots",onClick:()=>d({botId:t.id,chatId:a,threadId:i}),onContextMenu:v},t.shortName,f&&o.ZP.createElement(ui.Z,null,o.ZP.createElement(Vt.Z,{isOpen:h,positionX:"right",style:`left: ${f.x}px;top: ${f.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:w,onCloseAnimationEnd:y},o.ZP.createElement(Rt.Z,{icon:"stop",destructive:!0,onClick:P},u("WebApp.RemoveBot")))))})),fi=(0,o.X$)((e=>{let{chatId:t,threadId:n,isButtonVisible:s,canAttachMedia:i,canAttachPolls:r,attachBots:c,peerType:d,isScheduled:l,onFileSelect:u,onPollCreate:m,theme:g}=e;const[p,f,I]=(0,ft.Z)(),[v,w,y]=(0,li.Z)(p,I),[P,Z,C]=(0,ft.Z)();(0,o.d4)((()=>{p&&y()}),[p,y]);const b=(0,o.I4)((()=>{p?I():f()}),[p,f,I]),E=(0,o.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&u(Array.from(n),t)}),[u]),S=(0,o.I4)((()=>{(0,di.g)(Array.from(a.dII).join(","),(e=>E(e,!0)))}),[E]),M=(0,o.I4)((()=>{(0,di.g)("*",(e=>E(e,!1)))}),[E]),R=(0,o.Ye)((()=>Object.values(c).filter((e=>!!d&&(!("bots"!==d||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(d))))),[c,t,d]),k=(0,wt.Z)();if(s)return o.ZP.createElement("div",{className:"AttachMenu"},o.ZP.createElement(ci,{id:"attach-menu-button",className:p?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:b,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},o.ZP.createElement("i",{className:"icon-attach"})),o.ZP.createElement(Vt.Z,{id:"attach-menu-controls",isOpen:p||P,autoClose:!0,positionX:"right",positionY:"bottom",onClose:I,className:"AttachMenu--menu fluid",onCloseAnimationEnd:I,onMouseEnter:h.$b?void 0:v,onMouseLeave:h.$b?void 0:w,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!i&&o.ZP.createElement(Rt.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),i&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Rt.Z,{icon:"photo",onClick:S},k("AttachmentMenu.PhotoOrVideo")),o.ZP.createElement(Rt.Z,{icon:"document",onClick:M},k("AttachDocument"))),r&&o.ZP.createElement(Rt.Z,{icon:"poll",onClick:m},k("Poll")),i&&!l&&R.map((e=>o.ZP.createElement(pi,{bot:e,chatId:t,threadId:n,theme:g,onMenuOpened:Z,onMenuClosed:C})))))})),Ii=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),vi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),wi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var yi=n(67146);const Pi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Zi=n(93219),Ci=n(19830);const bi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Ei=(0,o.X$)((0,s.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:s}=(0,c.Bt)(e)||{};return s?{message:(0,c.hj)(e,s,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:a}=e;const{clickBotInlineButton:i}=(0,s.Sv)(),[r,c]=(0,li.Z)(t,a),{isKeyboardSingleUse:d}=n||{};if(n&&n.keyboardButtons)return o.ZP.createElement(Vt.Z,{isOpen:t,autoClose:d,positionX:"right",positionY:"bottom",onClose:a,className:"BotKeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:h.$b?void 0:r,onMouseLeave:h.$b?void 0:c,noCompact:!0},o.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(kt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>i({messageId:n.id,button:e})},e.text))))))))})));var Si=n(49841),Mi=n(17891),Ri=n(63394),ki=n(66902);const Ti=(0,o.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,type:s}=(0,c.Bt)(e)||{};if(!t||!n||!s)return{};const{forwardMessages:{fromChatId:a,toChatId:o,messageIds:i,noAuthors:r,noCaptions:d}}=e,u=(0,c.Yy)(e,t,n),m="scheduled"===s?(0,c.wU)(e,t):(0,c._$)(e,t,n),h=e.settings.byKey.animationLevel>=1,g=o===t,p=i?.map((t=>(0,c.hj)(e,a,t)));let f,I;if(u?f=(0,c.hj)(e,t,u):m?f=(0,c.kK)(e,t,n,s):g&&1===i.length&&(f=p?.[0]),u&&f){const{forwardInfo:n}=f,s=(0,c.FM)(e,t);n&&(n.isChannelPost||s)&&(I=(0,c.cv)(e,f)),I||n?.hiddenUserName||(I=(0,c.Ur)(e,f))}else g&&(f&&(I=(0,c.cv)(e,f),I||(I=(0,c.Ur)(e,f))),I||(I=(0,l.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a)));const v=p?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:u,editingId:m,message:f,sender:I,shouldAnimate:h,forwardedMessagesCount:g?i.length:void 0,noAuthors:r,noCaptions:d,forwardsHaveCaptions:v,isCurrentUserPremium:(0,c.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:a,sender:i,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:u,forwardsHaveCaptions:m,isCurrentUserPremium:h,onClear:g}=e;const{setReplyingToId:p,setEditingId:f,focusMessage:I,changeForwardRecipient:v,setForwardNoAuthors:w,setForwardNoCaptions:y,exitForwardMode:P}=(0,s.Sv)(),Z=(0,o.sO)(null),C=(0,wt.Z)(),b=Boolean(c),E=Boolean((t||n)&&a||i&&c),S=(0,Mi.Z)([c],c?300:void 0),{shouldRender:M,transitionClassNames:R}=(0,st.Z)(S&&E,void 0,!r,void 0,!r),k=(0,o.I4)((()=>{t?p({messageId:void 0}):n?f({messageId:void 0}):c&&P(),g?.()}),[t,n,c,g,p,f,P]);(0,o.d4)((()=>E?(0,gt.Z)(k):void 0),[E,k]);const T=(0,o.I4)((()=>{b||I({chatId:a.chatId,messageId:a.id})}),[I,b,a]),N=(0,o.I4)((e=>{e.stopPropagation(),k()}),[k]),A=(0,o.I4)((()=>{v()}),[v]),{isContextMenuOpen:x,contextMenuPosition:B,handleContextMenu:L,handleContextMenuClose:O,handleContextMenuHide:F}=(0,Un.Z)(Z),U=(0,o.I4)((()=>Z.current),[]),j=(0,o.I4)((()=>Z.current),[]),D=(0,o.I4)((()=>Z.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:q,positionY:$,transformOriginX:G,transformOriginY:H,style:_}=(0,Ri.Z)(B,U,j,D),V=(0,_e.Z)("ComposerEmbeddedMessage",R),z=(0,o.Ye)((()=>t?"icon-reply":n?"icon-edit":b?"icon-forward":void 0),[n,b,t]),W=c&&c>1?C("ForwardedMessageCount",c):void 0,X=(0,o.Ye)((()=>{if(!a||!b||!a.content.text||!d||h)return a;const e=(0,l.If)(a.content.text);return{...a,content:{...a.content,text:e}}}),[h,b,a,d]);if(M)return o.ZP.createElement("div",{className:V,ref:Z,onContextMenu:L,onClick:L},o.ZP.createElement("div",null,o.ZP.createElement("div",{className:"embedded-left-icon"},o.ZP.createElement("i",{className:z})),o.ZP.createElement(ks,{className:"inside-input",message:X,sender:d?void 0:i,customText:W,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:T,hasContextMenu:b}),o.ZP.createElement(kt.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:N},o.ZP.createElement("i",{className:"icon-close"})),b&&o.ZP.createElement(Vt.Z,{isOpen:x,transformOriginX:G,transformOriginY:H,positionX:q,positionY:$,style:_,className:"forward-context-menu",onClose:O,onCloseAnimationEnd:F},o.ZP.createElement(Rt.Z,{icon:d?void 0:"message-succeeded",customIcon:d?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>w(!1)},C(c>1?"ShowSenderNames":"ShowSendersName")),o.ZP.createElement(Rt.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:o.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>w(!0)},C(c>1?"HideSenderNames":"HideSendersName")),m&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(ki.Z,null),o.ZP.createElement(Rt.Z,{icon:u?void 0:"message-succeeded",customIcon:u?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>y(!1)},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),o.ZP.createElement(Rt.Z,{icon:u?"message-succeeded":void 0,customIcon:u?void 0:o.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>y(!0)},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),o.ZP.createElement(ki.Z,null),o.ZP.createElement(Rt.Z,{icon:"replace",onClick:A},C("ChangeRecipient")))))}))),Ni=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,ct.Z)(rt.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),Ai=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),xi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),Bi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),Li=new RegExp(a.FM6,"i"),Oi=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s}=t;const a=(0,c.tV)(e,n,s);return{theme:(0,c.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:a}}))((e=>{let{chatId:t,threadId:n,messageText:a,disabled:r,webPagePreview:c,noWebPage:d,theme:l}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,s.Sv)(),g=Wo((()=>{const{text:e,entities:t}=(0,f.ZP)(a),n=t?.find((e=>e.type===i.Vv.TextUrl));if(n)return n.url;const s=e.match(Li);return s?s[0]:void 0}),300,[a]);(0,o.d4)((()=>{g?u({text:g}):(m(),h({chatId:t,threadId:n}))}),[t,h,m,g,u,n]),(0,Ke.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&a.length&&!d&&!r),{shouldRender:I,transitionClassNames:v}=(0,st.Z)(p),w=(0,hn.Z)(c,!0),y=(0,o.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!I||!w)return;const{photo:P,...Z}=w,C={content:{webPage:Z}};return o.ZP.createElement("div",{className:(0,_e.Z)("WebPagePreview",v)},o.ZP.createElement("div",null,o.ZP.createElement("div",{className:"WebPagePreview-left-icon"},o.ZP.createElement("i",{className:"icon-link"})),o.ZP.createElement(ga,{message:C,inPreview:!0,theme:l}),o.ZP.createElement(kt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},o.ZP.createElement("i",{className:"icon-close"}))))}))),Fi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Ui=(0,o.X$)((e=>{let{isOpen:t,onClick:n,text:s,isDisabled:a}=e;const i=(0,o.sO)(null);return(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,s]),(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),o.ZP.createElement(kt.Z,{className:(0,_e.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:a,onClick:n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:(0,_e.Z)("bot-menu-icon","icon-webapp",t&&"open")}),o.ZP.createElement("span",{ref:i,className:"bot-menu-text"},s))}));var ji;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(ji||(ji={}));const Di="wonderful-voice-message.ogg",qi=(0,o.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:s,threadId:o,messageListType:i}=t;const r=(0,c.Z1)(e,s),d=s!==a.FVh?(0,c.IK)(e,s):void 0,u=Boolean(d),m=(0,c.FM)(e,s),h=u&&(0,c.FT)(e,s),g=(0,c.qy)(e,s,o),{language:p,shouldSuggestStickers:f,shouldSuggestCustomEmoji:I}=e.settings.byKey,v=e.emojiKeywords[a.pRL],w=p!==a.pRL?e.emojiKeywords[p]:void 0,y=h?h.id:void 0,P=y?(0,c.hj)(e,s,y):void 0,{currentUserId:Z}=e,C=r?.fullInfo?r?.fullInfo?.sendAsId||Z:void 0,b=r?.sendAsPeerIds&&C&&r.sendAsPeerIds.some((e=>e.id===C))?C:r?.adminRights?.anonymous?r?.id:void 0,E=b?(0,c.dy)(e,b):void 0,S=!E&&b?(0,c.Z1)(e,b):void 0,M=(0,c.uH)(e,s),R=(0,c.nA)(e,s),k=(0,c.Bt)(e),T=s===k?.chatId&&o===k?.threadId&&i===k?.type,N=(0,c.dy)(e,s),A=null===(n=N&&!N.fullInfo?.noVoiceMessages)||void 0===n||n,x="scheduled"===i?(0,c.hI)(e,s):(0,c.s)(e,s,o);return{editingMessage:(0,c.kK)(e,s,o,i),connectionState:e.connectionState,draft:(0,c.Ms)(e,s,o),chat:r,isChatWithBot:u,isChatWithSelf:m,isForCurrentMessageList:T,canScheduleUntilOnline:(0,c.Eh)(e,s),isChannel:r?(0,l.eA)(r):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:"thread"===i&&Boolean(g?.length),shouldSchedule:"scheduled"===i,botKeyboardMessageId:y,botKeyboardPlaceholder:P?.keyboardPlaceholder,isForwarding:s===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:r?.fullInfo?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:Z,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:f,shouldSuggestCustomEmoji:I,recentEmojis:e.recentEmojis,baseEmojiKeywords:v?.keywords,emojiKeywords:w?.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:r?.fullInfo&&r.fullInfo.botCommands,botCommands:d?.fullInfo?d.fullInfo.botInfo?.commands||!1:void 0,botMenuButton:d?.fullInfo?.botInfo?.menuButton,sendAsUser:E,sendAsChat:S,sendAsId:b,editingDraft:x,requestedDraftText:M,requestedDraftFiles:R,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,c.t)(e,s),theme:(0,c.Pu)(e),fileSizeLimit:(0,$.M)(e,"uploadMaxFileparts")*a.pJM,captionLimit:(0,$.M)(e,"captionLength"),isCurrentUserPremium:(0,c.wV)(e),canSendVoiceByPrivacy:A}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:I,messageListType:v,draft:w,chat:y,isForCurrentMessageList:P,isCurrentUserPremium:Z,canSendVoiceByPrivacy:C,connectionState:b,isChatWithBot:E,isChatWithSelf:S,isChannel:M,fileSizeLimit:R,isRightColumnShown:k,isSelectModeActive:N,isForwarding:A,pollModal:x,botKeyboardMessageId:B,botKeyboardPlaceholder:L,withScheduledButton:O,stickersForEmoji:F,customEmojiForEmoji:U,groupChatMembers:j,topInlineBotIds:D,currentUserId:q,captionLimit:$,lastSyncTime:G,contentToBeScheduled:H,shouldSuggestStickers:_,shouldSuggestCustomEmoji:V,baseEmojiKeywords:W,emojiKeywords:X,recentEmojis:Y,inlineBots:K,isInlineBotLoading:J,botCommands:Q,chatBotCommands:ee,sendAsUser:te,sendAsChat:ne,sendAsId:se,editingDraft:ae,requestedDraftText:oe,requestedDraftFiles:ie,botMenuButton:re,attachBots:ce,attachMenuPeerType:de,theme:le}=e;const{sendMessage:ue,clearDraft:me,showDialog:he,setStickerSearchQuery:ge,setGifSearchQuery:pe,forwardMessages:fe,openPollModal:Ie,closePollModal:ve,loadScheduledHistory:we,openChat:ye,addRecentEmoji:Pe,sendInlineBotResult:Ze,loadSendAs:Ce,resetOpenChatWithDraft:Ee,callAttachBot:Se,openLimitReachedModal:Me,openPremiumModal:Re,addRecentCustomEmoji:ke,showNotification:Te}=(0,s.Sv)(),Ne=(0,wt.Z)(),Ae=(0,o.sO)(null),[xe,Be]=(0,o.eJ)(""),Le=(0,Ao.Y)(xe),Oe=(0,o.sO)(),Fe=(0,ln.Z)(t),{width:Ue}=be.Z.get(),je=y?.sendAsPeerIds,De=je&&(je.length>1||!je.some((e=>e.id===q))),[qe,$e,Ge]=(0,ft.Z)(),He=(0,No.Z)(g,I),Ve=(0,o.I4)((e=>{Be(e),requestAnimationFrame((()=>{(0,Mo.AU)()}))}),[]),ze=(0,o.sO)(0),Je=(0,o.I4)((()=>{Ge()}),[Ge]),[Qe,et]=(0,ni.Z)(r,Je);(0,o.d4)((()=>{Oe.current=void 0}),[g]),(0,o.d4)((()=>{g&&G&&c&&we({chatId:g})}),[c,g,we,G,I]),(0,o.d4)((()=>{g&&y&&G&&!je&&c&&(0,l.ZV)(y)&&Ce({chatId:g})}),[y,g,c,G,Ce,je]);const tt=(0,o.sO)(!1);(0,Ke.Z)((e=>{let[t,n]=e;tt.current=Boolean(g===t&&je&&!n)}),[g,je]),(0,o.bt)((()=>{Ae.current&&(Ae.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')}),[]);const[nt,st]=(0,o.eJ)([]),[at,it,rt]=(0,ft.Z)(),[ct,dt,lt]=(0,ft.Z)(),[ut,mt,ht]=(0,ft.Z)(),[pt,It,vt]=(0,ft.Z)(),[yt,Pt,Zt]=(0,ft.Z)(),[Ct,bt]=(0,ft.Z)(),[Et,St,Mt]=(0,ft.Z)(),Rt=(0,o.I4)((e=>{const t="function"==typeof e?e(nt):e;t.some((e=>{let{size:t}=e;return t>R}))?Me({limit:"uploadMaxFileparts"}):st(t)}),[nt,R,Me]),{startRecordingVoice:Tt,stopRecordingVoice:Nt,pauseRecordingVoice:At,activeVoiceRecording:xt,currentRecordTime:Lt,recordButtonRef:Ot,startRecordTimeRef:Ft}=(()=>{const e=(0,o.sO)(null),[t,n]=(0,o.eJ)(),s=(0,o.sO)(),[a,i]=(0,o.eJ)();(0,o.d4)((()=>{h.s$&&h.mh&&Uo()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:a}=await jo((t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),i(Date.now()))}));s.current=Date.now(),i(Date.now()),n({stop:t,pause:a})}catch(e){console.error(e)}}),[]),c=(0,o.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),d=(0,o.I4)((()=>{if(t){n(void 0),s.current=void 0,i(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,o.d4)((()=>t?(0,gt.Z)(d):void 0),[t,d]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:d,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:s}})();(0,ot.Z)((()=>{He({type:"recordAudio"})}),xt&&a.o_S),(0,o.d4)((()=>{xt||He({type:"cancel"})}),[xt,He]),(0,o.d4)((()=>{xe&&!m&&He({type:"typing"})}),[m,xe,He]);const Ut=m?ji.Edit:!h.mh||xt||xe&&!nt.length||A?n?ji.Schedule:ji.Send:ji.Record,jt=!n,{isMentionTooltipOpen:Dt,closeMentionTooltip:qt,insertMention:$t,mentionFilteredUsers:Gt}=(0,zo.Z)(!nt.length,a.Edp,Ve,j,D,q),{isOpen:Ht,id:_t,isGallery:Vt,switchPm:zt,results:Wt,closeTooltip:Xt,help:Yt,loadMore:Kt}=function(e,t,n,a){const{queryInlineBot:i,resetInlineBot:r}=(0,s.Sv)(),[c,d,l]=(0,ft.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=Wo((()=>function(e){const t=function(e){return Qo.innerHTML=e.replace(/<br>/g,"\n"),Qo.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),Qo.innerText}(e),n=t.match(Yo);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Ko),usernameLowered:n[1].toLowerCase()}:Jo}(n)),300,[n])||{},p=(0,ln.Z)(m),f=(0,ln.Z)(u),I=g?a?.[g]:void 0,{id:v,switchPm:w,offset:y,results:P,isGallery:Z,help:C}=I||{};(0,o.d4)((()=>{p!==m&&l()}),[p,m,l]),(0,o.d4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m})}),[m,e,i,t,g]);const b=(0,o.I4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m,offset:y})}),[e,g,t,i,m,y]);return(0,o.d4)((()=>{e&&v&&(w||P?.length)?d():l()}),[v,e,d,P,w,l]),f!==u&&r({username:f}),{isOpen:c,id:v,isGallery:Z,switchPm:w,results:P,closeTooltip:l,help:h&&C?`@${u} ${C}`:void 0,loadMore:b}}(Boolean(!nt.length&&G),g,xe,K),{isOpen:Jt,close:Qt,filteredBotCommands:en}=function(e,t,n,s){const[a,i,r]=(0,ft.Z)(),[c,d]=(0,o.eJ)(),l=(0,o.I4)((e=>{n||s?ei((()=>{const t=(n||s||[]).filter((t=>{let{command:n}=t;return!e||n.includes(e)}));d(t&&t.length?t:void 0)})):d(void 0)}),[n,s]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,ko._)(t.substr(1)).match(ti);l(e?e[0]:"")}else d(void 0);else d(void 0)}),[l,t,e,r]),(0,o.d4)((()=>{c&&c.length&&t.length>0?i():r()}),[c,t.length,i,r]),{isOpen:a,close:r,filteredBotCommands:c}}(Boolean(Q&&Q.length||ee&&ee.length),xe,Q,ee),{isContextMenuOpen:tn,handleContextMenu:nn,handleContextMenuClose:sn,handleContextMenuHide:on}=(0,Un.Z)(Ot,!(Ut===ji.Send&&jt)),{canSendStickers:cn,canSendGifs:dn,canAttachMedia:un,canAttachPolls:mn,canAttachEmbedLinks:hn}=(0,o.Ye)((()=>(0,l.H5)(y,E)),[y,E]),gn=y&&(0,l.Nl)(y),pn=(0,l.Hd)(y),{isStickerTooltipOpen:fn,closeStickerTooltip:vn}=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=(0,o.Ye)((()=>(0,ko._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,s.Sv)(),d=h.op&&1===(0,Ro.Z)(i)||!h.op&&Boolean(t.match(To)),l=Boolean(n?.length)&&d;return(0,o.d4)((()=>{a||(e&&d?r({emoji:h.op?i:i.match(/alt="(.+)"/)?.[1]}):!l&&d||c())}),[t,d,c,r,e,a]),{isStickerTooltipOpen:l,closeStickerTooltip:c}}(Boolean(_&&cn&&!nt.length),xe,F,!c),{isCustomEmojiTooltipOpen:wn,closeCustomEmojiTooltip:yn,insertCustomEmoji:Pn}=(0,si.Z)(Boolean(V&&!nt.length),a.Edp,xe,Ve,U,!c),{isEmojiTooltipOpen:Zn,closeEmojiTooltip:Cn,filteredEmojis:bn,filteredCustomEmojis:En,insertEmoji:Sn,insertCustomEmoji:Mn}=(0,Vo.Z)(Boolean(_&&cn&&!nt.length),Le,Y,void 0,Ve,W,X,!c),Rn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2F;const n=window.getSelection();let s;if(s=t===a.R2F?document.querySelector(a.Edp):document.getElementById(t),n.rangeCount){const a=n.getRangeAt(0);if((0,bo.R)(a,t))return(0,Co.t)(e),void s.dispatchEvent(new Event("input",{bubbles:!0}))}Ve(`${Le.current}${e}`),requestAnimationFrame((()=>{(0,wo.Z)(s)}))}),[Le,Ve]),kn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2F;const n=(0,aa.z)(e);Rn(n,t)}),[Rn]),Tn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2F;const n=(0,In.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Rn(n,t)}),[Rn]),Nn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2F;Rn((0,Cs.yR)(e),t)}),[Rn]),An=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,bo.R)(t,a.R2F))return void document.execCommand("delete",!1)}Ve(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const s=n.textContent.length,a=document.createRange(),o=window.getSelection();a.setStart(n,s),a.setEnd(n,s),o.removeAllRanges(),o.addRange(a),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(Le.current))}),[Le,Ve]),xn=(0,o.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ve(""),st(d.D),vn(),yn(),qt(),Cn(),h.wB?setTimeout((()=>ht()),350):ht()}),[vn,yn,qt,Cn,ht,Ve]),Bn=(0,o.sO)();Bn.current=Nt,(0,o.d4)((()=>()=>{Bn.current(),xn()}),[g,I,xn,Bn]);const Ln=(0,o.I4)((()=>{const e=ze.current;Te(e?{message:Ne("UnlockPremiumEmojiHint2"),action:()=>ye({id:q,shouldReplaceHistory:!0}),actionText:Ne("Open")}:{message:Ne("UnlockPremiumEmojiHint"),action:()=>Re({initialSection:"animated_emoji"}),actionText:Ne("PremiumMore")}),ze.current=Number(!e)}),[q,Ne,ye,Re,Te]),[On,Fn]=((e,t,n,i,r,c,d,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,s.Sv)();(0,We.Z)((e=>{let[s]=e;if(!n)return;if(s?.id===n.id)return;const o=!s&&h?.text.length?h:n.content.text,i=(0,aa.z)(o);t(i),requestAnimationFrame((()=>{const e=document.querySelector(a.Edp);e&&(0,wo.Z)(e,!0)}))}),[n,t]),(0,o.d4)((()=>{if(n)return()=>{const t=(0,f.ZP)(e.current),n=t.text.length?t:void 0;p({chatId:c,threadId:d,type:u,text:n})}}),[c,n,e,p,d,u]);const I=(0,o.I4)((()=>{m&&(0,T.T2)((()=>{t((0,aa.z)(m));const e=document.querySelector(a.Edp);e&&requestAnimationFrame((()=>{(0,wo.Z)(e,!0)}))}))}),[m,t]),v=(0,o.I4)((()=>{i(),I()}),[i,I]),w=(0,o.I4)((()=>{const{text:t,entities:s}=(0,f.ZP)(e.current);n&&(t||(0,l.u8)(n)?(g({messageId:n.id,text:t,entities:s}),i(),I()):r())}),[g,n,e,r,i,I]),y=(0,o.I4)((()=>{if(!n)return;const t=(0,f.ZP)(e.current),s=t.text.length?t:void 0;p({chatId:c,threadId:d,type:u,text:s})}),[c,n,e,p,d,u]);return(0,Xe.Z)(y),Ye(y),[w,v]})(Le,Ve,m,xn,Pt,g,I,v,w,ae);((e,t,n,r,c,d,l)=>{const{saveDraft:u,clearDraft:m,loadCustomEmojis:g}=(0,s.Sv)(),p=(0,ln.Z)(e),I=(0,o.I4)(((e,t)=>{const n=r.current;void 0!==n&&!d&&l&&(n.length?u({chatId:e,threadId:t,draft:(0,f.ZP)(n)}):m({chatId:e,threadId:t}))}),[m,d,r,l,u]),v=(0,o.Ye)((()=>(0,T.Ds)((e=>e()),a.r_R,!1)),[t]),w=(0,ln.Z)(t),y=(0,ln.Z)(n);(0,o.d4)((()=>(Ho=t,_o=n,()=>{Ho=void 0,_o=void 0,I(t,n)})),[t,n,I]),(0,o.d4)((()=>{if(t===w&&n===y)return void(!e&&p&&c(""));if(d||!e)return;c((0,aa.z)(e));const s=e.entities?.map((e=>e.type===i.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];s.length&&g({ids:s}),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(a.Edp);e&&(0,wo.Z)(e,!0)}))}),[t,n,e,c,I,w,y,d,p,g]);const P=r.current,Z=(0,ln.Z)(P);(0,o.d4)((()=>{t&&n&&w===t&&y===n&&Z!==P&&(P.length?v((()=>{Ho===t&&_o===n&&I(t,n)})):I(t,n))}),[t,P,w,Z,y,v,n,I]);const C=(0,o.I4)((()=>{t&&n&&I(t,n)}),[t,n,I]);(0,Xe.Z)(C),Ye(C)})(w,g,I,Le,Ve,m,G),((e,t,n,s,r,c)=>{(0,o.d4)((()=>{if(e)return document.addEventListener("paste",o,!1),()=>{document.removeEventListener("paste",o,!1)};async function o(e){if(!e.clipboardData)return;const o=document.activeElement;if(o&&![a.R2F,a.nYf].includes(o.id))return;const d=e.clipboardData.getData("text").substring(0,4096),l=e.clipboardData.getData("text/html");let u=l?(0,f.ZP)(function(e){let t=document.createElement("div");t.innerHTML=e.replace(/\u00a0/g," ").replace(Go,"");const n=t.querySelectorAll(".text-content");return n.length&&(t=n[n.length-1]),Array.from(t.getElementsByTagName("*")).forEach((e=>{if(e instanceof HTMLElement)switch(e.removeAttribute("style"),"BR"===e.tagName&&e.replaceWith("\n"),"P"===e.tagName&&e.appendChild(document.createTextNode("\n")),"IMG"!==e.tagName||e.dataset.entityType||e.replaceWith(e.getAttribute("alt")||""),e.dataset.ignoreOnPaste&&e.remove(),f.xe[e.tagName]&&e.setAttribute("data-entity-type",f.xe[e.tagName]),e.dataset.entityType||e.textContent!==e.innerText||e.replaceWith(e.textContent),e.dataset.alt&&e.setAttribute("alt",e.dataset.alt),e.dataset.entityType){case i.Vv.MentionName:e.replaceWith(e.textContent||"");break;case i.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(l),void 0,!0):void 0;u&&(0,qo.Lo)(u)&&r&&(u=(0,qo.If)(u),c?.());const{items:m}=e.clipboardData;let h=[];if(e.preventDefault(),m.length>0&&(h=await(0,Do.Z)(m)),0===h.length&&!d)return;if(h.length>0&&!s){const e=await Promise.all(h.map((e=>Zo(e.name,e,1===h.length&&$o.includes(e.type)))));n((t=>t.concat(e)))}const g=u?.entities?.length?u:{text:d};g&&t(g,o?.id)}}),[t,s,n,e,r,c])})(P,kn,Rt,m,!Z&&!S,Ln);const jn=(0,o.I4)((()=>{m&&Fn()}),[m,Fn]),Dn=(0,o.I4)((async(e,t)=>{Rt(await Promise.all(e.map((e=>Zo(e.name,e,t)))))}),[Rt]),qn=(0,o.I4)((async(e,t)=>{Rt([...nt,...await Promise.all(e.map((e=>Zo(e.name,e,t))))])}),[nt,Rt]),$n=(0,o.I4)((()=>{st(d.D)}),[]),Gn=(0,o.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==b)return;let n=nt;if(xt){const e=await Nt();if(e){const{blob:t,duration:s,waveform:a}=e;n=[await Zo(Di,t,!1,{voice:{duration:s,waveform:a}})]}}const{text:o,entities:i}=(0,f.ZP)(Le.current);if(!n.length&&!o&&!A)return;const{serverTimeOffset:r}=(0,s.Rd)(),c=n.length?$:4096;if(o?.length>c){const e=o.length-c;return void he({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const d=document.querySelector(a.Edp);if(n.length||o){if(pn&&!gn){const e=(0,p.b)(r),t=Oe.current&&Math.floor(e-Oe.current),n=pn.nextSendDate&&pn.nextSendDate>e;if(t&&t<pn.seconds||n){const s=n?pn.nextSendDate-e:pn.seconds-t;return he({data:{message:Ne("SlowModeHint",(0,z.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),void d?.blur()}}ue({text:o,entities:i,attachments:n,scheduledAt:t,isSilent:e,shouldUpdateStickerSetsOrder:!0})}A&&fe({scheduledAt:t,isSilent:e}),Oe.current=(0,p.b)(r),me({chatId:g,localOnly:!0}),h.cj&&d&&d===document.activeElement&&So(d),requestAnimationFrame((()=>{xn()}))}),[b,nt,xt,A,me,g,$,xn,Nt,he,pn,gn,ue,fe,Ne,Le]),Hn=(0,o.I4)((()=>{"webApp"===re?.type&&Se({botId:g,chatId:g,isFromBotMenu:!0,url:re.url,threadId:I})}),[re,Se,g,I]),_n=(0,o.I4)((()=>{ht(),dt()}),[ht,dt]),Vn=(0,o.I4)((()=>{lt(),vt(),mt()}),[lt,vt,mt]),zn=(0,o.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:s,isSilent:a}=e;return void Ze({id:n,queryId:s,scheduledAt:t,isSilent:a})}const{isSilent:n,...s}=e||{};e&&0!==Object.keys(s).length?ue({...e,scheduledAt:t}):Gn(Boolean(n),t)}),[Gn,Ze,ue]);(0,o.d4)((()=>{H&&Qe((e=>{zn(H,e)}))}),[H,zn,Qe]),(0,o.d4)((()=>{oe&&(Ve(oe),Ee(),requestAnimationFrame((()=>{const e=document.getElementById(a.R2F);(0,wo.Z)(e,!0)})))}),[oe,Ee,Ve]),(0,o.d4)((()=>{if(ie?.length){const e=ie.every((e=>(0,rn.MD)(e)));Dn(ie,e),Ee()}}),[Dn,ie,Ee]);const Wn=(0,o.I4)((e=>{e.isFree||Z||S?Nn(e):Ln()}),[Nn,S,Z,Ln]),Xn=(0,o.I4)((function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;e={...e,isPreloadedGlobally:!0},n||s?($e(),Qe((n=>{Ge(),zn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{xn(a)}))}))):(ue({sticker:e,isSilent:t,shouldUpdateStickerSetsOrder:o}),requestAnimationFrame((()=>{xn(a)})))}),[n,$e,Qe,Ge,zn,xn,ue]),Yn=(0,o.I4)(((e,t,s)=>{n||s?($e(),Qe((n=>{Ge(),zn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{xn(!0)}))}))):(ue({gif:e,isSilent:t}),requestAnimationFrame((()=>{xn(!0)})))}),[n,$e,Qe,Ge,zn,xn,ue]),Kn=(0,o.I4)(((e,t,s)=>{if("connectionStateReady"!==b)return;n||s?Qe((n=>{zn({id:e.id,queryId:e.queryId,isSilent:t},n)})):Ze({id:e.id,queryId:e.queryId,isSilent:t});const o=document.querySelector(a.Edp);h.cj&&o&&o===document.activeElement&&So(o),me({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{xn()}))}),[g,me,b,zn,Qe,xn,Ze,n]),Jn=(0,o.I4)((()=>{me({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{xn()}))}),[g,me,xn]),Qn=(0,o.I4)((e=>{n?(Qe((t=>{zn({poll:e},t)})),ve()):(ue({poll:e}),ve())}),[ve,zn,Qe,ue,n]),es=(0,o.I4)((()=>{n?Qe((e=>{zn({isSilent:!0},e)})):Gn(!0)}),[zn,Gn,Qe,n]),ts=(0,o.I4)((e=>{"stickers"===e?(ge({query:""}),pe({query:void 0})):(pe({query:""}),ge({query:void 0}))}),[ge,pe]),ns=(0,o.I4)((()=>{const e=document.querySelector(a.Edp);h.wB&&e===document.activeElement?(e?.blur(),setTimeout((()=>{lt(),mt()}),100)):mt()}),[mt,lt]),ss=(0,o.I4)((()=>{const e=document.querySelector(a.Edp);if(!h.wB||e!==document.activeElement)return lt(),ht(),void It();e?.blur(),setTimeout((()=>{lt(),ht(),It()}),100)}),[lt,ht,It]),as=(0,o.I4)((()=>{ye({id:g,threadId:I,type:"scheduled"})}),[ye,g,I]);(0,o.d4)((()=>{k&&h.wB&&ht()}),[k,ht]),(0,o.d4)((()=>{c&&(N?St():setTimeout((()=>{Mt()}),200))}),[N,Mt,St,c]);const os=!(Ut!==ji.Record||un&&C),is=(0,o.I4)((()=>{switch(Ut){case ji.Send:Gn();break;case ji.Record:os?C||Te({message:Ne("VoiceMessagesRestrictedByPrivacy",y?.title)}):Tt();break;case ji.Edit:On();break;case ji.Schedule:xt&&At(),Qe((e=>{zn({},e)}))}}),[Ut,Gn,On,xt,Qe,os,C,Te,Ne,y?.title,Tt,At,zn]),rs=(0,ln.Z)(m,!0),cs=m||rs,ds=new Date;ds.setSeconds(0),ds.setMilliseconds(0);const ls=new Date;ls.setFullYear(ls.getFullYear()+1);let us="SendMessage";switch(Ut){case ji.Edit:us="Save edited message";break;case ji.Record:us=un?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const ms=(0,_e.Z)("Composer",!N&&"shown",Et&&"hover-disabled"),hs=(0,_e.Z)("mobile-symbol-menu-button",!c&&"not-ready",Ct?ut&&"menu-opened":ut&&"is-loading"),gs=(0,o.I4)((()=>{Qe((e=>{zn({},e)}))}),[zn,Qe]),ps=Ut===ji.Edit?On:Ut===ji.Schedule?gs:Gn,fs=re&&"commands"===re?.type;return o.ZP.createElement("div",{className:ms},un&&c&&o.ZP.createElement(Bi,{isOpen:t!==an.t.None,withQuick:t===an.t.QuickFile||Fe===an.t.QuickFile,onHide:u,onFileSelect:Dn}),o.ZP.createElement(Ni,{chatId:g,threadId:I,canShowCustomSendMenu:jt,attachments:nt,captionLimit:$,caption:nt.length?xe:"",groupChatMembers:j,currentUserId:q,recentEmojis:Y,isReady:c,isChatWithSelf:S,onCaptionUpdate:Ve,baseEmojiKeywords:W,emojiKeywords:X,shouldSchedule:n,onSendSilent:es,onSend:Gn,onSendScheduled:gs,onFileAppend:qn,onClear:$n,shouldSuggestCustomEmoji:V,customEmojiForEmoji:U}),o.ZP.createElement(xi,{isOpen:x.isOpen,isQuiz:x.isQuiz,shouldBeAnonymous:M,onClear:ve,onSend:Qn}),cs&&o.ZP.createElement(ai,{isOpen:yt,isSchedule:"scheduled"===v,onClose:Zt,message:cs}),o.ZP.createElement(Fi,{isOpen:pt,onClose:vt,chatId:g,selectedSendAsId:se,sendAsPeerIds:je,isCurrentUserPremium:Z}),o.ZP.createElement(wi,{isOpen:Dt,onClose:qt,onInsertUserName:$t,filteredUsers:Gt}),o.ZP.createElement(vi,{isOpen:Ht,botId:_t,isGallery:Vt,inlineBotResults:Wt,switchPm:zt,onSelectResult:Kn,loadMore:Kt,onClose:Xt,isSavedMessages:S,canSendGifs:dn,isCurrentUserPremium:Z}),o.ZP.createElement(bi,{isOpen:Jt,withUsername:Boolean(ee),botCommands:en,onClick:Jn,onClose:Qt}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:Ae}),o.ZP.createElement(Ti,{onClear:jn}),o.ZP.createElement(Oi,{chatId:g,threadId:I,messageText:nt.length?"":xe,disabled:!hn}),o.ZP.createElement("div",{className:"message-input-wrapper"},E&&re&&"webApp"===re.type&&!m&&o.ZP.createElement(Ui,{isOpen:!xe&&!xt,onClick:Hn,text:re.text,isDisabled:Boolean(xt)}),E&&fs&&!1!==Q&&!xt&&!m&&o.ZP.createElement(ci,{className:(0,_e.Z)("bot-commands",ct&&"activated"),round:!0,disabled:void 0===Q,color:"translucent",onActivate:_n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),De&&(te||ne)&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",onClick:pt?vt:ss,ariaLabel:Ne("SendMessageAsTitle"),className:(0,_e.Z)("send-as-button",tt.current&&"appear-animation")},o.ZP.createElement(bs.Z,{user:te,chat:ne,size:"tiny"})),h.wB?o.ZP.createElement(kt.Z,{className:hs,round:!0,color:"translucent",onClick:ut?ht:ns,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),ut&&!Ct&&o.ZP.createElement(Bt.Z,{color:"gray"})):o.ZP.createElement(ci,{className:(0,_e.Z)("symbol-menu-button",ut&&"activated"),round:!0,color:"translucent",onActivate:Vn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(Si.Z,{id:"message-input-text",editableInputId:a.R2F,chatId:g,threadId:I,html:nt.length?"":xe,placeholder:xt&&Ue<=600?"":L||Ne("Message"),forcedPlaceholder:Yt,canAutoFocus:c&&!nt.length,noFocusInterception:nt.length>0,shouldSuppressFocus:h.wB&&ut,shouldSuppressTextFormatter:Zn||Dt||Ht,onUpdate:Ve,onSend:ps,onSuppressedFocus:ht}),J&&Boolean(_t)&&o.ZP.createElement(Bt.Z,{color:"gray"}),O&&o.ZP.createElement(kt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:as,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),Boolean(B)&&!xt&&!m&&o.ZP.createElement(ci,{className:at?"activated":"",round:!0,color:"translucent",onActivate:it,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),xt&&Boolean(Lt)&&o.ZP.createElement("span",{className:"recording-state"},(0,z.rM)(Lt-Ft.current)),o.ZP.createElement(fi,{chatId:g,threadId:I,isButtonVisible:!xt&&!m,canAttachMedia:un,canAttachPolls:mn,onFileSelect:Dn,onPollCreate:Ie,isScheduled:n,attachBots:ce,peerType:de,theme:le}),Boolean(B)&&o.ZP.createElement(Ei,{messageId:B,isOpen:at,onClose:rt}),Q&&o.ZP.createElement(Ai,{isOpen:ct,botCommands:Q,onClose:lt}),o.ZP.createElement(Zi.Z,{chatId:g,isOpen:wn,onCustomEmojiSelect:Pn,addRecentCustomEmoji:ke}),o.ZP.createElement(Pi,{chatId:g,threadId:I,isOpen:fn,onStickerSelect:Xn}),o.ZP.createElement(Ci.Z,{isOpen:Zn,emojis:bn,customEmojis:En,onClose:Cn,onEmojiSelect:Sn,addRecentEmoji:Pe,onCustomEmojiSelect:Mn,addRecentCustomEmoji:ke}),o.ZP.createElement(Ii,{chatId:g,threadId:I,isOpen:ut||qe,canSendGifs:dn,canSendStickers:cn,onLoad:bt,onClose:ht,onEmojiSelect:Tn,onStickerSelect:Xn,onCustomEmojiSelect:Wn,onGifSelect:Yn,onRemoveSymbol:An,onSearchOpen:ts,addRecentEmoji:Pe,addRecentCustomEmoji:ke}))),xt&&o.ZP.createElement(kt.Z,{round:!0,color:"danger",className:"cancel",onClick:Nt,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(kt.Z,{ref:Ot,round:!0,color:"secondary",className:(0,_e.Z)(Ut,!c&&"not-ready",xt&&"recording"),disabled:os,allowDisabledClick:!0,ariaLabel:Ne(us),onClick:is,onContextMenu:Ut===ji.Send&&jt?nn:void 0},o.ZP.createElement("i",{className:"icon-send"}),o.ZP.createElement("i",{className:"icon-schedule"}),o.ZP.createElement("i",{className:"icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon-check"})),jt&&o.ZP.createElement(yi.Z,{isOpen:tn,onSendSilent:S?void 0:es,onSendSchedule:n?void 0:gs,onClose:sn,onCloseAnimationEnd:on,isSavedMessages:S}),et)}))),$i=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,ct.Z)(rt.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),Gi=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,ct.Z)(rt.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Hi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),_i=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),Vi=(0,o.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,ct.Z)(rt.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),zi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),Wi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"GiftPremiumModal",!t);return n?o.ZP.createElement(n,e):void 0})),Xi=h.wB?450+a.fK3:void 0;function Yi(e){return"file"===e.kind&&e.type&&a.oGt.has(e.type)}const Ki=(0,o.X$)((0,s.c$)((e=>{const t=(0,c.Pu)(e),{isBlurred:n,background:s,backgroundColor:a,patternColor:o}=e.settings.themes[t]||{},{messageLists:r}=e.messages,d=(0,c.Bt)(e),{isLeftColumnShown:u,chats:{listIds:m},activeEmojiInteractions:g,lastSyncTime:p}=e,f={theme:t,customBackground:s,backgroundColor:a,patternColor:o,isLeftColumnShown:u,isRightColumnShown:(0,c.Jf)(e),isBackgroundBlurred:n,isMobileSearchActive:Boolean(h.wB&&(0,c.n5)(e)),isSelectModeActive:(0,c.CA)(e),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),isGiftPremiumModalOpen:e.giftPremiumModal?.isOpen,animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,r.length-1),activeEmojiInteractions:g,lastSyncTime:p};if(!d||!m.active)return f;const{chatId:I,threadId:v,type:w}=d,y=(0,l.YC)(I),P=(0,c.Z1)(e,I),Z=(0,c.IK)(e,I),C=(0,c.KB)(e,I,v),{chatId:b,messageId:E}=e.audioPlayer,S=P&&(0,l.Qm)(P,v),M=(0,c.pk)(e,I),R="pinned"===w,k="scheduled"===w,T="thread"===w&&v===i._f,N=Boolean(P&&(0,l.eA)(P)),A=Boolean(P&&T&&(N||(0,l.ZV)(P))&&P.isNotJoined&&!P.joinRequests),x=Boolean(P?.isNotJoined&&P.isJoinToSend),B=Boolean(P?.isNotJoined&&P.isJoinRequest),L=Boolean(Z&&(0,c.s4)(e,Z.id)),O=!L&&M,F=Boolean(P&&(0,l.Bf)(P)&&!P.fullInfo&&p),U=(0,c.Yy)(e,I,v),j=!!P?.isForum&&v===i._f&&!U;return{...f,chatId:I,threadId:v,messageListType:w,chat:P,replyingToId:U,isPrivate:y,areChatSettingsLoaded:Boolean(P?.settings),canPost:!R&&(!P||S)&&!(k&&P?.isForum&&v===i._f)&&!M&&!(x&&P?.isNotJoined)&&!j,isPinnedMessageList:R,isScheduledMessageList:k,currentUserBannedRights:P?.currentUserBannedRights,defaultBannedRights:P?.defaultBannedRights,hasPinnedOrAudioPlayer:v!==i._f&&!P?.isForum||Boolean(!R&&C?.length)||Boolean(b&&E),pinnedMessagesCount:C?C.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:N,canSubscribe:A,canStartBot:O,canRestartBot:L,shouldJoinToSend:x,shouldSendJoinRequest:B,shouldLoadFullChat:F}}))((e=>{let{chatId:t,threadId:n,messageListType:i,chat:r,replyingToId:c,isPrivate:d,isPinnedMessageList:u,canPost:m,currentUserBannedRights:g,defaultBannedRights:p,hasPinnedOrAudioPlayer:f,pinnedMessagesCount:I,customBackground:v,theme:w,backgroundColor:y,patternColor:P,isLeftColumnShown:Z,isRightColumnShown:C,isBackgroundBlurred:b,isMobileSearchActive:E,isSelectModeActive:S,isSeenByModalOpen:M,isReactorListModalOpen:R,isGiftPremiumModalOpen:k,animationLevel:T,shouldSkipHistoryAnimations:N,currentTransitionKey:A,isChannel:x,areChatSettingsLoaded:B,canSubscribe:L,canStartBot:O,canRestartBot:F,activeEmojiInteractions:U,shouldJoinToSend:j,shouldSendJoinRequest:D,shouldLoadFullChat:q,lastSyncTime:$}=e;const{openChat:G,openPreviousChat:H,unpinAllMessages:_,loadUser:V,loadChatSettings:z,closeLocalTextSearch:W,exitMessageSelectMode:X,joinChannel:Y,sendBotCommand:K,restartBot:J,showNotification:Q,loadFullChat:ee}=(0,s.Sv)(),{width:te}=(0,cn.Z)(),ne=(0,wt.Z)(),[se,ae]=(0,o.eJ)(an.t.None),[oe,ie]=(0,o.eJ)(),[re,ce]=(0,o.eJ)(),[de,le]=(0,o.eJ)(!1),ue=f&&(te<a.l35||C&&te>a._mX&&te<a.QU1||te>=a.ksF&&te<a.jT7),me=(0,dn.Z)(t,Xi),he=(0,dn.Z)(n,Xi),ge=(0,dn.Z)(i,Xi),pe=(0,dn.Z)(L,Xi),fe=(0,dn.Z)(O,Xi),Ie=(0,dn.Z)(F,Xi),be=(0,dn.Z)(m,Xi)&&!Ie&&!fe&&!pe,Ee=(0,dn.Z)(ue,Xi),Se=(0,dn.Z)(oe,Xi),Me=(0,dn.Z)(x,Xi),Re=(0,dn.Z)(j,Xi),ke=(0,dn.Z)(D,Xi),Te=(0,ln.Z)(A),Ne=void 0!==Te&&Te<A?Te:void 0,{isReady:Ae,handleOpenEnd:xe,handleSlideStop:Be}=function(e,t,n,s){const[a,i]=(0,o.eJ)(!h.wB),r=(0,nt.Z)(),c=void 0!==n&&n!==t;return c&&(e?i(!1):r()),(0,Ke.Z)((()=>{e||i(!0)}),[e]),{isReady:a&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&i(Boolean(s))}:void 0,handleSlideStop:e?function(){i(!0)}:void 0}}(!N&&T!==a.oBh,A,Te,t);(0,o.d4)((()=>t?(0,gt.Z)((()=>{G({id:void 0})})):void 0),[t,G]),(0,Ke.Z)((()=>{ae(an.t.None),ie(void 0),ce(void 0)}),[t]),(0,o.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{e.height!==document.documentElement.clientHeight?document.body.classList.add("keyboard-visible"):document.body.classList.remove("keyboard-visible")};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}}),[]),(0,o.d4)((()=>{d&&V({userId:t})}),[t,d,V]),(0,o.d4)((()=>{!B&&$&&z({chatId:t})}),[t,d,B,$,z]),(0,o.d4)((()=>{t&&q&&Ae&&ee({chatId:t})}),[q,t,Ae,ee]);const Le=(0,o.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Yi);ae(n?an.t.QuickFile:an.t.Document)}),[]),Oe=(0,o.I4)((()=>{ae(an.t.None)}),[]),Fe=(0,o.I4)((()=>{le(!0)}),[]),Ue=(0,o.I4)((()=>{le(!1)}),[]),je=(0,o.I4)((()=>{_({chatId:t,threadId:n}),Ue(),H()}),[_,t,n,Ue,H]),De=(0,o.I4)((()=>{G({id:t})}),[G,t]),qe=(0,o.I4)((()=>{Y({chatId:t}),ke&&Q({message:ne(x?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[Y,t,ke,Q,x,ne]),$e=(0,o.I4)((()=>{K({command:"/start"})}),[K]),Ge=(0,o.I4)((()=>{J({chatId:t})}),[t,J]),He=((e,t)=>{const[n,s]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?s(t):on.fetch(a.foQ,e,on.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,rn.pt)(t).then((()=>{s(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(w,v),Ve=(0,_e.Z)(Ee&&"has-header-tools",h.aZ?"mask-image-disabled":"mask-image-enabled"),ze=(0,_e.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",v&&"Ik9ZZlj3eKtKXRrUZKVk",y&&"avVozLQe3SaWcSkIt6pG",v&&b&&"Tipa66fYcSvl6w0587Xz",C&&"vhOr8s3T_LCKSt2BF7fs"),We=(0,_e.Z)("messaging-disabled",!S&&"shown"),Xe=(0,l.q8)(ne,g,p),Ye=(0,l.mt)(ne,r,n,Boolean(c)),Je=Xe||Ye,{composerHiddenScale:Qe,toolbarHiddenScale:et,composerTranslateX:tt,toolbarTranslateX:st,unpinHiddenScale:at,toolbarForUnpinHiddenScale:ot}=(0,o.Ye)((()=>function(e,t){const n=e<=a.l35?ve.Gw:2*ve.Gw,s=function(e){if(e>a._mX){const t=Math.min(Math.max(.25*e,Ze),Pe),n=Math.min(.25*e,Pe);return Math.min(e-t-n,ye)}if(e>a.ksF){const t=Math.min(Math.max(.4*e,Ze),Pe);return Math.min(e-t,ye)}return e>ye?ye:e}(e),o=e<=a.l35?3.375*ve.Gw:4*ve.Gw,i=t?s-n-o:s-n,r=e>a.l35?Math.min(s-n,we):s-n,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/Ce,toolbarForUnpinHiddenScale:Ce/r}}(te,be)),[be,te]),it=(0,_e.Z)("middle-column-footer",!be&&"no-composer",be&&re&&!S&&"with-notch");(0,jt.Z)({isActive:S,onBack:X}),(0,jt.Z)({isActive:E,onBack:W});const rt=Boolean(!u&&!be&&!Ie&&!fe&&!pe&&Je),ct=Boolean(Ie||pe||ke||fe||u),dt=Boolean(rt||S||u);return o.ZP.createElement("div",{id:"MiddleColumn",className:Ve,onTransitionEnd:xe,style:`\n --composer-hidden-scale: ${Qe};\n --toolbar-hidden-scale: ${et};\n --unpin-hidden-scale: ${at};\n --toolbar-unpin-hidden-scale: ${ot};\n --composer-translate-x: ${tt}px;\n --toolbar-translate-x: ${st}px;\n --pattern-color: ${P};\n --theme-background-color:\n ${y||("dark"===w?a.Itv:a.p3h)};\n `,onClick:h.p7&&Z?De:void 0},o.ZP.createElement("div",{className:ze,style:He?`--custom-background: ${He}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),me&&he&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:be?Le:void 0},o.ZP.createElement(Vn,{chatId:me,threadId:he,messageListType:ge,isReady:Ae}),o.ZP.createElement(vt.Z,{name:N?"none":T===a.zy8?"slide":"fade",activeKey:A,shouldCleanup:!0,cleanupExceptionKey:Ne,onStop:Be},o.ZP.createElement(fo,{key:`${me}-${he}-${ge}`,chatId:me,threadId:he,type:ge,canPost:be,hasTools:Ee,onFabToggle:ie,onNotchToggle:ce,isReady:Ae,withBottomShift:ct,withDefaultBg:Boolean(!v&&!y)}),o.ZP.createElement("div",{className:it},be&&o.ZP.createElement(qi,{chatId:me,threadId:he,messageListType:ge,dropAreaState:se,onDropHide:Oe,isReady:Ae}),u&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ne.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Fe},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,ne("Chat.Pinned.UnpinAll",I,"i")))),rt&&o.ZP.createElement("div",{className:We},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,Je))),h.wB&&(pe||Re&&!ke)&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ne.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:qe},ne(Me?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&ke&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ne.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:qe},ne("ChannelJoinRequest"))),h.wB&&fe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ne.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:$e},ne("BotStart"))),h.wB&&Ie&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ne.isRtl?"rtl":void 0},o.ZP.createElement(kt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ge},ne("BotRestart"))),o.ZP.createElement(Gi,{messageListType:ge,isActive:S,canPost:be}),o.ZP.createElement(_i,{isOpen:M}),o.ZP.createElement(zi,{isOpen:R}))),o.ZP.createElement(vo,{isShown:Se,canPost:be,withExtraShift:dt})),h.wB&&o.ZP.createElement($i,{isActive:Boolean(E)})),t&&o.ZP.createElement(Hi,{isOpen:de,chatId:t,pinnedMessagesCount:I,onClose:Ue,onUnpin:je}),o.ZP.createElement("div",{teactFastList:!0},U?.map(((e,t)=>o.ZP.createElement(Vi,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),o.ZP.createElement(Wi,{isOpen:k}))}))),Ji=450+a.fK3,Qi=(0,T.Ds)((e=>e()),200,!1);var er;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Statistics=4]="Statistics",e[e.MessageStatistics=5]="MessageStatistics",e[e.Management=6]="Management",e[e.ManageInitial=7]="ManageInitial",e[e.ManageChannelSubscribers=8]="ManageChannelSubscribers",e[e.ManageChatAdministrators=9]="ManageChatAdministrators",e[e.ManageChatPrivacyType=10]="ManageChatPrivacyType",e[e.ManageDiscussion=11]="ManageDiscussion",e[e.ManageGroupPermissions=12]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=13]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=14]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=15]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=16]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=17]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=18]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=19]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=20]="ManageGroupMembers",e[e.ManageGroupAddAdmins=21]="ManageGroupAddAdmins",e[e.StickerSearch=22]="StickerSearch",e[e.GifSearch=23]="GifSearch",e[e.PollResults=24]="PollResults",e[e.AddingMembers=25]="AddingMembers",e[e.ManageInvites=26]="ManageInvites",e[e.ManageEditInvite=27]="ManageEditInvite",e[e.ManageReactions=28]="ManageReactions",e[e.ManageInviteInfo=29]="ManageInviteInfo",e[e.ManageJoinRequests=30]="ManageJoinRequests",e[e.CreateTopic=31]="CreateTopic",e[e.EditTopic=32]="EditTopic"}(er||(er={}));const tr=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,isProfile:s,isManagement:a,threadId:o}=t;const{query:r}=(0,c.n5)(e)||{},{query:d}=(0,c.y5)(e)||{},{query:u}=(0,c.yN)(e)||{},m=n?(0,c.Z1)(e,n):void 0,h=s&&n&&(0,l.YC)(n)?(0,c.dy)(e,n):void 0,g=m&&(0,l.eA)(m),p=m?.isForum&&Boolean(o&&o!==i._f),f=p?m.topics?.[o]:void 0,I=p&&f&&(0,l.GU)(m,f),v=h&&(0,l.cS)(h),w=h&&(0,l.kw)(h),y=Boolean(!a&&s&&!w&&m&&!(0,c.FM)(e,m.id)&&((0,l.YC)(m.id)||((0,l.Nl)(m)||m.isCreator)&&!m.isNotJoined)),P=Boolean(n&&e.management.byChatId[n]?.editingInvite),Z=!p&&m?.fullInfo?.canViewStatistics,C=n?e.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:y,canAddContact:w,canViewStatistics:Z,isChannel:g,isBot:v,isInsideTopic:p,canEditTopic:I,userId:h?.id,messageSearchQuery:r,stickerSearchQuery:d,gifSearchQuery:u,isEditingInvite:P,currentInviteInfo:C,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,threadId:a,isColumnOpen:i,isProfile:r,isSearch:c,isManagement:d,isStatistics:l,isMessageStatistics:u,isStickerSearch:g,isGifSearch:p,isPollResults:f,isCreatingTopic:I,isEditingTopic:v,isAddingChatMembers:w,profileState:y,managementScreen:P,canAddContact:Z,userId:C,canManage:b,isChannel:E,onClose:S,onScreenSelect:M,messageSearchQuery:R,stickerSearchQuery:k,gifSearchQuery:T,isEditingInvite:N,canViewStatistics:A,currentInviteInfo:x,shouldSkipHistoryAnimations:B,isBot:L,isInsideTopic:O,canEditTopic:F}=e;const{setLocalTextSearchQuery:U,setStickerSearchQuery:j,setGifSearchQuery:D,searchTextMessagesLocal:q,toggleManagement:$,openHistoryCalendar:G,openAddContactDialog:H,toggleStatistics:_,setEditingExportedInvite:V,deleteExportedChatInvite:W,openEditTopicPanel:X}=(0,s.Sv)(),[Y,K,J]=(0,ft.Z)(),Q=(0,o.I4)((()=>{V({chatId:n,invite:x}),M(m.u1.EditInvite)}),[n,x,M,V]),ee=(0,o.I4)((()=>{W({chatId:n,link:x.link}),M(m.u1.Invites),J()}),[n,J,x,W,M]),te=(0,o.I4)((e=>{U({query:e}),e.length&&Qi(q)}),[q,U]),ne=(0,o.I4)((e=>{j({query:e})}),[j]),se=(0,o.I4)((e=>{D({query:e})}),[D]),ae=(0,o.I4)((()=>{H({userId:C})}),[H,C]),oe=(0,o.I4)((()=>{n&&a&&X({chatId:n,topicId:a})}),[n,X,a]),[ie,re]=(0,o.eJ)(!i);(0,o.d4)((()=>{setTimeout((()=>{re(!i)}),Ji)}),[i]);const ce=(0,wt.Z)(),de=r?y===m.vi.Profile?er.Profile:y===m.vi.SharedMedia?er.SharedMedia:y===m.vi.MemberList?er.MemberList:-1:c?er.Search:f?er.PollResults:g?er.StickerSearch:p?er.GifSearch:w?er.AddingMembers:d?P===m.u1.Initial?er.ManageInitial:P===m.u1.ChatPrivacyType?er.ManageChatPrivacyType:P===m.u1.Discussion?er.ManageDiscussion:P===m.u1.ChannelSubscribers?er.ManageChannelSubscribers:P===m.u1.GroupPermissions?er.ManageGroupPermissions:P===m.u1.ChatAdministrators?er.ManageChatAdministrators:P===m.u1.GroupRemovedUsers?er.ManageGroupRemovedUsers:P===m.u1.ChannelRemovedUsers?er.ManageChannelRemovedUsers:P===m.u1.GroupUserPermissionsCreate?er.ManageGroupUserPermissionsCreate:P===m.u1.GroupUserPermissions?er.ManageGroupUserPermissions:P===m.u1.GroupRecentActions?er.ManageGroupRecentActions:P===m.u1.ChatAdminRights?er.ManageGroupAdminRights:P===m.u1.ChatNewAdminRights?er.ManageGroupNewAdminRights:P===m.u1.GroupMembers?er.ManageGroupMembers:P===m.u1.Invites?er.ManageInvites:P===m.u1.EditInvite?er.ManageEditInvite:P===m.u1.GroupAddAdmins?er.ManageGroupAddAdmins:P===m.u1.Reactions?er.ManageReactions:P===m.u1.InviteInfo?er.ManageInviteInfo:P===m.u1.JoinRequests?er.ManageJoinRequests:void 0:l?er.Statistics:u?er.MessageStatistics:I?er.CreateTopic:v?er.EditTopic:void 0,le=null!==(t=(0,hn.Z)(de,!0))&&void 0!==t?t:-1,ue=h.wB||de===er.SharedMedia||de===er.MemberList||de===er.AddingMembers||de===er.MessageStatistics||d,me=(0,_e.Z)("animated-close-icon",ue&&"state-back",(ie||B)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(kt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:S,ariaLabel:ce(ue?"Common.Back":"Common.Close")},o.ZP.createElement("div",{className:me})),o.ZP.createElement(vt.Z,{name:ie||B?"none":"slide-fade",activeKey:le},function(){if(-1!==le)switch(le){case er.PollResults:return o.ZP.createElement("h3",null,ce("PollResults"));case er.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Tt.Z,{parentContainerClassName:"RightSearch",value:R,onChange:te}),o.ZP.createElement(kt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>G({selectedAt:(0,z._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case er.AddingMembers:return o.ZP.createElement("h3",null,ce(E?"ChannelAddSubscribers":"GroupAddMembers"));case er.ManageInitial:return o.ZP.createElement("h3",null,ce("Edit"));case er.ManageChatPrivacyType:return o.ZP.createElement("h3",null,ce(E?"ChannelTypeHeader":"GroupTypeHeader"));case er.ManageDiscussion:return o.ZP.createElement("h3",null,ce("Discussion"));case er.ManageChatAdministrators:return o.ZP.createElement("h3",null,ce("ChannelAdministrators"));case er.ManageGroupRecentActions:return o.ZP.createElement("h3",null,ce("Group.Info.AdminLog"));case er.ManageGroupAdminRights:return o.ZP.createElement("h3",null,ce("EditAdminRights"));case er.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,ce("SetAsAdmin"));case er.ManageGroupPermissions:return o.ZP.createElement("h3",null,ce("ChannelPermissions"));case er.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,ce("BlockedUsers"));case er.ManageChannelRemovedUsers:return o.ZP.createElement("h3",null,ce("ChannelBlockedUsers"));case er.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,ce("ChannelAddException"));case er.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,ce("UserRestrictions"));case er.ManageInvites:return o.ZP.createElement("h3",null,ce("lng_group_invite_title"));case er.ManageEditInvite:return o.ZP.createElement("h3",null,ce(N?"EditLink":"NewLink"));case er.ManageInviteInfo:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,ce("InviteLink")),o.ZP.createElement("section",{className:"tools"},x&&!x.isRevoked&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ce("Edit"),onClick:Q},o.ZP.createElement("i",{className:"icon-edit"})),x&&x.isRevoked&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(kt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ce("Delete"),onClick:K},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(Pn.Z,{isOpen:Y,onClose:J,title:ce("DeleteLink"),text:ce("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ce("Delete"),confirmHandler:ee}))));case er.ManageJoinRequests:return o.ZP.createElement("h3",null,ce(E?"SubscribeRequests":"MemberRequests"));case er.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,ce("Channel.Management.AddModerator"));case er.StickerSearch:return o.ZP.createElement(Tt.Z,{value:k,placeholder:ce("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case er.GifSearch:return o.ZP.createElement(Tt.Z,{value:T,placeholder:ce("SearchGifsTitle"),autoFocusSearch:!0,onChange:se});case er.Statistics:return o.ZP.createElement("h3",null,ce(E?"ChannelStats.Title":"GroupStats.Title"));case er.MessageStatistics:return o.ZP.createElement("h3",null,ce("Stats.MessageTitle"));case er.SharedMedia:return o.ZP.createElement("h3",null,ce("SharedMedia"));case er.ManageChannelSubscribers:return o.ZP.createElement("h3",null,ce("ChannelSubscribers"));case er.MemberList:case er.ManageGroupMembers:return o.ZP.createElement("h3",null,ce("GroupMembers"));case er.ManageReactions:return o.ZP.createElement("h3",null,ce("Reactions"));case er.CreateTopic:return o.ZP.createElement("h3",null,ce("NewTopic"));case er.EditTopic:return o.ZP.createElement("h3",null,ce("EditTopic"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,ce(O?"AccDescrTopic":E?"Channel.TitleInfo":C?L?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),o.ZP.createElement("section",{className:"tools"},Z&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ce("AddContact"),onClick:ae},o.ZP.createElement("i",{className:"icon-add-user"})),b&&!O&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ce("Edit"),onClick:$},o.ZP.createElement("i",{className:"icon-edit"})),F&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ce("EditTopic"),onClick:oe},o.ZP.createElement("i",{className:"icon-edit"})),A&&o.ZP.createElement(kt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ce("Statistics"),onClick:_},o.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var nr=n(91),sr=n(3474),ar=n(27407);function or(e,t,n,s){const[o,i]=(0,ar.Z)(n?t:void 0,s,void 0,a.Vk);return[o,i,!(!o||!s||o[0]===s[0])]}function ir(e,t,n,s,i,r,c){const d=(0,o.sO)();(0,Ke.Z)((()=>{d.current=void 0}),[c]),(0,Ke.Z)((()=>{t===e&&i&&r&&(d.current=(0,l.R5)(i,r,e))}),[i,r,t,e]);const[u,m]=(0,ar.Z)(s?n:void 0,d.current,void 0,"media"===e?a.ENB:a.pnA);return[u,m,!(!u||!d.current||u[0]===d.current[0])]}const rr=(0,T.P2)((e=>e()),250,!1);let cr=!1;var dr=n(21273),lr=n(31876),ur=n(16568),mr=n(70180),hr=n(13709),gr=n(45418),pr=n(47262),fr=n(41151),Ir=n(22275);const vr=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function wr(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const yr=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,topicId:s}=t;const a=(0,c.Z1)(e,n),o=(0,c.Zw)(e,n),{currentType:r,resultsByType:d}=(0,c.we)(e)||{},{foundIds:u}=d&&r&&d[r]||{},m=(0,c.gb)(e,n,s||i._f),{byId:h,statusesById:g}=e.users,{byId:p}=e.chats,f=a&&(0,l.Bf)(a),I=a&&(0,l.eA)(a),v=!s&&(f||I&&(0,l.Nl)(a)),w=a?.fullInfo?.members,y=a?.fullInfo?.adminMembersById,P=v&&a&&(a.isForbidden||a.fullInfo&&!a.fullInfo.canViewMembers),Z=v&&a&&((0,l.VE)(a,"inviteUsers")||!(0,l.Mg)(a,"inviteUsers")||a.isCreator),C=v&&a&&((0,l.VE)(a,"banUsers")||a.isCreator),b=(0,c.xs)(e,n);let E,S,M;return(0,l.YC)(n)&&(S=n,M=(0,c.dy)(e,S),E=M&&!M.isSelf&&!(0,l.cS)(M)),{theme:(0,c.Pu)(e),isChannel:I,resolvedUserId:S,messagesById:o,foundIds:u,messageIds:m,mediaSearchType:r,hasCommonChatsTab:E,hasMembersTab:v,areMembersHidden:P,canAddMembers:Z,canDeleteMembers:C,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:a?.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:b,usersById:h,userStatusesById:g,chatsById:p,isChatProtected:a?.isProtected,...v&&w&&{members:w,adminMembersById:y},...E&&M&&{commonChatIds:M.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:n,profileState:r,onProfileStateChange:c,theme:d,isChannel:u,resolvedUserId:p,currentUserId:f,messagesById:I,foundIds:v,messageIds:w,mediaSearchType:y,hasCommonChatsTab:P,hasMembersTab:Z,areMembersHidden:C,canAddMembers:b,canDeleteMembers:E,commonChatIds:S,members:M,adminMembersById:R,usersById:k,userStatusesById:T,chatsById:N,isRightColumnShown:A,isRestricted:x,lastSyncTime:B,activeDownloadIds:L,serverTimeOffset:O,isChatProtected:F}=e;const{setLocalMediaSearchType:U,loadMoreMembers:j,loadCommonChats:D,openChat:q,searchMediaMessagesLocal:$,openMediaViewer:G,openAudioPlayer:H,focusMessage:_,loadProfilePhotos:V,setNewChatMembersDialogState:z}=(0,s.Sv)(),W=(0,o.sO)(null),X=(0,o.sO)(null),Y=(0,wt.Z)(),[K,J]=(0,o.eJ)(0),[Q,ee]=(0,o.eJ)(),te=(0,o.Ye)((()=>[...Z?[{type:"members",title:u?"ChannelSubscribers":"GroupMembers"}]:[],...vr,...n?[]:[{type:"voice",title:"SharedVoiceTab2"}],...P?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[P,Z,u,n]),ne=K>te.length-1?te.length-1:K,se=te[ne].type,ae=(0,o.Ye)((()=>w&&I?(0,g.q0)(I,w):{}),[I,w]),[oe,ie,re,ce]=function(e,t,n,s,a,i,r,c,d,u,m,h,g){let p=arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,f=arguments.length>14?arguments[14]:void 0;const I="members"!==s&&a?a:s,v=(0,o.Ye)((()=>{if(i&&c&&d)return(0,l.Z0)(i.map((e=>{let{userId:t}=e;return t})),c,d,void 0,p)}),[i,p,c,d]),w=(0,o.Ye)((()=>{if(r&&u)return(0,l.ih)(r,u,!0)}),[u,r]),[y,P,Z]=or(0,e,g,v),[C,b,E]=ir("media",I,n,g,m,h,f),[S,M,R]=ir("documents",I,n,g,m,h,f),[k,T,N]=ir("links",I,n,g,m,h,f),[A,x,B]=ir("audio",I,n,g,m,h,f),[L,O,F]=ir("voice",I,n,g,m,h,f),[U,j,D]=or(0,t,g,w);let q,$,G=!1;switch(I){case"members":q=y,$=P,G=Z;break;case"commonChats":q=U,$=j,G=D;break;case"media":q=C,$=b,G=E;break;case"documents":q=S,$=M,G=R;break;case"links":q=k,$=T,G=N;break;case"audio":q=A,$=x,G=B;break;case"voice":q=L,$=O,G=F}return[I,q,$,G]}(j,D,$,se,y,M,S,k,T,N,ae,v,B,O,n),de="members"===oe||!Z&&"media"===oe,le=te.findIndex((e=>{let{type:t}=e;return t===oe})),{handleScroll:ue}=function(e,t,n,s,a){(0,We.Z)((n=>{let[o,i]=n;if(a!==i&&o&&o!==t){const n=e.current,a=n.querySelector(".TabList");n.scrollTop<a.offsetTop&&(s("members"===t?m.vi.MemberList:m.vi.SharedMedia),cr=!0,(0,Kn.Z)(n,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{cr=!1}),350))}}),[t,a,s]),(0,We.Z)((t=>{let[a]=t;if(n!==m.vi.Profile||n===a)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(cr=!0,(0,Kn.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{cr=!1}),350),s(n))}),[n]);const i=(0,o.I4)((()=>{const n=e.current;if(!n)return;const a=n.querySelector(".TabList");if(!a)return;let o=m.vi.Profile;n.scrollTop>=a.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),s(o)}),[e,s,t]);return(0,o.d4)((()=>{cr||i()}),[i,t]),{handleScroll:(0,o.I4)((()=>{cr||rr(i)}),[i])}}(W,se,r,c,de),{applyTransitionFix:me,releaseTransitionFix:he}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,o.d4)((()=>{function n(){const n=e.current,s=n.querySelector(t),a=n.querySelector(".TabList");s&&a&&(s.style.minHeight=n.offsetHeight-a.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,o.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=`${e}px`}}),[e]),s=(0,o.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e]);return{applyTransitionFix:n,releaseTransitionFix:s}}(W),[ge,pe]=(0,sr.Z)(),{observe:fe}=(0,ns.S1)({rootRef:W,throttleMs:500}),Ie=(0,o.I4)((()=>{he(),pe()}),[he,pe]),ve=(0,o.I4)((()=>{z(m.WB.InProgress)}),[z]);(0,o.d4)((()=>{U({mediaType:se})}),[U,se,n]);const we=p||t;(0,o.d4)((()=>{B&&V({profileId:we})}),[V,we,B]);const ye=(0,o.I4)((e=>{G({chatId:we,threadId:i._f,mediaId:e,origin:m.bZ.SharedMedia})}),[we,G]),Pe=(0,o.I4)((e=>{H({chatId:we,messageId:e})}),[we,H]),Ze=(0,o.I4)((e=>{q({id:e})}),[q]),Ce=(0,o.I4)((e=>{_({chatId:we,messageId:e})}),[we,_]),be=(0,o.I4)((()=>{ee(void 0)}),[]);let Ee;(0,We.Z)((e=>{let[t]=e;if(0===K||t===Z)return;const n=K+(Z?1:-1);J(Math.min(n,te.length-1))}),[Z,K,te]),(0,o.d4)((()=>{if(X.current&&h.$b)return(0,Ut.sf)(X.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Ut.eM.Left?(J(Math.min(ne+1,te.length-1)),!0):t===Ut.eM.Right&&(J(Math.max(0,ne-1)),!0)})}),[ne,te.length]),de?Ee=A?0:1e3:ie||(Ee=a.Yan);const Se=(0,Mi.Z)([t,n,oe,ne],Ee);return o.ZP.createElement(dr.Z,{ref:W,className:"Profile custom-scroll",itemSelector:wr(oe),items:Se?ie:void 0,cacheBuster:ge,sensitiveArea:a.qUX,preloadBackwards:Se?"members"===oe?a.Vk:a.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:re,onScroll:ue},!ce&&function(e,t,n){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(ur.Z,{userId:t||e,canPlayVideo:n}),o.ZP.createElement(mr.Z,{chatOrUserId:t||e}))}(t,p,A&&Se),!x&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(vt.Z,{ref:X,name:Y.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:le,renderCount:te.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:me,onStop:Ie},function(){if(!ie||!Se||!ae){const e=de&&!Se,t=Boolean("members"===oe&&C);return o.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&o.ZP.createElement(Bt.Z,null),t&&o.ZP.createElement(pr.Z,{text:"You have no access to group members list."}))}if(!ie.length){let e;switch(oe){case"members":e=C?"You have no access to group members list.":"No members found";break;case"commonChats":e=Y("NoGroupsInCommon");break;case"documents":e=Y("lng_media_file_empty");break;case"links":e=Y("lng_media_link_empty");break;case"audio":e=Y("lng_media_song_empty");break;case"voice":e=Y("lng_media_audio_empty");break;default:e=Y("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(pr.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${oe}-list`,dir:Y.isRtl&&"media"===oe?"rtl":void 0,teactFastList:!0},"media"===oe?ie.map((e=>ae[e]&&o.ZP.createElement(hr.Z,{key:e,message:ae[e],isProtected:F||ae[e].isProtected,observeIntersection:fe,onClick:ye}))):"documents"===oe?ie.map((e=>ae[e]&&o.ZP.createElement(Ts.Z,{key:e,message:ae[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:L.includes(e),observeIntersection:fe,onDateClick:Ce}))):"links"===oe?ie.map((e=>ae[e]&&o.ZP.createElement(gr.Z,{key:e,message:ae[e],isProtected:F||ae[e].isProtected,observeIntersection:fe,onMessageClick:Ce}))):"audio"===oe?ie.map((e=>ae[e]&&o.ZP.createElement(Ns.ZP,{key:e,theme:d,message:ae[e],origin:m.Cr.SharedMedia,date:ae[e].date,lastSyncTime:B,className:"scroll-item",onPlay:Pe,onDateClick:Ce,canDownload:!F&&!ae[e].isProtected,isDownloading:L.includes(e)}))):"voice"===oe?ie.map((e=>ae[e]&&o.ZP.createElement(Ns.ZP,{key:e,theme:d,message:ae[e],senderTitle:(0,nr.F)(Y,ae[e],N,k),origin:m.Cr.SharedMedia,date:ae[e].date,lastSyncTime:B,className:"scroll-item",onPlay:Pe,onDateClick:Ce,canDownload:!F&&!ae[e].isProtected,isDownloading:L.includes(e)}))):"members"===oe?ie.map(((e,t)=>{return o.ZP.createElement(lr.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>Ze(e),contextActions:(n=e,n!==f&&E?[{title:Y("lng_context_remove_from_group"),icon:"stop",handler:()=>{ee(n)}}]:void 0)},o.ZP.createElement(gn.Z,{userId:e,adminMember:R?.[e],forceShowSelf:!0}));var n})):"commonChats"===oe?ie.map(((e,t)=>o.ZP.createElement(lr.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>q({id:e})},o.ZP.createElement(pn.Z,{chatId:e})))):void 0)}()),o.ZP.createElement(Dt.Z,{big:!0,activeTab:ne,tabs:te,onSwitchTab:J})),b&&o.ZP.createElement(fr.Z,{isShown:"members"===oe,onClick:ve,ariaLabel:Y("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),E&&o.ZP.createElement(Ir.Z,{isOpen:Boolean(Q),userId:Q,onClose:be}))}))),Pr=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),Zr=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),Cr=e=>{const t=(0,ct.Z)(rt.gl.Extra,"Statistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)},br=e=>{const t=(0,ct.Z)(rt.gl.Extra,"MessageStatistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)},Er=(0,o.X$)((()=>{const e=(0,ct.Z)(rt.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Gt.Z,null)})),Sr=(0,o.X$)((()=>{const e=(0,ct.Z)(rt.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Gt.Z,null)})),Mr=(0,o.X$)((()=>{const e=(0,ct.Z)(rt.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(Gt.Z,null)}));var Rr=n(11820);const kr=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),{userIds:a}=e.contactList||{},{byId:o}=e.chats,{currentUserId:i,newChatMembersProgress:r}=e,d=s&&(0,l.eA)(s),{query:u,fetchingStatus:h,globalUserIds:g,localUserIds:p}=e.userSearch;return{isChannel:d,members:s?.fullInfo?.members,currentUserId:i,chatsById:o,localContactIds:a,searchQuery:u,isSearching:h,isLoading:r===m.WB.Loading,globalUserIds:g,localUserIds:p}}))((e=>{let{isChannel:t,members:n,onNextStep:a,currentUserId:i,chatsById:r,localContactIds:c,isLoading:d,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,onClose:f,isActive:I}=e;const{setUserSearchQuery:v}=(0,s.Sv)(),w=(0,wt.Z)(),[y,P]=(0,o.eJ)([]),Z=(0,ln.Z)(y)===y;(0,jt.Z)({isActive:I,onBack:f});const C=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),b=(0,o.I4)((e=>{v({query:e})}),[v]),E=(0,o.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=c?(0,l.kK)(c,e,u):[];return(0,l.ih)((0,g.Tw)([...n,...h||[],...p||[]]).filter((n=>{const s=e[n];return!C.includes(n)&&n!==i&&(!s||!(0,l.cS)(s)||!t&&s.canBeInvitedToGroup)})),r)}),[c,r,u,h,p,i,C,t]),S=(0,o.I4)((()=>{y.length&&(v({query:""}),a(y))}),[y,v,a]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(Rr.Z,{itemIds:E,selectedIds:y,filterValue:u,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:P,onFilterChange:b,noScrollRestore:Z}),o.ZP.createElement(fr.Z,{isShown:Boolean(y.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:S},d?o.ZP.createElement(Bt.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Tr=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"CreateTopic");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),Nr=(0,o.X$)((e=>{const t=(0,ct.Z)(rt.gl.Extra,"EditTopic");return t?o.ZP.createElement(t,e):o.ZP.createElement(Gt.Z,null)})),Ar=450+a.fK3,xr=Object.keys(m.qt).length/2,Br=Object.keys(m.u1).length/2;function Lr(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Or=(0,o.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},s=(0,c.g4)(e),a=t?e.management.byChatId[t]?.nextScreen:void 0,o=(t?(0,c.Z1)(e,t)?.isForum:void 0)&&Boolean(n&&n!==i._f);return{contentKey:(0,c.Wq)(e),chatId:t,threadId:n,isInsideTopic:o,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,nextManagementScreen:a}}))((e=>{var t;let{contentKey:n,chatId:i,threadId:r,isInsideTopic:c,isChatSelected:d,shouldSkipHistoryAnimations:l,nextManagementScreen:u}=e;const{toggleChatInfo:h,toggleManagement:g,closeLocalTextSearch:p,setStickerSearchQuery:f,setGifSearchQuery:I,closePollResults:v,addChatMembers:w,setNewChatMembersDialogState:y,setEditingExportedInvite:P,toggleStatistics:Z,toggleMessageStatistics:C,setOpenedInviteInfo:b,requestNextManagementScreen:E,closeCreateTopicPanel:S,closeEditTopicPanel:M}=(0,s.Sv)(),{width:R}=(0,cn.Z)(),[k,T]=(0,o.eJ)(m.vi.Profile),[N,A]=(0,o.eJ)(m.u1.Initial),[x,B]=(0,o.eJ)(),[L,O]=(0,o.eJ)(),F=k!==m.vi.Profile,U=void 0!==n,j=n===m.qt.ChatInfo,D=n===m.qt.Search,q=n===m.qt.Management,$=n===m.qt.Statistics,G=n===m.qt.MessageStatistics,H=n===m.qt.StickerSearch,_=n===m.qt.GifSearch,V=n===m.qt.PollResults,z=n===m.qt.AddingMembers,W=n===m.qt.CreateTopic,X=n===m.qt.EditTopic,Y=R<=a._mX,[K,J]=(0,o.eJ)(!U),Q=null!==(t=(0,hn.Z)(n,!0,!d))&&void 0!==t?t:-1,ee=(0,o.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case m.qt.AddingMembers:y(m.WB.Closed);break;case m.qt.ChatInfo:if(F&&e){T(m.vi.Profile);break}h(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(N){case m.u1.Initial:g();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:A(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:A(m.u1.GroupPermissions),B(void 0),O(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:A(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:A(m.u1.Invites),b({invite:void 0}),P({chatId:i,invite:void 0})}break;case m.qt.MessageStatistics:C();break;case m.qt.Statistics:Z();break;case m.qt.Search:Lr(),p();break;case m.qt.StickerSearch:Lr(),f({query:void 0});break;case m.qt.GifSearch:Lr(),I({query:void 0});break;case m.qt.PollResults:v();break;case m.qt.CreateTopic:S();break;case m.qt.EditTopic:M()}}),[n,F,h,v,y,N,g,p,f,I,P,i,b,Z,C,S,M]),te=(0,o.I4)(((e,t)=>{B(e),O(t)}),[]),ne=(0,o.I4)((e=>{w({chatId:i,memberIds:e})}),[w,i]);function se(e){if(-1!==Q)switch(Q){case m.qt.AddingMembers:return o.ZP.createElement(kr,{key:i,chatId:i,isActive:U&&e,onNextStep:ne,onClose:ee});case m.qt.ChatInfo:return o.ZP.createElement(yr,{key:i,chatId:i,topicId:c?r:void 0,profileState:k,onProfileStateChange:T});case m.qt.Search:return o.ZP.createElement(Pr,{chatId:i,threadId:r,onClose:ee,isActive:U&&e});case m.qt.Management:return o.ZP.createElement(Zr,{key:i,chatId:i,currentScreen:N,isPromotedByCurrentUser:L,selectedChatMemberId:x,isActive:U&&e,onScreenSelect:A,onChatMemberSelect:te,onClose:ee});case m.qt.Statistics:return o.ZP.createElement(Cr,{chatId:i});case m.qt.MessageStatistics:return o.ZP.createElement(br,{chatId:i,isActive:U&&e});case m.qt.StickerSearch:return o.ZP.createElement(Er,{onClose:ee,isActive:U&&e});case m.qt.GifSearch:return o.ZP.createElement(Sr,{onClose:ee,isActive:U&&e});case m.qt.PollResults:return o.ZP.createElement(Mr,{onClose:ee,isActive:U&&e});case m.qt.CreateTopic:return o.ZP.createElement(Tr,{onClose:ee,isActive:U&&e});case m.qt.EditTopic:return o.ZP.createElement(Nr,{onClose:ee,isActive:U&&e})}}return(0,o.d4)((()=>U?(0,gt.Z)(ee):void 0),[U,ee]),(0,o.d4)((()=>{setTimeout((()=>{J(!U)}),Ar)}),[U]),(0,o.d4)((()=>{u&&(A(u),E(void 0))}),[u,E]),(0,o.d4)((()=>{U&&Y&&ee()}),[Y]),(0,es.Z)((e=>{let[t]=e;t!==i&&(T(m.vi.Profile),A(m.u1.Initial))}),[i]),(0,jt.Z)({isActive:d&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers||n===m.qt.CreateTopic||n===m.qt.EditTopic),onBack:()=>ee(!1)}),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:d?void 0:"is-hidden"},Y&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:ee}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(tr,{chatId:i,threadId:r,isColumnOpen:U,isProfile:j,isSearch:D,isManagement:q,isStatistics:$,isMessageStatistics:G,isStickerSearch:H,isGifSearch:_,isPollResults:V,isCreatingTopic:W,isEditingTopic:X,isAddingChatMembers:z,profileState:k,managementScreen:N,onClose:ee,onScreenSelect:A}),o.ZP.createElement(vt.Z,{name:K||l?"none":"zoom-fade",renderCount:xr+Br,activeKey:q?xr+N:Q,shouldCleanup:!0,cleanupExceptionKey:Q===m.qt.MessageStatistics?m.qt.Statistics:void 0},se)))}))),Fr=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,ct.Z)(rt.gl.Extra,"MediaViewer",!t);return n?o.ZP.createElement(n,null):void 0}));let Ur=[],jr=!1;function Dr(e,t){Ur.push({url:e,filename:t}),jr||(jr=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Ur)qr(t),e++,10===e&&(await(0,T.wO)(1e3),e=0);Ur=[]}(),jr=!1}),1e3))}function qr(e){let{url:t,filename:n}=e;const s=document.createElement("a");s.href=t,s.download=n;try{s.click()}catch(e){console.error(e)}}const $r=new Set,Gr=new Set,Hr=(0,o.X$)((0,s.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:a,showNotification:r}=(0,s.Sv)(),c=(0,Jn.Z)(1e3,!0),d=(0,o.I4)((e=>{Gr.add(e),c((()=>{Gr.size&&(a({messages:Array.from(Gr)}),Gr.clear())}))}),[a,c]);(0,o.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,s]=e;return s.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{if($r.has(e))return;$r.add(e);const t=(0,l.Ti)(e,"download");if(!t)return void d(e);const n=Ie.UV(t);if(n)return Dr(n,(0,l.w6)(e)),void d(e);const{document:s,video:a,audio:o}=e.content;if(((s||a||o)?.size||0)>h.l0&&!h.rT&&!h.Mc)return r({message:"Downloading files bigger than 2GB is not supported in your browser."}),void d(e);const c=(0,l.kG)(e,"download");Ie.he(t,c,!0).then((t=>{if(c===i.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),s=(0,l.w6)(e);n.searchParams.set("filename",encodeURIComponent(s)),window.open(n.toString())?.addEventListener("beforeunload",(()=>{r({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&Dr(t,(0,l.w6)(e));d(e)}))})):$r.clear()}),[n,t,a,d,r])})));var _r=n(13103);const Vr=(0,o.X$)((0,s.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:s}=n||{},a=s&&(0,c.Z1)(e,s);return{canPost:Boolean(a)&&(0,l.Qm)(a,i._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:s}=e;const{closeGame:a,openForwardMenu:i}=(0,K.Sv)(),r=(0,wt.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,No.Z)(d);(0,ot.Z)((()=>{m({type:"playingGame"})}),u&&s?5e3:void 0);const h=(0,o.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:d,messageIds:[l],withMyScore:!0}),a()),"share_game"===t.eventType&&(i({fromChatId:d,messageIds:[l]}),a())}catch(e){}}),[d,a,l,i]),g=(0,o.I4)((e=>{e.currentTarget.focus()}),[]);return(0,o.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,o.d4)((()=>{if(u)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[u]),o.ZP.createElement(_r.Z,{className:"GameModal",isOpen:u,onClose:a,title:n,hasCloseButton:!0},u&&o.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),zr=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,ct.Z)(rt.gl.Extra,"Notifications",!t);return n?o.ZP.createElement(n,null):void 0})),Wr=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,ct.Z)(rt.gl.Extra,"Dialogs",!t);return n?o.ZP.createElement(n,null):void 0})),Xr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"ForwardRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),Yr=(0,o.X$)((e=>{const{url:t}=e,n=(0,ct.Z)(rt.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),Kr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Jr=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,ct.Z)(rt.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),Qr=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,ct.Z)(rt.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),ec=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,ct.Z)(rt.gl.Calls,"PhoneCall",!t);return n?o.ZP.createElement(n,null):void 0}));function tc(){return tc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},tc.apply(this,arguments)}const nc=(0,o.X$)((0,K.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,K.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},a=e=>{let{chatId:t,type:n,threadId:a}=e;(0,jt.Z)({isActive:!0,hash:(0,it.tB)(t,n,a),onBack:s})};return o.ZP.createElement("div",null,t?.map(((e,t)=>o.ZP.createElement(a,tc({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),sc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"NewContactModal",!t);return n?o.ZP.createElement(n,e):void 0})),ac=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Calls,"RatePhoneCallModal",!t);return n?o.ZP.createElement(n,e):void 0})),oc=(0,o.X$)((e=>{const{webApp:t}=e,n=(0,ct.Z)(rt.gl.Extra,"WebAppModal",!t);return n?o.ZP.createElement(n,e):void 0})),ic=(0,o.X$)((e=>{const{bot:t}=e,n=(0,ct.Z)(rt.gl.Extra,"BotTrustModal",!t);return n?o.ZP.createElement(n,e):void 0})),rc=(0,o.X$)((e=>{const{bot:t}=e,n=(0,ct.Z)(rt.gl.Extra,"AttachBotInstallModal",!t);return n?o.ZP.createElement(n,e):void 0})),cc={root:"vfd0Bo1X6k19aaxQ577t"},dc=h.wB?50:100,lc=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],uc=(0,o.X$)((0,s.c$)((e=>(0,g.ei)(e,["confetti"])))((e=>{let{confetti:t}=e;const n=(0,o.sO)(null),s=(0,o.sO)([]),a=(0,o.sO)(!1),i=(0,cn.Z)(),r=(0,nt.Z)(),{lastConfettiTime:c,top:d,width:l,left:u,height:m}=t||{},h=()=>{if(!n.current||!a.current)return;const e=n.current,t=e.getContext("2d");if(!t)return;const{width:o,height:i}=e;t.clearRect(0,0,o,i);const r=[];s.current.forEach(((e,n)=>{const{pos:a,velocity:o,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:a.x+o.x*p,y:a.y+o.y*p},I={x:.98*o.x,y:o.y+=1e3*p},v=c*Math.abs(Math.sin(g*u)),w=5*g*u*(Math.PI/180),y=g+1,P=Date.now();if(f.y>i+e.size)return void r.push(e);const Z={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:P,frameCount:y};s.current[n]=Z,t.fillStyle=d,t.beginPath(),t.ellipse(a.x,a.y,c,l,m,0,2*Math.PI),t.fill()})),s.current=s.current.filter((e=>!r.includes(e))),s.current.length?requestAnimationFrame(h):a.current=!1};if((0,Ke.Z)((e=>{let t,[n]=e;return n!==c&&(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dc;for(let a=0;a<n;a++){const n=a%2,o={x:e*(n?-.1:1.1),y:.75*t},i=Math.random()*e*1.5,r={x:n?i:-1*i,y:-t/2-Math.random()*t},c=lc[Math.floor(Math.random()*lc.length)],d=10;s.current.push({pos:o,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}(l||i.width,m||i.height),t=setTimeout(r,1e4),a.current||(a.current=!0,requestAnimationFrame(h))),()=>{t&&clearTimeout(t)}}),[c,h]),!c||Date.now()-c>1e4)return;const g=(0,js.Z)(Boolean(d)&&`top: ${d}px`,Boolean(u)&&`left: ${u}px`,Boolean(l)&&`width: ${l}px`,Boolean(m)&&`height: ${m}px`);return o.ZP.createElement("div",{id:"Confetti",className:cc.root,style:g},o.ZP.createElement("canvas",{ref:n,className:cc.canvas,width:i.width,height:i.height}))}))),mc=(0,o.X$)((e=>{const{urlAuth:t}=e,n=(0,ct.Z)(rt.gl.Extra,"UrlAuthModal",!t);return n?o.ZP.createElement(n,e):void 0})),hc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"PremiumMainModal",!t);return n?o.ZP.createElement(n,e):void 0})),gc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),pc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,ct.Z)(rt.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),fc=(0,o.X$)((e=>{const{limit:t}=e,n=(0,ct.Z)(rt.gl.Extra,"PremiumLimitReachedModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ic=(0,o.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,ct.Z)(rt.gl.Extra,"DeleteFolderDialog",!t);return n?o.ZP.createElement(n,e):void 0})),vc=(0,o.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,ct.Z)(rt.gl.Extra,"CustomEmojiSetsModal",!t);return n?o.ZP.createElement(n,e):void 0})),wc=(0,o.X$)((e=>{const{requestedDraft:t}=e,n=(0,ct.Z)(rt.gl.Extra,"DraftRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),yc=(0,o.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,ct.Z)(rt.gl.Extra,"AttachBotRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0}));let Pc,Zc=!1;function Cc(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function bc(e){document.title!==e&&(document.title=e)}const Ec=(0,o.X$)((0,s.c$)((e=>{const{settings:{byKey:{animationLevel:t,language:n,wasTimeFormatSetManually:s}},botTrustRequest:a,requestedAttachBotInstall:o,requestedAttachBotInChat:i,requestedDraft:r,urlAuth:d,webApp:l,safeLinkModalUrl:u,lastSyncTime:m,openedStickerSetShortName:h,openedCustomEmojiSetIds:g,shouldSkipHistoryAnimations:p}=e,{chatId:f,messageId:I}=e.audioPlayer,v=f&&I?(0,c.hj)(e,f,I):void 0,w=e.openedGame,y=(w&&(0,c.hj)(e,w.chatId,w.messageId))?.content.game?.title,P=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;return{lastSyncTime:m,isLeftColumnOpen:e.isLeftColumnShown,isRightColumnOpen:(0,c.Jf)(e),isMediaViewerOpen:(0,c.zQ)(e),isForwardModalOpen:(0,c.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:v,safeLinkModalUrl:u,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:p,openedStickerSetShortName:h,openedCustomEmojiSetIds:g,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:t,language:n,wasTimeFormatSetManually:s,isPhoneCallActive:Boolean(e.phoneCall),addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:e.newContact?.userId,newContactByPhoneNumber:e.newContact?.isByPhoneNumber,openedGame:w,gameTitle:y,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall),botTrustRequest:a,botTrustRequestBot:a&&(0,c.dy)(e,a.botId),attachBotToInstall:o&&(0,c.dy)(e,o.botId),requestedAttachBotInChat:i,webApp:l,currentUser:P,urlAuth:d,isPremiumModalOpen:e.premiumModal?.isOpen,limitReached:e.limitReachedModal?.limit,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),deleteFolderDialogId:e.deleteFolderDialogModal,requestedDraft:r}}))((e=>{let{lastSyncTime:t,isLeftColumnOpen:n,isRightColumnOpen:i,isMediaViewerOpen:r,isForwardModalOpen:c,hasNotifications:d,hasDialogs:l,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:f,limitReached:I,openedStickerSetShortName:v,openedCustomEmojiSetIds:w,isServiceChatReady:y,animationLevel:P,language:Z,wasTimeFormatSetManually:C,addedSetIds:b,addedCustomEmojiIds:E,isPhoneCallActive:S,newContactUserId:M,newContactByPhoneNumber:R,openedGame:k,gameTitle:N,isRatePhoneCallModalOpen:A,botTrustRequest:x,botTrustRequestBot:B,attachBotToInstall:L,requestedAttachBotInChat:O,requestedDraft:F,webApp:U,currentUser:j,urlAuth:D,isPremiumModalOpen:q,isPaymentModalOpen:$,isReceiptModalOpen:G,deleteFolderDialogId:H}=e;const{loadAnimatedEmojis:_,loadNotificationSettings:V,loadNotificationExceptions:z,updateIsOnline:W,loadTopInlineBots:X,loadEmojiKeywords:Y,loadCountryList:K,loadAvailableReactions:Q,loadStickerSets:ee,loadPremiumGifts:te,loadDefaultTopicIcons:ne,loadAddedStickers:se,loadFavoriteStickers:ae,ensureTimeFormat:oe,closeStickerSetModal:ie,closeCustomEmojiSets:re,checkVersionNotification:ce,loadConfig:de,loadAppConfig:le,loadAttachBots:ue,loadContactList:me,loadCustomEmojis:he,loadGenericEmojiEffects:ge,closePaymentModal:pe,clearReceipt:fe,checkAppVersion:Ie,openChat:ve}=(0,s.Sv)();a.eMD&&!Zc&&(Zc=!0,console.log(">>> RENDER MAIN")),(0,ot.Z)(Ie,3e5,!0),(0,o.d4)((()=>{t&&(W(!0),de(),le(),Q(),_(),ge(),V(),z(),X(),Y({language:a.pRL}),ue(),me(),te(),ne(),Ie())}),[t,_,Y,z,V,X,W,Q,le,ue,me,te,Ie,de,ge,ne]),(0,o.d4)((()=>{t&&(Z!==a.pRL&&Y({language:Z}),K({langCode:Z}))}),[Z,t,K,Y]),(0,We.Z)((e=>{let[n]=e;!n&&t&&he({ids:Object.keys((0,s.Rd)().customEmojis.byId),ignoreCache:!0})}),[t]),(0,o.d4)((()=>{t&&(b&&E||(ee(),ae()),b&&E&&se())}),[t,b,ee,ae,se,E]),(0,o.d4)((()=>{t&&y&&ce()}),[t,y,ce]),(0,o.d4)((()=>{t&&!C&&oe()}),[t,C,oe]),(0,o.d4)((()=>{const e=(0,it.dx)();t&&e?.tgaddr&&(0,ze.ou)(decodeURIComponent(e.tgaddr))}),[t]),(0,We.Z)((e=>{let[n]=e;const s=(0,it.VX)();s&&!n&&t&&ve({id:s.chatId,threadId:s.threadId,type:s.type})}),[t]),(0,o.d4)((()=>{if(m||S)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[m,S]);const we=(0,st.Z)(n,void 0,!0,void 0,f),ye=(0,o.sO)(!1),Pe=(0,nt.Z)();(0,Ke.Z)((e=>{let[t]=e;if(void 0===t||0===P)return;ye.current=!0,h.wZ&&(0,T.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!n)}));const s=(0,at.YW)();(0,Ve.L)(document.getElementById("MiddleColumn"),(()=>{s(),ye.current=!1,Pe()}))}),[n]);const Ze=(0,st.Z)(i,void 0,!0,void 0,f),Ce=(0,o.sO)(!1),[Ee,Se]=(0,o.eJ)(i);(0,Ke.Z)((e=>{let[t]=e;if(void 0===t)return;if(0===P)return void Se(i);Ce.current=!0;const n=(0,at.YW)();(0,Ve.L)(document.getElementById("RightColumn"),(()=>{n(),Ce.current=!1,Pe(),Se(i)}))}),[i]);const Me=(0,_e.Z)(we.hasShownClass&&"left-column-shown",we.hasOpenClass&&"left-column-open",ye.current&&"left-column-animating",Ze.hasShownClass&&"right-column-shown",Ze.hasOpenClass&&"right-column-open",Ce.current&&"right-column-animating",Ee&&"narrow-message-list",f&&"history-animation-disabled"),Re=(0,o.I4)((()=>{W(!1);const e=(0,J.xW)();let t=0;clearInterval(Pc),Pc=window.setInterval((()=>{if(document.title.includes(a.ouc))Cc(!1);else{if(t%2==0){const t=(0,J.xW)()-e;t>0&&(bc(`${t} notification${t>1?"s":""}`),Cc(!0))}else bc(a.Tih),Cc(!1);t++}}),1e3)}),[W]),ke=(0,o.I4)((()=>{W(!0),clearInterval(Pc),Pc=void 0,document.title.includes(a.ouc)||bc(a.Tih),Cc(!1)}),[W]),Te=(0,o.I4)((()=>{ie()}),[ie]),Ne=(0,o.I4)((()=>{re()}),[re]);return(0,Xe.Z)(Re,ke),Ye(Re),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,o.d4)((()=>{if(h.$b){if(!e)return Je?.setAttribute("content",Qe),h.cj&&!h.fl&&document.addEventListener("gesturestart",tt),()=>{Je?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",tt)};Je?.setAttribute("content",et)}}),[e])}(r),o.ZP.createElement("div",{id:"Main",className:Me},o.ZP.createElement(sn,null),o.ZP.createElement(Ki,null),o.ZP.createElement(Or,null),o.ZP.createElement(Fr,{isOpen:r}),o.ZP.createElement(Xr,{isOpen:c}),o.ZP.createElement(wc,{requestedDraft:F}),o.ZP.createElement(zr,{isOpen:d}),o.ZP.createElement(Wr,{isOpen:l}),u&&o.ZP.createElement($n,{key:u.id,message:u,noUi:!0}),o.ZP.createElement(Yr,{url:g}),o.ZP.createElement(mc,{urlAuth:D,currentUser:j}),o.ZP.createElement(Kr,{isOpen:p}),o.ZP.createElement(dt,{isOpen:Boolean(v),onClose:Te,stickerSetShortName:v}),o.ZP.createElement(vc,{customEmojiSetIds:w,onClose:Ne}),m&&o.ZP.createElement(Jr,{groupCallId:m}),o.ZP.createElement(Qr,{isActive:Boolean(m||S)}),o.ZP.createElement(sc,{isOpen:Boolean(M||R),userId:M,isByPhoneNumber:R}),o.ZP.createElement(Vr,{openedGame:k,gameTitle:N}),o.ZP.createElement(oc,{webApp:U}),o.ZP.createElement(Hr,null),o.ZP.createElement(uc,null),o.ZP.createElement(ec,{isActive:S}),o.ZP.createElement(ht,{isForAppBadge:!0}),o.ZP.createElement(ac,{isOpen:A}),o.ZP.createElement(ic,{bot:B,type:x?.type}),o.ZP.createElement(rc,{bot:L}),o.ZP.createElement(yc,{requestedAttachBotInChat:O}),o.ZP.createElement(nc,null),q&&o.ZP.createElement(hc,{isOpen:q}),o.ZP.createElement(fc,{limit:I}),o.ZP.createElement(gc,{isOpen:$,onClose:pe}),o.ZP.createElement(pc,{isOpen:G,onClose:fe}),o.ZP.createElement(Ic,{deleteFolderDialogId:H}))})));var Sc=n(99364),Mc=n(8337);var Rc=n(2092);const kc=(0,o.X$)((0,s.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:a,signOut:i,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,s.Sv)(),{invalidAttemptsCount:d,isLoading:l}=n,u=(0,wt.Z)(),[m,h]=(0,o.eJ)(""),[g,p]=(0,o.eJ)(!1),[f,I,v]=(0,ft.Z)(!1),{shouldRender:w}=(0,st.Z)(t);(0,Pa.Z)(c,d&&d>=5?18e4:void 0);const y=(0,o.I4)((()=>{h("")}),[]),P=(0,o.I4)((e=>{d&&d>=5?h(u("FloodWait")):(h(""),(0,R.so)(e).then(a,(()=>{r(),h(u("lng_passcode_wrong"))})))}),[d,u,r,a]);(0,o.d4)((()=>{d&&d>=5?h(u("FloodWait")):0===d&&h("")}),[d,u]);const Z=(0,o.I4)((()=>{v(),i()}),[v,i]);if(w)return o.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},o.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:u.isRtl?"rtl":void 0},o.ZP.createElement($s.Z,{tgsUrl:Fs.l.Lock,previewUrl:Rc,size:160,className:"ar9YdQbWJreREHmnZa9m"}),o.ZP.createElement(Sc.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:l,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:y,isPasswordVisible:g,noRipple:!0,onChangePasswordVisibility:p,onSubmit:P}),o.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},o.ZP.createElement("p",null,o.ZP.createElement(Mc.Z,{onClick:I},"Log out")," ","if you don't remember your passcode."),o.ZP.createElement("p",null,o.ZP.createElement(kt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:I},u("AccountSettings.Logout"))))),o.ZP.createElement(Pn.Z,{isOpen:f,onClose:v,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:Z,confirmIsDestructive:!0}))})));a.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{connectionState:Tc,passcode:{isScreenLocked:Nc}}=(0,s.Rd)();Tc||Nc||(0,s.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
//# sourceMappingURL=5769.2c6bc8329d7f052953ae.js.map