TelegramPWA/dist/5769.0269632c191bb3c4ddde.js
Alexander Zinchuk c2d7234748 [Build]
2023-04-19 10:11:23 +02:00

2 lines
386 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],{62625:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Fd,Main:()=>xd});var a=n(33555),s=n(863),o=n(83716),i=n(60748),r=n(31664),c=(n(89005),n(6137)),d=n(25260),l=n(11192),u=n(70735),m=n(18010),h=n(65054);function g(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];let[s=(0,h._w)()]=n;const{chatId:o,threadId:i}=(0,l.Bt)(e,s)||{};return o&&i?(e=(0,d.qr)(e,o,i,!1,void 0,s),e=(0,d.Pb)(e,o,i,void 0,void 0,void 0,s)):e}(0,a.iw)("openLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s,threadId:o}=(0,l.Bt)(e,a)||{};if(s&&o)return(0,d.qr)(e,s,o,!0,void 0,a)})),(0,a.iw)("closeLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return g(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n,{chatId:o,threadId:i}=(0,l.Bt)(e,s)||{};if(!o||!i)return;const r=(0,m.uw)(o,i),{query:c}=(0,l.jU)(e,s).localTextSearch.byChatThreadKey[r]||{};return a!==c&&(e=(0,d.Pb)(e,o,i,u.D,void 0,void 0,s)),(0,d.qr)(e,o,i,!0,a,s)})),(0,a.iw)("setLocalMediaSearchType",((e,t,n)=>{const{mediaType:a,tabId:s=(0,h._w)()}=n,{chatId:o,threadId:i}=(0,l.Bt)(e,s)||{};if(o&&i)return(0,d.z5)(e,o,i,a,s)}));var p=n(44271),f=n(15780);(0,a.iw)("openChat",((e,t,n)=>{const{id:a,threadId:s=c._f,type:o="thread",shouldReplaceHistory:i=!1,shouldReplaceLast:r=!1,noForumTopicPanel:u,tabId:m=(0,h._w)()}=n,f=(0,l.Bt)(e,m),I=(0,l.jU)(e,m);if(I.premiumModal?.promo&&I.premiumModal?.isOpen&&(e=(0,p.i)(e,{premiumModal:{...I.premiumModal,isOpen:!1}},m)),f&&f.chatId===a&&f.threadId===s&&f.type===o||(a&&(e=(0,d.O8)(e,a,s,"replyStack",[],m),e=(0,p.i)(e,{activeReactions:{}},m)),e=g(e=(0,d.i9)(e,m),m),e=(0,p.i)(e,{isStatisticsShown:!1,contentToBeScheduled:void 0,...a!==(0,l.jU)(e,m).forwardMessages.toChatId&&{forwardMessages:{}}},m)),a){const n=(0,l.Z1)(e,a);n?.isForum&&!u?t.openForumPanel({chatId:a,tabId:m}):a!==(0,l.jU)(e,m).forumPanelChatId&&t.closeForumPanel({tabId:m})}return t.updatePageTitle({tabId:m}),(0,d.Wy)(e,a,s,o,i,r,m)})),(0,a.iw)("openChatInNewTab",((e,t,n)=>{const{chatId:a,threadId:s=c._f}=n;window.open((0,f.Ex)(a,"thread",s),"_blank")})),(0,a.iw)("openPreviousChat",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return t.updatePageTitle({tabId:a}),(0,d.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n;e=(0,p.i)(e,{...(0,l.jU)(e,s),isChatInfoShown:!0},s),e={...e,lastIsChatInfoShown:!0},(0,a.R3)(e),t.openChat({...n,tabId:s})})),(0,a.iw)("openChatWithDraft",((e,t,n)=>{const{chatId:a,text:s,threadId:o,files:i,tabId:r=(0,h._w)()}=n;return a&&t.openChat({id:a,threadId:o,tabId:r}),(0,p.i)(e,{requestedDraft:{chatId:a,text:s,files:i}},r)})),(0,a.iw)("resetChatCreation",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,n)=>{const{newChatMembersProgress:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{newChatMembersProgress:a},s)})),(0,a.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s,tabId:o=(0,h._w)()}=n,{chatId:i}=(0,l.Bt)(e,o)||{};if(!i)return void t.openChat({id:s[0],tabId:o});const r=s.indexOf(i);if(-1===r)return;const c=s[r+a];t.openChat({id:c,shouldReplaceHistory:!0,tabId:o})})),(0,a.iw)("openDeleteChatFolderModal",((e,t,n)=>{const{folderId:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{deleteFolderDialogModal:a},s)})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{deleteFolderDialogModal:void 0},a)}));var I=n(91713),v=n(60782),w=n(82267),b=n(83099),y=n(59692),P=n(64319),Z=n(996),C=n(42986),S=n(42797);const E=o.ckE+o.fK3;let M;function R(e,t,n){const{type:a,threadId:s}=(0,l.Bt)(e)||{},o=y.Iu,i="scheduled"===a?(0,l.yB)(e,t):(0,l.Zw)(e,t);if(!i||!s)return;const r=n.map((e=>i[e])).filter((t=>(0,l._k)(e,t,s).canCopy)).sort(((e,t)=>e.id-t.id)),c=r.reduce(((t,n)=>{const a=(0,l.Ur)(e,n);return t.push(`> ${a?(0,m.OU)(o,a):""}:`),t.push(`${function(e,t){const n=(0,C.Eb)(t),a=n?`${n} `:"",s=(0,Z.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${a}${(0,C.Kk)(e,t,s,!0)}`}(o,n)}\n`),t}),[]),d=r.reduce(((t,n)=>{const a=(0,l.Ur)(e,n);return t.push(`> ${a?(0,m.OU)(o,a):""}:`),t.push(`${(0,m.MK)(o,n,!1,0,!0)}\n`),t}),[]);(0,P.qN)(c.join("\n"),d.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o,tabId:i=(0,h._w)()}=n;return e=(0,d.pf)(e,a,s,"lastScrollOffset",o),(0,d.O8)(e,a,s,"scrollOffset",o,i)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a,tabId:s=(0,h._w)()}=n,o=(0,l.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o;return(0,d.pf)(e,i,r,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a,tabId:s=(0,h._w)()}=n,o=(0,l.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r,type:c}=o,u="scheduled"===c?"editingScheduledId":"editingId";return(0,d.pf)(e,i,r,u,a)})),(0,a.iw)("setEditingDraft",((e,t,n)=>{const{text:a,chatId:s,threadId:o,type:i}=n,r="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,d.pf)(e,s,o,r,a)})),(0,a.iw)("editLastMessage",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s,threadId:o}=(0,l.Bt)(e,a)||{};if(!s||!o)return;const i=(0,l.Zw)(e,s),r=(0,l.Cb)(e,s,o,a);if(!i||!r)return;const c=(0,v.dF)(r,(t=>Boolean(i[t]&&(0,l._k)(e,i[t],o).canEdit)));return c?(0,d.pf)(e,s,o,"editingId",c):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a,tabId:s=(0,h._w)()}=n,{chatId:o,threadId:i}=(0,l.Bt)(e,s)||{};if(!o||!i)return;const r=(0,l.Zw)(e,o),d=(0,l.Cb)(e,o,i,s);if(!r||!d)return;const u=(0,l.Yy)(e,o,i);let m;if((0,l.b9)(e,o,i,s)&&u){const e=Object.keys(r),t=e.indexOf(u.toString())+a;m=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(i===c._f){const t=(0,l.Z1)(e,o);m=t?.lastMessage?.id}else{const t=(0,l.tZ)(e,o,i);m=t?.lastMessageId}t.setReplyingToId({messageId:m,tabId:s}),t.focusMessage({chatId:o,threadId:i,messageId:m,tabId:s})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d,tabId:u=(0,h._w)()}=n,m=(0,l.jU)(e,u);return(0,p.i)(e,{audioPlayer:{chatId:a,threadId:s,messageId:o,origin:null!=i?i:m.audioPlayer.origin,volume:null!=r?r:m.audioPlayer.volume,playbackRate:c||m.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===m.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:m.audioPlayer.isPlaybackRateActive,isMuted:d||m.audioPlayer.isMuted}},u)})),(0,a.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{audioPlayer:{...(0,l.jU)(e,s).audioPlayer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a,isPlaybackRateActive:s,tabId:o=(0,h._w)()}=n;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:s}},(0,p.i)(e,{audioPlayer:{...(0,l.jU)(e,o).audioPlayer,playbackRate:a,isPlaybackRateActive:s}},o)})),(0,a.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{audioPlayer:{...(0,l.jU)(e,s).audioPlayer,isMuted:a}},s)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{audioPlayer:{...(0,l.jU)(e,s).audioPlayer,origin:a}},s)})),(0,a.iw)("closeAudioPlayer",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a);return(0,p.i)(e,{audioPlayer:{volume:s.audioPlayer.volume,playbackRate:s.audioPlayer.playbackRate,isPlaybackRateActive:s.audioPlayer.isPlaybackRateActive,isMuted:s.audioPlayer.isMuted}},a)})),(0,a.iw)("openPollResults",((e,t,n)=>{const{chatId:s,messageId:o,tabId:i=(0,h._w)()}=n,r=(0,l.Jf)(e,(0,S.W7)(),i),c=(0,l.jU)(e,i);if(r){if(s!==c.pollResults.chatId||o!==c.pollResults.messageId)return(0,p.i)(e,{pollResults:{chatId:s,messageId:o,voters:{}}},i)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,p.i)(e,{pollResults:{chatId:s,messageId:o,voters:{}}},i),(0,a.R3)(e)}),450)})),(0,a.iw)("closePollResults",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.Bt)(e,a);if(!s)return;const{chatId:o,threadId:i}=s;let r;if(i===c._f){const t=(0,l.Z1)(e,o);r=t?.lastMessage?.id}else{const t=(0,l.tZ)(e,o,i);r=t?.lastMessageId}r&&t.focusMessage({chatId:o,threadId:i,messageId:r,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{},o=(0,l.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o,c=(0,l.p9)(e,i,r,s);if(c&&0!==c.length){const n=c.pop();e=(0,d.O8)(e,i,r,"replyStack",[...c],s),(0,a.R3)(e),t.focusMessage({chatId:i,threadId:r,messageId:n,tabId:s,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:s})})),(0,a.iw)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:o=c._f,messageListType:i="thread",noHighlight:r,groupedId:u,groupedChatId:m,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f,noForumTopicPanel:w,tabId:b=(0,h._w)()}=n;let{messageId:y}=n;if(void 0!==u){const t=(0,l.y8)(e,m,u);t?.length&&([y]=(0,v.oA)(t))}const P=(0,l.Bt)(e,b),Z=!P||s!==P.chatId||o!==P.threadId||i!==P.type;if(M&&(clearTimeout(M),M=void 0),M=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,d.cq)(e,void 0,void 0,void 0,void 0,void 0,b),e=(0,d.wV)(e,void 0,b),(0,a.R3)(e)}),r?E:1500),e=(0,d.cq)(e,s,y,o,r,p,b),e=(0,d.wV)(e,void 0,b),g){const t=(0,l.p9)(e,s,o,b)||[];e=(0,d.O8)(e,s,o,"replyStack",[...t,g],b)}Z&&(e=(0,d.wV)(e,I.fo.Static,b));const C=(0,l.Cb)(e,s,o,b);if(C&&C.includes(y))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openChat({id:s,threadId:o,shouldReplaceHistory:f,noForumTopicPanel:w,tabId:b});if(Z&&(e=(0,d.O8)(e,s,o,"viewportIds",void 0,b)),C&&!Z){const t=y>C[0]?I.fo.Down:I.fo.Up;e=(0,d.wV)(e,t,b)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openChat({id:s,threadId:o,shouldReplaceHistory:f,noForumTopicPanel:w,tabId:b}),t.loadViewportMessages({tabId:b,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o,withMyScore:i,tabId:r=(0,h._w)()}=n;let c;return o&&(c=(0,l.xH)(e,a,o)),(0,p.i)(e,{forwardMessages:{fromChatId:a,messageIds:c||s,isModalShown:!0,withMyScore:i}},r)})),(0,a.iw)("changeForwardRecipient",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{forwardMessages:{...(0,l.jU)(e,a).forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}},a)})),(0,a.iw)("setForwardNoAuthors",((e,t,n)=>{const{noAuthors:a,tabId:s=(0,h._w)()}=n,o=(0,l.jU)(e,s);return(0,p.i)(e,{forwardMessages:{...o.forwardMessages,noAuthors:a,noCaptions:a&&o.forwardMessages.noCaptions}},s)})),(0,a.iw)("setForwardNoCaptions",((e,t,n)=>{const{noCaptions:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{forwardMessages:{...(0,l.jU)(e,s).forwardMessages,noCaptions:a,noAuthors:a}},s)})),(0,a.iw)("exitForwardMode",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{};e=(0,p.i)(e,{forwardMessages:{}},s),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages;t.openForwardMenu({fromChatId:o,messageIds:i,tabId:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:s,tabId:o=(0,h._w)()}=n,i=(0,l.jU)(e,o),r=i.activeDownloads.byChatId[s.chatId];r&&r.length&&(e=(0,p.i)(e,{activeDownloads:{byChatId:{...i.activeDownloads.byChatId,[s.chatId]:r.filter((e=>e!==s.id))}}},o),(0,a.R3)(e))})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a,tabId:s=(0,h._w)()}=n,o=(0,l.jU)(e,s).activeDownloads.byChatId,i={};return Object.keys(o).forEach((e=>{i[e]=o[e].filter((e=>!a.find((t=>t.id===e))))})),(0,p.i)(e,{activeDownloads:{byChatId:i}},s)})),(0,a.iw)("downloadMessageMedia",((e,t,n)=>{const{message:s,tabId:o=(0,h._w)()}=n,i=(0,l.jU)(e,o);e=(0,p.i)(e,{activeDownloads:{byChatId:{...i.activeDownloads.byChatId,[s.chatId]:[...i.activeDownloads.byChatId[s.chatId]||[],s.id]}}},o),(0,a.R3)(e)})),(0,a.iw)("downloadSelectedMessages",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages,{threadId:r}=(0,l.Bt)(e,a)||{},c=(0,l.Zw)(e,o);c&&r&&i.map((e=>c[e])).filter((t=>(0,l._k)(e,t,r).canDownload)).forEach((e=>t.downloadMessageMedia({message:e,tabId:a})))})),(0,a.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a,tabId:s=(0,h._w)()}=n||{},o=(0,l.jr)(e,s);return o?(0,d.M6)(e,o.id,a,s):e})),(0,a.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:o,groupedId:i,childMessageIds:r,withShift:c,tabId:u=(0,h._w)()}=n,m=(0,l.Bt)(e,u);if(!m)return;const{chatId:g,threadId:p,type:f}=m;e=(0,d.Ob)(e,g,p,f,o,i,r,c,u),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${s.$b?"long tap":"right click"} on a message.`,tabId:u}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,d.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,n)=>{const{isQuiz:a,tabId:s=(0,h._w)()}=n||{};return(0,p.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},s)})),(0,a.iw)("closePollModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(o.V61&&Date.now()>Number(o.V61)+2592e5)return;const n=o.JiC.split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((e=>{let{version:t}=e;return t===n})))return;const s={chatId:o.awM,date:(0,w.bp)(),content:{text:(0,b.ZP)("**Telegram Web A was updated to version 1.60**\n\n[🤩](customEmoji:5373026167722876724) **Whats New**\n\n• Archived Chats Header - Archived Chats are now accessible from the chat list in a collapsable header.\n\n• Reply Threads - You can tap to view all replies to a message in a separate window.\n\n• Emoji In Captions - You can now open the emoji panel [🙂](customEmoji:5971928678198676594) when adding a caption to media.\n\n• Message Translation - You can translate any message into another language from the context menu. To show this option, enable Translation in _Settings > Language_.\n\n• Emoji Statuses - Premium users can update their animated emoji status from the [🌟](customEmoji:6046154264353442824) at the top of their chat list.\n\n• Granular Media Permissions - Admins can choose which media types are allowed in their groups, each with separate toggles.\n\n[😍](customEmoji:5372886001465170842) **Whats Better**\n\n• Multiple tabs can be opened by holding <Ctrl> (⌘ on macOS) and clicking on a chat.\n\n• Opening a chat changes the title of your browser tab to the chat name. This can be modified in _Settings > Privacy and Security_.\n\n• Bot reply keyboards are now supported in groups and channels.\n\n• The video and audio players always remember your last playback speed.\n\n• Opening topics has an improved animation.\n\n• Performance when typing messages has been drastically improved.\n\n• Fixed disappearing drafts.\n\n• Fixed missing results in Global Search.\n\n• Fixed rare issues with opening text format options.\n\n• Fixed pasting text from Google Docs.\n\n• Fixed auto-closing context menu on iOS PWA.\n\n• Fixed changing group and channel admin rights.\n\n• Various layout and performance improvements.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:s,version:n})})),(0,a.iw)("createServiceNotification",((e,t,n)=>{const{message:s,version:i}=n,{serviceNotifications:r}=e,c=(0,l.Z1)(e,o.awM),d=Math.max(c.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),u=(r.length+1)/1e3,m=Math.floor(d)+u;s.previousLocalId=s.id,s.id=m;const h={id:m,message:s,version:i,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),h]},(0,a.R3)(e),t.apiUpdate({"@type":"newMessage",id:s.id,chatId:s.chatId,message:s})})),(0,a.iw)("openReactorListModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,h._w)()}=n;return(0,p.i)(e,{reactorModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeReactorListModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,h._w)()}=n;return(0,p.i)(e,{seenByModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeSeenByModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openMessageLanguageModal",((e,t,n)=>{const{chatId:a,id:s,tabId:o=(0,h._w)()}=n,i=(0,l.xx)(e,a,s,o);return(0,p.i)(e,{messageLanguageModal:{chatId:a,messageId:s,activeLanguage:i}},o)})),(0,a.iw)("closeMessageLanguageModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{messageLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages;R(e,o,i)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a,tabId:s=(0,h._w)()}=n,o=(0,l.jr)(e,s);a&&0!==a.length&&o&&R(e,o.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n,{chatId:o}=(0,l.jU)(e,s).globalSearch;return(0,d.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!o,messages:!0}}:{fetchingStatus:void 0},query:a},s)})),(0,a.iw)("setGlobalSearchClosing",((e,t,n)=>{const{tabId:a=(0,h._w)(),isClosing:s}=n||{};return(0,d.No)(e,{isClosing:s},a)})),(0,a.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:a}=n,{recentlyFoundChatIds:s}=e;if(!s)return{...e,recentlyFoundChatIds:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>10&&o.pop(),{...e,recentlyFoundChatIds:o}})),(0,a.iw)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:a,tabId:s=(0,h._w)()}=n;return(0,d.Og)(e,a,s)})),(0,a.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:a,tabId:s=(0,h._w)()}=n;return(0,d.No)(e,{chatId:a,query:void 0,resultsByType:void 0},s)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{stickerSearch:{query:a,resultIds:void 0}},s)})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{gifSearch:{query:a,offset:void 0,results:void 0}},s)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n;return(0,d.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a},s)})),(0,a.iw)("openAddContactDialog",((e,t,n)=>{const{userId:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{newContact:{userId:a}},s)})),(0,a.iw)("openNewContactDialog",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,d.ft)(e,a)})),n(73456);var k=n(91947),T=n(26926),A=n(16974);function N(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")}))}var x=n(69118);function B(e){document.title!==e&&(document.title=e)}const L=(0,x.Ds)(B,200,!1);var U=n(65116);let j,O;(0,a.iw)("toggleChatInfo",((e,t,n)=>{const{force:a,tabId:s=(0,h._w)()}=n||{},o=void 0!==a?a:!(0,l.jU)(e,s).isChatInfoShown;return e=(0,p.i)(e,{isChatInfoShown:o},s),{...e,lastIsChatInfoShown:o}})),(0,a.iw)("setLeftColumnWidth",((e,t,n)=>{const{leftColumnWidth:a}=n;return{...e,leftColumnWidth:a}})),(0,a.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.iw)("toggleManagement",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s}=(0,l.Bt)(e,a)||{};if(!s)return;const o=(0,l.jU)(e,a);return(0,p.i)(e,{management:{byChatId:{...o.management.byChatId,[s]:{...o.management.byChatId[s],isActive:!(o.management.byChatId[s]||{}).isActive}}}},a)})),(0,a.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:a,tabId:s=(0,h._w)()}=n||{},{chatId:o}=(0,l.Bt)(e,s)||{};if(!o)return;const i=(0,l.jU)(e,s);return(0,p.i)(e,{management:{byChatId:{...i.management.byChatId,[o]:{...i.management.byChatId[o],isActive:!0,nextScreen:a}}}},s)})),(0,a.iw)("closeManagement",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s}=(0,l.Bt)(e,a)||{};if(!s)return;const o=(0,l.jU)(e,a);return(0,p.i)(e,{management:{byChatId:{...o.management.byChatId,[s]:{...o.management.byChatId[s],isActive:!1}}}},a)})),(0,a.iw)("openChat",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n;if((0,S.W7)()||(0,S.c9)())return(0,p.i)(e,{isLeftColumnShown:0===(0,l.jU)(e,a).messageLists.length},a)})),(0,a.iw)("toggleStatistics",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a);return(0,p.i)(e,{isStatisticsShown:!s.isStatisticsShown,statistics:{...s.statistics,currentMessageId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,n)=>{const{tabId:a=(0,h._w)(),messageId:s}=n||{};return(0,p.i)(e,{statistics:{...(0,l.jU)(e,a).statistics,currentMessageId:s}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{isLeftColumnShown:!(0,l.jU)(e,a).isLeftColumnShown},a)})),(0,a.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:a}=n,{recentEmojis:s}=e;if(!s)return{...e,recentEmojis:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>32&&o.pop(),{...e,recentEmojis:o}})),(0,a.iw)("addRecentSticker",((e,t,n)=>{const{sticker:a}=n,{recent:s}=e.stickers;if(!s)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const o=s.stickers.filter((e=>e.id!==a.id));return o.unshift(a),{...e,stickers:{...e.stickers,recent:{...s,stickers:o}}}})),(0,a.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:a}=n,{recentCustomEmojis:s}=e;if(!s)return{...e,recentCustomEmojis:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>32&&o.pop(),{...e,recentCustomEmojis:o}})),(0,a.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,a.iw)("reorderStickerSets",((e,t,n)=>{const{order:a,isCustomEmoji:s}=n;return{...e,stickers:{...e.stickers,added:{setIds:s?e.stickers.added.setIds:a}},customEmojis:{...e.customEmojis,added:{setIds:s?a:e.customEmojis.added.setIds}}}})),(0,a.iw)("showNotification",((e,t,n)=>{const{tabId:a=(0,h._w)(),...s}=n;s.localId=(0,T.Z)({});const o=[...(0,l.jU)(e,a).notifications],i=o.findIndex((e=>e.message===s.message));return-1!==i&&o.splice(i,1),o.push(s),(0,p.i)(e,{notifications:o},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,n)=>{const{chatId:a,tabId:s=(0,h._w)()}=n,o=(0,l.Z1)(e,a);if(!o)return;const{canSendPlainText:i,canSendPhotos:r,canSendVideos:c,canSendDocuments:d,canSendAudios:u,canSendStickers:g,canSendRoundVideos:p,canSendVoices:f}=(0,m.H5)(o),I=(0,v.oA)([i?"Chat.SendAllowedContentTypeText":void 0,r?"Chat.SendAllowedContentTypePhoto":void 0,c?"Chat.SendAllowedContentTypeVideo":void 0,f?"Chat.SendAllowedContentTypeVoiceMessage":void 0,p?"Chat.SendAllowedContentTypeVideoMessage":void 0,d?"Chat.SendAllowedContentTypeFile":void 0,u?"Chat.SendAllowedContentTypeMusic":void 0,g?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>y.Iu(e)));if(!I.length)return void t.showNotification({message:y.Iu("Chat.SendNotAllowedText"),tabId:s});const w=y.Iu("AutoDownloadSettings.LastDelimeter"),b=I.join(", ").replace(/,([^,]*)$/,`${w}$1`);t.showNotification({message:y.Iu("Chat.SendAllowedContentText",b),tabId:s})})),(0,a.iw)("dismissNotification",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n,s=(0,l.jU)(e,a).notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return(0,p.i)(e,{notifications:s},a)})),(0,a.iw)("showDialog",((e,t,n)=>{const{data:a,tabId:s=(0,h._w)()}=n;if("message"in a&&a.hasErrorKey&&!(0,k.ZP)(a))return e;const o=[...(0,l.jU)(e,s).dialogs];if("message"in a){const e=o.findIndex((e=>e.message===a.message));-1!==e&&o.splice(e,1)}return o.push(a),(0,p.i)(e,{dialogs:o},s)})),(0,a.iw)("dismissDialog",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=[...(0,l.jU)(e,a).dialogs];return s.pop(),(0,p.i)(e,{dialogs:s},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{safeLinkModalUrl:a},s)})),(0,a.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{historyCalendarSelectedAt:a},s)})),(0,a.iw)("closeHistoryCalendar",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,n)=>{const{url:s,chatId:o,messageId:i,tabId:r=(0,h._w)()}=n,c=(0,l.hj)(e,o,i);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,l.LM)(e,d))return e=(0,p.i)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:n}}},r),void(0,a.R3)(e);e=(0,p.i)(e,{openedGame:{url:s,chatId:o,messageId:i}},r),(0,a.R3)(e)}})),(0,a.iw)("closeGame",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{openedGame:void 0},a)})),(0,a.iw)("requestConfetti",((e,t,n)=>{const{top:a,left:s,width:o,height:i,tabId:r=(0,h._w)()}=n||{},{animationLevel:c}=e.settings.byKey;if(0!==c)return(0,p.i)(e,{confetti:{lastConfettiTime:Date.now(),top:a,left:s,width:o,height:i}},r)})),(0,a.iw)("updateAttachmentSettings",((e,t,n)=>{const{shouldCompress:a,shouldSendGrouped:s}=n;return{...e,attachmentSettings:{shouldCompress:null!=a?a:e.attachmentSettings.shouldCompress,shouldSendGrouped:null!=s?s:e.attachmentSettings.shouldSendGrouped}}})),(0,a.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{limitReachedModal:{limit:a}},s)})),(0,a.iw)("closeLimitReachedModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{openedCustomEmojiSetIds:a},s)})),(0,a.iw)("closeCustomEmojiSets",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{openedCustomEmojiSetIds:void 0},a)})),(0,a.iw)("updateLastRenderedCustomEmojis",((e,t,n)=>{const{ids:a}=n,{lastRendered:s}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,v.Tw)([...s,...a]).slice(0,o.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,n)=>{const{chatId:a,tabId:s=(0,h._w)()}=n;return(0,l.jr)(e,s)||t.openChat({id:a,threadId:c._f,tabId:s}),(0,p.i)(e,{createTopicPanel:{chatId:a}},s)})),(0,a.iw)("closeCreateTopicPanel",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,n)=>{const{chatId:a,topicId:s,tabId:o=(0,h._w)()}=n;return(0,l.jr)(e,o)||t.openChat({id:a,tabId:o}),(0,p.i)(e,{editTopicPanel:{chatId:a,topicId:s}},o)})),(0,a.iw)("closeEditTopicPanel",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{editTopicPanel:void 0},a)})),(0,a.iw)("updateArchiveSettings",((e,t,n)=>{const{archiveSettings:a}=e,{isHidden:s=a.isHidden,isMinimized:o=a.isMinimized}=n;return{...e,archiveSettings:{isHidden:s,isMinimized:o}}})),(0,a.iw)("checkAppVersion",(e=>{const t=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((n=>{n=n.trim(),t.test(n)&&n!==o.JiC&&(e=(0,a.Rd)(),e={...e,isUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{o.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("afterHangUp",(e=>{(0,l.jU)(e,(0,h._w)()).multitabNextAction&&(0,h.g)()})),(0,a.iw)("onTabFocusChange",((e,t,n)=>{const{isBlurred:a,tabId:s=(0,h._w)()}=n;return a?(j&&clearInterval(j),j=window.setInterval((()=>{t.updatePageTitle({tabId:s})}),500)):(clearInterval(j),j=void 0),e=(0,p.i)(e,{isBlurred:a},s),{...e,initialUnreadNotifications:a?(0,A.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{canDisplayChatInTitle:s}=e.settings.byKey,i=e.currentUserId;if(document.title.includes(o.ouc))return N(!1),void B(`${o.Tih} ${o.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,A.xW)()-e.initialUnreadNotifications;if(t>0)return B(`${t} notification${t>1?"s":""}`),void N(!0)}N(!1);const r=(0,l.Bt)(e,a);if(r&&s&&!e.passcode.isScreenLocked){const{chatId:t,threadId:n}=r,a=(0,l.Z1)(e,t);if(a){const e=(0,m.U)(y.Iu,a,t===i);return a.isForum&&a.topics?.[n]?void L(`${e} ${a.topics[n].title}`):void L(e)}}B(o.Tih)}));let F,_=0;(0,U.ll)((e=>{const{updatePageTitle:t,updateIsOnline:n}=(0,a.Sv)(),s=e.passcode.isScreenLocked!==O,o=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,i=(0,l.jU)(e,(0,h._w)()).isMasterTab;s&&t(),o!==_&&i&&(F&&clearTimeout(F),F=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;n(t!==(0,h.s1)().length)}),100)),O=e.passcode.isScreenLocked,_=o})),(0,a.iw)("closePaymentModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a).payment.status;return e=(0,d.bp)(e,a),e=(0,d.WY)(e,a),(0,p.i)(e,{payment:{...(0,l.jU)(e,a).payment,status:s}},a)})),(0,a.iw)("addPaymentError",((e,t,n)=>{const{error:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{payment:{...(0,l.jU)(e,s).payment,status:"failed",error:a}},s)}));var D=n(88422);(0,a.iw)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:d,playbackRate:u,isMuted:m,tabId:g=(0,h._w)()}=n,f=(0,l.jU)(e,g);return(0,p.i)(e,{mediaViewer:{...f.mediaViewer,chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=d?d:f.mediaViewer.volume,playbackRate:u||f.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate,isMuted:m||f.mediaViewer.isMuted},forwardMessages:{}},g)})),(0,a.iw)("closeMediaViewer",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{volume:s,isMuted:o,playbackRate:i,isHidden:r}=(0,l.jU)(e,a).mediaViewer;return(0,p.i)(e,{mediaViewer:{volume:s,isMuted:o,isHidden:r,playbackRate:i}},a)})),(0,a.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{mediaViewer:{...(0,l.jU)(e,s).mediaViewer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a,tabId:s=(0,h._w)()}=n;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,p.i)(e,{mediaViewer:{...(0,l.jU)(e,s).mediaViewer,playbackRate:a}},s)})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{mediaViewer:{...(0,l.jU)(e,s).mediaViewer,isMuted:a}},s)})),(0,a.iw)("setMediaViewerHidden",((e,t,n)=>{const{isHidden:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{mediaViewer:{...(0,l.jU)(e,s).mediaViewer,isHidden:a}},s)}));var q=n(50214),$=n(95281),H=n(5872),G=n(35369);let V=!1;(0,x.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!V&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,q.jv)()})),(0,a.iw)("setPasscode",(async(e,t,n)=>{const{passcode:s}=n;e=(0,d.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,$.AU)(s);const o=JSON.stringify({...(0,q.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const i=(0,H.Uf)((0,d.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,$.H4)(o,i),(0,h.Z6)(),e=(0,a.Rd)(),e=(0,d.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,H.jA)(!0)})),(0,a.iw)("clearPasscode",(e=>((0,$.C8)(),(0,d.Kn)(e)))),(0,a.iw)("unlockScreen",((e,t,n)=>{const s=Object.values(e.byTabId),{sessionJson:o,globalJson:i}=n,r=JSON.parse(o);(0,q.wX)(r,r.userId);const c=e;(e=JSON.parse(i)).byTabId=c.byTabId,(0,H.nE)(e,(0,v.Xh)(G.g)),e=(0,d.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,h.Z6)(),s.forEach((e=>{let{id:n,isMasterTab:a}=e;return t.init({tabId:n,isMasterTab:a})})),t.initApi()})),(0,a.iw)("decryptSession",((e,t,n)=>{const{passcode:a}=n;(0,$.so)(a).then(t.unlockScreen,(()=>{t.logInvalidUnlockAttempt()}))})),(0,a.iw)("logInvalidUnlockAttempt",(e=>{var t;const n=(null!==(t=e.passcode?.invalidAttemptsCount)&&void 0!==t?t:0)+1;return(0,d.vu)(e,{invalidAttemptsCount:n,timeoutUntil:n>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,d.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,n)=>{const{error:a}=n;return(0,d.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,d.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{V=!0})),n(65456);var z=n(27225),W=n(71226),X=n(81396);const Y=new Map,K=(0,x.Ds)((e=>e()),500,!1);async function J(e,t,n,s,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];for(var u=arguments.length,m=new Array(u>7?u-7:0),g=7;g<u;g++)m[g-7]=arguments[g];let[p=(0,h._w)()]=m;const f=t.id;let w;switch(i){case I.Uq.Backwards:w=void 0;break;case I.Uq.Around:w=-(Math.round(o.hT6/2)+1);break;case I.Uq.Forwards:w=-(o.hT6+1)}e=(0,a.Rd)();const b=await(0,W.t9)("fetchMessages",{chat:(0,l.Z1)(e,f),offsetId:s,addOffset:w,limit:o.hT6,threadId:n});if(!b)return;const{messages:y,users:P,chats:Z,repliesThreadInfos:C}=b;e=(0,a.Rd)();const S=f===o.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],E=[].concat(y,S),M=(0,v.ee)(E,"id"),R=Object.keys(M).map(Number);e=(0,d.c_)(e,f,M),e=r?(0,d.hv)(e,f,n,R):(0,d.xj)(e,f,n,R),e=(0,d.Sh)(e,(0,v.ee)(P,"id")),e=(0,d.fZ)(e,(0,v.ee)(Z,"id")),e=(0,d.j6)(e,f,C);let k=(0,l.gb)(e,f,n);const T=s?(0,l.of)(e,f,n,s):void 0;if(r&&k&&T&&(T.length&&!(0,v.YE)(k,T)||(e=(0,d.xj)(e,f,n,T),k=(0,l.gb)(e,f,n),e=(0,d.IU)(e,f,n,T),r=!1)),!c){const t=r?T:k,{newViewportIds:a}=Q(t,s,i);e=(0,d.y9)(e,f,n,a,p)}(0,a.R3)(e)}function Q(e,t,n){const{length:a}=e,s=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,a)=>n===t||n<t&&e[a+1]>t))}(e,t):-1,i=n===I.Uq.Backwards?s:s+1||a,r=n===I.Uq.Around?Math.round(o.hT6/2):o.hT6,c=i-r,d=i+r-1,l=e.slice(Math.max(0,c),d+1);let u,m;switch(n){case I.Uq.Backwards:u=i>0,m=c>=0;break;case I.Uq.Forwards:u=i<a,m=d<=a-1;break;case I.Uq.Around:default:u=l.length>0,m=l.length===o.hT6}return{newViewportIds:l,areSomeLocal:u,areAllLocal:m}}async function ee(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];let r,[d=(0,h._w)()]=o;const u=t.attachment?(t,n)=>{Y.has(n)||(r=n,Y.set(n,u)),e=(0,a.Rd)(),e={...e,fileUploads:{byMessageLocalId:{...e.fileUploads.byMessageLocalId,[n]:{progress:t}}}},(0,a.R3)(e)}:void 0;(t.replyingTo||s.cj)&&await(0,x.Pn)(),e=(0,a.Rd)();const m=(0,l.Bt)(e,d);if(!m)return;const{threadId:g}=m;t.replyingTo||g===c._f||(t.replyingTo=(0,l.qS)(e,t.chat.id,g)),t.replyingTo&&!t.replyingToTopId&&g!==c._f&&(t.replyingToTopId=(0,l.qS)(e,t.chat.id,g)),await(0,W.t9)("sendMessage",t,u),u&&r&&Y.delete(r)}function te(e){const{shouldSendAsFile:t,mimeType:n}=e;return t?"file":n===o.s11?"gif":o.oGt.has(n)||o.wGh.has(n)?"media":o.e74.has(n)?"audio":e.voice?"voice":"file"}(0,a.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=I.Uq.Around,isBudgetPreload:o=!1,shouldForceRender:i=!1,tabId:r=(0,h._w)()}=n||{};let{chatId:c,threadId:u}=n||{};if(!c||!u){const t=(0,l.Bt)(e,r);if(!t)return;c=t.chatId,u=t.threadId}const m=(0,l.Z1)(e,c);if(!m||m.isRestricted)return;const g=(0,l.Cb)(e,c,u,r),p=(0,l.gb)(e,c,u);if(g&&g.length&&s!==I.Uq.Around){const n=s===I.Uq.Backwards?g[0]:g[g.length-1],a=Boolean(p&&!p.includes(n)),i=a?(0,l.of)(e,c,u,n):p,{newViewportIds:f,areSomeLocal:v,areAllLocal:w}=Q(i,n,s);if(v&&(e=(0,d.y9)(e,c,u,f,r)),(0,x.R3)((()=>{!async function(e,t,n,a,s,o,i,r,c){for(var d=arguments.length,l=new Array(d>9?d-9:0),u=9;u<d;u++)l[u-9]=arguments[u];let[m=(0,h._w)()]=l;n||await J(e,o,i,c,r,a,s,m),s||t.loadViewportMessages({chatId:o.id,threadId:i,direction:r,isBudgetPreload:!0,tabId:m})}(e,t,w,a,o,m,u,s,n,r)})),o)return}else{const t=(0,l.G$)(e,c,r)||(0,l.rd)(e,c,u),n=Boolean(t&&p&&!p.includes(t)),a=(n?(0,l.of)(e,c,u,t):p)||[],{newViewportIds:s,areSomeLocal:i,areAllLocal:h}=Q(a,t,I.Uq.Around);i&&(e=(0,d.y9)(e,c,u,s,r)),h||(0,x.R3)((()=>{J(e,m,u,t,I.Uq.Around,n,o,r)}))}(0,a.R3)(e,{forceOnHeavyAnimation:i})})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:i,threadUpdate:r}=n,u=(0,l.Z1)(e,s);if(!u)return;const m=await async function(e,t,n,s){const o=await(0,W.t9)("fetchMessage",{chat:t,messageId:n});if(o){if(o!==c._Q)return e=(0,a.Rd)(),e=(0,d.cY)(e,t.id,n,o.message),e=(0,d.Sh)(e,(0,v.ee)(o.users,"id")),(0,a.R3)(e),o.message;if(s){e=(0,a.Rd)();const n=(0,l.hj)(e,t.id,s);e=(0,d.cY)(e,t.id,s,{...n,replyToMessageId:void 0}),(0,a.R3)(e)}}}(e,u,o,i);if(m&&r){const{lastMessageId:t,isDeleting:n}=r;e=(0,a.Rd)(),e=(0,d.lG)(e,m,s,t,n),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n,s=(0,l.Bt)(e,a);if(!s)return;const{chatId:i,threadId:r,type:c}=s;if(n=(0,v.CE)(n,["tabId"]),"scheduled"===c&&!n.scheduledAt)return(0,p.i)(e,{contentToBeScheduled:n},a);const d=(0,l.Z1)(e,i),u=(0,l.Yy)(e,i,r),m=u?(0,l.hj)(e,i,u):void 0,g=d.isForum?(0,l.qS)(e,i,r):m?.replyToTopMessageId||m?.replyToMessageId,f={...n,chat:d,replyingTo:u,replyingToTopId:g,noWebPage:(0,l.tV)(e,i,r),sendAs:(0,l._5)(e,i)};t.setReplyingToId({messageId:void 0,tabId:a}),t.clearWebPagePreview({tabId:a});const I=!n.attachments||n.attachments.length<=1,w=!I&&n.shouldGroupMessages;if(I){const{attachments:t,...n}=f;ee(e,{...n,attachment:t?t[0]:void 0},a)}else if(w){const{text:t,entities:n,attachments:s,...i}=f,r=function(e){return e.reduce(((e,t,n,a)=>0===n?(e.push([t]),e):(te(t)===te(a[n-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(s);r.forEach(((s,r)=>{const c=(0,v.Vl)(s,o.DUi);for(let s=0;s<c.length;s++){const[o,...d]=c[s],l=`${Date.now()}${r}${s}`,u=0===s&&0===r;ee(e,{...i,text:u?t:void 0,entities:u?n:void 0,attachment:o,groupedId:d.length>0?l:void 0},a),d.forEach((t=>{ee(e,{...i,attachment:t,groupedId:l},a)}))}}))}else{const{text:t,entities:n,attachments:s,replyingTo:o,...i}=f;t&&ee(e,{...i,text:t,entities:n,replyingTo:o},a),s?.forEach((t=>{ee(e,{...i,attachment:t},a)}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{text:a,entities:s,tabId:o=(0,h._w)()}=n,i=(0,l.Bt)(e,o);if(!i)return;const{chatId:r,threadId:c,type:d}=i,u=(0,l.Z1)(e,r),m=(0,l.kK)(e,r,c,d);u&&m&&((0,W.t9)("editMessage",{chat:u,message:m,text:a,entities:s,noWebPage:(0,l.tV)(e,r,c)}),t.setEditingId({messageId:void 0,tabId:o}))})),(0,a.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,l.hj)(e,a,s),i=o&&Y.get((0,m.KK)(o));i&&(0,W.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.iw)("saveDraft",(async(e,t,n)=>{const{chatId:s,threadId:o,draft:i,shouldForce:r}=n;if(!i)return;const{text:c,entities:u}=i,h=(0,l.Z1)(e,s),g=(0,l.dy)(e,s);g&&(0,m.NB)(g)||(i.isLocal=!0,i.shouldForce=r,e=(0,d.pf)(e,s,o,"draft",i),e=(0,d.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e),await(0,W.t9)("saveDraft",{chat:h,text:c,entities:u,replyToMsgId:(0,l.Yy)(e,s,o),threadId:(0,l.qS)(e,s,o)})&&(i.isLocal=!1),e=(0,a.Rd)(),e=(0,d.pf)(e,s,o,"draft",i),e=(0,d.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e))})),(0,a.iw)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s=c._f,localOnly:o,shouldForce:i}=n;if(!(0,l.Ms)(e,a,s))return;const r=(0,l.Z1)(e,a);o||(0,W.t9)("clearDraft",r,(0,l.qS)(e,a,s));const u=i?{shouldForce:i,text:""}:void 0;return e=(0,d.pf)(e,a,s,"draft",u),(0,d.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,d.pf)(e,a,s,"noWebPage",o)})),(0,a.iw)("pinMessage",((e,t,n)=>{const{messageId:a,isUnpin:s,isOneSide:o,isSilent:i,tabId:r=(0,h._w)()}=n,c=(0,l.jr)(e,r);c&&(0,W.t9)("pinMessage",{chat:c,messageId:a,isUnpin:s,isOneSide:o,isSilent:i})})),(0,a.iw)("unpinAllMessages",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=(0,l.qS)(e,s,o);await(0,W.t9)("unpinAllMessages",{chat:i,threadId:r}),e=(0,a.Rd)();const u=(0,l.KB)(e,s,o);u?.forEach((t=>{e=(0,d.cY)(e,s,t,{isPinned:!1})})),e=(0,d.pf)(e,i.id,c._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s,tabId:o=(0,h._w)()}=n,i=(0,l.Bt)(e,o);if(!i)return;const{chatId:r,threadId:c}=i,d=(0,l.Z1)(e,r);(0,W.t9)("deleteMessages",{chat:d,messageIds:a,shouldDeleteForAll:s});const u=(0,l._$)(e,r,c);u&&a.includes(u)&&t.setEditingId({messageId:void 0,tabId:o})})),(0,a.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a,tabId:s=(0,h._w)()}=n,o=(0,l.Bt)(e,s);if(!o)return;const{chatId:i}=o,r=(0,l.Z1)(e,i);(0,W.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,l.wU)(e,i);c&&a.includes(c)&&t.setEditingId({messageId:void 0,tabId:s})})),(0,a.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:o,tabId:i=(0,h._w)()}=n,r=(0,l.Z1)(e,s);if(!r)return;await(0,W.t9)("deleteHistory",{chat:r,shouldDeleteForAll:o}),e=(0,a.Rd)();const c=(0,l.Bt)(e,i);c&&c.chatId===s&&t.openChat({id:void 0,tabId:i})})),(0,a.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:a,reason:s,description:o,tabId:i=(0,h._w)()}=n,r=(0,l.Bt)(e,i);if(!r)return;const{chatId:c}=r,d=(0,l.Z1)(e,c),u=await(0,W.t9)("reportMessages",{peer:d,messageIds:a,reason:s,description:o});t.showNotification({message:u?(0,y.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,a.iw)("sendMessageAction",(async(e,t,n)=>{const{action:a,chatId:s,threadId:o}=n;if(s===e.currentUserId)return;const i=(0,l.Z1)(e,s);if(!i)return;const r=(0,l.dy)(e,s);r&&((0,m.cS)(r)||(0,m.NB)(r))||await(0,W.t9)("sendMessageAction",{peer:i,threadId:o,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{maxId:a,tabId:s=(0,h._w)()}=n,i=(0,l.Bt)(e,s);if(!i)return;const{chatId:r,threadId:u}=i,m=(0,l.Z1)(e,r);if(!m)return;K((()=>{(0,W.t9)("markMessageListRead",{chat:m,threadId:u,maxId:a})})),r===o.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const g=(0,l.Cb)(e,r,u,s),p=(0,l.It)(e,r,u);if(!g||!p||!m.unreadCount)return e;const f=function(e,t,n){let a=0;for(let s=0,o=e.length;s<o&&(e[s]>=t&&e[s]<=n&&a++,!(e[s]>=n));s++);return a}(g,p,a);if(!f)return e;if(m.isForum&&m.topics?.[u]){const t=m.topics[u];e=(0,d.Xg)(e,r,u,{lastReadInboxMessageId:a});const n=Math.max(0,t.unreadCount-f);return 0===n&&(e=(0,d.a4)(e,r,{unreadCount:Math.max(0,m.unreadCount-1)})),(0,d.Cn)(e,r,u,{unreadCount:n})}return u===c._f?(0,d.a4)(e,r,{lastReadInboxMessageId:a,unreadCount:Math.max(0,m.unreadCount-f)}):void 0})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const{messageIds:a,tabId:s=(0,h._w)()}=n,o=(0,l.jr)(e,s);o&&(0,W.t9)("markMessagesRead",{chat:o,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,n)=>{const{text:s,tabId:o=(0,h._w)()}=n,i=await(0,W.t9)("fetchWebPagePreview",{message:s});e=(0,a.Rd)(),e=(0,p.i)(e,{webPagePreview:i},o),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};if((0,l.jU)(e,a).webPagePreview)return(0,p.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,l.Z1)(e,a);i&&(0,W.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.iw)("cancelPollVote",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,l.Z1)(e,a);o&&(0,W.t9)("sendPollVote",{chat:o,messageId:s,options:[]})})),(0,a.iw)("closePoll",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,l.Z1)(e,a),i=(0,l.hj)(e,a,s)?.content.poll;o&&i&&(0,W.t9)("closePoll",{chat:o,messageId:s,poll:i})})),(0,a.iw)("loadPollOptionResults",(async(e,t,n)=>{const{chat:s,messageId:o,option:i,offset:r,limit:c,shouldResetVoters:u,tabId:m=(0,h._w)()}=n,g=await(0,W.t9)("loadPollOptionResults",{chat:s,messageId:o,option:i,offset:r,limit:c});if(!g)return;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(g.users,"id"));const f=(0,l.jU)(e,m),{pollResults:I}=f,{voters:w}=f.pollResults;e=(0,p.i)(e,{pollResults:{...I,voters:{...w,[i]:(0,v.Tw)([...!u&&w&&w[i]?w[i]:[],...g&&g.users.map((e=>e.id))])},offsets:{...I.offsets?I.offsets:{},[i]:g.nextOffset||""}}},m),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:a,ids:s}=n,o=(0,l.Z1)(e,a);o&&(0,W.t9)("fetchExtendedMedia",{chat:o,ids:s})})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{isSilent:s,scheduledAt:o,tabId:i=(0,h._w)()}=n,{fromChatId:r,messageIds:c,toChatId:d,withMyScore:u,noAuthors:g,noCaptions:f,toThreadId:I}=(0,l.jU)(e,i).forwardMessages,v=(0,l.wV)(e),w=r?(0,l.Z1)(e,r):void 0,b=d?(0,l.Z1)(e,d):void 0,y=r&&c?c.sort(((e,t)=>e-t)).map((t=>(0,l.hj)(e,r,t))).filter(Boolean):void 0;if(!w||!b||!y||I&&!b.isForum)return;const P=(0,l._5)(e,d),Z=y.filter((e=>!(0,m.jM)(e)));Z.length&&(0,W.t9)("forwardMessages",{fromChat:w,toChat:b,toThreadId:I,messages:Z,isSilent:s,scheduledAt:o,sendAs:P,withMyScore:u,noAuthors:g,noCaptions:f,isCurrentUserPremium:v}),y.filter((e=>(0,m.jM)(e))).forEach((t=>{const{text:n,entities:a}=t.content.text||{},{sticker:r,poll:c}=t.content;ee(e,{chat:b,replyingToTopId:I,text:n,entities:a,sticker:r,poll:c,isSilent:s,scheduledAt:o,sendAs:P},i)})),e=(0,a.Rd)(),e=(0,p.i)(e,{forwardMessages:{}},i),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,n)=>{const{chatId:s}=n,o=(0,l.Z1)(e,s);if(!o)return;const i=await(0,W.t9)("fetchScheduledHistory",{chat:o});if(!i)return;const{messages:r}=i,u=(0,v.ee)(r,"id"),m=Object.keys(u).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,d.w3)(e,o.id,u),e=(0,d.pf)(e,o.id,c._f,"scheduledIds",m),o?.isForum){const t={};r.forEach((n=>{const a=(0,l.nr)(e,n),s=t[a]||[];s.push(n.id),t[a]=s})),Object.entries(t).forEach((t=>{let[n,a]=t;e=(0,d.pf)(e,o.id,Number(n),"scheduledIds",a)}))}(0,a.R3)(e)})),(0,a.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,o=(0,l.Z1)(e,a);o&&(0,W.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,l.Z1)(e,a),r=i&&(0,l.Tm)(e,i.id,s);i&&r&&(0,W.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,a.iw)("requestThreadInfoUpdate",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=(0,l.Cm)(e,s,o)?.id,c=await(0,W.t9)("requestThreadInfoUpdate",{chat:i,threadId:o,originChannelId:r});c&&(e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(c.users,"id")),(0,a.R3)(e))})),(0,a.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:s,chatId:o}=n,i=(0,l.Z1)(e,o);if(!i)return;e=(0,d.cY)(e,o,s,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,W.t9)("transcribeAudio",{chat:i,messageId:s});e=(0,a.Rd)(),e=(0,d.cY)(e,o,s,{transcriptionId:r,isTranscriptionError:!r}),(0,a.R3)(e)})),(0,a.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:s,ignoreCache:o}=n,i=o?s:(0,v.Tw)(s.filter((t=>!e.customEmojis.byId[t]))),r=await(0,W.t9)("fetchCustomEmoji",{documentId:i});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,v.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=await(0,W.t9)("fetchPinnedMessages",{chat:i,threadId:o});if(!r)return;const{messages:c,chats:u,users:m}=r,h=(0,v.ee)(c,"id"),g=Object.keys(h).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,d.c_)(e,i.id,h),e=(0,d.HX)(e,i.id,o,g),e=(0,d.Sh)(e,(0,v.ee)(m,"id")),e=(0,d.fZ)(e,(0,v.ee)(u,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=await(0,W.t9)("fetchSeenBy",{chat:i,messageId:o});r&&(e=(0,a.Rd)(),e=(0,d.cY)(e,s,o,{seenByUserIds:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,l.Z1)(e,a),i=(0,l.Z1)(e,s)||(0,l.dy)(e,s);if(o&&i)return(0,W.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,d.a4)(e,a,{fullInfo:{...o.fullInfo,sendAsId:s}})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,o=(0,l.Z1)(e,s);if(!o)return;const i=await(0,W.t9)("fetchSendAs",{chat:o});if(!i)return e=(0,a.Rd)(),e=(0,d.a4)(e,s,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(i.users,"id")),e=(0,d.fZ)(e,(0,v.ee)(i.chats,"id")),e=(0,d.a4)(e,s,{sendAsPeerIds:i.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:s}=n,o=(0,l.Z1)(e,s);if(!o)return;const i=await(0,W.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,a.Rd)(),e=(0,d.Fn)(e,s,i.messages[0]),e=(0,d.Sh)(e,(0,v.ee)(i.users,"id")),e=(0,d.fZ)(e,(0,v.ee)(i.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,l.Z1)(e,a),o=(0,l.fS)(e,a);s&&o&&(0,W.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=await(0,W.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!r)return;const{messages:c,chats:u,users:m}=r,h=(0,v.ee)(c,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,d.c_)(e,i.id,h),e=(0,d.Sh)(e,(0,v.ee)(m,"id")),e=(0,d.fZ)(e,(0,v.ee)(u,"id")),e=(0,d.a4)(e,s,{unreadMentions:[...i.unreadMentions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:s,tabId:o=(0,h._w)()}=n,i=(0,l.jr)(e,o);if(!i)return;const r=(i.unreadMentions||[]).filter((e=>!s.includes(e)));e=(0,d.a4)(e,i.id,{unreadMentions:r}),(0,a.R3)(e),t.markMessagesRead({messageIds:s,tabId:o})})),(0,a.iw)("focusNextMention",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jr)(e,a);s?.unreadMentions&&t.focusMessage({chatId:s.id,messageId:s.unreadMentions[0],tabId:a})})),(0,a.iw)("readAllMentions",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jr)(e,a);if(s)return(0,W.t9)("readAllMentions",{chat:s}),(0,d.a4)(e,s.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,a.iw)("openUrl",((e,t,n)=>{const{url:a,shouldSkipModal:s,tabId:i=(0,h._w)()}=n,r=(0,X.X)(a);if(r.match(o.FSu)||r.match(o.g$l))return void t.openTelegramLink({url:a,tabId:i});const{appConfig:c}=e;if(c){const e=new URL(r);if(c.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",c.autologinToken),void window.open(e.href,"_blank","noopener");if(c.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:a,tabId:i})}r.match(o.jL5)||s?window.open(r,"_blank","noopener"):t.toggleSafeLinkModal({url:r,tabId:i})})),(0,a.iw)("setForwardChatOrTopic",(async(e,t,n)=>{const{chatId:s,topicId:o,tabId:i=(0,h._w)()}=n;let r=(0,l.dy)(e,s);if(r&&(0,l.Nm)(e,i)){if(!r.fullInfo){const{accessHash:t}=r;r=await(0,W.t9)("fetchFullUser",{id:s,accessHash:t}),e=(0,a.Rd)()}if(r?.fullInfo.noVoiceMessages)return void t.showDialog({data:{message:(0,y.Iu)("VoiceMessagesRestrictedByPrivacy",(0,m.Js)(r))},tabId:i})}(0,l.GQ)(e,s,i)?(e=(0,p.i)(e,{forwardMessages:{...(0,l.jU)(e,i).forwardMessages,toChatId:s,toThreadId:o,isModalShown:!1}},i),(0,a.R3)(e),t.openChat({id:s,threadId:o,tabId:i}),t.closeMediaViewer({tabId:i}),t.exitMessageSelectMode({tabId:i})):t.showAllowedMessageTypesNotification({chatId:s,tabId:i})})),(0,a.iw)("forwardToSavedMessages",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{};e=(0,p.i)(e,{forwardMessages:{...(0,l.jU)(e,s).forwardMessages,toChatId:e.currentUserId}},s),(0,a.R3)(e),t.exitMessageSelectMode({tabId:s}),t.forwardMessages({isSilent:!0,tabId:s})})),(0,a.iw)("requestMessageTranslation",((e,t,n)=>{const{chatId:a,id:s,toLanguageCode:o=(0,l.rB)(e),tabId:i=(0,h._w)()}=n;return(0,d.ql)(e,a,s,o,i)})),(0,a.iw)("showOriginalMessage",((e,t,n)=>{const{chatId:a,id:s,tabId:o=(0,h._w)()}=n;return(0,d.IR)(e,a,s,o)})),(0,a.iw)("translateMessages",((e,t,n)=>{const{chatId:a,messageIds:s,toLanguageCode:o=(0,l.rB)(e)}=n,i=(0,l.Z1)(e,a);if(i)return s.forEach((t=>{e=(0,d.qt)(e,a,t,o,{isPending:!0})})),(0,W.t9)("translateText",{chat:i,messageIds:s,toLanguageCode:o}),e})),(0,a.iw)("loadMessageViews",(async(e,t,n)=>{const{chatId:s,ids:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=await(0,W.t9)("fetchMessageViews",{chat:i,ids:o});r&&(e=(0,a.Rd)(),r.forEach((t=>{e=(0,d.cY)(e,s,t.id,{views:t.views,forwards:t.forwards});const n=(0,l.hj)(e,s,t.id);if(!n)return;const a=n.repliesThreadInfo?.chatId,o=n.repliesThreadInfo?.threadId;a&&o&&(e=(0,d.Xg)(e,a,o,{messagesCount:t.messagesCount,recentReplierIds:t.recentReplierIds,lastMessageId:t.maxId,lastReadInboxMessageId:t.readMaxId}))})),(0,a.R3)(e))}));var ne=n(85765),ae=n(9211);const se=(0,x.P2)((e=>e()),500,!1);async function oe(e,t){const n=await(0,W.t9)("fetchRecentStickers",{hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:n}},(0,a.R3)(e))}async function ie(e,t,n){for(var s=arguments.length,o=new Array(s>3?s-3:0),i=3;i<s;i++)o[i-3]=arguments[i];let r,[c=(0,h._w)()]=o;try{r=await(0,W.t9)("fetchStickers",{stickerSetInfo:n})}catch(s){if("STICKERSET_INVALID"===s.message)return t.showNotification({message:(0,y.Iu)("StickerPack.ErrorNotFound"),tabId:c}),void("shortName"in n&&(0,l.jU)(e,c).openedStickerSetShortName===n.shortName&&(e=(0,p.i)(e,{openedStickerSetShortName:void 0},c),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!r)return;const{set:u,stickers:m,packs:g}=r,f=(e=(0,d.Rg)(e,u.id,{...u,stickers:m,packs:g})).stickers.forEmoji.emoji;f&&g[f]&&(e=(0,d.vy)(e)),(0,a.R3)(e)}async function re(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,h._w)()]=i;const l=await(0,W.t9)("searchGifs",{query:t,offset:s,username:n});l&&(e=(0,a.Rd)(),e=(0,d.rq)(e,!s,l.gifs,l.nextOffset,c),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[n,s]=await Promise.all([(0,W.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,W.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);s&&n&&(e=(0,a.Rd)(),e=(0,d.z3)(e,"added",n.hash,n.sets),e=(0,d.cU)(e,s.hash,s.sets),(0,a.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,a.iw)("loadAddedStickers",(async(e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{added:{setIds:s=[]},setsById:o}=e.stickers,{added:{setIds:i=[]}}=e.customEmojis,r=[...s,...i];if(r.length)for(let e=0;e<r.length;e++){const n=r[e];o[n]?.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:o[n].accessHash},tabId:a}),e%10==0&&e>0&&await(0,x.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};oe(e,t)})),(0,a.iw)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},n=await(0,W.t9)("fetchFavoriteStickers",{hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:n}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,W.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premium:{hash:n.hash,stickers:n.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumSetStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,W.t9)("fetchStickersForEmoji",{emoji:"📂⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premiumSet:{hash:n.hash,stickers:n.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,W.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}},(0,a.R3)(e))})),(0,a.iw)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},n=await(0,W.t9)("fetchFeaturedStickers",{hash:t});n&&(e=(0,a.Rd)(),e=(0,d.z3)(e,"featured",n.hash,n.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,W.t9)("fetchPremiumGifts");if(!t)return;const{set:n,stickers:s}=t;e=(0,a.Rd)(),e={...e,premiumGifts:{...n,stickers:s}},(0,a.R3)(e)})),(0,a.iw)("loadDefaultTopicIcons",(async e=>{const t=await(0,W.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,d.Rg)(e,o.id,o),e={...e,defaultTopicIconsId:o.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,W.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,d.Rg)(e,o.id,o),e={...e,defaultStatusIconsId:o.id},(0,a.R3)(e)})),(0,a.iw)("loadStickers",((e,t,n)=>{const{stickerSetInfo:a,tabId:s=(0,h._w)()}=n,o=(0,l.Ny)(e,a);o&&o.count===o?.stickers?.length||ie(e,t,a,s)})),(0,a.iw)("loadAnimatedEmojis",(async e=>{const[t,n]=await Promise.all([(0,W.t9)("fetchAnimatedEmojis"),(0,W.t9)("fetchAnimatedEmojiEffects")]);t&&n&&(e=(0,a.Rd)(),e=(0,d.g_)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...n.set,stickers:n.stickers}},(0,a.R3)(e))})),(0,a.iw)("loadGenericEmojiEffects",(async e=>{const t=await(0,W.t9)("fetchGenericEmojiEffects");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t;e={...e,genericEmojiEffects:{...n,stickers:s}},(0,a.R3)(e)})),(0,a.iw)("loadSavedGifs",(async e=>{const{hash:t}=e.gifs.saved,n=await(0,W.t9)("fetchSavedGifs",{hash:t});n&&(e=(0,a.Rd)(),e={...e,gifs:{...e.gifs,saved:n}},(0,a.R3)(e))})),(0,a.iw)("saveGif",(async(e,t,n)=>{const{gif:s,shouldUnsave:o,tabId:i=(0,h._w)()}=n,r=e.gifs.saved.gifs?.length,c=(0,ae.M)(e,"savedGifs"),d=(0,ae.P)(e,"savedGifs"),u=(0,l.wV)(e);if(!o&&r&&r>=c&&t.showNotification({title:y.Iu("LimitReachedFavoriteGifs",c.toString()),message:u?y.Iu("LimitReachedFavoriteGifsSubtitlePremium"):y.Iu("LimitReachedFavoriteGifsSubtitle",d.toString()),...!u&&{action:{action:"openPremiumModal",payload:{tabId:i}}},className:"bold-link",tabId:i}),!await(0,W.t9)("saveGif",{gif:s,shouldUnsave:o}))return;e=(0,a.Rd)();const m=e.gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==s.id}))||[],g=o?m:[s,...m];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:g}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a,tabId:s=(0,h._w)()}=n,o=e.stickers.favorite.stickers.length,i=(0,ae.M)(e,"stickersFaved"),r=(0,ae.P)(e,"stickersFaved"),c=(0,l.wV)(e);o>=i&&t.showNotification({title:y.Iu("LimitReachedFavoriteStickers",i.toString()),message:c?y.Iu("LimitReachedFavoriteStickersSubtitlePremium"):y.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:s}}},className:"bold-link",tabId:s}),a&&(0,W.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,n)=>{const{sticker:s}=n;s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:{...e.stickers.favorite,stickers:e.stickers.favorite.stickers.filter((e=>{let{id:t}=e;return t!==s.id}))}}},(0,a.R3)(e),(0,W.t9)("faveSticker",{sticker:s,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,W.t9)("removeRecentSticker",{sticker:s})&&oe((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,W.t9)("clearRecentStickers")&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:{stickers:[]}}},(0,a.R3)(e))})),(0,a.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,l.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i,isArchived:r}=s,c=!r&&Boolean(i);(0,W.t9)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:o})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,n)=>{const{language:s}=n;let o=e.emojiKeywords[s];if(o?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...o,isLoading:!0}}},(0,a.R3)(e);const i=await(0,W.t9)("fetchEmojiKeywords",{language:s,fromVersion:o?o.version:0});if(o=(e=(0,a.Rd)()).emojiKeywords[s],!i)return e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...o,isLoading:!1}}},void(0,a.R3)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{isLoading:!1,version:i.version,keywords:{...o?.keywords,...i.keywords}}}},(0,a.R3)(e)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,h._w)()}=n;s&&se((async()=>{const t=await(0,W.t9)("searchStickers",{query:s});if(!t)return;e=(0,a.Rd)();const{setsById:n,added:i}=e.stickers,r=t.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=n[e]||{};t&&(0,ne.Z)(t,s)&&r.unshift(e)}})),e=(0,d.z3)(e,"search",t.hash,t.sets),e=(0,d.fH)(e,t.hash,r,o),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,h._w)()}=n;"string"==typeof a&&se((()=>{re(e,a,e.config?.gifSearchUsername,void 0,s)}))})),(0,a.iw)("searchMoreGifs",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{query:s,offset:o}=(0,l.jU)(e,a).gifSearch;"string"==typeof s&&se((()=>{re(e,s,e.config?.gifSearchUsername,o,a)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:o}=e.stickers.forEmoji;se((async()=>{e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:s}}},(0,a.R3)(e);const t=await(0,W.t9)("fetchStickersForEmoji",{emoji:s,hash:o});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===s&&(e=(0,d.IM)(e,s,t.stickers,t.hash),(0,a.R3)(e))}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("loadCustomEmojiForEmoji",((e,t,n)=>{const{emoji:a}=n;return(0,d.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,W.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,v.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,v.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:s,tabId:o=(0,h._w)()}=n;(0,l.Ny)(e,s)||await ie(e,t,s,o),e=(0,a.Rd)();const i=(0,l.Ny)(e,s);i?.shortName&&(e=(0,p.i)(e,{openedStickerSetShortName:i.shortName},o),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,W.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,d.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var ce=n(790);const de=(0,x.P2)((e=>e()),500,!1);async function le(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0;for(var u=arguments.length,m=new Array(u>7?u-7:0),g=7;g<u;g++)m[g-7]=arguments[g];let p,[f=(0,h._w)()]=m;if(i){const e=(0,W.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:o.Hkl,offsetId:s,minDate:c,maxDate:r}),a=i.isForum?(0,W.t9)("fetchTopics",{chat:i,query:t,limit:o.XM3}):void 0,[d,l]=await Promise.all([e,a]);if(d){const{messages:e,users:t,totalCount:n,nextOffsetId:a}=d,{topics:s,count:o}=l||{};p={topics:s,totalTopicsCount:o,messages:e,users:t,chats:[],totalCount:n,nextRate:a}}}else p=await(0,W.t9)("searchMessagesGlobal",{query:t,offsetRate:s,limit:o.Hkl,type:n,maxDate:r,minDate:c});e=(0,a.Rd)();const I=(0,l.JX)(e,f);if(!p||""!==t&&t!==I)return e=(0,d.xv)(e,{messages:!1},f),void(0,a.R3)(e);const{messages:w,users:b,chats:y,totalCount:P,nextRate:Z}=p;y.length&&(e=(0,d.fZ)(e,(0,v.ee)(y,"id"))),b.length&&(e=(0,d.Sh)(e,(0,v.ee)(b,"id"))),w.length&&(e=(0,d.m6)(e,w)),e=(0,d.px)(e,w,P,n,Z,f),p.topics&&(e=(0,d.XG)(e,i.id,p.totalTopicsCount,p.topics));const C=p.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,d.No)(e,{foundTopicIds:C},f),(0,a.R3)(e)}async function ue(e,t,n,s,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var u=arguments.length,m=new Array(u>6?u-6:0),g=6;g<u;g++)m[g-6]=arguments[g];let[p=(0,h._w)()]=m;const f=await(0,W.t9)("searchMessagesLocal",{chat:t,type:s,limit:2*o.ENB,topMessageId:n===c._f?void 0:n,offsetId:i});if(!f)return;const{chats:I,users:w,messages:b,totalCount:y,nextOffsetId:P}=f,Z=(0,v.ee)(b,"id"),C=Object.keys(Z).map(Number);e=(0,a.Rd)(),(0,l.we)(e,p)&&(e=(0,d.fZ)(e,(0,v.ee)(I,"id")),e=(0,d.Sh)(e,(0,v.ee)(w,"id")),e=(0,d.c_)(e,t.id,Z),e=(0,d.c1)(e,t.id,n,s,C,y,P,p),(0,a.R3)(e),r||ue(e,t,n,s,P,!0,p))}let me,he;(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,h._w)()}=n,{chatId:i}=(0,l.jU)(e,o).globalSearch;s&&!i&&de((async()=>{const t=await(0,W.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,l.JX)(e,o);if(!t||!n||s!==n)return e=(0,d.xv)(e,{chats:!1},o),void(0,a.R3)(e);const{localChats:i,localUsers:r,globalChats:c,globalUsers:u}=t;(i.length||c.length)&&(e=(0,d.fZ)(e,(0,v.ee)([...i,...c],"id"))),(r.length||u.length)&&(e=(0,d.Sh)(e,(0,v.ee)([...r,...u],"id"))),e=(0,d.xv)(e,{chats:!1},o),e=(0,d.No)(e,{localResults:{chatIds:i.map((e=>{let{id:t}=e;return t})),userIds:r.map((e=>{let{id:t}=e;return t}))},globalResults:{...(0,l.jU)(e,o).globalSearch.globalResults,chatIds:c.map((e=>{let{id:t}=e;return t})),userIds:u.map((e=>{let{id:t}=e;return t}))}},o),(0,a.R3)(e)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:s,tabId:o=(0,h._w)()}=n,i=s?(0,ce.IS)(s):s;e=(0,d.No)(e,{date:s,query:"",resultsByType:{...(0,l.jU)(e,o).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},o),(0,a.R3)(e);const{chatId:r}=(0,l.jU)(e,o).globalSearch;le(e,"","text",void 0,r?(0,l.Z1)(e,r):void 0,i,s,o)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{const{type:a,tabId:s=(0,h._w)()}=n,{query:o,resultsByType:i,chatId:r,date:c}=(0,l.jU)(e,s).globalSearch,d=c?(0,ce.IS)(c):c,u=i?.[a]?.nextOffsetId;le(e,o,a,u,r?(0,l.Z1)(e,r):void 0,d,c,s)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{},{chatId:i,threadId:r}=(0,l.Bt)(e,s)||{},u=i?(0,l.Z1)(e,i):void 0;let m=(0,l.n5)(e,s);if(!u||!m||!r)return;const{query:g,results:p}=m,f=p?.nextOffsetId;let I;if(r!==c._f){const t=(0,l.tZ)(e,i,r);I=t?.topMessageId}if(!g)return;const w=await(0,W.t9)("searchMessagesLocal",{chat:u,type:"text",query:g,topMessageId:I,limit:o.pnA,offsetId:f});if(!w)return;const{chats:b,users:y,messages:P,totalCount:Z,nextOffsetId:C}=w,S=(0,v.ee)(P,"id"),E=Object.keys(S).map(Number);e=(0,a.Rd)(),m=(0,l.n5)(e,s),m&&g===m.query&&(e=(0,d.fZ)(e,(0,v.ee)(b,"id")),e=(0,d.Sh)(e,(0,v.ee)(y,"id")),e=(0,d.c_)(e,u.id,S),e=(0,d.dx)(e,u.id,r,E,Z,C,s),(0,a.R3)(e))})),(0,a.iw)("searchMediaMessagesLocal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s,threadId:o}=(0,l.Bt)(e,a)||{};if(!s||!o)return;const i=(0,l.Z1)(e,s),r=(0,l.we)(e,a);if(!i||!r)return;const{currentType:c,resultsByType:d}=r,u=c&&d&&d[c],m=u?.nextOffsetId;c&&ue(e,i,o,c,m,void 0,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,n)=>{const{timestamp:a,tabId:s=(0,h._w)()}=n,{chatId:o}=(0,l.Bt)(e,s)||{};if(!o)return;const i=(0,l.Z1)(e,o);if(!i)return;const r=await(0,W.t9)("findFirstMessageIdAfterDate",{chat:i,timestamp:a});r&&t.focusMessage({chatId:i.id,messageId:r,tabId:s})})),(0,a.iw)("checkPublicLink",(async(e,t,n)=>{const{username:s,tabId:o=(0,h._w)()}=n,{chatId:i}=(0,l.Bt)(e,o)||{};if(!i)return;if((0,l.jU)(e,o).management.progress===I.wv.InProgress)return;e=(0,d.fw)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0},o),(0,a.R3)(e);const{result:r,error:c}=await(0,W.t9)("checkChatUsername",{username:s});e=(0,a.Rd)(),e=(0,d.H9)(e,!0===r?I.wv.Complete:I.wv.Error,o),e=(0,d.fw)(e,i,{isUsernameAvailable:!0===r,checkedUsername:s,error:c},o),(0,a.R3)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:o})})),(0,a.iw)("updatePublicLink",(async(e,t,n)=>{const{username:s,tabId:o=(0,h._w)()}=n,{chatId:i}=(0,l.Bt)(e,o)||{};if(!i)return;const r=await(0,z.X9)(e,t,i,o);if(!r)return;e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.InProgress,o),(0,a.R3)(e);const c=await(0,W.t9)("setChatUsername",{chat:r,username:s});e=(0,a.Rd)(),e=(0,d.H9)(e,c?I.wv.Complete:I.wv.Error,o),e=(0,d.fw)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},o),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},{chatId:s}=(0,l.Bt)(e,a)||{},o=s&&(0,l.Z1)(e,s);s&&o&&(0,W.t9)("updatePrivateLink",{chat:o})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o,tabId:i=(0,h._w)()}=n;e=(0,d.fw)(e,s,{editingInvite:o},i),(0,a.R3)(e)})),(0,a.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:s,invite:o,tabId:i=(0,h._w)()}=n,r=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};e=(0,d.fw)(e,s,r,i),(0,a.R3)(e)})),(0,a.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o,isRevoked:i,limit:r,tabId:c=(0,h._w)()}=n,u=(0,l.Z1)(e,s),m=(0,l.dy)(e,o||e.currentUserId);if(!u||!m)return;const g=await(0,W.t9)("fetchExportedChatInvites",{peer:u,admin:m,isRevoked:i,limit:r});if(!g)return;e=(0,a.Rd)();const{invites:p,users:f}=g;e=(0,d.Sh)(e,(0,v.ee)(f,"id"));const I=i?{revokedInvites:p}:{invites:p};e=(0,d.fw)(e,s,I,c),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:u,title:m,tabId:g=(0,h._w)()}=n,p=(0,l.Z1)(e,s);if(!p)return;const f=await(0,W.t9)("editExportedChatInvite",{peer:p,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:u,title:m});if(!f)return;const{oldInvite:I,newInvite:w,users:b}=f;e=(0,a.Rd)();const{management:y}=(0,l.jU)(e,g),P=(y.byChatId[s].invites||[]).filter((e=>e.link!==I.link)),Z=[...y.byChatId[s].revokedInvites||[]];w.isRevoked?Z.unshift(w):P.push(w),e=(0,d.Sh)(e,(0,v.ee)(b,"id")),e=(0,d.fw)(e,s,{invites:P,revokedInvites:Z},g),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:s,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c,tabId:u=(0,h._w)()}=n,m=(0,l.Z1)(e,s);if(!m)return;const g=await(0,W.t9)("exportChatInvite",{peer:m,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c});if(!g)return;e=(0,a.Rd)();const p=(0,l.jU)(e,u).management.byChatId[s].invites||[];e=(0,d.fw)(e,s,{invites:[...p,g]},u),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,tabId:i=(0,h._w)()}=n,r=(0,l.Z1)(e,s);if(!r)return;if(!await(0,W.t9)("deleteExportedChatInvite",{peer:r,link:o}))return;e=(0,a.Rd)();const c=(0,l.jU)(e,i).management.byChatId[s];e=(0,d.fw)(e,s,{invites:c?.invites?.filter((e=>e.link!==o)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==o))},i),(0,a.R3)(e)})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o,tabId:i=(0,h._w)()}=n,r=(0,l.Z1)(e,s),c=(0,l.dy)(e,o||e.currentUserId);r&&c&&await(0,W.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,a.Rd)(),e=(0,d.fw)(e,s,{revokedInvites:[]},i),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteImporters",(async(e,t,n)=>{const{chatId:s,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:u=(0,h._w)()}=n,m=(0,l.Z1)(e,s),g=r?(0,l.dy)(e,r):void 0;if(!m||r&&!g)return;const p=await(0,W.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:i,offsetUser:g,limit:c});if(!p)return;const{importers:f,users:I}=p;e=(0,a.Rd)();const v=(0,l.jU)(e,u).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,d.fw)(e,s,{inviteInfo:{...v,importers:f}},u),e=(0,d.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,n)=>{const{chatId:s,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:u=(0,h._w)()}=n,m=(0,l.Z1)(e,s),g=r?(0,l.dy)(e,r):void 0;if(!m||r&&!g)return;const p=await(0,W.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:i,offsetUser:g,limit:c,isRequested:!0});if(!p)return;const{importers:f,users:I}=p;e=(0,a.Rd)();const v=(0,l.jU)(e,u).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,d.fw)(e,s,{inviteInfo:{...v,requesters:f}},u),e=(0,d.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:s,offsetDate:o=0,offsetUserId:i,limit:r=0}=n,c=(0,l.Z1)(e,s),u=i?(0,l.dy)(e,i):void 0;if(!c||i&&!u)return;const m=await(0,W.t9)("fetchChatInviteImporters",{peer:c,offsetDate:o,offsetUser:u,limit:r,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,a.Rd)(),e=(0,d.a4)(e,s,{joinRequests:h}),e=(0,d.Sh)(e,g),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:s,userId:o,isApproved:i}=n,r=(0,l.Z1)(e,s),c=(0,l.dy)(e,o);if(!r||!c)return;if(!await(0,W.t9)("hideChatJoinRequest",{peer:r,user:c,isApproved:i}))return;e=(0,a.Rd)();const u=(0,l.Z1)(e,s);u&&(e=(0,d.a4)(e,s,{joinRequests:u.joinRequests?.filter((e=>e.userId!==o))}),(0,a.R3)(e))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:s,isApproved:o,link:i}=n,r=(0,l.Z1)(e,s);if(!r)return;if(!await(0,W.t9)("hideAllChatJoinRequests",{peer:r,isApproved:o,link:i}))return;e=(0,a.Rd)();const c=(0,l.Z1)(e,s);c&&(e=(0,d.a4)(e,s,{joinRequests:[],fullInfo:{...c.fullInfo,recentRequesterIds:[],requestsPending:0}}),(0,a.R3)(e))})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,o=(0,l.Z1)(e,s);o&&await(0,W.t9)("hideChatReportPanel",o)&&(e=(0,a.Rd)(),e=(0,d.a4)(e,s,{settings:void 0}),(0,a.R3)(e))})),(0,a.iw)("uploadContactProfilePhoto",(async(e,t,n)=>{const{userId:s,file:o,isSuggest:i,tabId:r=(0,h._w)()}=n,c=(0,l.dy)(e,s);if(!c)return;e=(0,d.H9)(e,I.wv.InProgress,r),(0,a.R3)(e);const u=await(0,W.t9)("uploadContactProfilePhoto",{user:c,file:o,isSuggest:i});if(!u)return e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(u.users,"id")),(0,a.R3)(e);const{id:g,accessHash:p}=c;if(!await(0,W.t9)("fetchFullUser",{id:g,accessHash:p}))return e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:s}),e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.Complete,r),(0,a.R3)(e),o&&!i&&t.showNotification({message:y.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,m.Vl)(c)),tabId:r})})),(0,a.iw)("sync",((e,t)=>{o.eMD&&console.log(">>> START SYNC"),me&&clearTimeout(me),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),me=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),me=void 0}),15e3);const{loadAllChats:n,preloadTopChatMessages:s}=t;n({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(e,t){let n=!1;e=(0,a.Rd)();let s=!1;const i=Object.keys(e.messages.byChatId).reduce(((t,n)=>(t[n]=Object.keys(e.messages.byChatId[n].threadsById).reduce(((t,a)=>(t[Number(a)]={draft:(0,l.Ms)(e,n,Number(a)),editingId:(0,l._$)(e,n,Number(a)),editingDraft:(0,l.s)(e,n,Number(a)),replyingToId:(0,l.Yy)(e,n,Number(a))},t)),{}),t)),{});for(const{id:i}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:h,threadId:g}=(0,l.Bt)(e,i)||{},f=g||c._f,I=g&&h?(0,l.tZ)(e,h,g):void 0,w=h?e.chats.byId[h]:void 0;if(h&&w){const t=await(r=w,u=f,m=I?.lastReadInboxMessageId,(0,W.t9)("fetchMessages",{chat:r,threadId:u,offsetId:m||r.lastReadInboxMessageId,addOffset:-(Math.round(o.hT6/2)+1),limit:o.hT6}));e=(0,a.Rd)();const{chatId:c}=(0,l.Bt)(e,i)||{};if(t&&c===h){const a=(0,l.Zw)(e,h),i=h===o.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],r=w.isForum&&w.topics?Object.values(w.topics).map((e=>{let{lastMessageId:t}=e;return a[t]})).filter(Boolean):[],c=[].concat(t.messages,i),u=c.concat(r),m=(0,v.ee)(u,"id"),g=c.map((e=>{let{id:t}=e;return t}));s||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,p.i)(e,{tabThreads:{}},n)})),s=!0),e=(0,d.c_)(e,h,m),e=(0,d.xj)(e,h,f,g),I?.originChannelId&&(e=(0,d.Xg)(e,h,f,I)),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;const{chatId:a,threadId:s}=(0,l.Bt)(e,n)||{};a===h&&s===f&&(e=(0,d.y9)(e,h,f,g,n))})),e=(0,d.GL)(e,(0,v.ee)(t.chats,"id")),e=(0,d.eD)(e,(0,v.ee)(t.users,"id")),t.repliesThreadInfos.length&&(e=(0,d.j6)(e,h,t.repliesThreadInfos)),n=!0}}(0,a.R3)(e),w?.isForum&&(t.loadTopics({chatId:h,force:!0}),g&&g!==c._f&&t.loadTopicById({chatId:h,topicId:g,shouldCloseChatOnError:!0}))}var r,u,m;e=(0,a.Rd)(),n||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,p.i)(e,{tabThreads:{}},n)}))),Object.keys(i).forEach((t=>{const n=i[t];Object.keys(n).forEach((n=>{e=(0,d.sN)(e,t,Number(n),i[t][Number(n)])}))})),(0,a.R3)(e),Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:s,messageId:o}=(0,l.jU)(e,a).audioPlayer;s&&o&&!(0,l.hj)(e,s,o)&&t.closeAudioPlayer({tabId:a})}))}(e,t),e=(0,a.Rd)(),e={...e,lastSyncTime:Date.now(),isSyncing:!1},(0,a.R3)(e),o.eMD&&console.log(">>> FINISH SYNC"),(0,A.S1)(),n({listType:"archived",shouldReplace:!0}),(0,W.t9)("fetchCurrentUser"),s()}})})),(0,U.ll)((e=>{const{connectionState:t,authState:n}=e,{isMasterTab:s}=(0,l.jU)(e);!s||he?.connectionState===t&&he?.authState===n||"connectionStateReady"===t&&"authorizationStateReady"===n&&(0,a.Sv)().sync(),he=e})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:o,tabId:i=(0,h._w)()}=n;if(!a)return;const r=(0,l.Z1)(e,a);if(!r)return;const c=await(0,W.t9)("reportPeer",{peer:r,reason:s,description:o});t.showNotification({message:c?(0,y.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,a.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:a,reason:s,description:o,photo:i,tabId:r=(0,h._w)()}=n;if(!a)return;const c=(0,l.Z1)(e,a);if(!c||!i)return;const d=await(0,W.t9)("reportProfilePhoto",{peer:c,photo:i,reason:s,description:o});t.showNotification({message:d?(0,y.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("loadAuthorizations",(async e=>{const t=await(0,W.t9)("fetchAuthorizations");t&&(e=(0,a.Rd)(),e={...e,activeSessions:{byHash:t.authorizations,orderedHashes:Object.keys(t.authorizations),ttlDays:t.ttlDays}},(0,a.R3)(e))})),(0,a.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:s}=n;if(!await(0,W.t9)("terminateAuthorization",s))return;e=(0,a.Rd)();const{[s]:o,...i}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,W.t9)("terminateAllAuthorizations"))return;const t=(e=(0,a.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];e={...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}},(0,a.R3)(e)})),(0,a.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,W.t9)("changeSessionSettings",{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[s]:{...e.activeSessions.byHash[s],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0}}}},(0,a.R3)(e))})),(0,a.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:s}=n;await(0,W.t9)("changeSessionTtl",{days:s})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,ttlDays:s}},(0,a.R3)(e))})),(0,a.iw)("loadWebAuthorizations",(async e=>{const t=await(0,W.t9)("fetchWebAuthorizations");if(!t)return;const{users:n,webAuthorizations:s}=t;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(n,"id")),e={...e,activeWebSessions:{byHash:s,orderedHashes:Object.keys(s)}},(0,a.R3)(e)})),(0,a.iw)("terminateWebAuthorization",(async(e,t,n)=>{const{hash:s}=n;if(!await(0,W.t9)("terminateWebAuthorization",s))return;e=(0,a.Rd)();const{[s]:o,...i}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:i,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllWebAuthorizations",(async e=>{await(0,W.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));const ge=(0,x.P2)((e=>e()),500,!1);function pe(e,t,n){for(var a=arguments.length,s=new Array(a>3?a-3:0),o=3;o<a;o++)s[o-3]=arguments[o];let[i=(0,h._w)()]=s;const r=(0,l.jU)(e,i);return(0,p.i)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:n}}},i)}function fe(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),s=2;s<n;s++)a[s-2]=arguments[s];let[o=(0,h._w)()]=a;return(0,p.i)(e,{inlineBots:{...(0,l.jU)(e,o).inlineBots,isLoading:t}},o)}(0,a.iw)("loadFullUser",(async(e,t,n)=>{const{userId:a}=n,s=(0,l.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s,r=await(0,W.t9)("fetchFullUser",{id:o,accessHash:i});if(!r)return;const c=s.avatarHash!==r.avatarHash,d=s.fullInfo?.profilePhoto?.id!==r.fullInfo?.profilePhoto?.id,u=s.fullInfo?.fallbackPhoto?.id!==r.fullInfo?.fallbackPhoto?.id,m=s.fullInfo?.personalPhoto?.id!==r.fullInfo?.personalPhoto?.id;(c||d||u||m)&&s.photos?.length&&t.loadProfilePhotos({profileId:a})})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,o=(0,l.dy)(e,s);if(!o)return;const i=await(0,W.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:r,userStatusesById:c}=i;e=(0,a.Rd)(),e=(0,d.eD)(e,(0,v.ee)(r,"id")),e=(0,d.ps)(e,{...e.users.statusesById,...c}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,w.bp)()-t>60))return;const n=await(0,W.t9)("fetchTopUsers");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(o,"id")),e={...e,topPeers:{...e.topPeers,userIds:s,lastRequestedAt:(0,w.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,W.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(t.users,"id")),e=(0,d.fZ)(e,(0,v.ee)(t.chats,"id")),e=(0,d.zn)(e,t.userStatusesById);const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),o=t.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:o.map((e=>e.id))}},(0,a.R3)(e)})),(0,a.iw)("loadCurrentUser",(()=>{(0,W.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{},{chatId:o}=(0,l.Bt)(e,s)||{},i=o?(0,l.dy)(e,o):void 0;if(!i||(0,m.cS)(i)||i.commonChats?.isFullyLoaded)return;const r=i.commonChats?.maxId,c=await(0,W.t9)("fetchCommonChats",i.id,i.accessHash,r);if(!c)return;const{chats:u,chatIds:g,isFullyLoaded:p}=c;e=(0,a.Rd)(),u.length&&(e=(0,d.fZ)(e,(0,v.ee)(u,"id"))),e=(0,d.Nq)(e,i.id,{commonChats:{maxId:g.length?g[g.length-1]:"0",ids:(0,v.Tw)((i.commonChats?.ids||[]).concat(g)),isFullyLoaded:p}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,n)=>{const{userId:s,isMuted:o=!1,firstName:i,lastName:r,shouldSharePhoneNumber:c,tabId:u=(0,h._w)()}=n,m=(0,l.dy)(e,s);if(!m)return;let g;if(t.updateChatMutedState({chatId:s,isMuted:o}),e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.InProgress,u),(0,a.R3)(e),!m.isContact&&m.phoneNumber)g=await(0,W.t9)("importContact",{phone:m.phoneNumber,firstName:i,lastName:r});else{const{id:e,accessHash:t}=m;g=await(0,W.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:i,lastName:r,shouldSharePhoneNumber:c})}g&&(t.loadChatSettings({chatId:s}),e=(0,a.Rd)(),e=(0,d.Nq)(e,m.id,{firstName:i,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,d.H9)(e,I.wv.Complete,u),e=(0,d.ft)(e,u),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,n)=>{const{userId:a}=n,s=(0,l.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s;await(0,W.t9)("deleteContact",{id:o,accessHash:i})})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,o=(0,m.YC)(s);let i=o?(0,l.dy)(e,s):void 0;const r=o?void 0:(0,l.Z1)(e,s);if(!i&&!r)return;if(i&&!i.fullInfo?.profilePhoto){const{id:e,accessHash:t}=i;if(i=await(0,W.t9)("fetchFullUser",{id:e,accessHash:t}),!i)return}const c=await(0,W.t9)("fetchProfilePhotos",i,r);if(!c||!c.photos)return;e=(0,a.Rd)();const u=i||r,{photos:h,users:g}=c;h.sort((e=>e.id===u?.avatarHash?-1:1));const p=i?.fullInfo?.fallbackPhoto,f=i?.fullInfo?.personalPhoto;p&&h.push(p),f&&h.unshift(f),e=(0,d.Sh)(e,(0,v.ee)(g,"id")),e=o?(0,d.Nq)(e,s,{photos:h}):(0,d.a4)(e,s,{photos:h}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,h._w)()}=n;s&&ge((async()=>{const t=await(0,W.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,l.jU)(e,o).userSearch.query;if(!t||!n||s!==n)return e=(0,d.Q3)(e,!1,o),void(0,a.R3)(e);const{localUsers:i,globalUsers:r}=t;let c,u;i.length&&(e=(0,d.Sh)(e,(0,v.ee)(i,"id")),c=i.map((e=>{let{id:t}=e;return t}))),r.length&&(e=(0,d.Sh)(e,(0,v.ee)(r,"id")),u=r.map((e=>{let{id:t}=e;return t}))),e=(0,d.Q3)(e,!1,o),e=(0,d.Lm)(e,{localUserIds:c,globalUserIds:u},o),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:s,firstName:o,lastName:i,tabId:r=(0,h._w)()}=n,c=await(0,W.t9)("importContact",{phone:s,firstName:o,lastName:i});c?(t.openChat({id:c,tabId:r}),e=(0,a.Rd)(),e=(0,d.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:y.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,m.YC)(a)?(0,l.dy)(e,a):(0,l.Z1)(e,a);s&&(0,W.t9)("reportSpam",s)})),(0,a.iw)("setEmojiStatus",((e,t,n)=>{const{emojiStatus:a,expires:s}=n;(0,W.t9)("updateEmojiStatus",a,s)}));var Ie=n(18629);const ve=s.cj||s.wZ;class we{constructor(e,t){var n,a,s;this.features=e,this.onFail=t,n=this,s=void 0,(a=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 a=n.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(a="preOpened"))in n?Object.defineProperty(n,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[a]=s}preOpenIfNeeded(){ve&&(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(!ve){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const be="https://prizes.gamee.com/",ye=(0,x.Ds)((e=>e()),500,!1);async function Pe(e,t,n,s){await(0,W.t9)("toggleAttachBot",{bot:t,isWriteAllowed:s,isEnabled:n}),e=(0,a.Rd)(),await Ze(e)}async function Ze(e,t){const n=await(0,W.t9)("loadAttachBots",{hash:t});n&&(e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(n.users,"id")),e={...e,attachMenu:{hash:n.hash,bots:n.bots}},(0,a.R3)(e))}function Ce(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,h._w)()]=i;if("request"===s.type){e=(0,a.Rd)();const t=(0,l.jU)(e,c);if(!t.urlAuth)return;const{domain:n,bot:o,shouldRequestWriteAccess:i}=s;return e=(0,p.i)(e,{urlAuth:{...t.urlAuth,request:{domain:n,botId:o.id,shouldRequestWriteAccess:i}}},c),void(0,a.R3)(e)}const d="accepted"===s.type?s.url:n;window.open(d,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function Se(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c._f,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;await(0,W.t9)("sendMessage",{chat:e,replyingToTopId:t,text:n,replyingTo:a,sendAs:s})}let Ee;async function Me(e,t,n,a,s){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var i=arguments.length,r=new Array(i>6?i-6:0),c=6;c<i;c++)r[c-6]=arguments[c];let[d=(0,h._w)()]=r;const{showDialog:l,showNotification:u,openUrl:m,openGame:g}=t;o&&(Ee||(Ee=new we("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),Ee.preOpenIfNeeded());const p=await(0,W.t9)("answerCallbackButton",{chatId:n.id,accessHash:n.accessHash,messageId:a,data:s,isGame:o});if(!p)return;const{message:f,alert:I,url:v}=p;I?l({data:{message:f||"Error"},tabId:d}):f?u({message:f,tabId:d}):v&&(o?v.includes(be)?Ee.open(v):(Ee.cancelPreOpen(),g({url:v,chatId:n.id,messageId:a,tabId:d})):m({url:v,tabId:d}))}async function Re(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),o=2;o<n;o++)s[o-2]=arguments[o];let[i=(0,h._w)()]=s;const r=await(0,W.t9)("getPaymentForm",t);if(!r)return;const{form:c,invoice:l,users:u}=r;return e=(0,a.Rd)(),e=(0,d._7)(e,c,i),e=(0,d.Q$)(e,I.KB.Checkout,i),e=(0,d.Sh)(e,(0,v.ee)(u,"id")),(0,a.R3)(e),l}async function ke(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,h._w)()]=i;const l=await(0,W.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:n,shouldSave:s});if(!l)return;const{id:u,shippingOptions:m}=l;e=(0,a.Rd)(),e=(0,d.vT)(e,u,c),m?(e=(0,d.TM)(e,m,c),e=(0,d.Q$)(e,I.KB.Shipping,c)):e=(0,d.Q$)(e,I.KB.Checkout,c),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:s,tabId:o=(0,h._w)()}=n;switch(s.type){case"command":t.sendBotCommand({command:s.text,tabId:o});break;case"url":{const{url:e}=s;t.openUrl({url:e,tabId:o});break}case"callback":{const n=(0,l.jr)(e,o);if(!n)return;Me(e,t,n,a,s.data,void 0,o);break}case"requestPoll":t.openPollModal({isQuiz:s.isQuiz,tabId:o});break;case"requestPhone":{const n=e.currentUserId?(0,l.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id},tabId:o});break}case"receipt":{const n=(0,l.jr)(e,o);if(!n)return;const{receiptMessageId:i}=s;t.getReceipt({receiptMessageId:i,chatId:n.id,messageId:a,tabId:o});break}case"buy":{const n=(0,l.jr)(e,o);if(!n)return;t.openInvoice({chatId:n.id,messageId:a,tabId:o});break}case"game":{const n=(0,l.jr)(e,o);if(!n)return;Me(e,t,n,a,void 0,!0,o);break}case"switchBotInline":{const{query:e,isSamePeer:n}=s;t.switchBotInline({query:e,isSamePeer:n,messageId:a,tabId:o});break}case"userProfile":{const{userId:e}=s;t.openChatWithInfo({id:e,tabId:o});break}case"simpleWebView":{const{url:n}=s,{chatId:i}=(0,l.Bt)(e,o)||{};if(!i)return;const r=(0,l.hj)(e,i,a);if(!r?.senderId)return;const c=(0,Ie.BS)();t.requestSimpleWebView({url:n,botId:r?.senderId,theme:c,buttonText:s.text,tabId:o});break}case"webView":{const{url:n}=s,i=(0,l.jr)(e,o);if(!i)return;const r=(0,l.hj)(e,i.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,Ie.BS)();t.requestWebView({url:n,botId:c,peerId:i.id,theme:d,buttonText:s.text,tabId:o});break}case"urlAuth":{const{url:n}=s,i=(0,l.jr)(e,o);if(!i)return;t.requestBotUrlAuth({chatId:i.id,messageId:a,buttonId:s.buttonId,url:n,tabId:o});break}}})),(0,a.iw)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s,tabId:o=(0,h._w)()}=n,i=s?(0,l.Z1)(e,s):(0,l.jr)(e,o),r=(0,l.Bt)(e,o);if(!i||!r)return;const{threadId:c}=r;t.setReplyingToId({messageId:void 0,tabId:o}),t.clearWebPagePreview({tabId:o}),Se(i,c,a,(0,l.Yy)(e,i.id,c),(0,l._5)(e,i.id))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s,tabId:o=(0,h._w)()}=n,{currentUserId:i}=e,r=(0,l.jr)(e,o),u=i&&(0,l.IK)(e,s);i&&r&&u&&await(0,W.t9)("unblockContact",u.id,u.accessHash)&&(e=(0,a.Rd)(),e=(0,d.rB)(e,u.id),(0,a.R3)(e),Se(r,c._f,"/start",void 0,(0,l._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,w.bp)()-t<60)return;const n=await(0,W.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,w.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:s,username:o,query:i,offset:r,tabId:c=(0,h._w)()}=n;let u=(0,l.jU)(e,c).inlineBots.byUsername[o];if(!1!==u){if(void 0===u){const{user:t,chat:n}=await(0,W.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!t||!n)return e=pe(e,o,!1,c),void(0,a.R3)(e);e=(0,d.Sh)(e,{[t.id]:t}),e=(0,d.fZ)(e,{[n.id]:n}),u={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=pe(e,o,u,c),(0,a.R3)(e)}(i!==u.query||u.canLoadMore)&&ye((()=>{!async function(e,t){let{username:n,inlineBotData:s,chatId:o,query:i,offset:r}=t;for(var c=arguments.length,d=new Array(c>2?c-2:0),u=2;u<c;u++)d[u-2]=arguments[u];let[m=(0,h._w)()]=d;e=(0,a.Rd)();const g=(0,l.dy)(e,s.id),p=(0,l.Z1)(e,o);if(!g||!p)return;const f=s.query!==i;e=pe(e=fe(e,!0,m),n,{...s,query:i,...f&&{offset:void 0,results:[]}},m),(0,a.R3)(e);const I=await(0,W.t9)("fetchInlineBotResults",{bot:g,chat:p,query:i,offset:f?void 0:r});e=(0,a.Rd)();const v=(0,l.jU)(e,m).inlineBots.byUsername[n];if(e=fe(e,!1,m),!I||!v||i!==v.query)return void(0,a.R3)(e);const w=new Set((v.results||[]).map((e=>e.id))),b=I.results.filter((e=>!w.has(e.id)));e=pe(e,n,{...v,help:I.help,cacheTime:Date.now()+1e3*I.cacheTime,...b.length&&{isGallery:I.isGallery},...I.switchPm&&{switchPm:I.switchPm},canLoadMore:I.results.length>0&&Boolean(I.nextOffset),results:""===v.offset||v.offset===I.nextOffset?I.results:(v.results||[]).concat(b),offset:b.length?I.nextOffset:""},m),(0,a.R3)(e)}(e,{username:o,inlineBotData:u,chatId:s,query:i,offset:r},c)}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:o,tabId:i=(0,h._w)()}=n,r=(0,l.jr)(e,i);if(!r)return;const c=(0,l.hj)(e,r.id,o);if(!c)return;const d=(0,l.dy)(e,c.viaBotId||c.senderId);d&&t.openChatWithDraft({text:`@${d.usernames[0].username} ${a}`,chatId:s?r.id:void 0,tabId:i})})),(0,a.iw)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s,isSilent:o,scheduledAt:i,tabId:r=(0,h._w)()}=n,d=(0,l.Bt)(e,r);if(!d||!a)return;const{chatId:u,threadId:m}=d,g=(0,l.Z1)(e,u),p=(0,l.Yy)(e,u,m);let f;p&&m!==c._f&&(f=(0,l.qS)(e,u,m)),t.setReplyingToId({messageId:void 0,tabId:r}),t.clearWebPagePreview({tabId:r}),(0,W.t9)("sendInlineBotResult",{chat:g,resultId:a,queryId:s,replyingTo:p,replyingToTopId:f,sendAs:(0,l._5)(e,u),isSilent:o,scheduleDate:i})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s,force:o,tabId:i=(0,h._w)()}=n;let r=(0,l.jU)(e,i).inlineBots.byUsername[s];r&&(!o&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=pe(e,s,r,i),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jU)(e,a).inlineBots.byUsername;Object.keys(s).forEach((e=>{t.resetInlineBot({username:e,tabId:a})}))})),(0,a.iw)("startBot",(async(e,t,n)=>{const{botId:s,param:o}=n;let i=(0,l.dy)(e,s);i&&(i.fullInfo||await(0,W.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash}),e=(0,a.Rd)(),i=(0,l.dy)(e,s),i.fullInfo?.isBlocked&&await(0,W.t9)("unblockContact",i.id,i.accessHash),await(0,W.t9)("startBot",{bot:i,startParam:o}))})),(0,a.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:s,botId:o,theme:i,buttonText:r,tabId:c=(0,h._w)()}=n,d=(0,l.dy)(e,o);if(!d)return;if(!(0,l.LM)(e,o))return e=(0,p.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}},c),void(0,a.R3)(e);const u=await(0,W.t9)("requestSimpleWebView",{url:s,bot:d,theme:i});u&&(e=(0,a.Rd)(),e=(0,p.i)(e,{webApp:{url:u,botId:o,buttonText:r}},c),(0,a.R3)(e))})),(0,a.iw)("requestWebView",(async(e,t,n)=>{const{url:s,botId:o,peerId:i,theme:r,isSilent:c,buttonText:d,isFromBotMenu:u,startParam:m,tabId:g=(0,h._w)()}=n,f=(0,l.dy)(e,o);if(!f)return;const I=(0,l.Z1)(e,i);if(!I)return;if(!(0,l.LM)(e,o))return e=(0,p.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}},g),void(0,a.R3)(e);const v=(0,l.Bt)(e,g);if(!v)return;const{chatId:w,threadId:b}=v,y=w&&(0,l.Yy)(e,w,b),P=(0,l._5)(e,w),Z=await(0,W.t9)("requestWebView",{url:s,bot:f,peer:I,theme:r,isSilent:c,replyToMessageId:y||void 0,threadId:b,isFromBotMenu:u,startParam:m,sendAs:P});if(!Z)return;const{url:C,queryId:S}=Z;e=(0,a.Rd)(),e=(0,p.i)(e,{webApp:{url:C,botId:o,queryId:S,replyToMessageId:y||void 0,threadId:b,buttonText:d}},g),(0,a.R3)(e)})),(0,a.iw)("prolongWebView",(async(e,t,n)=>{const{botId:a,peerId:s,isSilent:o,replyToMessageId:i,queryId:r,threadId:c,tabId:d=(0,h._w)()}=n,u=(0,l.dy)(e,a);if(!u)return;const m=(0,l.Z1)(e,s);if(!m)return;const g=(0,l._5)(e,s);await(0,W.t9)("prolongWebView",{bot:u,peer:m,isSilent:o,replyToMessageId:i,threadId:c,queryId:r,sendAs:g})||t.closeWebApp({tabId:d})})),(0,a.iw)("sendWebViewData",((e,t,n)=>{const{bot:a,data:s,buttonText:o}=n;(0,W.t9)("sendWebViewData",{bot:a,data:s,buttonText:o})})),(0,a.iw)("closeWebApp",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n,s=(0,l.jU)(e,a);if(s.webApp?.url)return(0,p.i)(e,{webApp:{...s.webApp,slug:n.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,n)=>{const{botId:s,tabId:o=(0,h._w)()}=n,{trustedBotIds:i}=e,r=new Set(i);r.add(s),e={...e,trustedBotIds:Array.from(r)};const c=(0,l.jU)(e,o);if(c.botTrustRequest?.onConfirm){const{action:e,payload:n}=c.botTrustRequest.onConfirm;t[e](n)}e=(0,p.i)(e,{botTrustRequest:void 0},o),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:a}=n||{};await Ze(e,a)})),(0,a.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:a,isWriteAllowed:s,isEnabled:o}=n,i=(0,l.dy)(e,a);i&&await Pe(e,i,o,s)})),(0,a.iw)("callAttachBot",((e,t,n)=>{const{chatId:a,bot:s,url:o,startParam:i,threadId:r,tabId:c=(0,h._w)()}=n,d=!s;if(!d&&!e.attachMenu.bots[s.id])return(0,p.i)(e,{requestedAttachBotInstall:{bot:s,onConfirm:{action:"callAttachBot",payload:n}}},c);const l=(0,Ie.BS)();t.openChat({id:a,threadId:r,tabId:c}),t.requestWebView({url:o,peerId:a,botId:d?a:s.id,theme:l,buttonText:"",isFromBotMenu:d,startParam:i,tabId:c})})),(0,a.iw)("confirmAttachBotInstall",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,h._w)()}=n,{requestedAttachBotInstall:i}=(0,l.jU)(e,o),{bot:r,onConfirm:c}=i;e=(0,p.i)(e,{requestedAttachBotInstall:void 0},o),(0,a.R3)(e);const d=(0,l.dy)(e,r.id);if(d&&(await Pe(e,d,!0,s),c)){const{action:e,payload:n}=c;t[e](n)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,n)=>{const{bot:s,filter:o,startParam:i,tabId:r=(0,h._w)()}=n,c=(0,l.Bt)(e,r)?.chatId,d=s.peerTypes.filter((e=>"self"!==e&&o.includes(e)));d.length?(e=(0,p.i)(e,{requestedAttachBotInChat:{bot:s,filter:d,startParam:i}},r),(0,a.R3)(e)):t.callAttachBot({chatId:c||s.id,bot:s,startParam:i,tabId:r})})),(0,a.iw)("cancelAttachBotInChat",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{requestedAttachBotInChat:void 0},a)})),(0,a.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:s,buttonId:o,messageId:i,url:r,tabId:c=(0,h._w)()}=n,d=(0,l.Z1)(e,s);if(!d)return;const u=await(0,W.t9)("requestBotUrlAuth",{chat:d,buttonId:o,messageId:i});u&&(e=(0,a.Rd)(),e=(0,p.i)(e,{urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:d.id}}},c),(0,a.R3)(e),Ce(e,t,r,u,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,h._w)()}=n,i=(0,l.jU)(e,o);if(!i.urlAuth?.button)return;const{button:r,url:c}=i.urlAuth,{chatId:d,messageId:u,buttonId:m}=r,g=(0,l.Z1)(e,d);if(!g)return;const p=await(0,W.t9)("acceptBotUrlAuth",{chat:g,messageId:u,buttonId:m,isWriteAllowed:s});p&&Ce(e=(0,a.Rd)(),t,c,p,o)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:s,tabId:o=(0,h._w)()}=n,i=await(0,W.t9)("requestLinkUrlAuth",{url:s});i&&(e=(0,a.Rd)(),e=(0,p.i)(e,{urlAuth:{url:s}},o),(0,a.R3)(e),Ce(e,t,s,i,o))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,h._w)()}=n,i=(0,l.jU)(e,o);if(!i.urlAuth?.url)return;const{url:r}=i.urlAuth,c=await(0,W.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:s});c&&Ce(e=(0,a.Rd)(),t,r,c,o)})),(0,a.iw)("closeUrlAuthModal",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{urlAuth:void 0},a)})),n(55282),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,W.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,d.BI)(e,{hasPassword:t.hasPassword}),e=(0,d.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(0,a.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;e=(0,d.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,W.t9)("checkPassword",s);e=(0,a.Rd)(),e=(0,d.IE)(e,{isLoading:!1}),(0,a.R3)(e),i&&o()})),(0,a.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;e=(0,d.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,W.t9)("clearPassword",s);e=(0,a.Rd)(),e=(0,d.IE)(e,{isLoading:!1}),(0,a.R3)(e),i&&o()})),(0,a.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:s,password:o,hint:i,email:r,onSuccess:c}=n;e=(0,d.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const l=await(0,W.t9)("updatePassword",s,o,i,r);e=(0,a.Rd)(),e=(0,d.IE)(e,{isLoading:!1}),(0,a.R3)(e),l&&c()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:s,email:o,onSuccess:i}=n;e=(0,d.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,W.t9)("updateRecoveryEmail",s,o);e=(0,a.Rd)(),e=(0,d.IE)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,a.R3)(e),r&&i()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,W.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,d.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:a,saveInfo:s,tabId:o=(0,h._w)()}=n,i=(0,l.kb)(e,o);if(i)if("slug"in i)ke(e,i,a,s,o);else{const t=(0,l.Z1)(e,i.chatId);if(!t)return;ke(e,{chat:t,messageId:i.messageId},a,s,o)}})),(0,a.iw)("openInvoice",(async(e,t,n)=>{const{tabId:s=(0,h._w)()}=n;let o;if("slug"in n)o=await Re(e,{slug:n.slug},s);else{const t=(0,l.Z1)(e,n.chatId);if(!t)return;o=await Re(e,{chat:t,messageId:n.messageId},s)}o&&(e=(0,a.Rd)(),e=(0,d.bs)(e,o,s),e=(0,p.i)(e,{payment:{...(0,l.jU)(e,s).payment,inputInvoice:n,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:n.isExtendedMedia}},s),(0,a.R3)(e))})),(0,a.iw)("getReceipt",(async(e,t,n)=>{const{receiptMessageId:s,chatId:o,messageId:i,tabId:r=(0,h._w)()}=n,c=o&&(0,l.Z1)(e,o);if(!i||!s||!c)return;const u=await(0,W.t9)("getReceipt",c,s);if(!u)return;e=(0,a.Rd)();const m=(0,l.hj)(e,c.id,i);e=(0,d.Sh)(e,(0,v.ee)(u.users,"id")),e=(0,d.Dq)(e,u.receipt,m,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{};e=(0,p.i)(e,{payment:{...(0,l.jU)(e,s).payment,error:void 0}},s),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{};return(0,p.i)(e,{payment:{...(0,l.jU)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,n)=>{const{credentials:s,tabId:i=(0,h._w)()}=n,{nativeProvider:r}=(0,l.jU)(e,i).payment,{data:c}=s;if("stripe"===r){const t=(0,l.$$)(e,i);if(!t)return;!async function(e,t,n){for(var s=arguments.length,o=new Array(s>3?s-3:0),i=3;i<s;i++)o[i-3]=arguments[i];let[r=(0,h._w)()]=o;const c=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":t.cardNumber,"card[exp_month]":t.expiryMonth,"card[exp_year]":t.expiryYear,"card[cvc]":t.cvv,"card[address_zip]":t.zip,"card[address_country]":t.country}),u=await fetch(`https://api.stripe.com/v1/tokens${c}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${n}`}}),g=await u.json();if(g.error){const t=(0,m.Ow)(g.error);return e=(0,a.Rd)(),e=(0,p.i)(e,{payment:{...(0,l.jU)(e,r).payment,status:"failed",error:{...t}}},r),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,d.QH)(e,{type:g.type,id:g.id},r),e=(0,d.Q$)(e,I.KB.Checkout,r),(0,a.R3)(e)}(e,c,t,i)}else if("smartglocal"===r){const t=(0,l.EB)(e,i);if(!t)return;!async function(e,t,n){for(var s=arguments.length,i=new Array(s>3?s-3:0),r=3;r<s;r++)i[r-3]=arguments[r];let[c=(0,h._w)()]=i;const u={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},m=o.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",g=await fetch(m,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":n},body:JSON.stringify(u)}),f=await g.json();if("ok"!==f.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,p.i)(e,{payment:{...(0,l.jU)(e,c).payment,status:"failed",error:{...t}}},c),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,d.QD)(e,{type:"card",token:f.data.token},c),e=(0,d.Q$)(e,I.KB.Checkout,c),(0,a.R3)(e)}(e,c,t,i)}})),(0,a.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:s,saveCredentials:o,savedCredentialId:i,tipAmount:r,tabId:c=(0,h._w)()}=n,u=(0,l.kb)(e,c),m=(0,l.eh)(e,c),g=(0,l.sp)(e,c),{nativeProvider:p,temporaryPassword:f}=(0,l.jU)(e,c).payment,I="stripe"===p?(0,l.$$)(e,c):(0,l.EB)(e,c);if(!(u&&I&&m&&p))return;let v;if("slug"in u)v={slug:u.slug};else{const t=(0,l.Z1)(e,u.chatId);if(!t)return;v={chat:t,messageId:u.messageId}}e=(0,d.cQ)(e,{status:"pending"},c),(0,a.R3)(e);const w={save:o,data:"stripe"===p?(0,l.i3)(e,c):(0,l.Jg)(e,c)};await(0,W.t9)("sendPaymentForm",{inputInvoice:v,formId:m,credentials:w,requestedInfoId:g,shippingOptionId:s,savedCredentialId:i,temporaryPassword:f?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,d.cQ)(e,{status:"paid"},c),e=(0,d.WY)(e,c),(0,a.R3)(e))})),(0,a.iw)("setPaymentStep",((e,t,n)=>{const{step:a,tabId:s=(0,h._w)()}=n;return(0,d.Q$)(e,null!=a?a:I.KB.Checkout,s)})),(0,a.iw)("closePremiumModal",((e,t,n)=>{const{isClosed:a,tabId:s=(0,h._w)()}=n||{},o=(0,l.jU)(e,s);if(o.premiumModal)return(0,p.i)(e,{premiumModal:{...o.premiumModal,...a&&{isOpen:!1},isClosing:!a}},s)})),(0,a.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:s,fromUserId:o,isSuccess:i,isGift:r,monthsAmount:c,toUserId:l,tabId:u=(0,h._w)()}=n||{};t.loadPremiumStickers();const m=await(0,W.t9)("fetchPremiumPromo");m&&(e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(m.users,"id")),e=(0,p.i)(e,{premiumModal:{promo:m.promo,initialSection:s,isOpen:!0,fromUserId:o,toUserId:l,isGift:r,monthsAmount:c,isSuccess:i}},u),(0,a.R3)(e))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:s,tabId:o=(0,h._w)()}=n||{},i=await(0,W.t9)("fetchPremiumPromo");if(!i)return;e=(0,a.Rd)(),e=(0,d.Sh)(e,(0,v.ee)(i.users,"id"));const r=i.promo.options.find((e=>1===e.months));e=(0,p.i)(e,{giftPremiumModal:{isOpen:!0,forUserId:s,monthlyCurrency:r.currency,monthlyAmount:r.amount}},o),(0,a.R3)(e)})),(0,a.iw)("closeGiftPremiumModal",((e,t,n)=>{const{tabId:s=(0,h._w)()}=n||{};e=(0,p.i)(e,{giftPremiumModal:{isOpen:!1}},s),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,n)=>{const{password:s,tabId:o=(0,h._w)()}=n,i=await(0,W.t9)("fetchTemporaryPaymentPassword",s);e=(0,a.Rd)(),e=i?"error"in i?(0,d.cQ)(e,{error:{message:i.error,field:"password"}},o):(0,d.cQ)(e,{temporaryPassword:i,step:I.KB.Checkout},o):(0,d.cQ)(e,{error:{message:"Unknown Error",field:"password"}},o),(0,a.R3)(e)}));var Te=n(40647),Ae=n(74399);const Ne=32*Ae.Gw,xe=45.5*Ae.Gw,Be=26.5*Ae.Gw,Le=16*Ae.Gw,Ue=16.125*Ae.Gw;var je=n(43858),Oe=n(53475),Fe=n(4907);function _e(e,t){return t-((0,l.jU)(e).isLeftColumnShown&&!(0,S.W7)()?e.leftColumnWidth||((n=je.Z.get().width)>o._mX?Math.min(Math.max(.25*n,Le),.33*n):n>o.ksF?Math.min(Math.max(.33*n,Le),.4*n):Be):0);var n}function De(e,t,n){return(0,Oe.a4)(e,t,n,void 0,!0)}let qe=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,W.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&Te.he(`sticker${e.aroundAnimation.id}`,c.IU.BlobUrl),e.centerIcon&&Te.he(`sticker${e.centerIcon.id}`,c.IU.BlobUrl)})),e=(0,a.Rd)(),e={...e,availableReactions:t},(0,a.R3)(e))})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:o,startSize:i,isReversed:r,tabId:c=(0,h._w)()}=n,d={id:qe++,animatedEffect:a,x:_e(e,s)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:i,isReversed:r};return(0,p.i)(e,{activeEmojiInteractions:[...(0,l.jU)(e,c).activeEmojiInteractions||[],d]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:o,interactions:i}=n,r=(0,l.Z1)(e,s);r&&o&&s!==e.currentUserId&&(0,W.t9)("sendEmojiInteraction",{chat:r,messageId:a,emoticon:o,timestamps:i})})),(0,a.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,h._w)()}=n,i=(0,l.q6)(e,a),r=(0,l.hj)(e,a,s);i&&r&&!(0,m.CI)(r)&&t.toggleReaction({chatId:a,messageId:s,reaction:i,tabId:o})})),(0,a.iw)("toggleReaction",((e,t,n)=>{const{chatId:a,reaction:s,tabId:i=(0,h._w)()}=n;let{messageId:r}=n;const c=(0,l.Z1)(e,a);let d=(0,l.hj)(e,a,r);if(!c||!d)return;const u=Boolean(d.groupedId)&&!d.isInAlbum,g=u?(0,l.xH)(e,a,d.groupedId)[0]:void 0;d=u&&(0,l.hj)(e,a,g)||d,r=d?.id||r;const f=(0,m.UZ)(d),I=f.some((e=>(0,m.Hl)(e,s))),w=I?f.filter((e=>!(0,m.Hl)(e,s))):[...f,s],b=(0,l.oC)(e),y=w.slice(-b);(0,W.t9)("sendReaction",{chat:c,messageId:r,reactions:y});const{animationLevel:P}=e.settings.byKey,Z=(0,l.jU)(e,i);if(P===o.zy8){const t=I?(0,v.CE)(Z.activeReactions,[r]):{...Z.activeReactions,[r]:[...Z.activeReactions[r]||[],{messageId:r,reaction:s}]};e=(0,p.i)(e,{activeReactions:t},i)}return function(e,t,n){const a=t.reactions||{results:[]},s=a.results.map((e=>(0,m.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=s.findIndex((t=>(0,m.Hl)(t.reaction,e)));n>-1?s[n]={...s[n],chosenOrder:t,count:s[n].count+1}:s.push({reaction:e,chosenOrder:t,count:1})}));let{recentReactions:o=[]}=a;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,Fe.cY)(e,t.chatId,t.id,{reactions:{...a,results:s,recentReactions:o}})}(e,d,y)})),(0,a.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:a,reaction:s,tabId:o=(0,h._w)()}=n,i=(0,l.jU)(e,o);if(!i.activeReactions[a]?.some((e=>(0,m.Hl)(e.reaction,s))))return e;const r=i.activeReactions[a].filter((e=>!(0,m.Hl)(e.reaction,s))),c=r.length?{...i.activeReactions,[a]:r}:(0,v.CE)(i.activeReactions,[a]);return(0,p.i)(e,{activeReactions:c},o)})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;await(0,W.t9)("setDefaultReaction",{reaction:s})&&((e=(0,a.Rd)()).config?(e={...e,config:{...e.config,defaultReaction:s}},(0,a.R3)(e)):t.loadConfig())})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,n)=>{const{id:a,tabId:s=(0,h._w)()}=n;return(0,p.i)(e,{activeEmojiInteractions:(0,l.jU)(e,s).activeEmojiInteractions?.filter((e=>e.id!==a))},s)})),(0,a.iw)("loadReactors",(async(e,t,n)=>{const{chatId:s,messageId:o,reaction:i}=n,r=(0,l.Z1)(e,s),c=(0,l.hj)(e,s,o);if(!r||!c)return;const u=c.reactors?.nextOffset,m=await(0,W.t9)("fetchMessageReactionsList",{reaction:i,chat:r,messageId:o,offset:u});m&&(e=(0,a.Rd)(),m.users?.length&&(e=(0,d.Sh)(e,(0,v.ee)(m.users,"id"))),e=(0,d.cY)(e,s,o,{reactors:m}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,l.Z1)(e,s);o&&(0,W.t9)("fetchMessageReactions",{ids:a,chat:o})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:a,emoticon:s,x:o,y:i,startSize:r,isReversed:c,id:d,tabId:u=(0,h._w)()}=n,m=(0,l.Z1)(e,a),g=(0,l.jU)(e,u);if(m&&g.activeEmojiInteractions?.some((e=>e.id===d))&&a!==e.currentUserId)return(0,W.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:s}),(0,p.i)(e,{activeEmojiInteractions:g.activeEmojiInteractions.map((t=>t.id===d?{...t,x:_e(e,o),y:i,startSize:r,isReversed:c}:t))},u)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,l.Z1)(e,s);if(!i)return;const r=await(0,W.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!r||!r.messages.length)return e=De(e=(0,a.Rd)(),s,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:c,chats:u,users:m}=r,h=(0,v.ee)(c,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,d.c_)(e,i.id,h),e=(0,d.Sh)(e,(0,v.ee)(m,"id")),e=De(e=(0,d.fZ)(e,(0,v.ee)(u,"id")),s,{unreadReactions:[...i.unreadReactions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:s,tabId:i=(0,h._w)()}=n,{animationLevel:r}=e.settings.byKey,c=(0,l.jr)(e,i);if(c){if(c.unreadReactionsCount){const n=c.unreadReactionsCount-s.length,o=(c.unreadReactions||[]).filter((e=>!s.includes(e)));e=De(e,c.id,{unreadReactions:o}),(0,a.R3)(e),!o.length&&n&&t.fetchUnreadReactions({chatId:c.id,offsetId:Math.min(...s)})}if(t.markMessagesRead({messageIds:s,tabId:i}),r===o.zy8)return e=(0,a.Rd)(),(0,p.i)(e,{activeReactions:{...(0,l.jU)(e,i).activeReactions,...Object.fromEntries(s.map((t=>{const n=(0,l.hj)(e,c.id,t);if(!n)return;const a=n.reactions?.recentReactions?.filter((e=>{let{isUnread:t}=e;return t}));if(!a)return;const s=a.map((e=>e.reaction));return[t,s.map((e=>({messageId:t,reaction:e})))]})).filter(Boolean))}},i)}})),(0,a.iw)("focusNextReaction",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jr)(e,a);s?.unreadReactions&&t.focusMessage({chatId:s.id,messageId:s.unreadReactions[0],tabId:a})})),(0,a.iw)("readAllReactions",((e,t,n)=>{const{tabId:a=(0,h._w)()}=n||{},s=(0,l.jr)(e,a);if(s)return(0,W.t9)("readAllReactions",{chat:s}),De(e,s.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:s,isGroup:o,tabId:i=(0,h._w)()}=n,r=(0,l.Z1)(e,s);if(!r?.fullInfo)return;const c=await(0,W.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r});if(!c)return;e=(0,a.Rd)();const{stats:u,users:m}=c;if(e=(0,d.Sh)(e,(0,v.ee)(m,"id")),"recentTopMessages"in u&&u.recentTopMessages.length){const t=(0,l.Zw)(e,s);u.recentTopMessages=u.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}e=(0,d.ze)(e,s,u,i),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:s,messageId:o,tabId:i=(0,h._w)()}=n,r=(0,l.Z1)(e,s);if(!r?.fullInfo)return;let c=await(0,W.t9)("fetchMessageStatistics",{chat:r,messageId:o});c||(c={}),e=(0,a.Rd)();const{views:u,forwards:m}=(0,l.Zw)(e,s)[o];c.views=u,c.forwards=m;const g=r.fullInfo.statisticsDcId,p=await(0,W.t9)("fetchMessagePublicForwards",{chat:r,messageId:o,dcId:g});c.publicForwards=p?.length,c.publicForwardsData=p,e=(0,a.Rd)(),e=(0,d.kM)(e,c,i),(0,a.R3)(e)})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:s,token:o,name:i,isPercentage:r,tabId:c=(0,h._w)()}=n,u=(0,l.Z1)(e,s);if(!u?.fullInfo)return;const m=u.fullInfo.statisticsDcId,g=await(0,W.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:m,isPercentage:r});g&&(e=(0,a.Rd)(),e=(0,d.yC)(e,s,i,g,c),(0,a.R3)(e))})),n(28304);var $e=n(28406);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{const{isForum:s,lastReadOutboxMessageId:o}=(0,l.Z1)(e,n.id)||{};return n.chat.lastReadOutboxMessageId&&o&&n.chat.lastReadOutboxMessageId<o&&(n={...n,chat:(0,v.CE)(n.chat,["lastReadInboxMessageId"])}),e=(0,d.a4)(e,n.id,n.chat,n.newProfilePhoto),(0,a.R3)(e),n.noTopChatsRequest||(0,l.N)(e,n.id)||t.loadTopChats(),n.chat.id&&(0,$e.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((a=>{let{id:o}=a;const{chatId:i}=(0,l.Bt)(e,o)||{},r=n;i===r.id&&"isForum"in r.chat&&s!==r.chat.isForum&&(s&&t.closeForumPanel({tabId:o}),t.openChat({id:i,tabId:o}))}))}case"updateChatJoin":{const s=(0,l.Ek)(e,n.id);if(!s)return;e=(0,d.B1)(e,s,[n.id]),e=(0,d.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const o=(0,l.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.id}))}case"updateChatLeave":return(0,d.Dd)(e,n.id);case"updateChatInbox":return(0,d.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,threadId:s=c._f,typingStatus:o}=n;return e=(0,d.pf)(e,t,s,"typingStatus",o),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const n=(0,l.WP)(e,t,s,"typingStatus");o&&n&&o.timestamp===n.timestamp&&(e=(0,d.pf)(e,t,s,"typingStatus",void 0),(0,a.R3)(e))}),6e3)}case"newMessage":{const{message:t}=n;if(t.senderId===e.currentUserId&&!t.isFromScheduled)return;const s=(0,l.Z1)(e,n.chatId);if(!s)return;const o=Boolean(n.message.id&&n.message.hasUnreadMention);return e=(0,d.a4)(e,n.chatId,{unreadCount:s.unreadCount?s.unreadCount+1:1,...o&&{unreadMentionsCount:(s.unreadMentionsCount||0)+1}}),o&&(e=(0,d.a4)(e,n.chatId,{unreadMentions:[...s.unreadMentions||[],n.message.id]})),(0,a.R3)(e),void(0,$e.rh)({chat:s,message:t})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=n;if(!1!==a.hasUnreadMention)return;return t.forEach((t=>{const a="channelId"in n?n.channelId:(0,l.X5)(e,t),s=(0,l.Z1)(e,a);s?.unreadReactionsCount&&(e=De(e,a,{unreadReactionsCount:s.unreadReactionsCount-1||void 0,unreadReactions:s.unreadReactions?.filter((e=>e!==t))})),s?.unreadMentionsCount&&(e=(0,d.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1||void 0,unreadMentions:s.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,a=e.chats.byId[n.id];if(!a)return;return(0,d.a4)(e,n.id,{fullInfo:{...a.fullInfo,...t}})}case"updatePinnedChatIds":{const{ids:t,folderId:a}=n,s=a===o.WSp?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[s]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=n,s=(0,l.Ek)(e,t);if(!s)return;const{[s]:i}=e.chats.orderedPinnedIds;let r=i||[];if(a){if(!r.includes(t)){if("active"===s&&r.length>=o.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,[s]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:a}=n;return(0,d.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=n,{byId:s,orderedIds:o}=e.chatFolders,i=a?{...s,[t]:a}:(0,v.ei)(s,Object.keys(s).map(Number).filter((e=>e!==t))),r=a?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:a,addedMember:s,deletedMemberId:o}=n;if(!t)return;let i=!1,r=t.fullInfo?.members?[...t.fullInfo.members]:[];if(a)r=a,i=!0;else if(s)r.length&&r.some((e=>e.userId===s.userId))||(r.push(s),i=!0);else if(r.length&&o){const e=r.findIndex((e=>e.userId===o));e>-1&&(r.slice(e,1),i=!0)}if(i){const a=r.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,d.a4)(e,n.id,{membersCount:r.length,fullInfo:{...t.fullInfo,members:r,adminMembersById:(0,v.ee)(a,"userId")}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=n,s=e.chats.byId[t];return s?.photos?(0,d.a4)(e,t,{photos:s.photos.filter((e=>!a.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:a,date:s,replyingToId:o,threadId:i}=n;if(!e.chats.byId[t])return;return e=(0,d.pf)(e,t,i||c._f,"draft",a),e=(0,d.pf)(e,t,i||c._f,"replyingToId",o),e=(0,d.a4)(e,t,{draftDate:s})}case"showInvite":{const{data:a}=n;return void Object.values(e.byTabId).forEach((e=>{let{id:n}=e;t.showDialog({data:a,tabId:n})}))}case"updatePendingJoinRequests":{const{chatId:s,requestsPending:o,recentRequesterIds:i}=n,r=e.chats.byId[s];if(!r)return;return e=(0,d.a4)(e,s,{fullInfo:{...r.fullInfo,requestsPending:o,recentRequesterIds:i}}),(0,a.R3)(e),void t.loadChatJoinRequests({chatId:s})}case"updatePinnedTopic":{const{chatId:t,topicId:s,isPinned:o}=n;if(!e.chats.byId[t])return;return e=(0,d.Cn)(e,t,s,{isPinned:o}),void(0,a.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:s}=n;if(!e.chats.byId[t])return;return e=(0,d.a4)(e,t,{orderedPinnedTopicIds:s}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:s}=n,o=(0,l.Z1)(e,a);if(!o?.isForum)return;return void t.loadTopicById({chatId:a,topicId:s})}case"updateTopics":{const{chatId:a}=n,s=(0,l.Z1)(e,a);if(!s?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}}}));var He=n(84112);const Ge=350;function Ve(e,t,n,a,s,o,i){const r=i?.reactions;if(r&&(0,He.A)(a,r))return e;if(e=(0,d.cY)(e,t,n,{reactions:a}),!o)return e;const c=s.unreadReactions?.includes(n);if((0,m.yL)(e,a)&&!c){e=De(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||0)+1,unreadReactions:[...s?.unreadReactions||[],n]});const a=(0,l.hj)(e,t,n);if(!s||!a)return e;(0,x.R3)((()=>{(0,$e.rh)({chat:s,message:a,isReaction:!0})}))}else c&&(e=De(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||1)-1,unreadReactions:s?.unreadReactions?.filter((e=>e!==n))}));return e}function ze(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=s?(0,l.Tm)(e,t,n):(0,l.hj)(e,t,n);if(o&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,m.qp)(o);e&&a.content.photo?(a.content.photo.blobUrl=e.blobUrl,a.content.photo.thumbnail=e.thumbnail):t&&a.content.video?a.content.video.blobUrl=t.blobUrl:n&&a.content.sticker?a.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:s&&a.content.document&&(a.content.document.previewBlobUrl=s.previewBlobUrl)}const i=o?{...o,...a}:a;return s?(0,d.P4)(e,t,n,i):(0,d.cY)(e,t,n,i)}function We(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,l.Db)(e,n)||{};if(!o&&n.replyToMessageId){const o=(0,l.hj)(e,s,n.replyToMessageId);o?e=(0,d.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function Xe(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,firstMessageId:i}=(0,l.Db)(e,n)||{},r=(0,l.Z1)(e,s),u=r?.unreadCount&&!(0,l.gb)(e,s,c._f);return e=We(e,t,n),o&&(!i&&(0,m.CI)(n)||(e=(0,d.xj)(e,s,o.threadId,[a]),Object.values(e.byTabId).forEach((t=>{let{id:r}=t;(0,l.b9)(e,s,o.threadId,r)&&(e=(0,d.$S)(e,s,o.threadId,a,r),i||(e=(0,d.pf)(e,s,o.threadId,"firstMessageId",n.id)))}))),e=(0,d.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id}),(0,m.CI)(n)||(e=(0,d.Xg)(e,s,o.threadId,{messagesCount:(o.messagesCount||0)+1}))),u||(e=(0,d.xj)(e,s,c._f,[a]),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;if((0,l.b9)(e,s,c._f,n)){const t=(0,l.It)(e,s,c._f),o=(0,d.$S)(e,s,c._f,a,n),i=(0,l.Cb)(o,s,c._f,n);t&&!i.includes(t)||(e=o)}}))),e}function Ye(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:s}=e,o=s.byId[t],i=o?.lastMessage,r=o?.isForum?(0,l.p$)(e,n):void 0;return r&&(e=(0,d.Cn)(e,t,r.id,{lastMessageId:n.id})),!i||a||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,d.a4)(e,t,{lastMessage:n}):e}function Ke(e,t){const n=(0,l.Zw)(e,t),a=(0,l.gb)(e,t,c._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function Je(e,t,n,s){if(t){const o=(0,l.Z1)(e,t);if(!o)return;n.forEach((n=>{e=(0,d.cY)(e,t,n,{isDeleting:!0});const a=Ke(e=(0,d.CE)(e,t,n),t);a&&(e=Ye(e,t,a,!0)),o.topics?.[n]&&(e=(0,d.BK)(e,t,n))})),s.requestChatUpdate({chatId:t});const i=[];return n.forEach((n=>{const a=(0,l.hj)(e,t,n);if(!a)return;e=We(e,s,a,!0);const o=(0,l.nr)(e,a);o&&i.push(o)})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,d.K4)(e,t,n),(0,a.R3)(e),(0,v.Tw)(i).forEach((e=>{s.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),Ge)}const o=[];n.forEach((t=>{const n=(0,l.X5)(e,t);if(n){o.push(n);const s=Ke(e=(0,d.cY)(e,n,t,{isDeleting:!0}),n);s&&(e=Ye(e,n,s,!0)),setTimeout((()=>{e=(0,a.Rd)(),e=(0,d.K4)(e,n,[t]),(0,a.R3)(e)}),Ge)}})),(0,a.R3)(e),(0,v.Tw)(o).forEach((e=>{s.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:s,id:o,message:i,shouldForceReply:r}=n;e=Xe(e=ze(e,s,o,i),t,i),i.repliesThreadInfo&&(e=(0,d.Xg)(e,i.repliesThreadInfo.chatId,i.repliesThreadInfo.threadId,i.repliesThreadInfo));const u=(0,l.hj)(e,s,o),h=(0,l.Z1)(e,s);h?.isForum&&u.isTopicReply&&!(0,l.p$)(e,u)&&u.replyToMessageId&&t.loadTopicById({chatId:s,topicId:u.replyToMessageId}),Object.values(e.byTabId).forEach((n=>{let{id:h}=n;const g=(0,m.CI)(i);if((0,l.KA)(e,s,i,h)){if(g&&i.isOutgoing&&!i.content?.action){const n=(0,l.Bt)(e,h);n&&t.focusMessage({chatId:s,threadId:n.threadId,messageId:i.id,noHighlight:!0,isResizingContainer:!0,tabId:h})}const{threadInfo:n}=(0,l.Db)(e,i)||{};n&&!g&&t.requestThreadInfoUpdate({chatId:s,threadId:n.threadId}),g||setTimeout((()=>{e=(0,a.Rd)(),r&&(e=(0,d.pf)(e,s,c._f,"replyingToId",o)),e=Ye(e,s,u),(0,a.R3)(e)}),Ge)}else e=Ye(e,s,u)})),(0,a.R3)(e),(0,l.N)(e,s)||t.loadTopChats();break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:s}=(0,l.Bt)(e,a)||{};if(s!==n.id)return;const o=(0,l.hj)(e,s,n.messageId);if(!o)return;if((0,m.UD)(o)!==n.emoji)return;const i=(0,l.jU)(e,a);e=(0,p.i)(e,{activeEmojiInteractions:[...i.activeEmojiInteractions||[],{id:i.activeEmojiInteractions?.length||0,animatedEffect:n.emoji,messageId:n.messageId}]},a)})),(0,a.R3)(e);break;case"newScheduledMessage":{const{chatId:t,id:s,message:o}=n;e=ze(e,t,s,o,!0);const i=(0,l.qy)(e,t,c._f)||[];e=(0,d.pf)(e,t,c._f,"scheduledIds",(0,v.Tw)([...i,s]));const r=(0,l.nr)(e,o);if(r!==c._f){const n=(0,l.qy)(e,t,r)||[];e=(0,d.pf)(e,t,r,"scheduledIds",(0,v.Tw)([...n,s]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:t,id:s,message:o}=n,i=(0,l.hj)(e,t,s),r=(0,l.Z1)(e,t);e=ze(e,t,s,o);const c=(0,l.hj)(e,t,s);o.repliesThreadInfo&&(e=(0,d.Xg)(e,o.repliesThreadInfo.chatId,o.repliesThreadInfo.threadId,o.repliesThreadInfo)),i&&(e=Ye(e,t,c)),o.reactions&&r&&(e=Ve(e,t,s,o.reactions,r,c.isOutgoing,i)),o.content?.text?.text!==i?.content?.text?.text&&(e=(0,d.CE)(e,t,s)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n,i=(0,l.Tm)(e,t,s);if(!i)return;e=ze(e,t,s,o,!0);const r=Object.keys((0,l.yB)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,d.pf)(e,t,c._f,"scheduledIds",r);const u=(0,l.nr)(e,i);if(u!==c._f){const n=(0,l.qy)(e,t,u)||[];e=(0,d.pf)(e,t,u,"scheduledIds",n.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:i}=n;e=Xe(e,t,i);const r=(0,l.hj)(e,s,o);e=(0,d.K4)(e,s,[o]),i.isScheduled&&(e=(0,d.bV)(e,s,[o])),e=(0,d.cY)(e,s,i.id,{...r,...i,previousLocalId:o});const u=(0,l.hj)(e,s,i.id);e=Ye(e,s,u);const m=(0,l.Db)(e,i);Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:o,threadId:r}=(0,l.Bt)(e,a)||{};o===s&&(m?.threadInfo?.threadId||c._f)===r&&t.markMessageListRead({maxId:i.id,tabId:a})})),m?.threadInfo&&(e=(0,d.pf)(e,s,m.threadInfo.threadId,"threadInfo",{...m.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,i=(0,l.qy)(e,t,c._f)||[];e=(0,d.pf)(e,t,c._f,"scheduledIds",[...i,o.id]);const r=(0,l.nr)(e,o);if(r!==c._f){const n=(0,l.qy)(e,t,r)||[];e=(0,d.pf)(e,t,r,"scheduledIds",[...n,o.id])}const u=(0,l.Tm)(e,t,s);e=(0,d.bV)(e,t,[s]),e=(0,d.P4)(e,t,o.id,{...u,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,i=(0,v.q0)((0,l.Zw)(e,t),o),r={[c._f]:o};Object.values(i).forEach((n=>{const a=(0,l.nr)(e,n);if(e=(0,d.cY)(e,t,n.id,{isPinned:s}),a===c._f)return;const o=r[a]||[];o.push(n.id),r[a]=o})),Object.entries(r).forEach((n=>{let[a,o]=n;const i=(0,l.KB)(e,t,c._f)||[],r=s?(0,v.Tw)(i.concat(o)).sort(((e,t)=>t-e)):i.filter((e=>!o.includes(e)));e=(0,d.pf)(e,t,Number(a),"pinnedIds",r)})),(0,a.R3)(e);break}case"updateThreadInfo":{const{chatId:s,threadId:o,threadInfo:i,firstMessageId:r}=n,c=(0,l.tZ)(e,s,o),u={...c,...i};if(!u.threadId)return;e=(0,d.Xg)(e,s,o,u),r&&(e=(0,d.pf)(e,s,o,"firstMessageId",r));const m=(0,l.Z1)(e,s);if(m?.isForum&&i.lastReadInboxMessageId!==c?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:o}),i.topMessageId===o&&!m?.isForum){const t=m?.lastReadInboxMessageId,n=u.lastReadInboxMessageId||t;t&&n&&(e=(0,d.Xg)(e,s,o,{lastReadInboxMessageId:Math.max(n,t)}))}(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,l.Zw)(e,s);o&&!(0,m.YC)(s)&&(e=(0,d.K4)(e,s,Object.keys(o).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0,tabId:(0,h._w)()}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;Je(e,s,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,d.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,a.Rd)(),s=(0,d.bV)(s,e,t);const n=(0,l.yB)(s,e);s=(0,d.pf)(s,e,c._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),Ge))}(s,t,0,e);break}case"deleteHistory":{const{chatId:s}=n,i=e.messages.byChatId[s];if(s===o.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,a.R3)(e)),i){const n=Object.keys(i.byId).map(Number);Je(e=(0,a.Rd)(),s,n,t)}else t.requestChatUpdate({chatId:s});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,l.X5)(e,t);n&&(e=(0,d.cY)(e,n,t,s))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:s,messageUpdate:o}=n;s.forEach((n=>{e=(0,d.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,l.ZB)(e,t);if(o?.content.poll){const t=o.content.poll.results;let n=t;s.results?.results&&(t.results&&s.results.isMin?t.results&&(n={...s.results,results:s.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):n=s.results);const i={...o.content.poll,...s,results:n};e=(0,d.cY)(e,o.chatId,o.id,{content:{...o.content,poll:i}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:o}=n,i=(0,l.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:r}=i.content,{recentVoterIds:c,totalVoters:u,results:m}=r.results,h=c?[...c]:[],g=u?u+1:1,p=m?[...m]:[];h.push(s),o.forEach((t=>{const n=p.findIndex((e=>e.option===t)),a=p[n],o=a?{...a}:{option:t,votersCount:0};o.votersCount+=1,s===e.currentUserId&&(o.isChosen=!0),n?p[n]=o:p.push(o)})),e=(0,d.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...r,results:{...r.results,recentVoterIds:h,totalVoters:g,results:p}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=n;(0,l.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:o}=n,i=(0,l.hj)(e,t,s),r=(0,l.Z1)(e,n.chatId);if(!r||!i)return;e=Ve(e,t,s,o,r,i.isOutgoing,i),(0,a.R3)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:s,media:o,preview:i}=n,r=(0,l.hj)(e,t,s);if(!(0,l.Z1)(e,n.chatId)||!r)return;if(i){if(!r.content.invoice)return;e=(0,d.cY)(e,t,s,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:i}}}),(0,a.R3)(e)}else o&&(e=(0,d.cY)(e,t,s,{content:{...o}}),(0,a.R3)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:s,isPending:o}=n;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:s,isPending:o}}},(0,a.R3)(e);break}case"updateMessageSendFailed":{const{chatId:s,localId:o,error:i}=n;i.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:n}=e;t.showAllowedMessageTypesNotification({chatId:s,tabId:n})})),e=(0,d.cY)(e,s,o,{sendingState:"messageSendingStateFailed"}),(0,a.R3)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:s,toLanguageCode:o,translations:i}=n;e=(0,d.TD)(e,t,s,o,i),(0,a.R3)(e);break}}}));const Qe=(0,x.P2)((function(){let e=(0,a.Rd)();e=(0,d.ps)(e,{...e.users.statusesById,...et}),(0,a.R3)(e),et={}}),3e3,!0);let et={};(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,d.GK)(e,n.id);case"updateUser":return Object.values(e.byTabId).forEach((a=>{let{id:s}=a;n.id===e.currentUserId&&n.user.isPremium!==(0,l.wV)(e)&&(n.user.isPremium&&t.openPremiumModal({isSuccess:!0,tabId:s}),e={...e,translations:{byChatId:{}}})})),(0,d.Nq)(e,n.id,n.user);case"updateRequestUserUpdate":t.loadFullUser({userId:n.id});break;case"updateUserEmojiStatus":return(0,d.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return a=n.userId,s=n.status,et[a]=s,void Qe();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n,s=e.users.byId[t];if(!s)return;return(0,d.Nq)(e,t,{fullInfo:{...s.fullInfo,...a}})}case"updateBotMenuButton":{const{botId:t,button:a}=n,s=(0,l.dy)(e,t);if(!s?.fullInfo?.botInfo)return;return(0,d.Nq)(e,t,{fullInfo:{...s.fullInfo,botInfo:{...s.fullInfo.botInfo,menuButton:a}}})}}var a,s})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,d.Rg)(e,n.id,n.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,d.O4)(e,n.id):(0,d.rB)(e,n.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,a.R3)(e);break;case"updateConfig":t.loadConfig();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateRecentEmojiStatuses":t.loadRecentEmojiStatuses();break;case"updateMoveStickerSetToTop":{const a=n.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!a)return e;const s=[n.id,...a.filter((e=>e!==n.id))];t.reorderStickerSets({order:s,isCustomEmoji:n.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const a=n.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:a,isCustomEmoji:n.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}},(0,a.R3)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,d.fS)(e,n.url,a),e=(0,d.Q$)(e,I.KB.ConfirmPayment,a)})),(0,a.R3)(e);break;case"updateWebViewResultSent":Object.values(e.byTabId).forEach((e=>{e.webApp?.queryId===n.queryId&&(t.setReplyingToId({messageId:void 0,tabId:e.id}),t.closeWebApp({tabId:e.id}))}))}})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,d.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:s,isSilent:o,shouldShowPreviews:i}=n;e.chats.byId[t]&&(e=(0,d.a4)(e,t,{isMuted:s})),e=(0,d.aK)(e,t,{isMuted:s,isSilent:o,shouldShowPreviews:i}),(0,a.R3)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:s,isMuted:o}=n;e=(0,d.Cn)(e,t,s,{isMuted:o}),(0,a.R3)(e);break}}})),(0,a.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 tt=n(78958),nt=n(42431);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":{if("discarded"===n.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,h._w)()})):(0,tt.dc)(e,n.call.id);const a=(0,nt.$5)(e,n.call.id),s=a?.chatId;return s&&(e=(0,d.a4)(e,s,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,tt.AH)(e,n.call.id,(0,v.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount)}case"updateGroupCallChatId":{const t=(0,l.Z1)(e,n.chatId);return t&&(e=(0,d.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:s,nextOffset:o}=n,{currentUserId:i}=e;e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,tt.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,tt.AH)(e,t,{nextOffset:o}));const r=(0,nt.$5)(e,t),c=r?.chatId;return c&&(e=(0,d.a4)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!s.Bi)return;const{phoneCall:o,currentUserId:i}=e,{call:r}=n;if(o)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,h._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==i&&"requested"===r.state)return(0,x.R3)((()=>{e=(0,a.Rd)(),(0,$e.TO)({call:r,user:(0,nt.fu)(e)})})),(0,D.EP)(),(0,D.CW)(e,t,r.isVideo,(0,h._w)()),e={...e,phoneCall:r},(0,p.i)(e,{isCallPanelVisible:!1},(0,h._w)())}}}));var at=n(9937);(0,a.iw)("apiUpdate",((e,t,n)=>{"updatePaymentStateCompleted"===n["@type"]&&Object.values(e.byTabId).forEach((a=>{let{id:o}=a;const{inputInvoice:i}=(0,l.jU)(e,o).payment;if(i&&"chatId"in i&&"messageId"in i){const n=(0,l.hj)(e,i.chatId,i.messageId);if(n&&n.content.invoice){const{amount:e,currency:a,title:s}=n.content.invoice;t.showNotification({tabId:o,message:y.Iu("PaymentInfoHint",[(0,at.x)(e,a,y.QO().code),s])})}}s.Xp||(e=(0,d.WY)(e,o)),n.slug&&i&&"slug"in i&&i.slug!==n.slug||(e=(0,p.i)(e,{payment:{...(0,l.jU)(e,o).payment,status:"paid"}},o))}))}));var st=n(46752),ot=n(1279),it=n(53551),rt=n(99203),ct=n(274),dt=n(45332);function lt(e){(0,i.d4)((()=>(0,x.Gq)(e)),[e])}var ut=n(34446);const mt=document.querySelector('meta[name="viewport"]'),ht=mt?.getAttribute("content")||"";function gt(e){e.preventDefault()}var pt=n(65326),ft=n(31212),It=n(18674),vt=n(62357),wt=n(28183),bt=n(48778);const yt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0}));var Pt=n(2155),Zt=n(95616),Ct=n(17358);const St=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,Zt.yi)();const n=(0,A.xW)();if((0,i.d4)((()=>{t&&(0,Ct.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,Pt.bi)(n))}));var Et=n(23989),Mt=n(53455),Rt=n(60706),kt=n(73541),Tt=n(2255),At=n(59107),Nt=n(54416),xt=n(27370);var Bt=n(706);let Lt=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function Ut(e,t,n,a,s,o){let r,c,d;return r=function(){const[e,t]=(0,i.eJ)(window.navigator.onLine);return(0,i.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?Lt.syncing:Lt.online:Lt.waitingForNetwork,c=r===Lt.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===Lt.waitingForNetwork?d=e("WaitingForNetwork"):r===Lt.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}var jt=n(36046),Ot=n(73217),Ft=n(53106),_t=n(58964),Dt=n(231),qt=n(69589),$t=n(49187),Ht=n(83321),Gt=n(40126),Vt=n(49204);const zt=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,At.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(Vt.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(Tt.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(Dt.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))}));var Wt=n(96459),Xt=n(4863),Yt=n(6202);const Kt="HO3tML0GAC9vTH28baKB",Jt=(0,i.X$)((e=>{let{reaction:t,isLottie:n,className:a}=e;const o=(0,m.RK)(t.documentId),r=(0,Yt.Z)(n?void 0:o),c=(0,i.Ye)((()=>s._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(r||n)return i.ZP.createElement("div",{className:(0,st.Z)("HAg4STRlxDV3frYuABYr",a)},c.map((e=>{const a=`--offset-path: path('${e}');`;return n?i.ZP.createElement(Wt.Z,{documentId:t.documentId,className:Kt,style:a,withSharedAnimation:!0}):i.ZP.createElement("img",{src:r,alt:"",className:Kt,style:a})})))})),Qt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"StatusPickerMenu",!t);return n?i.ZP.createElement(n,e):void 0})),en=(0,i.X$)((0,a.c$)((e=>{const{currentUserId:t}=e,n=t?(0,l.dy)(e,t):void 0;return{emojiStatus:n?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:n,loadCurrentUser:s}=(0,a.Sv)(),r=(0,i.sO)(null),[c,d,l]=(0,Rt.Z)(!1),[u,m,h]=(0,Rt.Z)(!1),[g,p,f]=(0,Rt.Z)(!1),{isMobile:I}=(0,S.ZP)(),v=t?.until?1e3*t.until-Date.now()+1e3*(0,w.Qj)():void 0;(0,wt.Z)(s,v),(0,ct.Z)((e=>{let[n]=e;c&&t&&n&&t.documentId!==n.documentId&&(m(),l())}),[t,c,m,l]);const b=(0,i.I4)((e=>{d(),n({emojiStatus:e})}),[d,n]);(0,wt.Z)(h,u?1500:void 0);const y=(0,i.I4)((()=>{p()}),[p]);return i.ZP.createElement("div",{className:"extra-spacing"},Boolean(u&&t)&&i.ZP.createElement(Jt,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),i.ZP.createElement(Dt.Z,{round:!0,ref:r,ripple:!I,size:"smaller",color:"translucent",className:"emoji-status",onClick:y},t?i.ZP.createElement(Wt.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:o.y3O}):i.ZP.createElement(Xt.Z,null)),i.ZP.createElement(Qt,{statusButtonRef:r,isOpen:g,onEmojiStatusSelect:b,onClose:f}))}))),tn=[0,1,2],nn=(0,i.X$)((0,a.c$)((e=>{const t=(0,l.jU)(e),{query:n,fetchingStatus:a,chatId:s,date:o}=t.globalSearch,{currentUserId:i,connectionState:r,isSyncing:c,archiveSettings:d}=e,{byId:u}=e.chats,{isConnectionStatusMinimized:m,animationLevel:h}=e.settings.byKey;return{searchQuery:n,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:i,chatsById:u,globalSearchChatId:s,searchDate:o,theme:(0,l.Pu)(e),animationLevel:h,connectionState:r,isSyncing:c,isMessageListOpen:Boolean((0,l.Bt)(e)),isConnectionStatusMinimized:m,isCurrentUserPremium:(0,l.wV)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(t.canInstall),archiveSettings:d,isAuthRememberMe:e.authRememberMe}}))((e=>{let{shouldHideSearch:t,content:n,contactsFilter:r,onSearchQuery:c,isClosingSearch:d,onSelectSettings:l,onSelectContacts:u,onSelectArchived:h,onReset:g,searchQuery:p,isLoading:f,isCurrentUserPremium:v,shouldSkipTransition:w,currentUserId:b,globalSearchChatId:y,searchDate:P,theme:Z,animationLevel:C,chatsById:E,connectionState:M,isSyncing:R,isMessageListOpen:k,isConnectionStatusMinimized:T,areChatsLoaded:A,hasPasscode:N,isAuthRememberMe:x,canInstall:B,archiveSettings:L}=e;const{openChat:U,setGlobalSearchDate:j,setSettingOption:O,setGlobalSearchChatId:F,openChatByUsername:_,lockScreen:D,requestNextSettingsScreen:q,skipLockOnUnload:$,openUrl:H}=(0,a.Sv)(),G=(0,At.Z)(),{isMobile:V}=(0,S.ZP)(),z=n===I.du.ChatList,W=(0,i.Ye)((()=>P?(0,ce.xH)(new Date(1e3*P)):void 0),[P]),X=(0,i.Ye)((()=>z&&E?Object.values(E).reduce(((e,t)=>(0,m.pE)(t)&&t.unreadCount?e+1:e),0):0),[z,E]),{connectionStatus:Y,connectionStatusText:K,connectionStatusPosition:J}=Ut(G,M,R,k,T,!A),Q=(0,i.I4)((e=>{e.preventDefault(),e.stopPropagation(),N?D():q({screen:I.MT.PasscodeDisabled})}),[N]);(0,kt.y)(x?{"Ctrl+Shift+L":Q,"Alt+Shift+L":Q,"Meta+Shift+L":Q,...s.fl&&{"Mod+L":Q}}:void 0);const ee=window.location.hostname===o.xHY||o.Cgt,te=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(Dt.Z,{round:!0,ripple:z&&!V,size:"smaller",color:"translucent",className:n?"active":"",onClick:z?t:()=>g(),ariaLabel:z?G("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,st.Z)("animated-menu-icon",!z&&"state-back",w&&"no-animation")}))}),[z,V,G,g,w]),ne=(0,i.I4)((()=>{p||c("")}),[p,c]),ae=(0,i.I4)((()=>{O({isConnectionStatusMinimized:!T})}),[T,O]),se=(0,i.I4)((()=>{U({id:b,shouldReplaceHistory:!0})}),[b,U]),oe=(0,i.I4)((e=>{e.stopPropagation();const t="light"===Z?"dark":"light";O({theme:t}),O({shouldUseSystemTheme:!1}),(0,xt.Z)(t,C===o.zy8)}),[C,O,Z]),ie=(0,i.I4)((e=>{e.stopPropagation();const t=0===C?2:0;tn.forEach(((e,n)=>{document.body.classList.toggle(`animation-level-${n}`,t===n)})),O({animationLevel:t})}),[C,O]),re=(0,i.I4)((()=>{window.open(o.ulW,"_blank","noopener")}),[]),de=(0,i.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,Bt.W8)(),$()}),[$]),le=(0,i.I4)((()=>{_({username:G("Settings.TipsUsername")})}),[G,_]),ue=(0,i.I4)((()=>{H({url:o.mUA})}),[H]),me=(0,i.I4)((()=>{D()}),[D]),he=Boolean(y)||n===I.du.GlobalSearch||n===I.du.Contacts;(0,i.d4)((()=>he?(0,Et.Z)((()=>g())):void 0),[he,g]);const ge=n===I.du.Contacts?G("SearchFriends"):G("Search"),pe=o.Tjg?`${o.JiC} Beta (master)`:o.eMD?"master":o.JiC,{shouldDisableDropdownMenuTransitionRef:fe,handleDropdownMenuTransitionEnd:Ie}=(0,Ot.Z)(t),ve=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_t.Z,{icon:"saved-messages",onClick:se},G("SavedMessages")),L.isHidden&&i.ZP.createElement(_t.Z,{icon:"archive",onClick:h},i.ZP.createElement("span",{className:"menu-item-name"},G("ArchivedChats")),X>0&&i.ZP.createElement("div",{className:"right-badge"},X)),i.ZP.createElement(_t.Z,{icon:"user",onClick:u},G("Contacts")),i.ZP.createElement(_t.Z,{icon:"settings",onClick:l},G("Settings")),i.ZP.createElement(_t.Z,{icon:"darkmode",onClick:oe},i.ZP.createElement("span",{className:"menu-item-name"},G("lng_menu_night_mode")),i.ZP.createElement(Ht.Z,{id:"darkmode",label:G("dark"===Z?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===Z,noAnimation:!0})),i.ZP.createElement(_t.Z,{icon:"animations",onClick:ie},i.ZP.createElement("span",{className:"menu-item-name capitalize"},G("Appearance.Animations").toLowerCase()),i.ZP.createElement(Ht.Z,{id:"animations",label:"Toggle Animations",checked:C>0})),i.ZP.createElement(_t.Z,{icon:"help",onClick:le},G("TelegramFeatures")),i.ZP.createElement(_t.Z,{icon:"bug",onClick:ue},"Report Bug"),o.Tjg&&i.ZP.createElement(_t.Z,{icon:"permissions",onClick:re},"Beta Changelog"),ee&&i.ZP.createElement(_t.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:de},"Switch to K Version"),B&&i.ZP.createElement(_t.Z,{icon:"install",onClick:(0,jt.G)()},"Install App"))),[C,X,B,ie,ue,G,re,oe,le,se,de,h,u,l,Z,ee,L]);return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},G.isRtl&&i.ZP.createElement("div",{className:"DropdownMenuFiller"}),i.ZP.createElement(Ft.Z,{trigger:te,footer:`${o.iCi} ${pe}`,className:(0,st.Z)(G.isRtl&&"rtl",t&&G.isRtl&&"right-aligned",fe.current&&G.isRtl&&"disable-transition"),positionX:t&&G.isRtl?"right":"left",onTransitionEnd:G.isRtl?Ie:void 0},ve),i.ZP.createElement(qt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,st.Z)(y||P?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:d?void 0:r||p,focused:he,isLoading:f||"minimized"===J,spinnerColor:"minimized"===J?"yellow":void 0,spinnerBackgroundColor:"minimized"===J&&"light"===Z?"light":void 0,placeholder:ge,autoComplete:"off",canClose:Boolean(y||P),onChange:c,onReset:g,onFocus:ne,onSpinnerClick:"minimized"===J?ae:void 0},W&&i.ZP.createElement($t.Z,{icon:"calendar",title:W,canClose:!0,isMinimized:Boolean(y),className:"search-date",onClick:j,clickArg:{date:void 0}}),y&&i.ZP.createElement($t.Z,{chatOrUserId:y,onClick:F,canClose:!0,clickArg:{id:void 0}})),v&&i.ZP.createElement(en,null),N&&i.ZP.createElement(Dt.Z,{round:!0,ripple:!V,size:"smaller",color:"translucent",ariaLabel:`${G("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:me,className:(0,st.Z)(!v&&"extra-spacing")},i.ZP.createElement("i",{className:"icon-lock"})),i.ZP.createElement(Gt.Z,{isOpen:"overlay"===J,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(zt,{connectionStatus:Y,connectionStatusText:K,onClick:ae}))))})));var an=n(64963),sn=n(46590),on=n(93133),rn=n(46915);const cn=(0,i.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n},chats:{listIds:{archived:a}},currentUserId:s,lastSyncTime:o,archiveSettings:i}=e,{shouldSkipHistoryAnimations:r,activeChatFolder:c}=(0,l.jU)(e);return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:c,currentUserId:s,lastSyncTime:o,shouldSkipHistoryAnimations:r,hasArchivedChats:Boolean(a?.length),maxFolders:(0,ae.M)(e,"dialogFilters"),archiveSettings:i}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,chatFoldersById:c,orderedFolderIds:d,activeChatFolder:l,currentUserId:u,isForumPanelOpen:m,lastSyncTime:h,shouldSkipHistoryAnimations:g,maxFolders:p,shouldHideFolderTabs:f,hasArchivedChats:I,archiveSettings:v}=e;const{loadChatFolders:w,setActiveChatFolder:b,openChat:y}=(0,a.Sv)(),P=(0,i.sO)(null),Z=(0,At.Z)();(0,i.d4)((()=>{h&&w()}),[h,w]);const C=(0,i.Ye)((()=>({id:o.NfV,title:d?.[0]===o.NfV?Z("FilterAllChatsShort"):Z("FilterAllChats")})),[d,Z]),S=(0,i.Ye)((()=>d?d.map((e=>e===o.NfV?C:c[e]||{})).filter(Boolean):void 0),[c,C,d]),E=S?.findIndex((e=>e.id===o.NfV)),M=E===l,R=0===l,k=(0,Zt.yi)(),T=(0,i.Ye)((()=>{if(S&&S.length)return S.map(((e,t)=>{let{id:n,title:a}=e;const s=n!==o.NfV&&t>p-1;return{id:n,title:a,badgeCount:k[n]?.chatsCount,isBadgeActive:Boolean(k[n]?.notificationsCount),isBlocked:s}}))}),[S,k,p]),A=(0,i.I4)((e=>{b({activeChatFolder:e},{forceOnHeavyAnimation:!0})}),[b]);(0,i.d4)((()=>{T?.length&&l>=T.length&&b({activeChatFolder:0})}),[l,T,b]),(0,i.d4)((()=>{if(s.$b&&T?.length&&!m)return(0,an.sf)(P.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===an.eM.Left?(b({activeChatFolder:Math.min(l+1,T.length-1)},{forceOnHeavyAnimation:!0}),!0):t===an.eM.Right&&(b({activeChatFolder:Math.max(0,l-1)},{forceOnHeavyAnimation:!0}),!0)})}),[l,T,m,b]);const N=(0,i.sO)();N.current=!R,(0,i.d4)((()=>N.current?(0,Et.Z)((()=>{N.current&&b({activeChatFolder:0})})):void 0),[l,b]),(0,sn.Z)({isActive:!R,onBack:()=>b({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,i.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&T){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void y({id:u,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>T.length-1)return;b({activeChatFolder:n},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[u,T,y,b]);const{shouldRender:x,transitionClassNames:B}=(0,ft.Z)(!d,void 0,!0);function L(e){const a=Object.values(c).find((e=>{let{id:t}=e;return t===T[l].id})),s=a&&!M;return i.ZP.createElement(rn.Z,{folderType:s?"folder":"all",folderId:s?a.id:void 0,isActive:e,isForumPanelOpen:m,lastSyncTime:h,foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,canDisplayArchive:I&&!v.isHidden,archiveSettings:v})}const U=T&&T.length>1;return i.ZP.createElement("div",{className:(0,st.Z)("ChatFolders",U&&f&&"ChatFolders--tabs-hidden")},U?i.ZP.createElement(on.Z,{tabs:T,activeTab:l,onSwitchTab:A,areFolders:!0}):x?i.ZP.createElement("div",{className:(0,st.Z)("tabs-placeholder",B)}):void 0,i.ZP.createElement(Tt.Z,{ref:P,name:g?"none":Z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:l,renderCount:U?T.length:void 0},L))})));var dn=n(34288);const ln=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),un=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)}));var mn=n(52328);const hn=(0,i.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:a,onNewGroup:s}=e;const[o,r]=(0,i.eJ)(!1);(0,i.d4)((()=>{t||r(!1)}),[t]);const c=(0,At.Z)(),d=(0,st.Z)("NewChatButton",t&&"revealed",o&&"menu-is-open"),l=(0,i.I4)((()=>{r(!o)}),[o]),u=(0,i.I4)((()=>{r(!1)}),[]),m=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_t.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(_t.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(_t.Z,{icon:"user",onClick:n},c("NewMessageTitle")))),[c,a,s,n]);return i.ZP.createElement("div",{className:d,dir:c.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{round:!0,color:"primary",className:o?"active":"",onClick:l,ariaLabel:c(o?"Close":"NewMessageTitle"),tabIndex:-1},i.ZP.createElement("i",{className:"icon-new-chat-filled"}),i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(mn.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},m))}));var gn=n(59690);const pn=Object.keys(I.du).length/2;let fn;const In=(0,i.X$)((e=>{let{content:t,searchQuery:n,searchDate:o,isClosingSearch:r,contactsFilter:c,shouldSkipTransition:d,foldersDispatch:l,isUpdateAvailable:u,isForumPanelOpen:m,onSearchQuery:h,onContentChange:g,onSettingsScreenSelect:p,onReset:f,onTopicSearch:v}=e;const{closeForumPanel:w}=(0,a.Sv)(),[b,y]=(0,i.eJ)(s.$b),{shouldRenderForumPanel:P,handleForumPanelAnimationEnd:Z,handleForumPanelAnimationStart:C,isAnimationStarted:S}=(0,Nt.Z)(m),E=m&&t===I.du.ChatList,M=E&&S,{shouldRender:R,transitionClassNames:k}=(0,ft.Z)(u),T=(0,i.sO)(!1),A=(0,i.I4)((()=>{t===I.du.ChatList&&(T.current=!0,y(!0))}),[t]),N=(0,i.I4)((()=>{T.current=!1,fn&&(clearTimeout(fn),fn=void 0),fn=window.setTimeout((()=>{T.current||y(!1)}),250)}),[]),x=(0,i.I4)((()=>{g(I.du.Settings)}),[g]),B=(0,i.I4)((()=>{g(I.du.Contacts)}),[g]),L=(0,i.I4)((()=>{g(I.du.Archived),w()}),[w,g]),U=(0,i.I4)((()=>{window.location.reload()}),[]),j=(0,i.I4)((()=>{g(I.du.NewChannelStep1)}),[g]),O=(0,i.I4)((()=>{g(I.du.NewGroupStep1)}),[g]);(0,i.d4)((()=>{let e;return t!==I.du.ChatList?e=window.setTimeout((()=>{y(!1)}),250):(T.current||s.$b)&&y(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const F=(0,At.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:s.$b?void 0:A,onMouseLeave:s.$b?void 0:N},i.ZP.createElement(nn,{shouldHideSearch:M,content:t,contactsFilter:c,onSearchQuery:h,onSelectSettings:x,onSelectContacts:B,onSelectArchived:L,onReset:f,shouldSkipTransition:d,isClosingSearch:r}),i.ZP.createElement(Tt.Z,{name:d?"none":"zoom-fade",renderCount:pn,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:I.du.ChatList,shouldWrap:!0,wrapExceptionKey:I.du.ChatList},(e=>{switch(t){case I.du.ChatList:return i.ZP.createElement(cn,{shouldHideFolderTabs:M,onSettingsScreenSelect:p,onLeftColumnContentChange:g,foldersDispatch:l,isForumPanelOpen:M});case I.du.GlobalSearch:return i.ZP.createElement(ln,{searchQuery:n,searchDate:o,isActive:e,onReset:f});case I.du.Contacts:return i.ZP.createElement(un,{filter:c,isActive:e,onReset:f});default:return}})),R&&i.ZP.createElement(Dt.Z,{fluid:!0,pill:!0,className:(0,st.Z)("btn-update",k),onClick:U},F("lng_update_telegram")),P&&i.ZP.createElement(gn.Z,{isOpen:m,isHidden:!E,onTopicSearch:v,onOpenAnimationStart:C,onCloseAnimationEnd:Z}),i.ZP.createElement(hn,{isShown:b,onNewPrivateChat:B,onNewChannel:j,onNewGroup:O}))})),vn=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),wn=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),bn=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)}));var yn=function(e){return 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",e}(yn||{});const Pn=Object.keys(yn).length/2,Zn=(0,i.X$)((0,a.c$)((e=>{const t=(0,l.jU)(e),{globalSearch:{query:n,date:a},shouldSkipHistoryAnimations:s,activeChatFolder:o,nextSettingsScreen:i}=t,{leftColumnWidth:r,currentUserId:c,passcode:{hasPasscode:d},isUpdateAvailable:u,archiveSettings:m}=e,h=(0,l.jr)(e);return{searchQuery:n,searchDate:a,isFirstChatFolderActive:0===o,shouldSkipHistoryAnimations:s,leftColumnWidth:r,currentUserId:c,hasPasscode:d,nextSettingsScreen:i,isChatOpen:Boolean(h?.id),isUpdateAvailable:u,isForumPanelOpen:(0,l.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:m}}))((e=>{let{searchQuery:t,searchDate:n,isFirstChatFolderActive:o,shouldSkipHistoryAnimations:r,leftColumnWidth:c,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,isChatOpen:m,isUpdateAvailable:h,isForumPanelOpen:g,forumPanelChatId:p,isClosingSearch:f,archiveSettings:v}=e;const{setGlobalSearchQuery:w,setGlobalSearchClosing:b,setGlobalSearchChatId:y,resetChatCreation:P,setGlobalSearchDate:Z,loadPasswordInfo:C,clearTwoFaError:S,setLeftColumnWidth:E,resetLeftColumnWidth:M,openChat:R,requestNextSettingsScreen:k}=(0,a.Sv)(),T=(0,i.sO)(null),[A,N]=(0,i.eJ)(I.du.ChatList),[x,B]=(0,i.eJ)(I.MT.Main),[L,U]=(0,i.eJ)(""),[j,O]=(0,Mt.ZP)(),[F,_]=(0,i.eJ)(0);let D=yn.Main;switch(A){case I.du.Archived:D=yn.Archived;break;case I.du.Settings:D=yn.Settings;break;case I.du.NewChannelStep1:case I.du.NewChannelStep2:D=yn.NewChannel;break;case I.du.NewGroupStep1:case I.du.NewGroupStep2:D=yn.NewGroup}const q=(0,i.I4)((e=>{function t(){N(I.du.ChatList),U(""),b({isClosing:!0}),P(),setTimeout((()=>{w({query:""}),Z({date:void 0}),y({id:void 0}),b({isClosing:!1}),_(Date.now())}),250)}if(!0!==e)if(A!==I.du.NewGroupStep2)if(A!==I.du.NewChannelStep2){if(A===I.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(A===I.du.Settings)switch(x){case I.MT.EditProfile:case I.MT.Folders:case I.MT.General:case I.MT.Notifications:case I.MT.DataStorage:case I.MT.Privacy:case I.MT.ActiveSessions:case I.MT.Language:case I.MT.Stickers:case I.MT.Experimental:return void B(I.MT.Main);case I.MT.GeneralChatBackground:return void B(I.MT.General);case I.MT.GeneralChatBackgroundColor:return void B(I.MT.GeneralChatBackground);case I.MT.PrivacyPhoneNumber:case I.MT.PrivacyLastSeen:case I.MT.PrivacyProfilePhoto:case I.MT.PrivacyPhoneCall:case I.MT.PrivacyPhoneP2P:case I.MT.PrivacyForwarding:case I.MT.PrivacyGroupChats:case I.MT.PrivacyVoiceMessages:case I.MT.PrivacyBlockedUsers:case I.MT.ActiveWebsites:case I.MT.TwoFaDisabled:case I.MT.TwoFaEnabled:case I.MT.TwoFaCongratulations:case I.MT.PasscodeDisabled:case I.MT.PasscodeEnabled:case I.MT.PasscodeCongratulations:return void B(I.MT.Privacy);case I.MT.PasscodeNewPasscode:return void B(l?I.MT.PasscodeEnabled:I.MT.PasscodeDisabled);case I.MT.PasscodeChangePasscodeCurrent:case I.MT.PasscodeTurnOff:return void B(I.MT.PasscodeEnabled);case I.MT.PasscodeNewPasscodeConfirm:return void B(I.MT.PasscodeNewPasscode);case I.MT.PasscodeChangePasscodeNew:return void B(I.MT.PasscodeChangePasscodeCurrent);case I.MT.PasscodeChangePasscodeConfirm:return void B(I.MT.PasscodeChangePasscodeNew);case I.MT.PrivacyPhoneNumberAllowedContacts:case I.MT.PrivacyPhoneNumberDeniedContacts:return void B(I.MT.PrivacyPhoneNumber);case I.MT.PrivacyLastSeenAllowedContacts:case I.MT.PrivacyLastSeenDeniedContacts:return void B(I.MT.PrivacyLastSeen);case I.MT.PrivacyProfilePhotoAllowedContacts:case I.MT.PrivacyProfilePhotoDeniedContacts:return void B(I.MT.PrivacyProfilePhoto);case I.MT.PrivacyPhoneCallAllowedContacts:case I.MT.PrivacyPhoneCallDeniedContacts:return void B(I.MT.PrivacyPhoneCall);case I.MT.PrivacyPhoneP2PAllowedContacts:case I.MT.PrivacyPhoneP2PDeniedContacts:return void B(I.MT.PrivacyPhoneP2P);case I.MT.PrivacyForwardingAllowedContacts:case I.MT.PrivacyForwardingDeniedContacts:return void B(I.MT.PrivacyForwarding);case I.MT.PrivacyVoiceMessagesAllowedContacts:case I.MT.PrivacyVoiceMessagesDeniedContacts:return void B(I.MT.PrivacyVoiceMessages);case I.MT.PrivacyGroupChatsAllowedContacts:case I.MT.PrivacyGroupChatsDeniedContacts:return void B(I.MT.PrivacyGroupChats);case I.MT.TwoFaNewPassword:return void B(I.MT.TwoFaDisabled);case I.MT.TwoFaNewPasswordConfirm:return void B(I.MT.TwoFaNewPassword);case I.MT.TwoFaNewPasswordHint:return void B(I.MT.TwoFaNewPasswordConfirm);case I.MT.TwoFaNewPasswordEmail:return void B(I.MT.TwoFaNewPasswordHint);case I.MT.TwoFaNewPasswordEmailCode:return void B(I.MT.TwoFaNewPasswordEmail);case I.MT.TwoFaChangePasswordCurrent:case I.MT.TwoFaTurnOff:case I.MT.TwoFaRecoveryEmailCurrentPassword:return void B(I.MT.TwoFaEnabled);case I.MT.TwoFaChangePasswordNew:return void B(I.MT.TwoFaChangePasswordCurrent);case I.MT.TwoFaChangePasswordConfirm:return void B(I.MT.TwoFaChangePasswordNew);case I.MT.TwoFaChangePasswordHint:return void B(I.MT.TwoFaChangePasswordConfirm);case I.MT.TwoFaRecoveryEmail:return void B(I.MT.TwoFaRecoveryEmailCurrentPassword);case I.MT.TwoFaRecoveryEmailCode:return void B(I.MT.TwoFaRecoveryEmail);case I.MT.FoldersCreateFolder:case I.MT.FoldersEditFolder:return void B(I.MT.Folders);case I.MT.FoldersIncludedChatsFromChatList:case I.MT.FoldersExcludedChatsFromChatList:return void B(I.MT.FoldersEditFolderFromChatList);case I.MT.FoldersEditFolderFromChatList:return N(I.du.ChatList),void B(I.MT.Main);case I.MT.QuickReaction:case I.MT.CustomEmoji:return void B(I.MT.Stickers);case I.MT.DoNotTranslate:return void B(I.MT.Language)}A===I.du.ChatList&&o?N(I.du.GlobalSearch):t()}else N(I.du.NewChannelStep1);else N(I.du.NewGroupStep1);else t()}),[A,o,b,P,w,Z,y,x,l]),$=(0,i.I4)((e=>{A!==I.du.Contacts?(N(I.du.GlobalSearch),e!==t&&w({query:e})):U(e)}),[A,t,w]),H=(0,i.I4)((()=>{N(I.du.GlobalSearch),w({query:""}),y({id:p})}),[p,y,w]);(0,i.d4)((()=>A!==I.du.ChatList||o&&!m&&!g?(0,Et.Z)((()=>q())):void 0),[o,A,q,m,g]);const G=(0,i.I4)((e=>{A!==I.du.GlobalSearch&&(e.preventDefault(),N(I.du.GlobalSearch))}),[A]),V=(0,i.I4)((e=>{e.preventDefault(),R({id:d,shouldReplaceHistory:!0})}),[d,R]),z=(0,i.I4)((e=>{e.preventDefault(),N(I.du.Archived)}),[]),W=(0,i.I4)((e=>{e.preventDefault(),N(I.du.Settings)}),[]);(0,kt.y)({"Mod+Shift+F":G,"Mod+Shift+S":V,...s.fl&&{"Mod+0":V,"Mod+9":z},...s.jm&&s.fl&&{"Mod+,":W}}),(0,i.d4)((()=>{S(),x===I.MT.Privacy&&C()}),[S,C,x]),(0,ut.Z)((()=>{void 0!==u&&(N(I.du.Settings),B(u),k({screen:void 0}))}),[u,k]);const{initResize:X,resetResize:Y,handleMouseUp:K}=function(e,t,n,a,s){const[o,r,c]=(0,Rt.Z)(),[d,l]=(0,i.eJ)(0),[u,m]=(0,i.eJ)(0),h=(0,i.I4)((t=>{if(!e.current)return;const n=t?`${t}px`:"";e.current.style.width=n,s&&e.current.style.setProperty(s,n)}),[s,e]);function g(){document.body.classList.remove("cursor-ew-resize")}return(0,i.bt)((()=>{e.current&&a&&h(a)}),[s,e,a,h]),(0,i.d4)((()=>{if(!o)return;const n=e=>{const t=Math.ceil(u+e.clientX-d);h(t)};function a(){s(),t(e.current.offsetWidth)}function s(){g(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),c()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),s}),[u,d,e,t,o,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}}(T,(e=>E({leftColumnWidth:e})),M,c,"--left-column-width"),J=(0,i.I4)((e=>{N(I.du.Settings),B(e)}),[]);function Q(e){switch(D){case yn.Archived:return i.ZP.createElement(bn,{isActive:e,onReset:q,onTopicSearch:H,foldersDispatch:O,onSettingsScreenSelect:J,onLeftColumnContentChange:N,isForumPanelOpen:g,archiveSettings:v});case yn.Settings:return i.ZP.createElement(vn,{isActive:e,currentScreen:x,foldersState:j,foldersDispatch:O,onScreenSelect:J,onReset:q,shouldSkipTransition:r});case yn.NewChannel:return i.ZP.createElement(wn,{key:F,isActive:e,isChannel:!0,content:A,onContentChange:N,onReset:q});case yn.NewGroup:return i.ZP.createElement(wn,{key:F,isActive:e,content:A,onContentChange:N,onReset:q});default:return i.ZP.createElement(In,{content:A,isClosingSearch:f,searchQuery:t,searchDate:n,contactsFilter:L,foldersDispatch:O,onContentChange:N,onSearchQuery:$,onSettingsScreenSelect:J,onReset:q,shouldSkipTransition:r,isUpdateAvailable:h,isForumPanelOpen:g,onTopicSearch:H})}}return i.ZP.createElement(Tt.Z,{ref:T,name:r?"none":s.s0,renderCount:Pn,activeKey:D,shouldCleanup:!0,cleanupExceptionKey:yn.Main,shouldWrap:!0,wrapExceptionKey:yn.Main,id:"LeftColumn",afterChildren:i.ZP.createElement("div",{className:"resize-handle",onMouseDown:X,onMouseUp:K,onDoubleClick:Y})},Q)})));var Cn=n(12420),Sn=n(49524),En=n(71394);var Mn=n(12255),Rn=n(52678),kn=n(87204),Tn=n(28712),An=n(3570),Nn=n(33799),xn=n(75790),Bn=n(18360),Ln=n(86203),Un=n(6058),jn=n(98799),On=n(59188),Fn=n(32340),_n=n(2903),Dn=n(17891),qn=n(68512),$n=n(17551);const Hn={"pinned-message-border":"II9Qj_b_XQlgwGAOoy7u",pinnedMessageBorder:"II9Qj_b_XQlgwGAOoy7u","pinned-message-border-wrapper-1":"QpNjYZM0KJrGrocs69__",pinnedMessageBorderWrapper1:"QpNjYZM0KJrGrocs69__","pinned-message-border-wrapper":"sNpxwL0ihB0aXnfphNmp",pinnedMessageBorderWrapper:"sNpxwL0ihB0aXnfphNmp","pinned-message-border-mark":"YX_iyQuDtga6uKXRQqR0",pinnedMessageBorderMark:"YX_iyQuDtga6uKXRQqR0"};function Gn(e,t,n,a,s){return`M${e},${t+s}a${s},${s},0,0,1,\n ${n},0v${a-2*s}a${s},${s},0,0,1,${-n},0Z`}const Vn=(0,i.X$)((e=>{let{count:t,index:n}=e;const a=(0,i.sO)(null),s=(0,i.Ye)((()=>function(e,t){const n=e-t-1,a=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),s=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,a),i=`clipPath${e}`,r=function(e,t,n){let a="";if(3===n)a=Gn(0,0,2,t,1)+Gn(0,12,2,t+1,1)+Gn(0,25,2,t,1);else for(let e=0;e<n;e++)a+=Gn(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(i,a,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,a,e),d=function(e,t,n,a){return t<=4||e<=1?0:e>=t-2?a-36:(n+4)/2+(e-2)*(n+2)}(n,e,a,o);return{markHeight:s,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:o,clipPathId:i}}(t,n)),[t,n]);if((0,i.d4)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:o,clipPathId:i,clipPath:r}=s,c=a.current.firstElementChild;if(a?.current){const s=a.current,{style:d}=s;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=s.querySelector("svg"),u=s.querySelector("div"),m=s.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)`)}}),[s]),1===t)return i.ZP.createElement("div",{className:Hn.pinnedMessageBorder},i.ZP.createElement("div",{className:Hn.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=s;return i.ZP.createElement("div",{className:(0,st.Z)(Hn.pinnedMessageBorder,t>4&&Hn.pinnedMessageBorderMask)},i.ZP.createElement("div",{className:Hn.pinnedMessageBorderWrapper,ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${o}px; transform: translateY(-${r}px);`},i.ZP.createElement("span",null),i.ZP.createElement("div",{className:Hn.pinnedMessageBorderMark,style:`--height: ${c}px; --translate-y: ${d}px; --translate-track: ${r}px;`})))}));var zn=n(45370),Wn=n(62230),Xn=n(34076);const Yn="DusHAy2Lx0SlaPpVAb_o",Kn="jSVbc8Hb7PjitJujB_dQ",Jn=(0,i.X$)((e=>{let{message:t,count:n,index:o,customTitle:r,className:c,onUnpinMessage:d,onClick:l,onAllPinnedClick:u,isLoading:h,isFullWidth:g}=e;const{clickBotInlineButton:p}=(0,a.Sv)(),f=(0,At.Z)(),I=(0,_n.Z)(t),v=(0,Yt.Z)((0,m.Ti)(t,"pictogram")),w=(0,m.NE)(t),b=(0,Dn.Z)([h],450)&&h,[y,P,Z]=(0,Rt.Z)(),C=(0,i.I4)((()=>{Z(),d&&d(t.id)}),[Z,d,t.id]),S=(0,m.eH)(t),E=(0,i.I4)((()=>{S&&p({messageId:t.id,button:S})}),[p,S,t.id]),[M,R,k]=(0,Rt.Z)();return i.ZP.createElement("div",{className:(0,st.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",g&&"full-width",c)},(n>1||b)&&i.ZP.createElement(Dt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("EventLogFilterPinnedMessages"),onClick:b?void 0:u},h&&i.ZP.createElement(Vt.Z,{color:"blue",className:(0,st.Z)("d7XDT4Keip1KHh7mcCv9",Yn,!b&&Kn)}),i.ZP.createElement("i",{className:(0,st.Z)("icon-pin-list",Yn,b&&Kn)})),d&&i.ZP.createElement(Dt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("UnpinMessageAlertTitle"),onClick:P},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement($n.Z,{isOpen:y,onClose:Z,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:C}),i.ZP.createElement("div",{className:(0,st.Z)("uhn_g6FmUELuGJrCm45w",M&&"jeTsUEkDCkzGUVwy6lrL"),onClick:l,dir:f.isRtl?"rtl":void 0},i.ZP.createElement(Vn,{count:n,index:o}),i.ZP.createElement(Tt.Z,{activeKey:t.id,name:"slide-vertical",className:"EK6juGhJwhsLLm4Aag2F"},function(e,t,n){const{width:a,height:s}=(0,Ae.W7)(),o=t||e;return i.ZP.createElement("div",{className:"RFnmHP92f6CwfuR2Upaw"},e&&!n&&i.ZP.createElement("img",{className:"JfPOYkOcaMjS7Y5rsHZ4",src:o,width:a,height:s,alt:""}),e&&i.ZP.createElement(Wn.Z,{thumbDataUri:o,isVisible:Boolean(n),width:a,height:s}))}(I,v,w)),i.ZP.createElement("div",{className:(0,st.Z)("bSvmca5kaTIUh3yJBxnF",I&&"FBCNFm307_rxATSHPSiN")},i.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!r&&i.ZP.createElement(Xn.Z,{text:`${f("PinnedMessage")} ${o>0?"#"+(n-o):""}`}),r&&(0,Fn.Z)(r)),i.ZP.createElement(Tt.Z,{activeKey:t.id,name:"slide-vertical-fade",className:"ugsKEK4Xb166oFMP8hHy"},i.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},i.ZP.createElement(zn.Z,{lang:f,message:t,noEmoji:Boolean(I)})))),i.ZP.createElement(qn.Z,null),S&&i.ZP.createElement(Dt.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:E,shouldStopPropagation:!0,onMouseEnter:s.$b?void 0:R,onMouseLeave:s.$b?void 0:k},S.text)))}));var Qn=n(10396),ea=n(64532),ta=n(23186),na=n(75851);const aa=240;function sa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,s=new Image;return new Promise((o=>{s.onload=()=>{oa(s,s.width*t,s.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(a)}))},s.src=a}))}async function oa(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return ia(e,t,n,void 0,a);try{const s=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(s.height!==n||s.width!==t)throw new Error("Image bitmap resize not supported!");const o=await(0,na.ix)(e.src),i=(0,na.rZ)(o)<aa?"#fff":"#000";return await new Promise((e=>{const t=document.createElement("canvas");t.width=s.width,t.height=s.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(s):n.drawImage(s,0,0),t.toBlob(e,a)}))}catch(s){return ia(e,t,n,void 0,a)}}async function ia(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,s=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*a>t){const n=1/a;let s={width:Math.floor(e.width*a),height:Math.floor(e.height*a)};for(r.width=s.width,r.height=s.height,c.drawImage(e,0,0,s.width,s.height);s.width*a>t;)s={width:Math.floor(s.width*a),height:Math.floor(s.height*a)},c.drawImage(r,0,0,s.width*n,s.height*n,0,0,s.width,s.height);i.drawImage(r,0,0,s.width,s.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);const d=await(0,na.ix)(e.src),l=(0,na.rZ)(d)<aa?"#fff":"#000";return i.fillStyle=l,i.globalCompositeOperation="destination-over",i.fillRect(0,0,o.width,o.height),new Promise((e=>{o.toBlob(e,s)}))}var ra=n(77510);const ca=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",da={width:200,height:200},la=115;var ua=n(17240),ma=n(18051);const ha={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},ga=Object.keys(ha).sort().map(Number),pa=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,l.Ur)(e,n),s=(0,l.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r,isPlaybackRateActive:c}=(0,l.jU)(e).audioPlayer;return{sender:a,chat:s,volume:o,playbackRate:i,isPlaybackRateActive:c,isMuted:r}}))((e=>{let{message:t,className:n,noUi:r,sender:c,chat:d,volume:l,playbackRate:u,isPlaybackRateActive:h,isMuted:g}=e;const{setAudioPlayerVolume:p,setAudioPlayerPlaybackRate:f,setAudioPlayerMuted:I,focusMessage:v,closeAudioPlayer:w}=(0,a.Sv)(),b=(0,i.sO)(null),y=(0,At.Z)(),{isMobile:P}=(0,S.ZP)(),{audio:Z,voice:C,video:E}=(0,m.qp)(t),M=Boolean(C||E),R=M||(Z?.duration||0)>o.J0S,k=c?(0,m.OU)(y,c):void 0,T=Te.UV((0,m.Ti)(t,"inline")),A=((e,t,n)=>{const a=(0,At.Z)(),{audio:s,voice:o}=(0,m.qp)(e),r=s?s.title||s.fileName:o?"Voice message":"",c=s?.performer||t&&(0,m.OU)(a,t),d=n&&(0,m.U)(a,n)||"Telegram",l=s&&(0,m.MR)(s)&&(0,m.Ti)(e,"pictogram"),u=t&&(0,m.RT)(t,"big"),h=s&&l||o&&u,g=(0,Yt.Z)(h),p=(0,i.Ye)((()=>function(e,t,n){if(!n)return da;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?Ae.vY:void 0}(s,o,g)),[s,g,o]),{result:f}=(0,ra.Z)((()=>function(e,t){if(!e)return Promise.resolve(ca);if(!t)return function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{oa(o,t,n,a).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},o.src=s}))}(e,la,la);const n=Math.min(t.width,t.height);return n<la?sa(e,la/n):Promise.resolve(e)}(g,p)),[g,p],ca);return(0,i.Ye)((()=>(0,ea.Of)({title:r,artist:c,album:d,artwork:[{src:f}]})),[d,c,r,f])})(t,c,d),{playPause:N,stop:x,isPlaying:B,requestNextTrack:L,requestPreviousTrack:U,isFirst:j,isLast:O,setVolume:F,toggleMuted:_,setPlaybackRate:D}=(0,ta.Z)((0,Qn.An)(t),(0,m.XV)(t),M?"voice":"audio",T,void 0,A,void 0,!0,void 0,void 0,(0,m.CI)(t),!0),{isContextMenuOpen:q,handleBeforeContextMenu:$,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,ua.Z)(b),z=(0,i.I4)((()=>{v({chatId:t.chatId,messageId:t.id})}),[v,t.chatId,t.id]),W=(0,i.I4)((()=>{B&&N(),w(),(0,ea.Ay)(),x()}),[w,B,N,x]),X=(0,i.I4)((e=>{p({volume:e/100}),F(e/100)}),[p,F]),Y=(0,i.I4)((()=>{s.$b&&!s.cj||(_(),I({isMuted:!g}))}),[g,I,_]),K=(0,i.I4)((function(e){const t=ha[e],n=1!==e&&(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);f({playbackRate:t,isPlaybackRateActive:n}),D(n?t:1)}),[f,D]),J=(0,i.I4)((()=>{G();const e=Number(Object.entries(ha).find((e=>{let[,t]=e;return t===u}))?.[0])||1,t=!h;K(t&&1===e?2:e,t)}),[G,h,u,K]),Q=(0,i.I4)((()=>{const e=Object.entries(ha).find((e=>{let[,t]=e;return t===u}))?.[0]||1,t=`${1===u?2:e}Х`;return i.ZP.createElement("div",{className:"playback-wrapper"},q&&i.ZP.createElement("div",{className:"playback-backdrop",onClick:G}),i.ZP.createElement(Dt.Z,{round:!0,className:(0,st.Z)("playback-button",h&&"applied",q&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!P,onMouseEnter:H,onClick:J,onMouseDown:$,onContextMenu:H},i.ZP.createElement("span",{className:(0,st.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))}),[$,H,G,J,q,P,h,u]),ee=(0,i.Ye)((()=>0===l||g?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,g]);if(!r)return i.ZP.createElement("div",{className:(0,st.Z)("AudioPlayer",n),dir:y.isRtl?"rtl":void 0,ref:b},i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:z},Z?function(e){const{title:t,performer:n,fileName:a}=e;return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},(0,Fn.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Fn.Z)(n)))}(Z):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Fn.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(y("AttachAudio"),k),i.ZP.createElement(qn.Z,null)),i.ZP.createElement(Dt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:j(),onClick:U,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon-skip-previous"})),i.ZP.createElement(Dt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:(0,st.Z)("toggle-play","player-button",B?"pause":"play"),onClick:N,ariaLabel:B?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon-play"}),i.ZP.createElement("i",{className:"icon-pause"})),i.ZP.createElement(Dt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:L,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon-skip-next"})),i.ZP.createElement("div",{className:"volume-button-wrapper"},i.ZP.createElement(Dt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:Y,ripple:!P},i.ZP.createElement("i",{className:ee})),!s.cj&&i.ZP.createElement("div",{className:"volume-slider-wrapper"},i.ZP.createElement("div",{className:"volume-slider-spacer"}),i.ZP.createElement("div",{className:"volume-slider"},i.ZP.createElement(ma.Z,{bold:!0,value:g?0:100*l,onChange:X})))),R&&i.ZP.createElement(Ft.Z,{forceOpen:q,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Q,onClose:G,onHide:V,onMouseEnterBackdrop:G},ga.map((e=>function(e,t,n,a){const s=t===ha[e]&&a||1===e&&!a;return i.ZP.createElement(_t.Z,{key:e,onClick:()=>n(e),icon:s?"check":void 0,customIcon:s?void 0:i.ZP.createElement("i",{className:"icon-placeholder"})},e,"X")}(e,u,K,h)))),i.ZP.createElement(Dt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:W,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var fa=n(4794),Ia=n(14605);const va=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,l.Z1)(e,n),user:(0,m.YC)(n)?(0,l.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:s,user:o,settings:r,currentUserId:c}=e;const{openAddContactDialog:d,blockContact:l,reportSpam:u,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:I,hideChatReportPanel:v}=(0,a.Sv)(),w=(0,At.Z)(),[b,y,P]=(0,Rt.Z)(),[Z,C]=(0,i.eJ)(!0),[S,E]=(0,i.eJ)(!0),{accessHash:M}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:T,canBlockContact:A}=r||{},N=s&&(0,m.G9)(s),x=(0,i.I4)((()=>{d({userId:t}),R&&I({id:t})}),[d,R,I,t]),B=(0,i.I4)((()=>{P(),l({contactId:t,accessHash:M}),k&&Z&&u({chatId:t}),S&&h({chatId:t})}),[M,l,P,h,u,k,S,Z,t]),L=(0,i.I4)((()=>{v({chatId:t})}),[t,v]),U=(0,i.I4)((()=>{P(),u({chatId:t}),N?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,P,c,p,f,N,g,u]);if(r)return i.ZP.createElement("div",{className:(0,st.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&i.ZP.createElement(Dt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),A&&i.ZP.createElement(Dt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:y},w("lng_new_contact_block")),k&&!A&&i.ZP.createElement(Dt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:y},w("lng_report_spam_and_leave")),i.ZP.createElement(Dt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement($n.Z,{isOpen:b,onClose:P,title:w("BlockUserTitle",o?(0,m.Vl)(o):(0,m.U)(w,s)),text:o?w("UserInfo.BlockConfirmationTitle",(0,m.Js)(o)):w("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:o?B:U},o&&i.ZP.createElement(Ia.Z,{label:w("DeleteThisChat"),checked:S,onCheck:E}),o&&k&&i.ZP.createElement(Ia.Z,{label:w("ReportChat"),checked:Z,onCheck:C})))}))),wa=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s,isMobile:o}=t;const{isLeftColumnShown:i,shouldSkipHistoryAnimations:r,audioPlayer:d,messageLists:u}=(0,l.jU)(e),{lastSyncTime:h}=e,g=(0,l.Z1)(e,n),{chatId:p,messageId:f}=d,I=p&&f?(0,l.hj)(e,p,f):void 0;let v;if("pinned"===s){const t=(0,l.KB)(e,n,a);v=t?.length}else if("scheduled"===s){const t=(0,l.qy)(e,n,a);v=t?.length}else if("thread"===s&&a!==c._f){const t=(0,l.tZ)(e,n,a);v=t?.messagesCount||0}const w="thread"===s&&a===c._f,b=g&&(0,l.xo)(e,g),y=Boolean(b&&(0,l.s4)(e,n)),P=b&&!y&&Boolean((0,l.pk)(e,n)),Z=Boolean(g&&(w||g.isForum)&&((0,m.eA)(g)||(0,m.ZV)(g))&&g.isNotJoined),C=Boolean(g?.isNotJoined&&g.isJoinRequest),S={typingStatus:(0,l.WP)(e,n,a,"typingStatus"),isLeftColumnShown:i,isRightColumnShown:(0,l.Jf)(e,o),isSelectModeActive:(0,l.CA)(e),audioMessage:I,chat:g,messagesCount:v,isChatWithSelf:(0,l.FM)(e,n),lastSyncTime:h,shouldSkipHistoryAnimations:r,currentTransitionKey:Math.max(0,u.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:P||y||Z||C},E=(0,l.Zw)(e,n);if("thread"!==s||!E)return S;if(Object.assign(S,{messagesById:E}),a!==c._f&&!g?.isForum){const t=(0,l.qS)(e,n,a),s=t?(0,l.hj)(e,n,t):void 0,o=s?(0,l.cv)(e,s):void 0,i=(0,l.tZ)(e,n,a);return{...S,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o,isComments:Boolean(i?.originChannelId)}}const M=(0,l.KB)(e,n,a);if(M?.length){const t=E[M[0]],{canUnpin:n}=t&&(0,l._k)(e,t,a)||{};return{...S,pinnedMessageIds:M,canUnpin:n}}return S}))((e=>{let{chatId:t,threadId:n,messageListType:s,isReady:r,isMobile:d,pinnedMessageIds:l,messagesById:u,canUnpin:h,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:w,chat:b,messagesCount:y,isComments:P,isChatWithSelf:Z,lastSyncTime:C,hasButtonInHeader:E,shouldSkipHistoryAnimations:M,currentTransitionKey:R,connectionState:k,isSyncing:T,getCurrentPinnedIndexes:A,getLoadingPinnedId:N,onFocusPinnedMessage:x}=e;const{openChatWithInfo:B,pinMessage:L,focusMessage:U,openChat:j,openPreviousChat:O,loadPinnedMessages:F,toggleLeftColumn:_,exitMessageSelectMode:D}=(0,a.Sv)(),q=(0,At.Z)(),$=(0,i.sO)(!0),{isTablet:H}=(0,S.ZP)(),G=(0,Ln.Z)(A)[`${t}_${n}`]||0,V=(0,Ln.Z)(N),z=Array.isArray(l)?l[G]:l,W=u&&z?u[z]:void 0,X=Array.isArray(l)?l.length:l?1:void 0,Y=b&&(0,m.U)(q,b).length,K=g?(0,m.OU)(q,g):void 0,{settings:J}=b||{},Q=b?.isForum;(0,i.d4)((()=>{C&&r&&(n===c._f||Q)&&F({chatId:t,threadId:n})}),[t,F,C,n,r,Q]),(0,xn.Z)(t,z,W);const{width:ee}=(0,Mn.Z)(),te=ee<=o.ksF,ne=H&&I,ae=(0,i.sO)(null),se=(0,i.sO)(!0),oe=(0,i.I4)((()=>{B({id:t,threadId:n})}),[B,t,n]),ie=(0,i.I4)((e=>{L({messageId:e,isUnpin:!0})}),[L]),re=(0,i.I4)((e=>{const a=e.shiftKey&&Array.isArray(l)?l[(0,An.Z)(l.length,l.indexOf(z)-2)]:z;x(a)&&U({chatId:t,threadId:n,messageId:a,noForumTopicPanel:!0})}),[l,z,x,t,n]),ce=(0,i.I4)((()=>{j({id:t,threadId:n,type:"pinned"})}),[j,t,n]),de=(0,i.I4)((()=>{setTimeout((()=>{$.current=!0}),450)}),[]),le=(0,i.I4)((e=>{if($.current){if($.current=!1,d){const e=document.querySelector(o.Edp);e?.blur()}if(f)return D(),void de();if("thread"===s&&0===R)return!H||ne?(e.stopPropagation(),j({id:void 0},{forceOnHeavyAnimation:!0})):_(),void de();O(),de()}}),[d,f,s,R,de,H,ne]),ue=ee>=o.ksF&&ee<o.jT7||ee>o.l35&&ee<o.ksF&&(!Y||Y>30),me=ue||ee>o._mX&&ee<o.QU1,he=Boolean(J?.canAddContact||J?.canBlockContact||J?.canReportSpam),{shouldRender:ge,transitionClassNames:pe}=(0,ft.Z)(he),fe=(0,Bn.Z)(he?J:void 0,!0),{shouldRender:Ie,transitionClassNames:ve}=(0,ft.Z)(Boolean(w)),we=(0,Bn.Z)(w,!0),{shouldRender:be,transitionClassNames:ye}=(0,ft.Z)(Boolean(W),void 0,!0),Pe=(0,Bn.Z)(W,!0),Ze=(0,Bn.Z)(X,!0),Ce=(0,Bn.Z)(h,!0),Se=(0,Bn.Z)(K),Ee=(0,kn.Z)(R),Me=void 0!==Ee&&Ee<R?Ee:void 0,Re=be&&Pe||Ie&&we;(0,i.d4)((()=>{const e=ae.current;if(e)return me&&Re?void(v||ue?(se.current&&(e.classList.add("tools-stacked","animated"),se.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),se.current=!0)):(e.classList.remove("tools-stacked","animated"),void(se.current=!0))}),[me,Re,ue,v]);const{connectionStatusText:ke}=Ut(q,k,T,!0);function Te(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.ZP.createElement("div",{className:"back-button"},i.ZP.createElement(Dt.Z,{round:!0,size:"smaller",color:"translucent",onClick:le,ariaLabel:q(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,st.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(St,null))}const Ae=Boolean(Ie&&we),Ne=Ae||!d&&E&&ee<o.sgm;return i.ZP.createElement("div",{className:"MiddleHeader",ref:ae},i.ZP.createElement(Tt.Z,{name:M?"none":"slide-fade",activeKey:R,shouldCleanup:!0,cleanupExceptionKey:Me},"thread"!==s||n!==c._f&&!b?.isForum?i.ZP.createElement(i.ZP.Fragment,null,Te(),i.ZP.createElement("h3",null,void 0!==y?"thread"===s?q(P?"CommentsCount":"Replies",y,"i"):"pinned"===s?q("PinnedMessagesCount",y,"i"):"scheduled"===s?Z?q("Reminders"):q("messages",y,"i"):void 0:q("Loading"))):i.ZP.createElement(i.ZP.Fragment,null,(te||R>0)&&Te(ne,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:oe},(0,m.YC)(t)?i.ZP.createElement(Un.Z,{key:t,userId:t,typingStatus:p,status:ke,withDots:Boolean(ke),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:r,emojiStatusSize:22,noRtl:!0}):i.ZP.createElement(jn.Z,{key:t,chatId:t,threadId:n,typingStatus:p,status:ke,withDots:Boolean(ke),withMediaViewer:n===c._f,withFullInfo:n===c._f,withUpdatingStatus:!0,withVideoAvatar:r,noRtl:!0})))),n===c._f&&!b?.isForum&&i.ZP.createElement(fa.Z,{hasPinnedOffset:be&&Boolean(Pe)||Ie&&Boolean(we),chatId:t}),be&&Pe&&i.ZP.createElement(Jn,{key:t,message:Pe,count:Ze||0,index:G,customTitle:Se,className:ye,onUnpinMessage:Ce?ie:void 0,onClick:re,onAllPinnedClick:ce,isLoading:void 0!==V,isFullWidth:Ne}),ge&&i.ZP.createElement(va,{key:t,chatId:t,settings:fe,className:pe}),i.ZP.createElement("div",{className:"header-tools"},Ae&&i.ZP.createElement(pa,{key:(0,m.Tp)(we),message:we,className:ve}),i.ZP.createElement(On.Z,{chatId:t,threadId:n,messageListType:s,isMobile:d,canExpandActions:!Ae})))}))),ba=600;function ya(e){return"albumId"in e}function Pa(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,ce._F)(1e3*e[0].date),senderGroups:[a]};const o=[s];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}:a.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(a.push(n),n=void 0),c){const e=(0,ce._F)(1e3*c.date);s.datetime!==e?(s={originalDate:c.date,datetime:e,senderGroups:[]},o.push(s),a=[],s.senderGroups.push(a)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,m.FT)(i)||(0,m.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>ba)&&(a=[],s.senderGroups.push(a))}})),o}var Za=n(30386),Ca=n(87675),Sa=n(60539),Ea=n(70971),Ma=n(88957);const Ra=1e3,ka=10,Ta=60;var Aa=n(60998);const Na=(e,t,n)=>{const a=(0,i.sO)();return(0,i.bt)((()=>{const n=a.current;return a.current=t,e(n||[])}),t,n)};var xa=n(78722),Ba=n(3657);const La=s.wZ?1e3:350,Ua=20*Ae.Gw,ja=15*Ae.Gw,Oa=20*Ae.Gw,Fa=7*Ae.Gw,_a=5*Ae.Gw,Da=12;function qa(e,t){return e?t?Oa:ja:t?Ua:Fa}function $a(e,t,n,a){const s=(0,m.B4)(e),o=(0,m.O$)(e)||(0,m.F$)(e),i=(0,m.b7)(e),r=Boolean((0,m.F$)(e)),c=Boolean((0,m.Cg)(e)),{width:d,height:l}=o?(0,Ae.Eh)(o,s,t,r,n,a):(0,Ae.GC)(i,s,t,c,n,a),u=qa(Boolean((0,m.UD)(e)));let h=1;d<u&&u-d<Da&&(h=u/d),l*h<_a&&_a-l*h<Da&&(h=_a/l);const g=Math.round(d*h),p=Math.round(l*h);return{width:g,height:p,isSmall:g<u||p<_a}}const Ha={None:0,Top:1,Right:2,Bottom:4,Left:8};function Ga(e,t){return e.reduce(((e,t)=>e+t),t)}function Va(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:a}=e;a&Ha.Right&&(t.width=n.width+n.x),a&Ha.Bottom&&(t.height=n.height+n.y)})),t}function za(e,t,n,a,s){const o=function(e,t){return e.map((e=>{const n=$a(e,void 0,void 0,t);return n.width/n.height}))}(a.messages,s),i=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(o),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(o),c=o.length,d=o.some((e=>e>2)),l=(0,Ae.kc)(e,t,!1,n,s)-(t?2.5:0)*Ae.Gw;let u;const m={ratios:o,proportions:i,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return u=c>=5||d?function(e){let{ratios:t,averageRatio:n,maxWidth:a,minWidth:s,spacing:o,maxHeight:i=4*a/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,Tn.uZ)(e,1,2.75):(0,Tn.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=Ga(r.slice(e,e+t),0);return(a-(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 a=c-e-t;e<=3&&t<=(n<.85?4:3)&&a<=3&&u([e,t,a])}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 a=c-e-t-n;e<=3&&t<=3&&n<=3&&a<=4&&u([e,t,n,a])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:n}=l[e],a=n.length,r=Ga(t,0)+o*(a-1),c=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==a;++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],s=Math.round(n);let i=0;for(let c=0;c!==t;++c){const l=Ha.None|(0===e?Ha.Top:Ha.None)|(e===f-1?Ha.Bottom:Ha.None)|(0===c?Ha.Left:Ha.None)|(c===t-1?Ha.Right:Ha.None),u=r[I],m=c===t-1?a-i:Math.round(u*n);d[I]={dimensions:{x:i,y:v,width:m,height:s},sides:l},i+=m+o,++I}v+=s+o}return d}(m):2===c?function(e){const{ratios:t,proportions:n,averageRatio:a}=e;return"ww"===n&&a>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(s-a)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:Ha.Left|Ha.Top|Ha.Right},{dimensions:{x:0,y:o+a,width:n,height:o},sides:Ha.Left|Ha.Bottom|Ha.Right}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=(n-a)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],s)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:Ha.Top|Ha.Left|Ha.Bottom},{dimensions:{x:o+a,y:0,width:o,height:i},sides:Ha.Top|Ha.Right|Ha.Bottom}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:a,spacing:s,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(a-s),(a-s)/t[0]/(1/t[0]+1/t[1]))),a-s-i),c=a-r-s,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:Ha.Top|Ha.Left|Ha.Bottom},{dimensions:{x:c+s,y:0,width:r,height:d},sides:Ha.Top|Ha.Right|Ha.Bottom}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:a,maxWidth:s,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,a[1]*(s-n)/(a[2]+a[1]))),c=i-r-n,d=Math.max(o,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(i*a[0]),s-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:Ha.Top|Ha.Left|Ha.Bottom},{dimensions:{x:l+n,y:0,width:d,height:c},sides:Ha.Top|Ha.Right},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:Ha.Bottom|Ha.Right}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:a,spacing:s}=e,o=t,i=Math.round(Math.min(o/n[0],.66*(a-s))),r=(t-s)/2,c=Math.min(a-i-s,Math.round(Math.min(r/n[1],r/n[2]))),d=o-r-s;return[{dimensions:{x:0,y:0,width:o,height:i},sides:Ha.Left|Ha.Top|Ha.Right},{dimensions:{x:0,y:i+s,width:r,height:c},sides:Ha.Bottom|Ha.Left},{dimensions:{x:r+s,y:i+s,width:d,height:c},sides:Ha.Bottom|Ha.Right}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:a,maxHeight:s,minWidth:o}=e;const i=t,r=Math.round(Math.min(i/n[0],.66*(s-a))),c=Math.round((t-2*a)/(n[1]+n[2]+n[3])),d=Math.max(o,Math.round(Math.min(.4*(t-2*a),c*n[1]))),l=Math.round(Math.max(Math.max(o,.33*(t-2*a)),c*n[3])),u=i-d-l-2*a,m=Math.min(s-r-a,c);return[{dimensions:{x:0,y:0,width:i,height:r},sides:Ha.Left|Ha.Top|Ha.Right},{dimensions:{x:0,y:r+a,width:d,height:m},sides:Ha.Bottom|Ha.Left},{dimensions:{x:d+a,y:r+a,width:u,height:m},sides:Ha.Bottom},{dimensions:{x:d+a+u+a,y:r+a,width:l,height:m},sides:Ha.Right|Ha.Bottom}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:a,spacing:s,minWidth:o}=e;const i=t,r=Math.round(Math.min(i*n[0],.6*(a-s))),c=Math.round((t-2*s)/(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*s,m=Math.max(o,Math.min(a-r-s,c));return[{dimensions:{x:0,y:0,width:r,height:i},sides:Ha.Top|Ha.Left|Ha.Bottom},{dimensions:{x:r+s,y:0,width:m,height:d},sides:Ha.Top|Ha.Right},{dimensions:{x:r+s,y:d+s,width:m,height:l},sides:Ha.Right},{dimensions:{x:r+s,y:d+l+2*s,width:m,height:u},sides:Ha.Bottom|Ha.Right}]}(e)}(m),{layout:u,containerStyle:Va(u)}}let Wa,Xa;function Ya(e){return Xa||(Xa=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),Wa||(Wa=document.createElement("span"),Wa.style.font=`400 12px ${Xa}`,Wa.style.whiteSpace="nowrap",Wa.style.position="absolute",Wa.style.left="-999px",Wa.style.opacity=".01",document.body.appendChild(Wa)),Wa.textContent=e,Wa.offsetWidth}var Ka=n(55254),Ja=n(44139);const Qa=1e3,es=20;function ts(e,t,n,a,s,o,r,c){const d=(0,i.Ye)((()=>{if(!r)return 0;const e=r.indexOf(t);return Math.min(e,r.length-e-1)}),[t,r]);(0,i.bt)((()=>{if(a&&e.current){const t=e.current.closest(".MessageList");(0,Sa.Z)(t,e.current,o?"end":"centerOrTop",es,void 0!==s?Qa:void 0,s,void 0,c)}}),[e,n,a,s,o,c,d])}var ns=n(3858);const as=350,ss=150,os=200,is=3*Ae.Gw,rs=Number(Ae.Gw),cs="data-is-document-group-hover";function ds(e,t,n,o,r,c,d,l,u,m,h,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,a.Sv)(),[w,b,y]=(0,Rt.Z)(),[P,Z,C]=(0,Rt.Z)(),S=(0,i.sO)();return(0,i.d4)((()=>{if(!s.$b||r||!c||h)return;let e;return(0,an.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===an.eM.Left&&(e||(e=Date.now()),Z(),!0),onRelease:()=>{e&&c&&(I({messageId:n}),setTimeout(C,Math.max(0,ss-(Date.now()-e))),e=void 0)}})}),[t,r,n,I,Z,C,c,h]),{handleMouseDown:r?void 0:function(e){(0,Za.q)(e),u(e)},handleClick:function(t){if(r)e(t);else if(s.$b)return S.current?(clearInterval(S.current),S.current=void 0,void v({chatId:m,messageId:n})):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(s.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;je.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),as):l(e)}}(t)}),os))},handleContextMenu:r?d?ns.Z:void 0:function(t){if(s.wZ){if(t.target.matches("a[href]")||h)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:r?void 0:function(){!s.$b&&c&&I({messageId:n})},handleContentDoubleClick:s.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:a}=e,{x:s,width:o,y:i,height:r}=t.getBoundingClientRect(),c=s+o/2,d=i+r/2,l=Math.abs(c-n)<is,u=Math.abs(d-a)<rs;l&&u?b():y()},handleSendQuickReaction:function(e){e.stopPropagation(),v({chatId:m,messageId:n})},handleMouseLeave:function(e){y(),f&&function(e){const t=us(e.currentTarget);t&&t.removeAttribute(cs)}(e)},isSwiped:P,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:ls}}function ls(e){const t=us(e.currentTarget);t&&t.setAttribute(cs,"")}function us(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var ms=n(3927),hs=n(74095);function gs(e,t,n){return(t=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 a=n.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ps=.2;let fs;const Is=new class{constructor(){gs(this,"promise",void 0),gs(this,"reject",void 0),gs(this,"resolve",void 0),this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}};setTimeout((function(){fs||(fs=(0,hs.K)(new Worker(new URL(n.p+n.u(1275),n.b))),Is.resolve())}),4e3);var vs=n(70172),ws=n(18005);const bs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0}));var ys=n(45601),Ps=n(66735);const Zs=(0,i.X$)((e=>{let{message:t,content:n}=e;const{openMediaViewer:s,uploadProfilePhoto:o,showNotification:r}=(0,a.Sv)(),{isOutgoing:d}=t,l=(0,At.Z)(),[u,h]=(0,i.eJ)(),[g,p,f]=(0,Rt.Z)(!1),v=(0,Yt.Z)((0,m.Ti)(t,"full")),w=t.content.action.photo?.isVideo,b=(0,i.I4)((()=>{r({title:l("ApplyAvatarHintTitle"),message:l("ApplyAvatarHint"),action:{action:"requestNextSettingsScreen",payload:{screen:I.MT.Main}},actionText:l("Open")})}),[l,r]),y=(0,i.I4)((e=>{h(void 0),o({file:e}),b()}),[b,o]),P=(0,i.I4)((()=>{h(void 0)}),[]),Z=(0,i.I4)((async()=>{f(),b();const e=t.content.action.photo,n=await Te.he(`videoAvatar${e.id}?size=u`,c.IU.BlobUrl),a=await fetch(n).then((e=>e.blob()));o({file:new File([a],"avatar.mp4"),isVideo:!0,videoTs:e.videoSizes?.find((e=>void 0!==e.videoStartTs))?.videoStartTs})}),[f,t.content.action,b,o]);return i.ZP.createElement("span",{className:"action-message-suggested-avatar",tabIndex:0,role:"button",onClick:async()=>{!d&&v?w?p():h(await fetch(v).then((e=>e.blob()))):s({chatId:t.chatId,mediaId:t.id,threadId:c._f,origin:I.bZ.SuggestedAvatar})}},i.ZP.createElement(vs.Z,{photo:t.content.action.photo,forceVideo:!0,loopIndefinitely:!0,withVideo:w,size:"jumbo"}),i.ZP.createElement("span",null,n),i.ZP.createElement("span",{className:"action-message-button"},l(w?"ViewVideoAction":"ViewPhotoAction")),i.ZP.createElement(Ps.Z,{file:u,onClose:P,onChange:y}),i.ZP.createElement($n.Z,{isOpen:g,title:l("SuggestedVideo"),confirmHandler:Z,onClose:f,textParts:n}))})),Cs=(0,i.X$)((0,a.c$)(((e,t)=>{let{message:n,threadId:a,messageListType:s}=t;const{chatId:o,senderId:i,replyToMessageId:r,content:c}=n,{byId:d}=e.users,u=i,{targetUserIds:h,targetChatId:g}=c.action||{},p=r,f=p?(0,l.hj)(e,o,p):void 0,I=!!a&&(0,l._X)(e,n,a),{direction:v,noHighlight:w}=I&&(0,l.jU)(e).focusedMessage||{},b=(0,l.Z1)(e,o),y=b&&((0,m.eA)(b)||u===o),P=!y&&u?(0,l.dy)(e,u):void 0,Z=y?b:void 0,C=e.premiumGifts?.stickers?.[0];return{usersById:d,senderUser:P,senderChat:Z,targetChatId:g,targetUserIds:h,targetMessage:f,isFocused:I,premiumGiftSticker:C,topic:(0,l.p$)(e,n),...I&&{focusDirection:v,noFocusHighlight:w,viewportIds:a&&s?(0,l.$W)(e,o,a,s):void 0}}}))((e=>{let{message:t,isEmbedded:n,appearanceOrder:s=0,isLastInList:o,usersById:r,senderUser:c,senderChat:d,targetUserIds:l,targetMessage:u,targetChatId:h,isFocused:g,focusDirection:p,noFocusHighlight:f,viewportIds:I,premiumGiftSticker:v,isInsideTopic:w,topic:b,memoFirstUnreadIdRef:y,observeIntersectionForReading:P,observeIntersectionForLoading:Z,observeIntersectionForPlaying:C,onPinnedIntersectionChange:S}=e;const{openPremiumModal:E,requestConfetti:M}=(0,a.Sv)(),R=(0,At.Z)(),k=(0,i.sO)(null);(0,Ba._N)(k,P),(0,xn.Z)(t.chatId,t.replyToMessageId,u),ts(k,t.id,t.chatId,g,p,f,I),(0,i.d4)((()=>{if(t.isPinned)return()=>{S?.({viewportPinnedIdsToRemove:[t.id],isUnmount:!0})}}),[S,t.isPinned,t.id]);const T=s<=0,[A,N]=(0,Rt.Z)(T),x=Boolean(t.content.action?.text.startsWith("ActionGift")),B="suggestProfilePhoto"===t.content.action?.type&&t.content.action.photo;(0,i.d4)((()=>{T||setTimeout(N,10*s)}),[s,N,T]);const L=(0,Ba.Op)(k,C),U=(0,i.sO)((()=>{const e=y?.current&&t.id>=y.current;return x&&!t.isOutgoing&&e})());(0,i.d4)((()=>{L&&U.current&&(U.current=!1,M())}),[L,M]);const{transitionClassNames:j}=(0,ft.Z)(A,void 0,T,!1),O=(0,i.Ye)((()=>l?l.map((e=>r?.[e])).filter(Boolean):void 0),[l,r]),F=(0,ws.D)(R,t,c,d,O,u,h,b,{isEmbedded:n},Z,C),{isContextMenuOpen:_,contextMenuPosition:D,handleBeforeContextMenu:q,handleContextMenu:$,handleContextMenuClose:H,handleContextMenuHide:G}=(0,ua.Z)(k),V=void 0!==D;if(w&&"TopicWasCreatedAction"===t.content.action?.text)return i.ZP.createElement("span",{ref:k});if(n)return i.ZP.createElement("span",{ref:k,className:"embedded-action-message"},F);const z=(0,st.Z)("ActionMessage message-list-item",g&&!f&&"focused",(x||B)&&"centered-action",V&&"has-menu-open",o&&"last-in-list",!x&&!B&&"in-one-row",j);return i.ZP.createElement("div",{ref:k,id:(0,m.d0)(t.id),className:z,"data-message-id":t.id,"data-is-pinned":t.isPinned||void 0,onMouseDown:e=>{(0,Za.q)(e),q(e)},onContextMenu:$},!B&&i.ZP.createElement("span",{className:"action-message-content"},F),x&&i.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{E({isGift:!0,fromUserId:c?.id,toUserId:l?.[0],monthsAmount:t.content.action?.months||0})}},i.ZP.createElement(ys.Z,{key:t.id,sticker:v,play:!0,noLoop:!0,nonInteractive:!0}),i.ZP.createElement("strong",null,R("ActionGiftPremiumTitle")),i.ZP.createElement("span",null,R("ActionGiftPremiumSubtitle",R("Months",t.content.action?.months,"i"))),i.ZP.createElement("span",{className:"action-message-button"},R("ActionGiftPremiumView"))),B&&i.ZP.createElement(Zs,{message:t,content:F}),D&&i.ZP.createElement(bs,{isOpen:_,anchor:D,message:t,messageListType:"thread",onClose:H,onCloseAnimationEnd:G}))}))),Ss=e=>{let{className:t,message:n,sender:a,title:s,customText:o,isProtected:r,noUserColors:c,hasContextMenu:d,observeIntersectionForLoading:l,observeIntersectionForPlaying:u,onClick:h}=e;const g=(0,i.sO)(null),p=(0,Ba.Op)(g,l),f=(0,Yt.Z)(n&&(0,m.Ti)(n,"pictogram"),!p),I=(0,_n.Z)(n),v=Boolean(n&&(0,m.Y5)(n)),w=Boolean(n&&(0,m.NE)(n)),b=(0,At.Z)(),y=a?(0,m.OU)(b,a):n?.forwardInfo?.hiddenUserName;return i.ZP.createElement("div",{ref:g,className:(0,st.Z)("EmbeddedMessage",t,a&&!c&&`color-${(0,m.Rs)(a)}`),onClick:n?h:void 0},I&&function(e,t,n,a,s){const{width:o,height:r}=(0,Ae.W7)(),c=t||e;return i.ZP.createElement("div",{className:(0,st.Z)("embedded-thumb",n&&"round")},!s&&i.ZP.createElement("img",{src:c,width:o,height:r,alt:"",className:"pictogram",draggable:!1}),i.ZP.createElement(Wn.Z,{thumbDataUri:c,isVisible:Boolean(s),width:o,height:r}),a&&i.ZP.createElement("span",{className:"protector"}))}(I,f,v,r,w),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},n?(0,m.FT)(n)?i.ZP.createElement(Cs,{message:n,isEmbedded:!0,observeIntersectionForLoading:l,observeIntersectionForPlaying:u}):i.ZP.createElement(zn.Z,{lang:b,message:n,noEmoji:Boolean(I),observeIntersectionForLoading:l,observeIntersectionForPlaying:u}):o||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Fn.Z)(y||s||" "))),d&&i.ZP.createElement("i",{className:"embedded-more icon-more"}))};var Es=n(82535),Ms=n(54752),Rs=n(8018);const ks=(0,i.X$)((e=>{let{message:t,outgoingStatus:n,signature:s,withReactionOffset:o,repliesThreadInfo:r,renderQuickReactionButton:c,noReplies:d,isTranslated:l,isPinned:u,onClick:m,onTranslationClick:h,onOpenThread:g}=e;const{showNotification:p}=(0,a.Sv)(),f=(0,At.Z)(),[I,v]=(0,Rt.Z)(),w=e=>{e.stopPropagation(),p({message:f("ImportedInfo")})},b=(0,i.Ye)((()=>{if(!I)return;const e=(0,ce.SA)(1e3*t.date,f.code,void 0,f.timeFormat),n=t.isEdited&&(0,ce.SA)(1e3*t.editDate,f.code,void 0,f.timeFormat),a=t.forwardInfo&&(0,ce.SA)(1e3*t.forwardInfo.date,f.code,void 0,f.timeFormat);let s=e;return n&&(s+="\n",s+=f("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=f("lng_forwarded_date").replace("{date}",a)),s}),[I,f,t,f.timeFormat]),y=(0,st.Z)("MessageMeta",o&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return i.ZP.createElement("span",{className:y,dir:f.isRtl?"rtl":"ltr",onClick:m,"data-ignore-on-paste":!0},l&&i.ZP.createElement("i",{className:"icon-language message-translated",onClick:h}),Boolean(t.views)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-views"},(0,Pt.bi)(t.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),!d&&Boolean(r?.messagesCount)&&i.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),g()},className:"message-replies-wrapper"},i.ZP.createElement("span",{className:"message-replies"},i.ZP.createElement(Xn.Z,{text:(0,Pt.bi)(r.messagesCount)})),i.ZP.createElement("i",{className:"icon-reply-filled"})),u&&i.ZP.createElement("i",{className:"icon-pinned-message message-pinned"}),s&&i.ZP.createElement("span",{className:"message-signature"},(0,Fn.Z)(s)),i.ZP.createElement("span",{className:"message-time",title:b,onMouseEnter:v},t.forwardInfo?.isImported&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-imported",onClick:w},(0,ce.SA)(1e3*t.forwardInfo.date,f.code,!0)),i.ZP.createElement("span",{className:"message-imported",onClick:w},f("ImportedMessage"))),t.isEdited&&`${f("EditedMessage")} `,(0,ce.mr)(f,1e3*t.date)),n&&i.ZP.createElement(Rs.Z,{status:n}),c&&c())}));var Ts=n(36765),As=n(97799);const Ns=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:o,shouldLoop:r,lastSyncTime:d,shouldPlayEffect:l,onPlayEffect:u,onStopEffect:h}=e;const{showNotification:g,openStickerSet:p}=(0,a.Sv)(),f=(0,At.Z)(),{isMobile:I}=(0,S.ZP)(),v=(0,i.sO)(null),w=t.content.sticker,{stickerSetInfo:b,isVideo:y,hasEffect:P}=w,Z=w.isPreloadedGlobally?void 0:(0,m.Ti)(t,y&&!s.Hh?"pictogram":"inline"),C=(0,Ba.Op)(v,n),E=(0,Ba.Op)(v,o),M=`sticker${w.id}?size=f`,R=(0,Yt.Z)(M,!C||!P,c.IU.BlobUrl,d),[k,T,A]=(0,Rt.Z)(),N=(0,i.I4)((()=>{A(),h?.()}),[h,A]),x=(0,kn.Z)(l);(0,i.d4)((()=>{P&&E&&(l||x)&&(T(),u?.())}),[P,E,u,l,x,T]);const B=(0,i.I4)((()=>{p({stickerSetInfo:w.stickerSetInfo})}),[p,w]),L=(0,i.I4)((()=>{if(P)return k?void g({message:f("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:w.stickerSetInfo}},actionText:f("ViewAction")}):(T(),void u?.());B()}),[P,k,f,u,B,g,T,w.stickerSetInfo]),U="isMissing"in b,{width:j,height:O}=(0,Ae.Wr)(w,I),F=(0,st.Z)("Sticker media-inner",U&&"inactive",P&&!t.isOutgoing&&"reversed");return i.ZP.createElement("div",{ref:v,className:F,style:`width: ${j}px; height: ${O}px;`,onClick:U?void 0:L},i.ZP.createElement(Ts.Z,{containerRef:v,sticker:w,fullMediaHash:Z,fullMediaClassName:"full-media",size:j,shouldLoop:r,noLoad:!C,noPlay:!E,withSharedAnimation:!0,cacheBuster:d}),P&&C&&k&&i.ZP.createElement(As.Z,{key:M,className:"effect-sticker",tgsUrl:R,size:1.49*j,play:!0,isLowPriority:!0,noLoop:!0,onEnded:N}))};var xs=n(74753),Bs=n(80036);const Ls=7*Ae.Gw,Us=1e3,js=1e3,Os=0;function Fs(e,t,n,s,o,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,a.Sv)(),m=(0,i.sO)(null),h=(0,i.sO)(null),g=(0,Yt.Z)(n?`document${n}`:void 0,!n),p=c||Ls,f=(0,Bs.Z)(`width: ${p}px`,`height: ${p}px`,r&&"cursor: pointer"),I=(0,i.sO)(void 0),v=(0,i.sO)(void 0),w=(0,i.I4)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:I.current}),v.current=void 0,I.current=void 0)}),[l,e,t,r]),b=(0,i.I4)((()=>{const e=h.current;g&&(e&&(e.pause(),e.remove()),h.current=new Audio,h.current.src=g,(0,xs.Z)(h.current),h.current.addEventListener("ended",(()=>{h.current=void 0}),{once:!0}))}),[g]),y=(0,i.I4)((()=>{b();const n=m.current;if(!(r&&n&&t&&e))return;const{x:a,y:s}=n.getBoundingClientRect();d({emoji:r,x:a,y:s,startSize:p,isReversed:!o}),I.current||(I.current=[],v.current=performance.now(),setTimeout(w,Us)),I.current.push(v.current?(performance.now()-v.current)/js:Os)}),[e,r,d,o,t,b,w,p]);return(0,i.d4)((()=>{const n=m.current;n&&s&&s.forEach((a=>{let{id:s,startSize:i,messageId:c}=a;if(i||t!==c)return;const{x:d,y:l}=n.getBoundingClientRect();u({id:s,chatId:e,emoticon:r,startSize:p,x:d,y:l,isReversed:!o}),b()}))}),[s,e,r,o,t,b,u,p]),{ref:m,size:p,style:f,handleClick:y}}const _s=(0,i.X$)((0,a.c$)(((e,t)=>{let{emoji:n,withEffects:a}=t;return{sticker:(0,l.zB)(e,n),effect:a?(0,l.tH)(e,n):void 0,soundId:(0,l.Oh)(e,n)}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:a,forceLoadPreview:s,messageId:o,chatId:r,activeEmojiInteractions:c,sticker:d,effect:l,soundId:u}=e;const{ref:m,size:h,style:g,handleClick:p}=Fs(r,o,u,c,t,l?.emoji),f=(0,Ba.Op)(m,n);return i.ZP.createElement(ys.Z,{sticker:d,size:h,quality:1,noLoad:!f,forcePreview:s,lastSyncTime:a,play:f,forceOnHeavyAnimation:!0,ref:m,className:(0,st.Z)("AnimatedEmoji media-inner",d?.id===Ae.wB&&"like-sticker-thumb"),style:g,onClick:p})}))),Ds=(0,i.X$)((0,a.c$)(((e,t)=>{let{customEmojiId:n,withEffects:a}=t;const s=e.customEmojis.byId[n];return{sticker:s,effect:s?.emoji&&a?(0,l.tH)(e,s.emoji):void 0,soundId:s?.emoji&&(0,l.Oh)(e,s.emoji)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:a,chatId:s,activeEmojiInteractions:o,sticker:r,effect:c,soundId:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:g}=Fs(s,a,d,o,t,c?.emoji,(0,Ja.qo)(1));return i.ZP.createElement(Wt.Z,{ref:u,documentId:n,className:(0,st.Z)("AnimatedEmoji media-inner",r?.id===Ae.wB&&"like-sticker-thumb"),style:h,size:m,isBig:!0,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:l,onClick:g})}))),qs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function $s(e,t,n,a,s){return a?Promise.resolve(qs[s||"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 a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.width,a.height=n.height,s.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(s.getImageData(o,i,1,1).data).join(",")})`}(e,t)}var Hs=n(92566),Gs=n(15866);function Vs(e,t,n){const{isMobile:a}=(0,S.ZP)(),o=n||(0,m.DH)(e);return(0,Gs.Z)(o,Boolean(t),a&&!s.vX)}var zs=n(70692),Ws=n(39196);const Xs=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:s,canAutoLoad:r,isInSelectMode:c,isSelected:d,uploadProgress:l,forcedWidth:u,size:h="inline",dimensions:g,asForwarded:p,nonInteractive:f,shouldAffectAppendix:I,isDownloading:v,isProtected:w,theme:b,onClick:y,onCancelUpload:P}=e;const Z=(0,i.sO)(null),C=(0,m.O$)(n)||(0,m.F$)(n),E=C.blobUrl,M=(0,Ba.Op)(Z,a),{isMobile:R}=(0,S.ZP)(),[k,T]=(0,i.eJ)(r),A=k&&M,{mediaData:N,loadProgress:x}=(0,Hs.Z)((0,m.Ti)(n,h),!A),B=E||N,L=Boolean(u),[U]=(0,i.eJ)(!B),j=Boolean(B),O=Vs(n,j),F=Vs(n,!L),_=(0,zs.Z)(!j),D=(0,m.DH)(n),[q,,$]=(0,Rt.Z)(C.isSpoiler),{loadProgress:H}=(0,Hs.Z)((0,m.Ti)(n,"download"),!v,(0,m.kG)(n,"download")),{isUploading:G,isTransferring:V,transferProgress:z}=(0,m.Sc)(n,l||(v?H:x),A&&!B),W=!1===(0,kn.Z)(k),{shouldRender:X,transitionClassNames:Y}=(0,ft.Z)(V,void 0,W,"slow"),{shouldRender:K,transitionClassNames:J}=(0,ft.Z)(!B&&!k),Q=(0,i.I4)((()=>{G?P?.(n):B?q?$():y?.(n.id):T((e=>!e))}),[B,$,q,G,n,P,y]),ee=(0,m.B4)(n);Na((e=>{let[t]=e;if(!I)return void(t&&Z.current.closest(o.be_).removeAttribute(o.s22));const n=Z.current.closest(o.be_);B?$s(B,ee,0,d,b).then((e=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(o.s22,"")})):n.classList.add("has-appendix-thumb")}),[I,B,ee,c,d,b]);const{width:te,height:ne,isSmall:ae}=g||$a(n,p,s,R),se=(0,st.Z)("media-inner",!G&&!f&&"interactive",ae&&"small-image",te===ne&&"square-image",ne<_a&&"fix-min-height"),oe=g?` width: ${te}px; left: ${g.x}px; top: ${g.y}px;`:"",ie="inline"===h?`height: ${ne}px;${oe}`:void 0;return i.ZP.createElement("div",{id:t,ref:Z,className:se,style:ie,onClick:G?void 0:Q},L&&i.ZP.createElement("canvas",{ref:F,className:"thumbnail blurred-bg"}),i.ZP.createElement("img",{src:B,className:(0,st.Z)("full-media",L&&"with-blurred-bg"),alt:"",style:u?`width: ${u}px`:void 0,draggable:!w}),U&&i.ZP.createElement("canvas",{ref:O,className:(0,st.Z)("thumbnail",_)}),w&&i.ZP.createElement("span",{className:"protector"}),X&&!K&&i.ZP.createElement("div",{className:`media-loading ${Y}`},i.ZP.createElement(Ws.Z,{progress:z,onClick:G?Q:void 0})),K&&i.ZP.createElement("i",{className:(0,st.Z)("icon-download",J)}),i.ZP.createElement(Wn.Z,{isVisible:q,withAnimation:!0,thumbDataUri:D,width:te,height:ne,className:"media-spoiler"}),V&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*z),"%"))};var Ys=n(57080);const Ks=e=>{let{id:t,message:n,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:l,forcedWidth:u,lastSyncTime:h,dimensions:g,asForwarded:p,isDownloading:f,isProtected:I,onClick:v,onCancelUpload:w}=e;const b=(0,i.sO)(null),y=(0,i.sO)(null),P=(0,m.b7)(n)||(0,m.Cg)(n),Z=P.blobUrl,[C,,E]=(0,Rt.Z)(P.isSpoiler),M=(0,Ba.Op)(b,s),R=(0,Ba.Op)(b,o)&&M,k=(0,i.sO)(M);R&&!k.current&&(k.current=!0);const{isMobile:T}=(0,S.ZP)(),[A,N]=(0,i.eJ)(c),x=Boolean(A&&M&&h),[B,L]=(0,i.eJ)(Boolean(d&&!C)),U=(0,m.Ti)(n,"inline"),[j]=(0,i.eJ)(Boolean(U&&Te.UV(U))),{mediaData:O,loadProgress:F}=(0,Hs.Z)(U,!x,(0,m.kG)(n,"inline"),h),_=Z||O,[D,q]=(0,Rt.Z)(),$=(0,m.DH)(n),H=Boolean($),G=Boolean(u),V=(0,m.Ti)(n,"preview"),[z]=(0,i.eJ)(Boolean(V&&Te.UV(V))),W=M&&h,X=(0,Yt.Z)(V,!W,void 0,h),Y=(0,zs.Z)((H||X)&&!D),K=!H||X||D,J=Vs(n,K),Q=Vs(n,!G),ee=(0,zs.Z)(!K),te=_&&k.current,{loadProgress:ne}=(0,Hs.Z)((0,m.Ti)(n,"download"),!f,(0,m.kG)(n,"download"),h),{isUploading:ae,isTransferring:se,transferProgress:oe}=(0,m.Sc)(n,l||(f?ne:F),x&&!D&&!j||f),ie=!1===(0,kn.Z)(A),{shouldRender:re,transitionClassNames:de}=(0,ft.Z)(se,void 0,ie),{transitionClassNames:le}=(0,ft.Z)(Boolean((A||_)&&!B&&!re)),[ue,me]=(0,i.eJ)(0),he=(0,i.I4)((e=>{me(Math.max(0,e.currentTarget.currentTime-1))}),[]),ge=y.current?.duration||P.duration||0,pe=(0,m.B4)(n),fe=Boolean((0,m.Cg)(n)),{width:Ie,height:ve}=g||(0,Ae.GC)(P,pe,p,fe,r,T),we=(0,i.I4)((()=>{ae?w?.(n):f?(0,a.Sv)().cancelMessageMediaDownload({message:n}):_?(_&&!B&&L(!0),C?E():v?.(n.id)):N((e=>!e))}),[ae,f,_,B,C,v,n,w,E]),be=(0,st.Z)("media-inner dark",!ae&&"interactive",ve<_a&&"fix-min-height"),ye=`height: ${ve}px;${g?` width: ${Ie}px; left: ${g.x}px; top: ${g.y}px;`:""}`;return i.ZP.createElement("div",{ref:b,id:t,className:be,style:ye,onClick:ae?void 0:we},G&&i.ZP.createElement("canvas",{ref:Q,className:"thumbnail blurred-bg"}),te&&i.ZP.createElement(Ys.Z,{ref:y,src:_,className:(0,st.Z)("full-media",G&&"with-blurred-bg"),canPlay:B&&R,muted:!0,loop:!0,playsInline:!0,draggable:!I,onTimeUpdate:he,onReady:q,style:u?`width: ${u}px`:void 0}),i.ZP.createElement("img",{src:X,className:(0,st.Z)("thumbnail",Y,G&&"with-blurred-bg"),alt:"",style:u?`width: ${u}px;`:void 0,draggable:!I}),H&&!z&&i.ZP.createElement("canvas",{ref:J,className:(0,st.Z)("thumbnail",ee)}),I&&i.ZP.createElement("span",{className:"protector"}),i.ZP.createElement("i",{className:(0,st.Z)("icon-large-play",le)}),i.ZP.createElement(Wn.Z,{isVisible:C,withAnimation:!0,thumbDataUri:$,width:Ie,height:ve,className:"media-spoiler"}),re&&i.ZP.createElement("div",{className:(0,st.Z)("media-loading",de)},i.ZP.createElement(Ws.Z,{progress:oe,onClick:we})),!A&&!_&&i.ZP.createElement("i",{className:"icon-download"}),se?i.ZP.createElement("span",{className:"message-transfer-progress"},ae||f?`${Math.round(100*oe)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,ce.k9)(Math.max(ge-ue,0))))};var Js=n(6272);const Qs=(0,a.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,l.dy)(e,n.userId),phoneCodeList:a,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{contact:t,user:n,phoneCodeList:s,animationLevel:o}=e;const{openChat:r}=(0,a.Sv)(),{firstName:c,lastName:d,phoneNumber:l,userId:u}=t,m="0"!==u,h=(0,i.I4)((()=>{r({id:u})}),[r,u]);return i.ZP.createElement("div",{className:(0,st.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},i.ZP.createElement(vs.Z,{size:"large",user:n,text:c||d,animationLevel:o,withVideo:!0}),i.ZP.createElement("div",{className:"contact-info"},i.ZP.createElement("div",{className:"contact-name"},c," ",d),i.ZP.createElement("div",{className:"contact-phone"},(0,Js.WZ)(s,l))))}));var eo=n(20230),to=n(51218),no=n(14434),ao=n(96937);function so(e,t){return t>0?(e/t*100).toFixed():0}const oo=e=>{let{answer:t,voteResults:n,totalVoters:a,maxVotersCount:s,correctResults:o,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),d=0===o.length||-1!==o.indexOf(t.option),l=o.length>0&&d||c?.isChosen,u=c?so(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),p=c?so(c.votersCount,s||0):0,f=m!==u;if((0,i.d4)((()=>{r&&h(u)}),[r,u]),(0,i.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 i.ZP.createElement("div",{className:"PollOption",dir:"ltr"},i.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",l&&i.ZP.createElement("span",{className:(0,st.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:d?"icon-check":"icon-close"}))),i.ZP.createElement("div",{className:"poll-option-right"},i.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Fn.Z)(t.text)),i.ZP.createElement("div",{className:(0,st.Z)("poll-option-answer",l&&!d&&"wrong")},i.ZP.createElement("div",{className:"poll-option-corner",ref:g}),i.ZP.createElement("div",{className:"poll-option-line",style:I}))))};function io(e){e.stopPropagation()}const ro=(0,i.X$)((0,a.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:a}=n.results,{users:{byId:s}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:s}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:s,usersById:o,onSendVote:r}=e;const{loadMessage:c,openPollResults:d,requestConfetti:l}=(0,a.Sv)(),{id:u,chatId:m}=t,{summary:h,results:g}=n,[p,f]=(0,i.eJ)(!1),[I,v]=(0,i.eJ)([]),[b,y]=(0,i.eJ)(!1),[P,Z]=(0,i.eJ)(!1),[C,S]=(0,i.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+(0,w.Qj)(),h.closePeriod):0),E=(0,i.sO)(null),{results:M,totalVoters:R}=g,k=M&&M.some((e=>e.isChosen)),T=!h.closed&&!k,A=!T&&h.isPublic&&Number(g.totalVoters)>0,N=T&&h.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=h.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(h.quiz&&h.closePeriod&&C<=0)})));(0,i.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));p&&e&&(e.isCorrect&&l(),f(!1))}),[p,n.results.results,l]),(0,i.d4)((()=>{C>0&&setTimeout((()=>S(C-1)),1e3);const e=E.current;if(e){const t=12*Math.PI,n=e.lastElementChild,a=e.firstElementChild;if(C<=5&&e.classList.add("hurry-up"),n&&a){const e=(h.closePeriod-C)/h.closePeriod*t;a.textContent=(0,ce.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,ce.k9)(C)}</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>`}}),[C,h.closePeriod]),(0,i.d4)((()=>{h.quiz&&(C<=0||k&&!h.closed)&&c({chatId:m,messageId:u})}),[m,C,k,c,u,h.closed,h.quiz]),(0,i.d4)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{c({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[T,m,c,u,h.closePeriod,h.closed,h.quiz]);const U=(0,i.Ye)((()=>s?s.reduce(((e,t)=>{const n=o[t];return n&&e.push(n),e}),[]):[]),[o,s]),j=(0,i.I4)((e=>{v([e]),f(!0),Z(!0),r([e])}),[r]),O=(0,i.I4)((e=>{v(e)}),[]),F=(0,i.I4)((()=>{f(!0),Z(!0),r(I)}),[r,I]),_=(0,i.I4)((()=>{d({chatId:m,messageId:u})}),[m,u,d]),D=(0,i.I4)((()=>{y(!0)}),[]),q=(0,i.I4)((()=>{y(!1),Z(!1)}),[]);(0,i.d4)((()=>{P&&k&&h.quiz&&g.results&&n.results.solution&&(g.results.find((e=>e.isChosen&&e.isCorrect))||y(!0))}),[k,P,g.results,h.quiz,n.results.solution]);const $=(0,At.Z)();return i.ZP.createElement("div",{className:"Poll",dir:$.isRtl?"auto":"ltr"},b&&n.results.solution&&i.ZP.createElement(ao.Z,{message:(0,eo.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:q,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,Fn.Z)(h.question,["emoji","br"])),i.ZP.createElement("div",{className:"poll-type"},$(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),U.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},U.map((e=>i.ZP.createElement(vs.Z,{size:"micro",user:e})))),C>0&&T&&i.ZP.createElement("div",{ref:E,className:"poll-countdown"}),h.quiz&&n.results.solution&&!T&&i.ZP.createElement(Dt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:b,onClick:D,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon-lamp"}))),T&&i.ZP.createElement("div",{className:"poll-answers",onClick:io},N?i.ZP.createElement(to.Z,{options:L,onChange:O,disabled:t.isScheduled||p,loadingOptions:p?I:void 0,round:!0}):i.ZP.createElement(no.Z,{name:`poll-${u}`,options:L,onChange:j,disabled:t.isScheduled||p,loadingOption:p?I[0]:void 0})),!T&&i.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return i.ZP.createElement(oo,{key:e.option,shouldAnimate:P||!T,answer:e,voteResults:M,totalVoters:R,maxVotersCount:x,correctResults:B})}))),!A&&!N&&i.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")}($,h.quiz,g.totalVoters)),N&&i.ZP.createElement(Dt.Z,{isText:!0,disabled:0===I.length,size:"tiny",onClick:F},$("PollSubmitVotes")),A&&i.ZP.createElement(Dt.Z,{isText:!0,size:"tiny",onClick:_},$("PollViewResults")))})));var co=n(48035),lo=n(10088);const uo=(0,i.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,inPreview:r,asForwarded:c,lastSyncTime:d,isDownloading:l=!1,isProtected:u,theme:h,onMediaClick:g,onCancelMediaTransfer:p}=e;const f=(0,m.s1)(t),{isMobile:I}=(0,S.ZP)(),v=(0,i.I4)((()=>{g()}),[g]);if(!f)return;const{siteName:w,url:b,displayUrl:y,title:P,description:Z,photo:C,video:E}=f,M=(0,co.Z)(Z,170),R=Boolean(M||P||w);let k=!1;if(R&&f?.photo&&!f.video){const{width:e,height:n}=$a(t,void 0,void 0,I);k=e===n}const T=(C||E)&&g&&!k,A=(0,st.Z)("WebPage",r&&"in-preview",k&&"with-square-photo",!C&&!E&&!r&&"without-media",E&&"with-video",!R&&"no-article");return i.ZP.createElement("div",{className:A,"data-initial":(w||y)[0],dir:"auto"},C&&!E&&i.ZP.createElement(Xs,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,size:k?"pictogram":"inline",asForwarded:c,nonInteractive:!T,isDownloading:l,isProtected:u,theme:h,onClick:T?v:void 0,onCancelUpload:p}),R&&i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(lo.Z,{className:"site-name",url:b,text:w||y}),!r&&P&&i.ZP.createElement("p",{className:"site-title"},(0,Fn.Z)(P)),M&&i.ZP.createElement("p",{className:"site-description"},(0,Fn.Z)(M,["emoji","br"]))),!r&&E&&i.ZP.createElement(Ks,{message:t,observeIntersectionForLoading:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,lastSyncTime:d,asForwarded:c,isDownloading:l,isProtected:u,onClick:T?v:void 0,onCancelUpload:p}))}));var mo=n(17921);const ho=(0,i.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:a,isSelected:s,theme:r,forcedWidth:c}=e;const d=(0,i.sO)(null),l=(0,At.Z)(),u=(0,m.eO)(t),{title:h,text:g,amount:p,currency:f,isTest:I,photo:v}=u,w=(0,Yt.Z)((0,m.O9)(v)),b=Boolean(c),y=Vs(t,!b,w);return Na((e=>{let[t]=e;if(n){if(w){const e=d.current.closest(o.be_);$s(w,!1,0,s,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(o.s22,"")}))}}else t&&d.current.closest(o.be_).removeAttribute(o.s22)}),[n,w,a,s,r]),i.ZP.createElement("div",{ref:d,className:"Invoice"},h&&i.ZP.createElement("p",{className:"title"},(0,Fn.Z)(h)),g&&i.ZP.createElement("div",null,(0,Fn.Z)(g,["emoji","br"])),i.ZP.createElement("div",{className:"description "+(v?"has-image":"")},Boolean(v)&&i.ZP.createElement("div",{className:"invoice-image-container"},b&&i.ZP.createElement("canvas",{ref:y,className:"thumbnail blurred-bg"}),w&&i.ZP.createElement("img",{className:"invoice-image",src:w,alt:"",style:c?`width: ${c}px`:void 0,crossOrigin:"anonymous"}),!w&&v&&i.ZP.createElement(mo.Z,{width:c||v.dimensions?.width,height:v.dimensions?.height,forceAspectRatio:!0})),i.ZP.createElement("p",{className:"description-text"},(0,at.x)(p,f,l.code),I&&i.ZP.createElement("span",null,l("PaymentTestInvoice")))))})),go={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},po=(0,i.X$)((e=>{let{message:t,lastSyncTime:n}=e;const{openInvoice:s,loadExtendedMedia:o}=(0,a.Sv)(),r=(0,At.Z)(),c=(0,m.eO)(t),{chatId:d,id:l}=t,u=(0,i.I4)((()=>{o({chatId:d,ids:[l]})}),[d,l,o]);(0,vt.Z)(u,n?3e4:void 0);const{amount:h,currency:g,extendedMedia:p}=c,{width:f,height:I,thumbnail:v,duration:w}=p,b=(0,i.I4)((()=>{s({chatId:d,messageId:l,isExtendedMedia:!0})}),[d,l,s]);return i.ZP.createElement("div",{className:(0,st.Z)(go.root,"media-inner"),onClick:b},i.ZP.createElement(Wn.Z,{thumbDataUri:v?.dataUri,width:f,height:I,isVisible:!0,className:go.spoiler}),Boolean(w)&&i.ZP.createElement("div",{className:go.duration},(0,ce.k9)(w)),i.ZP.createElement("div",{className:go.buy},i.ZP.createElement("i",{className:(0,st.Z)("icon-lock",go.lock)}),r("Checkout.PayPrice",(0,at.x)(h,g))))})),fo=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"})),Io=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],vo=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",wo=1e-4,bo={width:400,height:300,zoom:16,scale:2},yo={__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>'},Po=(0,i.X$)((e=>{let{message:t,peer:n,lastSyncTime:s,isInSelectMode:r,isSelected:c,theme:d}=e;const{openUrl:l}=(0,a.Sv)(),u=(0,i.sO)(null),h=(0,i.sO)(null),g=(0,At.Z)(),p=(0,pt.Z)(),f=(0,m.nf)(t),{type:I,geo:v}=f,b=(0,w.bp)(),y=(0,m.$R)(t,b),P="geoLive"!==I||y?void 0:t.date+f.period-b,[Z,C]=(0,i.eJ)(v),S="venue"===I||"geoLive"===I&&!y,{width:E,height:M,zoom:R,scale:k}=bo,T=Boolean(s)&&(0,m.k6)(Z,E,M,R,k),A=(0,Yt.Z)(T),N=(0,kn.Z)(A),x=A||N,B=n&&(0,m.YC)(n.id),L=n&&B?n:void 0,U=n&&!B?n:void 0,j=(0,m.B4)(t),O=(0,i.Ye)((()=>{if("geoLive"!==I||!Z.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=Z;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,R)}),[I,Z,R]),F=(0,i.I4)((e=>{if("geoLive"!==I)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,o=t.date+f.period-(0,w.bp)(),i=(1-o/f.period)*n,r=(0,ce.mB)(g,1e3*o);a&&s?(s.textContent=r,a.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>`}),[I,t.date,f,g]);return(0,i.bt)((()=>{h.current&&F(h.current)}),[F]),Na((e=>{let[t]=e;if(S)t||u.current.closest(o.be_).removeAttribute(o.s22);else if(x){const e=u.current.closest(o.be_);$s(x,j,0,c,d).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(o.s22,"")}))}}),[S,j,r,c,d,x]),(0,i.d4)((()=>{Math.abs(v.lat-Z.lat)<wo&&Math.abs(v.long-Z.long)<wo?Z.accuracyRadius!==v.accuracyRadius&&C({...Z,accuracyRadius:v.accuracyRadius}):C(v)}),[v,Z]),(0,wt.Z)((()=>{p()}),y?void 0:1e3*(P||0)),(0,vt.Z)((()=>{const e=h.current;e&&F(e)}),P?1e3:void 0),i.ZP.createElement("div",{ref:u,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`}(Z.lat,Z.long,R);l({url:e})}},i.ZP.createElement("div",{className:"map-wrapper"},x?i.ZP.createElement("img",{className:"full-media map",src:x,alt:"Location on a map",style:`width: ${bo.width}px; height: ${bo.height}px;`}):i.ZP.createElement(mo.Z,{width:E,height:M}),function(){if(x)return i.ZP.createElement(i.ZP.Fragment,null,Boolean(O)&&!y&&i.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*O}px; height: ${2*O}px`}),function(){const e=(0,st.Z)("pin",I,y&&"expired");if("geoLive"===I)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:yo},i.ZP.createElement(vs.Z,{chat:U,user:L,className:"location-avatar"}),void 0!==f.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===I){const t=function(e){return e?fo.get(e)||fo.get(e.split("/")[0])||Io[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Io.length)]:"#008df2";var t}(f.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(f.venueType);return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:yo,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:vo,alt:""})}())}()),function(){if(S)return"venue"===I?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},f.title),i.ZP.createElement("div",{className:"location-info-subtitle"},f.address)):"geoLive"===I?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},g("AttachLiveLocation")),i.ZP.createElement("div",{className:"location-info-subtitle"},(0,ce.dJ)(g,b,t.editDate)),!y&&i.ZP.createElement("div",{className:"geo-countdown",ref:h})):void 0}())})),Zo=(0,i.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:s}=e;const{clickBotInlineButton:o}=(0,a.Sv)(),r=t.content.game,{title:c,description:d}=r,l=Boolean(s)&&(0,m.N)(r),u=Boolean(s)&&(0,m.Wc)(r),h=(0,Yt.Z)(l,!n),g=(0,Yt.Z)(u,!n);return i.ZP.createElement("div",{className:"Game"},i.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{o({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&i.ZP.createElement(mo.Z,{className:"skeleton preview-content"}),h&&i.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&i.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:g})),i.ZP.createElement("div",{className:"title"},c),!(0,m.UD)(t)&&i.ZP.createElement("div",{className:"description"},d))}));function Co(e){return(0,i.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,l.CA)(e),isSelected:(0,l.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:o,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),d=(0,i.I4)((e=>{e.stopPropagation(),c({messageId:o.id,withShift:e?.shiftKey})}),[c,o]),l=(0,i.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:n,isSelected:s,dimensions:{...e,x:0,y:0},onClick:n?void 0:a}}),[t,n,s]);return i.ZP.createElement("div",{className:(0,st.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&i.ZP.createElement("div",{className:"message-select-control"},s&&i.ZP.createElement("i",{className:"icon-select"})),i.ZP.createElement(e,l))})))}const So=Co(Xs),Eo=Co(Ks),Mo=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,l.Pu)(e),o=(0,l.xs)(e,a);return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,lastSyncTime:o,isOwn:r,isProtected:c,albumLayout:d,onMediaClick:u,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,a.Sv)(),I=t.messages.length,v=(0,i.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:w,height:b}=d.containerStyle;return i.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${b}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,m.qp)(e),b=h[(0,m.KK)(e)],y=b?.progress,{dimensions:P,sides:Z}=d.layout[t],C=(0,l.bH)((0,a.Rd)(),e),S=(0,l.__)((0,a.Rd)(),e);if(f){const a=s&&(r?t===I-1:Boolean(Z&Ha.Left&&Z&Ha.Bottom));return i.ZP.createElement(So,{id:`album-media-${(0,m.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,shouldAffectAppendix:a,uploadProgress:y,dimensions:P,isProtected:c,onClick:u,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})}if(w)return i.ZP.createElement(Eo,{id:`album-media-${(0,m.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,canAutoPlay:S,uploadProgress:y,lastSyncTime:o,dimensions:P,isProtected:c,onClick:u,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})})))}));let Ro;const ko=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,lastSyncTime:o,isDownloading:r}=e;const d=(0,i.sO)(null),l=(0,i.sO)(null),u=(0,i.sO)(null),h=t.content.video,g=(0,Ba.Op)(d,n),[p,f]=(0,i.eJ)(s),I=Boolean(p&&g&&o),{mediaData:v,loadProgress:w}=(0,Hs.Z)((0,m.Ti)(t,"inline"),!I,(0,m.kG)(t,"inline"),o),{loadProgress:b}=(0,Hs.Z)((0,m.Ti)(t,"download"),!r,c.IU.BlobUrl,o),[y,P]=(0,Rt.Z)(),Z=!Boolean((0,m.DH)(t))||y,C=Vs(t,Z),S=(0,zs.Z)(!Z),E=p&&!y||r,M=!1===(0,kn.Z)(p),{shouldRender:R,transitionClassNames:k}=(0,ft.Z)(E,void 0,M),[T,A]=(0,i.eJ)(!1),[N,B]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!T)return;const e=Ae.Rj/2,t=2*(e-6)*Math.PI,n=t-N*t,a=u.current,s=l.current,o=s.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${Ae.Rj}px" height="${Ae.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(a.currentTime/a.duration)}),[T,N]);const L=Boolean(v&&g),U=(0,i.I4)((()=>{u.current&&(A(!1),B(0),(0,xs.Z)(u.current),(0,x.T2)((()=>{l.current.innerHTML=""})))}),[]),j=(0,i.I4)((()=>{Ro?.(),Ro=U}),[U]),O=(0,i.I4)((()=>{if(!v)return void f((e=>!e));if(r)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=u.current;T?e.paused?((0,xs.Z)(e),(0,Qn.Es)()):e.pause():(j(),e.pause(),e.currentTime=0,(0,xs.Z)(e),(0,Qn.Es)(),A(!0))}),[j,T,r,v,t]),F=(0,i.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]);return i.ZP.createElement("div",{ref:d,className:"RoundVideo media-inner",onClick:O},v&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement(Ys.Z,{canPlay:L,ref:u,src:v,className:"full-media",width:Ae.Rj,height:Ae.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!T,loop:!T,playsInline:!0,onEnded:T?U:void 0,onTimeUpdate:T?F:void 0,onReady:P})),i.ZP.createElement("canvas",{ref:C,className:(0,st.Z)("thumbnail",S),style:`width: ${Ae.Rj}px; height: ${Ae.Rj}px`}),i.ZP.createElement("div",{className:"progress",ref:l}),R&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(Ws.Z,{progress:r?b:w})),!v&&!p&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},T?(0,ce.k9)(u.current.currentTime):(0,ce.k9)(h.duration),(!T||u.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},To=e=>{let{message:t,onClick:n}=e;const a=(0,At.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Dt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},i.ZP.createElement("span",{className:"inline-button-text"},(0,Fn.Z)(a(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!o.FSu.test(e.url))return i.ZP.createElement("i",{className:"icon-arrow-right"});break;case"urlAuth":return i.ZP.createElement("i",{className:"icon-arrow-right"});case"buy":case"receipt":return i.ZP.createElement("i",{className:"icon-cart"});case"switchBotInline":return i.ZP.createElement("i",{className:"icon-share-filled"});case"webView":case"simpleWebView":return i.ZP.createElement("i",{className:"icon-webapp"})}})(e))))))))},Ao=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openComments:s}=(0,a.Sv)(),o=(0,At.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:h,originChannelId:g}=t,p=(0,i.I4)((()=>{s({id:c,threadId:r,originChannelId:g})}),[s,c,r,g]),f=(0,i.Ye)((()=>{if(!h?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return h.map((n=>(0,m.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===d)return;const I=Boolean(u&&l&&u<l),v=d?o("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?i.ZP.createElement(Xn.Z,{text:(0,Pt.bi)(d)}):e)):void 0;return i.ZP.createElement("div",{"data-cnt":(0,Pt.bi)(d),className:(0,st.Z)("CommentButton",I&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:p},i.ZP.createElement("i",{className:"icon-comments-sticker"}),(!f||0===f.length)&&i.ZP.createElement("i",{className:"icon-comments"}),f&&f.length>0&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},f.map((e=>i.ZP.createElement(vs.Z,{key:e.id,size:"small",user:(0,m.YC)(e.id)?e:void 0,chat:(0,m.YC)(e.id)?void 0:e})))),i.ZP.createElement("div",{className:"label",dir:"auto"},d?v:o("LeaveAComment")),i.ZP.createElement("i",{className:"icon-next"}))}));var No=n(78046),xo=n(48198);const Bo={root:"JY0NZH9bysPBqR3sIbLu","is-custom-emoji":"T1R9OVCwcfQHR4vN8cx_",isCustomEmoji:"T1R9OVCwcfQHR4vN8cx_","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},Lo=2.5*Ae.Gw,Uo=6.5*Ae.Gw,jo=(0,i.X$)((e=>{let{reaction:t,genericEffects:n,activeReactions:s,availableReactions:o,observeIntersection:r}=e;const{stopActiveReaction:c}=(0,a.Sv)(),d=(0,i.sO)(null),l="documentId"in t,u=(0,i.Ye)((()=>o?.find((e=>(0,m.Hl)(e.reaction,t)))),[o,t]),h=u?.centerIcon?.id,g=(0,No.Z)(l?t.documentId:void 0),p=(0,i.Ye)((()=>{if(!l)return u?.aroundAnimation?.id;if(!g)return;const e=o?.find((e=>e.reaction.emoticon===g.emoji))?.aroundAnimation?.id;return e}),[u,o,g,l]),f=(0,i.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,Ba.Op)(d,r),v=h&&`sticker${h}`,w=f&&`sticker${f}`,b=(0,Yt.Z)(v,!h),y=(0,Yt.Z)(w,!f),P=(0,i.Ye)((()=>s?.find((e=>(0,m.Hl)(e.reaction,t)))),[s,t]),Z=Boolean(P&&(l||b)&&y),{shouldRender:C,transitionClassNames:S}=(0,ft.Z)(Z,void 0,!0,"slow"),E=(0,i.I4)((()=>{P?.messageId&&c({messageId:P.messageId,reaction:t})}),[P?.messageId,t,c]),[M,R,k]=(0,Rt.Z)(),T=!(l||Z&&M),A=(0,st.Z)(Bo.root,C&&Bo.animating,l&&Bo.isCustomEmoji);return i.ZP.createElement("div",{className:A,ref:d},T&&i.ZP.createElement(xo.Z,{reaction:t,availableReactions:o}),l&&i.ZP.createElement(Wt.Z,{documentId:t.documentId,className:Bo.customEmoji,observeIntersectionForPlaying:r}),C&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(As.Z,{key:f,className:(0,st.Z)(Bo.effect,S),size:Uo,tgsUrl:y,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:E}),l?!p&&I&&i.ZP.createElement(Jt,{reaction:t}):i.ZP.createElement(As.Z,{key:h,className:(0,st.Z)(Bo.animatedIcon,S),size:Lo,tgsUrl:b,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:R,onEnded:k})))})),Oo=(0,i.X$)((e=>{let{reaction:t,message:n,activeReactions:s,availableReactions:o,withRecentReactors:r,genericEffects:c,observeIntersection:d}=e;const{toggleReaction:l}=(0,a.Sv)(),{recentReactions:u}=n.reactions,h=(0,i.Ye)((()=>{if(!r||!u)return;const e=(0,a.Rd)().users.byId;return u.filter((e=>(0,m.Hl)(e.reaction,t.reaction))).map((t=>e[t.userId])).filter(Boolean)}),[t.reaction,u,r]),g=(0,i.I4)((()=>{l({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,l]);return i.ZP.createElement(Dt.Z,{className:(0,st.Z)((0,m.Bt)(t)&&"chosen"),size:"tiny",onClick:g},i.ZP.createElement(jo,{activeReactions:s,reaction:t.reaction,availableReactions:o,genericEffects:c,observeIntersection:d}),h?.length?i.ZP.createElement("div",{className:"avatars"},h.map((e=>i.ZP.createElement(vs.Z,{user:e,size:"micro"})))):i.ZP.createElement(Xn.Z,{text:(0,Pt.bi)(t.count),className:"counter"}))})),Fo=(0,i.X$)((e=>{let{message:t,isOutside:n,maxWidth:a,activeReactions:s,availableReactions:o,metaChildren:r,genericEffects:c,observeIntersection:d,noRecentReactors:l}=e;const u=(0,At.Z)(),h=(0,i.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return i.ZP.createElement("div",{className:(0,st.Z)("Reactions",n&&"is-outside"),style:a?`max-width: ${a}px`:void 0,dir:u.isRtl?"rtl":"ltr"},t.reactions.results.map((e=>i.ZP.createElement(Oo,{key:(0,m.$d)(e.reaction),reaction:e,message:t,activeReactions:s,availableReactions:o,withRecentReactors:h<=3&&!l,genericEffects:c,observeIntersection:d}))),r)})),_o=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:o}=e;const{requestMasterAndRequestCall:r}=(0,a.Sv)(),c=(0,At.Z)(),{isOutgoing:d,isVideo:l,reason:u}=t,m="missed"===u,h="busy"===u&&!d,g=(0,i.I4)((()=>{r({isVideo:l,userId:o})}),[o,l,r]),p=(0,i.Ye)((()=>l?h?"CallMessageVideoIncomingDeclined":m?d?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":d?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":h?"CallMessageIncomingDeclined":m?d?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":d?"CallMessageOutgoing":"CallMessageIncoming"),[h,m,d,l]),f=(0,i.Ye)((()=>t.duration?(0,ce.J_)(c,t.duration):void 0),[c,t.duration]),I=(0,ce.mr)(c,1e3*n.date);return i.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},i.ZP.createElement(Dt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!s.Bi,ariaLabel:c(d?"CallAgain":"CallBack")},i.ZP.createElement("i",{className:l?"icon-video-outlined":"icon-phone"})),i.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},i.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},c(p)),i.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},i.ZP.createElement("i",{className:(0,st.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",m&&"V5tKkKZpcY5yq_f5nO8l",!d&&"e0Vhbj8gfzQn1zJQoFLK")}),i.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?c("CallMessageWithDuration",[I,f]):I))))}));var Do=n(78780),qo=n(50685),$o=n(14612),Ho=n(98138),Go=n(2995);var Vo=n(69123);const zo=1.125*Ae.Gw,Wo=(0,i.X$)((e=>{let{topic:t,className:n,onClick:a}=e;const s=(0,At.Z)();return i.ZP.createElement("div",{className:(0,st.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,Ho.gZ)(t?.iconColor)})`,onClick:a},t?i.ZP.createElement(Go.Z,{topic:t,size:zo}):i.ZP.createElement("img",{src:Vo,alt:""}),t?.title?(0,Fn.Z)(t.title):s("Loading"),t?.isClosed&&i.ZP.createElement("i",{className:"icon-lock"}),i.ZP.createElement("i",{className:"icon-next"}))})),Xo={__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>'},Yo={__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>'},Ko=1.75*Ae.Gw,Jo=2.25*Ae.Gw,Qo=(0,i.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,activeReactions:s,activeEmojiInteractions:i}=(0,l.jU)(e),{lastSyncTime:r}=e,{message:d,album:u,withSenderName:h,withAvatar:g,threadId:p,messageListType:f,isLastInDocumentGroup:I,isFirstInGroup:v}=t,{id:w,chatId:b,viaBotId:y,replyToChatId:P,replyToMessageId:Z,isOutgoing:C,repliesThreadInfo:S,forwardInfo:E,transcriptionId:M,isPinned:R}=d,k=(0,l.Z1)(e,b),T=(0,l.FM)(e,b),A=(0,m.pK)(b),N=k&&(0,m.eA)(k),x=k&&(0,m.Bf)(k),B=k?.usernames,L=a.messageIds&&a.messageIds.includes(w),U=!T&&(0,m.Ul)(d),j=h||g||U,O=(0,l.Ur)(e,d),F=(0,l.cv)(e,d),_=y?(0,l.dy)(e,y):void 0,D=O?.id&&x?k.fullInfo?.adminMembersById?.[O?.id]:void 0,q=p?(0,l.qS)(e,b,p):void 0,$=d.id===q,H=Z===q,G=Z&&!H?(0,l.hj)(e,A&&P?P:b,Z):void 0,V=G&&(0,l.Bz)(e,G,Boolean(E)),z="topicCreate"===G?.content.action?.type,W=(0,l.uZ)(e,d),X="thread"===f&&(u?u.messages.some((t=>(0,l._X)(e,t,p))):(0,l._X)(e,d,p)),{direction:Y,noHighlight:K,isResizingContainer:J}=X&&n||{},{query:Q}=(0,l.n5)(e)||{},ee=(0,m.h_)(d),te=ee&&(0,l.zB)(e,ee)?ee:void 0,ne=(0,m.HW)(d);let ae;ae=u?.messages?u.messages.every((t=>{let{id:n}=t;return(0,l.vk)(e,n)})):(0,l.vk)(e,w);const{canReply:se}="thread"===f&&(0,l._k)(e,d,p)||{},oe=(0,l.te)(e,d),ie=S?(0,l.tZ)(e,S.chatId,S.threadId)||S:void 0,re=Boolean(d.groupedId)&&!d.isInAlbum,ce=re?(0,l.xH)(e,b,d.groupedId)[0]:void 0,de=re?I?(0,l.hj)(e,b,ce):void 0:d,le=k?.unreadReactions?.includes(d.id),ue=p===c._f&&k?.isForum&&v,me=ue?(0,l.p$)(e,d)||k?.topics?.[o.OxA]:void 0,he=Boolean((0,m.nf)(d)),ge=(0,l.xf)(e,b),pe=(0,l.xx)(e,b,d.id);return{theme:(0,l.Pu)(e),chatUsernames:B,forceSenderName:U,canShowSender:j,originSender:F,botSender:_,shouldHideReply:H||z,isThreadTop:$,replyMessage:G,replyMessageSender:V,isInDocumentGroup:re,isProtected:(0,l.EV)(e,d),isChatProtected:(0,l.Am)(e,b),isFocused:X,isForwarding:L,reactionMessage:de,isChatWithSelf:T,isRepliesChat:A,isChannel:N,isGroup:x,canReply:se,lastSyncTime:r,highlight:Q,animatedEmoji:te,animatedCustomEmoji:ne,isInSelectMode:(0,l.CA)(e),isSelected:ae,isGroupSelected:Boolean(d.groupedId)&&!d.isInAlbum&&(0,l.a6)(e,b,d.groupedId),threadId:p,isDownloading:oe,isPinnedList:"pinned"===f,isPinned:R,canAutoLoadMedia:(0,l.bH)(e,d),canAutoPlayMedia:(0,l.__)(e,d),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,l.Cy)(e),repliesThreadInfo:ie,availableReactions:e.availableReactions,defaultReaction:(0,m.CI)(d)?void 0:(0,l.q6)(e,b),activeReactions:de&&s[de.id],activeEmojiInteractions:i,hasUnreadReaction:le,isTranscribing:void 0!==M&&e.transcriptions[M]?.isPending,transcribedText:void 0!==M?e.transcriptions[M]?.text:void 0,isPremium:(0,l.wV)(e),animationLevel:e.settings.byKey.animationLevel,senderAdminMember:D,messageTopic:me,genericEffects:e.genericEmojiEffects,hasTopicChip:ue,chatTranslations:ge,areTranslationsEnabled:e.settings.byKey.canTranslate,requestedTranslationLanguage:pe,hasLinkedChat:Boolean(k?.fullInfo?.linkedChatId),...(j||he)&&{sender:O},...C&&{outgoingStatus:(0,l.dT)(e,d,"scheduled"===f)},..."number"==typeof W&&{uploadProgress:W},...X&&{focusDirection:Y,noFocusHighlight:K,isResizingContainer:J,viewportIds:(0,l.$W)(e,b,p,f)}}}))((e=>{let{message:t,chatUsernames:n,observeIntersectionForBottom:r,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,album:u,noAvatars:h,withAvatar:g,withSenderName:p,noComments:f,noReplies:v,appearanceOrder:b,isFirstInGroup:y,isPremium:P,isLastInGroup:Z,isFirstInDocumentGroup:C,isLastInDocumentGroup:E,isTranscribing:M,transcribedText:R,isLastInList:k,theme:T,forceSenderName:A,sender:N,canShowSender:x,originSender:B,botSender:L,isThreadTop:U,shouldHideReply:j,replyMessage:O,replyMessageSender:F,outgoingStatus:_,uploadProgress:D,isInDocumentGroup:q,isProtected:$,isChatProtected:H,isFocused:G,focusDirection:V,noFocusHighlight:z,isResizingContainer:W,viewportIds:X,isForwarding:Y,isChatWithSelf:K,isRepliesChat:J,isChannel:Q,isGroup:ee,canReply:te,lastSyncTime:ne,highlight:ae,animatedEmoji:se,animatedCustomEmoji:oe,genericEffects:ie,hasLinkedChat:re,isInSelectMode:ce,isSelected:de,isGroupSelected:le,threadId:ue,reactionMessage:me,availableReactions:he,defaultReaction:ge,activeReactions:pe,activeEmojiInteractions:fe,messageListType:Ie,isPinnedList:ve,isPinned:we,isDownloading:be,canAutoLoadMedia:ye,canAutoPlayMedia:Pe,shouldLoopStickers:Ze,autoLoadFileMaxSizeMb:Ce,repliesThreadInfo:Se,hasUnreadReaction:Ee,memoFirstUnreadIdRef:Me,animationLevel:Re,senderAdminMember:ke,messageTopic:Te,hasTopicChip:Ne,chatTranslations:xe,areTranslationsEnabled:Be,requestedTranslationLanguage:Le,onPinnedIntersectionChange:Ue}=e;const{toggleMessageSelection:je,clickBotInlineButton:Oe,disableContextMenuHint:Fe,animateUnreadReaction:_e,focusLastMessage:De}=(0,a.Sv)(),qe=(0,i.sO)(null),$e=(0,i.sO)(null),He=(0,i.sO)(null),Ge=(0,i.sO)(0),Ve=(0,At.Z)(),[ze,We]=(0,i.eJ)(!1),[Xe,Ye,Ke]=(0,Rt.Z)(),{isMobile:Je}=(0,S.ZP)();(0,Ba._N)($e,r);const{isContextMenuOpen:Qe,contextMenuPosition:et,handleBeforeContextMenu:tt,handleContextMenu:nt,handleContextMenuClose:at,handleContextMenuHide:ot}=(0,ua.Z)(qe,s.$b&&ce,!0,s.wZ);(0,i.d4)((()=>{Qe&&Fe()}),[Qe,Fe]);const it=b<=0,[rt,ct]=(0,Rt.Z)(it);(0,i.d4)((()=>{it||setTimeout(ct,10*b)}),[b,ct,it]);const{transitionClassNames:dt}=(0,ft.Z)(rt,void 0,it,!1),{id:lt,chatId:mt,forwardInfo:ht,viaBotId:gt,isTranscriptionError:pt}=t;(0,i.d4)((()=>{if(!we)return;const e=u?u.mainMessage.id:lt;return()=>{Ue({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[u,we,lt,Ue]);const It=(0,m.CI)(t),vt=(0,m.B4)(t),wt="scheduled"===Ie||t.isScheduled,bt=(0,m.ss)(t)&&!j,yt=Boolean(Se)&&"thread"===Ie,Pt=(0,m.$D)(t),Zt=Pt&&(se||oe),Ct=me?.reactions&&!(0,m.JE)(me.reactions),St=ht&&(!K||wt)&&!J&&!ht.isLinkedChannelPost&&!Pt,Et=Boolean(u)&&u.messages.length>1&&!u?.messages.some((e=>0===Object.keys(e.content).length)),Mt=q&&!C,kt=q&&!E,Tt=void 0!==et,Nt=!(Tt||ce||Y||kt),xt=Q&&!wt&&t.isForwardingAllowed&&!H,Bt=Boolean(ve||ht&&(ht.isChannelPost||K&&!vt||J)&&ht.fromMessageId),Lt=Ne||bt,Ut=(0,i.I4)(((e,t)=>{je({messageId:lt,groupedId:t,...e?.shiftKey&&{withShift:!0},...Et&&{childMessageIds:u.messages.map((e=>{let{id:t}=e;return t}))}})}),[je,lt,Et,u]),jt=x?N:void 0,Ot=Boolean(!ze&&(pt||R)),Ft=ht&&(K||J||!jt)?B:jt,_t=ht?B:jt,{handleMouseDown:qt,handleClick:$t,handleContextMenu:Ht,handleDoubleClick:Gt,handleContentDoubleClick:Vt,handleMouseMove:zt,handleSendQuickReaction:Yt,handleMouseLeave:Kt,isSwiped:Jt,isQuickReactionVisible:Qt,handleDocumentGroupMouseEnter:en}=ds(Ut,qe,lt,0,Boolean(ce),Boolean(te),Boolean($),nt,tt,mt,Tt,He,0,kt),{handleAvatarClick:tn,handleSenderClick:nn,handleViaBotClick:an,handleReplyClick:sn,handleMediaClick:on,handleAudioPlay:rn,handleAlbumMediaClick:cn,handleMetaClick:dn,handleTranslationClick:ln,handleOpenThread:un,handleReadMedia:mn,handleCancelUpload:hn,handleVoteSend:gn,handleGroupForward:pn,handleForward:fn,handleFocus:In,handleFocusForwarded:vn,handleDocumentGroupSelectAll:wn,handleTopicChipClick:bn}=function(e,t,n,s,o,r,d,l,u,m,h,g,p,f){const{openChat:v,showNotification:w,focusMessage:b,openMediaViewer:y,openAudioPlayer:P,markMessagesRead:Z,cancelSendingMessage:C,sendPollVote:S,openForwardMenu:E,focusMessageInComments:M,openMessageLanguageModal:R}=(0,a.Sv)(),{id:k,forwardInfo:T,replyToMessageId:A,replyToChatId:N,replyToTopMessageId:x,groupedId:B}=n,L=(0,i.I4)((()=>{h&&v({id:h.id})}),[h,v]),U=(0,i.I4)((()=>{g?d&&T?.channelPostId?b({chatId:g.id,messageId:T.channelPostId}):v({id:g.id}):w({message:e("HidAccount")})}),[d,b,T,e,v,g,w]),j=(0,i.I4)((()=>{p&&v({id:p.id})}),[p,v]),O=(0,i.I4)((()=>{b({chatId:u&&N?N:s,threadId:o,messageId:A,replyMessageId:u&&N?void 0:k,noForumTopicPanel:!0})}),[b,u,N,s,o,A,k]),F=(0,i.I4)((()=>{y({chatId:s,threadId:o,mediaId:k,origin:l?I.bZ.ScheduledInline:I.bZ.Inline})}),[s,o,k,y,l]),_=(0,i.I4)((()=>{P({chatId:s,messageId:k})}),[s,k,P]),D=(0,i.I4)((e=>{y({chatId:s,threadId:o,mediaId:e,origin:l?I.bZ.ScheduledAlbum:I.bZ.Album})}),[s,o,y,l]),q=(0,i.I4)((()=>{Z({messageIds:[k]})}),[k,Z]),$=(0,i.I4)((()=>{C({chatId:s,messageId:k})}),[C,s,k]),H=(0,i.I4)((e=>{S({chatId:s,messageId:k,options:e})}),[s,k,S]),G=(0,i.I4)((()=>{E({fromChatId:s,groupedId:B})}),[E,s,B]),V=(0,i.I4)((()=>{if(m&&m.messages){const e=m.messages.map((e=>{let{id:t}=e;return t}));E({fromChatId:s,messageIds:e})}else E({fromChatId:s,messageIds:[k]})}),[m,E,s,k]),z=(0,i.I4)((()=>{b({chatId:s,threadId:c._f,messageId:k})}),[b,s,k]),W=(0,i.I4)((()=>{r?b({chatId:T.fromChatId,groupedId:B,groupedChatId:s,messageId:T.fromMessageId}):u&&N?M({chatId:N,threadId:x,messageId:T.fromMessageId}):b({chatId:T.fromChatId,messageId:T.fromMessageId})}),[r,u,N,b,T,B,s,M,x]),X=(0,i.I4)((e=>{e.stopPropagation(),t(e,B)}),[t,B]);return{handleAvatarClick:L,handleSenderClick:U,handleViaBotClick:j,handleReplyClick:O,handleMediaClick:F,handleAudioPlay:_,handleAlbumMediaClick:D,handleMetaClick:X,handleTranslationClick:(0,i.I4)((e=>{e.stopPropagation(),R({chatId:s,id:k})}),[s,k,R]),handleOpenThread:(0,i.I4)((()=>{v({id:n.chatId,threadId:n.id})}),[n.chatId,n.id,v]),handleReadMedia:q,handleCancelUpload:$,handleVoteSend:H,handleGroupForward:G,handleForward:V,handleFocus:z,handleFocusForwarded:W,handleDocumentGroupSelectAll:X,handleTopicChipClick:(0,i.I4)((()=>{f&&b({chatId:u&&N?N:s,threadId:f.id,messageId:k})}),[s,b,u,f,k,N])}}(Ve,Ut,t,mt,ue,q,St,wt,J,u,Ft,_t,L,Te);(0,i.d4)((()=>{k&&Ot&&R&&De()}),[De,k,R,Ot]);const yn=(0,st.Z)("Message message-list-item",y&&"first-in-group",$&&"is-protected",Z&&"last-in-group",C&&"first-in-document-group",E&&"last-in-document-group",k&&"last-in-list",vt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",bt&&"has-reply",Tt&&"has-menu-open",G&&!z&&"focused",Y&&"is-forwarding",t.isDeleting&&"is-deleting",q&&"is-in-document-group",Et&&"is-album",t.hasUnreadMention&&"has-unread-mention",de&&"is-selected",ce&&"is-in-selection-mode",U&&!g&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Jt&&"is-swiped",dt,(Boolean(pe)||Xe)&&"has-active-reaction"),{text:Pn,photo:Zn,video:Cn,audio:Sn,voice:En,document:Mn,sticker:Rn,contact:Tn,poll:An,webPage:Nn,invoice:Bn,location:Ln,action:Un,game:jn}=(0,m.qp)(t),On=function(e){const[t,n]=(0,i.eJ)();return(0,ut.Z)((()=>{e&&async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ps;return fs||await Is.promise,await fs.request({name:"detectLanguage",args:[e,t]})}(e).then(n)}),[e]),t}(Be?Pn?.text:void 0),{isPending:_n,translatedText:Dn}=function(e,t,n,s){const{translateMessages:o}=(0,a.Sv)(),r=s?e?.byLangCode[s]?.[n]:void 0,{isPending:c,text:d}=r||{};return(0,i.d4)((()=>{d||c||!s||o({chatId:t,messageIds:[n],toLanguageCode:s})}),[t,d,c,n,s,o]),{isPending:c,translatedText:d}}(xe,mt,lt,Le),qn=(0,kn.Z)(Dn,!0),$n=_n?qn||Pn:Dn,Hn=Dn||qn,{phoneCall:Gn}=Un||{},Vn=(Se||re&&Q&&It)&&!kt&&"thread"===Ie&&!f,zn=Se&&!kt&&"thread"===Ie&&!f,Wn=!s.$b&&!Gn&&!ce&&ge&&!kt,Xn=function(e){let{hasSubheader:t,isCustomShape:n,isLastInGroup:a,asForwarded:s,hasThread:i,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:u,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:b,webPage:y,contact:P,location:Z,invoice:C}=(0,m.qp)(e),S=[o.gnl],E=p||f||Z||C?.extendedMedia,M=g||"venue"===Z?.type||u,R=E&&!M,k=Boolean(e.viaBotId);return!E&&e.emojiOnlyCount?(S.push("emoji-only"),e.emojiOnlyCount<=o.L5X&&S.push(`emoji-only-${e.emojiOnlyCount}`)):M&&S.push("text"),d&&S.push("has-action-button"),n&&(S.push("custom-shape"),f?.isRound&&S.push("round"),c&&S.push("has-comments")),E?S.push("media"):I?S.push("audio"):v?(S.push("voice"),h&&S.push("with-voice-transcription")):w?S.push("document"):P?S.push("contact"):b?S.push("poll"):y&&(S.push("web-page"),(y.photo||y.video)&&S.push("media")),C&&!C.extendedMedia&&S.push("invoice"),s&&S.push("is-forwarded"),t&&S.push("has-subheader"),i&&S.push("has-replies"),l&&S.push("has-reactions"),k&&S.push("is-via-bot"),r&&S.push("force-sender-name"),n||(S.push("has-shadow"),E&&c&&S.push("has-background"),(t||s||k||!R||r)&&S.push("has-solid-background"),a&&(p||Z&&!M||!R)&&S.push("has-appendix")),S.join(" ")}(t,{hasSubheader:Lt,isCustomShape:Pt,isLastInGroup:Z,asForwarded:St,hasThread:yt&&!f,forceSenderName:A,hasComments:Se&&Se.messagesCount>0,hasActionButton:xt||Bt,hasReactions:Ct,isGeoLiveActive:"geoLive"===Ln?.type&&!(0,m.$R)(t,(0,w.bp)()),withVoiceTranscription:Ot}),Yn=Xn.includes("has-appendix"),Kn=(0,m.fY)(t),Jn=(0,Ja.qo)(t.emojiOnlyCount);let Qn,ea;Qn=Gn||kt?"none":!Kn||Nn||Zt?"standalone":"in-text",Ct?Pt||(Zn||Cn)&&!Kn?ea="outside":St?(Qn="standalone",ea="inside"):ea="inside":ea="none";const ta=Pt?"in-meta":"in-content";(0,xn.Z)(J&&t.replyToChatId?t.replyToChatId:mt,bt?t.replyToMessageId:void 0,O,t.id),ts(qe,lt,mt,G,V,z,X,W);const na=Z,aa=(0,i.I4)((e=>{const t=Ge.current,n=e.target.clientHeight;if(Ge.current=n,(0,Sa.N)()||!t||n<=t)return;const a=e.target.closest(".MessageList");if(!a)return;const s=n-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=a;Math.round(i-r-o)-s<=5&&De()}),[De]),sa=(0,ms.Z)(aa,[aa],300,!1);(0,xa.Z)(na?qe:void 0,sa),(0,i.d4)((()=>{const e=$e.current;Ee&&e&&(0,Ka.P)(e)&&_e({messageIds:[lt]})}),[Ee,lt,_e]);let oa,ia,ra,ca="",da=!1;const la=(0,i.Ye)((()=>Et?za(vt,Boolean(St),Boolean(h),u,Je):void 0),[Et,vt,St,h,u,Je]),ma=St?28:0;if(!Et&&(Zn||Cn||Bn?.extendedMedia)){let e;if(Zn)e=$a(t,St,h,Je).width;else if(Cn)e=Cn.isRound?Ae.Rj:$a(t,St,h,Je).width;else if(Bn?.extendedMedia&&Bn.extendedMedia.width&&Bn.extendedMedia.height){const{width:t,height:n}=Bn.extendedMedia;e=(0,Ae.Kf)({width:t,height:n,fromOwnMessage:vt,asForwarded:St,noAvatars:h,isMobile:Je}).width}e&&(e<(Vn?Ua:ja)&&(ra=e),oa=Math.max(qa(Boolean($n),Vn),e),Bn?.extendedMedia&&oa-e>18&&(da=!0))}else la&&(oa=Math.max(qa(Boolean($n),Vn),la.containerStyle.width),oa-la.containerStyle.width>18&&(da=!0));if(oa)ca=`width: ${oa+ma}px`,ia=oa+Jo;else if(Rn&&!Lt){const{width:e}=(0,Ae.Wr)(Rn,Je);ca=`width: ${e+ma}px`,ia=e+Jo}const ha=Q&&t.postAuthorTitle||!St&&ht?.postAuthorTitle||void 0,ga=(0,i.Ye)((()=>ha?Ya(ha):void 0),[ha]);function pa(e){return i.ZP.createElement($o.Z,{message:t,translatedText:Le?Hn:void 0,isForAnimation:e,emojiSize:Jn,highlight:ae,isProtected:$,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,withTranslucentThumbs:Pt})}function fa(){if(ge)return i.ZP.createElement("div",{className:(0,st.Z)("quick-reaction",Qt&&!pe&&"visible"),onClick:Yt,ref:He},i.ZP.createElement(xo.Z,{reaction:ge,size:Ko,availableReactions:he,observeIntersection:l}))}function Ia(){const e=i.ZP.createElement(ks,{message:t,isPinned:we,noReplies:v,repliesThreadInfo:Se,outgoingStatus:_,signature:ha,withReactionOffset:"inside"===ea,renderQuickReactionButton:Wn&&"in-meta"===ta?fa:void 0,availableReactions:he,isTranslated:Boolean(Le?Hn:void 0),onClick:dn,onTranslationClick:ln,onOpenThread:un});return"inside"!==ea?e:i.ZP.createElement(Fo,{activeReactions:pe,message:me,metaChildren:e,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:Q})}const va=ee&&St?t.postAuthorTitle:void 0,wa=(0,i.Ye)((()=>n?.find((e=>e.isActive))),[n]);return i.ZP.createElement("div",{ref:qe,id:(0,m.d0)(t.id),className:yn,style:ga?`--meta-safe-author-width: ${ga}px`:void 0,"data-message-id":lt,onMouseDown:qt,onClick:$t,onContextMenu:Ht,onDoubleClick:Gt,onMouseEnter:kt?en:void 0,onMouseMove:Wn?zt:void 0,onMouseLeave:Wn||kt?Kt:void 0},i.ZP.createElement("div",{ref:$e,className:"bottom-marker","data-message-id":lt,"data-last-message-id":u?u.messages[u.messages.length-1].id:void 0,"data-album-main-id":u?u.mainMessage.id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ee||void 0,"data-is-pinned":we||void 0}),!q&&i.ZP.createElement("div",{className:"message-select-control"},de&&i.ZP.createElement("i",{className:"icon-select"})),E&&i.ZP.createElement("div",{className:(0,st.Z)("message-select-control group-select",le&&"is-selected"),onClick:wn},le&&i.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=Ft&&(0,m.YC)(Ft.id),t=Ft&&e?Ft:void 0,n=Ft&&!e?Ft:void 0,a=!Ft&&ht?ht.hiddenUserName:void 0;return i.ZP.createElement(vs.Z,{size:Je?"small-mobile":"small",user:t,chat:n,text:a,lastSyncTime:ne,onClick:t||n?tn:void 0,observeIntersection:d,animationLevel:Re,withVideo:!0})}(),i.ZP.createElement("div",{className:(0,st.Z)("message-content-wrapper",Xn.includes("text")&&"can-select-text")},i.ZP.createElement("div",{className:Xn,style:ca,dir:"auto"},St&&!Mt&&i.ZP.createElement("div",{className:"message-title"},Ve("ForwardedMessage"),va&&i.ZP.createElement("span",{className:"admin-title",dir:"auto"},va)),function(){const e=(0,st.Z)("content-inner",St&&"forwarded-message",Lt&&"with-subheader",da&&"no-media-corners"),n=Z&&!Kn&&!St&&!zn,a=(0,st.Z)("text-content","clearfix","in-text"===Qn&&"with-meta",_&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:Vt,dir:"auto"},function(){if(Pt&&!gt||!(p&&(!(Zn||Cn||Ln)||Ne)||St||gt||A)||Mt||bt&&Pt)return;let e,n;!_t||Pt&&gt?ht?.hiddenUserName&&(e=ht.hiddenUserName):(e=(0,m.OU)(Ve,_t),St||vt||(n=`color-${(0,m.Rs)(_t)}`));const a=_t&&"emojiStatus"in _t&&_t.emojiStatus,s=_t&&"isPremium"in _t&&_t.isPremium;return i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,st.Z)("message-title-name interactive",n),onClick:nn,dir:"ltr"},(0,Fn.Z)(e),!St&&a&&i.ZP.createElement(Wt.Z,{documentId:a.documentId,loopLimit:o.y3O,observeIntersectionForLoading:d,observeIntersectionForPlaying:l}),!St&&!a&&s&&i.ZP.createElement(Xt.Z,null),_t?.fakeType&&i.ZP.createElement(qo.Z,{fakeType:_t.fakeType})):L?void 0:" ",L&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Ve("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:an},(0,Fn.Z)(`@${L.usernames[0].username}`))),ht?.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ve("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&ee&&St?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&ee&&!St?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):ke&&!St?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},ke.customTitle||Ve(ke.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")):void 0)}(),Lt&&i.ZP.createElement("div",{className:"message-subheader"},Ne&&i.ZP.createElement(Wo,{topic:Te,onClick:bn,className:"message-topic"}),bt&&i.ZP.createElement(Ss,{message:O,noUserColors:vt||Q,isProtected:$,sender:F,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,onClick:sn})),Rn&&i.ZP.createElement(Ns,{message:t,observeIntersection:d,observeIntersectionForPlaying:l,shouldLoop:Ze,lastSyncTime:ne,shouldPlayEffect:Rn.hasEffect&&(Me.current&&lt>=Me.current||It)||void 0,onPlayEffect:Ye,onStopEffect:Ke}),Zt&&oe&&i.ZP.createElement(Ds,{customEmojiId:oe,withEffects:(0,m.YC)(mt),isOwn:vt,observeIntersection:d,lastSyncTime:ne,forceLoadPreview:It,messageId:lt,chatId:mt,activeEmojiInteractions:fe}),Zt&&se&&i.ZP.createElement(_s,{emoji:se,withEffects:(0,m.YC)(mt),isOwn:vt,observeIntersection:d,lastSyncTime:ne,forceLoadPreview:It,messageId:lt,chatId:mt,activeEmojiInteractions:fe}),Et&&i.ZP.createElement(Mo,{album:u,albumLayout:la,observeIntersection:d,isOwn:vt,isProtected:$,hasCustomAppendix:n,lastSyncTime:ne,onMediaClick:cn}),Gn&&i.ZP.createElement(_o,{message:t,phoneCall:Gn,chatId:mt}),!Et&&Zn&&i.ZP.createElement(Xs,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:ye,uploadProgress:D,shouldAffectAppendix:n,isDownloading:be,isProtected:$,asForwarded:St,theme:T,forcedWidth:ra,onClick:on,onCancelUpload:hn}),!Et&&Cn&&Cn.isRound&&i.ZP.createElement(ko,{message:t,observeIntersection:d,canAutoLoad:ye,lastSyncTime:ne,isDownloading:be}),!Et&&Cn&&!Cn.isRound&&i.ZP.createElement(Ks,{message:t,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,forcedWidth:ra,noAvatars:h,canAutoLoad:ye,canAutoPlay:Pe,uploadProgress:D,lastSyncTime:ne,isDownloading:be,isProtected:$,asForwarded:St,onClick:on,onCancelUpload:hn}),(Sn||En)&&i.ZP.createElement(Ms.ZP,{theme:T,message:t,origin:I.Cr.Inline,uploadProgress:D,lastSyncTime:ne,isSelectable:q,isSelected:de,noAvatars:h,onPlay:rn,onReadMedia:!En||vt&&!K?void 0:mn,onCancelUpload:hn,isDownloading:be,isTranscribing:M,isTranscriptionHidden:ze,isTranscribed:Boolean(R),isTranscriptionError:pt,canDownload:!$,onHideTranscription:We,canTranscribe:P}),Mn&&i.ZP.createElement(Es.Z,{message:t,observeIntersection:d,canAutoLoad:ye,autoLoadFileMaxSizeMb:Ce,uploadProgress:D,isSelectable:q,isSelected:de,onMediaClick:on,onCancelUpload:hn,isDownloading:be}),Tn&&i.ZP.createElement(Qs,{contact:Tn}),An&&i.ZP.createElement(ro,{message:t,poll:An,onSendVote:gn}),jn&&i.ZP.createElement(Zo,{message:t,canAutoLoadMedia:ye,lastSyncTime:ne}),Bn?.extendedMedia&&i.ZP.createElement(po,{message:t,lastSyncTime:ne}),Ot&&i.ZP.createElement("p",{className:(0,st.Z)("transcription",!ze&&pt&&"transcription-error"),dir:"auto"},pt?Ve("NoWordsRecognized"):M&&R?i.ZP.createElement(Do.Z,{content:R}):R),!Zt&&Kn&&i.ZP.createElement("div",{className:a,dir:"auto"},pa(),_n&&i.ZP.createElement("div",{className:"translation-animation"},i.ZP.createElement("div",{className:"text-loading"},pa(!0))),"in-text"===Qn&&Ia()),Nn&&i.ZP.createElement(uo,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:ye,canAutoPlay:Pe,asForwarded:St,lastSyncTime:ne,isDownloading:be,isProtected:$,theme:T,onMediaClick:on,onCancelMediaTransfer:hn}),Bn&&!Bn.extendedMedia&&i.ZP.createElement(ho,{message:t,shouldAffectAppendix:n,isInSelectMode:ce,isSelected:de,theme:T,forcedWidth:ra}),Ln&&i.ZP.createElement(Po,{message:t,lastSyncTime:ne,isInSelectMode:ce,isSelected:de,theme:T,peer:N}))}(),!kt&&"standalone"===Qn&&Ia(),Nt&&xt?i.ZP.createElement(Dt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ve("lng_context_forward_msg"),onClick:E?pn:fn},i.ZP.createElement("i",{className:"icon-share-filled"})):Nt&&Bt?i.ZP.createElement(Dt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ve?In:vn},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,zn&&i.ZP.createElement(Ao,{threadInfo:Se,disabled:f}),Yn&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:vt?Xo:Yo}),Wn&&"in-content"===ta&&fa()),t.inlineButtons&&i.ZP.createElement(To,{message:t,onClick:Oe}),"outside"===ea&&i.ZP.createElement(Fo,{message:me,isOutside:!0,maxWidth:ia,activeReactions:pe,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:Q})),et&&i.ZP.createElement(bs,{isOpen:Qe,anchor:et,message:t,album:u,chatUsername:wa?.username,messageListType:Ie,onClose:at,onCloseAnimationEnd:ot,repliesThreadInfo:Se,noReplies:v,detectedLanguage:On}))}))),ei=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0})),ti=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),ni=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,l.fS)(e,n),{chatId:s,isBot:o}=a||{};return{message:a,bot:s&&o?(0,l.dy)(e,s):void 0,channel:!o&&s?(0,l.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:o,bot:r,channel:c}=e;const{viewSponsoredMessage:d,openChat:l,openChatByInvite:u,startBot:h,focusMessage:g}=(0,a.Sv)(),p=(0,At.Z)(),f=(0,i.sO)(null),I=(0,i.sO)(null),v=Boolean(n),{observe:w}=(0,Ba.S1)({rootRef:o,debounceMs:200,threshold:1}),{isContextMenuOpen:b,contextMenuPosition:y,handleBeforeContextMenu:P,handleContextMenu:Z,handleContextMenuClose:C,handleContextMenuHide:S}=(0,ua.Z)(f,s.$b,!0,s.wZ),[E,M,R]=(0,Rt.Z)(!1);(0,i.d4)((()=>v?w(I.current,(e=>{e.isIntersecting&&d({chatId:t})})):void 0),[t,v,w,d]);const k=(0,i.I4)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?g({chatId:n.chatId,messageId:n.channelPostId}):(l({id:n.chatId}),n.startParam&&h({botId:n.chatId,param:n.startParam})))}),[g,n,l,u,h]);if(n)return i.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Za.q)(e),P(e)},onContextMenu:Z},i.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},i.ZP.createElement("div",{className:"content-inner",dir:"auto"},i.ZP.createElement("div",{className:"message-title",dir:"ltr"},r&&(0,Fn.Z)((0,m.Js)(r)||""),c&&(0,Fn.Z)(n.chatInviteTitle||(0,m.U)(p,c)||"")),i.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:I},i.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,eo.H)(n.text.text,n.text.entities)),i.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},i.ZP.createElement("span",{className:"message-signature"},n.isRecommended?p("Message.RecommendedLabel"):p("SponsoredMessage")))),i.ZP.createElement(Dt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),y&&i.ZP.createElement(ti,{isOpen:b,anchor:y,message:n,onAboutAds:M,onClose:C,onCloseAnimationEnd:S}),i.ZP.createElement(ei,{isOpen:E,onClose:R}))}))),ai=(0,i.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,threadId:r,messageIds:d,messageGroups:l,isViewportNewest:u,isUnread:h,isComments:g,withUsers:p,isChannelChat:f,noAvatars:w,containerRef:b,anchorIdRef:y,memoUnreadDividerBeforeIdRef:P,memoFirstUnreadIdRef:Z,type:C,isReady:E,threadTopMessageId:M,hasLinkedChat:R,isSchedule:k,noAppearanceAnimation:T,onFabToggle:A,onNotchToggle:N,onPinnedIntersectionChange:B}=e;const{openHistoryCalendar:L}=(0,a.Sv)(),{observeIntersectionForReading:U,observeIntersectionForLoading:j,observeIntersectionForPlaying:O}=function(e,t,n,s){const{markMessageListRead:o,markMentionsRead:i,animateUnreadReaction:r}=(0,a.Sv)(),{isMobile:c}=(0,S.ZP)(),d=c?300:500,{observe:l,freeze:u,unfreeze:m}=(0,Ba.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const c=[],d=[],l=[],u=[];let m=!1;t.forEach((e=>{const{isIntersecting:t,target:n,boundingClientRect:s,rootBounds:o}=e,{dataset:i}=n,r=Number(i.lastMessageId||i.messageId),h=i.albumMainId?Number(i.albumMainId):void 0;t?(r>a&&(a=r),i.hasUnreadMention&&c.push(r),i.hasUnreadReaction&&d.push(r),i.isPinned&&l.push(h||r)):i.isPinned&&(o&&s.bottom<o.top&&(m=!0),u.push(h||r))})),n.current&&a>=n.current&&o({maxId:a}),c.length&&i({messageIds:c}),d.length&&r({messageIds:d}),(l.length||u.length)&&s({viewportPinnedIdsToAdd:l,viewportPinnedIdsToRemove:u,isReversed:m})}));(0,dt.Z)(u,m);const{observe:h}=(0,Ba.S1)({rootRef:t,throttleMs:La,margin:d}),{observe:g}=(0,Ba.S1)({rootRef:t,throttleMs:La});return{observeIntersectionForReading:l,observeIntersectionForLoading:h,observeIntersectionForPlaying:g}}(C,b,Z,B),{backwardsTriggerRef:F,forwardsTriggerRef:_,fabTriggerRef:D}=function(e,t,n,r,c,d,l,u){const{loadViewportMessages:m}=(0,a.Sv)(),[h,g]=(0,i.Ye)((()=>"thread"===e?[(0,x.Ds)((()=>m({direction:I.Uq.Backwards})),1e3,!0,!1),(0,x.Ds)((()=>m({direction:I.Uq.Forwards})),1e3,!0,!1)]:[]),[m,n]),p=(0,i.sO)(null),f=(0,i.sO)(null),v=(0,i.sO)(null);function w(){if(!u)return;if(!n||!n.length)return d(!1),void l(!1);if(!r)return d(!0),void l(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:a,scrollTop:s}=t.current,o=Math.round(a-s-e),i=o<=1;0!==a&&(d(c?!i:!(o<=50)),l(!i))}const{observe:b}=(0,Ba.S1)({rootRef:t,margin:s.gZ},(e=>{if(!g||!h)return;if(n[0]>o.MPN)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:a}=t;"backwards-trigger"===a.className?h():"forwards-trigger"===a.className&&g()}));(0,Ba._N)(p,b),(0,Ba._N)(f,b);const{observe:y,freeze:P,unfreeze:Z}=(0,Ba.S1)({rootRef:t,margin:100},w);(0,Ba._N)(v,y);const{observe:C,freeze:S,unfreeze:E}=(0,Ba.S1)({rootRef:t,margin:1},w);(0,Ba._N)(v,C);const M=(0,i.sO)();return M.current=w,(0,ut.Z)((()=>{u&&M.current()}),[u]),(0,ut.Z)((()=>{P(),S(),setTimeout((()=>{E(),Z()}),250)}),[P,S,n,Z,E]),{backwardsTriggerRef:p,forwardsTriggerRef:f,fabTriggerRef:v}}(C,b,d,u,h,A,N,E),q=(0,At.Z)(),$=i.ZP.createElement("div",{className:(0,st.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,q("UnreadMessages"))),H=T?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let G=0;const V=l.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!ya(e[0])&&(0,m.FT)(e[0])&&!e[0].content.action?.phoneCall){const o=e[0],d=a===s.length-1&&t===n.length-1;return(0,v.oA)([o.id===P.current&&$,i.ZP.createElement(Cs,{key:o.id,message:o,threadId:r,messageListType:C,isInsideTopic:Boolean(r&&r!==c._f),observeIntersectionForReading:U,observeIntersectionForLoading:j,observeIntersectionForPlaying:O,memoFirstUnreadIdRef:Z,appearanceOrder:H-++G,isLastInList:d,onPinnedIntersectionChange:B})])}let o;return e.map(((d,l)=>{const u=ya(d)?d.mainMessage:d,h=ya(d)?d:void 0,I=(0,m.B4)(u),b=ya(d),S=e[l+1];u.previousLocalId&&y.current===(0,m.d0)(u.previousLocalId)&&(y.current=(0,m.d0)(u.id));const E=!b&&u.groupedId?u.groupedId:void 0,k=S&&!ya(S)?S.groupedId:void 0,T={isFirstInGroup:0===l,isLastInGroup:l===e.length-1,isFirstInDocumentGroup:Boolean(E&&E!==o),isLastInDocumentGroup:Boolean(E&&E!==k),isLastInList:l===e.length-1&&a===s.length-1&&t===n.length-1};o=E;const A=(0,m.KK)(u),N=(0,m.jM)(u)?`${u.date}_${A}`:A,x=!1===R||!f,L=u.id===M;return(0,v.oA)([u.id===P.current&&$,i.ZP.createElement(Qo,{key:N,message:u,observeIntersectionForBottom:U,observeIntersectionForLoading:j,observeIntersectionForPlaying:O,album:h,noAvatars:w,withAvatar:T.isLastInGroup&&p&&!I&&(!L||!g),withSenderName:T.isFirstInGroup&&p&&!I,threadId:r,messageListType:C,noComments:x,noReplies:!x||r!==c._f,appearanceOrder:H-++G,isFirstInGroup:T.isFirstInGroup,isLastInGroup:T.isLastInGroup,isFirstInDocumentGroup:T.isFirstInDocumentGroup,isLastInDocumentGroup:T.isLastInDocumentGroup,isLastInList:T.isLastInList,memoFirstUnreadIdRef:Z,onPinnedIntersectionChange:B}),u.id===M&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,q("DiscussionStarted")))])})).flat()}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Za.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,st.Z)("sticky-date",!k&&"interactive"),key:"date-header",onMouseDown:Za.q,onClick:k?void 0:()=>L({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},k&&e.originalDate===o.t4X&&q("MessageScheduledUntilOnline"),k&&e.originalDate!==o.t4X&&q("MessageScheduledOn",(0,ce.j1)(q,e.datetime,void 0,!0)),!k&&(0,ce.j1)(q,e.datetime))),a.flat())}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},i.ZP.createElement("div",{ref:F,key:"backwards-trigger",className:"backwards-trigger"}),V.flat(),!t&&u&&i.ZP.createElement(ni,{key:n,chatId:n,containerRef:b}),i.ZP.createElement("div",{ref:_,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:D,key:"fab-trigger",className:"fab-trigger"}))}));var si=n(73547);const oi=(0,i.X$)((0,a.c$)(((e,t)=>{let{userId:n}=t;const{stickers:a}=e.stickers.greeting,s=(0,m.db)(n)+(0,m.db)(e.currentUserId),o=a?.length?a[s%a.length]:void 0,i=(0,l.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:s}=e;const{loadGreetingStickers:o,sendMessage:r,markMessageListRead:c}=(0,a.Sv)(),d=(0,At.Z)(),l=(0,i.sO)(null),{observe:u}=(0,Ba.S1)({rootRef:l,debounceMs:200});(0,i.d4)((()=>{t||"connectionStateReady"!==n||o()}),[n,o,t]),(0,i.d4)((()=>{"connectionStateReady"===n&&s&&c({maxId:s})}),[n,c,s]);const m=(0,i.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return i.ZP.createElement("div",{className:"ContactGreeting",ref:l},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("p",{className:"title",dir:"auto"},d("Conversation.EmptyPlaceholder")),i.ZP.createElement("p",{className:"description",dir:"auto"},d("Conversation.GreetingText")),i.ZP.createElement("div",{className:"sticker"},t&&i.ZP.createElement(si.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),ii=3*Ae.Gw,ri=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a,topic:s}=e;const o=(0,At.Z)();return"scheduled"===n?function(e){return i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(o):t?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("i",{className:"icon icon-cloud-download"}),i.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),i.ZP.createElement("ul",{className:"description"},i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(o):a?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},i.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),i.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),i.ZP.createElement("ul",{className:"list-checkmarks"},i.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(o):s?function(e,t){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement(Go.Z,{topic:t,size:ii,className:"icon topic-icon"}),i.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),i.ZP.createElement("p",{className:"description topic-description"},(0,Fn.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(o,s):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,o("NoMessages")))})),ci=(0,x.Ds)((e=>e()),200,!1),di=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const o=(0,l.Z1)(e,n);if(!o)return{};const i=(0,l.$W)(e,n,a,s),r="scheduled"===s?(0,l.yB)(e,n):(0,l.Zw)(e,n),d=(0,l.qS)(e,n,a),u=(0,l.tZ)(e,n,a);if(!(a===c._f||o?.isForum||r&&d&&r[d]))return{};const{isRestricted:h,restrictionReason:g,lastMessage:p}=o,f=(0,l.G$)(e,n),I=a===c._f&&!i&&!o.unreadCount&&!f&&p&&!p.groupedId,v=(0,l.IK)(e,n);let w,b=!1;(0,l.pk)(e,n)&&(v.fullInfo?w=v.fullInfo.botInfo:b=!0);const y=o.topics?.[a];return{isCurrentUserPremium:(0,l.wV)(e),isChatLoaded:!0,isRestricted:h,restrictionReason:g,isChannelChat:(0,m.eA)(o),isGroupChat:(0,m.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,l.FM)(e,n),isRepliesChat:(0,m.pK)(n),isBot:Boolean(v),messageIds:i,messagesById:r,isComments:Boolean(u?.originChannelId),firstUnreadId:(0,l.It)(e,n,a),isViewportNewest:"thread"!==s||(0,l.b9)(e,n,a),threadFirstMessageId:(0,l.yZ)(e,n,a),focusingId:f,isSelectModeActive:(0,l.CA)(e),isLoadingBotInfo:b,botInfo:w,threadTopMessageId:d,hasLinkedChat:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,topic:y,...I&&{lastMessage:p}}}))((e=>{let{chatId:t,threadId:n,type:r,hasTools:d,onFabToggle:u,onNotchToggle:h,isCurrentUserPremium:g,isChatLoaded:p,isChannelChat:f,isGroupChat:w,canPost:b,isReady:y,isChatWithSelf:P,isRepliesChat:Z,isCreator:C,isBot:S,messageIds:E,messagesById:M,firstUnreadId:R,isComments:k,isViewportNewest:T,threadFirstMessageId:A,isRestricted:N,restrictionReason:B,focusingId:L,isSelectModeActive:U,lastMessage:j,isLoadingBotInfo:O,botInfo:F,threadTopMessageId:_,hasLinkedChat:D,lastSyncTime:q,withBottomShift:$,withDefaultBg:H,topic:G,onPinnedIntersectionChange:V,getForceNextPinnedInHeader:z}=e;const{loadViewportMessages:W,setScrollOffset:X,loadSponsoredMessages:Y,loadMessageReactions:K,copyMessagesByIds:J,loadMessageViews:Q}=(0,a.Sv)(),ee=(0,i.sO)(null),te=(0,i.sO)("thread"===r&&(0,l.Vt)((0,a.Rd)(),t,n)||(0,l.T6)((0,a.Rd)(),t,n)||0),ne=(0,i.sO)(),ae=(0,i.sO)(),se=(0,i.sO)(),oe=(0,i.sO)(),ie=(0,i.sO)(),re=(0,i.sO)(),ce=(0,i.sO)(!1),de=(0,i.sO)(Boolean(j)),le=(0,Yt.Z)(F?.photo?(0,m.NF)(F.photo):void 0),ue=(0,Yt.Z)(F?.gif?(0,m.ym)(F.gif):void 0),me=F?.photo?(0,m.bV)(F.photo):F?.gif?(0,m.jC)(F.gif):void 0,he=me&&{width:me.width/s.cL,height:me.height/s.cL},ge=Boolean(E);(0,ut.Z)((()=>{ge&&(0,x.R3)((()=>{de.current=!1}))}),[ge]),(0,ut.Z)((()=>{oe.current=R}),[R]),(0,i.d4)((()=>{!g&&f&&y&&q&&Y({chatId:t})}),[g,t,y,f,q,Y]),(0,ut.Z)((()=>{ge&&(ie.current=oe.current)}),[ge]),(0,ut.Z)((()=>{re.current=L}),[L]),(e=>{(0,kt.y)({"Mod+C":function(t){const n=(0,Aa.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(J);const pe=(0,i.Ye)((()=>{if(!E||!M)return;const e=!_||A===_||E[0]&&A!==E[0]?E:[_,...E];if(!e.length)return;const t=e.map((e=>M[e])).filter(Boolean),n="scheduled"===r?["date","id"]:["id"];return t.length?Pa((0,v.Xo)(t,n),ie.current):void 0}),[E,M,A,_,r]);(0,vt.Z)((()=>{if(!E||!M)return;const e=E.filter((e=>M[e]?.reactions));e.length&&K({chatId:t,ids:e})}),15e3),(0,vt.Z)((()=>{if(!E||!M||n!==c._f)return;const e=E.filter((e=>M[e]?.repliesThreadInfo?.isComments));e.length&&Q({chatId:t,ids:e})}),15e3);const fe=(0,i.Ye)((()=>{if("thread"===r)return(0,x.Ds)((()=>W({direction:I.Uq.Around})),1e3,!0,!1)}),[W,E]),{isScrolled:Ie,updateStickyDates:ve}=function(){const[e,t]=(0,Rt.Z)(!1),n=(0,Ma.Z)(Ra,!0);return{isScrolled:e,updateStickyDates:(0,i.I4)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,x.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,x.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:s}=e,o=n-a;return-s<=o&&o<=(t?Ta:ka)}))}(e,a);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),we=(0,i.I4)((()=>{if(ce.current)return void(ce.current=!1);const e=ee.current;e&&(re.current||ve(e,d),ci((()=>{const s=(0,a.Rd)();z()&&!(0,l.jU)(s).focusedMessage?.chatId&&V({hasScrolled:!0}),(0,x.T2)((()=>{e.parentElement&&(te.current=e.scrollHeight-e.scrollTop,"thread"===r&&X({chatId:t,threadId:n,scrollOffset:te.current}))}))})))}),[ve,d,z,V,r,t,n]),[be,ye]=function(e,t){const[n,a]=(0,Nn.Z)(),s=(0,i.I4)((e=>{a(e.contentRect.height)}),[a]);(0,xa.Z)(e,s),(0,i.d4)((()=>{const a=Number(e.current.dataset.normalHeight)||0,s=n();s&&s>a&&t&&(e.current.dataset.normalHeight=String(s))}),[t,e,n]);const o=(0,i.sO)();return[n,o]}(ee,b&&!U);(0,i.d4)((()=>{if(!fe||!p||N||L)return;if(E&&E[E.length-1]>o.MPN)return;const e=ee.current;(!E||E.length<o.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&fe()}),[p,E,fe,L,N]);const Pe=(0,Ea.Y)((()=>{if(!E||!se.current)return;const e=se.current.filter((e=>E.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(ne.current=t.id,ae.current=t.getBoundingClientRect().top)}));(0,ut.Z)((()=>Pe.current()),[E,T,d,Pe]),(0,i.d4)((()=>Pe.current()),[be,Pe]),Na((e=>{let[t,n]=e;const a=be(),s=ye.current;ye.current=a;const i=ee.current;se.current=Array.from(i.querySelectorAll(".message-list-item"));const r=E&&t&&E[E.length-1]!==t[t.length-1],c=E?.[0]!==t?.[0]&&E?.length===o.hT6/2+1,l=r&&!c,u=E&&re.current===E[E.length-1],m=T&&l&&E&&E.length<o.hT6/2&&!i.parentElement.classList.contains("force-messages-scroll")&&i.firstElementChild.clientHeight<=2*i.offsetHeight;m&&(i.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{i.parentElement&&i.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:h,scrollHeight:g,offsetHeight:p}=i,f=te.current,I=se.current[se.current.length-1];let v=f-(s||p);l&&(v-=I?I.offsetHeight:0);const w=T&&n&&v<=50;let b;if(l&&w&&!u&&(I&&(0,x.T2)((()=>{(0,Sa.Z)(i,I,"end",20)})),b=g-p,te.current=Math.max(Math.ceil(g-b),p),!m))return;const y=s&&s!==a,P=ne.current&&i.querySelector(`#${ne.current}`),Z=!P&&ie.current&&i.querySelector(".unread-divider");if(w&&y){if((0,Sa.N)())return;b=g-p}else b=P?h+(P.getBoundingClientRect().top-(ae.current||0)):Z?Math.min(Z.offsetTop-(d?60:10),g-f):g-f;(0,Ca.Z)(i,Math.ceil(b)),re.current||(ce.current=!0,(0,x.T2)((()=>{ce.current=!1}))),te.current=Math.max(Math.ceil(g-b),p)}),[E,T,be,ye,d]),(0,ct.Z)((e=>{let[t]=e;void 0!==t&&(0,It.YW)(200+o.fK3)}),[U]);const Ze=(0,At.Z)(),Ce=Boolean(t&&(0,m.YC)(t)),Se=Boolean(!Ce&&!f||P||Z),Ee=Boolean(!Se||f),Me=(0,m.YC)(t)&&!P&&!S&&(!pe&&!j&&E&&(!se.current||0===se.current.length)||1===E?.length&&"contactSignUp"===M?.[E[0]]?.content.action?.type||"contactSignUp"===j?.content?.action?.type),Re=w&&C&&1===E?.length&&"chatCreate"===M?.[E[0]]?.content.action?.type,ke=1===E?.length&&"topicCreate"===M?.[E[0]]?.content.action?.type,Te=F&&!F.description&&!F.gif&&!F.photo,Ae=(0,st.Z)("MessageList custom-scroll",Ee&&"no-avatars",!b&&"no-composer","pinned"===r&&"type-pinned",$&&"with-bottom-shift",H&&"with-default-bg",U&&"select-mode-active",Ie&&"scrolled",!y&&"is-animating");return i.ZP.createElement("div",{ref:ee,className:Ae,onScroll:we,onMouseDown:Za.q},N?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,B?B.text:"This is a private "+(f?"channel":"chat"))):F?i.ZP.createElement("div",{className:"empty"},O&&i.ZP.createElement("span",null,Ze("Loading")),Te&&!O&&i.ZP.createElement("span",null,Ze("NoMessages")),F&&i.ZP.createElement("div",{className:"bot-info",style:he&&`width: ${he.width}px`},le&&i.ZP.createElement("img",{src:le,width:he?.width,height:he?.height,alt:"Bot info"}),ue&&i.ZP.createElement(Ys.Z,{canPlay:!0,src:ue,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),me&&!le&&!ue&&i.ZP.createElement(mo.Z,{width:he?.width,height:he?.height}),F.description&&i.ZP.createElement("div",{className:"bot-info-description"},i.ZP.createElement("p",{className:"bot-info-title"},Ze("BotInfoTitle")),(0,Fn.Z)(F.description,["br","emoji","links"])))):Me?i.ZP.createElement(oi,{userId:t}):E&&(!pe||Re||ke)?i.ZP.createElement(ri,{chatId:t,topic:G,type:r,isChatWithSelf:P,isGroupChatJustCreated:Re}):E&&pe||j?i.ZP.createElement(ai,{isCurrentUserPremium:g,chatId:t,isComments:k,isChannelChat:f,messageIds:E||[j.id],messageGroups:pe||Pa([j]),isViewportNewest:Boolean(T),isUnread:Boolean(R),withUsers:Se,noAvatars:Ee,containerRef:ee,anchorIdRef:ne,memoUnreadDividerBeforeIdRef:ie,memoFirstUnreadIdRef:oe,threadId:n,type:r,isReady:y,threadTopMessageId:_,hasLinkedChat:D,isSchedule:!!pe&&"scheduled"===r,noAppearanceAnimation:!pe||!de.current,onFabToggle:u,onNotchToggle:h,onPinnedIntersectionChange:V}):i.ZP.createElement(dn.Z,{color:"white",backgroundColor:"dark"}))}))),li=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:o,className:r}=e;const c=(0,At.Z)(),d=(0,i.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,ua.Z)(d,!o);return i.ZP.createElement("div",{className:(0,st.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},i.ZP.createElement(Dt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:s,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,st.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(a)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,Pt.bi)(a)),o&&i.ZP.createElement(mn.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(_t.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),ui="EcdaljLbQ7DJN9gbQpSC",mi=(0,i.X$)((0,a.c$)((e=>{const t=(0,l.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,l.Z1)(e,n),i=o&&a===c._f&&"thread"===s;return{messageListType:s,chatId:n,reactionsCount:i?o.unreadReactionsCount:void 0,mentionsCount:i?o.unreadMentionsCount:void 0,unreadCount:i?o.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:s,chatId:o,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,a.Sv)(),v=(0,i.sO)(null),w=Boolean(c),b=Boolean(d);(0,i.d4)((()=>{w&&o&&g({chatId:o})}),[o,g,w]),(0,i.d4)((()=>{b&&o&&I({chatId:o})}),[o,I,b]);const y=(0,i.I4)((()=>{if(t)if("thread"===s)u();else{const e=v.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Sa.Z)(e,n,"end",20)}}),[t,s,u]),P=(0,st.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(d))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(d))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!l&&"S98OqutuQVCNVHgTrKv4");return i.ZP.createElement("div",{ref:v,className:P},i.ZP.createElement(li,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c,className:(0,st.Z)("wHTB_MNtk9J6I3F_4eVE",!w&&ui,!b&&"uHEtFnXb6pb14Jf0EsDr")}),i.ZP.createElement(li,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d,className:!b&&ui}),i.ZP.createElement(li,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:y,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var hi=n(65723);const gi=1280,pi=20,fi=/\.[^/.]+$/;async function Ii(e,t,a){const s=URL.createObjectURL(t),{type:i,size:r}=t;let c,d,l,u;if(o.oGt.has(i)){const n=await(0,En.pt)(s),{width:r,height:d}=n;u=!wi(r,d);const m=Math.max(r,d)>gi,h=i===o.s11;if(!u){if(!a?.compressedBlobUrl&&!h&&(m||"image/jpeg"!==i)){const n=await sa(s,m?gi/Math.max(r,d):1,"image/jpeg");return URL.revokeObjectURL(s),Ii(e,t,{compressedBlobUrl:n})}"image/jpeg"===i&&(e=e.replace(fi,".jpg")),c={width:r,height:d}}l=s}else if(o.wGh.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,En.jj)(s);u=!wi(e,t),u||(c={width:e,height:t,duration:n}),l=await(0,En.ud)(s)}else if(o.e74.has(i)){const{duration:e,title:t,performer:a,coverUrl:o}=await async function(e){const{fetchFromUrl:t,selectCover:a}=await n.e(8505).then(n.t.bind(n,38505,23)),s=await t(e),{common:{title:o,artist:i,picture:r},format:{duration:c}}=s,d=a(r);return{title:o,performer:i,duration:c,coverUrl:d?`data:${d.format};base64,${d.data.toString("base64")}`:void 0}}(s);d={duration:e||0,title:t,performer:a},l=o}return{blobUrl:s,filename:e,mimeType:i,size:r,quick:c,audio:d,previewBlobUrl:l,shouldSendAsFile:u||void 0,uniqueId:`${Date.now()}-${Math.random()}`,...a}}function vi(e,t){return e.map((e=>t?e.compressedBlobUrl?{...e,blobUrl:e.compressedBlobUrl}:e:{...e,shouldSendAsFile:!e.voice||void 0,shouldSendAsSpoiler:void 0}))}function wi(e,t){return Math.max(e,t)/Math.min(e,t)<=pi}var bi=n(41098),yi=n(96391);let Pi;function Zi(e){Pi.focus(),e.focus()}s.cj&&(Pi=document.createElement("input"),Pi.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Pi));var Ci=n(74288),Si=n(94462),Ei=n(33681),Mi=n(52400),Ri=n(71790);const ki=new RegExp(`^${o.t8f.source}$`,"g");var Ti=n(56389);const Ai=new URL(n(68973),n.b).href,Ni=1e3,xi={encoderPath:Ai,reuseWorker:!0},Bi={type:"audio/ogg"},Li=64,Ui=.1;let ji,Oi,Fi;async function _i(){return ji||(ji=n.e(1161).then(n.t.bind(n,1161,23)),Oi=(await ji).default,Fi=new Oi(xi)),ji}async function Di(e){await async function(){await _i(),await Fi.start()}();const t=Date.now();let n;const a=[],s=[];Fi.ondataavailable=e=>{a.push(e)};const o=function(t,n){const a=t.sourceNode,o=a.context.createAnalyser();o.fftSize=Li,a.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=>{s.push(255*t),e(t)})(n<Ui?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(Fi);return{stop:()=>new Promise(((e,i)=>{Fi.onstop=()=>{e({blob:new Blob(a,Bi),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},Fi.onerror=i;const r=Math.max(0,t+Ni-Date.now());setTimeout((()=>{Fi.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+Ni-Date.now());setTimeout((()=>{Fi.pause(),n=Date.now(),o()}),e)}}}var qi=n(21262);const $i=/id="docs-internal-guid/i,Hi={BOLD:"700",ITALIC:"italic",UNDERLINE:"underline",STRIKETHROUGH:"line-through",SUPERSCRIPT:"super",SUBSCRIPT:"sub"},Gi={ANCHOR:"a",BOLD:"strong",ITALIC:"em",UNDERLINE:"u",STRIKETHROUGH:"del",SUPERSCRIPT:"sup",SUBSCRIPT:"sub"},Vi=["H1","H2","H3","H4","H5","H6"];function zi(e){return(new DOMParser).parseFromString(e,"text/html").body}function Wi(e,t){const n=document.createElement(Gi.ANCHOR);return n.href=t,n.appendChild(e.cloneNode(!0)),n}function Xi(e,t){const n=document.createElement(t);return n.appendChild(e.cloneNode(!0)),n}function Yi(e,t){let n=t.cloneNode(!0);return e?(e.style&&e.style.fontWeight===Hi.BOLD&&(n=Xi(n,Gi.BOLD)),e.style&&e.style.fontStyle===Hi.ITALIC&&(n=Xi(n,Gi.ITALIC)),e.style&&e.style.textDecoration===Hi.UNDERLINE&&(n=Xi(n,Gi.UNDERLINE)),e.style&&e.style.textDecoration===Hi.STRIKETHROUGH&&(n=Xi(n,Gi.STRIKETHROUGH)),e.style&&e.style.verticalAlign===Hi.SUPERSCRIPT&&(n=Xi(n,Gi.SUPERSCRIPT)),e.style&&e.style.verticalAlign===Hi.SUBSCRIPT&&(n=Xi(n,Gi.SUBSCRIPT)),n):n}function Ki(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=t;return"A"===t.nodeName&&(n=Wi(n,t.href),"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0])),n=Yi(a,n),n}function Ji(e){if(e.childNodes&&(e.childNodes.length<=1||"OL"===e.nodeName||"UL"===e.nodeName)){let t,n=document.createTextNode(e.textContent||"");if("UL"===e.nodeName||"OL"===e.nodeName||"LI"===e.nodeName){t=document.createElement(e.nodeName),n=document.createDocumentFragment();const a=[];for(let t=0;t<e.childNodes.length;t++)a.push(...Ji(e.childNodes[t]));a.map((e=>n.appendChild(e)))}else-1!==Vi.indexOf(e.nodeName)?(t=document.createElement(e.nodeName),n=Ki(e.childNodes[0])):"P"===e.nodeName?(t=document.createElement("p"),n=function(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=document.createTextNode("");return"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0]),t.childNodes[0]&&"A"===t.childNodes[0].nodeName&&(n=Wi(n.cloneNode(!0),t.childNodes[0].href),a=t.childNodes[0].childNodes[0]),n=Yi(a,n),n}(e)):"BR"===e.nodeName?n=e:(t=document.createElement("span"),n=Ki(e));return t?(t.appendChild(n),[t]):[e.cloneNode(!0)]}if(e.childNodes){const t=[];for(let n=0;n<e.childNodes.length;n++)t.push(...Ji(e.childNodes[n]));return t}return[e]}function Qi(e){return 8!==e.nodeType}var er=n(56266);const tr=/<style>(.*?)<\/style>/gs,nr=(e,t,n,a,s,r)=>{(0,i.d4)((()=>{if(e)return document.addEventListener("paste",i,!1),()=>{document.removeEventListener("paste",i,!1)};async function i(e){if(!e.clipboardData)return;const i=document.activeElement;if(i&&![o.R2F,o.nYf].includes(i.id))return;const d=e.clipboardData.getData("text").substring(0,4096),l=e.clipboardData.getData("text/html");let u=l?(0,b.ZP)(function(e){let t=document.createElement("div");try{e=(n=e).match($i)?function(e){const t=document.createElement("body"),n=e.childNodes,a=Array.from(n).filter(Qi),s=[];for(const e of a)s.push(...Ji(e));for(let e=0;e<s.length;e++)t.appendChild(s[e].cloneNode(!0));return t}(zi(n.replace(/(\r\n|\n|\r)/,""))).innerHTML:zi(n.replace(/(\r\n|\n|\r)/,"")).innerHTML}catch(e){o.eMD&&console.error(e)}var n;t.innerHTML=e.replace(/\u00a0/g," ").replace(tr,"");const a=t.querySelectorAll(".text-content");return a.length&&(t=a[a.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(),b.xe[e.tagName]&&e.setAttribute("data-entity-type",b.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 c.Vv.MentionName:e.replaceWith(e.textContent||"");break;case c.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(l),void 0,!0):void 0;u&&(0,er.Lo)(u)&&s&&(u=(0,er.If)(u),r?.());const{items:m}=e.clipboardData;let h=[];if(e.preventDefault(),m.length>0&&(h=await(0,qi.Z)(m)),!h?.length&&!d)return;if(h?.length&&!a){const e=await Promise.all(h.map((e=>Ii(e.name,e))));n((t=>t.concat(e)))}const g=u?.entities?.length?u:{text:d};g&&t(g,i?.id)}}),[t,a,n,e,s,r])};var ar=n(11309);const sr=new Set([c.Vv.TextUrl,c.Vv.Url]);var or=n(28353),ir=n(29295),rr=n(16580);const cr=300,dr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,lr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,ur={username:"",query:"",canShowHelp:!1,usernameLowered:""},mr=document.createElement("div");const hr=(0,rr.Z)(((e,t,n)=>({username:e,query:t,canShowHelp:n,usernameLowered:e.toLowerCase()}))),gr=/^\/([\w@]{1,32})?$/i;var pr=n(33057),fr=n(60130);function Ir(e){return e.shouldSendAsFile?"file":o.oGt.has(e.mimeType)?"image":o.wGh.has(e.mimeType)?"video":o.e74.has(e.mimeType)?"audio":"file"}var vr=n(69156);let wr=!1;const br=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));var yr=n(43521),Pr=n(85655),Zr=n(56503),Cr=n(62898);const Sr="N3E1geoPu1vesCKf545F",Er=/#fff/gi,Mr=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const a=(0,Yt.Z)((0,m.ym)(t),!1,c.IU.Text),o=(0,i.Ye)((()=>{if(!a)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=a.replace(Er,e),s=(new DOMParser).parseFromString(t,"image/svg+xml");return s.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${s.documentElement.outerHTML}`}),[a,n]);return i.ZP.createElement("i",{className:(0,st.Z)("vL8HfVVnjTeFmp1ECFj8",s.FW&&Sr)},i.ZP.createElement("img",{src:o,alt:"",className:(0,st.Z)("Fb4aIyDYEwOlaqY8oZkV",s.FW&&Sr)}))})),Rr=(0,i.X$)((e=>{let{bot:t,theme:n,chatId:s,threadId:o,onMenuOpened:r,onMenuClosed:c}=e;const{callAttachBot:d,toggleAttachBot:l}=(0,a.Sv)(),u=(0,At.Z)(),m=(0,i.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,Rt.Z)(),[f,I]=(0,i.eJ)(void 0),v=(0,i.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()}),[r,g]),w=(0,i.I4)((()=>{p(),c()}),[p,c]),b=(0,i.I4)((()=>{I(void 0)}),[]),y=(0,i.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return i.ZP.createElement(_t.Z,{key:t.id,customIcon:m&&i.ZP.createElement(Mr,{icon:m,theme:n}),icon:m?void 0:"bots",onClick:()=>d({bot:t,chatId:s,threadId:o}),onContextMenu:v},t.shortName,f&&i.ZP.createElement(Cr.Z,null,i.ZP.createElement(mn.Z,{isOpen:h,positionX:"right",style:`left: ${f.x}px;top: ${f.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:w,onCloseAnimationEnd:b},i.ZP.createElement(_t.Z,{icon:"stop",destructive:!0,onClick:y},u("WebApp.RemoveBot")))))})),kr=(0,i.X$)((e=>{let{chatId:t,threadId:n,isButtonVisible:a,canAttachMedia:r,canAttachPolls:c,canSendPhotos:d,canSendVideos:l,canSendDocuments:u,canSendAudios:m,attachBots:h,peerType:g,isScheduled:p,onFileSelect:f,onPollCreate:I,theme:v}=e;const[w,b,y]=(0,Rt.Z)(),[P,Z,C]=(0,Zr.Z)(w,y),S=d&&l,E=d||l,[M,R,k]=(0,Rt.Z)();(0,i.d4)((()=>{w&&C()}),[w,C]);const T=(0,i.I4)((()=>{w?y():b()}),[w,b,y]),A=(0,i.I4)(((e,t)=>{const{files:n}=e.target,a=(0,En.ox)(n);a?.length&&f(a,t)}),[f]),N=(0,i.I4)((()=>{(0,Pr.g)(Array.from(S?o.dII:d?o.oGt:o.wGh).join(","),(e=>A(e,!0)))}),[d,S,A]),x=(0,i.I4)((()=>{(0,Pr.g)(!u&&m?Array.from(o.e74).join(","):"*",(e=>A(e,!1)))}),[m,u,A]),B=(0,i.Ye)((()=>Object.values(h).filter((e=>!!g&&(!("bots"!==g||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(g))))),[h,t,g]),L=(0,At.Z)();if(a)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(yr.Z,{id:"attach-menu-button",className:w?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:T,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon-attach"})),i.ZP.createElement(mn.Z,{id:"attach-menu-controls",isOpen:w||M,autoClose:!0,positionX:"right",positionY:"bottom",onClose:y,className:"AttachMenu--menu fluid",onCloseAnimationEnd:y,onMouseEnter:s.$b?void 0:P,onMouseLeave:s.$b?void 0:Z,noCloseOnBackdrop:!s.$b,ariaLabelledBy:"attach-menu-button"},!r&&i.ZP.createElement(_t.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),r&&i.ZP.createElement(i.ZP.Fragment,null,E&&i.ZP.createElement(_t.Z,{icon:"photo",onClick:N},L(S?"AttachmentMenu.PhotoOrVideo":d?"InputAttach.Popover.Photo":"InputAttach.Popover.Video")),(u||m)&&i.ZP.createElement(_t.Z,{icon:"document",onClick:x},L(!u&&m?"InputAttach.Popover.Music":"AttachDocument"))),c&&i.ZP.createElement(_t.Z,{icon:"poll",onClick:I},L("Poll")),r&&!p&&B.map((e=>i.ZP.createElement(Rr,{bot:e,chatId:t,threadId:n,theme:v,onMenuOpened:R,onMenuClosed:k})))))})),Tr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Ar=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Nr=n(67146);const xr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Br=n(93219),Lr=n(19830);const Ur=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),jr=(0,i.X$)((0,a.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:a}=(0,l.Bt)(e)||{};return a?{message:(0,l.hj)(e,a,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:o}=e;const{clickBotInlineButton:r}=(0,a.Sv)(),[c,d]=(0,Zr.Z)(t,o),{isKeyboardSingleUse:l}=n||{};if(n&&n.keyboardButtons)return i.ZP.createElement(mn.Z,{isOpen:t,autoClose:l,positionX:"right",positionY:"bottom",onClose:o,className:"BotKeyboardMenu",onCloseAnimationEnd:o,onMouseEnter:s.$b?void 0:c,onMouseLeave:s.$b?void 0:d,noCompact:!0},i.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Dt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>r({messageId:n.id,button:e})},e.text))))))))})));var Or=n(49841),Fr=n(63394),_r=n(66902);const Dr=(0,i.X$)((0,a.c$)(((e,t)=>{let{shouldForceShowEditing:n}=t;const{chatId:a,threadId:s,type:o}=(0,l.Bt)(e)||{};if(!a||!s||!o)return{};const{forwardMessages:{fromChatId:i,toChatId:r,messageIds:c,noAuthors:d,noCaptions:u}}=(0,l.jU)(e),h=(0,l.Yy)(e,a,s),g="scheduled"===o?(0,l.wU)(e,a):(0,l._$)(e,a,s),p=e.settings.byKey.animationLevel>=1,f=r===a,I=c?.map((t=>(0,l.hj)(e,i,t)));let v,w;if(h&&!n?v=(0,l.hj)(e,a,h):g?v=(0,l.kK)(e,a,s,o):f&&1===c.length&&(v=I?.[0]),h&&v&&!n){const{forwardInfo:t}=v,n=(0,l.FM)(e,a);t&&(t.isChannelPost||n)&&(w=(0,l.cv)(e,v)),w||t?.hiddenUserName||(w=(0,l.Ur)(e,v))}else f&&(v&&(w=(0,l.cv)(e,v),w||(w=(0,l.Ur)(e,v))),w||(w=(0,m.YC)(i)?(0,l.dy)(e,i):(0,l.Z1)(e,i)));const b=I?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:h,editingId:g,message:v,sender:w,shouldAnimate:p,forwardedMessagesCount:f?c.length:void 0,noAuthors:d,noCaptions:u,forwardsHaveCaptions:b,isCurrentUserPremium:(0,l.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:o,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:l,forwardsHaveCaptions:u,shouldForceShowEditing:h,isCurrentUserPremium:g,onClear:p}=e;const{setReplyingToId:f,setEditingId:I,focusMessage:v,changeForwardRecipient:w,setForwardNoAuthors:b,setForwardNoCaptions:y,exitForwardMode:P}=(0,a.Sv)(),Z=(0,i.sO)(null),C=(0,At.Z)(),S=Boolean(c),E=Boolean((t||n)&&s||o&&c),M=(0,Dn.Z)([c],c?300:void 0),{shouldRender:R,transitionClassNames:k}=(0,ft.Z)(M&&E,void 0,!r,void 0,!r),T=(0,i.I4)((()=>{t&&!h?f({messageId:void 0}):n?I({messageId:void 0}):c&&P(),p?.()}),[t,h,n,c,p,f,I,P]);(0,i.d4)((()=>E?(0,Et.Z)(T):void 0),[E,T]);const A=(0,i.I4)((()=>{S||v({chatId:s.chatId,messageId:s.id,noForumTopicPanel:!0})}),[v,S,s]),N=(0,i.I4)((e=>{e.stopPropagation(),T()}),[T]),x=(0,i.I4)((()=>{w()}),[w]),{isContextMenuOpen:B,contextMenuPosition:L,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:O}=(0,ua.Z)(Z),F=(0,i.I4)((()=>Z.current),[]),_=(0,i.I4)((()=>Z.current),[]),D=(0,i.I4)((()=>Z.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:q,positionY:$,transformOriginX:H,transformOriginY:G,style:V}=(0,Fr.Z)(L,F,_,D),z=(0,st.Z)("ComposerEmbeddedMessage",k),W=(0,i.Ye)((()=>t&&!h?"icon-reply":n?"icon-edit":S?"icon-forward":void 0),[n,S,t,h]),X=c&&c>1?C("ForwardedMessageCount",c):void 0,Y=(0,i.Ye)((()=>{if(!s||!S||!s.content.text||!d||g)return s;const e=(0,m.If)(s.content.text);return{...s,content:{...s.content,text:e}}}),[g,S,s,d]);if(R)return i.ZP.createElement("div",{className:z,ref:Z,onContextMenu:U,onClick:U},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"embedded-left-icon"},i.ZP.createElement("i",{className:W})),i.ZP.createElement(Ss,{className:"inside-input",message:Y,sender:d?void 0:o,customText:X,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:A,hasContextMenu:S}),i.ZP.createElement(Dt.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:N},i.ZP.createElement("i",{className:"icon-close"})),S&&i.ZP.createElement(mn.Z,{isOpen:B,transformOriginX:H,transformOriginY:G,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:j,onCloseAnimationEnd:O},i.ZP.createElement(_t.Z,{icon:d?void 0:"message-succeeded",customIcon:d?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>b({noAuthors:!1})},C(c>1?"ShowSenderNames":"ShowSendersName")),i.ZP.createElement(_t.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>b({noAuthors:!0})},C(c>1?"HideSenderNames":"HideSendersName")),u&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_r.Z,null),i.ZP.createElement(_t.Z,{icon:l?void 0:"message-succeeded",customIcon:l?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>y({noCaptions:!1})},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),i.ZP.createElement(_t.Z,{icon:l?"message-succeeded":void 0,customIcon:l?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>y({noCaptions:!0})},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),i.ZP.createElement(_r.Z,null),i.ZP.createElement(_t.Z,{icon:"replace",onClick:x},C("ChangeRecipient")))))}))),qr=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,bt.Z)(rt.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),$r=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Hr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),Gr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),Vr=new RegExp(o.FM6,"i"),zr=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a}=t;const s=(0,l.tV)(e,n,a);return{theme:(0,l.Pu)(e),webPagePreview:(0,l.jU)(e).webPagePreview,noWebPage:s}}))((e=>{let{chatId:t,threadId:n,getHtml:s,isDisabled:o,webPagePreview:r,noWebPage:d,theme:l}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,a.Sv)(),g=(0,ar.i)((()=>{const{text:e,entities:t}=(0,b.ZP)(s()),n=t?.find((e=>e.type===c.Vv.TextUrl));return n?.url||e.match(Vr)?.[0]}),[s],300,!0),p=(0,Ri.Z)(g,[g,s],!0);(0,i.d4)((()=>{const e=p();e?u({text:e}):(m(),h({chatId:t,threadId:n}))}),[p,t,n,m,u,h]),(0,ut.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t,m,n,h]);const f=(0,Ln.Z)((()=>Boolean(r&&s()&&!d&&!o)),[o,s,d,r]),{shouldRender:I,transitionClassNames:v}=(0,ft.Z)(f),w=(0,Bn.Z)(r,!0),y=(0,i.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 i.ZP.createElement("div",{className:(0,st.Z)("WebPagePreview",v)},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"WebPagePreview-left-icon"},i.ZP.createElement("i",{className:"icon-link"})),i.ZP.createElement(uo,{message:C,inPreview:!0,theme:l}),i.ZP.createElement(Dt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},i.ZP.createElement("i",{className:"icon-close"}))))}))),Wr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Xr=(0,i.X$)((e=>{let{isOpen:t,onClick:n,text:a,isDisabled:s}=e;const o=(0,i.sO)(null);return(0,i.d4)((()=>{const e=o.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,a]),(0,i.d4)((()=>{const e=o.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),i.ZP.createElement(Dt.Z,{className:(0,st.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,st.Z)("bot-menu-icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},a))}));var Yr=n(23522),Kr=function(e){return e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule",e}(Kr||{});const Jr=(0,i.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a,threadId:s,messageListType:i,isMobile:r}=t;const c=(0,l.Z1)(e,a),d=a!==o.FVh?(0,l.IK)(e,a):void 0,u=Boolean(d),h=(0,l.FM)(e,a),g=(0,m.YC)(a),p=(u||!g)&&(0,l.FT)(e,a,s),f=(0,l.qy)(e,a,s),{language:I,shouldSuggestStickers:v,shouldSuggestCustomEmoji:w}=e.settings.byKey,b=e.emojiKeywords[o.pRL],y=I!==o.pRL?e.emojiKeywords[I]:void 0,P=p?p.id:void 0,Z=P?(0,l.hj)(e,a,P):void 0,{currentUserId:C}=e,S=c?.fullInfo?c?.fullInfo?.sendAsId||C:void 0,E=c?.sendAsPeerIds&&S&&(c.sendAsPeerIds.some((e=>e.id===S))?S:c?.adminRights?.anonymous?c?.id:void 0),M=E?(0,l.dy)(e,E):void 0,R=!M&&E?(0,l.Z1)(e,E):void 0,k=(0,l.uH)(e,a),T=(0,l.nA)(e,a),A=(0,l.Bt)(e),N=a===A?.chatId&&s===A?.threadId&&i===A?.type,x=(0,l.dy)(e,a),B=null===(n=x&&!x.fullInfo?.noVoiceMessages)||void 0===n||n,L="scheduled"===i?(0,l.hI)(e,a):(0,l.s)(e,a,s),U=(0,l.Yy)(e,a,s),j=(0,l.jU)(e);return{isOnActiveTab:!j.isBlurred,editingMessage:(0,l.kK)(e,a,s,i),connectionState:e.connectionState,replyingToId:U,draft:(0,l.Ms)(e,a,s),chat:c,isChatWithBot:u,isChatWithSelf:h,isForCurrentMessageList:N,canScheduleUntilOnline:(0,l.Eh)(e,a),isChannel:c?(0,m.eA)(c):void 0,isRightColumnShown:(0,l.Jf)(e,r),isSelectModeActive:(0,l.CA)(e),withScheduledButton:"thread"===i&&Boolean(f?.length),shouldSchedule:"scheduled"===i,botKeyboardMessageId:P,botKeyboardPlaceholder:Z?.keyboardPlaceholder,isForwarding:a===j.forwardMessages.toChatId,pollModal:j.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:c?.fullInfo?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:C,lastSyncTime:e.lastSyncTime,contentToBeScheduled:j.contentToBeScheduled,shouldSuggestStickers:v,shouldSuggestCustomEmoji:w,recentEmojis:e.recentEmojis,baseEmojiKeywords:b?.keywords,emojiKeywords:y?.keywords,inlineBots:j.inlineBots.byUsername,isInlineBotLoading:j.inlineBots.isLoading,chatBotCommands:c?.fullInfo&&c.fullInfo.botCommands,botCommands:d?.fullInfo?d.fullInfo.botInfo?.commands||!1:void 0,botMenuButton:d?.fullInfo?.botInfo?.menuButton,sendAsUser:M,sendAsChat:R,sendAsId:E,editingDraft:L,requestedDraftText:k,requestedDraftFiles:T,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,l.t)(e,a),theme:(0,l.Pu)(e),fileSizeLimit:(0,ae.M)(e,"uploadMaxFileparts")*o.pJM,captionLimit:(0,ae.M)(e,"captionLength"),isCurrentUserPremium:(0,l.wV)(e),canSendVoiceByPrivacy:B,attachmentSettings:e.attachmentSettings}}))((e=>{let{isOnActiveTab:t,dropAreaState:n,shouldSchedule:r,canScheduleUntilOnline:d,isReady:l,isMobile:h,onDropHide:g,editingMessage:p,chatId:f,threadId:I,messageListType:v,draft:y,chat:P,isForCurrentMessageList:Z,isCurrentUserPremium:C,canSendVoiceByPrivacy:S,connectionState:E,isChatWithBot:M,isChatWithSelf:R,isChannel:k,fileSizeLimit:T,isRightColumnShown:A,isSelectModeActive:N,isForwarding:B,pollModal:L,botKeyboardMessageId:U,botKeyboardPlaceholder:j,withScheduledButton:O,stickersForEmoji:F,customEmojiForEmoji:_,groupChatMembers:D,topInlineBotIds:q,currentUserId:$,captionLimit:H,lastSyncTime:G,contentToBeScheduled:V,shouldSuggestStickers:z,shouldSuggestCustomEmoji:W,baseEmojiKeywords:X,emojiKeywords:Y,recentEmojis:K,inlineBots:J,isInlineBotLoading:Q,botCommands:ee,chatBotCommands:te,sendAsUser:ne,sendAsChat:ae,sendAsId:se,editingDraft:oe,replyingToId:ie,requestedDraftText:re,requestedDraftFiles:de,botMenuButton:le,attachBots:ue,attachMenuPeerType:me,attachmentSettings:he,theme:ge}=e;const{sendMessage:pe,clearDraft:fe,showDialog:Ie,forwardMessages:ve,openPollModal:we,closePollModal:be,loadScheduledHistory:ye,openChat:Pe,addRecentEmoji:Ze,sendInlineBotResult:Ce,loadSendAs:Se,resetOpenChatWithDraft:Ee,callAttachBot:Me,addRecentCustomEmoji:Re,showNotification:ke,showAllowedMessageTypesNotification:Te}=(0,a.Sv)(),Ae=(0,At.Z)(),Ne=(0,i.sO)(null),xe=(0,i.sO)(null),[Be,Le]=(0,Nn.Z)(""),Ue=(0,vr.Z)(o.Edp),Oe=(0,i.sO)(),Fe=(0,kn.Z)(n),{width:_e}=je.Z.get(),De=P?.sendAsPeerIds,qe=De&&(De.length>1||!De.some((e=>e.id===$))),[$e,He,Ge]=(0,Rt.Z)(),Ve=(0,Ti.Z)(f,I);(0,i.d4)(Ci.AU,[Be]);const ze=(0,i.sO)(0),We=(0,i.I4)((()=>{Ge()}),[Ge]),[Xe,Ye]=(0,pr.Z)(d,We);(0,i.d4)((()=>{Oe.current=void 0}),[f]),(0,i.d4)((()=>{f&&G&&l&&ye({chatId:f})}),[l,f,ye,G,I]),(0,i.d4)((()=>{f&&P&&G&&!De&&l&&(0,m.ZV)(P)&&Se({chatId:f})}),[P,f,l,G,Se,De]);const Ke=(0,i.sO)(!1);(0,ut.Z)((e=>{let[t,n]=e;Ke.current=Boolean(f===t&&De&&!n)}),[f,De]),(0,i.bt)((()=>{Ne.current&&(Ne.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[Je,Qe]=(0,i.eJ)([]),et=Boolean(Je.length),{canSendStickers:tt,canSendGifs:nt,canAttachMedia:at,canAttachPolls:ot,canAttachEmbedLinks:it,canSendVoices:rt,canSendPlainText:mt,canSendAudios:ht,canSendVideos:gt,canSendPhotos:pt,canSendDocuments:ft}=(0,i.Ye)((()=>(0,m.H5)(P,M)),[P,M]),It=!mt&&!p,{shouldSuggestCompression:wt,shouldForceCompression:bt,shouldForceAsFile:yt,handleAppendFiles:Pt,handleFileSelect:Zt,onCaptionUpdate:Ct,handleClearAttachments:St,handleSetAttachments:Mt}=function(e){let{attachments:t,fileSizeLimit:n,setHtml:s,setAttachments:o,chatId:r,canSendAudios:c,canSendVideos:d,canSendPhotos:l,canSendDocuments:m}=e;const{openLimitReachedModal:h,showAllowedMessageTypesNotification:g}=(0,a.Sv)(),[p,f]=(0,i.eJ)(!1),[I,v]=(0,i.eJ)(!1),[w,b]=(0,i.eJ)(void 0),y=(0,i.I4)((()=>{o(u.D)}),[o]),P=(0,i.I4)((e=>{const a="function"==typeof e?e(t):e;if(a.length)if(a.some((e=>{const t=Ir(e);return"audio"===t&&!c&&!m||"video"===t&&!d&&!m||"image"===t&&!l&&!m||"file"===t&&!m})))g({chatId:r});else if(a.some((e=>{let{size:t}=e;return t>n})))h({limit:"uploadMaxFileparts"});else{o(a);const e=a.some((e=>{const t=Ir(e);return"audio"===t&&!c||"video"===t&&!d||"image"===t&&!l}));f(Boolean(e&&m)),v(!m)}else y()}),[t,c,m,l,d,r,n,y,h,o,g]);return{shouldSuggestCompression:w,handleAppendFiles:(0,i.I4)((async(e,n)=>{P([...t,...await Promise.all(e.map((e=>Ii(e.name,e,{shouldSendAsSpoiler:n||void 0}))))])}),[t,P]),handleFileSelect:(0,i.I4)((async(e,t)=>{P(await Promise.all(e.map((e=>Ii(e.name,e))))),b(t)}),[P]),onCaptionUpdate:s,handleClearAttachments:y,handleSetAttachments:P,shouldForceCompression:I,shouldForceAsFile:p}}({attachments:Je,setHtml:Le,setAttachments:Qe,fileSizeLimit:T,chatId:f,canSendAudios:ht,canSendVideos:gt,canSendPhotos:pt,canSendDocuments:ft}),[kt,Tt,Nt]=(0,Rt.Z)(),[xt,Bt,Lt]=(0,Rt.Z)(),[Ut,jt,Ot]=(0,Rt.Z)(),[Ft,_t,qt]=(0,Rt.Z)(),[$t,Ht,Gt]=(0,Rt.Z)(),[zt,Wt,Xt]=(0,Rt.Z)(),{startRecordingVoice:Yt,stopRecordingVoice:Kt,pauseRecordingVoice:Jt,activeVoiceRecording:Qt,currentRecordTime:en,recordButtonRef:tn,startRecordTimeRef:nn}=(()=>{const e=(0,i.sO)(null),[t,n]=(0,i.eJ)(),a=(0,i.sO)(),[o,r]=(0,i.eJ)();(0,i.d4)((()=>{s.s$&&s.mh&&_i()}),[]);const c=(0,i.I4)((async()=>{try{const{stop:t,pause:s}=await Di((t=>{e.current&&(a.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),r(Date.now()))}));a.current=Date.now(),r(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}}),[]),d=(0,i.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),l=(0,i.I4)((()=>{if(t){n(void 0),a.current=void 0,r(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,i.d4)((()=>t?(0,Et.Z)(l):void 0),[t,l]),{startRecordingVoice:c,pauseRecordingVoice:d,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:o,recordButtonRef:e,startRecordTimeRef:a}})();(0,vt.Z)((()=>{Ve({type:"recordAudio"})}),Qt&&o.o_S),(0,i.d4)((()=>{Qt||Ve({type:"cancel"})}),[Qt,Ve]);const an=(0,Ea.Y)(Boolean(p));(0,i.d4)((()=>{Be()&&!an.current&&Ve({type:"typing"})}),[Be,an,Ve]);const sn=P&&(0,m.Nl)(P),on=(0,m.Hd)(P),{isEmojiTooltipOpen:rn,closeEmojiTooltip:cn,filteredEmojis:dn,filteredCustomEmojis:ln,insertEmoji:un}=(0,or.Z)(Boolean(l&&t&&Z&&z&&!et),Be,Le,void 0,K,X,Y),{isCustomEmojiTooltipOpen:mn,closeCustomEmojiTooltip:hn,insertCustomEmoji:gn}=(0,fr.Z)(Boolean(l&&t&&Z&&W&&!et),Be,Le,Ue,xe,_),{isStickerTooltipOpen:pn,closeStickerTooltip:fn}=function(e,t,n){const{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),[d,l,u]=(0,Rt.Z)(!1),m=(0,Ri.Z)((()=>{const n=t();if(!e||!n||s.op&&n.length>8)return;if(!n.match(s.op?Ei.Z:o.t8f))return;const a=(0,Mi._)(n);return a&&(s.op&&1===(0,Si.Z)(a)||!s.op&&Boolean(n.match(ki)))?s.op?a:a.match(/alt="(.+)"/)?.[1]:void 0}),[t,e]),h=(0,Ln.Z)((()=>Boolean(m())),[m]),g=Boolean(n?.length);return(0,i.d4)((()=>{if(!e)return;const t=m();t?g||r({emoji:t}):c()}),[e,m,g,r,c]),(0,i.d4)(u,[u,t]),{isStickerTooltipOpen:Boolean(h&&g&&!d),closeStickerTooltip:l}}(Boolean(l&&t&&Z&&z&&tt&&!et),Be,F),{isMentionTooltipOpen:In,closeMentionTooltip:vn,insertMention:wn,mentionFilteredUsers:bn}=(0,ir.Z)(Boolean(l&&Z&&!et),Be,Le,Ue,xe,D,q,$),{isOpen:yn,botId:Pn,isGallery:Zn,switchPm:Sn,results:En,closeTooltip:Mn,help:Rn,loadMore:Tn}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r,resetAllInlineBots:c}=(0,a.Sv)(),[d,l,u]=(0,Rt.Z)(!1),m=(0,ar.C)((()=>{const t=n();return e&&t.startsWith("@")?function(e){if(!e.startsWith("@"))return ur;const t=function(e){return mr.innerHTML=e.replace(/<br>/g,"\n"),mr.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),mr.innerText}(e),n=t.match(dr);return n?hr(n[1],n[2],""===n[2]&&!t.match(lr)):ur}(t):ur}),[n,e],cr),{username:h,query:g,canShowHelp:p,usernameLowered:f}=(0,Ln.Z)(m,[m,n],!0);(0,ut.Z)((e=>{let[t]=e;t&&r({username:t})}),[h,r]),(0,i.d4)((()=>{f&&o({chatId:t,username:f,query:g})}),[t,g,o,f]),(0,i.d4)(u,[u,n]);const{id:I,switchPm:v,offset:w,results:b,isGallery:y,help:P}=f&&s?.[f]||{},Z=Boolean((b?.length||v)&&!d);(0,i.d4)((()=>{Z||h||c()}),[Z,c,h]);const C=(0,i.I4)((()=>{f&&o({chatId:t,username:f,query:g,offset:w})}),[t,w,g,o,f]);return{isOpen:Z,botId:I,isGallery:y,switchPm:v,results:b,closeTooltip:l,help:p&&P?`@${h} ${P}`:void 0,loadMore:C}}(Boolean(l&&Z&&!et&&G),f,Be,J),{isOpen:An,close:xn,filteredBotCommands:Bn}=function(e,t,n,a){const[s,o]=(0,i.eJ)(),[r,c,d]=(0,Rt.Z)(!1),l=(0,ar.C)((()=>{const n=t();return e&&n.startsWith("/")?(0,Mi._)(n).match(gr)?.[0].trim():void 0}),[t,e],300),u=(0,Ri.Z)(l,[l,t],!0);return(0,i.d4)((()=>{const e=u(),t=n||a;if(!e||!t)return void o(void 0);const s=e.substring(1),i=t.filter((e=>!s||e.command.startsWith(s)));o(i?.length?i:void 0)}),[u,n,a]),(0,i.d4)(d,[d,t]),{isOpen:Boolean(s?.length&&!r),close:c,filteredBotCommands:s}}(Boolean(l&&Z&&(ee&&ee?.length||te?.length)),Be,ee,te),Un=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;if(t===o.R2F&&It)return;const n=window.getSelection();let a;if(a=t===o.R2F?document.querySelector(o.Edp):document.getElementById(t),n.rangeCount){const s=n.getRangeAt(0);if((0,yi.R)(s,t))return(0,bi.tx)(e),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Le(`${Be()}${e}`),requestAnimationFrame((()=>{(0,hi.Z)(a)}))}),[It,Be,Le]),jn=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,eo.z)(e);Un(n,t)}),[Un]),On=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;Un((0,Ja.yR)(e),t)}),[Un]);((e,t,n,r,d,l,u)=>{const{saveDraft:m,clearDraft:h,loadCustomEmojis:g}=(0,a.Sv)(),p=Boolean(l),f=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(p||!u)return;const s=r();var o,i,c,d;s?m({chatId:null!==(o=e.chatId)&&void 0!==o?o:t,threadId:null!==(i=e.threadId)&&void 0!==i?i:n,draft:(0,b.ZP)(s),shouldForce:a}):h({chatId:null!==(c=e.chatId)&&void 0!==c?c:t,threadId:null!==(d=e.threadId)&&void 0!==d?d:n,shouldForce:a})}),[t,n,p,u,r,m,h]),I=(0,i.I4)((()=>{f(void 0,!0)}),[f]),v=(0,Ea.Y)(f),w=(0,Ma.Z)(o.r_R,!0,void 0,[t,n]);(0,ct.Z)((a=>{let[i,r,u]=a;if(t===i&&n===r&&(!e&&u&&d(""),!e?.shouldForce))return;if(l||!e)return;d((0,eo.z)(e));const m=e.entities?.map((e=>e.type===c.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];m.length&&g({ids:m}),s.$b||requestAnimationFrame((()=>{const e=document.querySelector(o.Edp);e&&(0,hi.Z)(e,!0)}))}),[t,n,e,d,l,g]),(0,i.d4)((()=>()=>{p||v.current({chatId:t,threadId:n}),wr=!0,requestAnimationFrame((()=>{wr=!1}))}),[t,n,p,v]);const y=(0,Ea.Y)(t),P=(0,Ea.Y)(n);(0,i.d4)((()=>{if(wr)return;if(!r())return void v.current();const e=y.current,t=P.current;w((()=>{y.current===e&&P.current===t&&v.current()}))}),[y,r,w,P,v]),(0,dt.Z)(I),lt(I)})(y,f,I,Be,Le,p,G);const _n=(0,i.I4)((function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||Le(""),Qe(u.D),cn(),hn(),fn(),vn(),h?setTimeout((()=>Ot()),350):Ot()}),[Le,h,fn,hn,vn,cn,Ot]),[Dn,qn,$n]=((e,t,n,s,r,c,d,l,u,h,g)=>{const{editMessage:p,setEditingDraft:f,toggleMessageWebPage:I}=(0,a.Sv)(),[v,w]=(0,i.eJ)(!1);(0,ct.Z)((e=>{let[a,s]=e;if(!n)return;if(g&&s!==g)return t(""),void w(!1);if(a?.id===n.id&&g===s)return;const i=!a&&h?.text.length?h:n.content.text,r=(0,eo.z)(i);t(r),w(!0),requestAnimationFrame((()=>{const e=document.querySelector(o.Edp);e&&(0,hi.Z)(e,!0)}))}),[n,g,h,t]),(0,i.d4)((()=>{if(!n)return;const e=!("webPage"in n.content)&&n.content.text?.entities?.some((e=>sr.has(e.type)));I({chatId:c,threadId:d,noWebPage:e})}),[c,d,n]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,b.ZP)(e()),n=t.text.length?t:void 0;f({chatId:c,threadId:d,type:l,text:n})}}),[c,n,e,f,d,l]);const y=(0,ar.i)((()=>{if(!n)return!1;const t=(0,b.ZP)(e());return!("webPage"in n.content)&&n.content.text?.entities?.some((e=>sr.has(e.type)))&&!t.entities?.some((e=>sr.has(e.type)))}),[n,e],300,!0),P=(0,Ri.Z)(y,[y,e],!0);(0,ct.Z)((e=>{let[t]=e;n&&t?.id===n.id&&P()&&I({chatId:c,threadId:d,noWebPage:!1})}),[n,c,e,d,P]);const Z=(0,i.I4)((()=>{u&&(0,x.T2)((()=>{t((0,eo.z)(u));const e=document.querySelector(o.Edp);e&&requestAnimationFrame((()=>{(0,hi.Z)(e,!0)}))}))}),[u,t]),C=(0,i.I4)((()=>{s(),Z()}),[s,Z]),S=(0,i.I4)((()=>{const{text:t,entities:a}=(0,b.ZP)(e());n&&(t||(0,m.u8)(n)?(p({text:t,entities:a}),s(),Z()):r())}),[p,n,e,r,s,Z]),E=(0,i.I4)((()=>{if(!n)return;const t=(0,b.ZP)(e()),a=t.text.length?t:void 0;f({chatId:c,threadId:d,type:l,text:a})}),[c,n,e,f,d,l]);return(0,dt.Z)(E),lt(E),[S,C,v]})(Be,Le,p,_n,Ht,f,I,v,y,oe,ie),Hn=(0,Ea.Y)(_n),Gn=(0,Ea.Y)(Kt);(0,i.d4)((()=>()=>{Gn.current(),Hn.current()}),[f,I,Hn,Gn]);const Vn=(0,i.I4)((()=>{const e=ze.current;ke(e?{message:Ae("UnlockPremiumEmojiHint2"),action:{action:"openChat",payload:{id:$,shouldReplaceHistory:!0}},actionText:Ae("Open")}:{message:Ae("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:Ae("PremiumMore")}),ze.current=Number(!e)}),[$,Ae,ke]),zn=(0,Ln.Z)((()=>p&&$n?Kr.Edit:!s.mh||Qt||B||Be()&&!et?r?Kr.Schedule:Kr.Send:Kr.Record),[Qt,p,Be,et,B,$n,r]),Wn=!r,{isContextMenuOpen:Xn,handleContextMenu:Yn,handleContextMenuClose:Kn,handleContextMenuHide:Jn}=(0,ua.Z)(tn,!(zn===Kr.Send&&Wn));nr(Z,jn,Mt,p,!C&&!R,Vn);const Qn=(0,i.I4)((()=>{p&&qn()}),[p,qn]),ea=(0,i.I4)(((e,t)=>{const n=t?H:4096;if(e?.length>n){const t=e.length-n;return Ie({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":t.toString(),"{PLURAL_S}":t>1?"s":""},hasErrorKey:!0}}),!1}return!0}),[H,Ie]),ta=(0,i.I4)((()=>{if(on&&!sn){const e=document.querySelector(o.Edp),t=(0,w.bp)(),n=Oe.current&&Math.floor(t-Oe.current),a=on.nextSendDate&&on.nextSendDate>t;if(n&&n<on.seconds||a){const s=a?on.nextSendDate-t:on.seconds-n;return Ie({data:{message:Ae("SlowModeHint",(0,ce.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),e?.blur(),!1}}return!0}),[sn,Ae,Ie,on]),na=(0,i.I4)((e=>{let{attachments:t,sendCompressed:n=he.shouldCompress,sendGrouped:a=he.shouldSendGrouped,isSilent:s,scheduledAt:o}=e;if("connectionStateReady"!==E)return;const{text:i,entities:r}=(0,b.ZP)(Be());(i||t.length)&&ea(i,!0)&&ta()&&(pe({text:i,entities:r,scheduledAt:o,isSilent:s,shouldUpdateStickerSetsOrder:!0,attachments:vi(t,n),shouldGroupMessages:a}),Oe.current=(0,w.bp)(),fe({chatId:f,localOnly:!0}),requestAnimationFrame((()=>{_n()})))}),[he.shouldCompress,he.shouldSendGrouped,E,Be,ea,ta,pe,fe,f,_n]),aa=(0,i.I4)(((e,t,n,a)=>{na({attachments:Je,sendCompressed:e,sendGrouped:t,isSilent:n,scheduledAt:a})}),[Je,na]),sa=(0,i.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==E)return;let n=Je;if(Qt){const e=await Kt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await Ii("wonderful-voice-message.ogg",t,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:i}=(0,b.ZP)(Be());if(n.length)return void na({attachments:n});if(!a&&!B)return;if(!ea(a))return;const r=document.querySelector(o.Edp);if(a){if(!ta())return;pe({text:a,entities:i,scheduledAt:t,isSilent:e,shouldUpdateStickerSetsOrder:!0})}B&&ve({scheduledAt:t,isSilent:e}),Oe.current=(0,w.bp)(),fe({chatId:f,localOnly:!0}),s.cj&&r&&r===document.activeElement&&Zi(r),requestAnimationFrame((()=>{_n()}))}),[E,Je,Qt,Be,B,ea,fe,f,Kt,na,ta,pe,ve,_n]),oa=(0,i.I4)((()=>{"webApp"===le?.type&&Me({chatId:f,url:le.url,threadId:I})}),[le,Me,f,I]),ia=(0,i.I4)((()=>{Ot(),Bt()}),[Ot,Bt]),ra=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:a,isSilent:s}=e;return void Ce({id:n,queryId:a,scheduledAt:t,isSilent:s})}const{isSilent:n,...a}=e||{};if(e&&0!==Object.keys(a).length)if(void 0!==e.sendCompressed||void 0!==e.sendGrouped){const{sendCompressed:a=!1,sendGrouped:s=!1}=e;aa(a,s,n,t)}else pe({...e,scheduledAt:t});else sa(Boolean(n),t)}),[aa,sa,Ce,pe]);(0,ct.Z)((e=>{let[t]=e;V&&V!==t&&Xe((e=>{ra(V,e)}))}),[V,ra,Xe]),(0,i.d4)((()=>{re&&(Le(re),Ee(),requestAnimationFrame((()=>{const e=document.getElementById(o.R2F);(0,hi.Z)(e,!0)})))}),[re,Ee,Le]),(0,i.d4)((()=>{de?.length&&(Zt(de),Ee())}),[Zt,de,Ee]);const ca=(0,i.I4)(((e,t)=>{e.isFree||C||R?On(e,t):Vn()}),[On,R,C,Vn]),da=(0,i.I4)((e=>{ca(e,o.nYf)}),[ca]),la=(0,i.I4)(((e,t,n)=>{r||n?(He(),Xe((n=>{Ge(),ra({gif:e,isSilent:t},n),requestAnimationFrame((()=>{_n(!0)}))}))):(pe({gif:e,isSilent:t}),requestAnimationFrame((()=>{_n(!0)})))}),[r,He,Xe,Ge,ra,_n,pe]),ma=(0,i.I4)((function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0;e={...e,isPreloadedGlobally:!0},r||n?(He(),Xe((n=>{Ge(),ra({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{_n(a)}))}))):(pe({sticker:e,isSilent:t,shouldUpdateStickerSetsOrder:s}),requestAnimationFrame((()=>{_n(a)})))}),[r,He,Xe,Ge,ra,_n,pe]),ha=(0,i.I4)(((e,t,n)=>{if("connectionStateReady"!==E)return;r||n?Xe((n=>{ra({id:e.id,queryId:e.queryId,isSilent:t},n)})):Ce({id:e.id,queryId:e.queryId,isSilent:t});const a=document.querySelector(o.Edp);s.cj&&a&&a===document.activeElement&&Zi(a),fe({chatId:f,localOnly:!0}),requestAnimationFrame((()=>{_n()}))}),[f,fe,E,ra,Xe,_n,Ce,r]),ga=(0,i.I4)((()=>{fe({chatId:f,localOnly:!0}),requestAnimationFrame((()=>{_n()}))}),[f,fe,_n]),pa=(0,i.I4)((e=>{r?(Xe((t=>{ra({poll:e},t)})),be()):(pe({poll:e}),be())}),[be,ra,Xe,pe,r]),fa=(0,i.I4)((e=>{if(r)Xe((t=>{ra({...e,isSilent:!0},t)}));else if(e&&("sendCompressed"in e||"sendGrouped"in e)){const{sendCompressed:t=!1,sendGrouped:n=!1}=e;aa(t,n,!0)}else sa(!0)}),[ra,sa,aa,Xe,r]),Ia=(0,i.I4)((()=>{const e=document.querySelector(o.Edp);if(!h||e!==document.activeElement)return Lt(),Ot(),void _t();e?.blur(),setTimeout((()=>{Lt(),Ot(),_t()}),100)}),[Lt,Ot,_t,h]),va=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,Fn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Un(n,t)}),[Un]);(0,i.d4)((()=>{It&&Le("")}),[It,Le,Je]);const wa=(0,i.I4)((e=>{va(e,o.nYf)}),[va]),ba=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.R2F;const t=window.getSelection();if(t.rangeCount){const n=t.getRangeAt(0);if((0,yi.R)(n,e))return void document.execCommand("delete",!1)}Le(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 a=n.textContent.length,s=document.createRange(),o=window.getSelection();s.setStart(n,a),s.setEnd(n,a),o.removeAllRanges(),o.addRange(s),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(Be()))}),[Be,Le]),ya=(0,i.I4)((()=>{ba(o.nYf)}),[ba]),Pa=(0,i.I4)((()=>{Pe({id:f,threadId:I,type:"scheduled",noForumTopicPanel:!0})}),[Pe,f,I]);(0,i.d4)((()=>{A&&h&&Ot()}),[A,Ot,h]),(0,i.d4)((()=>{l&&(N?Wt():setTimeout((()=>{Xt()}),200))}),[N,Xt,Wt,l]);const Za=!(zn!==Kr.Record||at&&S&&rt),Ca=(0,i.I4)((()=>{switch(zn){case Kr.Send:sa();break;case Kr.Record:Za?S?rt||Te({chatId:f}):ke({message:Ae("VoiceMessagesRestrictedByPrivacy",P?.title)}):Yt();break;case Kr.Edit:Dn();break;case Kr.Schedule:Qt&&Jt(),Xe((e=>{ra({},e)}))}}),[zn,sa,Dn,Qt,Xe,Za,S,ke,Ae,P?.title,Yt,Jt,ra,f,Te,rt]),Sa=(0,kn.Z)(p,!0),Ra=p||Sa,ka=new Date;ka.setSeconds(0),ka.setMilliseconds(0);const Ta=new Date;Ta.setFullYear(Ta.getFullYear()+1);let Aa="SendMessage";switch(zn){case Kr.Edit:Aa="Save edited message";break;case Kr.Record:Aa=at?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const Na=(0,st.Z)("Composer",!N&&"shown",zt&&"hover-disabled"),xa=(0,i.I4)((()=>{Xe((e=>{ra({},e)}))}),[ra,Xe]),Ba=(0,i.I4)((()=>{fa()}),[fa]),La=(0,i.I4)(((e,t)=>{Xe((n=>{ra({sendCompressed:e,sendGrouped:t},n)}))}),[ra,Xe]),Ua=(0,i.I4)(((e,t)=>{fa({sendCompressed:e,sendGrouped:t})}),[fa]),ja=zn===Kr.Edit?Dn:zn===Kr.Schedule?xa:sa,Oa=M&&"webApp"===le?.type&&!p,Fa=(0,Ln.Z)((()=>Oa&&!Be()&&!Qt),[Oa,Be,Qt]),_a=M&&"commands"===le?.type&&!p&&!1!==ee&&!Qt;return i.ZP.createElement("div",{className:Na},at&&l&&i.ZP.createElement(Gr,{isOpen:n!==Cn.t.None,withQuick:n===Cn.t.QuickFile||Fe===Cn.t.QuickFile,onHide:g,onFileSelect:Zt}),i.ZP.createElement(qr,{chatId:f,threadId:I,canShowCustomSendMenu:Wn,attachments:Je,getHtml:Be,isReady:l,shouldSuggestCompression:wt,shouldForceCompression:bt,shouldForceAsFile:yt,isForCurrentMessageList:Z,shouldSchedule:r,onCaptionUpdate:Ct,onSendSilent:Ua,onSend:aa,onSendScheduled:La,onFileAppend:Pt,onClear:St,onAttachmentsUpdate:Mt,onCustomEmojiSelect:da,onRemoveSymbol:ya,onEmojiSelect:wa}),i.ZP.createElement(Hr,{isOpen:L.isOpen,isQuiz:L.isQuiz,shouldBeAnonymous:k,onClear:be,onSend:pa}),Ra&&i.ZP.createElement(br,{isOpen:$t,isSchedule:"scheduled"===v,onClose:Gt,message:Ra}),i.ZP.createElement(Wr,{isOpen:Ft,onClose:qt,chatId:f,selectedSendAsId:se,sendAsPeerIds:De,isCurrentUserPremium:C}),i.ZP.createElement(Ar,{isOpen:In,filteredUsers:bn,onInsertUserName:wn,onClose:vn}),i.ZP.createElement(Ur,{isOpen:An,withUsername:Boolean(te),botCommands:Bn,getHtml:Be,onClick:ga,onClose:xn}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:Ne}),i.ZP.createElement(Tr,{isOpen:yn,botId:Pn,isGallery:Zn,inlineBotResults:En,switchPm:Sn,loadMore:Tn,isSavedMessages:R,canSendGifs:nt,isCurrentUserPremium:C,onSelectResult:ha,onClose:Mn}),i.ZP.createElement(Dr,{onClear:Qn,shouldForceShowEditing:Boolean($n&&p)}),i.ZP.createElement(zr,{chatId:f,threadId:I,getHtml:Be,isDisabled:!it||et}),i.ZP.createElement("div",{className:"message-input-wrapper"},Oa&&i.ZP.createElement(Xr,{isOpen:Fa,text:le.text,isDisabled:Boolean(Qt),onClick:oa}),_a&&i.ZP.createElement(yr.Z,{className:(0,st.Z)("bot-commands",xt&&"activated"),round:!0,disabled:void 0===ee,color:"translucent",onActivate:ia,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),qe&&(ne||ae)&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",onClick:Ft?qt:Ia,ariaLabel:Ae("SendMessageAsTitle"),className:(0,st.Z)("send-as-button",Ke.current&&"appear-animation")},i.ZP.createElement(vs.Z,{user:ne,chat:ae,size:"tiny"})),(!It||nt||tt)&&i.ZP.createElement(Yr.Z,{chatId:f,threadId:I,isMobile:h,isReady:l,isSymbolMenuOpen:Ut,openSymbolMenu:jt,closeSymbolMenu:Ot,canSendStickers:tt,canSendGifs:nt,onGifSelect:la,onStickerSelect:ma,onCustomEmojiSelect:ca,onRemoveSymbol:ba,onEmojiSelect:va,closeBotCommandMenu:Lt,closeSendAsMenu:qt,isSymbolMenuForced:$e,canSendPlainText:!It}),i.ZP.createElement(Or.Z,{ref:xe,id:"message-input-text",editableInputId:o.R2F,chatId:f,canSendPlainText:!It,threadId:I,isActive:!et,getHtml:Be,placeholder:Qt&&_e<=600?"":It?Ae("Chat.PlaceholderTextNotAllowed"):j||Ae("Message"),forcedPlaceholder:Rn,canAutoFocus:l&&Z&&!et,noFocusInterception:et,shouldSuppressFocus:h&&Ut,shouldSuppressTextFormatter:rn||In||yn,onUpdate:Le,onSend:ja,onSuppressedFocus:Ot}),Q&&Boolean(Pn)&&i.ZP.createElement(Vt.Z,{color:"gray"}),O&&i.ZP.createElement(Dt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Pa,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),Boolean(U)&&!Qt&&!p&&i.ZP.createElement(yr.Z,{className:kt?"activated":"",round:!0,color:"translucent",onActivate:Tt,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),Qt&&Boolean(en)&&i.ZP.createElement("span",{className:"recording-state"},(0,ce.rM)(en-nn.current)),i.ZP.createElement(kr,{chatId:f,threadId:I,isButtonVisible:!Qt&&!p,canAttachMedia:at,canAttachPolls:ot,canSendPhotos:pt,canSendVideos:gt,canSendDocuments:ft,canSendAudios:ht,onFileSelect:Zt,onPollCreate:we,isScheduled:r,attachBots:ue,peerType:me,theme:ge}),Boolean(U)&&i.ZP.createElement(jr,{messageId:U,isOpen:kt,onClose:Nt}),ee&&i.ZP.createElement($r,{isOpen:xt,botCommands:ee,onClose:Lt}),i.ZP.createElement(Br.Z,{chatId:f,isOpen:mn,onCustomEmojiSelect:gn,addRecentCustomEmoji:Re,onClose:hn}),i.ZP.createElement(xr,{chatId:f,threadId:I,isOpen:pn,onStickerSelect:ma,onClose:fn}),i.ZP.createElement(Lr.Z,{isOpen:rn,emojis:dn,customEmojis:ln,addRecentEmoji:Ze,addRecentCustomEmoji:Re,onEmojiSelect:un,onCustomEmojiSelect:un,onClose:cn}))),Qt&&i.ZP.createElement(Dt.Z,{round:!0,color:"danger",className:"cancel",onClick:Kt,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(Dt.Z,{ref:tn,round:!0,color:"secondary",className:(0,st.Z)(zn,!l&&"not-ready",Qt&&"recording"),disabled:Za,allowDisabledClick:!0,ariaLabel:Ae(Aa),onClick:Ca,onContextMenu:zn===Kr.Send&&Wn?Yn:void 0},i.ZP.createElement("i",{className:"icon-send"}),i.ZP.createElement("i",{className:"icon-schedule"}),i.ZP.createElement("i",{className:"icon-microphone-alt"}),i.ZP.createElement("i",{className:"icon-check"})),Wn&&i.ZP.createElement(Nr.Z,{isOpen:Xn,onSendSilent:R?void 0:Ba,onSendSchedule:r?void 0:xa,onClose:Kn,onCloseAnimationEnd:Jn,isSavedMessages:R}),Ye)}))),Qr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,bt.Z)(rt.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),ec=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,bt.Z)(rt.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),tc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),nc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),ac=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,bt.Z)(rt.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),sc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),oc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0})),ic=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"MessageLanguageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function rc(e){return"file"===e.kind&&e.type&&o.oGt.has(e.type)}const cc=450+o.fK3,dc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const a=(0,l.Pu)(e),{isBlurred:s,background:i,backgroundColor:r,patternColor:d}=e.settings.themes[a]||{},{messageLists:u,isLeftColumnShown:h,activeEmojiInteractions:g,seenByModal:p,giftPremiumModal:f,reactorModal:I,audioPlayer:v,shouldSkipHistoryAnimations:w,messageLanguageModal:b}=(0,l.jU)(e),y=(0,l.Bt)(e),{chats:{listIds:P},lastSyncTime:Z}=e,C={theme:a,customBackground:i,backgroundColor:r,patternColor:d,isLeftColumnShown:h,isRightColumnShown:(0,l.Jf)(e,n),isBackgroundBlurred:s,hasCurrentTextSearch:Boolean((0,l.n5)(e)),isSelectModeActive:(0,l.CA)(e),isSeenByModalOpen:Boolean(p),isReactorListModalOpen:Boolean(I),isGiftPremiumModalOpen:f?.isOpen,isMessageLanguageModalOpen:Boolean(b),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,u.length-1),activeEmojiInteractions:g,lastSyncTime:Z};if(!y||!P.active)return C;const{chatId:S,threadId:E,type:M}=y,R=(0,m.YC)(S),k=(0,l.Z1)(e,S),T=(0,l.IK)(e,S),A=(0,l.KB)(e,S,E),{chatId:N,messageId:x}=v,B=(0,l.tZ)(e,S,E),L=Boolean(B?.originChannelId),U=k&&(0,m.Qm)(k,E,L),j=(0,l.pk)(e,S),O="pinned"===M,F="scheduled"===M,_="thread"===M&&E===c._f,D=Boolean(k&&(0,m.eA)(k)),q=Boolean(k&&_&&(D||(0,m.ZV)(k))&&k.isNotJoined&&!k.joinRequests),$=Boolean(k?.isNotJoined&&k.isJoinToSend),H=Boolean(k?.isNotJoined&&k.isJoinRequest),G=Boolean(T&&(0,l.s4)(e,T.id)),V=!G&&j,z=Boolean(k&&(0,m.Bf)(k)&&!k.fullInfo&&Z),W=(0,l.Yy)(e,S,E),X=!!k?.isForum&&E===c._f&&!W&&k.topics?.[o.OxA]?.isClosed,Y=N&&x?(0,l.hj)(e,N,x):void 0;return{...C,chatId:S,threadId:E,messageListType:M,chat:k,replyingToId:W,isPrivate:R,areChatSettingsLoaded:Boolean(k?.settings),canPost:!O&&(!k||U)&&!j&&!($&&k?.isNotJoined)&&!X,isPinnedMessageList:O,isScheduledMessageList:F,currentUserBannedRights:k?.currentUserBannedRights,defaultBannedRights:k?.defaultBannedRights,hasPinned:E!==c._f&&!k?.isForum||Boolean(!O&&A?.length),hasAudioPlayer:Boolean(Y),pinnedMessagesCount:A?A.length:0,shouldSkipHistoryAnimations:w,isChannel:D,canSubscribe:q,canStartBot:V,canRestartBot:G,shouldJoinToSend:$,shouldSendJoinRequest:H,shouldLoadFullChat:z,pinnedIds:A}}))((e=>{let{chatId:t,threadId:n,messageListType:r,isMobile:c,chat:d,replyingToId:u,isPrivate:h,isPinnedMessageList:g,canPost:p,currentUserBannedRights:f,defaultBannedRights:I,hasPinned:w,hasAudioPlayer:b,pinnedMessagesCount:y,customBackground:P,theme:Z,backgroundColor:C,patternColor:E,isLeftColumnShown:M,isRightColumnShown:R,isBackgroundBlurred:k,hasCurrentTextSearch:T,isSelectModeActive:A,isSeenByModalOpen:N,isReactorListModalOpen:x,isGiftPremiumModalOpen:B,isMessageLanguageModalOpen:L,animationLevel:U,shouldSkipHistoryAnimations:j,currentTransitionKey:O,isChannel:F,areChatSettingsLoaded:_,canSubscribe:D,canStartBot:q,canRestartBot:$,activeEmojiInteractions:H,shouldJoinToSend:G,shouldSendJoinRequest:V,shouldLoadFullChat:z,lastSyncTime:W,pinnedIds:X}=e;const{openChat:Y,openPreviousChat:K,unpinAllMessages:J,loadUser:Q,loadChatSettings:ee,closeLocalTextSearch:te,exitMessageSelectMode:ne,joinChannel:ae,sendBotCommand:se,restartBot:oe,showNotification:ie,loadFullChat:re}=(0,a.Sv)(),{width:ce}=(0,Mn.Z)(),{isTablet:de}=(0,S.ZP)(),le=(0,At.Z)(),[ue,me]=(0,i.eJ)(Cn.t.None),[he,ge]=(0,i.eJ)(),[pe,fe]=(0,i.eJ)(),[Ie,ve]=(0,i.eJ)(!1),{onIntersectionChanged:we,onFocusPinnedMessage:be,getCurrentPinnedIndexes:ye,getLoadingPinnedId:Pe,getForceNextPinnedInHeader:Ze}=function(e,t,n){const[s,o]=(0,Nn.Z)({}),[r,c]=(0,Nn.Z)(),d=(0,i.sO)(),[u,m]=(0,Nn.Z)(),h=e?`${e}_${t}`:void 0;return(0,i.d4)((()=>{c(void 0),d.current=void 0,m(void 0)}),[e,o,c,m,t]),(0,i.d4)((()=>{if(!h)return;const e=s()[h],t=n?.length||0;e>=t&&o({...s(),[h]:Math.max(0,t-1)})}),[s,h,n?.length,o]),{onIntersectionChanged:(0,i.I4)((i=>{let{viewportPinnedIdsToAdd:g=[],viewportPinnedIdsToRemove:p=[],isReversed:f,hasScrolled:I,isUnmount:w}=i;if(!e||!t||!h)return;const b=(0,a.Rd)();if(!n?.length||!n)return;const y=u();if(y&&!I){const e=n.indexOf(y);o({...s(),[h]:e}),m(void 0)}I&&(c(void 0),m(void 0));const P=r(),Z=d.current;if(w&&0===g.length&&1===p.length&&!Z?.includes(p[0]))return;const C=(0,v.Tw)((Z?.filter((e=>!p.includes(e)))||[]).concat(g));d.current=C;const S=(0,l.G$)(b,e);if(!C.length&&w&&S&&!n.includes(S)){const e=n.find((e=>e<S));if(e){const t=n.indexOf(e);o({...s(),[h]:t})}}if(P||w)return;const E=Math.max(...C),M=n.findIndex((e=>e===E)),R=f?0:1,k=C.length?M:Z?.length?(0,Tn.uZ)(n.indexOf(Z[0])+R,0,n.length-1):0;o({...s(),[h]:k})}),[e,t,h,n,u,r,o,s,m,c]),onFocusPinnedMessage:(0,i.I4)((i=>{if(!e||!t||!h||u())return!1;const r=(0,a.Rd)();if(!n?.length)return!1;const d=n.indexOf(i),g=(0,An.Z)(n.length,d+1);c(!0);const p=(0,l.gb)(r,e,t);return p?.includes(i)||(0,l.of)(r,e,t,i)?(o({...s(),[h]:g}),!0):(m(n[g]),!0)}),[e,s,u,h,n,o,c,m,t]),getCurrentPinnedIndexes:s,getLoadingPinnedId:u,getForceNextPinnedInHeader:r}}(t,n,X),Ce=c&&T,Se=c?cc:void 0,Ee=w&&(ce<o.l35||R&&ce>o._mX&&ce<o.QU1||ce>=o.ksF&&ce<o.jT7&&b),Me=(0,Rn.Z)(t,Se),Re=(0,Rn.Z)(n,Se),ke=(0,Rn.Z)(r,Se),Te=(0,Rn.Z)(D,Se),je=(0,Rn.Z)(q,Se),Oe=(0,Rn.Z)($,Se),Fe=(0,Rn.Z)(p,Se)&&!Oe&&!je&&!Te&&t!==o.mzl,_e=(0,Rn.Z)(Ee,Se),De=(0,Rn.Z)(he,Se)&&t!==o.mzl,qe=(0,Rn.Z)(F,Se),$e=(0,Rn.Z)(G,Se),He=(0,Rn.Z)(V,Se),Ge=(0,Rn.Z)(t?we:void 0,Se),Ve=(0,kn.Z)(O),ze=void 0!==Ve&&Ve<O?Ve:void 0,{isReady:We,handleCssTransitionEnd:Xe,handleSlideTransitionStop:Ye}=function(e,t,n,a,s){const[o,r]=(0,i.eJ)(!s),c=(0,pt.Z)(),d=void 0!==n&&n!==t;return d&&(e?(r(!1),setTimeout((()=>{r(!0)}),cc)):c()),(0,ut.Z)((()=>{e||r(!0)}),[e]),{isReady:o&&!d,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideTransitionStop:e?function(){r(!0)}:void 0}}(!j&&U!==o.oBh,O,Ve,t,c);(0,i.d4)((()=>t?(0,Et.Z)((()=>{Y({id:void 0})})):void 0),[t,Y]),(0,ut.Z)((()=>{me(Cn.t.None),fe(void 0)}),[t]),(0,i.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,i.d4)((()=>{h&&Q({userId:t})}),[t,h,Q]),(0,i.d4)((()=>{!_&&W&&ee({chatId:t})}),[t,h,_,W,ee]),(0,i.d4)((()=>{t&&z&&We&&re({chatId:t})}),[z,t,We,re]);const Ke=(0,i.I4)((e=>{const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(rc);me(n?Cn.t.QuickFile:Cn.t.Document)}),[]),Je=(0,i.I4)((()=>{me(Cn.t.None)}),[]),Qe=(0,i.I4)((()=>{ve(!0)}),[]),et=(0,i.I4)((()=>{ve(!1)}),[]),tt=(0,i.I4)((()=>{J({chatId:t,threadId:n}),et(),K()}),[J,t,n,et,K]),nt=(0,i.I4)((()=>{Y({id:t})}),[Y,t]),at=(0,i.I4)((()=>{ae({chatId:t}),He&&ie({message:le(F?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[ae,t,He,ie,F,le]),ot=(0,i.I4)((()=>{se({command:"/start"})}),[se]),it=(0,i.I4)((()=>{oe({chatId:t})}),[t,oe]),rt=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):Sn.fetch(o.foQ,e,Sn.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,En.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(Z,P),ct=(0,st.Z)(_e&&"has-header-tools",s.aZ?"mask-image-disabled":"mask-image-enabled"),dt=(0,st.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",P&&"Ik9ZZlj3eKtKXRrUZKVk",C&&"avVozLQe3SaWcSkIt6pG",P&&k&&"Tipa66fYcSvl6w0587Xz",R&&"vhOr8s3T_LCKSt2BF7fs"),lt=(0,st.Z)("messaging-disabled",!A&&"shown"),mt=(0,m.q8)(le,f,I),ht=(0,m.mt)(le,d,n,Boolean(u)),gt=mt||ht,{composerHiddenScale:ft,toolbarHiddenScale:It,composerTranslateX:vt,toolbarTranslateX:wt,unpinHiddenScale:bt,toolbarForUnpinHiddenScale:yt}=(0,i.Ye)((()=>function(e,t){const n=e<=o.l35?Ae.Gw:2*Ae.Gw,a=function(e){if(e>o._mX){const t=Math.min(Math.max(.25*e,Le),Be),n=Math.min(.25*e,Be);return Math.min(e-t-n,xe)}if(e>o.ksF){const t=Math.min(Math.max(.4*e,Le),Be);return Math.min(e-t,xe)}return e>xe?xe:e}(e),s=e<=o.l35?3.375*Ae.Gw:4*Ae.Gw,i=t?a-n-s:a-n,r=e>o.l35?Math.min(a-n,Ne):a-n,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?s/2*d:0,toolbarTranslateX:t?s/2*-1*c:0,unpinHiddenScale:r/Ue,toolbarForUnpinHiddenScale:Ue/r}}(ce,Fe)),[Fe,ce]),Pt=(0,st.Z)("middle-column-footer",!Fe&&"no-composer",Fe&&pe&&!A&&"with-notch");(0,sn.Z)({isActive:A,onBack:ne}),(0,sn.Z)({isActive:Ce,onBack:te});const Zt=Boolean(!g&&!Fe&&!Oe&&!je&&!Te&&gt),Ct=Boolean(Oe||Te||He||je||g),St=Boolean(Zt||A||g);return i.ZP.createElement("div",{id:"MiddleColumn",className:ct,onTransitionEnd:Xe,style:`\n --composer-hidden-scale: ${ft};\n --toolbar-hidden-scale: ${It};\n --unpin-hidden-scale: ${bt};\n --toolbar-unpin-hidden-scale: ${yt};\n --composer-translate-x: ${vt}px;\n --toolbar-translate-x: ${wt}px;\n --pattern-color: ${E};\n --theme-background-color:\n ${C||("dark"===Z?o.Itv:o.p3h)};\n `,onClick:de&&M?nt:void 0},i.ZP.createElement("div",{className:dt,style:rt?`--custom-background: ${rt}`:void 0}),i.ZP.createElement("div",{id:"middle-column-portals"}),Boolean(Me&&Re)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"messages-layout",onDragEnter:Fe?Ke:void 0},i.ZP.createElement(wa,{chatId:Me,threadId:Re,messageListType:ke,isReady:We,isMobile:c,getCurrentPinnedIndexes:ye,getLoadingPinnedId:Pe,onFocusPinnedMessage:be}),i.ZP.createElement(Tt.Z,{name:j?"none":U===o.zy8?"slide":"fade",activeKey:O,shouldCleanup:!0,cleanupExceptionKey:ze,onStop:Ye},i.ZP.createElement(di,{key:`${Me}-${Re}-${ke}`,chatId:Me,threadId:Re,type:ke,canPost:Fe,hasTools:_e,onFabToggle:ge,onNotchToggle:fe,isReady:We,withBottomShift:Ct,withDefaultBg:Boolean(!P&&!C),onPinnedIntersectionChange:Ge,getForceNextPinnedInHeader:Ze}),i.ZP.createElement("div",{className:Pt},Fe&&i.ZP.createElement(Jr,{chatId:Me,threadId:Re,messageListType:ke,dropAreaState:ue,onDropHide:Je,isReady:We,isMobile:c}),g&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Qe},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,le("Chat.Pinned.UnpinAll",y,"i")))),Zt&&i.ZP.createElement("div",{className:lt},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,gt))),c&&(Te||$e&&!He)&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:at},le(qe?"ProfileJoinChannel":"ProfileJoinGroup"))),c&&He&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:at},le("ChannelJoinRequest"))),c&&je&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ot},le("BotStart"))),c&&Oe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(Dt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:it},le("BotRestart"))),i.ZP.createElement(ec,{messageListType:ke,isActive:A,canPost:Fe}),i.ZP.createElement(nc,{isOpen:N}),i.ZP.createElement(sc,{isOpen:x}),i.ZP.createElement(ic,{isOpen:L}))),i.ZP.createElement(mi,{isShown:De,canPost:Fe,withExtraShift:St})),c&&i.ZP.createElement(Qr,{isActive:Boolean(Ce)})),t&&i.ZP.createElement(tc,{isOpen:Ie,chatId:t,pinnedMessagesCount:y,onClose:et,onUnpin:tt}),i.ZP.createElement("div",{teactFastList:!0},H?.map(((e,t)=>i.ZP.createElement(ac,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(oc,{isOpen:B}))}))),lc=450+o.fK3,uc=(0,x.Ds)((e=>e()),200,!1);var mc=function(e){return 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",e}(mc||{});const hc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,isProfile:a,isManagement:s,threadId:o}=t;const i=(0,l.jU)(e),{query:r}=(0,l.n5)(e)||{},{query:d}=(0,l.y5)(e)||{},{query:u}=(0,l.yN)(e)||{},h=n?(0,l.Z1)(e,n):void 0,g=a&&n&&(0,m.YC)(n)?(0,l.dy)(e,n):void 0,p=h&&(0,m.eA)(h),f=h?.isForum&&Boolean(o&&o!==c._f),I=f?h.topics?.[o]:void 0,v=f&&I&&(0,m.GU)(h,I),w=g&&(0,m.cS)(g),b=g&&(0,m.kw)(g),y=Boolean(!s&&a&&!b&&h&&!(0,l.FM)(e,h.id)&&((0,m.YC)(h.id)||((0,m.Nl)(h)||h.isCreator)&&!h.isNotJoined)),P=Boolean(n&&i.management.byChatId[n]?.editingInvite),Z=!f&&h?.fullInfo?.canViewStatistics,C=n?i.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:y,canAddContact:b,canViewStatistics:Z,isChannel:p,isBot:w,isInsideTopic:f,canEditTopic:v,userId:g?.id,messageSearchQuery:r,stickerSearchQuery:d,gifSearchQuery:u,isEditingInvite:P,currentInviteInfo:C,shouldSkipHistoryAnimations:i.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,threadId:s,isColumnOpen:o,isProfile:r,isSearch:c,isManagement:d,isStatistics:l,isMessageStatistics:u,isStickerSearch:m,isGifSearch:h,isPollResults:g,isCreatingTopic:p,isEditingTopic:f,isAddingChatMembers:v,profileState:w,managementScreen:b,canAddContact:y,userId:P,canManage:Z,isChannel:C,onClose:E,onScreenSelect:M,messageSearchQuery:R,stickerSearchQuery:k,gifSearchQuery:T,isEditingInvite:A,canViewStatistics:N,currentInviteInfo:x,shouldSkipHistoryAnimations:B,isBot:L,isInsideTopic:U,canEditTopic:j}=e;const{setLocalTextSearchQuery:O,setStickerSearchQuery:F,setGifSearchQuery:_,searchTextMessagesLocal:D,toggleManagement:q,openHistoryCalendar:$,openAddContactDialog:H,toggleStatistics:G,setEditingExportedInvite:V,deleteExportedChatInvite:z,openEditTopicPanel:W}=(0,a.Sv)(),[X,Y,K]=(0,Rt.Z)(),{isMobile:J}=(0,S.ZP)(),Q=(0,i.I4)((()=>{V({chatId:n,invite:x}),M(I.u1.EditInvite)}),[n,x,M,V]),ee=(0,i.I4)((()=>{z({chatId:n,link:x.link}),M(I.u1.Invites),K()}),[n,K,x,z,M]),te=(0,i.I4)((e=>{O({query:e}),e.length&&uc(D)}),[D,O]),ne=(0,i.I4)((e=>{F({query:e})}),[F]),ae=(0,i.I4)((e=>{_({query:e})}),[_]),se=(0,i.I4)((()=>{H({userId:P})}),[H,P]),oe=(0,i.I4)((()=>{n&&s&&W({chatId:n,topicId:s})}),[n,W,s]),ie=(0,i.I4)((()=>{q()}),[q]),re=(0,i.I4)((()=>{G()}),[G]),[de,le]=(0,i.eJ)(!o);(0,i.d4)((()=>{setTimeout((()=>{le(!o)}),lc)}),[o]);const ue=(0,At.Z)(),me=r?w===I.vi.Profile?mc.Profile:w===I.vi.SharedMedia?mc.SharedMedia:w===I.vi.MemberList?mc.MemberList:-1:c?mc.Search:g?mc.PollResults:m?mc.StickerSearch:h?mc.GifSearch:v?mc.AddingMembers:d?b===I.u1.Initial?mc.ManageInitial:b===I.u1.ChatPrivacyType?mc.ManageChatPrivacyType:b===I.u1.Discussion?mc.ManageDiscussion:b===I.u1.ChannelSubscribers?mc.ManageChannelSubscribers:b===I.u1.GroupPermissions?mc.ManageGroupPermissions:b===I.u1.ChatAdministrators?mc.ManageChatAdministrators:b===I.u1.GroupRemovedUsers?mc.ManageGroupRemovedUsers:b===I.u1.ChannelRemovedUsers?mc.ManageChannelRemovedUsers:b===I.u1.GroupUserPermissionsCreate?mc.ManageGroupUserPermissionsCreate:b===I.u1.GroupUserPermissions?mc.ManageGroupUserPermissions:b===I.u1.GroupRecentActions?mc.ManageGroupRecentActions:b===I.u1.ChatAdminRights?mc.ManageGroupAdminRights:b===I.u1.ChatNewAdminRights?mc.ManageGroupNewAdminRights:b===I.u1.GroupMembers?mc.ManageGroupMembers:b===I.u1.Invites?mc.ManageInvites:b===I.u1.EditInvite?mc.ManageEditInvite:b===I.u1.GroupAddAdmins?mc.ManageGroupAddAdmins:b===I.u1.Reactions?mc.ManageReactions:b===I.u1.InviteInfo?mc.ManageInviteInfo:b===I.u1.JoinRequests?mc.ManageJoinRequests:void 0:l?mc.Statistics:u?mc.MessageStatistics:p?mc.CreateTopic:f?mc.EditTopic:void 0,he=null!==(t=(0,Bn.Z)(me,!0))&&void 0!==t?t:-1,ge=J||me===mc.SharedMedia||me===mc.MemberList||me===mc.AddingMembers||me===mc.MessageStatistics||d,pe=(0,st.Z)("animated-close-icon",ge&&"state-back",(de||B)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(Dt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:E,ariaLabel:ue(ge?"Common.Back":"Common.Close")},i.ZP.createElement("div",{className:pe})),i.ZP.createElement(Tt.Z,{name:de||B?"none":"slide-fade",activeKey:he},function(){if(-1!==he)switch(he){case mc.PollResults:return i.ZP.createElement("h3",null,ue("PollResults"));case mc.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(qt.Z,{parentContainerClassName:"RightSearch",value:R,onChange:te}),i.ZP.createElement(Dt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>$({selectedAt:(0,ce._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon-calendar"})));case mc.AddingMembers:return i.ZP.createElement("h3",null,ue(C?"ChannelAddSubscribers":"GroupAddMembers"));case mc.ManageInitial:return i.ZP.createElement("h3",null,ue("Edit"));case mc.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ue(C?"ChannelTypeHeader":"GroupTypeHeader"));case mc.ManageDiscussion:return i.ZP.createElement("h3",null,ue("Discussion"));case mc.ManageChatAdministrators:return i.ZP.createElement("h3",null,ue("ChannelAdministrators"));case mc.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ue("Group.Info.AdminLog"));case mc.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ue("EditAdminRights"));case mc.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ue("SetAsAdmin"));case mc.ManageGroupPermissions:return i.ZP.createElement("h3",null,ue("ChannelPermissions"));case mc.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ue("BlockedUsers"));case mc.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ue("ChannelBlockedUsers"));case mc.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ue("ChannelAddException"));case mc.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ue("UserRestrictions"));case mc.ManageInvites:return i.ZP.createElement("h3",null,ue("lng_group_invite_title"));case mc.ManageEditInvite:return i.ZP.createElement("h3",null,ue(A?"EditLink":"NewLink"));case mc.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ue("InviteLink")),i.ZP.createElement("section",{className:"tools"},x&&!x.isRevoked&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:Q},i.ZP.createElement("i",{className:"icon-edit"})),x&&x.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Dt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:Y},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement($n.Z,{isOpen:X,onClose:K,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:ee}))));case mc.ManageJoinRequests:return i.ZP.createElement("h3",null,ue(C?"SubscribeRequests":"MemberRequests"));case mc.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ue("Channel.Management.AddModerator"));case mc.StickerSearch:return i.ZP.createElement(qt.Z,{value:k,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case mc.GifSearch:return i.ZP.createElement(qt.Z,{value:T,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:ae});case mc.Statistics:return i.ZP.createElement("h3",null,ue(C?"ChannelStats.Title":"GroupStats.Title"));case mc.MessageStatistics:return i.ZP.createElement("h3",null,ue("Stats.MessageTitle"));case mc.SharedMedia:return i.ZP.createElement("h3",null,ue("SharedMedia"));case mc.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ue("ChannelSubscribers"));case mc.MemberList:case mc.ManageGroupMembers:return i.ZP.createElement("h3",null,ue("GroupMembers"));case mc.ManageReactions:return i.ZP.createElement("h3",null,ue("Reactions"));case mc.CreateTopic:return i.ZP.createElement("h3",null,ue("NewTopic"));case mc.EditTopic:return i.ZP.createElement("h3",null,ue("EditTopic"));default:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ue(U?"AccDescrTopic":C?"Channel.TitleInfo":P?L?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),i.ZP.createElement("section",{className:"tools"},y&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("AddContact"),onClick:se},i.ZP.createElement("i",{className:"icon-add-user"})),Z&&!U&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},i.ZP.createElement("i",{className:"icon-edit"})),j&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},i.ZP.createElement("i",{className:"icon-edit"})),N&&i.ZP.createElement(Dt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:re},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var gc=n(91);var pc=n(27407);function fc(e,t,n,a){const[s,i]=(0,pc.Z)(n?t:void 0,a,void 0,o.Vk);return[s,i,!(!s||!a||s[0]===a[0])]}function Ic(e,t,n,a,s,r,c){const d=(0,i.sO)();(0,ut.Z)((()=>{d.current=void 0}),[c]),(0,ut.Z)((()=>{t===e&&s&&r&&(d.current=(0,m.R5)(s,r,e))}),[s,r,t,e]);const[l,u]=(0,pc.Z)(a?n:void 0,d.current,void 0,"media"===e?o.ENB:o.pnA);return[l,u,!(!l||!d.current||l[0]===d.current[0])]}const vc=(0,x.P2)((e=>e()),250,!1);let wc=!1;var bc=n(21273),yc=n(31876),Pc=n(16568),Zc=n(70180),Cc=n(13709),Sc=n(45418),Ec=n(47262),Mc=n(41151),Rc=n(22275);const kc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],Tc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,topicId:a,isMobile:s}=t;const o=(0,l.Z1)(e,n),i=(0,l.Zw)(e,n),{currentType:r,resultsByType:c}=(0,l.we)(e)||{},{foundIds:d}=c&&r&&c[r]||{},{byId:u,statusesById:h}=e.users,{byId:g}=e.chats,p=o&&(0,m.Bf)(o),f=o&&(0,m.eA)(o),I=!a&&(p||f&&(0,m.Nl)(o)),v=o?.fullInfo?.members,w=o?.fullInfo?.adminMembersById,b=I&&o&&(o.isForbidden||o.fullInfo&&!o.fullInfo.canViewMembers),y=I&&o&&((0,m.VE)(o,"inviteUsers")||!(0,m.Mg)(o,"inviteUsers")||o.isCreator),P=I&&o&&((0,m.VE)(o,"banUsers")||o.isCreator),Z=(0,l.xs)(e,n);let C,S,E;return(0,m.YC)(n)&&(S=n,E=(0,l.dy)(e,S),C=E&&!E.isSelf&&!(0,m.cS)(E)),{theme:(0,l.Pu)(e),isChannel:f,resolvedUserId:S,messagesById:i,foundIds:d,mediaSearchType:r,hasCommonChatsTab:C,hasMembersTab:I,areMembersHidden:b,canAddMembers:y,canDeleteMembers:P,currentUserId:e.currentUserId,isRightColumnShown:(0,l.Jf)(e,s),isRestricted:o?.isRestricted,lastSyncTime:e.lastSyncTime,activeDownloadIds:Z,usersById:u,userStatusesById:h,chatsById:g,isChatProtected:o?.isProtected,...I&&v&&{members:v,adminMembersById:w},...C&&E&&{commonChatIds:E.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:n,profileState:r,onProfileStateChange:d,theme:l,isChannel:u,resolvedUserId:h,currentUserId:g,messagesById:p,foundIds:f,mediaSearchType:v,hasCommonChatsTab:w,hasMembersTab:b,areMembersHidden:y,canAddMembers:P,canDeleteMembers:Z,commonChatIds:C,members:S,adminMembersById:E,usersById:M,userStatusesById:R,chatsById:k,isRightColumnShown:T,isRestricted:A,lastSyncTime:N,activeDownloadIds:x,isChatProtected:B}=e;const{setLocalMediaSearchType:L,loadMoreMembers:U,loadCommonChats:j,openChat:O,searchMediaMessagesLocal:F,openMediaViewer:_,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:$,setNewChatMembersDialogState:H}=(0,a.Sv)(),G=(0,i.sO)(null),V=(0,i.sO)(null),z=(0,At.Z)(),[W,X]=(0,i.eJ)(0),[Y,K]=(0,i.eJ)(),J=(0,i.Ye)((()=>[...b?[{type:"members",title:u?"ChannelSubscribers":"GroupMembers"}]:[],...kc,...n?[]:[{type:"voice",title:"SharedVoiceTab2"}],...w?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[w,b,u,n]),Q=W>J.length-1?J.length-1:W,ee=J[Q].type,[te,ne,ae,se]=function(e,t,n,a,s,o,r,c,d,l,u,h,g,p){const f="members"!==a&&s?s:a,I=(0,i.Ye)((()=>{if(o&&c&&d)return(0,m.Z0)(o.map((e=>{let{userId:t}=e;return t})),c,d)}),[o,c,d]),v=(0,i.Ye)((()=>{if(r&&l)return(0,m.ih)(r,l,!0)}),[l,r]),[w,b,y]=fc(0,e,g,I),[P,Z,C]=Ic("media",f,n,g,u,h,p),[S,E,M]=Ic("documents",f,n,g,u,h,p),[R,k,T]=Ic("links",f,n,g,u,h,p),[A,N,x]=Ic("audio",f,n,g,u,h,p),[B,L,U]=Ic("voice",f,n,g,u,h,p),[j,O,F]=fc(0,t,g,v);let _,D,q=!1;switch(f){case"members":_=w,D=b,q=y;break;case"commonChats":_=j,D=O,q=F;break;case"media":_=P,D=Z,q=C;break;case"documents":_=S,D=E,q=M;break;case"links":_=R,D=k,q=T;break;case"audio":_=A,D=N,q=x;break;case"voice":_=B,D=L,q=U}return[f,_,D,q]}(U,j,F,ee,v,S,C,M,R,k,p,f,N,n),oe="members"===te||!b&&"media"===te,ie=J.findIndex((e=>{let{type:t}=e;return t===te})),{handleScroll:re}=function(e,t,n,a){(0,ct.Z)((n=>{let[s]=n;if(s&&s!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?I.vi.MemberList:I.vi.SharedMedia),wc=!0,(0,Sa.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{wc=!1}),350))}}),[t,a,e]),(0,ct.Z)((t=>{let[s]=t;if(n!==I.vi.Profile||n===s)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(wc=!0,(0,Sa.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{wc=!1}),350),a(n))}),[n,e,a]);const s=(0,i.I4)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let o=I.vi.Profile;n.scrollTop>=s.offsetTop&&(o="members"===t?I.vi.MemberList:I.vi.SharedMedia),a(o)}),[e,a,t]);return(0,i.d4)((()=>{wc||s()}),[s,t]),{handleScroll:(0,i.I4)((()=>{wc||vc(s)}),[s])}}(G,te,r,d),{applyTransitionFix:ce,releaseTransitionFix:de}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";return(0,i.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");a&&s&&(a.style.minHeight=n.offsetHeight-s.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]),{applyTransitionFix:(0,i.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.paddingRight=`${e}px`}}),[e]),releaseTransitionFix:(0,i.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}),[e])}}(G),[le,ue]=(()=>{const[e,t]=(0,i.eJ)(0);return[e,(0,i.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:me}=(0,Ba.S1)({rootRef:G,throttleMs:500}),he=(0,i.I4)((()=>{de(),ue()}),[de,ue]),ge=(0,i.I4)((()=>{H({newChatMembersProgress:I.WB.InProgress})}),[H]);(0,i.d4)((()=>{L({mediaType:ee})}),[L,ee,n]);const pe=h||t;(0,i.d4)((()=>{N&&$({profileId:pe})}),[$,pe,N]);const fe=(0,i.I4)((e=>{_({chatId:pe,threadId:c._f,mediaId:e,origin:I.bZ.SharedMedia})}),[pe,_]),Ie=(0,i.I4)((e=>{D({chatId:pe,messageId:e})}),[pe,D]),ve=(0,i.I4)((e=>{O({id:e})}),[O]),we=(0,i.I4)((e=>{q({chatId:pe,messageId:e})}),[pe,q]),be=(0,i.I4)((()=>{K(void 0)}),[]);let ye;(0,ct.Z)((e=>{let[t]=e;if(0===W||t===b)return;const n=W+(b?1:-1);X(Math.min(n,J.length-1))}),[b,W,J]),(0,i.d4)((()=>{if(V.current&&s.$b)return(0,an.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===an.eM.Left?(X(Math.min(Q+1,J.length-1)),!0):t===an.eM.Right&&(X(Math.max(0,Q-1)),!0)})}),[Q,J.length]),oe?ye=T?0:1e3:ne||(ye=o.Yan);const Pe=(0,Dn.Z)([t,n,te,Q],ye);return i.ZP.createElement(bc.Z,{ref:G,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition__slide--active.${te}-list > .scroll-item`,items:Pe?ne:void 0,cacheBuster:le,sensitiveArea:o.qUX,preloadBackwards:Pe?"members"===te?o.Vk:o.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:ae,onScroll:re},!se&&function(e,t,n){return i.ZP.createElement("div",{className:"profile-info"},i.ZP.createElement(Pc.Z,{userId:t||e,canPlayVideo:n}),i.ZP.createElement(Zc.Z,{chatOrUserId:t||e}))}(t,h,T&&Pe),!A&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(Tt.Z,{ref:V,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ie,renderCount:J.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ce,onStop:he},function(){if(!ne||!Pe||!p){const e=oe&&!Pe,t=Boolean("members"===te&&y);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(Vt.Z,null),t&&i.ZP.createElement(Ec.Z,{text:"You have no access to group members list."}))}if(!ne.length){let e;switch(te){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=z("NoGroupsInCommon");break;case"documents":e=z("lng_media_file_empty");break;case"links":e=z("lng_media_link_empty");break;case"audio":e=z("lng_media_song_empty");break;case"voice":e=z("lng_media_audio_empty");break;default:e=z("SharedMedia.EmptyTitle")}return i.ZP.createElement("div",{className:"content empty-list"},i.ZP.createElement(Ec.Z,{text:e}))}return i.ZP.createElement("div",{className:`content ${te}-list`,dir:z.isRtl&&"media"===te?"rtl":void 0,teactFastList:!0},"media"===te?ne.map((e=>p[e]&&i.ZP.createElement(Cc.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:me,onClick:fe}))):"documents"===te?ne.map((e=>p[e]&&i.ZP.createElement(Es.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:x.includes(e),observeIntersection:me,onDateClick:we}))):"links"===te?ne.map((e=>p[e]&&i.ZP.createElement(Sc.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:me,onMessageClick:we}))):"audio"===te?ne.map((e=>p[e]&&i.ZP.createElement(Ms.ZP,{key:e,theme:l,message:p[e],origin:I.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!p[e].isProtected,isDownloading:x.includes(e)}))):"voice"===te?ne.map((e=>p[e]&&i.ZP.createElement(Ms.ZP,{key:e,theme:l,message:p[e],senderTitle:(0,gc.F)(z,p[e],k,M),origin:I.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!p[e].isProtected,isDownloading:x.includes(e)}))):"members"===te?ne.map(((e,t)=>{return i.ZP.createElement(yc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>ve(e),contextActions:(n=e,n!==g&&Z?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{K(n)}}]:void 0)},i.ZP.createElement(Un.Z,{userId:e,adminMember:E?.[e],forceShowSelf:!0}));var n})):"commonChats"===te?ne.map(((e,t)=>i.ZP.createElement(yc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>O({id:e})},i.ZP.createElement(jn.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(on.Z,{big:!0,activeTab:Q,tabs:J,onSwitchTab:X})),P&&i.ZP.createElement(Mc.Z,{isShown:"members"===te,onClick:ge,ariaLabel:z("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon-add-user-filled"})),Z&&i.ZP.createElement(Rc.Z,{isOpen:Boolean(Y),userId:Y,onClose:be}))}))),Ac=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),Nc=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),xc=e=>{const t=(0,bt.Z)(rt.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)},Bc=e=>{const t=(0,bt.Z)(rt.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)},Lc=(0,i.X$)((()=>{const e=(0,bt.Z)(rt.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(dn.Z,null)})),Uc=(0,i.X$)((()=>{const e=(0,bt.Z)(rt.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(dn.Z,null)})),jc=(0,i.X$)((()=>{const e=(0,bt.Z)(rt.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(dn.Z,null)}));var Oc=n(11820);const Fc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,l.Z1)(e,n),{userIds:s}=e.contactList||{},{byId:o}=e.chats,{newChatMembersProgress:i}=(0,l.jU)(e),{currentUserId:r}=e,c=a&&(0,m.eA)(a),{query:d,fetchingStatus:u,globalUserIds:h,localUserIds:g}=(0,l.jU)(e).userSearch;return{isChannel:c,members:a?.fullInfo?.members,currentUserId:r,chatsById:o,localContactIds:s,searchQuery:d,isSearching:u,isLoading:i===I.WB.Loading,globalUserIds:h,localUserIds:g}}))((e=>{let{isChannel:t,members:n,onNextStep:s,currentUserId:o,chatsById:r,localContactIds:c,isLoading:d,searchQuery:l,isSearching:u,localUserIds:h,globalUserIds:g,onClose:p,isActive:f}=e;const{setUserSearchQuery:I}=(0,a.Sv)(),w=(0,At.Z)(),[b,y]=(0,i.eJ)([]),P=(0,kn.Z)(b)===b;(0,sn.Z)({isActive:f,onBack:p});const Z=(0,i.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),C=(0,i.I4)((e=>{I({query:e})}),[I]),S=(0,i.Ye)((()=>{const e=(0,a.Rd)().users.byId,n=c?(0,m.kK)(c,e,l):[];return(0,m.ih)((0,v.Tw)([...n,...h||[],...g||[]]).filter((n=>{const a=e[n];return!Z.includes(n)&&n!==o&&(!a||!(0,m.cS)(a)||!t&&a.canBeInvitedToGroup)})),r)}),[c,r,l,h,g,o,Z,t]),E=(0,i.I4)((()=>{b.length&&(I({query:""}),s(b))}),[b,I,s]);return i.ZP.createElement("div",{className:"AddChatMembers"},i.ZP.createElement("div",{className:"AddChatMembers-inner"},i.ZP.createElement(Oc.Z,{itemIds:S,selectedIds:b,filterValue:l,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:u,onSelectedIdsChange:y,onFilterChange:C,noScrollRestore:P}),i.ZP.createElement(Mc.Z,{isShown:Boolean(b.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:E},d?i.ZP.createElement(Vt.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),_c=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"CreateTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),Dc=(0,i.X$)((e=>{const t=(0,bt.Z)(rt.gl.Extra,"EditTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(dn.Z,null)})),qc=450+o.fK3,$c=Object.keys(I.qt).length/2,Hc=Object.keys(I.u1).length/2;function Gc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Vc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{chatId:a,threadId:s}=(0,l.Bt)(e)||{},o=(0,l.g4)(e),{management:i,shouldSkipHistoryAnimations:r}=(0,l.jU)(e),d=a?i.byChatId[a]?.nextScreen:void 0,u=(a?(0,l.Z1)(e,a)?.isForum:void 0)&&Boolean(s&&s!==c._f);return{contentKey:(0,l.Wq)(e,n),chatId:a,threadId:s,isInsideTopic:u,isChatSelected:Boolean(a&&o),shouldSkipHistoryAnimations:r,nextManagementScreen:d}}))((e=>{var t;let{contentKey:n,chatId:s,threadId:r,isMobile:c,isInsideTopic:d,isChatSelected:l,shouldSkipHistoryAnimations:u,nextManagementScreen:m}=e;const{toggleChatInfo:h,toggleManagement:g,closeLocalTextSearch:p,setStickerSearchQuery:f,setGifSearchQuery:v,closePollResults:w,addChatMembers:b,setNewChatMembersDialogState:y,setEditingExportedInvite:P,toggleStatistics:Z,toggleMessageStatistics:C,setOpenedInviteInfo:S,requestNextManagementScreen:E,closeCreateTopicPanel:M,closeEditTopicPanel:R}=(0,a.Sv)(),{width:k}=(0,Mn.Z)(),[T,A]=(0,i.eJ)(I.vi.Profile),[N,x]=(0,i.eJ)(I.u1.Initial),[B,L]=(0,i.eJ)(),[U,j]=(0,i.eJ)(),O=T!==I.vi.Profile,F=void 0!==n,_=n===I.qt.ChatInfo,D=n===I.qt.Search,q=n===I.qt.Management,$=n===I.qt.Statistics,H=n===I.qt.MessageStatistics,G=n===I.qt.StickerSearch,V=n===I.qt.GifSearch,z=n===I.qt.PollResults,W=n===I.qt.AddingMembers,X=n===I.qt.CreateTopic,Y=n===I.qt.EditTopic,K=k<=o._mX,[J,Q]=(0,i.eJ)(!F),ee=null!==(t=(0,Bn.Z)(n,!0,!l))&&void 0!==t?t:-1,te=(0,i.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case I.qt.AddingMembers:y({newChatMembersProgress:I.WB.Closed});break;case I.qt.ChatInfo:if(O&&e){A(I.vi.Profile);break}h({force:!1},{forceSyncOnIOs:!0});break;case I.qt.Management:switch(N){case I.u1.Initial:g();break;case I.u1.ChatPrivacyType:case I.u1.Discussion:case I.u1.GroupPermissions:case I.u1.GroupType:case I.u1.ChatAdministrators:case I.u1.ChannelSubscribers:case I.u1.GroupMembers:case I.u1.Invites:case I.u1.Reactions:case I.u1.JoinRequests:case I.u1.ChannelRemovedUsers:x(I.u1.Initial);break;case I.u1.GroupUserPermissionsCreate:case I.u1.GroupRemovedUsers:case I.u1.GroupUserPermissions:x(I.u1.GroupPermissions),L(void 0),j(void 0);break;case I.u1.ChatAdminRights:case I.u1.ChatNewAdminRights:case I.u1.GroupAddAdmins:case I.u1.GroupRecentActions:x(I.u1.ChatAdministrators);break;case I.u1.EditInvite:case I.u1.InviteInfo:x(I.u1.Invites),S({chatId:s,invite:void 0}),P({chatId:s,invite:void 0})}break;case I.qt.MessageStatistics:C();break;case I.qt.Statistics:Z();break;case I.qt.Search:Gc(),p();break;case I.qt.StickerSearch:Gc(),f({query:void 0});break;case I.qt.GifSearch:Gc(),v({query:void 0});break;case I.qt.PollResults:w();break;case I.qt.CreateTopic:M();break;case I.qt.EditTopic:R()}}),[n,O,h,w,y,N,g,p,f,v,P,s,S,Z,C,M,R]),ne=(0,i.I4)(((e,t)=>{L(e),j(t)}),[]),ae=(0,i.I4)((e=>{b({chatId:s,memberIds:e})}),[b,s]);function se(e){if(-1!==ee)switch(ee){case I.qt.AddingMembers:return i.ZP.createElement(Fc,{key:`add_chat_members_${s}`,chatId:s,isActive:F&&e,onNextStep:ae,onClose:te});case I.qt.ChatInfo:return i.ZP.createElement(Tc,{key:`profile_${s}`,chatId:s,topicId:d?r:void 0,profileState:T,isMobile:c,onProfileStateChange:A});case I.qt.Search:return i.ZP.createElement(Ac,{key:`right_search_${s}`,chatId:s,threadId:r,onClose:te,isActive:F&&e});case I.qt.Management:return i.ZP.createElement(Nc,{key:`management_${s}`,chatId:s,currentScreen:N,isPromotedByCurrentUser:U,selectedChatMemberId:B,isActive:F&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:te});case I.qt.Statistics:return i.ZP.createElement(xc,{chatId:s});case I.qt.MessageStatistics:return i.ZP.createElement(Bc,{chatId:s,isActive:F&&e});case I.qt.StickerSearch:return i.ZP.createElement(Lc,{onClose:te,isActive:F&&e});case I.qt.GifSearch:return i.ZP.createElement(Uc,{onClose:te,isActive:F&&e});case I.qt.PollResults:return i.ZP.createElement(jc,{onClose:te,isActive:F&&e});case I.qt.CreateTopic:return i.ZP.createElement(_c,{onClose:te,isActive:F&&e});case I.qt.EditTopic:return i.ZP.createElement(Dc,{onClose:te,isActive:F&&e})}}return(0,i.d4)((()=>F?(0,Et.Z)(te):void 0),[F,te]),(0,i.d4)((()=>{setTimeout((()=>{Q(!F)}),qc)}),[F]),(0,i.d4)((()=>{m&&(x(m),E(void 0))}),[m,E]),(0,i.d4)((()=>{F&&K&&te()}),[K]),Na((e=>{let[t]=e;t!==s&&(A(I.vi.Profile),x(I.u1.Initial))}),[s]),(0,sn.Z)({isActive:l&&(n===I.qt.ChatInfo||n===I.qt.Management||n===I.qt.AddingMembers||n===I.qt.CreateTopic||n===I.qt.EditTopic),onBack:()=>te(!1)}),i.ZP.createElement("div",{id:"RightColumn-wrapper",className:l?void 0:"is-hidden"},K&&i.ZP.createElement("div",{className:"overlay-backdrop",onClick:te}),i.ZP.createElement("div",{id:"RightColumn"},i.ZP.createElement(hc,{chatId:s,threadId:r,isColumnOpen:F,isProfile:_,isSearch:D,isManagement:q,isStatistics:$,isMessageStatistics:H,isStickerSearch:G,isGifSearch:V,isPollResults:z,isCreatingTopic:X,isEditingTopic:Y,isAddingChatMembers:W,profileState:T,managementScreen:N,onClose:te,onScreenSelect:x}),i.ZP.createElement(Tt.Z,{name:J||u?"none":"zoom-fade",renderCount:$c+Hc,activeKey:q?$c+N:ee,shouldCleanup:!0,cleanupExceptionKey:ee===I.qt.MessageStatistics?I.qt.Statistics:void 0},se)))}))),zc=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,bt.Z)(rt.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0})),Wc=10,Xc=1e3;let Yc=[],Kc=!1;function Jc(e,t){Yc.push({url:e,filename:t}),Kc||(Kc=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Yc)Qc(t),e++,e===Wc&&(await(0,x.wO)(Xc),e=0);Yc=[]}(),Kc=!1}),Xc))}function Qc(e){let{url:t,filename:n}=e;const a=document.createElement("a");a.href=t,a.download=n;try{a.click()}catch(e){console.error(e)}}const ed=new Set,td=new Set,nd=(0,i.X$)((0,a.c$)((e=>({activeDownloads:(0,l.jU)(e).activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:o,showNotification:r}=(0,a.Sv)(),d=(0,Ma.Z)(1e3,!0),l=(0,i.I4)((e=>{td.add(e),d((()=>{td.size&&(o({messages:Array.from(td)}),td.clear())}))}),[o,d]);(0,i.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,a]=e;return a.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{if(ed.has(e))return;ed.add(e);const t=(0,m.Ti)(e,"download");if(!t)return void l(e);const n=Te.UV(t);if(n)return Jc(n,(0,m.w6)(e)),void l(e);const{document:a,video:o,audio:i}=e.content;if(((a||o||i)?.size||0)>s.l0&&!s.rT&&!s.Mc)return r({message:"Downloading files bigger than 2GB is not supported in your browser."}),void l(e);const d=(0,m.kG)(e,"download");Te.he(t,d,!0).then((t=>{if(d===c.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),a=(0,m.w6)(e);n.searchParams.set("filename",encodeURIComponent(a));const s=window.open(n.toString());s?.addEventListener("beforeunload",(()=>{r({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&Jc(t,(0,m.w6)(e));l(e)}))})):ed.clear()}),[n,t,o,l,r])})));var ad=n(13103);const sd=(0,i.X$)((0,a.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:a}=n||{},s=a&&(0,l.Z1)(e,a);return{canPost:Boolean(s)&&(0,m.Qm)(s,c._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:a}=e;const{closeGame:s,openForwardMenu:o}=(0,U.Sv)(),r=(0,At.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,Ti.Z)(d);(0,vt.Z)((()=>{m({type:"playingGame"})}),u&&a?5e3:void 0);const h=(0,i.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:d,messageIds:[l],withMyScore:!0}),s()),"share_game"===t.eventType&&(o({fromChatId:d,messageIds:[l]}),s())}catch(e){}}),[d,s,l,o]),g=(0,i.I4)((e=>{e.currentTarget.focus()}),[]);return(0,i.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),i.ZP.createElement(ad.Z,{className:"GameModal",isOpen:u,onClose:s,title:n,hasCloseButton:!0},u&&i.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),od=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,bt.Z)(rt.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),id=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,bt.Z)(rt.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),rd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"ForwardRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),cd=(0,i.X$)((e=>{const{url:t}=e,n=(0,bt.Z)(rt.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),dd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),ld=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,bt.Z)(rt.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),ud=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,bt.Z)(rt.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),md=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,bt.Z)(rt.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0}));function hd(){return hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},hd.apply(this,arguments)}const gd=(0,i.X$)((0,a.c$)((e=>({messageLists:(0,l.jU)(e).messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,a.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},o=e=>{let{chatId:t,type:n,threadId:a}=e;(0,sn.Z)({isActive:!0,hash:(0,f.tB)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,t?.map(((e,t)=>i.ZP.createElement(o,hd({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),pd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0})),fd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0})),Id=(0,i.X$)((e=>{const{webApp:t}=e,n=(0,bt.Z)(rt.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0})),vd=(0,i.X$)((e=>{const{bot:t}=e,n=(0,bt.Z)(rt.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0})),wd=(0,i.X$)((e=>{const{bot:t}=e,n=(0,bt.Z)(rt.gl.Extra,"AttachBotInstallModal",!t);return n?i.ZP.createElement(n,e):void 0})),bd={root:"vfd0Bo1X6k19aaxQ577t"},yd=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Pd=(0,i.X$)((0,a.c$)((e=>(0,v.ei)((0,l.jU)(e),["confetti"])))((e=>{let{confetti:t}=e;const n=(0,i.sO)(null),a=(0,i.sO)([]),s=(0,i.sO)(!1),o=(0,Mn.Z)(),r=(0,pt.Z)(),{isMobile:c}=(0,S.ZP)(),d=c?50:100,{lastConfettiTime:l,top:u,width:m,left:h,height:g}=t||{},p=(0,i.I4)((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;for(let s=0;s<n;s++){const n=s%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=yd[Math.floor(Math.random()*yd.length)],d=10;a.current.push({pos:o,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}),[d]),f=(0,i.I4)((()=>{if(!n.current||!s.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=[];a.current.forEach(((e,n)=>{const{pos:s,velocity:o,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:s.x+o.x*p,y:s.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),b=g+1,y=Date.now();if(f.y>i+e.size)return void r.push(e);const P={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:y,frameCount:b};a.current[n]=P,t.fillStyle=d,t.beginPath(),t.ellipse(s.x,s.y,c,l,m,0,2*Math.PI),t.fill()})),a.current=a.current.filter((e=>!r.includes(e))),a.current.length?requestAnimationFrame(f):s.current=!1}),[]);if((0,ut.Z)((e=>{let t,[n]=e;return n!==l&&(p(m||o.width,g||o.height),t=setTimeout(r,1e4),s.current||(s.current=!0,requestAnimationFrame(f))),()=>{clearTimeout(t)}}),[l,r,f]),!l||Date.now()-l>1e4)return;const I=(0,Bs.Z)(Boolean(u)&&`top: ${u}px`,Boolean(h)&&`left: ${h}px`,Boolean(m)&&`width: ${m}px`,Boolean(g)&&`height: ${g}px`);return i.ZP.createElement("div",{id:"Confetti",className:bd.root,style:I},i.ZP.createElement("canvas",{ref:n,className:bd.canvas,width:o.width,height:o.height}))}))),Zd=(0,i.X$)((e=>{const{urlAuth:t}=e,n=(0,bt.Z)(rt.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0})),Cd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0})),Sd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ed=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,bt.Z)(rt.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),Md=(0,i.X$)((e=>{const{limit:t}=e,n=(0,bt.Z)(rt.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0})),Rd=(0,i.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,bt.Z)(rt.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0})),kd=(0,i.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,bt.Z)(rt.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Td=(0,i.X$)((e=>{const{requestedDraft:t}=e,n=(0,bt.Z)(rt.gl.Extra,"DraftRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),Ad=(0,i.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,bt.Z)(rt.gl.Extra,"AttachBotRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0}));let Nd=!1;const xd=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{settings:{byKey:{animationLevel:a,language:s,wasTimeFormatSetManually:o}},lastSyncTime:i}=e,{botTrustRequest:r,requestedAttachBotInstall:c,requestedAttachBotInChat:d,requestedDraft:u,urlAuth:m,webApp:h,safeLinkModalUrl:g,openedStickerSetShortName:p,openedCustomEmojiSetIds:f,shouldSkipHistoryAnimations:I,openedGame:v,audioPlayer:w,isLeftColumnShown:b,historyCalendarSelectedAt:y,notifications:P,dialogs:Z,newContact:C,ratingPhoneCall:S,premiumModal:E,isMasterTab:M,payment:R,limitReachedModal:k,deleteFolderDialogModal:T}=(0,l.jU)(e),{chatId:A,messageId:N}=w,x=A&&N?(0,l.hj)(e,A,N):void 0,B=v&&(0,l.hj)(e,v.chatId,v.messageId),L=B?.content.game?.title,U=e.currentUserId?(0,l.dy)(e,e.currentUserId):void 0,{chatId:j}=(0,l.Bt)(e)||{};return{lastSyncTime:i,isLeftColumnOpen:b,isMiddleColumnOpen:Boolean(j),isRightColumnOpen:(0,l.Jf)(e,n),isMediaViewerOpen:(0,l.zQ)(e),isForwardModalOpen:(0,l.Ev)(e),hasNotifications:Boolean(P.length),hasDialogs:Boolean(Z.length),audioMessage:x,safeLinkModalUrl:g,isHistoryCalendarOpen:Boolean(y),shouldSkipHistoryAnimations:I,openedStickerSetShortName:p,openedCustomEmojiSetIds:f,isServiceChatReady:(0,l.UW)(e),activeGroupCallId:M?e.groupCalls.activeGroupCallId:void 0,animationLevel:a,language:s,wasTimeFormatSetManually:o,isPhoneCallActive:M?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:C?.userId,newContactByPhoneNumber:C?.isByPhoneNumber,openedGame:v,gameTitle:L,isRatePhoneCallModalOpen:Boolean(S),botTrustRequest:r,botTrustRequestBot:r&&(0,l.dy)(e,r.botId),attachBotToInstall:c?.bot,requestedAttachBotInChat:d,webApp:h,currentUser:U,urlAuth:m,isCurrentUserPremium:(0,l.wV)(e),isPremiumModalOpen:E?.isOpen,limitReached:k?.limit,isPaymentModalOpen:R.isPaymentModalOpen,isReceiptModalOpen:Boolean(R.receipt),deleteFolderDialogId:T,isMasterTab:M,requestedDraft:u}}))((e=>{let{lastSyncTime:t,isMobile:n,isLeftColumnOpen:c,isMiddleColumnOpen:d,isRightColumnOpen:l,isMediaViewerOpen:u,isForwardModalOpen:m,hasNotifications:h,hasDialogs:g,audioMessage:p,activeGroupCallId:I,safeLinkModalUrl:v,isHistoryCalendarOpen:w,shouldSkipHistoryAnimations:b,limitReached:y,openedStickerSetShortName:P,openedCustomEmojiSetIds:Z,isServiceChatReady:C,animationLevel:E,language:M,wasTimeFormatSetManually:R,addedSetIds:k,addedCustomEmojiIds:T,isPhoneCallActive:A,newContactUserId:B,newContactByPhoneNumber:L,openedGame:U,gameTitle:j,isRatePhoneCallModalOpen:O,botTrustRequest:F,botTrustRequestBot:_,attachBotToInstall:D,requestedAttachBotInChat:q,requestedDraft:$,webApp:H,currentUser:G,urlAuth:V,isPremiumModalOpen:z,isPaymentModalOpen:W,isReceiptModalOpen:X,isCurrentUserPremium:Y,deleteFolderDialogId:K,isMasterTab:J}=e;const{initMain:Q,loadAnimatedEmojis:ee,loadNotificationSettings:te,loadNotificationExceptions:ne,updateIsOnline:ae,onTabFocusChange:se,loadTopInlineBots:oe,loadEmojiKeywords:ie,loadCountryList:re,loadAvailableReactions:ce,loadStickerSets:de,loadPremiumGifts:le,loadDefaultTopicIcons:ue,loadAddedStickers:me,loadFavoriteStickers:he,loadDefaultStatusIcons:ge,ensureTimeFormat:pe,closeStickerSetModal:fe,closeCustomEmojiSets:Ie,checkVersionNotification:ve,loadConfig:we,loadAppConfig:be,loadAttachBots:ye,loadContactList:Pe,loadCustomEmojis:Ze,loadGenericEmojiEffects:Ce,closePaymentModal:Se,clearReceipt:Ee,checkAppVersion:Me,openChat:Re,toggleLeftColumn:ke,loadRecentEmojiStatuses:Te,updatePageTitle:Ae}=(0,a.Sv)();o.eMD&&!Nd&&(Nd=!0,console.log(">>> RENDER MAIN")),(0,wt.Z)((()=>{(0,rt.Pb)(rt.gl.Calls)}),5e3);const Ne=(0,i.sO)(null),{isDesktop:xe}=(0,S.ZP)();(0,i.d4)((()=>{c||d||xe?c&&d&&n&&ke():ke()}),[xe,c,d,n,ke]),(0,vt.Z)(Me,J?3e5:void 0,!0),(0,i.d4)((()=>{t&&J&&(ae(!0),we(),be(),Q(),ce(),ee(),Ce(),te(),ne(),oe(),ie({language:o.pRL}),ye(),Pe(),le(),ue(),ge(),Me(),Y&&Te())}),[t,ee,ie,ne,te,oe,ae,ce,be,ye,Pe,le,Me,we,Ce,ue,ge,Te,Y,J,Q]),(0,i.d4)((()=>{t&&J&&(M!==o.pRL&&ie({language:M}),re({langCode:M}))}),[M,t,re,ie,J]),(0,ct.Z)((e=>{let[n]=e;!n&&t&&J&&Ze({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[t,J,Ze]),(0,i.d4)((()=>{t&&J&&(k&&T||(de(),he()),k&&T&&me())}),[t,k,de,he,me,T,J]),(0,i.d4)((()=>{t&&C&&J&&ve()}),[t,C,ve,J]),(0,i.d4)((()=>{t&&!R&&pe()}),[t,R,pe]),(0,i.d4)((()=>{const e=(0,f.dx)();t&&e?.tgaddr&&(0,it.ou)(decodeURIComponent(e.tgaddr))}),[t]),(0,ct.Z)((e=>{let[n]=e;const a=(0,f.VX)();a&&!n&&t&&Re({id:a.chatId,threadId:a.threadId,type:a.type})}),[t,Re]),(0,i.bt)((()=>{const e=Ne.current;1===e.parentNode.childElementCount&&(0,r.D_)(e,"Transition__slide--active")}),[]);const Be=(0,ft.Z)(c,void 0,!0,void 0,b,void 0,!0),Le=(0,i.sO)(!1),Ue=(0,pt.Z)();(0,ut.Z)((e=>{let[t]=e;if(void 0===t||c===t||0===E)return;Le.current=!0,s.wZ&&(0,x.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!c)}));const n=(0,It.YW)();(0,ot.L)(document.getElementById("MiddleColumn"),(()=>{n(),Le.current=!1,Ue()}))}),[c,E,Ue]);const je=(0,ft.Z)(l,void 0,!0,void 0,b,void 0,!0),Oe=(0,i.sO)(!1),[Fe,_e]=(0,i.eJ)(l);(0,ut.Z)((e=>{let[t]=e;if(void 0===t||l===t)return;if(0===E)return void _e(l);Oe.current=!0;const n=(0,It.YW)();(0,ot.L)(document.getElementById("RightColumn"),(()=>{n(),Oe.current=!1,Ue(),_e(l)}))}),[l,E,Ue]);const De=(0,st.Z)(Be.hasShownClass&&"left-column-shown",Be.hasOpenClass&&"left-column-open",Le.current&&"left-column-animating",je.hasShownClass&&"right-column-shown",je.hasOpenClass&&"right-column-open",Oe.current&&"right-column-animating",Fe&&"narrow-message-list",b&&"history-animation-disabled"),qe=(0,i.I4)((()=>{se({isBlurred:!0})}),[se]),$e=(0,i.I4)((()=>{se({isBlurred:!1}),document.title.includes(o.ouc)||Ae(),N(!1)}),[se,Ae]),He=(0,i.I4)((()=>{fe()}),[fe]),Ge=(0,i.I4)((()=>{Ie()}),[Ie]);return(0,dt.Z)(qe,$e),lt(qe),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(s.$b){if(!e)return mt?.setAttribute("content",ht),s.cj&&!s.fl&&document.addEventListener("gesturestart",gt),()=>{mt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),s.cj&&!s.fl&&document.removeEventListener("gesturestart",gt)};mt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(u),i.ZP.createElement("div",{ref:Ne,id:"Main",className:De},i.ZP.createElement(Zn,null),i.ZP.createElement(dc,{isMobile:n}),i.ZP.createElement(Vc,{isMobile:n}),i.ZP.createElement(zc,{isOpen:u}),i.ZP.createElement(rd,{isOpen:m}),i.ZP.createElement(Td,{requestedDraft:$}),i.ZP.createElement(od,{isOpen:h}),i.ZP.createElement(id,{isOpen:g}),p&&i.ZP.createElement(pa,{key:p.id,message:p,noUi:!0}),i.ZP.createElement(cd,{url:v}),i.ZP.createElement(Zd,{urlAuth:V,currentUser:G}),i.ZP.createElement(dd,{isOpen:w}),i.ZP.createElement(yt,{isOpen:Boolean(P),onClose:He,stickerSetShortName:P}),i.ZP.createElement(kd,{customEmojiSetIds:Z,onClose:Ge}),I&&i.ZP.createElement(ld,{groupCallId:I}),i.ZP.createElement(ud,{isActive:Boolean(I||A)}),i.ZP.createElement(pd,{isOpen:Boolean(B||L),userId:B,isByPhoneNumber:L}),i.ZP.createElement(sd,{openedGame:U,gameTitle:j}),i.ZP.createElement(Id,{webApp:H}),i.ZP.createElement(nd,null),i.ZP.createElement(Pd,null),i.ZP.createElement(md,{isActive:A}),i.ZP.createElement(St,{isForAppBadge:!0}),i.ZP.createElement(fd,{isOpen:O}),i.ZP.createElement(vd,{bot:_,type:F?.type}),i.ZP.createElement(wd,{bot:D}),i.ZP.createElement(Ad,{requestedAttachBotInChat:q}),i.ZP.createElement(gd,null),z&&i.ZP.createElement(Cd,{isOpen:z}),i.ZP.createElement(Md,{limit:y}),i.ZP.createElement(Sd,{isOpen:W,onClose:Se}),i.ZP.createElement(Ed,{isOpen:X,onClose:Ee}),i.ZP.createElement(Rd,{deleteFolderDialogId:K}))})));var Bd=n(62821),Ld=n(21179),Ud=n(99364),jd=n(8337);var Od=n(2092);const Fd=(0,i.X$)((0,a.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:s,signOut:o,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,a.Sv)(),{invalidAttemptsCount:d,timeoutUntil:l,isLoading:u}=n,m=(0,At.Z)(),[h,g]=(0,i.eJ)(""),[p,f]=(0,i.eJ)(!1),[I,v,w]=(0,Rt.Z)(!1),{shouldRender:b}=(0,ft.Z)(t);(0,wt.Z)(c,l?l-Date.now():void 0);const y=(0,i.I4)((()=>{g("")}),[]),P=(0,i.I4)((e=>{void 0===l?(g(""),(0,$.so)(e).then(s,(()=>{r(),g(m("lng_passcode_wrong"))}))):g(m("FloodWait"))}),[m,l]);(0,i.d4)((()=>{void 0!==l?g(m("FloodWait")):0===d&&g("")}),[l,m,d]);const Z=(0,i.I4)((()=>{w(),o({forceInitApi:!0})}),[w,o]);if(b)return i.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},i.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:m.isRtl?"rtl":void 0},i.ZP.createElement(Ld.Z,{tgsUrl:Bd.l.Lock,previewUrl:Od,size:160,className:"ar9YdQbWJreREHmnZa9m"}),i.ZP.createElement(Ud.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:u,error:h,placeholder:m("Passcode.EnterPasscodePlaceholder"),submitLabel:m("Next"),clearError:y,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:f,onSubmit:P}),i.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},i.ZP.createElement("p",null,i.ZP.createElement(jd.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),i.ZP.createElement("p",null,i.ZP.createElement(Dt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},m("AccountSettings.Logout"))))),i.ZP.createElement($n.Z,{isOpen:I,onClose:w,text:m("lng_sure_logout"),confirmLabel:m("AccountSettings.Logout"),confirmHandler:Z,confirmIsDestructive:!0}))})));o.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:_d},connectionState:Dd}=(0,a.Rd)();Dd||_d||s.Eo||(0,a.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
//# sourceMappingURL=5769.0269632c191bb3c4ddde.js.map