TelegramPWA/dist/5769.9474b1eea191c21d23ca.js
Alexander Zinchuk b86d857277 [Build]
2022-11-01 18:55:18 +01:00

2 lines
335 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],{21650:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>ac,Main:()=>ec});var s=n(33555),a=n(83716),i=n(14050),o=(n(89005),n(6137)),r=n(5161),c=n(11192),l=n(70735),d=n(60371);function u(e){const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};return t&&n?(e=(0,r.qr)(e,t,n,!1),e=(0,r.Pb)(e,t,n,void 0)):e}(0,s.iw)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(t&&n)return(0,r.qr)(e,t,n,!0)})),(0,s.iw)("closeLocalTextSearch",u),(0,s.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:s,threadId:a}=(0,c.Bt)(e)||{};if(!s||!a)return;const{query:i}=n,o=(0,d.uw)(s,a),{query:u}=e.localTextSearch.byChatThreadKey[o]||{};return i!==u&&(e=(0,r.Pb)(e,s,a,l.D)),(0,r.qr)(e,s,a,!0,i)})),(0,s.iw)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:s}=(0,c.Bt)(e)||{};if(!s)return;const{mediaType:a}=n;return(0,r.z5)(e,s,a)})),(0,s.iw)("openChat",((e,t,n)=>{var s,a;const{id:i,threadId:l=o._f,type:d="thread",shouldReplaceHistory:m=!1}=n,h=(0,c.Bt)(e);return null!==(s=e.premiumModal)&&void 0!==s&&s.promo&&null!==(a=e.premiumModal)&&void 0!==a&&a.isOpen&&(e={...e,premiumModal:{...e.premiumModal,isOpen:!1}}),h&&h.chatId===i&&h.threadId===l&&h.type===d||(i&&(e=(0,r.pf)(e,i,l,"replyStack",[])),e=u(e=(0,r.i9)(e)),e={...e,isStatisticsShown:!1,messages:{...e.messages,contentToBeScheduled:void 0},...i!==e.forwardMessages.toChatId&&{forwardMessages:{}}}),(0,r.Wy)(e,i,l,d,m)})),(0,s.iw)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,s.iw)("openChatWithInfo",((e,t,n)=>{(0,s.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,s.iw)("openChatWithDraft",((e,t,n)=>{const{chatId:s,text:a}=n;return s&&t.openChat({id:s}),{...e,requestedDraft:{chatId:s,text:a}}})),(0,s.iw)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,s.iw)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,s.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:s,orderedIds:a}=n,{chatId:i}=(0,c.Bt)(e)||{};if(!i)return void t.openChat({id:a[0]});const o=a.indexOf(i);if(-1===o)return;const r=a[o+s];t.openChat({id:r,shouldReplaceHistory:!0})})),(0,s.iw)("openDeleteChatFolderModal",((e,t,n)=>{const{folderId:s}=n;return{...e,deleteFolderDialogModal:s}})),(0,s.iw)("closeDeleteChatFolderModal",(e=>({...e,deleteFolderDialogModal:void 0})));var m=n(91713),h=n(77361),g=n(60782),p=n(82267),f=n(83099),v=n(50711),I=n(64319);const w=a.ck+a.fK;let y;function P(e,t,n){const{type:s,threadId:a}=(0,c.Bt)(e)||{},i=v.i0,o="scheduled"===s?(0,c.Fn)(e,t):(0,c.Zw)(e,t);if(!o||!a)return;const r=n.map((e=>o[e])).filter((t=>(0,c._k)(e,t,a).canCopy)).sort(((e,t)=>e.id-t.id)).reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,d.OU)(i,s):""}:`),t.push(`${(0,d.MK)(i,n,!1,0,void 0,!0)}\n`),t}),[]);(0,I.TE)(r.join("\n"))}(0,s.iw)("setScrollOffset",((e,t,n)=>{const{chatId:s,threadId:a,scrollOffset:i}=n;return(0,r.pf)(e,s,a,"scrollOffset",i)})),(0,s.iw)("setReplyingToId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:i,threadId:o}=a;return(0,r.pf)(e,i,o,"replyingToId",s)})),(0,s.iw)("setEditingId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:i,threadId:o,type:l}=a,d="scheduled"===l?"editingScheduledId":"editingId";return(0,r.pf)(e,i,o,d,s)})),(0,s.iw)("setEditingDraft",((e,t,n)=>{const{text:s,chatId:a,threadId:i,type:o}=n,c="scheduled"===o?"editingScheduledDraft":"editingDraft";return(0,r.pf)(e,a,i,c,s)})),(0,s.iw)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(!t||!n)return;const s=(0,c.Zw)(e,t),a=(0,c.Cb)(e,t,n);if(!s||!a)return;const i=(0,g.dF)(a,(t=>Boolean(s[t]&&(0,c._k)(e,s[t],n).canEdit)));return i?(0,r.pf)(e,t,n,"editingId",i):void 0})),(0,s.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:s}=n,{chatId:a,threadId:i}=(0,c.Bt)(e)||{};if(!a||!i)return;const r=(0,c.Zw)(e,a),l=(0,c.Cb)(e,a,i);if(!r||!l)return;const d=(0,c.Yy)(e,a,i);let u;if((0,c.b9)(e,a,i)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+s;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(i===o._f){var m;const t=(0,c.Z1)(e,a);u=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,c.tZ)(e,a,i);u=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:u}),t.focusMessage({chatId:a,threadId:i,messageId:u})})),(0,s.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:s,threadId:a,messageId:i,origin:o,volume:r,playbackRate:c,isMuted:l}=n;return{...e,audioPlayer:{chatId:s,threadId:a,messageId:i,origin:null!=o?o:e.audioPlayer.origin,volume:null!=r?r:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:l||e.audioPlayer.isMuted}}})),(0,s.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:s,isMuted:!1}}})),(0,s.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:s}}})),(0,s.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:s}}})),(0,s.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:s}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:s}}})),(0,s.iw)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,s.iw)("openPollResults",((e,t,n)=>{const{chatId:a,messageId:i}=n;if((0,c.Jf)(e)){if(a!==e.pollResults.chatId||i!==e.pollResults.messageId)return{...e,pollResults:{chatId:a,messageId:i,voters:{}}}}else window.setTimeout((()=>{e=(0,s.Rd)(),(0,s.R3)({...e,pollResults:{chatId:a,messageId:i,voters:{}}})}),450)})),(0,s.iw)("closePollResults",(e=>({...e,pollResults:{}}))),(0,s.iw)("focusLastMessage",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:s,threadId:a}=n;let i;if(a===o._f){var r;const t=(0,c.Z1)(e,s);i=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,c.tZ)(e,s,a);i=null==t?void 0:t.lastMessageId}i&&t.focusMessage({chatId:s,threadId:a,messageId:i,noHighlight:!0})})),(0,s.iw)("focusNextReply",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:a,threadId:i}=n,o=(0,c.p9)(e,a,i);if(o&&0!==o.length){const n=o.pop();e=(0,r.pf)(e,a,i,"replyStack",[...o]),(0,s.R3)(e),t.focusMessage({chatId:a,threadId:i,messageId:n})}else t.focusLastMessage()})),(0,s.iw)("focusMessage",((e,t,n)=>{const{chatId:a,threadId:i=o._f,messageListType:l="thread",noHighlight:d,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f}=n;let{messageId:v}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);null!=t&&t.length&&([v]=t)}const I=(0,c.Bt)(e),P=!I||a!==I.chatId||i!==I.threadId||l!==I.type;if(y&&(clearTimeout(y),y=void 0),y=window.setTimeout((()=>{let e=(0,s.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,s.R3)(e)}),d?w:1500),e=(0,r.cq)(e,a,v,d,p),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,a,i)||[];e=(0,r.pf)(e,a,i,"replyStack",[...t,g])}P&&(e=(0,r.wV)(e,m.fo.Static));const Z=(0,c.Cb)(e,a,i);if(Z&&Z.includes(v))return(0,s.R3)(e),void t.openChat({id:a,threadId:i,shouldReplaceHistory:f});if(P&&(e=(0,r.pf)(e,a,i,"viewportIds",void 0)),e=(0,r.pf)(e,a,i,"outlyingIds",void 0),Z&&!P){const t=v>Z[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,s.R3)(e),t.openChat({id:a,threadId:i,shouldReplaceHistory:f}),t.loadViewportMessages()})),(0,s.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:s,messageIds:a,groupedId:i,withMyScore:o}=n;let r;return i&&(r=(0,c.xH)(e,s,i)),{...e,forwardMessages:{fromChatId:s,messageIds:r||a,isModalShown:!0,withMyScore:o}}})),(0,s.iw)("changeForwardRecipient",(e=>({...e,forwardMessages:{...e.forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}}))),(0,s.iw)("setForwardNoAuthors",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noAuthors:n,noCaptions:n&&e.forwardMessages.noCaptions}}))),(0,s.iw)("setForwardNoCaptions",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noCaptions:n,noAuthors:n}}))),(0,s.iw)("exitForwardMode",(e=>{(0,s.R3)({...e,forwardMessages:{}})})),(0,s.iw)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:s})})),(0,s.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:a}=n,i=e.activeDownloads.byChatId[a.chatId];i&&i.length&&(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:i.filter((e=>e!==a.id))}}})})),(0,s.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:s}=n,a=e.activeDownloads.byChatId,i={};return Object.keys(a).forEach((e=>{i[e]=a[e].filter((e=>!s.find((t=>t.id===e))))})),{...e,activeDownloads:{byChatId:i}}})),(0,s.iw)("downloadMessageMedia",((e,t,n)=>{const{message:a}=n;(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:[...e.activeDownloads.byChatId[a.chatId]||[],a.id]}}})})),(0,s.iw)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages,{threadId:a}=(0,c.Bt)(e)||{},i=(0,c.Zw)(e,n);i&&a&&s.map((e=>i[e])).filter((t=>(0,c._k)(e,t,a).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,s.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:s}=n||{},a=(0,c.jr)(e);return a?(0,r.M6)(e,a.id,s):e})),(0,s.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:a,groupedId:i,childMessageIds:o,withShift:l}=n,d=(0,c.Bt)(e);if(!d)return;const{chatId:u,threadId:m,type:g}=d;e=(0,r.Ob)(e,u,m,g,a,i,o,l),(0,s.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.$b?"long tap":"right click"} on a message.`}))})),(0,s.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,s.iw)("exitMessageSelectMode",r.i9),(0,s.iw)("openPollModal",((e,t,n)=>{const{isQuiz:s}=n||{};return{...e,pollModal:{isOpen:!0,isQuiz:s}}})),(0,s.iw)("closePollModal",(e=>({...e,pollModal:{isOpen:!1}}))),(0,s.iw)("checkVersionNotification",((e,t)=>{if(a.V6&&Date.now()>Number(a.V6)+2592e5)return;const n=a.Ji.split(".").slice(0,2).join("."),{serviceNotifications:s}=e;if(s.find((e=>{let{version:t}=e;return t===n})))return;const i={chatId:a.aw,date:(0,p.b)(e.serverTimeOffset),content:{text:(0,f.Z)("**Telegram Web Z was updated to version 1.55**\n\n[👏](customEmoji:5471921242866981303) **Harder**\n• Sending custom emoji is now supported.\n• You can now view recent (cached) messages while offline.\n• Enjoy the beautifully redesigned payments screen with an option to add tips for certain invoices.\n• Media in chats can also be deleted via the Media Viewer.\n\n[🤩](customEmoji:5373026167722876724) **Better**\n• Custom emoji sent without text are shown at a larger size.\n\n[🚀](customEmoji:5445284980978621387) **Faster**\n• Optimized rendering for animated stickers and emoji.\n\n[💪](customEmoji:5471883477219549006) **Stronger**\n• Improved sync after editing drafts on another device.\n• Fixed duplicate notification sounds when waking up from sleep.\n• Various fixes for the Media Viewer.\n• Various fixes for username input.\n• Various layout improvements.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:i,version:n})})),(0,s.iw)("createServiceNotification",((e,t,n)=>{var i;const{message:o,version:r}=n,{serviceNotifications:l}=e,d=(0,c.Z1)(e,a.aw),u=Math.max((null===(i=d.lastMessage)||void 0===i?void 0:i.id)||0,...l.map((e=>{let{id:t}=e;return t}))),m=(l.length+1)/1e3,h=Math.floor(u)+m;o.previousLocalId=o.id,o.id=h;const g={id:h,message:o,version:r,isUnread:!0};(0,s.R3)({...e,serviceNotifications:[...l.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:o.id,chatId:o.chatId,message:o})})),(0,s.iw)("openReactorListModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,reactorModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,s.iw)("openSeenByModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,seenByModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,s.iw)("copySelectedMessages",(e=>{if(!e.selectedMessages)return;const{chatId:t,messageIds:n}=e.selectedMessages;P(e,t,n)})),(0,s.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.jr)(e);s&&0!==s.length&&a&&P(e,a.id,s)})),(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s}=n,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:s})})),(0,s.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:s}=n,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[s]});const i=a.filter((e=>e!==s));return i.unshift(s),i.length>10&&i.pop(),(0,r.No)(e,{recentlyFoundChatIds:i})})),(0,s.iw)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,s.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:s}=n;return(0,r.Og)(e,s)})),(0,s.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:s}=n;return(0,r.No)(e,{chatId:s,query:void 0,resultsByType:void 0})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s})})),(0,s.iw)("openAddContactDialog",((e,t,n)=>{const{userId:s}=n;return{...e,newContact:{userId:s}}})),(0,s.iw)("openNewContactDialog",(e=>({...e,newContact:{isByPhoneNumber:!0}}))),(0,s.iw)("closeNewContactDialog",(e=>(0,r.ft)(e))),n(73456);var Z=n(91947),C=n(26926);(0,s.iw)("toggleChatInfo",((e,t,n)=>({...e,isChatInfoShown:void 0!==n?n:!e.isChatInfoShown}))),(0,s.iw)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,s.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,s.iw)("toggleManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,s.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:s}=n||{},{chatId:a}=(0,c.Bt)(e)||{};if(a)return{...e,management:{byChatId:{...e.management.byChatId,[a]:{...e.management.byChatId[a],isActive:!0,nextScreen:s}}}}})),(0,s.iw)("closeManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,s.iw)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,s.iw)("toggleStatistics",(e=>({...e,isStatisticsShown:!e.isStatisticsShown,statistics:{...e.statistics,currentMessageId:void 0}}))),(0,s.iw)("toggleMessageStatistics",((e,t,n)=>({...e,statistics:{...e.statistics,currentMessageId:null==n?void 0:n.messageId}}))),(0,s.iw)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,s.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:s}=n,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[s]};const i=a.filter((e=>e!==s));return i.unshift(s),i.length>32&&i.pop(),{...e,recentEmojis:i}})),(0,s.iw)("addRecentSticker",((e,t,n)=>{const{sticker:s}=n,{recent:a}=e.stickers;if(!a)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[s]}}};const i=a.stickers.filter((e=>e.id!==s.id));return i.unshift(s),{...e,stickers:{...e.stickers,recent:{...a,stickers:i}}}})),(0,s.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:s}=n,{recentCustomEmojis:a}=e;if(!a)return{...e,recentCustomEmojis:[s]};const i=a.filter((e=>e!==s));return i.unshift(s),i.length>32&&i.pop(),{...e,recentCustomEmojis:i}})),(0,s.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,s.iw)("reorderStickerSets",((e,t,n)=>{const{order:s,isCustomEmoji:a}=n;return{...e,stickers:{...e.stickers,[a?"customEmoji":"added"]:{setIds:s}}}})),(0,s.iw)("showNotification",((e,t,n)=>{const s=n;s.localId=(0,C.Z)({});const a=[...e.notifications],i=a.findIndex((e=>e.message===s.message));return-1!==i&&a.splice(i,1),a.push(s),{...e,notifications:a}})),(0,s.iw)("dismissNotification",((e,t,n)=>{const s=e.notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return{...e,notifications:s}})),(0,s.iw)("showDialog",((e,t,n)=>{const{data:s}=n;if("message"in s&&s.hasErrorKey&&!(0,Z.ZP)(s))return e;const a=[...e.dialogs];if("message"in s){const e=a.findIndex((e=>e.message===s.message));-1!==e&&a.splice(e,1)}return a.push(s),{...e,dialogs:a}})),(0,s.iw)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,s.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:s}=n;return{...e,safeLinkModalUrl:s}})),(0,s.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:s}=n;return{...e,historyCalendarSelectedAt:s}})),(0,s.iw)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,s.iw)("openGame",((e,t,n)=>{const{url:a,chatId:i,messageId:o}=n,r=(0,c.hj)(e,i,o);if(!r)return;const l=r.viaBotId||r.senderId;l&&((0,c.LM)(e,l)?(0,s.R3)({...e,openedGame:{url:a,chatId:i,messageId:o}}):(0,s.R3)({...e,botTrustRequest:{botId:l,type:"game",onConfirm:{action:"openGame",payload:n}}}))})),(0,s.iw)("closeGame",(e=>({...e,openedGame:void 0}))),(0,s.iw)("requestConfetti",((e,t,n)=>{const{top:s,left:a,width:i,height:o}=n||{},{animationLevel:r}=e.settings.byKey;if(0!==r)return{...e,confetti:{lastConfettiTime:Date.now(),top:s,left:a,width:i,height:o}}})),(0,s.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:s}=n;return{...e,limitReachedModal:{limit:s}}})),(0,s.iw)("closeLimitReachedModal",(e=>({...e,limitReachedModal:void 0}))),(0,s.iw)("closeStickerSetModal",(e=>({...e,openedStickerSetShortName:void 0}))),(0,s.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:s}=n;return{...e,openedCustomEmojiSetIds:s}})),(0,s.iw)("closeCustomEmojiSets",(e=>({...e,openedCustomEmojiSetIds:void 0}))),(0,s.iw)("updateLastRenderedCustomEmojis",((e,t,n)=>{const{ids:s}=n,{lastRendered:i}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,g.Tw)([...i,...s]).slice(0,a.j7)}}})),(0,s.iw)("checkAppVersion",(()=>{const e=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{t=t.trim(),e.test(t)&&t!==a.Ji&&(0,s.R3)({...(0,s.Rd)(),isUpdateAvailable:!0})})).catch((e=>{a.eM&&console.error("[checkAppVersion failed] ",e)}))})),(0,s.iw)("closePaymentModal",(e=>{const t=e.payment.status;return e=(0,r.bp)(e),e=(0,r.WY)(e),{...e,payment:{...e.payment,status:t}}})),(0,s.iw)("addPaymentError",((e,t,n)=>{const{error:s}=n;return{...e,payment:{...e.payment,status:"failed",error:s}}}));var b=n(88422);(0,s.iw)("openMediaViewer",((e,t,n)=>{const{chatId:s,threadId:a,mediaId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,volume:l,playbackRate:d,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:s,threadId:a,mediaId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=l?l:e.mediaViewer.volume,playbackRate:d||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,s.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:s,isHidden:a}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,isHidden:a,playbackRate:s}}})),(0,s.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:s,isMuted:!1}}})),(0,s.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:s}}})),(0,s.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:s}}})),(0,s.iw)("setMediaViewerHidden",((e,t,n)=>{const s=n;return{...e,mediaViewer:{...e.mediaViewer,isHidden:s}}}));var S=n(3100),E=n(95281),M=n(5872),R=n(69118),k=n(35369);let A=!1;(0,R.Gq)((()=>{(0,s.Rd)().passcode.hasPasscode&&!A&&(0,S.jv)()})),(0,s.iw)("setPasscode",(async(e,t,n)=>{let{passcode:a}=n;(0,s.R3)((0,r.vu)(e,{isLoading:!0})),await(0,E.AU)(a);const i=JSON.stringify({...(0,S.K8)(),userId:e.currentUserId}),o=(0,M.Uf)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,E.H4)(i,o),(0,s.R3)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1})),(0,M.jA)(!0)})),(0,s.iw)("clearPasscode",(e=>((0,E.C8)(),(0,r.Kn)(e)))),(0,s.iw)("unlockScreen",((e,t,n)=>{let{sessionJson:a,globalJson:i}=n;const o=JSON.parse(a);(0,S.wX)(o,o.userId),e=JSON.parse(i),(0,M.nE)(e,(0,g.Xh)(k.Y)),(0,s.R3)((0,r.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0})),t.initApi()})),(0,s.iw)("logInvalidUnlockAttempt",(e=>{var t,n;return(0,r.vu)(e,{invalidAttemptsCount:(null!==(t=null===(n=e.passcode)||void 0===n?void 0:n.invalidAttemptsCount)&&void 0!==t?t:0)+1})})),(0,s.iw)("resetInvalidUnlockAttempts",(e=>(0,r.vu)(e,{invalidAttemptsCount:0}))),(0,s.iw)("setPasscodeError",((e,t,n)=>{const{error:s}=n;return(0,r.vu)(e,{error:s})})),(0,s.iw)("clearPasscodeError",(e=>(0,r.vu)(e,{error:void 0}))),(0,s.iw)("skipLockOnUnload",(()=>{A=!0})),n(65456);var T=n(27225),N=n(71226),B=n(81396);const x=new Map,L=(0,R.Ds)((e=>e()),500,!1);async function O(e,t,n,i){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const d=e.id;let u;switch(i){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(a.hT/2)+1);break;case m.Uq.Forwards:u=-(a.hT+1)}const h=await(0,N.t9)("fetchMessages",{chat:(0,c.Cm)((0,s.Rd)(),d,t),offsetId:n,addOffset:u,limit:a.hT,threadId:t});if(!h)return;const{messages:p,users:f,chats:v,threadInfos:I}=h;let w=(0,s.Rd)();const y=d===a.aw?w.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],P=[].concat(p,y),Z=(0,g.ee)(P,"id"),C=Object.keys(Z).map(Number);w=(0,r.c_)(w,d,Z),w=o?(0,r.ff)(w,d,t,C):(0,r.xj)(w,d,t,C),w=(0,r.Sh)(w,(0,g.ee)(f,"id")),w=(0,r.fZ)(w,(0,g.ee)(v,"id")),w=(0,r.j6)(w,d,I);let b=(0,c.gb)(w,d,t);const S=(0,c.qC)(w,d,t);if(o&&b&&S&&(S.length&&!(0,g.YE)(b,S)||(w=(0,r.xj)(w,d,t,S),b=(0,c.gb)(w,d,t),w=(0,r.pf)(w,d,t,"outlyingIds",void 0),o=!1)),!l){const e=o?S:b,{newViewportIds:s}=U(e,n,i);w=(0,r.y9)(w,d,t,s)}(0,s.R3)(w)}function U(e,t,n){const{length:s}=e,i=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,s)=>n===t||n<t&&e[s+1]>t))}(e,t):-1,o=n===m.Uq.Backwards?i:i+1||s,r=o-a.hT,c=o+a.hT-1,l=e.slice(Math.max(0,r),c+1);let d,u;switch(n){case m.Uq.Backwards:d=o>0,u=r>=0;break;case m.Uq.Forwards:d=o<s,u=c<=s-1;break;case m.Uq.Around:default:d=l.length>0,u=l.length===a.hT}return{newViewportIds:l,areSomeLocal:d,areAllLocal:u}}async function j(e){let t;const n=e.attachment?(e,a)=>{x.has(a)||(t=a,x.set(a,n));const i=(0,s.Rd)();(0,s.R3)({...i,fileUploads:{byMessageLocalId:{...i.fileUploads.byMessageLocalId,[a]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,R.Pn)();const a=(0,s.Rd)();e.serverTimeOffset=a.serverTimeOffset;const i=(0,c.Bt)(a);if(!i)return;const{threadId:r}=i;e.replyingTo||r===o._f||(e.replyingTo=(0,c.qS)(a,e.chat.id,r)),e.replyingTo&&!e.replyingToTopId&&r!==o._f&&(e.replyingToTopId=(0,c.qS)(a,e.chat.id,r)),await(0,N.t9)("sendMessage",e,n),n&&t&&x.delete(t)}(0,s.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=m.Uq.Around,isBudgetPreload:i=!1}=n||{};let{chatId:o,threadId:l}=n||{};if(!o){const t=(0,c.Bt)(e);if(!t)return;o=t.chatId,l=t.threadId}const d=(0,c.Z1)(e,o);if(!d||d.isRestricted)return;const u=(0,c.Cb)(e,o,l),h=(0,c.gb)(e,o,l),g=(0,c.qC)(e,o,l);if(u&&u.length&&s!==m.Uq.Around){const n=s===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),c=a?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:v}=U(c,n,s);if(f&&(e=(0,r.y9)(e,o,l,p)),(0,R.R3)((()=>{!async function(e,t,n,s,a,i,o,r){t||await O(a,i,r,o,n,s),s||e.loadViewportMessages({chatId:a.id,threadId:i,direction:o,isBudgetPreload:!0})}(t,v,a,i,d,l,s,n)})),i)return}else{const t=(0,c.G$)(e,o)||(0,c.rd)(e,o,l),n=Boolean(t&&h&&!h.includes(t)),s=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=U(s,t,m.Uq.Around);p&&u.length>=a.hT&&(e=(0,r.y9)(e,o,l,u)),f||(0,R.R3)((()=>{O(d,l,t,m.Uq.Around,n,i)}))}return e})),(0,s.iw)("loadMessage",(async(e,t,n)=>{const{chatId:a,messageId:i,replyOriginForId:l,threadUpdate:d}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await async function(e,t,n){const a=await(0,N.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===o._Q){if(n){let t=(0,s.Rd)();const a=(0,c.hj)(t,e.id,n);t=(0,r.cY)(t,e.id,n,{...a,replyToMessageId:void 0}),(0,s.R3)(t)}return}let i=(0,s.Rd)();return i=(0,r.cY)(i,e.id,t,a.message),i=(0,r.Sh)(i,(0,g.ee)(a.users,"id")),(0,s.R3)(i),a.message}(u,i,l);if(m&&d){const{lastMessageId:e,isDeleting:t}=d;(0,s.R3)((0,r.lG)((0,s.Rd)(),m,a,e,t))}})),(0,s.iw)("sendMessage",((e,t,n)=>{const s=(0,c.Bt)(e);if(!s)return;const{chatId:i,threadId:o,type:r}=s;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const l=(0,c.Z1)(e,i),d={...n,chat:l,replyingTo:(0,c.Yy)(e,i,o),noWebPage:(0,c.tV)(e,i,o),sendAs:(0,c._5)(e,i)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i,threadId:o,value:!1});const u=!n.attachments||n.attachments.length<=1,m=!u&&n.attachments&&n.attachments.length>1;if(u){const{attachments:e,...t}=d;j({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...s}=d,i=(0,g.Vl)(n,a.DU);for(let n=0;n<i.length;n++){const[a,...o]=i[n],r=`${Date.now()}${n}`;j({...s,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:a,groupedId:o.length>0?r:void 0}),o.forEach((e=>{j({...s,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:s,...a}=d;e&&j({...a,text:e,entities:t,replyingTo:s}),n.forEach((e=>{j({...a,attachment:e})}))}})),(0,s.iw)("editMessage",((e,t,n)=>{const{serverTimeOffset:s}=e,{text:a,entities:i}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:r,threadId:l,type:d}=o,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,l,d);u&&m&&((0,N.t9)("editMessage",{chat:u,message:m,text:a,entities:i,noWebPage:(0,c.tV)(e,r,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))})),(0,s.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:s,messageId:a}=n,i=(0,c.hj)(e,s,a),o=i&&x.get((0,d.KK)(i));o&&(0,N.u3)(o),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:s})})),(0,s.iw)("saveDraft",((e,t,n)=>{const{chatId:s,threadId:a,draft:i}=n;if(!i)return;const{text:l,entities:u}=i,m=(0,c.Z1)(e,s),h=(0,c.dy)(e,s);return h&&(0,d.NB)(h)?void 0:(a===o._f&&(0,N.t9)("saveDraft",{chat:m,text:l,entities:u,replyToMsgId:(0,c.Yy)(e,s,a)}),e=(0,r.pf)(e,s,a,"draft",i),e=(0,r.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}))})),(0,s.iw)("clearDraft",((e,t,n)=>{const{chatId:s,threadId:a,localOnly:i}=n;if(!(0,c.Ms)(e,s,a))return;const l=(0,c.Z1)(e,s);return i||a!==o._f||(0,N.t9)("clearDraft",l),e=(0,r.pf)(e,s,a,"draft",void 0),(0,r.a4)(e,s,{draftDate:void 0})})),(0,s.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:s,threadId:a,noWebPage:i}=n;return(0,r.pf)(e,s,a,"noWebPage",i)})),(0,s.iw)("pinMessage",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageId:a,isUnpin:i,isOneSide:o,isSilent:r}=n;(0,N.t9)("pinMessage",{chat:s,messageId:a,isUnpin:i,isOneSide:o,isSilent:r})})),(0,s.iw)("unpinAllMessages",((e,t,n)=>{const a=(0,c.Z1)(e,n.chatId);a&&async function(e){await(0,N.t9)("unpinAllMessages",{chat:e});let t=(0,s.Rd)();t=(0,r.pf)(t,e.id,o._f,"pinnedIds",[]),(0,s.R3)(t)}(a)})),(0,s.iw)("deleteMessages",((e,t,n)=>{const{messageIds:s,shouldDeleteForAll:a}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:o,threadId:r}=i,l=(0,c.Z1)(e,o);(0,N.t9)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:a});const d=(0,c._$)(e,o,r);s.includes(d)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:i}=a,o=(0,c.Z1)(e,i);(0,N.t9)("deleteScheduledMessages",{chat:o,messageIds:s});const r=(0,c.wU)(e,i);s.includes(r)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:a}=n,i=(0,c.Z1)(e,s);if(!i)return;await(0,N.t9)("deleteHistory",{chat:i,shouldDeleteForAll:a});const o=(0,c.Bt)(e);o&&o.chatId===s&&t.openChat({id:void 0})})),(0,s.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:s,reason:a,description:i}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:r}=o,l=(0,c.Z1)(e,r),d=await(0,N.t9)("reportMessages",{peer:l,messageIds:s,reason:a,description:i});t.showNotification({message:d?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("sendMessageAction",(async(e,t,n)=>{const{action:s,chatId:a,threadId:i}=n;if(a===e.currentUserId)return;const o=(0,c.Z1)(e,a);if(!o)return;const r=(0,c.dy)(e,a);r&&((0,d.cS)(r)||(0,d.NB)(r))||await(0,N.t9)("sendMessageAction",{peer:o,threadId:i,action:s})})),(0,s.iw)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:s}=e,i=(0,c.Bt)(e);if(!i)return;const{chatId:l,threadId:d}=i,u=(0,c.Cm)(e,l,d);if(!u)return;const{maxId:m}=n;if(L((()=>{(0,N.t9)("markMessageListRead",{serverTimeOffset:s,chat:u,threadId:d,maxId:m})})),d!==o._f)return;l===a.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,c.Cb)(e,l,d),g=(0,c.It)(e,l,d);if(!h||!g||!u.unreadCount)return e;const p=function(e,t,n){let s=0;for(let a=0,i=e.length;a<i&&(e[a]>=t&&e[a]<=n&&s++,!(e[a]>=n));a++);return s}(h,g,m);return p?(0,r.a4)(e,l,{lastReadInboxMessageId:m,unreadCount:Math.max(0,u.unreadCount-p)}):e})),(0,s.iw)("markMessagesRead",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageIds:a}=n;(0,N.t9)("markMessagesRead",{chat:s,messageIds:a})})),(0,s.iw)("loadWebPagePreview",((e,t,n)=>{const{text:a}=n;!async function(e){const t=await(0,N.t9)("fetchWebPagePreview",{message:e});(0,s.R3)({...(0,s.Rd)(),webPagePreview:t})}(a)})),(0,s.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,s.iw)("sendPollVote",((e,t,n)=>{const{chatId:s,messageId:a,options:i}=n,o=(0,c.Z1)(e,s);o&&(0,N.t9)("sendPollVote",{chat:o,messageId:a,options:i})})),(0,s.iw)("cancelPollVote",((e,t,n)=>{const{chatId:s,messageId:a}=n,i=(0,c.Z1)(e,s);i&&(0,N.t9)("sendPollVote",{chat:i,messageId:a,options:[]})})),(0,s.iw)("closePoll",((e,t,n)=>{var s;const{chatId:a,messageId:i}=n,o=(0,c.Z1)(e,a),r=null===(s=(0,c.hj)(e,a,i))||void 0===s?void 0:s.content.poll;o&&r&&(0,N.t9)("closePoll",{chat:o,messageId:i,poll:r})})),(0,s.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:a,messageId:i,option:o,offset:c,limit:l,shouldResetVoters:d}=n;!async function(e,t,n,a,i,o){const c=await(0,N.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:a,limit:i});if(!c)return;let l=(0,s.Rd)();l=(0,r.Sh)(l,(0,g.ee)(c.users,"id"));const{voters:d}=l.pollResults;(0,s.R3)({...l,pollResults:{...l.pollResults,voters:{...d,[n]:(0,g.Tw)([...!o&&d&&d[n]?d[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(a,i,o,c,l,d)})),(0,s.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:a,messageIds:i,toChatId:o,withMyScore:r,noAuthors:l,noCaptions:u}=e.forwardMessages,m=(0,c.wV)(e),h=a?(0,c.Z1)(e,a):void 0,g=o?(0,c.Z1)(e,o):void 0,p=a&&i?i.sort(((e,t)=>e-t)).map((t=>(0,c.hj)(e,a,t))).filter(Boolean):void 0;if(!h||!g||!p)return;const{isSilent:f,scheduledAt:v}=n,I=(0,c._5)(e,o),w=p.filter((e=>!(0,d.jM)(e)));w.length&&(0,N.t9)("forwardMessages",{fromChat:h,toChat:g,messages:w,serverTimeOffset:(0,s.Rd)().serverTimeOffset,isSilent:f,scheduledAt:v,sendAs:I,withMyScore:r,noAuthors:l,noCaptions:u,isCurrentUserPremium:m}),p.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:s,poll:a}=e.content;j({chat:g,text:t,entities:n,sticker:s,poll:a,isSilent:f,scheduledAt:v,sendAs:I})})),(0,s.R3)({...(0,s.Rd)(),forwardMessages:{}})})),(0,s.iw)("loadScheduledHistory",((e,t,n)=>{const{chatId:a}=n,i=(0,c.Z1)(e,a);i&&async function(e){const t=await(0,N.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,a=(0,g.ee)(n,"id"),i=Object.keys(a).map(Number).sort(((e,t)=>t-e));let c=(0,s.Rd)();c=(0,r.w3)(c,e.id,a),c=(0,r.pf)(c,e.id,o._f,"scheduledIds",i),(0,s.R3)(c)}(i)})),(0,s.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:s,id:a}=n,i=(0,c.Z1)(e,s);i&&(0,N.t9)("sendScheduledMessages",{chat:i,ids:[a]})})),(0,s.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:s,messageId:a,scheduledAt:i}=n,o=(0,c.Z1)(e,s),r=o&&(0,c.Tm)(e,o.id,a);o&&r&&(0,N.t9)("rescheduleMessage",{chat:o,message:r,scheduledAt:i})})),(0,s.iw)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:s,threadId:a}=n,i=(0,c.Cm)(e,s,a);i&&(0,N.t9)("requestThreadInfoUpdate",{chat:i,threadId:a})})),(0,s.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:a,chatId:i}=n,o=(0,c.Z1)(e,i);if(!o)return;e=(0,r.cY)(e,i,a,{transcriptionId:""}),(0,s.R3)(e);const l=await(0,N.t9)("transcribeAudio",{chat:o,messageId:a});e=(0,r.cY)((0,s.Rd)(),i,a,{transcriptionId:l,isTranscriptionError:!l}),(0,s.R3)(e)})),(0,s.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:a,ignoreCache:i}=n,o=i?a:(0,g.Tw)(a.filter((t=>!e.customEmojis.byId[t]))),r=await(0,N.t9)("fetchCustomEmoji",{documentId:o});r&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,g.ee)(r,"id")}}}))})),(0,s.iw)("loadPinnedMessages",((e,t,n)=>{const{chatId:a}=n,i=(0,c.Z1)(e,a);i&&async function(e){const t=await(0,N.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:a,users:i}=t,c=(0,g.ee)(n,"id"),l=Object.keys(c).map(Number).sort(((e,t)=>t-e));let d=(0,s.Rd)();d=(0,r.c_)(d,e.id,c),d=(0,r.pf)(d,e.id,o._f,"pinnedIds",l),d=(0,r.Sh)(d,(0,g.ee)(i,"id")),d=(0,r.fZ)(d,(0,g.ee)(a,"id")),(0,s.R3)(d)}(i)})),(0,s.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:a,messageId:i}=n,o=(0,c.Z1)(e,a);if(!o)return;const l=await(0,N.t9)("fetchSeenBy",{chat:o,messageId:i});l&&(0,s.R3)((0,r.cY)((0,s.Rd)(),a,i,{seenByUserIds:l}))})),(0,s.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:s,sendAsId:a}=n,i=(0,c.Z1)(e,s),o=(0,c.Z1)(e,a)||(0,c.dy)(e,a);if(i&&o)return(0,N.t9)("saveDefaultSendAs",{sendAs:o,chat:i}),(0,r.a4)(e,s,{fullInfo:{...i.fullInfo,sendAsId:a}})})),(0,s.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:a}=n,i=(0,c.Z1)(e,a);if(!i)return;const o=await(0,N.t9)("fetchSendAs",{chat:i});o?(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(o.chats,"id")),e=(0,r.a4)(e,a,{sendAsPeerIds:o.sendAs}),(0,s.R3)(e)):(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{sendAsPeerIds:[]}))})),(0,s.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:a}=n,i=(0,c.Z1)(e,a);if(!i)return;const o=await(0,N.t9)("fetchSponsoredMessages",{chat:i});o&&(e=(0,s.Rd)(),e=(0,r.Fn)(e,a,o.messages[0]),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(o.chats,"id")),(0,s.R3)(e))})),(0,s.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:s}=n,a=(0,c.Z1)(e,s),i=(0,c.fS)(e,s);a&&i&&(0,N.t9)("viewSponsoredMessage",{chat:a,random:i.randomId})})),(0,s.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:a,offsetId:i}=n,o=(0,c.Z1)(e,a);if(!o)return;const l=await(0,N.t9)("fetchUnreadMentions",{chat:o,offsetId:i});if(!l)return;const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,o.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=(0,r.fZ)(e,(0,g.ee)(u,"id")),e=(0,r.a4)(e,a,{unreadMentions:[...o.unreadMentions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:a}=n,i=(0,c.jr)(e);if(!i)return;const o=(i.unreadMentions||[]).filter((e=>!a.includes(e)));e=(0,r.a4)(e,i.id,{unreadMentions:o}),(0,s.R3)(e),t.markMessagesRead({messageIds:a})})),(0,s.iw)("focusNextMention",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0]})})),(0,s.iw)("readAllMentions",(e=>{const t=(0,c.jr)(e);if(t)return(0,N.t9)("readAllMentions",{chat:t}),(0,r.a4)(e,t.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,s.iw)("openUrl",((e,t,n)=>{const{url:s,shouldSkipModal:i}=n,o=(0,B.X)(s);if(o.match(a.FS)||o.match(a.g$))return void t.openTelegramLink({url:s});const{appConfig:r}=e;if(r){const e=new URL(o);if(r.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",r.autologinToken),void window.open(e.href,"_blank","noopener");if(r.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:s})}o.match(a.jL)||i?window.open(o,"_blank","noopener"):t.toggleSafeLinkModal({url:o})})),(0,s.iw)("setForwardChatId",(async(e,t,n)=>{const{id:a}=n;let i=(0,c.dy)(e,a);if(i&&(0,c.Nm)(e)){var o;if(!i.fullInfo){const{accessHash:e}=i;i=await(0,N.t9)("fetchFullUser",{id:a,accessHash:e})}if(null!==(o=i)&&void 0!==o&&o.fullInfo.noVoiceMessages)return void t.showDialog({data:{message:(0,v.i0)("VoiceMessagesRestrictedByPrivacy",(0,d.Js)(i))}})}(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,isModalShown:!1}}),t.openChat({id:a}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,s.iw)("forwardToSavedMessages",((e,t)=>{(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:e.currentUserId}}),t.exitMessageSelectMode(),t.forwardMessages({isSilent:!0})}));var F=n(85765),D=n(9211);const q=(0,R.P2)((e=>e()),500,!1);async function $(e){const t=await(0,N.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,recent:t}})}async function G(e){const t=await(0,N.t9)("fetchStickers",{stickerSetInfo:e});let n=(0,s.Rd)();if(!t)return(0,R.R3)((()=>{(0,s.Sv)().showNotification({message:(0,v.i0)("StickerPack.ErrorNotFound")})})),void("shortName"in e&&n.openedStickerSetShortName===e.shortName&&(0,s.R3)({...n,openedStickerSetShortName:void 0}));const{set:a,stickers:i,packs:o}=t;n=(0,r.Rg)(n,a.id,{...a,stickers:i,packs:o});const c=n.stickers.forEmoji.emoji;c&&o[c]&&(n=(0,r.vy)(n)),(0,s.R3)(n)}async function H(e,t){const n=await(0,N.t9)("searchGifs",{query:e,offset:t});n&&(0,s.R3)((0,r.rq)((0,s.Rd)(),!t,n.gifs,n.nextOffset))}(0,s.iw)("loadStickerSets",((e,t)=>{!async function(e){const t=await(0,N.t9)("fetchStickerSets",{hash:e});t&&(0,s.R3)((0,r.z3)((0,s.Rd)(),"added",t.hash,t.sets))}(e.stickers.added.hash),async function(e){const t=await(0,N.t9)("fetchCustomEmojiSets",{hash:e});t&&(0,s.R3)((0,r.z3)((0,s.Rd)(),"added",t.hash,t.sets))}(e.customEmojis.added.hash),t.loadCustomEmojis({ids:e.recentCustomEmojis})})),(0,s.iw)("loadAddedStickers",(async(e,t)=>{const{added:{setIds:n=[]},setsById:s}=e.stickers,{added:{setIds:a=[]}}=e.customEmojis,i=[...n,...a];if(i.length)for(let e=0;e<i.length;e++){var o;const n=i[e];null!==(o=s[n])&&void 0!==o&&o.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:s[n].accessHash}}),e%10==0&&e>0&&await(0,R.wO)(200))}})),(0,s.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};$(t)})),(0,s.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,N.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,s.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,N.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,premium:{hash:n.hash,stickers:n.stickers}}}))})),(0,s.iw)("loadPremiumSetStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,N.t9)("fetchStickersForEmoji",{emoji:"📂⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,premiumSet:{hash:n.hash,stickers:n.stickers}}}))})),(0,s.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,N.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}}))})),(0,s.iw)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,N.t9)("fetchFeaturedStickers",{hash:e});t&&(0,s.R3)((0,r.z3)((0,s.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,s.iw)("loadPremiumGifts",(async()=>{const e=await(0,N.t9)("fetchPremiumGifts");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)({...(0,s.Rd)(),premiumGifts:{...t,stickers:n}})})),(0,s.iw)("loadStickers",((e,t,n)=>{var s;const{stickerSetInfo:a}=n,i=(0,c.Ny)(e,a);i&&i.count===(null==i||null===(s=i.stickers)||void 0===s?void 0:s.length)||G(a)})),(0,s.iw)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,N.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)((0,r.g_)((0,s.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,N.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)({...(0,s.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,s.iw)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,N.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,s.iw)("saveGif",(async(e,t,n)=>{var a,i;const{gif:o,shouldUnsave:r}=n,l=null===(a=e.gifs.saved.gifs)||void 0===a?void 0:a.length,d=(0,D.M)(e,"savedGifs"),u=(0,D.P)(e,"savedGifs"),m=(0,c.wV)(e);if(!r&&l&&l>=d&&t.showNotification({title:v.i0("LimitReachedFavoriteGifs",d.toString()),message:m?v.i0("LimitReachedFavoriteGifsSubtitlePremium"):v.i0("LimitReachedFavoriteGifsSubtitle",u.toString()),...!m&&{action:t.openPremiumModal},className:"bold-link"}),!await(0,N.t9)("saveGif",{gif:o,shouldUnsave:r}))return;const h=(null===(i=(e=(0,s.Rd)()).gifs.saved.gifs)||void 0===i?void 0:i.filter((e=>{let{id:t}=e;return t!==o.id})))||[],g=r?h:[o,...h];(0,s.R3)({...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:g}}})})),(0,s.iw)("faveSticker",((e,t,n)=>{const{sticker:s}=n,a=e.stickers.favorite.stickers.length,i=(0,D.M)(e,"stickersFaved"),o=(0,D.P)(e,"stickersFaved"),r=(0,c.wV)(e);a>=i&&t.showNotification({title:v.i0("LimitReachedFavoriteStickers",i.toString()),message:r?v.i0("LimitReachedFavoriteStickersSubtitlePremium"):v.i0("LimitReachedFavoriteStickersSubtitle",o.toString()),...!r&&{action:t.openPremiumModal},className:"bold-link"}),s&&(0,N.t9)("faveSticker",{sticker:s})})),(0,s.iw)("unfaveSticker",((e,t,n)=>{const{sticker:a}=n;a&&function(e){const t=(0,s.Rd)();(0,s.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((t=>{let{id:n}=t;return n!==e.id}))}}}),(0,N.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,s.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,N.t9)("removeRecentSticker",{sticker:s})&&$()})),(0,s.iw)("clearRecentStickers",(async e=>{await(0,N.t9)("clearRecentStickers")&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,recent:{stickers:[]}}}))})),(0,s.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:s}=n,a=(0,c.Ny)(e,s);if(!a)return;const{accessHash:i,installedDate:o}=a;(0,N.t9)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:i})})),(0,s.iw)("loadEmojiKeywords",(async(e,t,n)=>{var a,i;const{language:o}=n;let r=e.emojiKeywords[o];if(null!==(a=r)&&void 0!==a&&a.isLoading)return;(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!0}}});const c=await(0,N.t9)("fetchEmojiKeywords",{language:o,fromVersion:r?r.version:0});r=(e=(0,s.Rd)()).emojiKeywords[o],c?(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:c.version,keywords:{...null===(i=r)||void 0===i?void 0:i.keywords,...c.keywords}}}}):(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!1}}})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;a&&q((()=>{!async function(e,t){const n=await(0,N.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const a=(0,s.Rd)(),{setsById:i,added:o}=a.stickers,c=n.sets.map((e=>{let{id:t}=e;return t}));o.setIds&&o.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=i[t]||{};n&&(0,F.Z)(n,e)&&c.unshift(t)}})),(0,s.R3)((0,r.z3)(a,"search",n.hash,n.sets,c))}(a)}))})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;"string"==typeof s&&q((()=>{H(s)}))})),(0,s.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&q((()=>{H(t,n)}))})),(0,s.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:a}=n,{hash:i}=e.stickers.forEmoji;q((()=>{!async function(e,t){let n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const a=await(0,N.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,s.Rd)(),a&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,a.stickers,a.hash),(0,s.R3)(n))}(a,i)}))})),(0,s.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,s.iw)("loadCustomEmojiForEmoji",((e,t,n)=>{const{emoji:s}=n;return(0,r.AA)(e,s)})),(0,s.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,s.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,N.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,g.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,g.ee)(t.sets,"id")}}}))})),(0,s.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:a}=n;(0,c.Ny)(e,a)||await G(a),e=(0,s.Rd)();const i=(0,c.Ny)(e,a);null!=i&&i.shortName?(0,s.R3)({...e,openedStickerSetShortName:i.shortName}):t.showNotification({message:(0,v.i0)("StickerPack.ErrorNotFound")})}));var V=n(790);const _=(0,R.P2)((e=>e()),500,!1);async function z(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;if(o){const s=await(0,N.t9)("searchMessagesLocal",{chat:o,query:t,type:n,limit:a.Hk,offsetId:i,minDate:d,maxDate:l});if(s){const{messages:t,users:n,totalCount:a,nextOffsetId:i}=s;e={messages:t,users:n,chats:[],totalCount:a,nextRate:i}}}else e=await(0,N.t9)("searchMessagesGlobal",{query:t,offsetRate:i,limit:a.Hk,type:n,maxDate:l,minDate:d});let u=(0,s.Rd)();const m=(0,c.JX)(u);if(!e||""!==t&&t!==m)return void(0,s.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:v,nextRate:I}=e;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,v,n,I),(0,s.R3)(u)}async function W(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=await(0,N.t9)("searchMessagesLocal",{chat:e,type:t,limit:2*a.EN,offsetId:n});if(!o)return;const{chats:l,users:d,messages:u,totalCount:m,nextOffsetId:h}=o,p=(0,g.ee)(u,"id"),f=Object.keys(p).map(Number);let v=(0,s.Rd)();const I=(0,c.we)(v);I&&(v=(0,r.fZ)(v,(0,g.ee)(l,"id")),v=(0,r.Sh)(v,(0,g.ee)(d,"id")),v=(0,r.c_)(v,e.id,p),v=(0,r.c1)(v,e.id,t,f,m,h),(0,s.R3)(v),i||W(e,t,h,!0))}(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:a}=e.globalSearch,{query:i}=n;i&&!a&&_((()=>{!async function(e){const t=await(0,N.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=(0,c.JX)(n);if(!t||!a||e!==a)return void(0,s.R3)((0,r.xv)(n,{chats:!1}));const{localChats:i,localUsers:o,globalChats:l,globalUsers:d}=t;(i.length||l.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...i,...l],"id"))),(o.length||d.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...o,...d],"id"))),n=(0,r.xv)(n,{chats:!1}),n=(0,r.No)(n,{localResults:{chatIds:i.map((e=>{let{id:t}=e;return t})),userIds:o.map((e=>{let{id:t}=e;return t}))},globalResults:{...n.globalSearch.globalResults,chatIds:l.map((e=>{let{id:t}=e;return t})),userIds:d.map((e=>{let{id:t}=e;return t}))}}),(0,s.R3)(n)}(i)}))})),(0,s.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:a}=n,i=a?(0,V.IS)(a):a;e=(0,r.No)(e,{date:a,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}}),(0,s.R3)(e);const{chatId:o}=e.globalSearch;z("","text",void 0,o?(0,c.Z1)(e,o):void 0,i,a)})),(0,s.iw)("searchMessagesGlobal",((e,t,n)=>{var s;const{query:a,resultsByType:i,chatId:o,date:r}=e.globalSearch,l=r?(0,V.IS)(r):r,{type:d}=n;z(a,d,null==i||null===(s=i[d])||void 0===s?void 0:s.nextOffsetId,o?(0,c.Z1)(e,o):void 0,l,r)})),(0,s.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},i=t?(0,c.Z1)(e,t):void 0,l=(0,c.n5)(e);if(!i||!l||!n)return;const{query:d,results:u}=l,m=null==u?void 0:u.nextOffsetId;let h;if(n!==o._f){const s=(0,c.tZ)(e,t,n);h=null==s?void 0:s.topMessageId}!async function(e,t,n,i,o){if(!i)return;const l=await(0,N.t9)("searchMessagesLocal",{chat:e,type:"text",query:i,topMessageId:n,limit:a.pn,offsetId:o});if(!l)return;const{chats:d,users:u,messages:m,totalCount:h,nextOffsetId:p}=l,f=(0,g.ee)(m,"id"),v=Object.keys(f).map(Number);let I=(0,s.Rd)();const w=(0,c.n5)(I);w&&i===w.query&&(I=(0,r.fZ)(I,(0,g.ee)(d,"id")),I=(0,r.Sh)(I,(0,g.ee)(u,"id")),I=(0,r.c_)(I,e.id,f),I=(0,r.dx)(I,e.id,t,v,h,p),(0,s.R3)(I))}(i,n,h,d,m)})),(0,s.iw)("searchMediaMessagesLocal",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(!t)return;const n=(0,c.Z1)(e,t),s=(0,c.we)(e);if(!n||!s)return;const{currentType:a,resultsByType:i}=s,o=a&&i&&i[a],r=null==o?void 0:o.nextOffsetId;a&&W(n,a,r)})),(0,s.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:a}=n,{chatId:i}=(0,c.Bt)(e)||{};if(!i)return;const o=(0,c.Z1)(e,i);o&&async function(e,t){const n=await(0,N.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,s.Sv)().focusMessage({chatId:e.id,messageId:n})}(o,a)})),(0,s.iw)("checkPublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};if(!a)return;if(e.management.progress===m.wv.InProgress)return;const{username:i}=n;e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0}),(0,s.R3)(e);const o=await(0,N.t9)("checkChatUsername",{username:i});e=(0,s.Rd)(),e=(0,r.H9)(e,o?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:o,checkedUsername:i}),(0,s.R3)(e),void 0===o&&t.openLimitReachedModal({limit:"channelsPublic"})})),(0,s.iw)("updatePublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};let i=a&&(0,c.Z1)(e,a);if(!a||!i)return;const{username:o}=n;if(e=(0,r.H9)(e,m.wv.InProgress),(0,s.R3)(e),(0,d.G9)(i)){if(i=await(0,T.bZ)(i),!i)return;t.openChat({id:i.id})}const l=await(0,N.t9)("setChatUsername",{chat:i,username:o});e=(0,s.Rd)(),e=(0,r.H9)(e,l?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0}),(0,s.R3)(e)})),(0,s.iw)("updatePrivateLink",(e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t&&(0,c.Z1)(e,t);t&&n&&(0,N.t9)("updatePrivateLink",{chat:n})})),(0,s.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:a,invite:i}=n;(0,s.R3)((0,r.fw)(e,a,{editingInvite:i}))})),(0,s.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:a,invite:i}=n,o=i?{inviteInfo:{invite:i}}:{inviteInfo:void 0};(0,s.R3)((0,r.fw)(e,a,o))})),(0,s.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:i,isRevoked:o,limit:l}=n,d=(0,c.Z1)(e,a),u=(0,c.dy)(e,i||e.currentUserId);if(!d||!u)return;const m=await(0,N.t9)("fetchExportedChatInvites",{peer:d,admin:u,isRevoked:o,limit:l});if(!m)return;const h=o?{revokedInvites:m}:{invites:m};(0,s.R3)((0,r.fw)((0,s.Rd)(),a,h))})),(0,s.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:a,link:i,isRevoked:o,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,a);if(!h)return;const g=await(0,N.t9)("editExportedChatInvite",{peer:h,link:i,isRevoked:o,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m});if(!g)return;const{oldInvite:p,newInvite:f}=g,v=((e=(0,s.Rd)()).management.byChatId[a].invites||[]).filter((e=>e.link!==p.link)),I=[...e.management.byChatId[a].revokedInvites||[]];f.isRevoked?I.unshift(f):v.push(f),(0,s.R3)((0,r.fw)(e,a,{invites:v,revokedInvites:I}))})),(0,s.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:a,expireDate:i,usageLimit:o,isRequestNeeded:l,title:d}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await(0,N.t9)("exportChatInvite",{peer:u,expireDate:i,usageLimit:o,isRequestNeeded:l,title:d});if(!m)return;const h=(e=(0,s.Rd)()).management.byChatId[a].invites||[];(0,s.R3)((0,r.fw)(e,a,{invites:[...h,m]}))})),(0,s.iw)("deleteExportedChatInvite",(async(e,t,n)=>{var a,i;const{chatId:o,link:l}=n,d=(0,c.Z1)(e,o);if(!d)return;if(!await(0,N.t9)("deleteExportedChatInvite",{peer:d,link:l}))return;const u=(e=(0,s.Rd)()).management.byChatId[o];(0,s.R3)((0,r.fw)(e,o,{invites:null==u||null===(a=u.invites)||void 0===a?void 0:a.filter((e=>e.link!==l)),revokedInvites:null==u||null===(i=u.revokedInvites)||void 0===i?void 0:i.filter((e=>e.link!==l))}))})),(0,s.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:i}=n,o=(0,c.Z1)(e,a),l=(0,c.dy)(e,i||e.currentUserId);o&&l&&await(0,N.t9)("deleteRevokedExportedChatInvites",{peer:o,admin:l})&&(e=(0,s.Rd)(),(0,s.R3)((0,r.fw)(e,a,{revokedInvites:[]})))})),(0,s.iw)("loadChatInviteImporters",(async(e,t,n)=>{var a;const{chatId:i,link:o,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,i),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,N.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u});if(!g)return;const{importers:p,users:f}=g,v=null===(a=(e=(0,s.Rd)()).management.byChatId[i])||void 0===a?void 0:a.inviteInfo;null!=v&&v.invite&&v.invite.link===o&&(e=(0,r.fw)(e,i,{inviteInfo:{...v,importers:p}}),e=(0,r.Sh)(e,f),(0,s.R3)(e))})),(0,s.iw)("loadChatInviteRequesters",(async(e,t,n)=>{var a;const{chatId:i,link:o,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,i),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,N.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u,isRequested:!0});if(!g)return;const{importers:p,users:f}=g,v=null===(a=(e=(0,s.Rd)()).management.byChatId[i])||void 0===a?void 0:a.inviteInfo;null!=v&&v.invite&&v.invite.link===o&&(e=(0,r.fw)(e,i,{inviteInfo:{...v,requesters:p}}),e=(0,r.Sh)(e,f),(0,s.R3)(e))})),(0,s.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:a,offsetDate:i,offsetUserId:o,limit:l}=n,d=(0,c.Z1)(e,a),u=(0,c.dy)(e,o);if(!d||o&&!u)return;const m=await(0,N.t9)("fetchChatInviteImporters",{peer:d,offsetDate:i,offsetUser:u,limit:l,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,s.Rd)(),e=(0,r.a4)(e,a,{joinRequests:h}),e=(0,r.Sh)(e,g),(0,s.R3)(e)})),(0,s.iw)("hideChatJoinRequest",(async(e,t,n)=>{var a;const{chatId:i,userId:o,isApproved:l}=n,d=(0,c.Z1)(e,i),u=(0,c.dy)(e,o);if(!d||!u)return;if(!await(0,N.t9)("hideChatJoinRequest",{peer:d,user:u,isApproved:l}))return;e=(0,s.Rd)();const m=(0,c.Z1)(e,i);m&&(0,s.R3)((0,r.a4)(e,i,{joinRequests:null===(a=m.joinRequests)||void 0===a?void 0:a.filter((e=>e.userId!==o))}))})),(0,s.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:a,isApproved:i,link:o}=n,l=(0,c.Z1)(e,a);if(!l)return;if(!await(0,N.t9)("hideAllChatJoinRequests",{peer:l,isApproved:i,link:o}))return;e=(0,s.Rd)();const d=(0,c.Z1)(e,a);d&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:[],fullInfo:{...d.fullInfo,recentRequesterIds:[],requestsPending:0}}))})),(0,s.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:a}=n,i=(0,c.Z1)(e,a);i&&await(0,N.t9)("hideChatReportPanel",i)&&(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{settings:void 0}))}));var X=n(65116),J=n(16974);let Y,K;function Q(e){return(0,N.t9)("fetchMessages",{chat:e,threadId:o._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(a.hT/2)+1),limit:a.hT})}(0,s.iw)("sync",(()=>{a.eM&&console.log(">>> START SYNC"),Y&&clearTimeout(Y),(0,s.R3)({...(0,s.Rd)(),isSyncing:!0}),Y=window.setTimeout((()=>{(0,s.R3)({...(0,s.Rd)(),isSyncing:!1}),Y=void 0}),15e3);const{loadAllChats:e,preloadTopChatMessages:t}=(0,s.Sv)();e({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(){let e=!1,t=(0,s.Rd)();const n=Object.keys(t.messages.byChatId).reduce(((e,n)=>(e[n]={},e[n].draft=(0,c.Ms)(t,n,o._f),e[n].editingId=(0,c._$)(t,n,o._f),e[n].editingDraft=(0,c.s)(t,n,o._f),e)),{}),{chatId:i,threadId:l}=(0,c.Bt)(t)||{},d=i?t.chats.byId[i]:void 0;if(i&&d){const n=await Q(d);t=(0,s.Rd)();const{chatId:u}=(0,c.Bt)(t)||{},m=l&&(0,c.tZ)(t,i,l);if(n&&u===i){const s=t.messages.byChatId[i],c=i===a.aw?t.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],d=[].concat(n.messages,c),u=(0,g.ee)(d,"id"),h=Object.keys(u).map(Number);if(t={...t,messages:{...t.messages,byChatId:{}}},t=(0,r.c_)(t,i,u),t=(0,r.xj)(t,i,o._f,h),t=(0,r.y9)(t,i,o._f,h),l&&m&&m.originChannelId){const{originChannelId:e}=m,n=t.messages.byChatId[e],a=await Q(t.chats.byId[e]);if(a){const e=(0,g.ee)(a.messages,"id"),r=Object.keys(e).map(Number);t={...t,messages:{...t.messages,byChatId:{...t.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[o._f]:{...null==n?void 0:n.threadsById[o._f],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[i]:{...t.messages.byChatId[i],threadsById:{...t.messages.byChatId[i].threadsById,[l]:{...null==s?void 0:s.threadsById[l],outlyingIds:void 0}}}}}}}}t=(0,r.GL)(t,(0,g.ee)(n.chats,"id")),t=(0,r.eD)(t,(0,g.ee)(n.users,"id")),t=(0,r.j6)(t,i,n.threadInfos),e=!0}}e||(t={...t,messages:{...t.messages,byChatId:{}}}),Object.keys(n).forEach((e=>{t=(0,r.sN)(t,e,o._f,n[e])})),(0,s.R3)(t);const{chatId:u,messageId:m}=t.audioPlayer;u&&m&&!(0,c.hj)(t,u,m)&&(0,s.Sv)().closeAudioPlayer()}(),(0,s.R3)({...(0,s.Rd)(),lastSyncTime:Date.now(),isSyncing:!1}),a.eM&&console.log(">>> FINISH SYNC"),(0,J.S1)(),e({listType:"archived",shouldReplace:!0}),(0,N.t9)("fetchCurrentUser"),t()}})})),(0,X.ll)((e=>{var t,n;const{connectionState:a,authState:i}=e;(null===(t=K)||void 0===t?void 0:t.connectionState)===a&&(null===(n=K)||void 0===n?void 0:n.authState)===i||("connectionStateReady"===a&&"authorizationStateReady"===i&&(0,s.Sv)().sync(),K=e)})),(0,s.iw)("reportPeer",(async(e,t,n)=>{const{chatId:s,reason:a,description:i}=n;if(!s)return;const o=(0,c.Z1)(e,s);if(!o)return;const r=await(0,N.t9)("reportPeer",{peer:o,reason:a,description:i});t.showNotification({message:r?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:s,reason:a,description:i,photo:o}=n;if(!s)return;const r=(0,c.Z1)(e,s);if(!r||!o)return;const l=await(0,N.t9)("reportProfilePhoto",{peer:r,photo:o,reason:a,description:i});t.showNotification({message:l?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("loadAuthorizations",(async()=>{const e=await(0,N.t9)("fetchAuthorizations");e&&(0,s.R3)({...(0,s.Rd)(),activeSessions:{byHash:e.authorizations,orderedHashes:Object.keys(e.authorizations),ttlDays:e.ttlDays}})})),(0,s.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,N.t9)("terminateAuthorization",a))return;e=(0,s.Rd)();const{[a]:i,...o}=e.activeSessions.byHash;(0,s.R3)({...e,activeSessions:{byHash:o,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,N.t9)("terminateAllAuthorizations"))return;const t=(e=(0,s.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];(0,s.R3)({...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}})})),(0,s.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:a,areCallsEnabled:i,areSecretChatsEnabled:o}=n;await(0,N.t9)("changeSessionSettings",{hash:a,areCallsEnabled:i,areSecretChatsEnabled:o})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[a]:{...e.activeSessions.byHash[a],...void 0!==i?{areCallsEnabled:i}:void 0,...void 0!==o?{areSecretChatsEnabled:o}:void 0}}}}))})),(0,s.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:a}=n;await(0,N.t9)("changeSessionTtl",{days:a})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,ttlDays:a}}))})),(0,s.iw)("loadWebAuthorizations",(async()=>{const e=await(0,N.t9)("fetchWebAuthorizations");e&&(0,s.R3)({...(0,s.Rd)(),activeWebSessions:{byHash:e,orderedHashes:Object.keys(e)}})})),(0,s.iw)("terminateWebAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,N.t9)("terminateWebAuthorization",a))return;e=(0,s.Rd)();const{[a]:i,...o}=e.activeWebSessions.byHash;(0,s.R3)({...e,activeWebSessions:{byHash:o,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllWebAuthorizations",(async e=>{await(0,N.t9)("terminateAllWebAuthorizations")&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeWebSessions:{byHash:{},orderedHashes:[]}}))}));const ee=(0,R.P2)((e=>e()),500,!1);function te(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function ne(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,s.iw)("loadFullUser",((e,t,n)=>{const{userId:s}=n,a=(0,c.dy)(e,s);if(!a)return;const{id:i,accessHash:o}=a;(0,N.t9)("fetchFullUser",{id:i,accessHash:o})})),(0,s.iw)("loadUser",(async(e,t,n)=>{const{userId:a}=n,i=(0,c.dy)(e,a);if(!i)return;const o=await(0,N.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:l,userStatusesById:d}=o;e=(0,s.Rd)(),e=(0,r.eD)(e,(0,g.ee)(l,"id")),e=(0,r.ps)(e,{...e.users.statusesById,...d}),(0,s.R3)(e)})),(0,s.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,N.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let a=(0,s.Rd)();a=(0,r.Sh)(a,(0,g.ee)(n,"id")),a={...a,topPeers:{...a.topPeers,userIds:t,lastRequestedAt:(0,p.b)(a.serverTimeOffset)}},(0,s.R3)(a)}()})),(0,s.iw)("loadContactList",(()=>{!async function(){const e=await(0,N.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,s.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id")),t=(0,r.zn)(t,e.userStatusesById);const n=e=>e.lastName||e.firstName||"",a=new Intl.Collator("en-US"),i=e.users.sort(((e,t)=>a.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,s.R3)({...t,contactList:{userIds:i.map((e=>e.id))}})}()})),(0,s.iw)("loadCurrentUser",(()=>{(0,N.t9)("fetchCurrentUser")})),(0,s.iw)("loadCommonChats",(async e=>{var t,n,a;const{chatId:i}=(0,c.Bt)(e)||{},o=i?(0,c.dy)(e,i):void 0;if(!o||(0,d.cS)(o)||null!==(t=o.commonChats)&&void 0!==t&&t.isFullyLoaded)return;const l=null===(n=o.commonChats)||void 0===n?void 0:n.maxId,u=await(0,N.t9)("fetchCommonChats",o.id,o.accessHash,l);if(!u)return;const{chats:m,chatIds:h,isFullyLoaded:p}=u;e=(0,s.Rd)(),m.length&&(e=(0,r.fZ)(e,(0,g.ee)(m,"id"))),e=(0,r.Nq)(e,o.id,{commonChats:{maxId:h.length?h[h.length-1]:"0",ids:(0,g.Tw)(((null===(a=o.commonChats)||void 0===a?void 0:a.ids)||[]).concat(h)),isFullyLoaded:p}}),(0,s.R3)(e)})),(0,s.iw)("updateContact",((e,t,n)=>{const{userId:a,isMuted:i=!1,firstName:o,lastName:l,shouldSharePhoneNumber:d}=n;!async function(e,t,n,a,i){let o=(0,s.Rd)();const l=(0,c.dy)(o,e);if(!l)return;let d;if((0,s.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,s.R3)((0,r.H9)((0,s.Rd)(),m.wv.InProgress)),!l.isContact&&l.phoneNumber)d=await(0,N.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:a});else{const{id:e,accessHash:t}=l;d=await(0,N.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:a,shouldSharePhoneNumber:i})}d&&((0,s.Sv)().loadChatSettings({chatId:e}),(0,s.R3)((0,r.Nq)((0,s.Rd)(),l.id,{firstName:n,lastName:a}))),o=(0,s.Rd)(),o=(0,r.H9)(o,m.wv.Complete),o=(0,r.ft)(o),(0,s.R3)(o)}(a,i,o,l,d)})),(0,s.iw)("deleteContact",((e,t,n)=>{const{userId:a}=n;!async function(e){const t=(0,s.Rd)(),n=(0,c.dy)(t,e);if(!n)return;const{id:a,accessHash:i}=n;await(0,N.t9)("deleteContact",{id:a,accessHash:i})}(a)})),(0,s.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:a}=n,i=(0,d.YC)(a),o=i?(0,c.dy)(e,a):void 0,l=i?void 0:(0,c.Z1)(e,a);if(!o&&!l)return;const u=await(0,N.t9)("fetchProfilePhotos",o,l);u&&u.photos&&(e=(0,s.Rd)(),i?e=(0,r.Nq)(e,a,{photos:u.photos}):(e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,r.a4)(e,a,{photos:u.photos})),(0,s.R3)(e))})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;a&&ee((()=>{!async function(e){const t=await(0,N.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=n.userSearch.query;if(!t||!a||e!==a)return void(0,s.R3)((0,r.Q3)(n,!1));const{localUsers:i,globalUsers:o}=t;let c,l;i.length&&(n=(0,r.Sh)(n,(0,g.ee)(i,"id")),c=i.map((e=>{let{id:t}=e;return t}))),o.length&&(n=(0,r.Sh)(n,(0,g.ee)(o,"id")),l=o.map((e=>{let{id:t}=e;return t}))),n=(0,r.Q3)(n,!1),n=(0,r.Lm)(n,{localUserIds:c,globalUserIds:l}),(0,s.R3)(n)}(a)}))})),(0,s.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:a,firstName:i,lastName:o}=n,c=await(0,N.t9)("importContact",{phone:a,firstName:i,lastName:o});c?(t.openChat({id:c}),(0,s.R3)((0,r.ft)((0,s.Rd)()))):t.showNotification({message:v.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,s.iw)("reportSpam",((e,t,n)=>{const{chatId:s}=n,a=(0,d.YC)(s)?(0,c.dy)(e,s):(0,c.Z1)(e,s);a&&(0,N.t9)("reportSpam",a)}));var se=n(18629);const ae=h.cj||h.wZ;class ie{constructor(e,t){var n,s;this.features=e,this.onFail=t,s=void 0,(n="preOpened")in this?Object.defineProperty(this,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):this[n]=s}preOpenIfNeeded(){var e;ae&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():null===(e=this.onFail)||void 0===e||e.call(this))}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!ae){const n=window.open(e,void 0,this.features);var t;n?n.focus():null===(t=this.onFail)||void 0===t||t.call(this)}}cancelPreOpen(){var e;null===(e=this.preOpened)||void 0===e||e.close(),this.preOpened=void 0}}const oe="https://prizes.gamee.com/",re=(0,R.Ds)((e=>e()),500,!1);async function ce(e,t){await(0,N.t9)("toggleAttachBot",{bot:e,isEnabled:t}),await le()}async function le(e){const t=await(0,N.t9)("loadAttachBots",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}function de(e,t){if("request"===t.type){const e=(0,s.Rd)();if(!e.urlAuth)return;const{domain:n,bot:a,shouldRequestWriteAccess:i}=t;return void(0,s.R3)({...e,urlAuth:{...e.urlAuth,request:{domain:n,botId:a.id,shouldRequestWriteAccess:i}}})}const n="accepted"===t.type?t.url:e;window.open(n,"_blank","noopener"),(0,s.Sv)().closeUrlAuthModal()}async function ue(e,t,n,s,a){await(0,N.t9)("sendMessage",{chat:e,text:n,replyingTo:s,sendAs:a})}let me;async function he(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{showDialog:i,showNotification:o,openUrl:r,openGame:c}=(0,s.Sv)();a&&(me||(me=new ie("popup,width=800,height=600",(()=>{o({message:"Allow browser to open popup window"})}))),me.preOpenIfNeeded());const l=await(0,N.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n,isGame:a});if(!l)return;const{message:d,alert:u,url:m}=l;u?i({data:{message:d||"Error"}}):d?o({message:d}):m&&(a?m.includes(oe)?me.open(m):(me.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}async function ge(e){const t=await(0,N.t9)("getPaymentForm",e);if(!t)return;const{form:n,invoice:a}=t;let i=(0,r._7)((0,s.Rd)(),n);return i=(0,r.Q$)(i,m.KB.Checkout),(0,s.R3)(i),a}async function pe(e,t,n){const a=await(0,N.t9)("validateRequestedInfo",{inputInvoice:e,requestInfo:t,shouldSave:n});if(!a)return;const{id:i,shippingOptions:o}=a;let c=(0,r.vT)((0,s.Rd)(),i);o?(c=(0,r.TM)(c,o),c=(0,r.Q$)(c,m.KB.Shipping)):c=(0,r.Q$)(c,m.KB.Checkout),(0,s.R3)(c)}(0,s.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:s,button:a}=n;switch(a.type){case"command":t.sendBotCommand({command:a.text});break;case"url":{const{url:e}=a;t.openUrl({url:e});break}case"callback":{const t=(0,c.jr)(e);if(!t)return;he(t,s,a.data);break}case"requestPoll":t.openPollModal({isQuiz:a.isQuiz});break;case"requestPhone":{const n=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id}});break}case"receipt":{const n=(0,c.jr)(e);if(!n)return;const{receiptMessageId:i}=a;t.getReceipt({receiptMessageId:i,chatId:n.id,messageId:s});break}case"buy":{const n=(0,c.jr)(e);if(!n)return;t.openInvoice({chatId:n.id,messageId:s});break}case"game":{const t=(0,c.jr)(e);if(!t)return;he(t,s,void 0,!0);break}case"switchBotInline":{const{query:e,isSamePeer:n}=a;t.switchBotInline({query:e,isSamePeer:n,messageId:s});break}case"userProfile":{const{userId:e}=a;t.openChatWithInfo({id:e});break}case"simpleWebView":{const{url:n}=a,{chatId:i}=(0,c.Bt)(e)||{};if(!i)return;const o=(0,c.hj)(e,i,s);if(null==o||!o.senderId)return;const r=(0,se.BS)();t.requestSimpleWebView({url:n,botId:null==o?void 0:o.senderId,theme:r,buttonText:a.text});break}case"webView":{const{url:n}=a,i=(0,c.jr)(e);if(!i)return;const o=(0,c.hj)(e,i.id,s);if(!o)return;const r=o.viaBotId||o.senderId;if(!r)return;const l=(0,se.BS)();t.requestWebView({url:n,botId:r,peerId:i.id,theme:l,buttonText:a.text});break}case"urlAuth":{const{url:n}=a,i=(0,c.jr)(e);if(!i)return;t.requestBotUrlAuth({chatId:i.id,messageId:s,buttonId:a.buttonId,url:n});break}}})),(0,s.iw)("sendBotCommand",((e,t,n)=>{const{command:s,chatId:a}=n,{currentUserId:i}=e,o=a?(0,c.Z1)(e,a):(0,c.jr)(e),r=(0,c.Bt)(e);if(!i||!o||!r)return;const{threadId:l}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o.id,threadId:l,value:!1}),ue(o,0,s,(0,c.Yy)(e,o.id,l),(0,c._5)(e,a))})),(0,s.iw)("restartBot",(async(e,t,n)=>{const{chatId:a}=n,{currentUserId:i}=e,o=(0,c.jr)(e),l=i&&(0,c.IK)(e,a);i&&o&&l&&await(0,N.t9)("unblockContact",l.id,l.accessHash)&&((0,s.R3)((0,r.rB)((0,s.Rd)(),l.id)),ue(o,0,"/start",void 0,(0,c._5)(e,a)))})),(0,s.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,p.b)(e.serverTimeOffset)-t<60)return;const n=await(0,N.t9)("fetchTopInlineBots");if(!n)return;const{ids:a,users:i}=n;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:a,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,s.R3)(e)})),(0,s.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:a,username:i,query:o,offset:l}=n;let d=e.inlineBots.byUsername[i];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,N.t9)("fetchInlineBot",{username:i})||{};if(e=(0,s.Rd)(),!t||!n)return void(0,s.R3)(te(e,i,!1));e=(0,r.Sh)(e,{[t.id]:t}),e=(0,r.fZ)(e,{[n.id]:n}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=te(e,i,d),(0,s.R3)(e)}(o!==d.query||d.canLoadMore)&&re((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:a,query:i,offset:o}=e,r=(0,s.Rd)();const l=(0,c.dy)(r,n.id),d=(0,c.Z1)(r,a);if(!l||!d)return;const u=n.query!==i;r=ne(r,!0),r=te(r,t,{...n,query:i,...u&&{offset:void 0,results:[]}}),(0,s.R3)(r);const m=await(0,N.t9)("fetchInlineBotResults",{bot:l,chat:d,query:i,offset:u?void 0:o}),h=r.inlineBots.byUsername[t];if(r=ne((0,s.Rd)(),!1),!m||!h||i!==h.query)return void(0,s.R3)(r);const g=new Set((h.results||[]).map((e=>e.id))),p=m.results.filter((e=>!g.has(e.id)));r=te(r,t,{...h,help:m.help,...p.length&&{isGallery:m.isGallery},...m.switchPm&&{switchPm:m.switchPm},canLoadMore:m.results.length>0&&Boolean(m.nextOffset),results:""===h.offset||h.offset===m.nextOffset?m.results:(h.results||[]).concat(p),offset:p.length?m.nextOffset:""}),(0,s.R3)(r)}({username:i,inlineBotData:d,chatId:a,query:o,offset:l})}))}})),(0,s.iw)("switchBotInline",((e,t,n)=>{const{query:s,isSamePeer:a,messageId:i}=n,o=(0,c.jr)(e);if(!o)return;const r=(0,c.hj)(e,o.id,i);if(!r)return;const l=(0,c.dy)(e,r.viaBotId||r.senderId);l&&t.openChatWithDraft({text:`@${l.username} ${s}`,chatId:a?o.id:void 0})})),(0,s.iw)("sendInlineBotResult",((e,t,n)=>{const{id:s,queryId:a,isSilent:i,scheduledAt:o}=n,r=(0,c.Bt)(e);if(!r||!s)return;const{chatId:l,threadId:d}=r,u=(0,c.Z1)(e,l);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:l,threadId:d,value:!1}),(0,N.t9)("sendInlineBotResult",{chat:u,resultId:s,queryId:a,replyingTo:(0,c.Yy)(e,l,d),sendAs:(0,c._5)(e,l),isSilent:i,scheduleDate:o})})),(0,s.iw)("resetInlineBot",((e,t,n)=>{const{username:a}=n;let i=e.inlineBots.byUsername[a];i&&(i={id:i.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,s.R3)(te(e,a,i)))})),(0,s.iw)("startBot",(async(e,t,n)=>{var a;const{botId:i,param:o}=n;let r=(0,c.dy)(e,i);r&&(r.fullInfo||await(0,N.t9)("fetchFullUser",{id:r.id,accessHash:r.accessHash}),r=(0,c.dy)((0,s.Rd)(),i),null!==(a=r.fullInfo)&&void 0!==a&&a.isBlocked&&await(0,N.t9)("unblockContact",r.id,r.accessHash),await(0,N.t9)("startBot",{bot:r,startParam:o}))})),(0,s.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:a,botId:i,theme:o,buttonText:r}=n,l=(0,c.dy)(e,i);if(!l)return;if(!(0,c.LM)(e,i))return void(0,s.R3)({...e,botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}});const d=await(0,N.t9)("requestSimpleWebView",{url:a,bot:l,theme:o});d&&(e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:d,botId:i,buttonText:r}}))})),(0,s.iw)("requestWebView",(async(e,t,n)=>{const{url:a,botId:i,peerId:o,theme:r,isSilent:l,buttonText:d,isFromBotMenu:u,startParam:m}=n,h=(0,c.dy)(e,i);if(!h)return;const g=(0,c.Z1)(e,o);if(!g)return;if(!(0,c.LM)(e,i))return void(0,s.R3)({...e,botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}});const p=(0,c.Bt)(e);if(!p)return;const{chatId:f,threadId:v}=p,I=f&&(0,c.Yy)(e,f,v),w=(0,c._5)(e,f),y=await(0,N.t9)("requestWebView",{url:a,bot:h,peer:g,theme:r,isSilent:l,replyToMessageId:I||void 0,isFromBotMenu:u,startParam:m,sendAs:w});if(!y)return;const{url:P,queryId:Z}=y;e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:P,botId:i,queryId:Z,buttonText:d}})})),(0,s.iw)("prolongWebView",(async(e,t,n)=>{const{botId:s,peerId:a,isSilent:i,replyToMessageId:o,queryId:r}=n,l=(0,c.dy)(e,s);if(!l)return;const d=(0,c.Z1)(e,a);if(!d)return;const u=(0,c._5)(e,a);await(0,N.t9)("prolongWebView",{bot:l,peer:d,isSilent:i,replyToMessageId:o,queryId:r,sendAs:u})||t.closeWebApp()})),(0,s.iw)("sendWebViewData",((e,t,n)=>{const{bot:s,data:a,buttonText:i}=n;(0,N.t9)("sendWebViewData",{bot:s,data:a,buttonText:i})})),(0,s.iw)("closeWebApp",(e=>({...e,webApp:void 0}))),(0,s.iw)("setWebAppPaymentSlug",((e,t,n)=>{var s;if(null!==(s=e.webApp)&&void 0!==s&&s.url)return{...e,webApp:{...e.webApp,slug:n.slug}}})),(0,s.iw)("cancelBotTrustRequest",(e=>({...e,botTrustRequest:void 0}))),(0,s.iw)("markBotTrusted",((e,t,n)=>{var a;const{botId:i}=n,{trustedBotIds:o}=e,r=new Set(o);if(r.add(i),(0,s.R3)({...e,botTrustRequest:void 0,trustedBotIds:Array.from(r)}),null!==(a=e.botTrustRequest)&&void 0!==a&&a.onConfirm){const{action:n,payload:s}=e.botTrustRequest.onConfirm;t[n](s)}})),(0,s.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:s}=n||{};await le(s)})),(0,s.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:s,isEnabled:a}=n,i=(0,c.dy)(e,s);i&&await ce(i,a)})),(0,s.iw)("callAttachBot",((e,t,n)=>{const{chatId:s,botId:a,isFromBotMenu:i,url:o,startParam:r}=n,{attachMenu:{bots:c}}=e;if(!i&&!c[a])return{...e,requestedAttachBotInstall:{botId:a,onConfirm:{action:"callAttachBot",payload:{chatId:s,botId:a,startParam:r}}}};const l=(0,se.BS)();t.openChat({id:s}),t.requestWebView({url:o,peerId:s,botId:a,theme:l,buttonText:"",isFromBotMenu:i,startParam:r})})),(0,s.iw)("confirmAttachBotInstall",(async e=>{const{requestedAttachBotInstall:t}=e,{botId:n,onConfirm:a}=t;(0,s.R3)({...e,requestedAttachBotInstall:void 0});const i=(0,c.dy)(e,n);if(i&&(await ce(i,!0),a)){const{action:e,payload:t}=a;(0,s.Sv)()[e](t)}})),(0,s.iw)("cancelAttachBotInstall",(e=>({...e,requestedAttachBotInstall:void 0}))),(0,s.iw)("requestAttachBotInChat",((e,t,n)=>{var a;const{botId:i,filter:o,startParam:r}=n,l=null===(a=(0,c.Bt)(e))||void 0===a?void 0:a.chatId,{attachMenu:{bots:d}}=e,u=d[i];if(!u)return;const m=u.peerTypes.filter((e=>"self"!==e&&o.includes(e)));m.length?(0,s.R3)({...e,requestedAttachBotInChat:{botId:i,filter:m,startParam:r}}):t.callAttachBot({chatId:l||i,botId:i,startParam:r})})),(0,s.iw)("cancelAttachBotInChat",(e=>({...e,requestedAttachBotInChat:void 0}))),(0,s.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:a,buttonId:i,messageId:o,url:r}=n,l=(0,c.Z1)(e,a);if(!l)return;const d=await(0,N.t9)("requestBotUrlAuth",{chat:l,buttonId:i,messageId:o});d&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:r,button:{buttonId:i,messageId:o,chatId:l.id}}}),de(r,d))})),(0,s.iw)("acceptBotUrlAuth",(async(e,t,n)=>{var s;const{isWriteAllowed:a}=n;if(null===(s=e.urlAuth)||void 0===s||!s.button)return;const{button:i,url:o}=e.urlAuth,{chatId:r,messageId:l,buttonId:d}=i,u=(0,c.Z1)(e,r);if(!u)return;const m=await(0,N.t9)("acceptBotUrlAuth",{chat:u,messageId:l,buttonId:d,isWriteAllowed:a});m&&de(o,m)})),(0,s.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:a}=n,i=await(0,N.t9)("requestLinkUrlAuth",{url:a});i&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:a}}),de(a,i))})),(0,s.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{var s;const{isWriteAllowed:a}=n;if(null===(s=e.urlAuth)||void 0===s||!s.url)return;const{url:i}=e.urlAuth,o=await(0,N.t9)("acceptLinkUrlAuth",{url:i,isWriteAllowed:a});o&&de(i,o)})),(0,s.iw)("closeUrlAuthModal",(e=>({...e,urlAuth:void 0}))),n(51371),(0,s.iw)("loadPasswordInfo",(async e=>{const t=await(0,N.t9)("getPasswordInfo");t&&(e=(0,s.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),e=(0,r.IE)(e,{hint:t.hint}),(0,s.R3)(e))})),(0,s.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:i}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const o=await(0,N.t9)("checkPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),o&&i()})),(0,s.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:i}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const o=await(0,N.t9)("clearPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),o&&i()})),(0,s.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:a,password:i,hint:o,email:c,onSuccess:l}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const d=await(0,N.t9)("updatePassword",a,i,o,c);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),d&&l()})),(0,s.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:a,email:i,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,N.t9)("updateRecoveryEmail",a,i);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),c&&o()})),(0,s.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:s}=n;(0,N.t9)("provideRecoveryEmailCode",s)})),(0,s.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,s.iw)("validateRequestedInfo",((e,t,n)=>{const s=(0,c.kb)(e);if(!s)return;const{requestInfo:a,saveInfo:i}=n;if("slug"in s)pe(s,a,i);else{const t=(0,c.Z1)(e,s.chatId);if(!t)return;pe({chat:t,messageId:s.messageId},a,i)}})),(0,s.iw)("openInvoice",(async(e,t,n)=>{let a;if("slug"in n)a=await ge({slug:n.slug});else{const t=(0,c.Z1)(e,n.chatId);if(!t)return;a=await ge({chat:t,messageId:n.messageId})}a&&(e=(0,s.Rd)(),e=(0,r.bs)(e,a),(0,s.R3)({...e,payment:{...e.payment,inputInvoice:n,isPaymentModalOpen:!0,status:"cancelled"}}))})),(0,s.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:a,chatId:i,messageId:o}=n,l=i&&(0,c.Z1)(e,i);o&&a&&l&&async function(e,t,n){const a=await(0,N.t9)("getReceipt",e,n);if(!a)return;let i=(0,s.Rd)();const o=(0,c.hj)(i,e.id,t);i=(0,r.Dq)(i,a,o),(0,s.R3)(i)}(l,o,a)})),(0,s.iw)("clearPaymentError",(e=>{(0,s.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,s.iw)("clearReceipt",(e=>{(0,s.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,s.iw)("sendCredentialsInfo",((e,t,n)=>{const{nativeProvider:i}=e.payment,{credentials:o}=n,{data:l}=o;if("stripe"===i){const t=(0,c.$$)(e);if(!t)return;!async function(e,t){const n=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),a=await fetch(`https://api.stripe.com/v1/tokens${n}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),i=await a.json();if(i.error){const e=(0,d.Ow)(i.error),t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let o=(0,r.QH)((0,s.Rd)(),{type:i.type,id:i.id});o=(0,r.Q$)(o,m.KB.Checkout),(0,s.R3)(o)}(l,t)}else if("smartglocal"===i){const t=(0,c.EB)(e);if(!t)return;!async function(e,t){const n={card:{number:e.cardNumber.replace(/\D+/g,""),expiration_month:e.expiryMonth,expiration_year:e.expiryYear,security_code:e.cvv.replace(/\D+/g,"")}},i=a.eA?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",o=await fetch(i,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":t},body:JSON.stringify(n)}),c=await o.json();if("ok"!==c.status){const e={description:"payment error"},t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let l=(0,r.QD)((0,s.Rd)(),{type:"card",token:c.data.token});l=(0,r.Q$)(l,m.KB.Checkout),(0,s.R3)(l)}(l,t)}})),(0,s.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:a,saveCredentials:i,savedCredentialId:o,tipAmount:l}=n,d=(0,c.kb)(e),u=(0,c.eh)(e),m=(0,c.sp)(e),{nativeProvider:h,temporaryPassword:g}=e.payment,p="stripe"===h?(0,c.$$)(e):(0,c.EB)(e);if(!(d&&p&&u&&h))return;let f;if("slug"in d)f={slug:d.slug};else{const t=(0,c.Z1)(e,d.chatId);if(!t)return;f={chat:t,messageId:d.messageId}}(0,s.R3)((0,r.cQ)(e,{status:"pending"}));const v={save:i,data:"stripe"===h?(0,c.i3)(e):(0,c.Jg)(e)};await(0,N.t9)("sendPaymentForm",{inputInvoice:f,formId:u,credentials:v,requestedInfoId:m,shippingOptionId:a,savedCredentialId:o,temporaryPassword:null==g?void 0:g.value,tipAmount:l})&&(e=(0,s.Rd)(),e=(0,r.bp)(e),e=(0,r.cQ)(e,{status:"paid"}),e=(0,r.WY)(e),(0,s.R3)(e))})),(0,s.iw)("setPaymentStep",(function(e,t){var n;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,null!==(n=s.step)&&void 0!==n?n:m.KB.Checkout)})),(0,s.iw)("closePremiumModal",((e,t,n)=>{if(!e.premiumModal)return;const{isClosed:s}=n||{};return{...e,premiumModal:{...e.premiumModal,...s&&{isOpen:!1},isClosing:!s}}})),(0,s.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:a,fromUserId:i,isSuccess:o,isGift:c,monthsAmount:l,toUserId:d}=n||{};t.loadPremiumStickers();const u=await(0,N.t9)("fetchPremiumPromo");u&&(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),(0,s.R3)({...e,premiumModal:{promo:u.promo,initialSection:a,isOpen:!0,fromUserId:i,toUserId:d,isGift:c,monthsAmount:l,isSuccess:o}}))})),(0,s.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:a}=n||{},i=await(0,N.t9)("fetchPremiumPromo");if(!i)return;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id"));const o=i.promo.options.find((e=>1===e.months));(0,s.R3)({...e,giftPremiumModal:{isOpen:!0,forUserId:a,monthlyCurrency:o.currency,monthlyAmount:o.amount}})})),(0,s.iw)("closeGiftPremiumModal",(e=>{(0,s.R3)({...e,giftPremiumModal:{isOpen:!1}})})),(0,s.iw)("validatePaymentPassword",(async(e,t,n)=>{let{password:a}=n;const i=await(0,N.t9)("fetchTemporaryPaymentPassword",a);e=(0,s.Rd)(),e=i?"error"in i?(0,r.cQ)(e,{error:{message:i.error,field:"password"}}):(0,r.cQ)(e,{temporaryPassword:i,step:m.KB.Checkout}):(0,r.cQ)(e,{error:{message:"Unknown Error",field:"password"}}),(0,s.R3)(e)}));var fe=n(40647),ve=n(4907),Ie=n(74399);const we=32*Ie.Gw,ye=45.5*Ie.Gw,Pe=26.5*Ie.Gw,Ze=18*Ie.Gw,Ce=16.125*Ie.Gw;var be=n(43858),Se=n(53475);function Ee(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=be.Z.get().width)>a._m?Math.min(Math.max(.25*n,Ze),.33*n):n>a.ks?Math.min(Math.max(.33*n,Ze),.4*n):Pe):0);var n}function Me(e,t,n){return(0,Se.a4)(e,t,n,void 0,!0)}let Re=0;(0,s.iw)("loadAvailableReactions",(async()=>{const e=await(0,N.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&fe.he(`sticker${e.aroundAnimation.id}`,o.IU.BlobUrl),e.centerIcon&&fe.he(`sticker${e.centerIcon.id}`,o.IU.BlobUrl)})),(0,s.R3)({...(0,s.Rd)(),availableReactions:e}))})),(0,s.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:s,x:a,y:i,localEffect:o,startSize:r,isReversed:c}=n,l={id:Re++,animatedEffect:s||o,x:Ee(e,a)+40*Math.random()-20,y:i+40*Math.random()-20,startSize:r,isReversed:c};return{...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],l]}})),(0,s.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:s,chatId:a,emoji:i,interactions:o,localEffect:r}=n,l=(0,c.Z1)(e,a);l&&(i||r)&&a!==e.currentUserId&&(0,N.t9)("sendEmojiInteraction",{chat:l,messageId:s,emoticon:i||(0,c.ji)(r),timestamps:o})})),(0,s.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:s,messageId:a,x:i,y:o}=n,r=(0,c.q6)(e,s),l=(0,c.hj)(e,s,a);r&&l&&!(0,d.CI)(l)&&t.sendReaction({chatId:s,messageId:a,reaction:r,x:i,y:o})})),(0,s.iw)("sendReaction",((e,t,n)=>{var s,i,o;const{chatId:r}=n;let{messageId:l}=n,{reaction:d}=n;const u=(0,c.Z1)(e,r);let m=(0,c.hj)(e,r,l);if(!u||!m)return;const h=Boolean(m.groupedId)&&!m.isInAlbum,p=h?(0,c.xH)(e,r,m.groupedId)[0]:void 0;m=h&&(0,c.hj)(e,r,p)||m,l=(null===(s=m)||void 0===s?void 0:s.id)||l,null!==(i=m.reactions)&&void 0!==i&&null!==(o=i.results)&&void 0!==o&&o.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,N.t9)("sendReaction",{chat:u,messageId:l,reaction:d});const{animationLevel:f}=e.settings.byKey;return f===a.zy&&(e={...e,activeReactions:{...d?e.activeReactions:(0,g.CE)(e.activeReactions,[l]),...d&&{[l]:{reaction:d,messageId:l}}}}),function(e,t,n,s){const{reactions:a}=(0,c.hj)(e,t,n)||{};if(!a)return e;let i=a.results.map((e=>e.reaction===s?{...e,count:e.isChosen?e.count:e.count+1,isChosen:!0}:e.isChosen?{...e,isChosen:!1,count:e.count-1}:e)).filter((e=>e.count>0)),{recentReactions:o}=a;if(s&&!i.some((e=>e.reaction===s))){const{currentUserId:t}=e;i=[...i,{reaction:s,isChosen:!0,count:1}],a.canSeeList&&(o=[...o||[],{userId:t,reaction:s}])}return(0,ve.cY)(e,t,n,{reactions:{...a,results:i,recentReactions:o}})}(e,r,l,d)})),(0,s.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,s.iw)("stopActiveReaction",((e,t,n)=>{var s;const{messageId:a,reaction:i}=n;return(null===(s=e.activeReactions[a])||void 0===s?void 0:s.reaction)!==i?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[a])}})),(0,s.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:a}=n;await(0,N.t9)("setDefaultReaction",{reaction:a})&&(0,s.R3)({...(0,s.Rd)(),appConfig:{...e.appConfig,defaultReaction:a}})})),(0,s.iw)("stopActiveEmojiInteraction",((e,t,n)=>{var s;const{id:a}=n;return{...e,activeEmojiInteractions:null===(s=e.activeEmojiInteractions)||void 0===s?void 0:s.filter((e=>e.id!==a))}})),(0,s.iw)("loadReactors",(async(e,t,n)=>{var a,i,o;const{chatId:l,messageId:d,reaction:u}=n,m=(0,c.Z1)(e,l),h=(0,c.hj)(e,l,d);if(!m||!h)return;const p=null===(a=h.reactors)||void 0===a?void 0:a.nextOffset,f=await(0,N.t9)("fetchMessageReactionsList",{reaction:u,chat:m,messageId:d,offset:p});if(!f)return;e=(0,s.Rd)(),null!==(i=f.users)&&void 0!==i&&i.length&&(e=(0,r.Sh)(e,(0,g.ee)(f.users,"id")));const{nextOffset:v,count:I,reactions:w}=f;(0,s.R3)((0,r.cY)(e,l,d,{reactors:{nextOffset:v,count:I,reactions:[...(null===(o=h.reactors)||void 0===o?void 0:o.reactions)||[],...w]}}))})),(0,s.iw)("loadMessageReactions",((e,t,n)=>{const{ids:s,chatId:a}=n,i=(0,c.Z1)(e,a);i&&(0,N.t9)("fetchMessageReactions",{ids:s,chat:i})})),(0,s.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{var s;const{chatId:a,emoticon:i,x:o,y:r,startSize:l,isReversed:d,id:u}=n,m=(0,c.Z1)(e,a);if(m&&null!==(s=e.activeEmojiInteractions)&&void 0!==s&&s.some((e=>e.id===u))&&a!==e.currentUserId)return(0,N.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:i}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:Ee(e,o),y:r,startSize:l,isReversed:d}:t))}})),(0,s.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:a,offsetId:i}=n,o=(0,c.Z1)(e,a);if(!o)return;const l=await(0,N.t9)("fetchUnreadReactions",{chat:o,offsetId:i,addOffset:i?-1:void 0});if(!l||!l.messages.length)return e=Me(e=(0,s.Rd)(),a,{unreadReactionsCount:0}),void(0,s.R3)(e);const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,o.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=Me(e=(0,r.fZ)(e,(0,g.ee)(u,"id")),a,{unreadReactions:[...o.unreadReactions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:i}=n,{animationLevel:o}=e.settings.byKey,r=(0,c.jr)(e);if(r){if(r.unreadReactionsCount){const n=r.unreadReactionsCount-i.length,a=(r.unreadReactions||[]).filter((e=>!i.includes(e)));e=Me(e,r.id,{unreadReactions:a}),(0,s.R3)(e),!a.length&&n&&t.fetchUnreadReactions({chatId:r.id,offsetId:Math.min(...i)})}if(t.markMessagesRead({messageIds:i}),o===a.zy)return e=(0,s.Rd)(),{...e,activeReactions:{...e.activeReactions,...Object.fromEntries(i.map((t=>{var n,s;const a=(0,c.hj)(e,r.id,t);if(!a)return;const i=null===(n=a.reactions)||void 0===n||null===(s=n.recentReactions)||void 0===s?void 0:s.find((e=>e.isUnread));return i?[t,{messageId:t,reaction:null==i?void 0:i.reaction}]:void 0})).filter(Boolean))}}}})),(0,s.iw)("focusNextReaction",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0]})})),(0,s.iw)("readAllReactions",(e=>{const t=(0,c.jr)(e);if(t)return(0,N.t9)("readAllReactions",{chat:t}),Me(e,t.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,s.iw)("loadStatistics",(async(e,t,n)=>{var a;const{chatId:i,isGroup:o}=n,l=(0,c.Z1)(e,i);if(null==l||!l.fullInfo)return;const d=await(0,N.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:l});if(d){if(e=(0,s.Rd)(),null!==(a=d.recentTopMessages)&&void 0!==a&&a.length){const t=(0,c.Zw)(e,i);d.recentTopMessages=d.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}(0,s.R3)((0,r.ze)(e,i,d))}})),(0,s.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:a,messageId:i}=n,o=(0,c.Z1)(e,a);if(null==o||!o.fullInfo)return;let l=await(0,N.t9)("fetchMessageStatistics",{chat:o,messageId:i});l||(l={}),e=(0,s.Rd)();const{views:d,forwards:u}=(0,c.Zw)(e,a)[i];l.views=d,l.forwards=u;const m=o.fullInfo.statisticsDcId,h=await(0,N.t9)("fetchMessagePublicForwards",{chat:o,messageId:i,dcId:m});l.publicForwards=null==h?void 0:h.length,l.publicForwardsData=h,e=(0,s.Rd)(),(0,s.R3)((0,r.kM)(e,l))})),(0,s.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:a,token:i,name:o,isPercentage:l}=n,d=(0,c.Z1)(e,a);if(null==d||!d.fullInfo)return;const u=d.fullInfo.statisticsDcId,m=await(0,N.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:u,isPercentage:l});m&&(0,s.R3)((0,r.yC)((0,s.Rd)(),a,o,m))})),n(28304);var ke=n(28406);function Ae(e,t){const n=typeof e;if(n!==typeof t)return!1;if("object"!==n)return e===t;const s=Array.isArray(e);if(s!==Array.isArray(t))return!1;if(s){const n=e,s=t;return n.length===s.length&&n.every(((e,t)=>Ae(e,s[t])))}const a=e,i=t;return Object.keys(a).every((e=>Ae(a[e],i[e])))}(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":return(0,s.R3)((0,r.a4)(e,n.id,n.chat,n.newProfilePhoto)),n.noTopChatsRequest||(0,c.N)(e,n.id)||t.loadTopChats(),void(n.chat.id&&(0,ke.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}));case"updateChatJoin":{const a=(0,c.Ek)(e,n.id);if(!a)return;e=(0,r.B1)(e,a,[n.id]),e=(0,r.a4)(e,n.id,{isNotJoined:!1}),(0,s.R3)(e);const i=(0,c.Z1)(e,n.id);return void(i&&t.requestChatUpdate({chatId:i.id}))}case"updateChatLeave":return(0,r.Dd)(e,n.id);case"updateChatInbox":return(0,r.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,typingStatus:a}=n;return(0,s.R3)((0,r.a4)(e,t,{typingStatus:a})),void setTimeout((()=>{e=(0,s.Rd)();const n=(0,c.Z1)(e,t);n&&a&&n.typingStatus&&n.typingStatus.timestamp===a.timestamp&&(0,s.R3)((0,r.a4)(e,t,{typingStatus:void 0}))}),6e3)}case"newMessage":{const{message:a}=n,{chatId:i,threadId:l,type:d}=(0,c.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const u=(0,c.Z1)(e,n.chatId);if(!u)return;const m="thread"===d&&l===o._f&&n.chatId===i,h=Boolean(n.message.id&&n.message.hasUnreadMention);return m?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):e=(0,r.a4)(e,n.chatId,{unreadCount:(u.unreadCount||0)+1,...h&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1}}),h&&(e=(0,r.a4)(e,n.chatId,{unreadMentions:[...u.unreadMentions||[],n.message.id]})),(0,s.R3)(e),void(0,ke.rh)({chat:u,message:a})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;return t.forEach((t=>{const s="channelId"in n?n.channelId:(0,c.X5)(e,t),a=(0,c.Z1)(e,s);var i,o;null!=a&&a.unreadReactionsCount&&(e=Me(e,s,{unreadReactionsCount:a.unreadReactionsCount-1||void 0,unreadReactions:null===(i=a.unreadReactions)||void 0===i?void 0:i.filter((e=>e!==t))})),null!=a&&a.unreadMentionsCount&&(e=(0,r.a4)(e,s,{unreadMentionsCount:a.unreadMentionsCount-1||void 0,unreadMentions:null===(o=a.unreadMentions)||void 0===o?void 0:o.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,s=e.chats.byId[n.id];if(!s)return;return(0,r.a4)(e,n.id,{fullInfo:{...s.fullInfo,...t}})}case"updatePinnedChatIds":{const{ids:t,folderId:s}=n,i=s===a.WS?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:s}=n,i=(0,c.Ek)(e,t);if(!i)return;const{[i]:o}=e.chats.orderedPinnedIds;let r=o||[];if(s){if(!r.includes(t)){if("active"===i&&r.length>=a.EG){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,[i]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:s}=n;return(0,r.Pi)(e,t,s)}case"updateChatFolder":{const{id:t,folder:s}=n,{byId:a,orderedIds:i}=e.chatFolders,o=s?{...a,[t]:s}:(0,g.ei)(a,Object.keys(a).map(Number).filter((e=>e!==t))),r=s?i&&i.includes(t)?i:[...i||[],t]:i?i.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:o,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":{var i;const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:a,deletedMemberId:o}=n;if(!t)return;let c=!1,l=null!==(i=t.fullInfo)&&void 0!==i&&i.members?[...t.fullInfo.members]:[];if(s)l=s,c=!0;else if(a)l.length&&l.some((e=>e.userId===a.userId))||(l.push(a),c=!0);else if(l.length&&o){const e=l.findIndex((e=>e.userId===o));e>-1&&(l.slice(e,1),c=!0)}if(c){const s=l.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,r.a4)(e,n.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:s}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,a=e.chats.byId[t];return null!=a&&a.photos?(0,r.a4)(e,t,{photos:a.photos.filter((e=>!s.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:s,date:a,replyingToId:i}=n;if(!e.chats.byId[t])return;return e=(0,r.pf)(e,t,o._f,"draft",s),e=(0,r.pf)(e,t,o._f,"replyingToId",i),e=(0,r.a4)(e,t,{draftDate:a})}case"showInvite":{const{data:e}=n;return void t.showDialog({data:e})}case"updatePendingJoinRequests":{const{chatId:a,requestsPending:i,recentRequesterIds:o}=n,c=e.chats.byId[a];if(!c)return;e=(0,r.a4)(e,a,{fullInfo:{...c.fullInfo,requestsPending:i,recentRequesterIds:o}}),(0,s.R3)(e),t.loadChatJoinRequests({chatId:a})}}}));const Te=350;function Ne(e,t,n,s,a,i,o){var l;const u=null==o?void 0:o.reactions;if(u&&Ae(s,u))return e;if(e=(0,r.cY)(e,t,n,{reactions:s}),!i)return e;const m=null===(l=a.unreadReactions)||void 0===l?void 0:l.includes(n);if((0,d.yL)(e,s)&&!m){e=Me(e,t,{unreadReactionsCount:((null==a?void 0:a.unreadReactionsCount)||0)+1,unreadReactions:[...(null==a?void 0:a.unreadReactions)||[],n]});const s=(0,c.hj)(e,t,n);if(!a||!s)return e;(0,R.R3)((()=>{(0,ke.rh)({chat:a,message:s,isReaction:!0})}))}else if(m){var h;e=Me(e,t,{unreadReactionsCount:((null==a?void 0:a.unreadReactionsCount)||1)-1,unreadReactions:null==a||null===(h=a.unreadReactions)||void 0===h?void 0:h.filter((e=>e!==n))})}return e}function Be(e,t,n,s){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const i=a?(0,c.Tm)(e,t,n):(0,c.hj)(e,t,n);if(i&&s.content){const{photo:e,video:t,sticker:n,document:a}=(0,d.qp)(i);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:n&&s.content.sticker?s.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:a&&s.content.document&&(s.content.document.previewBlobUrl=a.previewBlobUrl)}return a?(0,r.P4)(e,t,n,s):(0,r.cY)(e,t,n,s)}function xe(e,t,n,s){const{chatId:a}=n,{threadInfo:i}=(0,c.Db)(e,a,n)||{};if(!i&&n.replyToMessageId){const i=(0,c.hj)(e,a,n.replyToMessageId);i?e=(0,r.lG)(e,i,a,n.id,s):t.loadMessage({chatId:a,messageId:n.replyToMessageId,threadUpdate:{isDeleting:s,lastMessageId:n.id}})}return e}function Le(e,t,n){const{id:s,chatId:a}=n,{threadInfo:i,firstMessageId:l}=(0,c.Db)(e,a,n)||{},u=(0,c.Z1)(e,a),m=(null==u?void 0:u.unreadCount)&&!(0,c.gb)(e,a,o._f);if(e=xe(e,t,n),i&&(!l&&(0,d.CI)(n)||(e=(0,r.xj)(e,a,i.threadId,[s]),(0,c.b9)(e,a,i.threadId)&&(e=(0,r.$S)(e,a,i.threadId,s),l||(e=(0,r.pf)(e,a,i.threadId,"firstMessageId",n.id)))),e=(0,r.pf)(e,a,i.threadId,"threadInfo",{...i,lastMessageId:n.id,messagesCount:i.messagesCount+1})),m)return e;if(e=(0,r.xj)(e,a,o._f,[s]),(0,c.b9)(e,a,o._f)){const t=(0,c.It)(e,a,o._f),n=(0,r.$S)(e,a,o._f,s),i=(0,c.Cb)(n,a,o._f);t&&!i.includes(t)||(e=n)}return e}function Oe(e,t,n){var s;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:i}=e,o=null===(s=i.byId[t])||void 0===s?void 0:s.lastMessage;return!o||a||o.id===n.id||o.id===n.previousLocalId||n.id>o.id?(0,r.a4)(e,t,{lastMessage:n}):e}function Ue(e,t){const n=(0,c.Zw)(e,t),s=(0,c.gb)(e,t,o._f);if(!n||!s)return;let a=s.length;for(;a--;){const e=n[s[a]];if(!e.isDeleting)return e}}function je(e,t,n,a){if(e){t.forEach((t=>{const n=Ue(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);n&&(a=Oe(a,e,n,!0))})),n.requestChatUpdate({chatId:e});const i=[];return t.forEach((t=>{const s=(0,c.hj)(a,e,t);if(!s)return;a=xe(a,n,s,!0);const{threadInfo:o}=(0,c.Db)(a,e,s)||{};o&&i.push(o.threadId)})),(0,s.R3)(a),void setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),e,t)),(0,g.Tw)(i).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),Te)}const i=[];t.forEach((e=>{const t=(0,c.X5)(a,e);if(t){i.push(t);const n=Ue(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);n&&(a=Oe(a,t,n,!0)),setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),t,[e]))}),Te)}})),(0,s.R3)(a),(0,g.Tw)(i).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:a,id:l,message:u,shouldForceReply:m}=n;e=Le(e=Be(e,a,l,u),t,u),u.threadInfo&&(e=(0,r.Xg)(e,u.threadInfo.chatId,u.threadInfo.threadId,u.threadInfo));const h=(0,c.hj)(e,a,l),g=(0,d.CI)(u);if((0,c.KA)(e,a,u)){var i;if(g&&u.isOutgoing&&(null===(i=u.content)||void 0===i||!i.action)){const n=(0,c.Bt)(e);n&&t.focusMessage({chatId:a,threadId:n.threadId,messageId:u.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,a,u)||{};n&&t.requestThreadInfoUpdate({chatId:a,threadId:n.threadId}),g||setTimeout((()=>{let e=(0,s.Rd)();m&&(e=(0,r.pf)(e,a,o._f,"replyingToId",l)),(0,s.R3)(Oe(e,a,h))}),Te)}else e=Oe(e,a,h);(0,s.R3)(e),(0,c.N)(e,a)||t.loadTopChats();break}case"updateStartEmojiInteraction":{var l;const{chatId:t}=(0,c.Bt)(e)||{};if(t!==n.id)return;const a=(0,c.hj)(e,t,n.messageId);if(!a)return;if((0,d.UD)(a)!==n.emoji)return;const i=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:(null===(l=e.activeEmojiInteractions)||void 0===l?void 0:l.length)||0,animatedEffect:i?(0,c.cu)(i):n.emoji,messageId:n.messageId}]},(0,s.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:a,message:i}=n;e=Be(e,t,a,i,!0);const l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,o._f,"scheduledIds",(0,g.Tw)([...l,a])),(0,s.R3)(e);break}case"updateMessage":{var u,m;const{chatId:a,id:i,message:l}=n,d=(0,c.hj)(e,a,i),h=(0,c.Z1)(e,a);e=Be(e,a,i,l);const g=(0,c.hj)(e,a,i);l.threadInfo&&(e=(0,r.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),d&&(e=Oe(e,a,g)),l.reactions&&h&&(e=Ne(e,a,i,l.reactions,h,l.isOutgoing,d)),(0,s.R3)(e),d&&h&&!l.isOutgoing&&(null===(u=h.lastMessage)||void 0===u?void 0:u.id)===l.id&&(0,c.xo)(e,h)&&(0,c.KA)(e,a,l)&&(0,c.b9)(e,a,(null===(m=l.threadInfo)||void 0===m?void 0:m.threadId)||o._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:a,message:i}=n;if(!(0,c.Tm)(e,t,a))return;e=Be(e,t,a,i,!0);const l=Object.keys((0,c.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,o._f,"scheduledIds",l),(0,s.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:i,message:o}=n;e=Le(e,t,o);const l=(0,c.hj)(e,a,i);e=(0,r.K4)(e,a,[i]),o.isScheduled&&(e=(0,r.bV)(e,a,[i])),e=(0,r.cY)(e,a,o.id,{...l,...o,previousLocalId:i});const d=(0,c.hj)(e,a,o.id);e=Oe(e,a,d);const u=(0,c.Db)(e,a,o);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:o.id}),e=(0,r.pf)(e,a,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:o.id,lastReadInboxMessageId:o.id})),(0,s.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:a,message:i}=n,l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,o._f,"scheduledIds",[...l,i.id]);const d=(0,c.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,i.id,{...d,...i,previousLocalId:a}),(0,s.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:i}=n,l=(0,c.KB)(e,t)||[],d=a?[...l,...i].sort(((e,t)=>t-e)):l.filter((e=>!i.includes(e)));(0,s.R3)((0,r.pf)(e,t,o._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:i,firstMessageId:o}=n,l={...(0,c.tZ)(e,t,a),...i};if(!l.threadId)return;e=(0,r.Xg)(e,t,a,l),o&&(e=(0,r.pf)(e,t,a,"firstMessageId",o)),(0,s.R3)(e);break}case"resetMessages":{const{id:a}=n,i=(0,c.Zw)(e,a);i&&!(0,d.YC)(a)&&(e=(0,r.K4)(e,a,Object.keys(i).map(Number)),(0,s.R3)(e),t.loadFullChat({chatId:a,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:a}=n;je(a,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:a}=n;!function(e,t,n,a){e&&(t.forEach((t=>{a=(0,r.P4)(a,e,t,{isDeleting:!0})})),(0,s.R3)(a),setTimeout((()=>{a=(0,r.bV)((0,s.Rd)(),e,t);const n=(0,c.Fn)(a,e);a=(0,r.pf)(a,e,o._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,s.R3)(a)}),Te))}(a,t,0,e);break}case"deleteHistory":{const{chatId:i}=n,o=e.messages.byChatId[i];i===a.aw&&(0,s.R3)({...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))}),o?je(i,Object.keys(o.byId).map(Number),t,(0,s.Rd)()):t.requestChatUpdate({chatId:i});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:a}=n;t.forEach((t=>{const n=(0,c.X5)(e,t);n&&(e=(0,r.cY)(e,n,t,a))})),(0,s.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:a,messageUpdate:i}=n;a.forEach((n=>{e=(0,r.cY)(e,t,n,i)})),(0,s.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:a}=n,i=(0,c.ZB)(e,t);if(null!=i&&i.content.poll){var h;const t=i.content.poll.results;let n=t;null!==(h=a.results)&&void 0!==h&&h.results&&(t.results&&a.results.isMin?t.results&&(n={...a.results,results:a.results.results.map((e=>{var n;return{...e,isChosen:null===(n=t.results.find((t=>t.option===e.option)))||void 0===n?void 0:n.isChosen}})),isMin:void 0}):n=a.results);const o={...i.content.poll,...a,results:n};(0,s.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.content,poll:o}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:a,options:i}=n,o=(0,c.ZB)(e,t);if(!o||!o.content.poll||!o.content.poll.results)break;const{poll:l}=o.content,{recentVoterIds:d,totalVoters:u,results:m}=l.results,h=d?[...d]:[],g=u?u+1:1,p=m?[...m]:[];h.push(a),i.forEach((t=>{const n=p.findIndex((e=>e.option===t)),s=p[n],i=s?{...s}:{option:t,votersCount:0};i.votersCount+=1,a===e.currentUserId&&(i.isChosen=!0),n?p[n]=i:p.push(i)})),(0,s.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:{...l,results:{...l.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:s}=n;(0,c.UW)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:t,id:a,reactions:i}=n,o=(0,c.hj)(e,t,a),r=(0,c.Z1)(e,n.chatId);if(!r||!o)return;(0,s.R3)(Ne(e,t,a,i,r,o.isOutgoing,o));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:a,isPending:i}=n;(0,s.R3)({...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:a,isPending:i}}});break}}}));const Fe=(0,R.P2)((function(){const e=(0,s.Rd)();(0,s.R3)((0,r.ps)(e,{...e.users.statusesById,...De})),De={}}),3e3,!0);let De={};(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,r.GK)(e,n.id);case"updateUser":return n.id===e.currentUserId&&n.user.isPremium&&!(0,c.wV)(e)&&t.openPremiumModal({isSuccess:!0}),(0,r.Nq)(e,n.id,n.user);case"updateUserEmojiStatus":return(0,r.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return a=n.userId,i=n.status,De[a]=i,void Fe();case"updateUserFullInfo":{const{id:t,fullInfo:s}=n,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...s}})}case"updateBotMenuButton":{var s;const{botId:t,button:a}=n,i=(0,c.dy)(e,t);if(null==i||null===(s=i.fullInfo)||void 0===s||!s.botInfo)return;return(0,r.Nq)(e,t,{fullInfo:{...i.fullInfo,botInfo:{...i.fullInfo.botInfo,menuButton:a}}})}}var a,i})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,r.Rg)(e,n.id,n.stickerSet)})),(0,s.iw)("apiUpdate",((e,t,n)=>{var a;switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,r.O4)((0,s.Rd)(),n.id):(0,r.rB)((0,s.Rd)(),n.id);case"updateResetContactList":(0,s.R3)({...(0,s.Rd)(),contactList:{userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":t.reorderStickerSets({order:n.order,isCustomEmoji:n.isCustomEmoji});break;case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":(0,s.R3)({...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}});break;case"updatePaymentVerificationNeeded":e=(0,r.fS)((0,s.Rd)(),n.url),e=(0,r.Q$)(e,m.KB.ConfirmPayment),(0,s.R3)(e);break;case"updateWebViewResultSent":(null===(a=e.webApp)||void 0===a?void 0:a.queryId)===n.queryId&&(t.setReplyingToId({messageId:void 0}),t.closeWebApp())}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,r.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent:i,shouldShowPreviews:o}=n;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:a})),(0,s.R3)((0,r.aK)(e,t,{isMuted:a,isSilent:i,shouldShowPreviews:o}));break}}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:n.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:n.message}}}}));var qe=n(78958),$e=n(42431);(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":return"discarded"===n.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,qe.dc)(e,n.call.id):(0,qe.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,c.Z1)(e,n.chatId);return t&&(e=(0,r.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:a,nextOffset:i}=n,{currentUserId:o}=e;return e=(0,s.Rd)(),a.forEach((n=>{n.id&&(e=(0,qe.B6)(e,t,n.id,n,Boolean(i)||o===n.id))})),i&&(e=(0,qe.AH)(e,t,{nextOffset:i})),e}case"updatePhoneCall":{if(!h.Bi)return;const{phoneCall:a,currentUserId:i}=e,{call:o}=n;if(a)return"discarded"===o.state?(t.playGroupCallSound({sound:"end"}),{...e,...o.needRating&&{ratingPhoneCall:o},isCallPanelVisible:void 0,phoneCall:void 0}):void 0;if((null==o?void 0:o.adminId)!==i&&"requested"===o.state)return(0,R.R3)((()=>{(0,ke.TO)({call:o,user:(0,$e.fu)((0,s.Rd)())})})),(0,b.o5)(),{...e,phoneCall:o,isCallPanelVisible:!1}}}}));var Ge=n(9937);(0,s.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"]){const{inputInvoice:s}=e.payment;if(s&&"chatId"in s&&"messageId"in s){const n=(0,c.hj)(e,s.chatId,s.messageId);if(n&&n.content.invoice){const{amount:e,currency:s,title:a}=n.content.invoice;t.showNotification({message:v.i0("PaymentInfoHint",[(0,Ge.x)(e,s,v.i0.code),a])})}}return h.Xp||(e=(0,r.bp)(e)),n.slug&&s&&"slug"in s&&s.slug!==n.slug?h.Xp?void 0:e:{...e,payment:{...e.payment,status:"paid"}}}}));var He=n(46752),Ve=n(1279),_e=n(53551),ze=n(274),We=n(45332);function Xe(e){(0,i.d4)((()=>(0,R.Gq)(e)),[e])}var Je=n(29290);const Ye=document.querySelector('meta[name="viewport"]'),Ke=(null==Ye?void 0:Ye.getAttribute("content"))||"",Qe="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function et(e){e.preventDefault()}var tt=n(65326),nt=n(46590),st=n(31212),at=n(18674),it=n(62357),ot=n(99203),rt=n(48778);const ct=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0}));var lt=n(2155),dt=n(95616),ut=n(17358);const mt=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,dt.yi)();const n=(0,J.xW)();if((0,i.d4)((()=>{t&&(0,ut.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,lt.bi)(n))}));var ht=n(23989),gt=n(53455),pt=n(60706),ft=n(73541),vt=n(2255),It=n(59107),wt=n(27370),yt=n(706);let Pt;function Zt(e,t,n,s,a,o){let r,c,l;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?Pt.syncing:Pt.online:Pt.waitingForNetwork,c=r===Pt.online||o?"none":s?"middleHeader":a?"minimized":"overlay",r===Pt.waitingForNetwork?l=e("WaitingForNetwork"):r===Pt.syncing&&(l=e("Updating")),"middleHeader"===c&&(l=l.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:l}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(Pt||(Pt={}));var Ct=n(36046),bt=n(53106),St=n(58964),Et=n(231),Mt=n(69589),Rt=n(49187),kt=n(83321),At=n(40126),Tt=n(49204);const Nt=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:s}=e;const a=(0,It.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},i.ZP.createElement(Tt.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(vt.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(Et.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))})),Bt=(0,i.X$)((0,s.c$)((e=>{const{query:t,fetchingStatus:n,chatId:s,date:a}=e.globalSearch,{currentUserId:i,connectionState:o,isSyncing:r}=e,{byId:l}=e.chats,{isConnectionStatusMinimized:d,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:i,chatsById:l,globalSearchChatId:s,searchDate:a,theme:(0,c.Pu)(e),animationLevel:u,connectionState:o,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:d,areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(e.canInstall)}}))((e=>{let{content:t,contactsFilter:n,onSearchQuery:o,onSelectSettings:r,onSelectContacts:c,onSelectArchived:l,onReset:u,searchQuery:g,isLoading:p,shouldSkipTransition:f,currentUserId:v,globalSearchChatId:I,searchDate:w,theme:y,animationLevel:P,chatsById:Z,connectionState:C,isSyncing:b,isMessageListOpen:S,isConnectionStatusMinimized:E,areChatsLoaded:M,hasPasscode:R,canInstall:k}=e;const{openChat:A,setGlobalSearchDate:T,setSettingOption:N,setGlobalSearchChatId:B,openChatByUsername:x,lockScreen:L,requestNextSettingsScreen:O,skipLockOnUnload:U}=(0,s.Sv)(),j=(0,It.Z)(),F=t===m.du.ChatList,D=(0,i.Ye)((()=>w?(0,V.xH)(new Date(1e3*w)):void 0),[w]),q=(0,i.Ye)((()=>F&&Z?Object.values(Z).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[F,Z]),{connectionStatus:$,connectionStatusText:G,connectionStatusPosition:H}=Zt(j,C,b,S,E,!M),_=(0,i.I4)((e=>{e.preventDefault(),e.stopPropagation(),R?L():O(m.MT.PasscodeDisabled)}),[R,L,O]);(0,ft.y)({"Ctrl+Shift+L":_,"Alt+Shift+L":_,"Meta+Shift+L":_,...h.fl&&{"Mod+L":_}});const z=window.location.hostname===a.xH||a.Cg,W=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(Et.Z,{round:!0,ripple:F&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:F?t:()=>u(),ariaLabel:F?j("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,He.Z)("animated-menu-icon",!F&&"state-back",f&&"no-animation")}))}),[F,j,u,f]),X=(0,i.I4)((()=>{g||o("")}),[g,o]),J=(0,i.I4)((()=>{N({isConnectionStatusMinimized:!E})}),[E,N]),Y=(0,i.I4)((()=>{A({id:v,shouldReplaceHistory:!0})}),[v,A]),K=(0,i.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";N({theme:t}),N({shouldUseSystemTheme:!1}),(0,wt.Z)(t,P===a.zy)}),[P,N,y]),Q=(0,i.I4)((()=>{window.open(a.ul,"_blank","noopener")}),[]),ee=(0,i.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,yt.W8)(),U()}),[U]),te=(0,i.I4)((()=>{U()}),[U]),ne=(0,i.I4)((()=>{x({username:j("Settings.TipsUsername")})}),[j,x]),se=(0,i.I4)((()=>{L()}),[L]),ae=Boolean(I)||t===m.du.GlobalSearch||t===m.du.Contacts;(0,i.d4)((()=>ae?(0,ht.Z)((()=>u())):void 0),[ae,u]);const ie=t===m.du.Contacts?j("SearchFriends"):j("Search"),oe=a.Tj?`${a.Ji} Beta (master)`:a.eM?"master":a.Ji;return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},i.ZP.createElement(bt.Z,{trigger:W,footer:`${a.iC} ${oe}`},i.ZP.createElement(St.Z,{icon:"saved-messages",onClick:Y},j("SavedMessages")),i.ZP.createElement(St.Z,{icon:"archive",onClick:l},i.ZP.createElement("span",{className:"menu-item-name"},j("ArchivedChats")),q>0&&i.ZP.createElement("div",{className:"archived-badge"},q)),i.ZP.createElement(St.Z,{icon:"user",onClick:c},j("Contacts")),i.ZP.createElement(St.Z,{icon:"settings",onClick:r},j("Settings")),i.ZP.createElement(St.Z,{icon:"darkmode",onClick:K},i.ZP.createElement("span",{className:"menu-item-name"},j("lng_menu_night_mode")),i.ZP.createElement(kt.Z,{id:"darkmode",label:j("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),i.ZP.createElement(St.Z,{icon:"help",onClick:ne},j("TelegramFeatures")),i.ZP.createElement(St.Z,{icon:"bug",href:a.mU},"Report Bug"),a.Tj&&i.ZP.createElement(St.Z,{icon:"permissions",onClick:Q},"Beta Changelog"),z&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(St.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:ee},"Switch to K Version"),i.ZP.createElement(St.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:te},"Switch to Old Version")),k&&i.ZP.createElement(St.Z,{icon:"install",onClick:(0,Ct.G)()},"Install App")),i.ZP.createElement(Mt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||w?"with-picker-item":"",value:n||g,focused:ae,isLoading:p||"minimized"===H,spinnerColor:"minimized"===H?"yellow":void 0,spinnerBackgroundColor:"minimized"===H&&"light"===y?"light":void 0,placeholder:ie,autoComplete:"off",canClose:Boolean(I||w),onChange:o,onReset:u,onFocus:X,onSpinnerClick:"minimized"===H?J:void 0},D&&i.ZP.createElement(Rt.Z,{icon:"calendar",title:D,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:T,clickArg:{date:void 0}}),I&&i.ZP.createElement(Rt.Z,{chatOrUserId:I,onClick:B,canClose:!0,clickArg:{id:void 0}})),R&&i.ZP.createElement(Et.Z,{round:!0,ripple:!h.wB,size:"smaller",color:"translucent",ariaLabel:`${j("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:se,className:"passcode-lock"},i.ZP.createElement("i",{className:"icon-lock"})),i.ZP.createElement(At.Z,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(Nt,{connectionStatus:$,connectionStatusText:G,onClick:J}))))})));var xt=n(64963),Lt=n(93133),Ot=n(1080);const Ut=(0,i.X$)((0,s.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,activeChatFolder:s},currentUserId:a,lastSyncTime:i,shouldSkipHistoryAnimations:o}=e;return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:s,currentUserId:a,lastSyncTime:i,shouldSkipHistoryAnimations:o,maxFolders:(0,D.M)(e,"dialogFilters")}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:o,orderedFolderIds:r,activeChatFolder:c,currentUserId:l,lastSyncTime:d,shouldSkipHistoryAnimations:u,maxFolders:m}=e;const{loadChatFolders:g,setActiveChatFolder:p,openChat:f}=(0,s.Sv)(),v=(0,i.sO)(null),I=(0,It.Z)();(0,i.d4)((()=>{d&&g()}),[d,g]);const w=(0,i.Ye)((()=>({id:a.Nf,title:(null==r?void 0:r[0])===a.Nf?I("FilterAllChatsShort"):I("FilterAllChats")})),[r,I]),y=(0,i.Ye)((()=>r?r.map((e=>e===a.Nf?w:o[e]||{})).filter(Boolean):void 0),[o,w,r]),P=(null==y?void 0:y.findIndex((e=>e.id===a.Nf)))===c,Z=0===c,C=(0,dt.yi)(),b=(0,i.Ye)((()=>{if(y&&y.length)return y.map(((e,t)=>{var n,s;let{id:i,title:o}=e;const r=i!==a.Nf&&t>m-1;return{id:i,title:o,badgeCount:null===(n=C[i])||void 0===n?void 0:n.chatsCount,isBadgeActive:Boolean(null===(s=C[i])||void 0===s?void 0:s.notificationsCount),isBlocked:r}}))}),[y,C,m]),S=(0,i.I4)((e=>{p(e,{forceOnHeavyAnimation:!0})}),[p]);(0,i.d4)((()=>{b&&b.length&&c>=b.length&&p(0)}),[c,b,p]),(0,i.d4)((()=>{if(v.current&&h.$b&&b&&b.length)return(0,xt.sf)(v.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===xt.eM.Left?(p(Math.min(c+1,b.length-1),{forceOnHeavyAnimation:!0}),!0):t===xt.eM.Right&&(p(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,b,p]);const E=(0,i.sO)();E.current=!Z,(0,i.d4)((()=>E.current?(0,ht.Z)((()=>{E.current&&p(0)})):void 0),[c,p]),(0,nt.Z)({isActive:!Z,onBack:()=>p(0,{forceOnHeavyAnimation:!0})}),(0,i.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&b){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void f({id:l,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>b.length-1)return;p(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[l,b,f,p]);const{shouldRender:M,transitionClassNames:R}=(0,st.Z)(!r,void 0,!0);function k(e){const s=Object.values(o).find((e=>{let{id:t}=e;return t===b[c].id}));return!s||P?i.ZP.createElement(Ot.Z,{folderType:"all",isActive:e,lastSyncTime:d,foldersDispatch:t,onScreenSelect:n}):i.ZP.createElement(Ot.Z,{folderType:"folder",folderId:s.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t})}const A=b&&b.length>1;return i.ZP.createElement("div",{className:"ChatFolders"},A?i.ZP.createElement(Lt.Z,{tabs:b,activeTab:c,onSwitchTab:S,areFolders:!0}):M?i.ZP.createElement("div",{className:(0,He.Z)("tabs-placeholder",R)}):void 0,i.ZP.createElement(vt.Z,{ref:v,name:u?"none":I.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:A?b.length:void 0},k))})));var jt=n(34288);const Ft=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)})),Dt=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)}));var qt=n(52328);const $t=(0,i.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:s,onNewGroup:a}=e;const[o,r]=(0,i.eJ)(!1);(0,i.d4)((()=>{t||r(!1)}),[t]);const c=(0,It.Z)(),l=(0,He.Z)("NewChatButton",t&&"revealed",o&&"menu-is-open"),d=(0,i.I4)((()=>{r(!o)}),[o]),u=(0,i.I4)((()=>{r(!1)}),[]);return i.ZP.createElement("div",{className:l,dir:c.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{round:!0,color:"primary",className:o?"active":"",onClick:d,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(qt.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},i.ZP.createElement(St.Z,{icon:"channel",onClick:s},c("NewChannel")),i.ZP.createElement(St.Z,{icon:"group",onClick:a},c("NewGroup")),i.ZP.createElement(St.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),Gt=Object.keys(m.du).length/2;let Ht;const Vt=(0,i.X$)((e=>{let{content:t,searchQuery:n,searchDate:s,contactsFilter:a,shouldSkipTransition:o,foldersDispatch:r,isUpdateAvailable:c,onSearchQuery:l,onContentChange:d,onScreenSelect:u,onReset:g}=e;const[p,f]=(0,i.eJ)(h.$b),{shouldRender:v,transitionClassNames:I}=(0,st.Z)(c),w=(0,i.sO)(!1),y=(0,i.I4)((()=>{t===m.du.ChatList&&(w.current=!0,f(!0))}),[t]),P=(0,i.I4)((()=>{w.current=!1,Ht&&(clearTimeout(Ht),Ht=void 0),Ht=window.setTimeout((()=>{w.current||f(!1)}),250)}),[]),Z=(0,i.I4)((()=>{d(m.du.Settings)}),[d]),C=(0,i.I4)((()=>{d(m.du.Contacts)}),[d]),b=(0,i.I4)((()=>{d(m.du.Archived)}),[d]),S=(0,i.I4)((()=>{window.location.reload()}),[]),E=(0,i.I4)((()=>{d(m.du.NewChannelStep1)}),[d]),M=(0,i.I4)((()=>{d(m.du.NewGroupStep1)}),[d]);(0,i.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{f(!1)}),250):(w.current||h.$b)&&f(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const R=(0,It.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:y,onMouseLeave:h.$b?void 0:P},i.ZP.createElement(Bt,{content:t,contactsFilter:a,onSearchQuery:l,onSelectSettings:Z,onSelectContacts:C,onSelectArchived:b,onReset:g,shouldSkipTransition:o}),i.ZP.createElement(vt.Z,{name:o?"none":"zoom-fade",renderCount:Gt,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return i.ZP.createElement(Ut,{onScreenSelect:u,foldersDispatch:r});case m.du.GlobalSearch:return i.ZP.createElement(Ft,{searchQuery:n,searchDate:s,isActive:e,onReset:g});case m.du.Contacts:return i.ZP.createElement(Dt,{filter:a,isActive:e,onReset:g});default:return}})),v&&i.ZP.createElement(Et.Z,{fluid:!0,pill:!0,className:(0,He.Z)("btn-update",I),onClick:S},R("lng_update_telegram")),i.ZP.createElement($t,{isShown:p,onNewPrivateChat:C,onNewChannel:E,onNewGroup:M}))})),_t=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)})),zt=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)})),Wt=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)}));var Xt;!function(e){e[e.Main=0]="Main",e[e.Settings=1]="Settings",e[e.Archived=2]="Archived",e[e.NewGroup=3]="NewGroup",e[e.NewChannel=4]="NewChannel"}(Xt||(Xt={}));const Jt=Object.keys(Xt).length/2,Yt=(0,i.X$)((0,s.c$)((e=>{var t;const{globalSearch:{query:n,date:s},chatFolders:{activeChatFolder:a},shouldSkipHistoryAnimations:i,leftColumnWidth:o,currentUserId:r,passcode:{hasPasscode:l},settings:{nextScreen:d},isUpdateAvailable:u}=e;return{searchQuery:n,searchDate:s,isFirstChatFolderActive:0===a,shouldSkipHistoryAnimations:i,leftColumnWidth:o,currentUserId:r,hasPasscode:l,nextSettingsScreen:d,isChatOpen:Boolean(null===(t=(0,c.jr)(e))||void 0===t?void 0:t.id),isUpdateAvailable:u}}))((e=>{let{searchQuery:t,searchDate:n,isFirstChatFolderActive:a,shouldSkipHistoryAnimations:o,leftColumnWidth:r,currentUserId:c,hasPasscode:l,nextSettingsScreen:d,isChatOpen:u,isUpdateAvailable:g}=e;const{setGlobalSearchQuery:p,setGlobalSearchChatId:f,resetChatCreation:v,setGlobalSearchDate:I,loadPasswordInfo:w,clearTwoFaError:y,setLeftColumnWidth:P,resetLeftColumnWidth:Z,openChat:C,requestNextSettingsScreen:b}=(0,s.Sv)(),S=(0,i.sO)(null),[E,M]=(0,i.eJ)(m.du.ChatList),[R,k]=(0,i.eJ)(m.MT.Main),[A,T]=(0,i.eJ)(""),[N,B]=(0,gt.ZP)(),[x,L]=(0,i.eJ)(0);let O=Xt.Main;switch(E){case m.du.Archived:O=Xt.Archived;break;case m.du.Settings:O=Xt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:O=Xt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:O=Xt.NewGroup}const U=(0,i.I4)((e=>{function t(){M(m.du.ChatList),T(""),p({query:""}),I({date:void 0}),f({id:void 0}),v(),setTimeout((()=>{L(Date.now())}),250)}if(!0!==e)if(E!==m.du.NewGroupStep2)if(E!==m.du.NewChannelStep2){if(E===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(E===m.du.Settings)switch(R){case m.MT.EditProfile:case m.MT.Folders:case m.MT.General:case m.MT.Notifications:case m.MT.DataStorage:case m.MT.Privacy:case m.MT.ActiveSessions:case m.MT.Language:case m.MT.Stickers:case m.MT.Experimental:return void k(m.MT.Main);case m.MT.GeneralChatBackground:return void k(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void k(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyPhoneCall:case m.MT.PrivacyPhoneP2P:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyVoiceMessages:case m.MT.PrivacyBlockedUsers:case m.MT.ActiveWebsites:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:case m.MT.PasscodeDisabled:case m.MT.PasscodeEnabled:case m.MT.PasscodeCongratulations:return void k(m.MT.Privacy);case m.MT.PasscodeNewPasscode:return void k(l?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled);case m.MT.PasscodeChangePasscodeCurrent:case m.MT.PasscodeTurnOff:return void k(m.MT.PasscodeEnabled);case m.MT.PasscodeNewPasscodeConfirm:return void k(m.MT.PasscodeNewPasscode);case m.MT.PasscodeChangePasscodeNew:return void k(m.MT.PasscodeChangePasscodeCurrent);case m.MT.PasscodeChangePasscodeConfirm:return void k(m.MT.PasscodeChangePasscodeNew);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void k(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void k(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void k(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void k(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void k(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void k(m.MT.PrivacyForwarding);case m.MT.PrivacyVoiceMessagesAllowedContacts:case m.MT.PrivacyVoiceMessagesDeniedContacts:return void k(m.MT.PrivacyVoiceMessages);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void k(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void k(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void k(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void k(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void k(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void k(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void k(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void k(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void k(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void k(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void k(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void k(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void k(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void k(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return M(m.du.ChatList),void k(m.MT.Main);case m.MT.QuickReaction:case m.MT.CustomEmoji:return void k(m.MT.Stickers)}E===m.du.ChatList&&a?M(m.du.GlobalSearch):t()}else M(m.du.NewChannelStep1);else M(m.du.NewGroupStep1);else t()}),[E,a,R,p,I,f,v,l]),j=(0,i.I4)((e=>{E!==m.du.Contacts?(M(m.du.GlobalSearch),e!==t&&p({query:e})):T(e)}),[E,t,p]);(0,i.d4)((()=>E!==m.du.ChatList||a&&!u?(0,ht.Z)((()=>U())):void 0),[a,E,U,u]);const F=(0,i.I4)((e=>{E!==m.du.GlobalSearch&&(e.preventDefault(),M(m.du.GlobalSearch))}),[E]),D=(0,i.I4)((e=>{e.preventDefault(),C({id:c,shouldReplaceHistory:!0})}),[c,C]),q=(0,i.I4)((e=>{e.preventDefault(),M(m.du.Settings)}),[]);(0,ft.y)({"Mod+Shift+F":F,"Mod+Shift+S":D,"Mod+0":D,...h.jm&&h.fl&&{"Mod+,":q}}),(0,i.d4)((()=>{y(),R===m.MT.Privacy&&w()}),[y,w,R]),(0,Je.Z)((()=>{d&&(M(m.du.Settings),k(d),b(void 0))}),[d,b]);const{initResize:$,resetResize:G,handleMouseUp:H}=function(e,t,n,s){const[a,o,r]=(0,pt.Z)(),[c,l]=(0,i.eJ)(),[d,u]=(0,i.eJ)();function m(){document.body.classList.remove("cursor-ew-resize")}return(0,i.bt)((()=>{e.current&&s&&(e.current.style.width=`${s}px`)}),[e,s]),(0,i.d4)((()=>{if(!a)return;const n=t=>{const n=Math.ceil(d+t.clientX-c);e.current.style.width=`${n}px`};function s(){i(),t(e.current.offsetWidth)}function i(){m(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",s,!1),document.removeEventListener("blur",s,!1),r()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",s,!1),document.addEventListener("blur",s,!1),i}),[d,c,e,t,a,r]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),l(t.clientX),u(e.current.offsetWidth),o()},resetResize:function(t){t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}}(S,P,Z,r),V=(0,i.I4)((e=>{M(m.du.Settings),k(e)}),[]);return i.ZP.createElement("div",{id:"LeftColumn",ref:S},i.ZP.createElement(vt.Z,{name:o?"none":h.s0,renderCount:Jt,activeKey:O,shouldCleanup:!0,cleanupExceptionKey:Xt.Main},(e=>{switch(O){case Xt.Archived:return i.ZP.createElement(Wt,{isActive:e,onReset:U,onContentChange:M});case Xt.Settings:return i.ZP.createElement(_t,{isActive:e,currentScreen:R,foldersState:N,foldersDispatch:B,onScreenSelect:V,onReset:U,shouldSkipTransition:o});case Xt.NewChannel:return i.ZP.createElement(zt,{key:x,isActive:e,isChannel:!0,content:E,onContentChange:M,onReset:U});case Xt.NewGroup:return i.ZP.createElement(zt,{key:x,isActive:e,content:E,onContentChange:M,onReset:U});default:return i.ZP.createElement(Vt,{content:E,searchQuery:t,searchDate:n,contactsFilter:A,foldersDispatch:B,onContentChange:M,onSearchQuery:j,onScreenSelect:V,onReset:U,shouldSkipTransition:o,isUpdateAvailable:g})}})),i.ZP.createElement("div",{className:"resize-handle",onMouseDown:$,onMouseUp:H,onDoubleClick:G}))})));var Kt=n(12420),Qt=n(49524),en=n(71394);var tn=n(12255),nn=n(52678),sn=n(87204),an=n(3570),on=n(75790),rn=n(18360),cn=n(6058),ln=n(98799);const dn=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"HeaderMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),un=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s,a;let{chatId:i,threadId:r,messageListType:l}=t;const u=(0,c.Z1)(e,i),m=Boolean(u&&(0,d.eA)(u));if(!u||u.isRestricted||(0,c.CA)(e))return{noMenu:!0};const g=(0,c.IK)(e,i),p=(0,c.FM)(e,i),f="thread"===l&&r===o._f,v="thread"===l&&r!==o._f,I=(0,c.Jf)(e),w=Boolean(g&&(0,c.s4)(e,g.id)),y=!w&&Boolean((0,c.pk)(e,i)),P=Boolean(f&&(m||(0,d.ZV)(u))&&u.isNotJoined),Z=f||v,C=h.Bi&&(0,d.YC)(u.id)&&!p&&!g,b=f&&!p&&!P,S=f&&!P,E=h.Bi&&u.isCallActive,M=h.Bi&&!u.isCallActive&&((null===(n=u.adminRights)||void 0===n?void 0:n.manageCall)||u.isCreator&&(0,d.G9)(u));return{noMenu:!1,isChannel:m,isRightColumnShown:I,canStartBot:y,canRestartBot:w,canSubscribe:P,canSearch:Z,canCall:C,canMute:b,canViewStatistics:null===(s=u.fullInfo)||void 0===s?void 0:s.canViewStatistics,canLeave:S,canEnterVoiceChat:E,canCreateVoiceChat:M,pendingJoinRequests:null===(a=u.fullInfo)||void 0===a?void 0:a.requestsPending,shouldJoinToSend:Boolean((null==u?void 0:u.isNotJoined)&&u.isJoinToSend),shouldSendJoinRequest:Boolean((null==u?void 0:u.isNotJoined)&&u.isJoinRequest)}}))((e=>{let{chatId:t,threadId:n,noMenu:a,isChannel:o,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,pendingJoinRequests:w,isRightColumnShown:y,canExpandActions:P,shouldJoinToSend:Z,shouldSendJoinRequest:C}=e;const{joinChannel:b,sendBotCommand:S,openLocalTextSearch:E,restartBot:M,requestCall:R,requestNextManagementScreen:k,showNotification:A}=(0,s.Sv)(),T=(0,i.sO)(null),N=(0,It.Z)(),[B,x]=(0,i.eJ)(!1),[L,O]=(0,i.eJ)(void 0),U=(0,i.I4)((()=>{x(!0);const e=T.current.getBoundingClientRect();O({x:e.right,y:e.bottom})}),[]),j=(0,i.I4)((()=>{x(!1)}),[]),F=(0,i.I4)((()=>{O(void 0)}),[]),D=(0,i.I4)((()=>{b({chatId:t}),C&&A({message:N(o?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[b,t,C,A,o,N]),q=(0,i.I4)((()=>{S({command:"/start"})}),[S]),$=(0,i.I4)((()=>{M({chatId:t})}),[t,M]),G=(0,i.I4)((()=>{k({screen:m.u1.JoinRequests})}),[k]),H=(0,i.I4)((()=>{E(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[E]),V=(0,i.I4)((e=>{d&&h.fl&&!e.shiftKey&&(e.preventDefault(),H())}),[d,H]);return(0,ft.y)({"Mod+F":V}),i.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&i.ZP.createElement(i.ZP.Fragment,null,P&&!C&&(l||Z)&&i.ZP.createElement(Et.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:D},N(o?"ProfileJoinChannel":"ProfileJoinGroup")),P&&C&&i.ZP.createElement(Et.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:D},N("ChannelJoinRequest")),P&&r&&i.ZP.createElement(Et.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:q},N("BotStart")),P&&c&&i.ZP.createElement(Et.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:$},N("BotRestart")),d&&i.ZP.createElement(Et.Z,{round:!0,ripple:y,color:"translucent",size:"smaller",onClick:H,ariaLabel:"Search in this chat"},i.ZP.createElement("i",{className:"icon-search"})),u&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",size:"smaller",onClick:function(){R({userId:t})},ariaLabel:"Call"},i.ZP.createElement("i",{className:"icon-phone"}))),Boolean(w)&&i.ZP.createElement(Et.Z,{round:!0,className:"badge-button",ripple:y,color:"translucent",size:"smaller",onClick:G,ariaLabel:N(o?"SubscribeRequests":"MemberRequests")},i.ZP.createElement("i",{className:"icon-user"}),i.ZP.createElement("div",{className:"badge"},w)),i.ZP.createElement(Et.Z,{ref:T,className:B?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:U},i.ZP.createElement("i",{className:"icon-more"})),L&&i.ZP.createElement(dn,{chatId:t,threadId:n,isOpen:B,anchor:L,withExtraActions:h.wB||!P,isChannel:o,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,onSubscribeChannel:D,onSearchClick:H,onClose:j,onCloseAnimationEnd:F}))})));var mn=n(996),hn=n(6202),gn=n(2903),pn=n(68512),fn=n(17551);function vn(e,t,n,s,a){return`M${e},${t+a}a${a},${a},0,0,1,\n ${n},0v${s-2*a}a${a},${a},0,0,1,${-n},0Z`}const In=(0,i.X$)((e=>{let{count:t,index:n}=e;const s=(0,i.sO)(null),a=(0,i.Ye)((()=>function(e,t){const n=e-t-1,s=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),a=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),i=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),o=`clipPath${e}`,r=function(e,t,n){let s="";if(3===n)s=vn(0,0,2,t,1)+vn(0,12,2,t+1,1)+vn(0,25,2,t,1);else for(let e=0;e<n;e++)s+=vn(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(o,s,e),c=function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,s,e),l=function(e,t,n,s){return t<=4||e<=1?0:e>=t-2?s-36:(n+4)/2+(e-2)*(n+2)}(n,e,s,i);return{markHeight:a,clipPath:r,markTranslateY:c,trackTranslateY:l,trackHeight:i,clipPathId:o}}(t,n)),[t,n]);if((0,i.d4)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:i,clipPathId:o,clipPath:r}=a,c=s.current.firstElementChild;if(null!=s&&s.current){const a=s.current,{style:l}=a;l.height=`${e}px`,l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");d||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(${i}px)`)}}),[a]),1===t)return i.ZP.createElement("div",{className:"pinned-message-border"},i.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:s}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:l,clipPathId:d}=a;return i.ZP.createElement("div",{className:(0,He.Z)("pinned-message-border",t>4&&"pinned-message-border-mask")},i.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:s,style:`clip-path: url("#${d}"); width: 2px;\n height: ${o}px; transform: translateY(-${r}px);`},i.ZP.createElement("span",null),i.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${c}px; transform: translateY(${l}px);`})))})),wn=(0,i.X$)((e=>{let{message:t,count:n,index:a,customTitle:o,className:r,onUnpinMessage:c,onClick:l,onAllPinnedClick:u}=e;const{clickBotInlineButton:m}=(0,s.Sv)(),g=(0,It.Z)(),p=(0,gn.Z)(t),f=(0,hn.Z)((0,d.Ti)(t,"pictogram")),v=(0,mn.e)(g,t,Boolean(p)),[I,w,y]=(0,pt.Z)(),P=(0,i.I4)((()=>{y(),c&&c(t.id)}),[y,c,t.id]),Z=(0,d.eH)(t),C=(0,i.I4)((()=>{Z&&m({messageId:t.id,button:Z})}),[m,Z,t.id]),[b,S,E]=(0,pt.Z)();return i.ZP.createElement("div",{className:(0,He.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&i.ZP.createElement(Et.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:u},i.ZP.createElement("i",{className:"icon-pin-list"})),c&&i.ZP.createElement(Et.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:w},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(fn.Z,{isOpen:I,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:P}),i.ZP.createElement("div",{className:(0,He.Z)("HeaderPinnedMessage",b&&"no-hover"),onClick:l,dir:g.isRtl?"rtl":void 0},i.ZP.createElement(In,{count:n,index:a}),p&&function(e,t){const{width:n,height:s}=(0,Ie.W7)();return i.ZP.createElement("img",{src:t||e,width:n,height:s,alt:""})}(p,f),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("div",{className:"title",dir:"auto"},o||`${g("PinnedMessage")} ${a>0?"#"+(n-a):""}`),i.ZP.createElement("p",{dir:"auto"},v),i.ZP.createElement(pn.Z,null)),Z&&i.ZP.createElement(Et.Z,{size:"tiny",className:"inline-button",onClick:C,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:S,onMouseLeave:h.$b?void 0:E},Z.text)))}));var yn=n(10396),Pn=n(64532),Zn=n(23186),Cn=n(75851);const bn=240;function Sn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,a=new Image;return new Promise((i=>{a.onload=()=>{En(a,a.width*t,a.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},a.src=s}))}async function En(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return Mn(e,t,n,void 0,s);try{const a=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(a.height!==n||a.width!==t)throw new Error("Image bitmap resize not supported!");const i=await(0,Cn.ix)(e.src),o=(0,Cn.rZ)(i)<bn?"#fff":"#000";return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const n=t.getContext("2d");n.fillStyle=o,n.fillRect(0,0,t.width,t.height);const i=t.getContext("bitmaprenderer");i?i.transferFromImageBitmap(a):n.drawImage(a,0,0),t.toBlob(e,s)}))}catch(a){return Mn(e,t,n,void 0,s)}}async function Mn(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"image/png";const i=document.createElement("canvas"),o=i.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(i.width=t,i.height=n,e.width*s>t){const n=1/s;let a={width:Math.floor(e.width*s),height:Math.floor(e.height*s)};for(r.width=a.width,r.height=a.height,c.drawImage(e,0,0,a.width,a.height);a.width*s>t;)a={width:Math.floor(a.width*s),height:Math.floor(a.height*s)},c.drawImage(r,0,0,a.width*n,a.height*n,0,0,a.width,a.height);o.drawImage(r,0,0,a.width,a.height,0,0,i.width,i.height)}else o.drawImage(e,0,0,i.width,i.height);const l=await(0,Cn.ix)(e.src),d=(0,Cn.rZ)(l)<bn?"#fff":"#000";return o.fillStyle=d,o.globalCompositeOperation="destination-over",o.fillRect(0,0,i.width,i.height),new Promise((e=>{i.toBlob(e,a)}))}var Rn=n(77510);const kn=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",An={width:200,height:200},Tn=115;var Nn=n(32340),Bn=n(18051);const xn=(0,s.c$)(((e,t)=>{let{message:n}=t;const s=(0,c.Ur)(e,n),a=(0,c.Z1)(e,n.chatId),{volume:i,playbackRate:o,isMuted:r}=e.audioPlayer;return{sender:s,chat:a,volume:i,playbackRate:o,isMuted:r}}))((e=>{let{message:t,className:n,noUi:o,sender:r,chat:c,volume:l,playbackRate:u,isMuted:m}=e;const{setAudioPlayerVolume:g,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:v,closeAudioPlayer:I}=(0,s.Sv)(),w=(0,It.Z)(),{audio:y,voice:P,video:Z}=(0,d.qp)(t),C=Boolean(P||Z),b=C||((null==y?void 0:y.duration)||0)>a.J0,S=r?(0,d.OU)(w,r):void 0,E=fe.UV((0,d.Ti)(t,"inline")),M=((e,t,n)=>{const s=(0,It.Z)(),{audio:a,voice:o}=(0,d.qp)(e),r=a?a.title||a.fileName:o?"Voice message":"",c=(null==a?void 0:a.performer)||t&&(0,d.OU)(s,t),l=n&&(0,d.U)(s,n)||"Telegram",u=a&&(0,d.MR)(a)&&(0,d.Ti)(e,"pictogram"),m=t&&(0,d.RT)(t,"big"),h=a&&u||o&&m,g=(0,hn.Z)(h),p=(0,i.Ye)((()=>function(e,t,n){if(!n)return An;if(e){var s;if(null===(s=e.thumbnailSizes)||void 0===s||!s.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?Ie.vY:void 0}(a,o,g)),[a,g,o]),{result:f}=(0,Rn.Z)((()=>function(e,t){if(!e)return Promise.resolve(kn);if(!t)return function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,i=new Image;return new Promise((o=>{i.onload=()=>{En(i,t,n,s).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},i.src=a}))}(e,Tn,Tn);const n=Math.min(t.width,t.height);return n<Tn?Sn(e,Tn/n):Promise.resolve(e)}(g,p)),[g,p],kn);return(0,i.Ye)((()=>(0,Pn.Of)({title:r,artist:c,album:l,artwork:[{src:f}]})),[l,c,r,f])})(t,r,c),{playPause:R,stop:k,isPlaying:A,requestNextTrack:T,requestPreviousTrack:N,isFirst:B,isLast:x,setVolume:L,toggleMuted:O,setPlaybackRate:U}=(0,Zn.Z)((0,yn.An)(t),(0,d.XV)(t),C?"voice":"audio",E,void 0,M,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),j=C&&A;(0,i.d4)((()=>{if(j)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[j]);const F=(0,i.I4)((()=>{v({chatId:t.chatId,messageId:t.id})}),[v,t.chatId,t.id]),D=(0,i.I4)((()=>{A&&R(),I(),(0,Pn.Ay)(),k()}),[I,A,R,k]),q=(0,i.I4)((e=>{g({volume:e/100}),L(e/100)}),[g,L]),$=(0,i.I4)((()=>{h.$b&&!h.cj||(O(),f({isMuted:!m}))}),[m,f,O]),G=(0,i.I4)((()=>{1===u?(U(1.8),p({playbackRate:1.8})):(U(1),p({playbackRate:1}))}),[u,p,U]),H=(0,i.Ye)((()=>0===l||m?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,m]);if(!o)return i.ZP.createElement("div",{className:(0,He.Z)("AudioPlayer",n),dir:w.isRtl?"rtl":void 0},i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:F},y?function(e){const{title:t,performer:n,fileName:s}=e;return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},(0,Nn.Z)(t||s)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Nn.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Nn.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(w("AttachAudio"),S),i.ZP.createElement(pn.Z,null)),i.ZP.createElement(Et.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:B(),onClick:N,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon-skip-previous"})),i.ZP.createElement(Et.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,He.Z)("toggle-play","player-button",A?"pause":"play"),onClick:R,ariaLabel:A?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon-play"}),i.ZP.createElement("i",{className:"icon-pause"})),i.ZP.createElement(Et.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:x(),onClick:T,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon-skip-next"})),i.ZP.createElement(Et.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},i.ZP.createElement("i",{className:H,onClick:$}),!h.cj&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"volume-slider-spacer"}),i.ZP.createElement("div",{className:"volume-slider"},i.ZP.createElement(Bn.Z,{bold:!0,value:m?0:100*l,onChange:q})))),b&&i.ZP.createElement(Et.Z,{round:!0,className:(0,He.Z)("playback-button",1!==u&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:G},i.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),i.ZP.createElement(Et.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:D,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var Ln=n(70172);const On=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),a=(0,$e.Bj)(e,n);return{groupCall:a,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(a?a.participantsCount>0&&a.isLoaded:s&&s.isCallNotEmpty&&s.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==a?void 0:a.id),animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{chatId:t,isActive:n,groupCall:a,hasPinnedOffset:o,usersById:r,chatsById:c,animationLevel:l}=e;const{joinGroupCall:d,subscribeToGroupCallUpdates:u}=(0,s.Sv)(),m=(0,It.Z)(),h=(0,i.I4)((()=>{d({chatId:t})}),[d,t]),g=null==a?void 0:a.participants,p=(0,i.Ye)((()=>g?Object.values(g).filter(((e,t)=>t<3)).map((e=>{let{id:t,isUser:n}=e;if(n){if(!r[t])return;return{user:r[t]}}if(c[t])return{chat:c[t]}})).filter(Boolean):[]),[c,g,r]);if((0,i.d4)((()=>{if(null!=a&&a.id&&(n||!a.isLoaded))return u({id:a.id,subscribed:!0}),()=>{u({id:a.id,subscribed:!1})}}),[null==a?void 0:a.id,null==a?void 0:a.isLoaded,n,u]),a)return i.ZP.createElement("div",{className:(0,He.Z)("GroupCallTopPane",o&&"has-pinned-offset",!n&&"is-hidden"),onClick:h},i.ZP.createElement("div",{className:"info"},i.ZP.createElement("span",{className:"title"},m("VoipGroupVoiceChat")),i.ZP.createElement("span",{className:"participants"},m("Participants",a.participantsCount||0,"i"))),i.ZP.createElement("div",{className:"avatars"},p.map((e=>{if(e)return e.user?i.ZP.createElement(Ln.Z,{key:e.user.id,user:e.user,animationLevel:l}):i.ZP.createElement(Ln.Z,{key:e.chat.id,chat:e.chat,animationLevel:l})}))),i.ZP.createElement(Et.Z,{round:!0,className:"join"},m("VoipChatJoin")))})));var Un=n(14605);const jn=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,c.Z1)(e,n),user:(0,d.YC)(n)?(0,c.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:a,user:o,settings:r,currentUserId:c}=e;const{openAddContactDialog:l,blockContact:u,reportSpam:m,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:v,hideChatReportPanel:I}=(0,s.Sv)(),w=(0,It.Z)(),[y,P,Z]=(0,pt.Z)(),[C,b]=(0,i.eJ)(!0),[S,E]=(0,i.eJ)(!0),{accessHash:M}=a||{},{isAutoArchived:R,canReportSpam:k,canAddContact:A,canBlockContact:T}=r||{},N=a&&(0,d.G9)(a),B=(0,i.I4)((()=>{l({userId:t}),R&&v({chatId:t})}),[l,R,v,t]),x=(0,i.I4)((()=>{Z(),u({contactId:t,accessHash:M}),k&&C&&m({chatId:t}),S&&h({chatId:t})}),[M,u,Z,h,m,k,S,C,t]),L=(0,i.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,i.I4)((()=>{Z(),m({chatId:t}),N?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,Z,c,p,f,N,g,m]);if(r)return i.ZP.createElement("div",{className:(0,He.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},A&&i.ZP.createElement(Et.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},w("lng_new_contact_add")),T&&i.ZP.createElement(Et.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_new_contact_block")),k&&!T&&i.ZP.createElement(Et.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_report_spam_and_leave")),i.ZP.createElement(Et.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(fn.Z,{isOpen:y,onClose:Z,title:w("BlockUserTitle",o?(0,d.Vl)(o):(0,d.U)(w,a)),text:o?w("UserInfo.BlockConfirmationTitle",(0,d.Js)(o)):w("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:o?x:O},o&&i.ZP.createElement(Un.Z,{label:w("DeleteThisChat"),checked:S,onCheck:E}),o&&k&&i.ZP.createElement(Un.Z,{label:w("ReportChat"),checked:C,onCheck:b})))}))),Fn=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,messageListType:a}=t;const{isLeftColumnShown:i,lastSyncTime:r,shouldSkipHistoryAnimations:l}=e,u=(0,c.Z1)(e,n),{typingStatus:m}=u||{},{chatId:h,messageId:g}=e.audioPlayer,p=h&&g?(0,c.hj)(e,h,g):void 0;let f;if("pinned"===a){const t=(0,c.KB)(e,n);f=null==t?void 0:t.length}else if("scheduled"===a){const t=(0,c.qy)(e,n);f=null==t?void 0:t.length}else if("thread"===a&&s!==o._f){const t=(0,c.tZ)(e,n,s);f=(null==t?void 0:t.messagesCount)||0}const v="thread"===a&&s===o._f,I=u&&(0,c.xo)(e,u),w=Boolean(I&&(0,c.s4)(e,n)),y=I&&!w&&Boolean((0,c.pk)(e,n)),P=Boolean(v&&u&&((0,d.eA)(u)||(0,d.ZV)(u))&&u.isNotJoined),Z=Boolean((null==u?void 0:u.isNotJoined)&&u.isJoinRequest),C={typingStatus:m,isLeftColumnShown:i,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),audioMessage:p,chat:u,messagesCount:f,isChatWithSelf:(0,c.FM)(e,n),lastSyncTime:r,shouldSkipHistoryAnimations:l,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:y||w||P||Z},b=(0,c.Zw)(e,n);if("thread"!==a||!b)return C;if(Object.assign(C,{messagesById:b}),s!==o._f){const t=(0,c.qS)(e,n,s),a=t?(0,c.hj)(e,n,t):void 0,i=a?(0,c.cv)(e,a):void 0;return{...C,pinnedMessageIds:t,canUnpin:!1,topMessageSender:i}}const S=(0,c.KB)(e,n);if(null!=S&&S.length){const t=b[S[0]],{canUnpin:n}=t&&(0,c._k)(e,t,s)||{};return{...C,pinnedMessageIds:S,canUnpin:n}}return C}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:v,isRightColumnShown:I,audioMessage:w,chat:y,messagesCount:P,isChatWithSelf:Z,lastSyncTime:C,hasButtonInHeader:b,shouldSkipHistoryAnimations:S,currentTransitionKey:E,connectionState:M,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:A,focusMessage:T,openChat:N,openPreviousChat:B,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,s.Sv)(),U=(0,It.Z)(),j=(0,i.sO)(!0),[F,D]=(0,i.eJ)(0),q=Array.isArray(l)?l[F]:l,$=u&&q?u[q]:void 0,G=Array.isArray(l)?l.length:l?1:void 0,H=y&&(0,d.U)(U,y).length,V=g?(0,d.OU)(U,g):void 0,{settings:_}=y||{};(0,i.d4)((()=>{n===o._f&&C&&c&&x({chatId:t})}),[t,x,C,n,c]),(0,i.d4)((()=>{D(0)}),[l]),(0,on.Z)(t,q,$);const{width:z}=(0,tn.Z)(),W=z<=a.ks,X=h.p7&&v,J=(0,i.sO)(null),Y=(0,i.sO)(!0),K=(0,i.I4)((()=>{k({id:t})}),[k,t]),Q=(0,i.I4)((e=>{A({chatId:t,messageId:e,isUnpin:!0})}),[A,t]),ee=(0,i.I4)((()=>{if($){T({chatId:$.chatId,threadId:n,messageId:$.id});const e=(0,an.Z)(G||1,F+1);D(e)}}),[$,T,n,G,F]),te=(0,i.I4)((()=>{N({id:t,threadId:o._f,type:"pinned"})}),[N,t]),ne=(0,i.I4)((()=>{setTimeout((()=>{j.current=!0}),450)}),[]),se=(0,i.I4)((e=>{if(j.current){if(j.current=!1,h.wB){const e=document.querySelector(a.Ed);null==e||e.blur()}if(f)return O(),void ne();if(n===o._f&&"thread"===r&&0===E)return h.wB||X?(e.stopPropagation(),N({id:void 0},{forceOnHeavyAnimation:!0})):L(),void ne();B(),ne()}}),[n,r,E,f,B,X,N,L,O,ne]),ae=z>=a.ks&&z<a.jT||z>a.l3&&z<a.ks&&(!H||H>30),ie=ae||z>a._m&&z<a.QU,oe=Boolean((null==_?void 0:_.canAddContact)||(null==_?void 0:_.canBlockContact)||(null==_?void 0:_.canReportSpam)),{shouldRender:re,transitionClassNames:ce}=(0,st.Z)(oe),le=(0,rn.Z)(oe?_:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,st.Z)(Boolean(w)),me=(0,rn.Z)(w,!0),{shouldRender:he,transitionClassNames:ge}=(0,st.Z)(Boolean($)),pe=(0,rn.Z)($,!0),fe=(0,rn.Z)(G,!0),ve=(0,rn.Z)(m,!0),Ie=(0,rn.Z)(V),we=(0,sn.Z)(E),ye=void 0!==we&&we<E?we:void 0,Pe=he&&pe||de&&me;(0,i.d4)((()=>{const e=J.current;if(e)return ie&&Pe?void(I||ae?(Y.current&&(e.classList.add("tools-stacked","animated"),Y.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),Y.current=!0)):(e.classList.remove("tools-stacked","animated"),void(Y.current=!0))}),[ie,Pe,ae,I]);const{connectionStatusText:Ze}=Zt(U,M,R,!0);function Ce(){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(Et.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:U(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,He.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(mt,null))}const be=Boolean(de&&me),Se=be||!h.wB&&b&&z<a.sg;return i.ZP.createElement("div",{className:"MiddleHeader",ref:J},i.ZP.createElement(vt.Z,{name:S?"none":"slide-fade",activeKey:E,shouldCleanup:!0,cleanupExceptionKey:ye},"thread"===r&&n===o._f?i.ZP.createElement(i.ZP.Fragment,null,(W||E>0)&&Ce(X,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:K},(0,d.YC)(t)?i.ZP.createElement(cn.Z,{key:t,userId:t,typingStatus:p,status:Ze,withDots:Boolean(Ze),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0}):i.ZP.createElement(ln.Z,{key:t,chatId:t,typingStatus:p,status:Ze,withDots:Boolean(Ze),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0}))):"thread"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,U("CommentsCount",P,"i"))):"pinned"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,U("PinnedMessagesCount",P,"i"))):"scheduled"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,Z?U("Reminders"):U("messages",P,"i"))):void 0),i.ZP.createElement(On,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&i.ZP.createElement(wn,{key:t,message:pe,count:fe||0,index:F,customTitle:Ie,className:(0,He.Z)(ge,Se&&"full-width"),onUnpinMessage:ve?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&i.ZP.createElement(jn,{key:t,chatId:t,settings:le,className:ce}),i.ZP.createElement("div",{className:"header-tools"},be&&i.ZP.createElement(xn,{key:(0,d.Tp)(me),message:me,className:ue}),i.ZP.createElement(un,{chatId:t,threadId:n,messageListType:r,canExpandActions:!be})))})));function Dn(e){return"albumId"in e}function qn(e,t){let n,s=[],a={originalDate:e[0].date,datetime:(0,V._F)(1e3*e[0].date),senderGroups:[s]};const i=[a];return e.forEach(((o,r)=>{o.isInAlbum?n?(n.messages.push(o),o.content.text&&(n.mainMessage=o)):n={albumId:o.groupedId,messages:[o],mainMessage:o}:s.push(o);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(s.push(n),n=void 0),c){const e=(0,V._F)(1e3*c.date);a.datetime!==e?(a={originalDate:c.date,datetime:e,senderGroups:[]},i.push(a),s=[],a.senderGroups.push(s)):(c.id===t||o.senderId!==c.senderId||o.isOutgoing!==c.isOutgoing||(0,d.Lo)(o)||(0,d.Lo)(c)||o.forwardInfo&&c.forwardInfo&&(o.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||o.inlineButtons||c.inlineButtons||c.date-o.date>600)&&(s=[],a.senderGroups.push(s))}})),i}var $n=n(30386),Gn=n(87675),Hn=n(60539),Vn=n(88957);var _n=n(60998);var zn=n(72645),Wn=n(3657);const Xn=h.wZ?1e3:350,Jn=h.wB?300:500;var Yn=n(17240);function Kn(e,t){return e?t?238:175:t?238:100}function Qn(e,t){const n=(0,d.B4)(e),s=(0,d.MF)(e),a=(0,d.O$)(e)||(0,d.F$)(e),i=(0,d.b7)(e),o=Boolean((0,d.F$)(e)),{width:r,height:c}=a?(0,Ie.Eh)(a,n,s,o,t):(0,Ie.GC)(i,n,s,t),l=Kn(Boolean((0,d.UD)(e)));let u=1;r<l&&l-r<12&&(u=l/r),c*u<90&&90-c*u<12&&(u=90/c);const m=Math.round(r*u),h=Math.round(c*u);return{width:m,height:h,isSmall:m<l||h<90}}var es=n(28712);function ts(e,t){return e.reduce(((e,t)=>e+t),t)}function ns(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:s}=e;2&s&&(t.width=n.width+n.x),4&s&&(t.height=n.height+n.y)})),t}function ss(e,t,n,s){const a=function(e){return e.map((e=>{const t=Qn(e);return t.width/t.height}))}(s.messages),i=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(a),o=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(a),r=a.length,c=a.some((e=>e>2)),l=(0,Ie.kc)(e,t,!1,n)-(t?2.5:0)*Ie.Gw;let d;const u={ratios:a,proportions:i,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||c?function(e){let{ratios:t,averageRatio:n,maxWidth:s,minWidth:a,spacing:i,maxHeight:o=4*s/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,es.uZ)(e,1,2.75):(0,es.uZ)(e,.6667,1)))}(t,n),c=t.length,l=new Array(c),d=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=ts(r.slice(e,e+t),0);return(s-(t-1)*i)/n})(n,e)),n+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const s=c-e-t;e<=3&&t<=(n<.85?4:3)&&s<=3&&u([e,t,s])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let n=1;n!==c-e-t;++n){const s=c-e-t-n;e<=3&&t<=3&&n<=3&&s<=4&&u([e,t,n,s])}let m,h=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:n}=d[e],s=n.length,r=ts(t,0)+i*(s-1),c=Math.min(...t)<a?1.5:1,l=(()=>{for(let e=1;e!==s;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-o)*c*l;(!m||u<h)&&(m=d[e],h=u)}const g=m.lineCounts,p=m.heights,f=g.length;let v=0,I=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],a=Math.round(n);let o=0;for(let c=0;c!==t;++c){const d=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[v],m=c===t-1?s-o:Math.round(u*n);l[v]={dimensions:{x:o,y:I,width:m,height:a},sides:d},o+=m+i,++v}I+=a+i}return l}(u):2===r?function(e){const{ratios:t,proportions:n,averageRatio:s}=e;return"ww"===n&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,i=Math.round(Math.min(n/t[0],Math.min(n/t[1],(a-s)/2)));return[{dimensions:{x:0,y:0,width:n,height:i},sides:11},{dimensions:{x:0,y:i+s,width:n,height:i},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,i=(n-s)/2,o=Math.round(Math.min(i/t[0],Math.min(i/t[1],a)));return[{dimensions:{x:0,y:0,width:i,height:o},sides:13},{dimensions:{x:i+s,y:0,width:i,height:o},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:s,spacing:a,maxHeight:i}=e,o=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(s-a),(s-a)/t[0]/(1/t[0]+1/t[1]))),s-a-o),c=s-r-a,l=Math.min(i,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:l},sides:13},{dimensions:{x:c+a,y:0,width:r,height:l},sides:7}]}(e)}(u):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:s,maxWidth:a,minWidth:i}=e,o=t,r=Math.round(Math.min((t-n)/2,s[1]*(a-n)/(s[2]+s[1]))),c=o-r-n,l=Math.max(i,Math.round(Math.min((a-n)/2,Math.min(r*s[2],c*s[1])))),d=Math.min(Math.round(o*s[0]),a-n-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:13},{dimensions:{x:d+n,y:0,width:l,height:c},sides:3},{dimensions:{x:d+n,y:c+n,width:l,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:s,spacing:a}=e,i=t,o=Math.round(Math.min(i/n[0],.66*(s-a))),r=(t-a)/2,c=Math.min(s-o-a,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:i,height:o},sides:11},{dimensions:{x:0,y:o+a,width:r,height:c},sides:12},{dimensions:{x:r+a,y:o+a,width:i-r-a,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:s,maxHeight:a,minWidth:i}=e;const o=t,r=Math.round(Math.min(o/n[0],.66*(a-s))),c=Math.round((t-2*s)/(n[1]+n[2]+n[3])),l=Math.max(i,Math.round(Math.min(.4*(t-2*s),c*n[1]))),d=Math.round(Math.max(Math.max(i,.33*(t-2*s)),c*n[3])),u=o-l-d-2*s,m=Math.min(a-r-s,c);return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+s,width:l,height:m},sides:12},{dimensions:{x:l+s,y:r+s,width:u,height:m},sides:4},{dimensions:{x:l+s+u+s,y:r+s,width:d,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:s,spacing:a,minWidth:i}=e;const o=t,r=Math.round(Math.min(o*n[0],.6*(s-a))),c=Math.round((t-2*a)/(1/n[1]+1/n[2]+1/n[3])),l=Math.round(c/n[1]),d=Math.round(c/n[2]),u=o-l-d-2*a,m=Math.max(i,Math.min(s-r-a,c));return[{dimensions:{x:0,y:0,width:r,height:o},sides:13},{dimensions:{x:r+a,y:0,width:m,height:l},sides:3},{dimensions:{x:r+a,y:l+a,width:m,height:d},sides:2},{dimensions:{x:r+a,y:l+d+2*a,width:m,height:u},sides:6}]}(e)}(u),{layout:d,containerStyle:ns(d)}}let as,is;function os(e){return is||(is=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),as||(as=document.createElement("span"),as.style.font=`400 12px ${is}`,as.style.whiteSpace="nowrap",as.style.position="absolute",as.style.left="-999px",as.style.opacity=".01",document.body.appendChild(as)),as.innerHTML=e,as.offsetWidth}function rs(e,t,n,s,a,o){(0,i.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Hn.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s,void 0,o)}}),[e,t,n,s,a,o])}var cs=n(3858);const ls=3*Ie.Gw,ds=Number(Ie.Gw),us="data-is-document-group-hover";function ms(e,t,n,a,o,r,c,l,d,u,m,g,p,f){const{setReplyingToId:v,sendDefaultReaction:I}=(0,s.Sv)(),[w,y,P]=(0,pt.Z)(),[Z,C,b]=(0,pt.Z)(),S=(0,i.sO)();return(0,i.d4)((()=>{if(!h.$b||o||!r||m)return;let e;return(0,xt.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===xt.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,o,n,v,C,b,r,m]),{handleMouseDown:o?void 0:function(e){(0,$n.q)(e),d(e)},handleClick:function(t){if(o)e(t);else if(h.$b)return S.current?(clearInterval(S.current),S.current=void 0,void function(e){const{pageX:t,pageY:s}=e;I({chatId:u,messageId:n,x:t,y:s})}(t)):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;be.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:o?c?cs.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:o?void 0:function(){h.$b||v({messageId:n})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:s}=e,{x:a,width:i,y:o,height:r}=t.getBoundingClientRect(),c=Math.abs(p?n-a:a+i-n)<ls,l=Math.abs(o+r-s)<ds;c&&l?y():P()},handleSendQuickReaction:function(e){const{x:t,y:s}=e.currentTarget.getBoundingClientRect();I({chatId:u,messageId:n,x:t,y:s})},handleMouseLeave:function(e){P(),f&&function(e){const t=gs(e.currentTarget);t&&t.removeAttribute(us)}(e)},isSwiped:Z,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:hs}}function hs(e){const t=gs(e.currentTarget);t&&t.setAttribute(us,"")}function gs(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var ps=n(55254),fs=n(44139),vs=n(18005);const Is=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0}));var ws=n(45601);const ys=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s;let{message:a}=t;const{byId:i}=e.users,o=a.senderId,{targetUserIds:r,targetChatId:l}=a.content.action||{},u=a.replyToMessageId,m=u?(0,c.hj)(e,a.chatId,u):void 0,h=(0,c._X)(e,a),{direction:g,noHighlight:p}=h&&e.focusedMessage||{},f=(0,c.Z1)(e,a.chatId),v=f&&((0,d.eA)(f)||o===a.chatId);return{usersById:i,senderUser:!v&&o?(0,c.dy)(e,o):void 0,senderChat:v?f:void 0,targetChatId:l,targetUserIds:r,targetMessage:m,isFocused:h,premiumGiftSticker:null===(n=e.premiumGifts)||void 0===n||null===(s=n.stickers)||void 0===s?void 0:s[0],...h&&{focusDirection:g,noFocusHighlight:p}}}))((e=>{var t;let{message:n,observeIntersection:a,observeIntersectionForAnimation:o,isEmbedded:r,appearanceOrder:c=0,isLastInList:l,usersById:u,senderUser:m,senderChat:h,targetUserIds:g,targetMessage:p,targetChatId:f,isFocused:v,focusDirection:I,noFocusHighlight:w,premiumGiftSticker:y,memoFirstUnreadIdRef:P}=e;const{openPremiumModal:Z,requestConfetti:C}=(0,s.Sv)(),b=(0,It.Z)(),S=(0,i.sO)(null);(0,Wn._N)(S,a),(0,on.Z)(n.chatId,n.replyToMessageId,p),rs(S,n.chatId,v,I,w);const E=c<=0,[M,R]=(0,pt.Z)(E),k=Boolean(null===(t=n.content.action)||void 0===t?void 0:t.text.startsWith("ActionGift"));(0,i.d4)((()=>{E||setTimeout(R,10*c)}),[c,R,E]);const A=(0,Wn.Op)(S,o),T=(0,i.sO)((()=>{const e=(null==P?void 0:P.current)&&n.id>=P.current;return k&&!n.isOutgoing&&e})());(0,i.d4)((()=>{A&&T.current&&(T.current=!1,C())}),[A,C]);const{transitionClassNames:N}=(0,st.Z)(M,void 0,E,!1),B=(0,i.Ye)((()=>g?g.map((e=>null==u?void 0:u[e])).filter(Boolean):void 0),[g,u]),x=(0,vs.D)(b,n,m,h,B,p,f,{asTextWithSpoilers:r}),{isContextMenuOpen:L,contextMenuPosition:O,handleBeforeContextMenu:U,handleContextMenu:j,handleContextMenuClose:F,handleContextMenuHide:D}=(0,Yn.Z)(S),q=void 0!==O;if(r)return i.ZP.createElement("span",{className:"embedded-action-message"},x);const $=(0,He.Z)("ActionMessage message-list-item",v&&!w&&"focused",k&&"premium-gift",q&&"has-menu-open",l&&"last-in-list",N);return i.ZP.createElement("div",{ref:S,id:(0,d.d0)(n.id),className:$,"data-message-id":n.id,onMouseDown:e=>{(0,$n.q)(e),U(e)},onContextMenu:j},i.ZP.createElement("span",null,x),k&&i.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{var e;Z({isGift:!0,fromUserId:null==m?void 0:m.id,toUserId:null==g?void 0:g[0],monthsAmount:(null===(e=n.content.action)||void 0===e?void 0:e.months)||0})}},i.ZP.createElement(ws.Z,{key:n.id,sticker:y,play:!0,noLoop:!0,nonInteractive:!0}),i.ZP.createElement("strong",null,b("ActionGiftPremiumTitle")),i.ZP.createElement("span",null,b("ActionGiftPremiumSubtitle",b("Months",null===(G=n.content.action)||void 0===G?void 0:G.months,"i"))),i.ZP.createElement("span",{className:"action-message-button"},b("ActionGiftPremiumView"))),O&&i.ZP.createElement(Is,{isOpen:L,anchor:O,message:n,messageListType:"thread",onClose:F,onCloseAnimationEnd:D}));var G}))),Ps=e=>{var t;let{className:n,message:s,sender:a,title:o,customText:r,isProtected:c,noUserColors:l,hasContextMenu:u,observeIntersection:m,onClick:h}=e;const g=(0,i.sO)(null),p=(0,Wn.Op)(g,m),f=(0,hn.Z)(s&&(0,d.Ti)(s,"pictogram"),!p),v=(0,gn.Z)(s),I=Boolean(s&&(0,d.Y5)(s)),w=(0,It.Z)(),y=a?(0,d.OU)(w,a):null==s||null===(t=s.forwardInfo)||void 0===t?void 0:t.hiddenUserName;return i.ZP.createElement("div",{ref:g,className:(0,He.Z)("EmbeddedMessage",n,a&&!l&&`color-${(0,d.Rs)(a)}`),onClick:s?h:void 0},v&&function(e,t,n,s){const{width:a,height:o}=(0,Ie.W7)();return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("img",{src:t||e,width:a,height:o,alt:"",className:n?"round":"",draggable:!s}),s&&i.ZP.createElement("span",{className:"protector"}))}(v,f,I,c),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},s?(0,d.Lo)(s)?i.ZP.createElement(ys,{message:s,isEmbedded:!0}):(0,mn.e)(w,s,Boolean(v)):r||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Nn.Z)(y||o||" "))),u&&i.ZP.createElement("i",{className:"embedded-more icon-more"}))};var Zs=n(82535),Cs=n(54752),bs=n(8018),Ss=n(48198),Es=n(97799);const Ms=(0,i.X$)((e=>{var t,n;let{reaction:a,activeReaction:o,isInMeta:r,availableReactions:c}=e;const{stopActiveReaction:l}=(0,s.Sv)(),d=null==c?void 0:c.find((e=>e.reaction===a)),u=null==d||null===(t=d.centerIcon)||void 0===t?void 0:t.id,m=null==d||null===(n=d.aroundAnimation)||void 0===n?void 0:n.id,h=u&&`sticker${u}`,g=m&&`sticker${m}`,p=(0,hn.Z)(h,!u),f=(0,hn.Z)(g,!m),v=Boolean((null==o?void 0:o.reaction)===a&&p&&f),{shouldRender:I,transitionClassNames:w}=(0,st.Z)(v,void 0,!0,"slow"),y=(0,i.I4)((()=>{l({messageId:null==o?void 0:o.messageId,reaction:a})}),[null==o?void 0:o.messageId,a,l]),[P,Z,C]=(0,pt.Z)(),b=!v||!P,S=(0,He.Z)("ReactionAnimatedEmoji",r&&"in-meta",I&&"is-animating");return i.ZP.createElement("div",{className:S},b&&i.ZP.createElement(Ss.Z,{reaction:a}),I&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Es.Z,{key:u,className:w,size:30,tgsUrl:p,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:Z,onEnded:C}),i.ZP.createElement(Es.Z,{key:m,className:(0,He.Z)("effect",w),size:100,tgsUrl:f,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:y})))})),Rs=(0,i.X$)((e=>{var t;let{message:n,outgoingStatus:s,signature:a,onClick:o,withReactions:r,activeReaction:c,withReactionOffset:l,availableReactions:d,reactionMessage:u}=e;const m=(0,It.Z)(),[h,g]=(0,pt.Z)(),p=r&&(null==u||null===(t=u.reactions)||void 0===t?void 0:t.results.filter((e=>e.count>0))),f=(0,i.Ye)((()=>{if(!h)return;const e=(0,V.SA)(1e3*n.date,m.code),t=n.isEdited&&(0,V.SA)(1e3*n.editDate,m.code),s=n.forwardInfo&&(0,V.SA)(1e3*n.forwardInfo.date,m.code);let a=e;return t&&(a+="\n",a+=m("lng_edited_date").replace("{date}",t)),s&&(a+="\n",a+=m("lng_forwarded_date").replace("{date}",s)),a}),[h,m,n]);return i.ZP.createElement("span",{className:(0,He.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:o},p&&p.map((e=>i.ZP.createElement(Ms,{activeReaction:c,reaction:e.reaction,isInMeta:!0,availableReactions:d}))),Boolean(n.views)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-views"},(0,lt.bi)(n.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),a&&i.ZP.createElement("span",{className:"message-signature"},(0,Nn.Z)(a)),i.ZP.createElement("span",{className:"message-time",title:f,onMouseEnter:g},n.isEdited&&`${m("EditedMessage")} `,(0,V.mr)(m,1e3*n.date)),s&&i.ZP.createElement(bs.Z,{status:s}))}));var ks=n(36765);const As=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:r,lastSyncTime:c,shouldPlayEffect:l,onPlayEffect:u,onStopEffect:m}=e;const{showNotification:g,openStickerSet:p}=(0,s.Sv)(),f=(0,It.Z)(),v=(0,i.sO)(null),I=t.content.sticker,{stickerSetInfo:w,isVideo:y,hasEffect:P}=I,Z=I.isPreloadedGlobally?void 0:(0,d.Ti)(t,y&&!h.Hh?"pictogram":"inline"),C=(0,Wn.Op)(v,n),b=(0,Wn.Op)(v,a),S=`sticker${I.id}?size=f`,E=(0,hn.Z)(S,!C||!P,o.IU.BlobUrl,c),[M,R,k]=(0,pt.Z)(),A=(0,i.I4)((()=>{k(),null==m||m()}),[m,k]);(0,i.d4)((()=>{P&&b&&l&&(R(),null==u||u())}),[P,b,u,l,R]);const T=(0,i.I4)((()=>{p({stickerSetInfo:I.stickerSetInfo})}),[p,I]),N=(0,i.I4)((()=>{if(P)return M?void g({message:f("PremiumStickerTooltip"),action:T,actionText:f("ViewAction")}):(R(),void(null==u||u()));T()}),[P,M,f,u,T,g,R]),B="isMissing"in w,{width:x,height:L}=(0,Ie.Wr)(I),O=(0,He.Z)("Sticker media-inner",B&&"inactive",P&&!t.isOutgoing&&"reversed");return i.ZP.createElement("div",{ref:v,className:O,style:`width: ${x}px; height: ${L}px;`,onClick:B?void 0:N},i.ZP.createElement(ks.Z,{containerRef:v,sticker:I,fullMediaHash:Z,fullMediaClassName:"full-media",size:x,shouldLoop:r,noLoad:!C,noPlay:!b,withSharedAnimation:!0,cacheBuster:c}),P&&C&&M&&i.ZP.createElement(Es.Z,{key:S,className:"effect-sticker",tgsUrl:E,size:1.49*x,play:!0,isLowPriority:!0,noLoop:!0,onEnded:A}))};var Ts=n(13365),Ns=n(74753),Bs=n(80036);function xs(e,t,n,a,o,r,l,d){const{interactWithAnimatedEmoji:u,sendEmojiInteraction:m,sendWatchingEmojiInteraction:h}=(0,s.Sv)(),g=r||l,p=(0,i.sO)(null),f=(0,i.sO)(null),v=(0,hn.Z)(n?`document${n}`:void 0,!n),I=d||104,w=(0,Bs.Z)(`width: ${I}px`,`height: ${I}px`,(l||r)&&"cursor: pointer"),y=(0,i.sO)(void 0),P=(0,i.sO)(void 0),Z=(0,i.I4)((()=>{p.current&&(m({chatId:e,messageId:t,localEffect:r,emoji:l,interactions:y.current}),P.current=void 0,y.current=void 0)}),[m,e,t,r,l]),C=(0,i.I4)((()=>{const e=f.current;v&&(e&&(e.pause(),e.remove()),f.current=new Audio,f.current.src=v,(0,Ns.Z)(f.current),f.current.addEventListener("ended",(()=>{f.current=void 0}),{once:!0}))}),[v]),b=(0,i.I4)((()=>{C();const n=p.current;if(!(g&&n&&t&&e))return;const{x:s,y:a}=n.getBoundingClientRect();u({localEffect:r,emoji:l,x:s,y:a,startSize:I,isReversed:!o}),y.current||(y.current=[],P.current=performance.now(),setTimeout(Z,1e3)),y.current.push(P.current?(performance.now()-P.current)/1e3:0)}),[e,l,g,u,o,r,t,C,Z,I]);return(0,i.d4)((()=>{const n=p.current;n&&a&&a.forEach((s=>{let{id:a,startSize:i,messageId:d}=s;if(i||t!==d)return;const{x:u,y:m}=n.getBoundingClientRect();h({id:a,chatId:e,emoticon:r?(0,c.ji)(r):l,startSize:I,x:u,y:m,isReversed:!o}),C()}))}),[a,e,l,o,r,t,C,h,I]),{ref:p,size:I,style:w,handleClick:b}}var Ls=n(21179);const Os=(0,i.X$)((0,s.c$)(((e,t)=>{let{emoji:n,withEffects:s}=t;const a=(0,c.CP)(e,n);return{sticker:(0,c.zB)(e,n),effect:s?(0,c.tH)(e,n):void 0,soundId:(0,c.Oh)(e,n),localSticker:a,localEffect:a&&s?(0,c.cu)(a):void 0}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:s,forceLoadPreview:a,messageId:o,chatId:r,activeEmojiInteractions:c,sticker:l,effect:d,localSticker:u,localEffect:m,soundId:h}=e;const{ref:g,size:p,style:f,handleClick:v}=xs(r,o,h,c,t,m,null==d?void 0:d.emoji),I=(0,Wn.Op)(g,n);return u?i.ZP.createElement(Ls.Z,{tgsUrl:Ts.l[u],size:p,quality:1,play:I,forceOnHeavyAnimation:!0,ref:g,className:"AnimatedEmoji media-inner",style:f,onClick:v}):i.ZP.createElement(ws.Z,{sticker:l,size:p,quality:1,noLoad:!I,forcePreview:a,lastSyncTime:s,play:I,forceOnHeavyAnimation:!0,ref:g,className:(0,He.Z)("AnimatedEmoji media-inner",(null==l?void 0:l.id)===Ie.wB&&"like-sticker-thumb"),style:f,onClick:v})})));var Us=n(41012);const js=(0,i.X$)((0,s.c$)(((e,t)=>{let{customEmojiId:n,withEffects:s}=t;const a=e.customEmojis.byId[n];return{sticker:a,effect:null!=a&&a.emoji&&s?(0,c.tH)(e,a.emoji):void 0,soundId:(null==a?void 0:a.emoji)&&(0,c.Oh)(e,a.emoji)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:s,chatId:a,activeEmojiInteractions:o,sticker:r,effect:c,soundId:l,observeIntersection:d}=e;const{ref:u,size:m,style:h,handleClick:g}=xs(a,s,l,o,t,void 0,null==c?void 0:c.emoji,(0,fs.qo)(1));return i.ZP.createElement(Us.Z,{ref:u,documentId:n,className:(0,He.Z)("AnimatedEmoji media-inner",(null==r?void 0:r.id)===Ie.wB&&"like-sticker-thumb"),style:h,size:m,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersection:d,onClick:g})})));var Fs=n(92566),Ds=n(15866);function qs(e,t){return(0,Ds.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}var $s=n(70692);const Gs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Hs(e,t,n,s,a){return s?Promise.resolve(Gs[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.crossOrigin="anonymous",n.width||await new Promise((e=>{n.onload=e}));const s=document.createElement("canvas"),a=s.getContext("2d");s.width=n.width,s.height=n.height,a.drawImage(n,0,0,n.width,n.height);const i=t?n.width-1:0,o=n.height-1;return`rgba(${Array.from(a.getImageData(i,o,1,1).data).join(",")})`}(e,t)}var Vs=n(39196);const _s=e=>{let{id:t,message:n,observeIntersection:s,noAvatars:o,canAutoLoad:r,isInSelectMode:c,isSelected:l,uploadProgress:u,size:m="inline",dimensions:h,nonInteractive:g,shouldAffectAppendix:p,isDownloading:f,isProtected:v,withAspectRatio:I,theme:w,onClick:y,onCancelUpload:P}=e;const Z=(0,i.sO)(null),C=((0,d.O$)(n)||(0,d.F$)(n)).blobUrl,b=(0,Wn.Op)(Z,s),[S,E]=(0,i.eJ)(r),M=S&&b,{mediaData:R,loadProgress:k}=(0,Fs.Z)((0,d.Ti)(n,m),!M),A=C||R,T=qs(n,A),{loadProgress:N}=(0,Fs.Z)((0,d.Ti)(n,"download"),!f,(0,d.kG)(n,"download")),{isUploading:B,isTransferring:x,transferProgress:L}=(0,d.Sc)(n,u||(f?N:k),M&&!A),O=!1===(0,sn.Z)(S),U=(0,$s.Z)(A),{shouldRender:j,transitionClassNames:F}=(0,st.Z)(x,void 0,O,"slow"),{shouldRender:D,transitionClassNames:q}=(0,st.Z)(!A&&!S),$=(0,i.I4)((()=>{B?P&&P(n):A?y&&y(n.id):E((e=>!e))}),[A,B,n,P,y]),G=(0,d.B4)(n);(0,i.bt)((()=>{if(!p)return;const e=Z.current.closest(".message-content");A?Hs(A,G,0,l,w).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")})):e.classList.add("has-appendix-thumb")}),[A,G,p,c,l,w]);const{width:H,height:V,isSmall:_}=h||Qn(n,o),z=(0,He.Z)("media-inner",!B&&!g&&"interactive",_&&"small-image",H===V&&"square-image"),W=I?`aspect-ratio: ${(H/V).toFixed(3)}/ 1`:"",X=h?`width: ${H}px; height: ${V}px; left: ${h.x}px; top: ${h.y}px;${W}`:"";return i.ZP.createElement("div",{id:t,ref:Z,className:z,style:X,onClick:B?void 0:$},i.ZP.createElement("canvas",{ref:T,className:"thumbnail",style:`width: ${H}px; height: ${V}px;${W}`}),i.ZP.createElement("img",{src:A,className:`full-media ${U}`,width:H,height:V,alt:"",draggable:!v}),v&&i.ZP.createElement("span",{className:"protector"}),j&&!D&&i.ZP.createElement("div",{className:`media-loading ${F}`},i.ZP.createElement(Vs.Z,{progress:L,onClick:B?$:void 0})),D&&i.ZP.createElement("i",{className:(0,He.Z)("icon-download",q)}),x&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*L),"%"))};var zs=n(12019),Ws=n(57080);function Xs(){return Xs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Xs.apply(this,arguments)}const Js=e=>{var t;let{id:n,message:a,observeIntersection:o,noAvatars:r,canAutoLoad:c,canAutoPlay:l,uploadProgress:u,lastSyncTime:m,dimensions:h,onClick:g,onCancelUpload:p,isDownloading:f,isProtected:v,withAspectRatio:I}=e;const w=(0,i.sO)(null),y=(0,i.sO)(null),P=(0,d.b7)(a)||(0,d.Cg)(a),Z=P.blobUrl,C=(0,Wn.Op)(w,o),[b,S]=(0,i.eJ)(c),E=Boolean(b&&C&&m),[M,R]=(0,i.eJ)(l),k=(0,hn.Z)((0,d.Ti)(a,"pictogram"),!(C&&m),(0,d.kG)(a,"pictogram"),m),A=(0,$s.Z)(k),{mediaData:T,loadProgress:N}=(0,Fs.Z)((0,d.Ti)(a,"inline"),!E,(0,d.kG)(a,"inline"),m),B=Z||T,x=Boolean(C&&B),L=qs(a,k),{loadProgress:O}=(0,Fs.Z)((0,d.Ti)(a,"download"),!f,(0,d.kG)(a,"download"),m),{isBuffered:U,bufferingHandlers:j}=(0,zs.Z)(!c),{isUploading:F,isTransferring:D,transferProgress:q}=(0,d.Sc)(a,u||(f?O:N),E&&!U||f),$=!1===(0,sn.Z)(b),{shouldRender:G,transitionClassNames:H}=(0,st.Z)(D,void 0,$),{shouldRender:_,transitionClassNames:z}=(0,st.Z)(b&&!M&&!G),[W,X]=(0,i.eJ)(0),J=(0,i.I4)((e=>{X(Math.max(0,e.currentTarget.currentTime-1))}),[]),Y=(null===(t=y.current)||void 0===t?void 0:t.duration)||P.duration||0,K=(0,d.B4)(a),Q=(0,d.MF)(a),{width:ee,height:te}=h||(0,Ie.GC)(P,K,Q,r),ne=(0,i.I4)((()=>{F?p&&p(a):f?(0,s.Sv)().cancelMessageMediaDownload({message:a}):B?B&&!M?R(!0):g&&g(a.id):S((e=>!e))}),[F,f,B,M,g,p,a]),se=(0,He.Z)("media-inner dark",!F&&"interactive"),ae=I?`aspect-ratio: ${(ee/te).toFixed(3)}/ 1`:"",ie=h?`width: ${ee}px; height: ${te}px; left: ${h.x}px; top: ${h.y}px;${ae}`:"";return i.ZP.createElement("div",{ref:w,id:n,className:se,style:ie,onClick:F?void 0:ne},i.ZP.createElement("canvas",{ref:L,className:"thumbnail",style:`width: ${ee}px; height: ${te}px;${ae}`}),i.ZP.createElement("img",{src:k,className:(0,He.Z)("thumbnail",A),style:`width: ${ee}px; height: ${te}px;${ae}`,alt:"",draggable:!v}),x&&i.ZP.createElement(Ws.Z,Xs({ref:y,canPlay:M,src:B,className:"full-media",width:ee,height:te,muted:!0,loop:!0,playsInline:!0},j,{draggable:!v,onTimeUpdate:J,style:ae})),v&&i.ZP.createElement("span",{className:"protector"}),_&&i.ZP.createElement("i",{className:(0,He.Z)("icon-large-play",z)}),G&&i.ZP.createElement("div",{className:(0,He.Z)("media-loading",H)},i.ZP.createElement(Vs.Z,{progress:q,onClick:ne})),!b&&i.ZP.createElement("i",{className:"icon-download"}),D?i.ZP.createElement("span",{className:"message-transfer-progress"},F||f?`${Math.round(100*q)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,V.k9)(Math.max(Y-W,0))))};var Ys=n(6272);const Ks=(0,s.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:s}}=e;return{user:(0,c.dy)(e,n.userId),phoneCodeList:s,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{contact:t,user:n,phoneCodeList:a,animationLevel:o}=e;const{openChat:r}=(0,s.Sv)(),{firstName:c,lastName:l,phoneNumber:d,userId:u}=t,m="0"!==u,h=(0,i.I4)((()=>{r({id:u})}),[r,u]);return i.ZP.createElement("div",{className:(0,He.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},i.ZP.createElement(Ln.Z,{size:"large",user:n,text:c||l,animationLevel:o,withVideo:!0}),i.ZP.createElement("div",{className:"contact-info"},i.ZP.createElement("div",{className:"contact-name"},c," ",l),i.ZP.createElement("div",{className:"contact-phone"},(0,Ys.WZ)(a,d))))}));var Qs=n(20230),ea=n(51218),ta=n(14434),na=n(96937);function sa(e,t){return t>0?(e/t*100).toFixed():0}const aa=e=>{let{answer:t,voteResults:n,totalVoters:s,maxVotersCount:a,correctResults:o,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),l=0===o.length||-1!==o.indexOf(t.option),d=o.length>0&&l||(null==c?void 0:c.isChosen),u=c?sa(c.votersCount,s||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),p=c?sa(c.votersCount,a||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 v=`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,"%",d&&i.ZP.createElement("span",{className:(0,He.Z)("poll-option-chosen",!l&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:l?"icon-check":"icon-close"}))),i.ZP.createElement("div",{className:"poll-option-right"},i.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Nn.Z)(t.text)),i.ZP.createElement("div",{className:(0,He.Z)("poll-option-answer",d&&!l&&"wrong")},i.ZP.createElement("div",{className:"poll-option-corner",ref:g}),i.ZP.createElement("div",{className:"poll-option-line",style:v}))))};function ia(e){e.stopPropagation()}const oa=(0,i.X$)((0,s.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:s}=n.results,{serverTimeOffset:a,users:{byId:i}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:i,serverTimeOffset:a}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:a,usersById:o,onSendVote:r,serverTimeOffset:c}=e;const{loadMessage:l,openPollResults:d,requestConfetti:u}=(0,s.Sv)(),{id:m,chatId:h}=t,{summary:g,results:p}=n,[f,v]=(0,i.eJ)(!1),[I,w]=(0,i.eJ)([]),[y,P]=(0,i.eJ)(!1),[Z,C]=(0,i.eJ)(!1),[b,S]=(0,i.eJ)(!g.closed&&g.closeDate&&g.closeDate>0?Math.min(g.closeDate-Math.floor(Date.now()/1e3)+c,g.closePeriod):0),E=(0,i.sO)(null),{results:M,totalVoters:R}=p,k=M&&M.some((e=>e.isChosen)),A=!g.closed&&!k,T=!A&&g.isPublic&&Number(p.totalVoters)>0,N=A&&g.multipleChoice,B=M?Math.max(...M.map((e=>e.votersCount))):R,x=M?M.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],L=g.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(g.quiz&&g.closePeriod&&b<=0)})));(0,i.d4)((()=>{var e;const t=null===(e=n.results.results)||void 0===e?void 0:e.find((e=>e.isChosen));f&&t&&(t.isCorrect&&u(),v(!1))}),[f,n.results.results,u]),(0,i.d4)((()=>{b>0&&setTimeout((()=>S(b-1)),1e3);const e=E.current;if(e){const t=12*Math.PI,n=e.lastElementChild,s=e.firstElementChild;if(b<=5&&e.classList.add("hurry-up"),n&&s){const e=(g.closePeriod-b)/g.closePeriod*t;s.textContent=(0,V.k9)(b),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,V.k9)(b)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[b,g.closePeriod]),(0,i.d4)((()=>{g.quiz&&(b<=0||k&&!g.closed)&&l({chatId:h,messageId:m})}),[h,b,k,l,m,g.closed,g.quiz]),(0,i.d4)((()=>{let e;return g.quiz&&!g.closed&&g.closePeriod&&g.closePeriod>0&&(e=window.setTimeout((()=>{l({chatId:h,messageId:m})}),1e3*g.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[A,h,l,m,g.closePeriod,g.closed,g.quiz]);const O=(0,i.Ye)((()=>a?a.reduce(((e,t)=>{const n=o[t];return n&&e.push(n),e}),[]):[]),[o,a]),U=(0,i.I4)((e=>{w([e]),v(!0),C(!0),r([e])}),[r]),j=(0,i.I4)((e=>{w(e)}),[]),F=(0,i.I4)((()=>{v(!0),C(!0),r(I)}),[r,I]),D=(0,i.I4)((()=>{d({chatId:h,messageId:m})}),[h,m,d]),q=(0,i.I4)((()=>{P(!0)}),[]),$=(0,i.I4)((()=>{P(!1),C(!1)}),[]);(0,i.d4)((()=>{Z&&k&&g.quiz&&p.results&&n.results.solution&&(p.results.find((e=>e.isChosen&&e.isCorrect))||P(!0))}),[k,Z,p.results,g.quiz,n.results.solution]);const G=(0,It.Z)();return i.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&i.ZP.createElement(na.Z,{message:(0,Qs.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:$,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,Nn.Z)(g.question,["emoji","br"])),i.ZP.createElement("div",{className:"poll-type"},G(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(g)),O.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},O.map((e=>i.ZP.createElement(Ln.Z,{size:"micro",user:e})))),b>0&&A&&i.ZP.createElement("div",{ref:E,className:"poll-countdown"}),g.quiz&&n.results.solution&&!A&&i.ZP.createElement(Et.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:q,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon-lamp"}))),A&&i.ZP.createElement("div",{className:"poll-answers",onClick:ia},N?i.ZP.createElement(ea.Z,{options:L,onChange:j,disabled:t.isScheduled||f,loadingOptions:f?I:void 0,round:!0}):i.ZP.createElement(ta.Z,{name:`poll-${m}`,options:L,onChange:U,disabled:t.isScheduled||f,loadingOption:f?I[0]:void 0})),!A&&i.ZP.createElement("div",{className:"poll-results"},g.answers.map((function(e){return i.ZP.createElement(aa,{key:e.option,shouldAnimate:Z||!A,answer:e,voteResults:M,totalVoters:R,maxVotersCount:B,correctResults:x})}))),!T&&!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")}(G,g.quiz,p.totalVoters)),N&&i.ZP.createElement(Et.Z,{isText:!0,disabled:0===I.length,size:"tiny",onClick:F},G("PollSubmitVotes")),T&&i.ZP.createElement(Et.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var ra=n(48035),ca=n(10088);const la=(0,i.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:o,inPreview:r,lastSyncTime:c,isDownloading:l=!1,isProtected:u,theme:m,onMediaClick:h,onCancelMediaTransfer:g}=e;const p=(0,d.s1)(t),f=(0,i.I4)((()=>{h()}),[h]);if(!p)return;const{siteName:v,url:I,displayUrl:w,title:y,description:P,photo:Z,video:C}=p,b=(0,ra.Z)(P,170),S=Boolean(b||y||v);let E=!1;if(S&&null!=p&&p.photo&&!p.video){const{width:e,height:n}=Qn(t);E=e===n}const M=(Z||C)&&h&&!E,R=(0,He.Z)("WebPage",r&&"in-preview",E&&"with-square-photo",!Z&&!C&&!r&&"without-media",C&&"with-video",!S&&"no-article");return i.ZP.createElement("div",{className:R,"data-initial":(v||w)[0],dir:"auto"},Z&&!C&&i.ZP.createElement(_s,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,size:E?"pictogram":"inline",nonInteractive:!M,onClick:M?f:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0,theme:m}),S&&i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(ca.Z,{className:"site-name",url:I,text:v||w}),!r&&y&&i.ZP.createElement("p",{className:"site-title"},(0,Nn.Z)(y)),b&&i.ZP.createElement("p",{className:"site-description"},(0,Nn.Z)(b,["emoji","br"]))),!r&&C&&i.ZP.createElement(Js,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:o,lastSyncTime:c,onClick:M?f:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0}))}));var da=n(17921);const ua=(0,i.X$)((e=>{var t,n;let{message:s,shouldAffectAppendix:o,isInSelectMode:r,isSelected:c,theme:l}=e;const u=(0,i.sO)(null),m=(0,It.Z)(),h=(0,d.eO)(s),{title:g,text:p,amount:f,currency:v,isTest:I,photo:w}=h,y=(0,hn.Z)((0,d.O9)(w));return(0,i.bt)((()=>{if(!o)return;const e=u.current.closest(".message-content");y&&Hs(y,!1,0,c,l).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")}))}),[o,y,r,c,l]),i.ZP.createElement("div",{ref:u,className:"Invoice"},g&&i.ZP.createElement("p",{className:"title"},(0,Nn.Z)(g)),p&&i.ZP.createElement("div",null,(0,Nn.Z)(p,["emoji","br"])),i.ZP.createElement("div",{className:"description "+(w?"has-image":"")},y&&i.ZP.createElement("img",{className:"invoice-image",src:y,alt:"",crossOrigin:"anonymous"}),!y&&w&&i.ZP.createElement(da.Z,{width:null===(t=w.dimensions)||void 0===t?void 0:t.width,height:null===(n=w.dimensions)||void 0===n?void 0:n.height,forceAspectRatio:!0}),i.ZP.createElement("p",{className:"description-text"},(0,Ge.x)(f,v,m.code),I&&i.ZP.createElement("span",null,m("PaymentTestInvoice")))))}));var ma=n(28183);const ha=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"})),ga=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],pa=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",fa=1e-4,va={width:400,height:300,zoom:16,scale:2},Ia={__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>'},wa=(0,i.X$)((e=>{let{message:t,peer:n,lastSyncTime:s,isInSelectMode:o,isSelected:r,theme:c,serverTimeOffset:l}=e;const u=(0,i.sO)(null),m=(0,i.sO)(null),h=(0,It.Z)(),g=(0,tt.Z)(),f=(0,d.nf)(t),{type:v,geo:I}=f,w=(0,p.b)(l),y=(0,d.$R)(t,w),P="geoLive"!==v||y?void 0:t.date+f.period-w,[Z,C]=(0,i.eJ)(I),b="venue"===v||"geoLive"===v&&!y,{width:S,height:E,zoom:M,scale:R}=va,k=Boolean(s)&&(0,d.k6)(Z,S,E,M,R),A=(0,hn.Z)(k),T=(0,sn.Z)(A),N=A||T,B=n&&(0,d.YC)(n.id),x=n&&B?n:void 0,L=n&&!B?n:void 0,O=(0,d.B4)(t),U=(0,i.Ye)((()=>{if("geoLive"!==v||!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,M)}),[v,Z,M]),j=(0,i.I4)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,s=e.lastElementChild,a=e.firstElementChild,i=t.date+f.period-(0,p.b)(l),o=(1-i/f.period)*n,r=(0,V.mB)(h,1e3*i);s&&a?(a.textContent=r,s.firstElementChild.setAttribute("stroke-dashoffset",`-${o}`)):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="-${o}"\n />\n </svg>`}),[v,t.date,f,l,h]);return(0,i.bt)((()=>{m.current&&j(m.current)}),[j]),(0,i.bt)((()=>{if(b)return;const e=u.current.closest(".message-content");N&&Hs(N,O,0,r,c).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(a.s2,"")}))}),[O,o,r,c,N,b]),(0,i.d4)((()=>{Math.abs(I.lat-Z.lat)<fa&&Math.abs(I.long-Z.long)<fa?Z.accuracyRadius!==I.accuracyRadius&&C({...Z,accuracyRadius:I.accuracyRadius}):C(I)}),[I,Z]),(0,ma.Z)((()=>{g()}),y?void 0:1e3*(P||0)),(0,it.Z)((()=>{const e=m.current;e&&j(e)}),P?1e3:void 0),i.ZP.createElement("div",{ref:u,className:"Location media-inner interactive",onClick:()=>{var e;const t=function(e,t,n){return`http://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(Z.lat,Z.long,M);null===(e=window.open(t,"_blank","noopener"))||void 0===e||e.focus()}},i.ZP.createElement("div",{className:"map-wrapper"},N?i.ZP.createElement("img",{className:"full-media map",src:N,alt:"Location on a map",width:va.width,height:va.height}):i.ZP.createElement(da.Z,{width:S,height:E}),function(){if(N)return i.ZP.createElement(i.ZP.Fragment,null,Boolean(U)&&!y&&i.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*U}px; height: ${2*U}px`}),function(){const e=(0,He.Z)("pin",v,y&&"expired");if("geoLive"===v)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:Ia},i.ZP.createElement(Ln.Z,{chat:L,user:x,className:"location-avatar"}),void 0!==f.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===v){const t=function(e){return e?ha.get(e)||ha.get(e.split("/")[0])||ga[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%ga.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:Ia,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:pa,alt:""})}())}()),function(){if(b)return"venue"===v?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"===v?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},h("AttachLiveLocation")),i.ZP.createElement("div",{className:"location-info-subtitle"},(0,V.dJ)(h,w,t.editDate)),!y&&i.ZP.createElement("div",{className:"geo-countdown",ref:m})):void 0}())})),ya=(0,i.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:a}=e;const{clickBotInlineButton:o}=(0,s.Sv)(),r=t.content.game,{title:c,description:l}=r,u=Boolean(a)&&(0,d.N)(r),m=Boolean(a)&&(0,d.Wc)(r),h=(0,hn.Z)(u,!n),g=(0,hn.Z)(m,!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(da.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,d.UD)(t)&&i.ZP.createElement("div",{className:"description"},l))}));function Pa(e){return(0,i.X$)((0,s.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,c.CA)(e),isSelected:(0,c.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:a,message:o,dimensions:r}=t,{toggleMessageSelection:c}=(0,s.Sv)(),l=(0,i.I4)((e=>{e.stopPropagation(),c({messageId:o.id,withShift:null==e?void 0:e.shiftKey})}),[c,o]),d=(0,i.Ye)((()=>{const{dimensions:e,onClick:s}=t;return{...t,isInSelectMode:n,isSelected:a,dimensions:{...e,x:0,y:0},onClick:n?void 0:s}}),[t,n,a]);return i.ZP.createElement("div",{className:(0,He.Z)("album-item-select-wrapper",a&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?l:void 0},n&&i.ZP.createElement("div",{className:"message-select-control"},a&&i.ZP.createElement("i",{className:"icon-select"})),i.ZP.createElement(e,d))})))}const Za=Pa(_s),Ca=Pa(Js),ba=(0,s.c$)(((e,t)=>{let{album:n}=t;const{chatId:s}=n.mainMessage,a=(0,c.Pu)(e),i=(0,c.xs)(e,s);return{theme:a,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:i}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:a,lastSyncTime:o,isOwn:r,isProtected:l,albumLayout:u,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,s.Sv)(),v=t.messages.length,I=(0,i.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:w,height:y}=u.containerStyle;return i.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${y}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,d.qp)(e),y=h[(0,d.KK)(e)],P=null==y?void 0:y.progress,{dimensions:Z,sides:C}=u.layout[t],b=(0,c.bH)((0,s.Rd)(),e),S=(0,c.__)((0,s.Rd)(),e);if(f){const s=a&&(r?t===v-1:Boolean(8&C&&4&C));return i.ZP.createElement(Za,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,shouldAffectAppendix:s,uploadProgress:P,dimensions:Z,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})}if(w)return i.ZP.createElement(Ca,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,canAutoPlay:S,uploadProgress:P,lastSyncTime:o,dimensions:Z,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})})))}));function Sa(){return Sa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Sa.apply(this,arguments)}let Ea;const Ma=e=>{let{message:t,observeIntersection:n,canAutoLoad:a,lastSyncTime:r,isDownloading:c}=e;const l=(0,i.sO)(null),u=(0,i.sO)(null),m=(0,i.sO)(null),h=t.content.video,g=(0,Wn.Op)(l,n),[p,f]=(0,i.eJ)(a),v=Boolean(p&&g&&r),{mediaData:I,loadProgress:w}=(0,Fs.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:y}=(0,Fs.Z)((0,d.Ti)(t,"download"),!c,o.IU.BlobUrl,r),P=qs(t,I),{isBuffered:Z,bufferingHandlers:C}=(0,zs.Z)(),b=p&&!Z||c,S=!1===(0,sn.Z)(p),E=(0,$s.Z)(I),{shouldRender:M,transitionClassNames:k}=(0,st.Z)(b||!Z,void 0,S),[A,T]=(0,i.eJ)(!1),[N,B]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!A)return;const e=Ie.Rj/2,t=2*(e-6)*Math.PI,n=t-N*t,s=m.current,a=u.current,i=a.firstElementChild;i?i.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${Ie.Rj}px" height="${Ie.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(s.currentTime/s.duration)}),[A,N]);const x=Boolean(I&&g),L=(0,i.I4)((()=>{m.current&&(T(!1),B(0),(0,Ns.Z)(m.current),(0,R.T2)((()=>{u.current.innerHTML=""})))}),[]),O=(0,i.I4)((()=>{var e;null===(e=Ea)||void 0===e||e(),Ea=L}),[L]),U=(0,i.I4)((()=>{if(!I)return void f((e=>!e));if(c)return void(0,s.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;A?e.paused?((0,Ns.Z)(e),(0,yn.Es)()):e.pause():(O(),e.pause(),e.currentTime=0,(0,Ns.Z)(e),(0,yn.Es)(),T(!0))}),[O,A,c,I,t]),j=(0,i.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]),F=(0,He.Z)("full-media",E);return i.ZP.createElement("div",{ref:l,className:"RoundVideo media-inner",onClick:U},i.ZP.createElement("div",{className:"thumbnail-wrapper"},i.ZP.createElement("canvas",{ref:P,className:"thumbnail",style:`width: ${Ie.Rj}px; height: ${Ie.Rj}px`})),I&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement(Ws.Z,Sa({canPlay:x,ref:m,src:I,className:F,width:Ie.Rj,height:Ie.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!A,loop:!A,playsInline:!0,onEnded:A?L:void 0},C,{onTimeUpdate:A?j:void 0}))),i.ZP.createElement("div",{className:"progress",ref:u}),M&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(Vs.Z,{progress:c?y:w})),!I&&!p&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},A?(0,V.k9)(m.current.currentTime):(0,V.k9)(h.duration),(!A||m.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},Ra=e=>{let{message:t,onClick:n}=e;const s=(0,It.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Et.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,Nn.Z)(s(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!a.FS.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))))))))},ka=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:a}=(0,s.Sv)(),o=(0,It.Z)(),{threadId:r,chatId:c,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,i.I4)((()=>{a({id:c,threadId:r})}),[a,c,r]),p=(0,i.Ye)((()=>{if(null==h||!h.length)return;const{users:{byId:e},chats:{byId:t}}=(0,s.Rd)();return h.map((n=>(0,d.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===l)return;const f=Boolean(m&&u&&m<u);return i.ZP.createElement("div",{"data-cnt":(0,lt.bi)(l),className:(0,He.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:g},i.ZP.createElement("i",{className:"icon-comments-sticker"}),(!p||0===p.length)&&i.ZP.createElement("i",{className:"icon-comments"}),p&&p.length>0&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},p.map((e=>i.ZP.createElement(Ln.Z,{key:e.id,size:"small",user:(0,d.YC)(e.id)?e:void 0,chat:(0,d.YC)(e.id)?void 0:e})))),i.ZP.createElement("div",{className:"label",dir:"auto"},l?o("Comments",l,"i"):o("LeaveAComment")),i.ZP.createElement("i",{className:"icon-next"}))})),Aa=(0,i.X$)((e=>{let{reaction:t,message:n,activeReaction:a,availableReactions:o}=e;const{sendReaction:r}=(0,s.Sv)(),{recentReactions:c}=n.reactions,l=(0,i.Ye)((()=>{if(!c||t.count>3)return;const e=(0,s.Rd)().users.byId;return c.filter((e=>e.reaction===t.reaction)).map((t=>e[t.userId])).filter(Boolean)}),[t,c]),d=(0,i.I4)((()=>{r({reaction:t.isChosen?void 0:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,r]);return i.ZP.createElement(Et.Z,{className:(0,He.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},i.ZP.createElement(Ms,{activeReaction:a,reaction:t.reaction,availableReactions:o}),null!=l&&l.length?i.ZP.createElement("div",{className:"avatars"},l.map((e=>i.ZP.createElement(Ln.Z,{user:e,size:"micro"})))):(0,lt.bi)(t.count))})),Ta=(0,i.X$)((e=>{let{message:t,isOutside:n,activeReaction:s,availableReactions:a,metaChildren:o}=e;return i.ZP.createElement("div",{className:(0,He.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>i.ZP.createElement(Aa,{key:e.reaction,reaction:e,message:t,activeReaction:s,availableReactions:a}))),o)})),Na=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:a}=e;const{requestCall:o}=(0,s.Sv)(),r=(0,It.Z)(),{isOutgoing:c,isVideo:l,reason:d}=t,u="missed"===d,m="busy"===d&&!c,g=(0,i.I4)((()=>{o({isVideo:l,userId:a})}),[a,l,o]),p=(0,i.Ye)((()=>l?m?"CallMessageVideoIncomingDeclined":u?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?"CallMessageIncomingDeclined":u?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":c?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,c,l]),f=(0,i.Ye)((()=>t.duration?(0,V.J_)(r,t.duration):void 0),[r,t.duration]),v=(0,V.mr)(r,1e3*n.date);return i.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},i.ZP.createElement(Et.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!h.Bi,ariaLabel:r(c?"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"},r(p)),i.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},i.ZP.createElement("i",{className:(0,He.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",u&&"V5tKkKZpcY5yq_f5nO8l",!c&&"e0Vhbj8gfzQn1zJQoFLK")}),i.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?r("CallMessageWithDuration",[v,f]):v))))}));var Ba=n(78780),xa=n(4863),La=n(50685);const Oa={__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>'},Ua={__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>'},ja=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s,a;const{focusedMessage:i,forwardMessages:o,lastSyncTime:r,serverTimeOffset:l}=e,{message:u,album:m,withSenderName:h,withAvatar:g,threadId:p,messageListType:f,isLastInDocumentGroup:v}=t,{id:I,chatId:w,viaBotId:y,replyToChatId:P,replyToMessageId:Z,isOutgoing:C,threadInfo:b,forwardInfo:S,transcriptionId:E}=u,M=(0,c.Z1)(e,w),R=(0,c.FM)(e,w),k=(0,d.pK)(w),A=M&&(0,d.eA)(M),T=null==M?void 0:M.username,N=!R&&(0,d.Ul)(u),B=h||g||N,x=(0,c.Ur)(e,u),L=(0,c.cv)(e,u),O=y?(0,c.dy)(e,y):void 0,U=p?(0,c.qS)(e,w,p):void 0,j=u.id===U,F=Z===U,D=Z&&!F?(0,c.hj)(e,k&&P?P:w,Z):void 0,q=D&&(0,c.Bz)(e,D,Boolean(S)),$=(0,c.uZ)(e,u),G="thread"===f&&(m?m.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,u)),{direction:H,noHighlight:V,isResizingContainer:_}=G&&i||{},z=o.messageIds&&o.messageIds.includes(I),{query:W}=(0,c.n5)(e)||{},X=(0,d.h_)(u),J=X&&((0,c.zB)(e,X)||(0,c.CP)(e,X))?X:void 0,Y=(0,d.HW)(u);let K;K=null!=m&&m.messages?m.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,I);const{canReply:Q}="thread"===f&&(0,c._k)(e,u,p)||{},ee=(0,c.te)(e,u),te=b?(0,c.tZ)(e,b.chatId,b.threadId)||b:void 0,ne=Boolean(u.groupedId)&&!u.isInAlbum,se=ne?(0,c.xH)(e,w,u.groupedId)[0]:void 0,ae=ne?v?(0,c.hj)(e,w,se):void 0:u,ie=null==M||null===(n=M.unreadReactions)||void 0===n?void 0:n.includes(u.id);return{theme:(0,c.Pu)(e),chatUsername:T,forceSenderName:N,sender:x,canShowSender:B,originSender:L,botSender:O,shouldHideReply:F,isThreadTop:j,replyMessage:D,replyMessageSender:q,isInDocumentGroup:ne,isProtected:(0,c.EV)(e,u),isFocused:G,isForwarding:z,reactionMessage:ae,isChatWithSelf:R,isRepliesChat:k,isChannel:A,canReply:Q,lastSyncTime:r,serverTimeOffset:l,highlight:W,animatedEmoji:J,animatedCustomEmoji:Y,isInSelectMode:(0,c.CA)(e),isSelected:K,isGroupSelected:Boolean(u.groupedId)&&!u.isInAlbum&&(0,c.a6)(e,w,u.groupedId),threadId:p,isDownloading:ee,isPinnedList:"pinned"===f,canAutoLoadMedia:(0,c.bH)(e,u),canAutoPlayMedia:(0,c.__)(e,u),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.yB)(e),threadInfo:te,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(u)?void 0:(0,c.q6)(e,w),activeReaction:ae&&e.activeReactions[ae.id],activeEmojiInteractions:e.activeEmojiInteractions,...C&&{outgoingStatus:(0,c.dT)(e,u,"scheduled"===f)},..."number"==typeof $&&{uploadProgress:$},...G&&{focusDirection:H,noFocusHighlight:V,isResizingContainer:_},hasUnreadReaction:ie,isTranscribing:void 0!==E&&(null===(s=e.transcriptions[E])||void 0===s?void 0:s.isPending),transcribedText:void 0!==E?null===(a=e.transcriptions[E])||void 0===a?void 0:a.text:void 0,isPremium:(0,c.wV)(e),animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{message:t,chatUsername:n,observeIntersectionForBottom:r,observeIntersectionForMedia:c,observeIntersectionForAnimatedStickers:l,album:u,noAvatars:g,withAvatar:f,withSenderName:v,areReactionsInMeta:I,noComments:w,appearanceOrder:y,isFirstInGroup:P,isPremium:Z,isLastInGroup:C,isFirstInDocumentGroup:b,isLastInDocumentGroup:S,isTranscribing:E,transcribedText:M,isLastInList:R,theme:k,forceSenderName:A,sender:T,canShowSender:N,originSender:B,botSender:x,isThreadTop:L,shouldHideReply:O,replyMessage:U,replyMessageSender:j,outgoingStatus:F,uploadProgress:D,isInDocumentGroup:q,isProtected:$,isFocused:G,focusDirection:H,noFocusHighlight:V,isResizingContainer:_,isForwarding:z,isChatWithSelf:W,isRepliesChat:X,isChannel:J,canReply:Y,lastSyncTime:K,serverTimeOffset:Q,highlight:ee,animatedEmoji:te,animatedCustomEmoji:ne,isInSelectMode:se,isSelected:ae,isGroupSelected:ie,threadId:oe,reactionMessage:re,availableReactions:ce,defaultReaction:le,activeReaction:de,activeEmojiInteractions:ue,messageListType:me,isPinnedList:he,isDownloading:ge,canAutoLoadMedia:pe,canAutoPlayMedia:fe,shouldLoopStickers:ve,autoLoadFileMaxSizeMb:we,threadInfo:ye,hasUnreadReaction:Pe,memoFirstUnreadIdRef:Ze,animationLevel:Ce}=e;const{toggleMessageSelection:be,clickBotInlineButton:Se,disableContextMenuHint:Ee,animateUnreadReaction:Me,focusLastMessage:Re}=(0,s.Sv)(),ke=(0,i.sO)(null),Ae=(0,i.sO)(null),Te=(0,i.sO)(null),Ne=(0,It.Z)(),[Be,xe]=(0,i.eJ)(!1),[Le,Oe,Ue]=(0,pt.Z)();(0,Wn._N)(Ae,r);const{isContextMenuOpen:je,contextMenuPosition:Fe,handleBeforeContextMenu:De,handleContextMenu:qe,handleContextMenuClose:$e,handleContextMenuHide:Ge}=(0,Yn.Z)(ke,h.$b&&se,!0,h.wZ);(0,i.d4)((()=>{je&&Ee()}),[je,Ee]);const Ve=y<=0,[_e,ze]=(0,pt.Z)(Ve);(0,i.d4)((()=>{Ve||setTimeout(ze,10*y)}),[y,ze,Ve]);const{transitionClassNames:We}=(0,st.Z)(_e,void 0,Ve,!1),{id:Xe,chatId:Je,forwardInfo:Ye,viaBotId:Ke,isTranscriptionError:Qe}=t,et=(0,d.CI)(t),tt=(0,d.B4)(t),nt="scheduled"===me||t.isScheduled,at=(0,d.ss)(t)&&!O,it=Boolean(ye)&&"thread"===me,ot=(0,d.$D)(t),rt=ot&&(te||ne),ct=(null==re?void 0:re.reactions)&&!(0,d.JE)(re.reactions),lt=Ye&&(!W||nt)&&!X&&!Ye.isLinkedChannelPost&&!ot,dt=Boolean(u)&&u.messages.length>1&&!(null!=u&&u.messages.some((e=>0===Object.keys(e.content).length))),ut=q&&!b,mt=q&&!S,ht=void 0!==Fe,gt=!(ht||se||z||mt),ft=J&&!nt&&!$,vt=Boolean(he||Ye&&(Ye.isChannelPost||W&&!tt||X)&&Ye.fromMessageId),wt=(0,i.I4)(((e,t)=>{be({messageId:Xe,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...dt&&{childMessageIds:u.messages.map((e=>{let{id:t}=e;return t}))}})}),[be,Xe,dt,u]),yt=N?T:void 0,Pt=Boolean(!Be&&(Qe||M)),Zt=Ye&&(W||X||!yt)?B:yt,Ct=Ye?B:yt,{handleMouseDown:bt,handleClick:St,handleContextMenu:Mt,handleDoubleClick:Rt,handleContentDoubleClick:kt,handleMouseMove:At,handleSendQuickReaction:Tt,handleMouseLeave:Nt,isSwiped:Bt,isQuickReactionVisible:xt,handleDocumentGroupMouseEnter:Lt}=ms(wt,ke,Xe,0,Boolean(se),Boolean(Y),Boolean($),qe,De,Je,ht,Te,tt,mt),{handleAvatarClick:Ot,handleSenderClick:Ut,handleViaBotClick:jt,handleReplyClick:Ft,handleMediaClick:Dt,handleAudioPlay:qt,handleAlbumMediaClick:$t,handleMetaClick:Gt,handleReadMedia:Ht,handleCancelUpload:Vt,handleVoteSend:_t,handleGroupForward:zt,handleForward:Wt,handleFocus:Xt,handleFocusForwarded:Jt,handleDocumentGroupSelectAll:Yt}=function(e,t,n,a,r,c,l,d,u,h,g,p,f){const{openChat:v,showNotification:I,focusMessage:w,openMediaViewer:y,openAudioPlayer:P,markMessagesRead:Z,cancelSendingMessage:C,sendPollVote:b,openForwardMenu:S,focusMessageInComments:E}=(0,s.Sv)(),{id:M,forwardInfo:R,replyToMessageId:k,replyToChatId:A,replyToTopMessageId:T,groupedId:N}=n,B=(0,i.I4)((()=>{g&&v({id:g.id})}),[g,v]),x=(0,i.I4)((()=>{p?l&&null!=R&&R.channelPostId?w({chatId:p.id,messageId:R.channelPostId}):v({id:p.id}):I({message:e("HidAccount")})}),[l,w,R,e,v,p,I]),L=(0,i.I4)((()=>{f&&v({id:f.id})}),[f,v]),O=(0,i.I4)((()=>{w({chatId:u&&A?A:a,threadId:r,messageId:k,replyMessageId:u&&A?void 0:M})}),[w,u,A,a,r,k,M]),U=(0,i.I4)((()=>{y({chatId:a,threadId:r,mediaId:M,origin:d?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,M,y,d]),j=(0,i.I4)((()=>{P({chatId:a,messageId:M})}),[a,M,P]),F=(0,i.I4)((e=>{y({chatId:a,threadId:r,mediaId:e,origin:d?m.bZ.ScheduledAlbum:m.bZ.Album})}),[a,r,y,d]),D=(0,i.I4)((()=>{Z({messageIds:[M]})}),[M,Z]),q=(0,i.I4)((()=>{C({chatId:a,messageId:M})}),[C,a,M]),$=(0,i.I4)((e=>{b({chatId:a,messageId:M,options:e})}),[a,M,b]),G=(0,i.I4)((()=>{S({fromChatId:a,groupedId:N})}),[S,a,N]),H=(0,i.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:a,messageIds:e})}else S({fromChatId:a,messageIds:[M]})}),[h,S,a,M]),V=(0,i.I4)((()=>{w({chatId:a,threadId:o._f,messageId:M})}),[w,a,M]),_=(0,i.I4)((()=>{c?w({chatId:R.fromChatId,groupedId:N,groupedChatId:a}):u&&A?E({chatId:A,threadId:T,messageId:R.fromMessageId}):w({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,A,w,R,N,a,E,T]),z=(0,i.I4)((e=>{e.stopPropagation(),t(e,N)}),[t,N]);return{handleAvatarClick:B,handleSenderClick:x,handleViaBotClick:L,handleReplyClick:O,handleMediaClick:U,handleAudioPlay:j,handleAlbumMediaClick:F,handleMetaClick:z,handleReadMedia:D,handleCancelUpload:q,handleVoteSend:$,handleGroupForward:G,handleForward:H,handleFocus:V,handleFocusForwarded:_,handleDocumentGroupSelectAll:z}}(Ne,wt,t,Je,oe,q,lt,nt,X,u,Zt,Ct,x);(0,i.d4)((()=>{R&&Pt&&M&&Re()}),[Re,R,M,Pt]);const Kt=(0,He.Z)("Message message-list-item",P&&"first-in-group",$&&"is-protected",C&&"last-in-group",b&&"first-in-document-group",S&&"last-in-document-group",R&&"last-in-list",tt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",at&&"has-reply",ht&&"has-menu-open",G&&!V&&"focused",z&&"is-forwarding",t.isDeleting&&"is-deleting",q&&"is-in-document-group",dt&&"is-album",t.hasUnreadMention&&"has-unread-mention",ae&&"is-selected",se&&"is-in-selection-mode",L&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Bt&&"is-swiped",We,(Boolean(de)||Le)&&"has-active-reaction"),{text:Qt,photo:en,video:tn,audio:nn,voice:sn,document:an,sticker:rn,contact:cn,poll:ln,webPage:dn,invoice:un,location:hn,action:gn,game:pn}=(0,d.qp)(t),{phoneCall:fn}=gn||{},vn=ye&&!mt&&"thread"===me&&!w,In=!h.$b&&!fn&&!se&&le&&!mt,wn=function(e){let{hasReply:t,customShape:n,isLastInGroup:s,asForwarded:i,hasThread:o,forceSenderName:r,hasComments:c,hasActionButton:l,hasReactions:u,isGeoLiveActive:m,withVoiceTranscription:h}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:g,photo:p,video:f,audio:v,voice:I,document:w,poll:y,webPage:P,contact:Z,location:C,invoice:b}=(0,d.qp)(e),S=["message-content"],E=p||f||C,M=g||"venue"===(null==C?void 0:C.type)||m,R=E&&!M,k=Boolean(e.viaBotId);return e.emojiOnlyCount?(S.push("emoji-only"),e.emojiOnlyCount<=a.L5&&S.push(`emoji-only-${e.emojiOnlyCount}`)):M&&S.push("text"),l&&S.push("has-action-button"),n&&(S.push("custom-shape"),null!=f&&f.isRound&&S.push("round"),c&&S.push("has-comments")),E?S.push("media"):v?S.push("audio"):I?(S.push("voice"),h&&S.push("with-voice-transcription")):w?S.push("document"):Z?S.push("contact"):y?S.push("poll"):P&&(S.push("web-page"),(P.photo||P.video)&&S.push("media")),b&&S.push("invoice"),i&&S.push("is-forwarded"),t&&S.push("is-reply"),o&&S.push("has-replies"),u&&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||i||!R||k||r)&&S.push("has-solid-background"),s&&(p||C&&!M||!R)&&S.push("has-appendix")),S.join(" ")}(t,{hasReply:at,customShape:ot,isLastInGroup:C,asForwarded:lt,hasThread:it,forceSenderName:A,hasComments:ye&&(null==ye?void 0:ye.messagesCount)>0,hasActionButton:ft||vt,hasReactions:ct,isGeoLiveActive:"geoLive"===(null==hn?void 0:hn.type)&&!(0,d.$R)(t,(0,p.b)(Q)),withVoiceTranscription:Pt}),yn=wn.includes("has-appendix"),Pn=t.emojiOnlyCount&&(0,fs.qo)(t.emojiOnlyCount),Zn=(0,mn.X)(t,ee,Pn,void 0,void 0,$,l);let Cn,bn;Cn=fn||mt?"none":!Zn||dn||rt?"standalone":"in-text",I?bn="in-meta":ct?ot||(en||tn)&&!Zn?bn="outside":lt?(Cn="standalone",bn="inside"):bn="inside":bn="none",(0,on.Z)(X&&t.replyToChatId?t.replyToChatId:Je,at?t.replyToMessageId:void 0,U,t.id),rs(ke,Je,G,H,V,_),(0,i.d4)((()=>{const e=Ae.current;Pe&&e&&(0,ps.P)(e)&&Me({messageIds:[Xe]})}),[Pe,Xe,Me]);let Sn,En="",Mn=!1;const Rn=(0,i.Ye)((()=>dt?ss(tt,Boolean(lt),Boolean(g),u):void 0),[dt,tt,lt,g,u]),kn=lt?28:0;if(dt||!en&&!tn)Rn&&(Sn=Math.max(Kn(Boolean(Qt),vn),Rn.containerStyle.width),Sn-Rn.containerStyle.width>18&&(Mn=!0));else{let e;en?e=Qn(t,g).width:tn&&(e=tn.isRound?Ie.Rj:Qn(t,g).width),e&&(Sn=Math.max(Kn(Boolean(Qt),vn),e),Sn-e>18&&(Mn=!0))}Sn&&(En=`width: ${Sn+kn}px`);const An=J&&t.adminTitle||!lt&&(null==Ye?void 0:Ye.adminTitle)||void 0,Tn=(0,i.Ye)((()=>An?os(An):void 0),[An]);function Bn(){const e=i.ZP.createElement(Rs,{message:t,reactionMessage:re,outgoingStatus:F,signature:An,withReactions:"in-meta"===bn,withReactionOffset:"inside"===bn,availableReactions:ce,activeReaction:de,onClick:Gt});return"inside"!==bn?e:i.ZP.createElement(Ta,{activeReaction:de,message:re,metaChildren:e,availableReactions:ce})}return i.ZP.createElement("div",{ref:ke,id:(0,d.d0)(t.id),className:Kt,style:Tn?`--meta-safe-author-width: ${Tn}px`:void 0,"data-message-id":Xe,onMouseDown:bt,onClick:St,onContextMenu:Mt,onDoubleClick:Rt,onMouseEnter:mt?Lt:void 0,onMouseMove:In?At:void 0,onMouseLeave:In||mt?Nt:void 0},i.ZP.createElement("div",{ref:Ae,className:"bottom-marker","data-message-id":Xe,"data-last-message-id":u?u.messages[u.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Pe||void 0}),!q&&i.ZP.createElement("div",{className:"message-select-control"},ae&&i.ZP.createElement("i",{className:"icon-select"})),S&&i.ZP.createElement("div",{className:(0,He.Z)("message-select-control group-select",ie&&"is-selected"),onClick:Yt},ie&&i.ZP.createElement("i",{className:"icon-select"})),f&&function(){const e=Zt&&(0,d.YC)(Zt.id),t=Zt&&e?Zt:void 0,n=Zt&&!e?Zt:void 0,s=!Zt&&Ye?Ye.hiddenUserName:void 0;return i.ZP.createElement(Ln.Z,{size:"small",user:t,chat:n,text:s,lastSyncTime:K,onClick:t||n?Ot:void 0,observeIntersection:c,animationLevel:Ce,withVideo:!0})}(),i.ZP.createElement("div",{className:(0,He.Z)("message-content-wrapper",wn.includes("text")&&"can-select-text")},i.ZP.createElement("div",{ref:Te,className:wn,style:En,dir:"auto"},lt&&!ut&&i.ZP.createElement("div",{className:"message-title"},Ne("ForwardedMessage")),function(){const e=(0,He.Z)("content-inner",lt&&"forwarded-message",at&&"reply-message",Mn&&"no-media-corners"),n=C&&!Zn&&!lt&&!it,s=(0,He.Z)("text-content","in-text"===Cn&&"with-meta",F&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:kt,dir:"auto"},function(){if(ot&&!Ke||!(v&&!(en||tn||hn)||lt||Ke||A)||ut||at&&ot)return;let e,n;!Ct||ot&&Ke?null!=Ye&&Ye.hiddenUserName&&(e=Ye.hiddenUserName):(e=(0,d.OU)(Ne,Ct),lt||(n=`color-${(0,d.Rs)(Ct)}`));const s=Ct&&"emojiStatus"in Ct&&Ct.emojiStatus,o=Ct&&"isPremium"in Ct&&Ct.isPremium;return i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,He.Z)("message-title-name interactive",n),onClick:Ut,dir:"ltr"},(0,Nn.Z)(e),!lt&&s&&i.ZP.createElement(Us.Z,{documentId:s.documentId,loopLimit:a.y3,observeIntersection:c,observeIntersectionForPlaying:l}),!lt&&!s&&o&&i.ZP.createElement(xa.Z,null),(null==Ct?void 0:Ct.fakeType)&&i.ZP.createElement(La.Z,{fakeType:Ct.fakeType})):x?void 0:" ",x&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Ne("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:jt},(0,Nn.Z)(`@${x.username}`))),null!=Ye&&Ye.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ne("DiscussChannel")):t.adminTitle&&!J?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.adminTitle):void 0)}(),at&&i.ZP.createElement(Ps,{message:U,noUserColors:tt,isProtected:$,sender:j,observeIntersection:c,onClick:Ft}),rn&&i.ZP.createElement(As,{message:t,observeIntersection:c,observeIntersectionForPlaying:l,shouldLoop:ve,lastSyncTime:K,shouldPlayEffect:rn.hasEffect&&(Ze.current&&Xe>=Ze.current||et)||void 0,onPlayEffect:Oe,onStopEffect:Ue}),rt&&ne&&i.ZP.createElement(js,{customEmojiId:ne,withEffects:(0,d.YC)(Je),isOwn:tt,observeIntersection:c,lastSyncTime:K,forceLoadPreview:et,messageId:Xe,chatId:Je,activeEmojiInteractions:ue}),rt&&te&&i.ZP.createElement(Os,{emoji:te,withEffects:(0,d.YC)(Je),isOwn:tt,observeIntersection:c,lastSyncTime:K,forceLoadPreview:et,messageId:Xe,chatId:Je,activeEmojiInteractions:ue}),dt&&i.ZP.createElement(ba,{album:u,albumLayout:Rn,observeIntersection:c,isOwn:tt,isProtected:$,hasCustomAppendix:n,lastSyncTime:K,onMediaClick:$t}),fn&&i.ZP.createElement(Na,{message:t,phoneCall:fn,chatId:Je}),!dt&&en&&i.ZP.createElement(_s,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:pe,uploadProgress:D,shouldAffectAppendix:n,onClick:Dt,onCancelUpload:Vt,isDownloading:ge,isProtected:$,theme:k}),!dt&&tn&&tn.isRound&&i.ZP.createElement(Ma,{message:t,observeIntersection:c,canAutoLoad:pe,lastSyncTime:K,isDownloading:ge}),!dt&&tn&&!tn.isRound&&i.ZP.createElement(Js,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:pe,canAutoPlay:fe,uploadProgress:D,lastSyncTime:K,onClick:Dt,onCancelUpload:Vt,isDownloading:ge,isProtected:$}),(nn||sn)&&i.ZP.createElement(Cs.ZP,{theme:k,message:t,origin:m.Cr.Inline,uploadProgress:D,lastSyncTime:K,isSelectable:q,isSelected:ae,noAvatars:g,onPlay:qt,onReadMedia:!sn||tt&&!W?void 0:Ht,onCancelUpload:Vt,isDownloading:ge,isTranscribing:E,isTranscriptionHidden:Be,isTranscribed:Boolean(M),isTranscriptionError:Qe,canDownload:!$,onHideTranscription:xe,canTranscribe:Z}),an&&i.ZP.createElement(Zs.Z,{message:t,observeIntersection:c,canAutoLoad:pe,autoLoadFileMaxSizeMb:we,uploadProgress:D,isSelectable:q,isSelected:ae,onMediaClick:Dt,onCancelUpload:Vt,isDownloading:ge}),cn&&i.ZP.createElement(Ks,{contact:cn}),ln&&i.ZP.createElement(oa,{message:t,poll:ln,onSendVote:_t}),pn&&i.ZP.createElement(ya,{message:t,canAutoLoadMedia:pe,lastSyncTime:K}),Pt&&i.ZP.createElement("p",{className:(0,He.Z)("transcription",!Be&&Qe&&"transcription-error"),dir:"auto"},Qe?Ne("NoWordsRecognized"):E&&M?i.ZP.createElement(Ba.Z,{content:M}):M),!rt&&Zn&&i.ZP.createElement("p",{className:s,dir:"auto"},Zn,"in-text"===Cn&&Bn()),dn&&i.ZP.createElement(la,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:pe,canAutoPlay:fe,lastSyncTime:K,onMediaClick:Dt,onCancelMediaTransfer:Vt,isDownloading:ge,isProtected:$,theme:k}),un&&i.ZP.createElement(ua,{message:t,shouldAffectAppendix:n,isInSelectMode:se,isSelected:ae,theme:k}),hn&&i.ZP.createElement(wa,{message:t,lastSyncTime:K,isInSelectMode:se,isSelected:ae,theme:k,peer:T,serverTimeOffset:Q}))}(),!mt&&"standalone"===Cn&&Bn(),gt&&ft?i.ZP.createElement(Et.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ne("lng_context_forward_msg"),onClick:S?zt:Wt},i.ZP.createElement("i",{className:"icon-share-filled"})):gt&&vt?i.ZP.createElement(Et.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:he?Xt:Jt},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,vn&&i.ZP.createElement(ka,{threadInfo:ye,disabled:w}),yn&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:tt?Oa:Ua}),In&&i.ZP.createElement("div",{className:(0,He.Z)("quick-reaction",xt&&!de&&"visible"),onClick:Tt},i.ZP.createElement(Ss.Z,{reaction:le}))),t.inlineButtons&&i.ZP.createElement(Ra,{message:t,onClick:Se}),"outside"===bn&&i.ZP.createElement(Ta,{message:re,isOutside:!0,activeReaction:de,availableReactions:ce})),Fe&&i.ZP.createElement(Is,{isOpen:je,anchor:Fe,message:t,album:u,chatUsername:n,messageListType:me,onClose:$e,onCloseAnimationEnd:Ge}))}))),Fa=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Da=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),qa=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.fS)(e,n),{chatId:a,isBot:i}=s||{};return{message:s,bot:a&&i?(0,c.dy)(e,a):void 0,channel:!i&&a?(0,c.Z1)(e,a):void 0}}))((e=>{let{chatId:t,message:n,containerRef:a,bot:o,channel:r}=e;const{viewSponsoredMessage:c,openChat:l,openChatByInvite:u,startBot:m,focusMessage:g}=(0,s.Sv)(),p=(0,It.Z)(),f=(0,i.sO)(null),v=(0,i.sO)(null),I=Boolean(n),{observe:w}=(0,Wn.S1)({rootRef:a,debounceMs:200,threshold:1}),{isContextMenuOpen:y,contextMenuPosition:P,handleBeforeContextMenu:Z,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:S}=(0,Yn.Z)(f,h.$b,!0,h.wZ),[E,M,R]=(0,pt.Z)(!1);(0,i.d4)((()=>I?w(v.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,I,w,c]);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&&m({botId:n.chatId,param:n.startParam})))}),[g,n,l,u,m]);if(n)return i.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,$n.q)(e),Z(e)},onContextMenu:C},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"},o&&(0,Nn.Z)((0,d.Js)(o)||""),r&&(0,Nn.Z)(n.chatInviteTitle||(0,d.U)(p,r,o)||"")),i.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:v},i.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,Qs.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(Et.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),P&&i.ZP.createElement(Da,{isOpen:y,anchor:P,message:n,onAboutAds:M,onClose:b,onCloseAnimationEnd:S}),i.ZP.createElement(Fa,{isOpen:E,onClose:R}))}))),$a=(0,i.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,messageIds:o,messageGroups:r,isViewportNewest:c,isUnread:l,withUsers:u,areReactionsInMeta:p,noAvatars:f,containerRef:v,anchorIdRef:I,memoUnreadDividerBeforeIdRef:w,memoFirstUnreadIdRef:y,threadId:P,type:Z,isReady:C,isScrollingRef:b,isScrollPatchNeededRef:S,threadTopMessageId:E,hasLinkedChat:M,isSchedule:k,noAppearanceAnimation:A,onFabToggle:T,onNotchToggle:N}=e;const{openHistoryCalendar:B}=(0,s.Sv)(),{observeIntersectionForMedia:x,observeIntersectionForReading:L,observeIntersectionForAnimatedStickers:O}=function(e,t,n){const{markMessageListRead:a,markMentionsRead:i,animateUnreadReaction:o}=(0,s.Sv)(),{observe:r}=(0,Wn.S1)({rootRef:t,throttleMs:Xn,margin:Jn}),{observe:c,freeze:l,unfreeze:d}=(0,Wn.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let s=0;const r=[],c=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:a}=n,i=Number(a.lastMessageId||a.messageId);i>s&&(s=i),a.hasUnreadMention&&r.push(i),a.hasUnreadReaction&&c.push(i)})),n.current&&s>=n.current&&a({maxId:s}),r.length&&i({messageIds:r}),c.length&&o({messageIds:c})}));(0,We.Z)(l,d);const{observe:u}=(0,Wn.S1)({rootRef:t,throttleMs:Xn});return{observeIntersectionForMedia:r,observeIntersectionForReading:c,observeIntersectionForAnimatedStickers:u}}(Z,v,y),{backwardsTriggerRef:U,forwardsTriggerRef:j,fabTriggerRef:F}=function(e,t,n,o,r,c,l,d,u,g){const{loadViewportMessages:p}=(0,s.Sv)(),[f,v]=(0,i.Ye)((()=>"thread"===e?[(0,R.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,R.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,n]),I=(0,i.sO)(null),w=(0,i.sO)(null),y=(0,i.sO)(null);function P(){if(!d)return;if(!n||!n.length)return c(!1),void l(!1);if(!o)return c(!0),void l(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:s,scrollTop:a}=t.current,i=Math.round(s-a-e),u=i<=1;c(r?!u:!(i<=50)),l(!u)}const{observe:Z}=(0,Wn.S1)({rootRef:t,margin:h.gZ},(e=>{if(!v||!f)return;if(n[0]>a.MP)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:s}=t;"backwards-trigger"===s.className?(h.i4&&u.current&&n.length<=a.hT&&(g.current=!0),f()):"forwards-trigger"===s.className&&v()}));(0,Wn._N)(I,Z),(0,Wn._N)(w,Z);const{observe:C,freeze:b,unfreeze:S}=(0,Wn.S1)({rootRef:t,margin:100},P);(0,Wn._N)(y,C);const{observe:E,freeze:M,unfreeze:k}=(0,Wn.S1)({rootRef:t,margin:1},P);return(0,Wn._N)(y,E),(0,Je.Z)((()=>{d&&P()}),[d]),(0,Je.Z)((()=>{b(),M(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:w,fabTriggerRef:y}}(Z,v,o,c,l,T,N,C,b,S),D=(0,It.Z)(),q=i.ZP.createElement("div",{className:(0,He.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,D("UnreadMessages"))),$=A?0:r.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let G=0;const H=r.map(((e,t,n)=>{const s=e.senderGroups.map(((e,s,a)=>{var o;if(1===e.length&&!Dn(e[0])&&(0,d.Lo)(e[0])&&(null===(o=e[0].content.action)||void 0===o||!o.phoneCall)){const o=e[0],r=s===a.length-1&&t===n.length-1;return(0,g.oA)([o.id===w.current&&q,i.ZP.createElement(ys,{key:o.id,message:o,observeIntersection:L,observeIntersectionForAnimation:O,memoFirstUnreadIdRef:y,appearanceOrder:$-++G,isLastInList:r})])}let r;return e.map(((o,c)=>{const l=Dn(o)?o.mainMessage:o,m=Dn(o)?o:void 0,h=(0,d.B4)(l),v=Dn(o),C=e[c+1];l.previousLocalId&&I.current===(0,d.d0)(l.previousLocalId)&&(I.current=(0,d.d0)(l.id));const b=!v&&l.groupedId?l.groupedId:void 0,S=C&&!Dn(C)?C.groupedId:void 0,R={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==r),isLastInDocumentGroup:Boolean(b&&b!==S),isLastInList:c===e.length-1&&s===a.length-1&&t===n.length-1};r=b;const k=(0,d.KK)(l),A=(0,d.jM)(l)?`${l.date}_${k}`:k;return(0,g.oA)([l.id===w.current&&q,i.ZP.createElement(ja,{key:A,message:l,observeIntersectionForBottom:L,observeIntersectionForMedia:x,observeIntersectionForAnimatedStickers:O,album:m,noAvatars:f,withAvatar:R.isLastInGroup&&u&&!h&&!(l.id===E),withSenderName:R.isFirstInGroup&&u&&!h,areReactionsInMeta:p,threadId:P,messageListType:Z,noComments:!1===M,appearanceOrder:$-++G,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:y}),l.id===E&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,D("DiscussionStarted")))])})).flat()}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:$n.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,He.Z)("sticky-date",!k&&"interactive"),key:"date-header",onMouseDown:$n.q,onClick:k?void 0:()=>B({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},k&&e.originalDate===a.t4&&D("MessageScheduledUntilOnline"),k&&e.originalDate!==a.t4&&D("MessageScheduledOn",(0,V.j1)(D,e.datetime,void 0,!0)),!k&&(0,V.j1)(D,e.datetime))),s.flat())}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},i.ZP.createElement("div",{ref:U,key:"backwards-trigger",className:"backwards-trigger"}),H.flat(),!t&&c&&i.ZP.createElement(qa,{key:n,chatId:n,containerRef:v}),i.ZP.createElement("div",{ref:j,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:F,key:"fab-trigger",className:"fab-trigger"}))}));var Ga=n(73547);const Ha=(0,i.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;const{stickers:s}=e.stickers.greeting,a=(0,d.db)(n)+(0,d.db)(e.currentUserId),i=null!=s&&s.length?s[a%s.length]:void 0,o=(0,c.Z1)(e,n);return o?{sticker:i,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:a}=e;const{loadGreetingStickers:o,sendMessage:r,markMessageListRead:c}=(0,s.Sv)(),l=(0,It.Z)(),d=(0,i.sO)(null),{observe:u}=(0,Wn.S1)({rootRef:d,debounceMs:200});(0,i.d4)((()=>{t||"connectionStateReady"!==n||o()}),[n,o,t]),(0,i.d4)((()=>{"connectionStateReady"===n&&a&&c({maxId:a})}),[n,c,a]);const m=(0,i.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return i.ZP.createElement("div",{className:"ContactGreeting",ref:d},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),i.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),i.ZP.createElement("div",{className:"sticker"},t&&i.ZP.createElement(Ga.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),Va=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:s}=e;const a=(0,It.Z)();return"scheduled"===n?function(e){return i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(a):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")))))}(a):s?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")))))}(a):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,a("NoMessages")))})),_a=(0,R.Ds)((e=>e()),200,!1),za=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,type:a}=t;const i=(0,c.Z1)(e,n);if(!i)return{};const r=(0,c.$W)(e,n,s,a),l="scheduled"===a?(0,c.Fn)(e,n):(0,c.Zw)(e,n),u=(0,c.qS)(e,n,s);if(s!==o._f&&!(l&&u&&l[u]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=i,p=(0,c.G$)(e,n),f=s===o._f&&!r&&!i.unreadCount&&!p&&g&&!g.groupedId,v=(0,c.IK)(e,n);let I,w=!1;return(0,c.pk)(e,n)&&(v.fullInfo?I=v.fullInfo.botInfo:w=!0),{isCurrentUserPremium:(0,c.wV)(e),isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,d.eA)(i),isGroupChat:(0,d.Bf)(i),isCreator:i.isCreator,isChatWithSelf:(0,c.FM)(e,n),isRepliesChat:(0,d.pK)(n),isBot:Boolean(v),messageIds:r,messagesById:l,firstUnreadId:(0,c.It)(e,n,s),isViewportNewest:"thread"!==a||(0,c.b9)(e,n,s),threadFirstMessageId:(0,c.yZ)(e,n,s),focusingId:p,isSelectModeActive:(0,c.CA)(e),isLoadingBotInfo:w,botInfo:I,threadTopMessageId:u,hasLinkedChat:i.fullInfo&&"linkedChatId"in i.fullInfo?Boolean(i.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...f&&{lastMessage:g}}}))((e=>{var t,n,o,r,l,u;let{chatId:p,threadId:f,type:v,hasTools:I,onFabToggle:w,onNotchToggle:y,isCurrentUserPremium:P,isChatLoaded:Z,isChannelChat:C,isGroupChat:b,canPost:S,isReady:E,isChatWithSelf:M,isRepliesChat:k,isCreator:A,isBot:T,messageIds:N,messagesById:B,firstUnreadId:x,isViewportNewest:L,threadFirstMessageId:O,isRestricted:U,restrictionReason:j,focusingId:F,isSelectModeActive:D,lastMessage:q,isLoadingBotInfo:$,botInfo:G,threadTopMessageId:H,hasLinkedChat:V,lastSyncTime:_,withBottomShift:z,withDefaultBg:W}=e;const{loadViewportMessages:X,setScrollOffset:J,loadSponsoredMessages:Y,loadMessageReactions:K,copyMessagesByIds:Q}=(0,s.Sv)(),ee=(0,i.sO)(null),te=(0,i.sO)("thread"===v&&(0,c.Vt)((0,s.Rd)(),p,f)||0),ne=(0,i.sO)(),se=(0,i.sO)(),ae=(0,i.sO)(),ie=(0,i.sO)(),oe=(0,i.sO)(),re=(0,i.sO)(),ce=(0,i.sO)(!1),le=(0,i.sO)(Boolean(q)),[de,ue]=(0,i.eJ)(),me=(0,hn.Z)(null!=G&&G.photo?(0,d.NF)(G.photo):void 0),he=(0,hn.Z)(null!=G&&G.gif?(0,d.ym)(G.gif):void 0),ge=null!=G&&G.photo?(0,d.bV)(G.photo):null!=G&&G.gif?(0,d.jC)(G.gif):void 0,pe=ge&&{width:ge.width/h.cL,height:ge.height/h.cL},fe=Boolean(N);(0,Je.Z)((()=>{fe&&(0,R.R3)((()=>{le.current=!1}))}),[fe]),(0,Je.Z)((()=>{ie.current=x}),[x]),(0,Je.Z)((()=>{!P&&C&&E&&_&&Y({chatId:p})}),[P,p,E,C,_]),(0,Je.Z)((()=>{fe&&(oe.current=ie.current)}),[fe]),(0,Je.Z)((()=>{re.current=F}),[F]),(e=>{(0,ft.y)({"Mod+C":function(t){const n=(0,_n.Z)();n&&n.length>0&&(t.preventDefault(),e({messageIds:n}))}})})(Q);const ve=(0,i.Ye)((()=>{if(!N||!B)return;const e=!H||N[0]&&O!==N[0]?N:[H,...N];if(!e.length)return;const t=e.map((e=>B[e])).filter(Boolean);return qn((0,g.Xo)(t,["date","id"]),oe.current)}),[N,B,O,H]);(0,it.Z)((()=>{if(!N||!B)return;const e=N.filter((e=>{var t;return null===(t=B[e])||void 0===t?void 0:t.reactions}));e.length&&K({chatId:p,ids:e})}),15e3);const Ie=(0,i.Ye)((()=>{if("thread"===v)return(0,R.Ds)((()=>X({direction:m.Uq.Around})),1e3,!0,!1)}),[X,N]),{isScrolled:we,updateStickyDates:ye}=function(){const[e,t]=(0,pt.Z)(!1),n=(0,Vn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,i.I4)(((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,R.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,R.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:a}=e,i=n-s;return-a<=i&&i<=(t?60:10)}))}(e,s);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),Pe=(0,i.sO)(),Ze=(0,i.sO)(),Ce=(0,i.I4)((()=>{if(ce.current)return void(ce.current=!1);Pe.current=!0;const e=ee.current;re.current||ye(e,I),_a((()=>{Pe.current=!1,(0,R.T2)((()=>{e.parentElement&&(te.current=e.scrollHeight-e.scrollTop,"thread"===v&&J({chatId:p,threadId:f,scrollOffset:te.current}))}))}))}),[ye,I,v,J,p,f]);(0,i.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((e=>{let[t]=e;t.target.offsetParent&&ue(t.contentRect.height)}));return e.observe(ee.current),()=>{e.disconnect()}}),[]);const{height:be}=(0,tn.Z)();(0,i.d4)((()=>{ee.current.dataset.normalHeight=String(ee.current.offsetHeight)}),[be,S]),(0,i.d4)((()=>{if(!Ie||!Z||U||F)return;if(N&&N[N.length-1]>a.MP)return;const e=ee.current;(!N||N.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&Ie()}),[Z,N,Ie,F,U]),(0,Je.Z)((()=>{if(!N||!ae.current)return;const e=ae.current.filter((e=>N.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(ne.current=t.id,se.current=t.getBoundingClientRect().top)}),[N,L,de,I]),(0,zn.Z)((e=>{let[t,n,s]=e;const i=ee.current;ae.current=Array.from(i.querySelectorAll(".message-list-item"));const o=N&&t&&N[N.length-1]!==t[t.length-1],r=(null==N?void 0:N[0])!==(null==t?void 0:t[0])&&(null==N?void 0:N.length)===a.hT/2+1,c=o&&!r,l=N&&re.current===N[N.length-1],d=L&&c&&N&&N.length<a.hT/2&&!i.parentElement.classList.contains("force-messages-scroll")&&i.firstElementChild.clientHeight<=2*i.offsetHeight;d&&(i.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{i.parentElement&&i.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=i,g=te.current,p=ae.current[ae.current.length-1];let f=g-(s||h);c&&(f-=p?p.offsetHeight:0);const v=L&&n&&f<=50;let w;if(c&&v&&!l&&(p&&(0,R.T2)((()=>{(0,Hn.Z)(i,p,"end",20)})),w=m-h,te.current=Math.max(Math.ceil(m-w),h),!d))return;const y=void 0!==s&&s!==de,P=ne.current&&i.querySelector(`#${ne.current}`),Z=!P&&oe.current&&i.querySelector(".unread-divider");if(v&&y){if((0,Hn.N)())return;w=m-h}else P?(Ze.current&&(Ze.current=!1,(0,Gn.z)(i)),w=u+(P.getBoundingClientRect().top-(se.current||0))):w=Z?Math.min(Z.offsetTop-(I?60:10),m-g):m-g;(0,Gn.Z)(i,Math.ceil(w)),re.current||(ce.current=!0,(0,R.T2)((()=>{ce.current=!1}))),te.current=Math.max(Math.ceil(m-w),h)}),[N,L,de,I]),(0,ze.Z)((e=>{let[t]=e;void 0!==t&&(0,at.YW)(200+a.fK)}),[D]);const Se=(0,It.Z)(),Ee=Boolean(p&&(0,d.YC)(p)),Me=Boolean(!Ee&&!C||M||k),Re=Boolean(!Me||C),ke=(0,d.YC)(p)&&!M&&!T&&(!ve&&!q&&N&&(!ae.current||0===ae.current.length)||1===(null==N?void 0:N.length)&&"contactSignUp"===(null==B||null===(t=B[N[0]])||void 0===t||null===(n=t.content.action)||void 0===n?void 0:n.type)||"contactSignUp"===(null==q||null===(o=q.content)||void 0===o||null===(r=o.action)||void 0===r?void 0:r.type)),Ae=b&&A&&1===(null==N?void 0:N.length)&&"chatCreate"===(null==B||null===(l=B[N[0]])||void 0===l||null===(u=l.content.action)||void 0===u?void 0:u.type),Te=G&&!G.description,Ne=(0,He.Z)("MessageList custom-scroll",Re&&"no-avatars",!S&&"no-composer","pinned"===v&&"type-pinned",z&&"with-bottom-shift",W&&"with-default-bg",D&&"select-mode-active",we&&"scrolled",!E&&"is-animating");return i.ZP.createElement("div",{ref:ee,className:Ne,onScroll:Ce,onMouseDown:$n.q},U?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,j?j.text:"This is a private "+(C?"channel":"chat"))):G?i.ZP.createElement("div",{className:"empty"},$&&i.ZP.createElement("span",null,Se("Loading")),Te&&i.ZP.createElement("span",null,Se("NoMessages")),G&&i.ZP.createElement("div",{className:"bot-info",style:pe&&`width: ${pe.width}px`},me&&i.ZP.createElement("img",{src:me,width:null==pe?void 0:pe.width,height:null==pe?void 0:pe.height,alt:"Bot info"}),he&&i.ZP.createElement(Ws.Z,{canPlay:!0,src:he,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),ge&&!me&&!he&&i.ZP.createElement(da.Z,{width:null==pe?void 0:pe.width,height:null==pe?void 0:pe.height}),G.description&&i.ZP.createElement("div",{className:"bot-info-description"},i.ZP.createElement("p",{className:"bot-info-title"},Se("BotInfoTitle")),(0,Nn.Z)(G.description,["br","emoji","links"])))):ke?i.ZP.createElement(Ha,{userId:p}):!N||ve&&!Ae?N&&ve||q?i.ZP.createElement($a,{isCurrentUserPremium:P,chatId:p,messageIds:N||[q.id],messageGroups:ve||qn([q]),isViewportNewest:Boolean(L),isUnread:Boolean(x),withUsers:Me,areReactionsInMeta:Ee,noAvatars:Re,containerRef:ee,anchorIdRef:ne,memoUnreadDividerBeforeIdRef:oe,memoFirstUnreadIdRef:ie,threadId:f,type:v,isReady:E,isScrollingRef:Pe,isScrollPatchNeededRef:Ze,threadTopMessageId:H,hasLinkedChat:V,isSchedule:!!ve&&"scheduled"===v,noAppearanceAnimation:!ve||!le.current,onFabToggle:w,onNotchToggle:y}):i.ZP.createElement(jt.Z,{color:"white",backgroundColor:"dark"}):i.ZP.createElement(Va,{chatId:p,type:v,isChatWithSelf:M,isGroupChatJustCreated:Ae}))}))),Wa=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:s,onClick:a,onReadAll:o,className:r}=e;const c=(0,It.Z)(),l=(0,i.sO)(null),{isContextMenuOpen:d,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,Yn.Z)(l,!o);return i.ZP.createElement("div",{className:(0,He.Z)("KboxtoWkfx23zfklH_Zg",r),ref:l},i.ZP.createElement(Et.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:a,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,He.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(s)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,lt.bi)(s)),o&&i.ZP.createElement(qt.Z,{isOpen:d,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(St.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),Xa=(0,i.X$)((0,s.c$)((e=>{const t=(0,c.Bt)(e);if(!t)return{};const{chatId:n,threadId:s,type:a}=t,i=(0,c.Z1)(e,n),r=i&&s===o._f&&"thread"===a;return{messageListType:a,chatId:n,reactionsCount:r?i.unreadReactionsCount:void 0,mentionsCount:r?i.unreadMentionsCount:void 0,unreadCount:r?i.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:a,chatId:o,unreadCount:r,reactionsCount:c,mentionsCount:l,withExtraShift:d}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:v}=(0,s.Sv)(),I=(0,i.sO)(null),w=Boolean(c),y=Boolean(l);(0,i.d4)((()=>{w&&o&&g({chatId:o})}),[o,g,w]),(0,i.d4)((()=>{y&&o&&v({chatId:o})}),[o,v,y]);const P=(0,i.I4)((()=>{if(t)if("thread"===a)u();else{const e=I.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Hn.Z)(e,n,"end",20)}}),[t,a,u]),Z=(0,He.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(l))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(l))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!d&&"S98OqutuQVCNVHgTrKv4");return i.ZP.createElement("div",{ref:I,className:Z},w&&i.ZP.createElement(Wa,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),y&&i.ZP.createElement(Wa,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:l}),i.ZP.createElement(Wa,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:P,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var Ja=n(65723);const Ya=1280,Ka=/\.[^/.]+$/;async function Qa(e,t,s,i){const o=URL.createObjectURL(t),{type:r,size:c}=t;let l,d,u;if(a.oG.has(r))if(s){const t=await(0,en.pt)(o),{width:n,height:s}=t,a=n>Ya||s>Ya;if(a||"image/jpeg"!==r){const t=await Sn(o,a?Ya/Math.max(n,s):1,"image/jpeg");return URL.revokeObjectURL(o),Qa(e,await(0,en.gm)(t),!0,i)}"image/jpeg"===r&&(e=e.replace(Ka,".jpg")),l={width:n,height:s}}else u=o;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,en.jj)(o);l={width:e,height:t,duration:n},u=await(0,en.ud)(o)}else if(a.e7.has(r)){const{duration:e,title:t,performer:s,coverUrl:a}=await async function(e){const{fetchFromUrl:t,selectCover:s}=await n.e(8505).then(n.t.bind(n,38505,23)),a=await t(e),{common:{title:i,artist:o,picture:r},format:{duration:c}}=a,l=s(r);return{title:i,performer:o,duration:c,coverUrl:l?`data:${l.format};base64,${l.data.toString("base64")}`:void 0}}(o);d={duration:e||0,title:t,performer:s},u=a}return{blobUrl:o,filename:e,mimeType:r,size:c,quick:l,audio:d,previewBlobUrl:u,...i}}var ei=n(41098),ti=n(96391);let ni;function si(e){ni.focus(),e.focus()}h.cj&&(ni=document.createElement("input"),ni.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(ni));var ai=n(74288),ii=n(94462),oi=n(52400);const ri=new RegExp(`^${a.t8.source}$`,"g");var ci=n(56389),li=n(70971);const di={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},ui={type:"audio/ogg"};let mi,hi,gi;async function pi(){return mi||(mi=n.e(1161).then(n.t.bind(n,1161,23)),hi=(await mi).default,gi=new hi(di)),mi}async function fi(e){await async function(){await pi(),await gi.start()}();const t=Date.now();let n;const s=[],a=[];gi.ondataavailable=e=>{s.push(e)};const i=function(t,n){const s=t.sourceNode,i=s.context.createAnalyser();i.fftSize=64,s.connect(i);const o=i.frequencyBinCount,r=new Uint8Array(o);let c=!1;return function t(){if(c)return;i.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/o/255;(t=>{a.push(255*t),e(t)})(n<.1?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(gi);return{stop:()=>new Promise(((e,o)=>{gi.onstop=()=>{e({blob:new Blob(s,ui),duration:Math.round(((n||Date.now())-t)/1e3),waveform:a})},gi.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{gi.stop(),i()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{gi.pause(),n=Date.now(),i()}),e)}}}var vi=n(21262);const Ii=["image/png","image/jpeg","image/gif"];let wi,yi;var Pi=n(72162),Zi=n(29295);function Ci(e,t,n){const[s,a]=(0,i.eJ)(),{isFrozen:o,updateWhenUnfrozen:r}=function(){const e=(0,i.sO)(!1),t=(0,i.I4)((()=>{e.current=!0}),[]),n=(0,tt.Z)(),s=(0,i.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,at.ZP)(bi,s),{isFrozen:(0,at.zG)(),updateWhenUnfrozen:t}}(),c=(0,Vn.Z)(t,!0);return(0,Je.Z)((()=>{o?r():c((()=>{a(e())}))}),[...n,o]),s}function bi(){}const Si=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Ei=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,Mi={username:"",query:"",canShowHelp:!1,usernameLowered:""},Ri=document.createElement("div");const ki=(0,R.P2)((e=>e()),500,!0),Ai=/^[\w@]{1,32}\s?/i;var Ti=n(33057),Ni=n(19934);const Bi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function xi(){return xi=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},xi.apply(this,arguments)}let Li,Oi=!0;const Ui=(0,i.X$)((e=>{let{onActivate:t,...n}=e;const s=(0,i.sO)(!1),a=(0,i.I4)((()=>{if(s.current=!0,Oi)return Oi=!1,void t();Li&&(clearTimeout(Li),Li=void 0),Li=window.setTimeout((()=>{s.current&&t()}),200)}),[t]),o=(0,i.I4)((()=>{s.current=!1}),[]);return i.ZP.createElement(Et.Z,xi({},n,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:o,onClick:t}))}));var ji=n(85655),Fi=n(56503),Di=n(62898);const qi="N3E1geoPu1vesCKf545F",$i=/#fff/gi,Gi=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const s=(0,hn.Z)((0,d.ym)(t),!1,o.IU.Text),a=(0,i.Ye)((()=>{if(!s)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=s.replace($i,e),a=(new DOMParser).parseFromString(t,"image/svg+xml");return a.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${a.documentElement.outerHTML}`}),[s,n]);return i.ZP.createElement("i",{className:(0,He.Z)("vL8HfVVnjTeFmp1ECFj8",h.FW&&qi)},i.ZP.createElement("img",{src:a,alt:"",className:(0,He.Z)("Fb4aIyDYEwOlaqY8oZkV",h.FW&&qi)}))})),Hi=(0,i.X$)((e=>{let{bot:t,theme:n,chatId:a,onMenuOpened:o,onMenuClosed:r}=e;const{callAttachBot:c,toggleAttachBot:l}=(0,s.Sv)(),d=(0,It.Z)(),u=(0,i.Ye)((()=>{var e;return null===(e=t.icons.find((e=>{let{name:t}=e;return"default_static"===t})))||void 0===e?void 0:e.document}),[t.icons]),[m,h,g]=(0,pt.Z)(),[p,f]=(0,i.eJ)(void 0),v=(0,i.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();f({x:t.right,y:t.bottom}),o(),h()}),[o,h]),I=(0,i.I4)((()=>{g(),r()}),[g,r]),w=(0,i.I4)((()=>{f(void 0)}),[]),y=(0,i.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return i.ZP.createElement(St.Z,{key:t.id,customIcon:u&&i.ZP.createElement(Gi,{icon:u,theme:n}),icon:u?void 0:"bots",onClick:()=>c({botId:t.id,chatId:a}),onContextMenu:v},t.shortName,p&&i.ZP.createElement(Di.Z,null,i.ZP.createElement(qt.Z,{isOpen:m,positionX:"right",style:`left: ${p.x}px;top: ${p.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:I,onCloseAnimationEnd:w},i.ZP.createElement(St.Z,{icon:"stop",destructive:!0,onClick:y},d("WebApp.RemoveBot")))))})),Vi=(0,i.X$)((e=>{let{chatId:t,isButtonVisible:n,canAttachMedia:s,canAttachPolls:o,attachBots:r,peerType:c,isScheduled:l,onFileSelect:d,onPollCreate:u,theme:m}=e;const[g,p,f]=(0,pt.Z)(),[v,I,w]=(0,Fi.Z)(g,f),[y,P,Z]=(0,pt.Z)();(0,i.d4)((()=>{g&&w()}),[g,w]);const C=(0,i.I4)((()=>{g?f():p()}),[g,p,f]),b=(0,i.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&d(Array.from(n),t)}),[d]),S=(0,i.I4)((()=>{(0,ji.g)(Array.from(a.dI).join(","),(e=>b(e,!0)))}),[b]),E=(0,i.I4)((()=>{(0,ji.g)("*",(e=>b(e,!1)))}),[b]),M=(0,i.Ye)((()=>Object.values(r).filter((e=>!!c&&(!("bots"!==c||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(c))))),[r,t,c]),R=(0,It.Z)();if(n)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(Ui,{id:"attach-menu-button",className:g?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:C,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon-attach"})),i.ZP.createElement(qt.Z,{id:"attach-menu-controls",isOpen:g||y,autoClose:!0,positionX:"right",positionY:"bottom",onClose:f,className:"AttachMenu--menu fluid",onCloseAnimationEnd:f,onMouseEnter:h.$b?void 0:v,onMouseLeave:h.$b?void 0:I,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!s&&i.ZP.createElement(St.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),s&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(St.Z,{icon:"photo",onClick:S},R("AttachmentMenu.PhotoOrVideo")),i.ZP.createElement(St.Z,{icon:"document",onClick:E},R("AttachDocument"))),o&&i.ZP.createElement(St.Z,{icon:"poll",onClick:u},R("Poll")),s&&!l&&M.map((e=>i.ZP.createElement(Hi,{bot:e,chatId:t,theme:m,onMenuOpened:P,onMenuClosed:Z})))))})),_i=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"SymbolMenu",!t);return n?i.ZP.createElement(n,e):void 0})),zi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Wi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Xi=n(67146);const Ji=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Yi=n(93219),Ki=n(19830);const Qi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),eo=(0,i.X$)((0,s.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:s}=(0,c.Bt)(e)||{};return s?{message:(0,c.hj)(e,s,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:a}=e;const{clickBotInlineButton:o}=(0,s.Sv)(),[r,c]=(0,Fi.Z)(t,a),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,pt.Z)(!0),g=(0,i.I4)((()=>{m(),a()}),[a,m]);if((0,i.d4)((()=>{u()}),[u,null==n?void 0:n.keyboardButtons]),n&&n.keyboardButtons)return i.ZP.createElement(qt.Z,{isOpen:t||d,autoClose:l,positionX:"right",positionY:"bottom",onClose:g,className:"BotKeyboardMenu",onCloseAnimationEnd:g,onMouseEnter:h.$b?void 0:r,onMouseLeave:h.$b?void 0:c,noCompact:!0},i.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Et.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>o({messageId:n.id,button:e})},e.text))))))))})));var to=n(13616),no=n(17891),so=n(63394),ao=n(66902);const io=(0,i.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,type:s}=(0,c.Bt)(e)||{};if(!t||!n||!s)return{};const{forwardMessages:{fromChatId:a,toChatId:i,messageIds:o,noAuthors:r,noCaptions:l}}=e,u=(0,c.Yy)(e,t,n),m="scheduled"===s?(0,c.wU)(e,t):(0,c._$)(e,t,n),h=e.settings.byKey.animationLevel>=1,g=i===t,p=null==o?void 0:o.map((t=>(0,c.hj)(e,a,t)));let f,v;if(u?f=(0,c.hj)(e,t,u):m?f=(0,c.kK)(e,t,n,s):g&&1===o.length&&(f=null==p?void 0:p[0]),u&&f){const{forwardInfo:n}=f,s=(0,c.FM)(e,t);n&&(n.isChannelPost||s)&&(v=(0,c.cv)(e,f)),v||null!=n&&n.hiddenUserName||(v=(0,c.Ur)(e,f))}else g&&(f&&(v=(0,c.cv)(e,f),v||(v=(0,c.Ur)(e,f))),v||(v=(0,d.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a)));const I=null==p?void 0:p.some((e=>(null==e?void 0:e.content.text)&&Object.keys(e.content).length>1));return{replyingToId:u,editingId:m,message:f,sender:v,shouldAnimate:h,forwardedMessagesCount:g?o.length:void 0,noAuthors:r,noCaptions:l,forwardsHaveCaptions:I,isCurrentUserPremium:(0,c.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:a,sender:r,shouldAnimate:c,forwardedMessagesCount:l,noAuthors:d,noCaptions:u,forwardsHaveCaptions:m,isCurrentUserPremium:h,onClear:g}=e;const{setReplyingToId:p,setEditingId:f,focusMessage:v,changeForwardRecipient:I,setForwardNoAuthors:w,setForwardNoCaptions:y,exitForwardMode:P}=(0,s.Sv)(),Z=(0,i.sO)(null),C=(0,It.Z)(),b=Boolean(l),S=Boolean((t||n)&&a||r&&l),E=(0,no.Z)([l],l?300:void 0),{shouldRender:M,transitionClassNames:R}=(0,st.Z)(E&&S,void 0,!c,void 0,!c),k=(0,i.I4)((()=>{t?p({messageId:void 0}):n?f({messageId:void 0}):l&&P(),null==g||g()}),[t,n,l,g,p,f,P]);(0,i.d4)((()=>S?(0,ht.Z)(k):void 0),[S,k]);const A=(0,i.I4)((()=>{b||v({chatId:a.chatId,messageId:a.id})}),[v,b,a]),T=(0,i.I4)((e=>{e.stopPropagation(),k()}),[k]),N=(0,i.I4)((()=>{I()}),[I]),{isContextMenuOpen:B,contextMenuPosition:x,handleContextMenu:L,handleContextMenuClose:O,handleContextMenuHide:U}=(0,Yn.Z)(Z),j=(0,i.I4)((()=>Z.current),[]),F=(0,i.I4)((()=>Z.current),[]),D=(0,i.I4)((()=>Z.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:q,positionY:$,transformOriginX:G,transformOriginY:H,style:V}=(0,so.Z)(x,j,F,D),_=(0,He.Z)("ComposerEmbeddedMessage",R),z=(0,i.Ye)((()=>t?"icon-reply":n?"icon-edit":b?"icon-forward":void 0),[n,b,t]),W=l&&l>1?C("ForwardedMessageCount",l):void 0,X=(0,i.Ye)((()=>{var e;const t=null==a||null===(e=a.content.text)||void 0===e?void 0:e.entities;if(!a||!b||null==t||!t.length||!d||h)return a;const n=t.filter((e=>e.type!==o.Vv.CustomEmoji));return{...a,content:{...a.content,text:{text:a.content.text.text,entities:n}}}}),[h,b,a,d]);if(M)return i.ZP.createElement("div",{className:_,ref:Z,onContextMenu:L,onClick:L},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"embedded-left-icon"},i.ZP.createElement("i",{className:z})),i.ZP.createElement(Ps,{className:"inside-input",message:X,sender:d?void 0:r,customText:W,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:A,hasContextMenu:b}),i.ZP.createElement(Et.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:T},i.ZP.createElement("i",{className:"icon-close"})),b&&i.ZP.createElement(qt.Z,{isOpen:B,transformOriginX:G,transformOriginY:H,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:O,onCloseAnimationEnd:U},i.ZP.createElement(St.Z,{icon:d?void 0:"message-succeeded",customIcon:d?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>w(!1)},C(l>1?"ShowSenderNames":"ShowSendersName")),i.ZP.createElement(St.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>w(!0)},C(l>1?"HideSenderNames":"HideSendersName")),m&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(ao.Z,null),i.ZP.createElement(St.Z,{icon:u?void 0:"message-succeeded",customIcon:u?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>y(!1)},C(l>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),i.ZP.createElement(St.Z,{icon:u?"message-succeeded":void 0,customIcon:u?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>y(!0)},C(l>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),i.ZP.createElement(ao.Z,null),i.ZP.createElement(St.Z,{icon:"replace",onClick:N},C("ChangeRecipient")))))}))),oo=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,rt.Z)(ot.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),ro=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),co=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),lo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),uo=new RegExp(a.FM,"i"),mo=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s}=t;const a=(0,c.tV)(e,n,s);return{theme:(0,c.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:a}}))((e=>{let{chatId:t,threadId:n,messageText:a,disabled:r,webPagePreview:c,noWebPage:l,theme:d}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,s.Sv)(),g=Ci((()=>{const{text:e,entities:t}=(0,f.Z)(a),n=null==t?void 0:t.find((e=>e.type===o.Vv.TextUrl));if(n)return n.url;const s=e.match(uo);return s?s[0]:void 0}),300,[a]);(0,i.d4)((()=>{g?u({text:g}):(m(),h({chatId:t,threadId:n}))}),[t,h,m,g,u,n]),(0,Je.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&a.length&&!l&&!r),{shouldRender:v,transitionClassNames:I}=(0,st.Z)(p),w=(0,rn.Z)(c,!0),y=(0,i.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!v||!w)return;const{photo:P,...Z}=w,C={content:{webPage:Z}};return i.ZP.createElement("div",{className:(0,He.Z)("WebPagePreview",I)},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"WebPagePreview-left-icon"},i.ZP.createElement("i",{className:"icon-link"})),i.ZP.createElement(la,{message:C,inPreview:!0,theme:d}),i.ZP.createElement(Et.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},i.ZP.createElement("i",{className:"icon-close"}))))}))),ho=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0})),go=(0,i.X$)((e=>{let{isOpen:t,onClick:n,text:s,isDisabled:a}=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,s]),(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(Et.Z,{className:(0,He.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:a,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,He.Z)("bot-menu-icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},s))}));var po;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(po||(po={}));const fo="wonderful-voice-message.ogg",vo=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s,i,r,l,u,m,h,g;let{chatId:p,threadId:f,messageListType:v}=t;const I=(0,c.Z1)(e,p),w=p!==a.FV?(0,c.IK)(e,p):void 0,y=Boolean(w),P=(0,c.FM)(e,p),Z=y&&(0,c.FT)(e,p),C=(0,c.qy)(e,p),{language:b,shouldSuggestStickers:S,shouldSuggestCustomEmoji:E}=e.settings.byKey,M=e.emojiKeywords[a.pR],R=b!==a.pR?e.emojiKeywords[b]:void 0,k=Z?Z.id:void 0,A=k?(0,c.hj)(e,p,k):void 0,{currentUserId:T}=e,N=null!=I&&I.fullInfo?(null==I||null===(n=I.fullInfo)||void 0===n?void 0:n.sendAsId)||T:void 0,B=null!=I&&I.sendAsPeerIds&&N&&I.sendAsPeerIds.some((e=>e.id===N))?N:null!=I&&null!==(s=I.adminRights)&&void 0!==s&&s.anonymous?null==I?void 0:I.id:void 0,x=B?(0,c.dy)(e,B):void 0,L=!x&&B?(0,c.Z1)(e,B):void 0,O=(0,c.QV)(e,p),U=(0,c.Bt)(e),j=p===(null==U?void 0:U.chatId)&&f===(null==U?void 0:U.threadId)&&v===(null==U?void 0:U.type),F=(0,c.dy)(e,p),q=null===(i=F&&!(null!==(r=F.fullInfo)&&void 0!==r&&r.noVoiceMessages))||void 0===i||i,$="scheduled"===v?(0,c.hI)(e,p):(0,c.s)(e,p,f);return{editingMessage:(0,c.kK)(e,p,f,v),connectionState:e.connectionState,draft:(0,c.Ms)(e,p,f),chat:I,isChatWithBot:y,isChatWithSelf:P,isForCurrentMessageList:j,canScheduleUntilOnline:(0,c.Eh)(e,p),isChannel:I?(0,d.eA)(I):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:f===o._f&&"thread"===v&&Boolean(null==C?void 0:C.length),shouldSchedule:"scheduled"===v,botKeyboardMessageId:k,botKeyboardPlaceholder:null==A?void 0:A.keyboardPlaceholder,isForwarding:p===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:null==I||null===(l=I.fullInfo)||void 0===l?void 0:l.members,topInlineBotIds:null===(u=e.topInlineBots)||void 0===u?void 0:u.userIds,currentUserId:T,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:S,shouldSuggestCustomEmoji:E,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==M?void 0:M.keywords,emojiKeywords:null==R?void 0:R.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:(null==I?void 0:I.fullInfo)&&I.fullInfo.botCommands,botCommands:null!=w&&w.fullInfo?(null===(m=w.fullInfo.botInfo)||void 0===m?void 0:m.commands)||!1:void 0,botMenuButton:null==w||null===(h=w.fullInfo)||void 0===h||null===(g=h.botInfo)||void 0===g?void 0:g.menuButton,sendAsUser:x,sendAsChat:L,sendAsId:B,editingDraft:$,requestedText:O,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,c.t)(e,p),theme:(0,c.Pu)(e),fileSizeLimit:(0,D.M)(e,"uploadMaxFileparts")*a.pJ,captionLimit:(0,D.M)(e,"captionLength"),isCurrentUserPremium:(0,c.wV)(e),canSendVoiceByPrivacy:q}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:v,messageListType:I,draft:w,chat:y,isForCurrentMessageList:P,isCurrentUserPremium:Z,canSendVoiceByPrivacy:C,connectionState:b,isChatWithBot:S,isChatWithSelf:E,isChannel:M,fileSizeLimit:k,isRightColumnShown:A,isSelectModeActive:T,isForwarding:N,pollModal:B,botKeyboardMessageId:x,botKeyboardPlaceholder:L,withScheduledButton:O,stickersForEmoji:U,customEmojiForEmoji:j,groupChatMembers:F,topInlineBotIds:D,currentUserId:q,captionLimit:$,lastSyncTime:G,contentToBeScheduled:H,shouldSuggestStickers:_,shouldSuggestCustomEmoji:z,baseEmojiKeywords:W,emojiKeywords:X,recentEmojis:J,inlineBots:Y,isInlineBotLoading:K,botCommands:Q,chatBotCommands:ee,sendAsUser:te,sendAsChat:ne,sendAsId:se,editingDraft:ae,requestedText:ie,botMenuButton:oe,attachBots:re,attachMenuPeerType:ce,theme:le}=e;const{sendMessage:de,clearDraft:ue,showDialog:me,setStickerSearchQuery:he,setGifSearchQuery:ge,forwardMessages:pe,openPollModal:fe,closePollModal:ve,loadScheduledHistory:Ie,openChat:we,addRecentEmoji:ye,sendInlineBotResult:Pe,loadSendAs:Ze,loadFullChat:Ce,resetOpenChatWithDraft:Se,callAttachBot:Ee,openLimitReachedModal:Me,openPremiumModal:Re,addRecentCustomEmoji:ke,showNotification:Ae}=(0,s.Sv)(),Te=(0,It.Z)(),Ne=(0,i.sO)(null),[Be,xe]=(0,i.eJ)(""),Le=(0,li.Y)(Be),Oe=(0,i.sO)(),Ue=(0,sn.Z)(t),{width:je}=be.Z.get(),Fe=null==y?void 0:y.sendAsPeerIds,De=Fe&&(Fe.length>1||!Fe.some((e=>e.id===q))),[qe,$e,Ge]=(0,pt.Z)(),Ve=(0,ci.Z)(g,v),_e=(0,i.I4)((e=>{xe(e),requestAnimationFrame((()=>{(0,ai.A)()}))}),[]),Ye=(0,i.sO)(0),Ke=(0,i.I4)((()=>{Ge()}),[Ge]),[Qe,et]=(0,Ti.Z)(r,Ke);(0,i.d4)((()=>{Oe.current=void 0}),[g]),(0,i.d4)((()=>{g&&G&&v===o._f&&c&&Ie({chatId:g})}),[c,g,Ie,G,v]),(0,i.d4)((()=>{g&&y&&G&&!Fe&&c&&(0,d.ZV)(y)&&Ze({chatId:g})}),[y,g,c,G,Ze,Fe]),(0,i.d4)((()=>{g&&y&&G&&!y.fullInfo&&c&&(0,d.ZV)(y)&&Ce({chatId:g})}),[y,g,c,G,Ce]);const tt=(0,i.sO)(!1);(0,Je.Z)((e=>{let[t,n]=e;tt.current=Boolean(g===t&&Fe&&!n)}),[g,Fe]),(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[nt,st]=(0,i.eJ)([]),[at,ot,rt]=(0,pt.Z)(),[ct,lt,dt]=(0,pt.Z)(),[ut,mt,gt]=(0,pt.Z)(),[ft,vt,wt]=(0,pt.Z)(),[yt,Pt,Zt]=(0,pt.Z)(),[Ct,bt]=(0,pt.Z)(),[St,Mt,Rt]=(0,pt.Z)(),kt=(0,i.I4)((e=>{const t="function"==typeof e?e(nt):e;t&&t.some((e=>e.size>k))?Me({limit:"uploadMaxFileparts"}):st(t)}),[nt,k,Me]),{startRecordingVoice:At,stopRecordingVoice:Nt,pauseRecordingVoice:Bt,activeVoiceRecording:xt,currentRecordTime:Lt,recordButtonRef:Ot,startRecordTimeRef:Ut}=(()=>{const e=(0,i.sO)(null),[t,n]=(0,i.eJ)(),s=(0,i.sO)(),[a,o]=(0,i.eJ)();(0,i.d4)((()=>{h.s$&&h.mh&&pi()}),[]);const r=(0,i.I4)((async()=>{try{const{stop:t,pause:a}=await fi((t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))}));s.current=Date.now(),o(Date.now()),n({stop:t,pause:a})}catch(e){console.error(e)}}),[]),c=(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),s.current=void 0,o(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,ht.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:s}})();(0,it.Z)((()=>{Ve({type:"recordAudio"})}),xt&&a.o_),(0,i.d4)((()=>{xt||Ve({type:"cancel"})}),[xt,Ve]),(0,i.d4)((()=>{Be&&!m&&Ve({type:"typing"})}),[m,Be,Ve]);const jt=m?po.Edit:!h.mh||xt||Be&&!nt.length||N?n?po.Schedule:po.Send:po.Record,Ft=!n,{isMentionTooltipOpen:Dt,closeMentionTooltip:qt,insertMention:$t,mentionFilteredUsers:Gt}=(0,Zi.Z)(!nt.length,Le,_e,void 0,F,D,q),{isOpen:Ht,id:Vt,isGallery:_t,switchPm:zt,results:Wt,closeTooltip:Xt,help:Jt,loadMore:Yt}=function(e,t,n,a){const{queryInlineBot:o,resetInlineBot:r}=(0,s.Sv)(),[c,l,d]=(0,pt.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=Ci((()=>function(e){const t=function(e){return Ri.innerHTML=e.replace(/<br>/g,"\n"),Ri.innerText}(e),n=t.match(Si);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Ei),usernameLowered:n[1].toLowerCase()}:Mi}(n)),300,[n])||{},p=(0,sn.Z)(m),f=(0,sn.Z)(u),v=g?null==a?void 0:a[g]:void 0,{id:I,switchPm:w,offset:y,results:P,isGallery:Z,help:C}=v||{};(0,i.d4)((()=>{p!==m&&d()}),[p,m,d]),(0,i.d4)((()=>{e&&g&&t&&o({chatId:t,username:g,query:m})}),[m,e,o,t,g]);const b=(0,i.I4)((()=>{e&&g&&t&&o({chatId:t,username:g,query:m,offset:y})}),[e,g,t,o,m,y]);return(0,i.d4)((()=>{e&&I&&(w||null!=P&&P.length)?l():d()}),[I,e,l,P,w,d]),f!==u&&r({username:f}),{isOpen:c,id:I,isGallery:Z,switchPm:w,results:P,closeTooltip:d,help:h&&C?`@${u} ${C}`:void 0,loadMore:b}}(Boolean(!nt.length&&G),g,Be,Y),{isOpen:Qt,close:en,filteredBotCommands:tn}=function(e,t,n,s){const[a,o,r]=(0,pt.Z)(),[c,l]=(0,i.eJ)(),d=(0,i.I4)((e=>{n||s?ki((()=>{const t=(n||s||[]).filter((t=>{let{command:n}=t;return!e||n.includes(e)}));l(t&&t.length?t:void 0)})):l(void 0)}),[n,s]);return(0,i.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,oi._)(t.substr(1)).match(Ai);d(e?e[0]:"")}else l(void 0);else l(void 0)}),[d,t,e,r]),(0,i.d4)((()=>{c&&c.length&&t.length>0?o():r()}),[c,t.length,o,r]),{isOpen:a,close:r,filteredBotCommands:c}}(Boolean(Q&&Q.length||ee&&ee.length),Be,Q,ee),{isContextMenuOpen:nn,handleContextMenu:an,handleContextMenuClose:on,handleContextMenuHide:rn}=(0,Yn.Z)(Ot,!(jt===po.Send&&Ft)),{canSendStickers:cn,canSendGifs:ln,canAttachMedia:dn,canAttachPolls:un,canAttachEmbedLinks:mn}=(0,i.Ye)((()=>(0,d.H5)(y,S)),[y,S]),hn=y&&(0,d.Nl)(y),gn=(0,d.Hd)(y),{isStickerTooltipOpen:pn,closeStickerTooltip:fn}=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(0,i.Ye)((()=>(0,oi._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,s.Sv)(),l=h.op&&1===(0,ii.Z)(o)||!h.op&&Boolean(t.match(ri)),d=Boolean(null==n?void 0:n.length)&&l;return(0,i.d4)((()=>{var t;a||(e&&l?r({emoji:h.op?o:null===(t=o.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!d&&l||c())}),[t,l,c,r,e,a]),{isStickerTooltipOpen:d,closeStickerTooltip:c}}(Boolean(_&&cn&&!nt.length),Be,U,!c),{isCustomEmojiTooltipOpen:vn,closeCustomEmojiTooltip:In,insertCustomEmoji:wn}=(0,Ni.Z)(Boolean(z&&!nt.length),a.Ed,Be,_e,j,!c),{isEmojiTooltipOpen:yn,closeEmojiTooltip:Pn,filteredEmojis:Zn,filteredCustomEmojis:Cn,insertEmoji:bn,insertCustomEmoji:Sn}=(0,Pi.Z)(Boolean(_&&cn&&!nt.length),Le,J,void 0,_e,W,X,!c),En=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=window.getSelection();let s;if(s=t===a.R2?document.querySelector(a.Ed):document.getElementById(t),n.rangeCount){const a=n.getRangeAt(0);if((0,ti.R)(a,t))return(0,ei.t)(e),void s.dispatchEvent(new Event("input",{bubbles:!0}))}_e(`${Le.current}${e}`),requestAnimationFrame((()=>{(0,Ja.Z)(s)}))}),[Le,_e]),Mn=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=(0,Nn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");En(n,t)}),[En]),Rn=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;En((0,fs.yR)(e),t)}),[En]),kn=(0,i.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,ti.R)(t,a.R2))return void document.execCommand("delete",!1)}_e(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const s=n.textContent.length,a=document.createRange(),i=window.getSelection();a.setStart(n,s),a.setEnd(n,s),i.removeAllRanges(),i.addRange(a),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}(Le.current))}),[Le,_e]),An=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||_e(""),st(l.D),fn(),In(),qt(),Pn(),h.wB?setTimeout((()=>gt()),350):gt()}),[fn,In,qt,Pn,gt,_e]),Tn=(0,i.sO)();Tn.current=Nt,(0,i.d4)((()=>()=>{Tn.current(),An()}),[g,An,Tn]);const[Bn,xn]=((e,t,n,o,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,s.Sv)();(0,ze.Z)((e=>{let[s]=e;if(!n)return;if((null==s?void 0:s.id)===n.id)return;const i=(0,Qs.z)(null!=h&&h.text.length?h:n.content.text);t(i),requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,Ja.Z)(e,!0)}))}),[n,t]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,f.Z)(e.current),n=t.text.length?t:void 0;p({chatId:c,threadId:l,type:u,text:n})}}),[c,n,e,p,l,u]);const v=(0,i.I4)((()=>{m&&(0,R.T2)((()=>{t((0,Qs.z)(m));const e=document.querySelector(a.Ed);e&&requestAnimationFrame((()=>{(0,Ja.Z)(e,!0)}))}))}),[m,t]),I=(0,i.I4)((()=>{o(),v()}),[o,v]),w=(0,i.I4)((()=>{const{text:t,entities:s}=(0,f.Z)(e.current);n&&(t||(0,d.u8)(n)?(g({messageId:n.id,text:t,entities:s}),o(),v()):r())}),[g,n,e,r,o,v]),y=(0,i.I4)((()=>{if(!n)return;const t=(0,f.Z)(e.current),s=t.text.length?t:void 0;p({chatId:c,threadId:l,type:u,text:s})}),[c,n,e,p,l,u]);return(0,We.Z)(y),Xe(y),[w,I]})(Le,_e,m,An,Pt,g,v,I,w,ae);((e,t,n,r,c,l,d)=>{const{saveDraft:u,clearDraft:m,loadCustomEmojis:g}=(0,s.Sv)(),p=(0,sn.Z)(e),v=(0,i.I4)(((e,t)=>{const n=r.current;void 0!==n&&!l&&d&&(n.length?u({chatId:e,threadId:t,draft:(0,f.Z)(n)}):m({chatId:e,threadId:t}))}),[m,l,r,d,u]),I=(0,i.Ye)((()=>(0,R.Ds)((e=>e()),a.r_,!1)),[t]),w=(0,sn.Z)(t),y=(0,sn.Z)(n);(0,i.d4)((()=>(wi=t,yi=n,()=>{wi=void 0,yi=void 0,v(t,n)})),[t,n,v]),(0,i.d4)((()=>{var s;if(t===w&&n===y)return void(!e&&p&&c(""));if(l||!e)return;c((0,Qs.z)(e));const i=(null===(s=e.entities)||void 0===s?void 0:s.map((e=>e.type===o.Vv.CustomEmoji&&e.documentId)).filter(Boolean))||[];i.length&&g({ids:i}),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,Ja.Z)(e,!0)}))}),[t,n,e,c,v,w,y,l,p,g]);const P=r.current,Z=(0,sn.Z)(P);(0,i.d4)((()=>{t&&n&&w===t&&y===n&&Z!==P&&(P.length?I((()=>{wi===t&&yi===n&&v(t,n)})):v(t,n))}),[t,P,w,Z,y,I,n,v]);const C=(0,i.I4)((()=>{t&&n&&v(t,n)}),[t,n,v]);(0,We.Z)(C),Xe(C)})(w,g,v,Le,_e,m,G),((e,t,n,s)=>{(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&&![a.R2,a.nY].includes(i.id))return;const o=e.clipboardData.getData("text").substring(0,4096),{items:r}=e.clipboardData;let c=[];if(e.preventDefault(),r.length>0&&(c=await(0,vi.Z)(r)),0!==c.length||o){if(c.length>0&&!s){const e=await Promise.all(c.map((e=>Qa(e.name,e,1===c.length&&Ii.includes(e.type)))));n((t=>t.concat(e)))}o&&t(o,null==i?void 0:i.id)}}}),[t,s,n,e])})(P,Mn,kt,m);const On=(0,i.I4)((()=>{m&&xn()}),[m,xn]),Un=(0,i.I4)((async(e,t)=>{kt(await Promise.all(e.map((e=>Qa(e.name,e,t)))))}),[kt]),jn=(0,i.I4)((async(e,t)=>{kt([...nt,...await Promise.all(e.map((e=>Qa(e.name,e,t))))])}),[nt,kt]),Fn=(0,i.I4)((()=>{st(l.D)}),[]),Dn=(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"!==b)return;let n=nt;if(xt){const e=await Nt();if(e){const{blob:t,duration:s,waveform:a}=e;n=[await Qa(fo,t,!1,{voice:{duration:s,waveform:a}})]}}const{text:i,entities:o}=(0,f.Z)(Le.current);if(!n.length&&!i&&!N)return;const{serverTimeOffset:r}=(0,s.Rd)(),c=n.length?$:4096;if((null==i?void 0:i.length)>c){const e=i.length-c;return void me({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const l=document.querySelector(a.Ed);if(n.length||i){if(gn&&!hn){const e=(0,p.b)(r),t=Oe.current&&Math.floor(e-Oe.current),n=gn.nextSendDate&&gn.nextSendDate>e;if(t&&t<gn.seconds||n){const s=n?gn.nextSendDate-e:gn.seconds-t;return me({data:{message:Te("SlowModeHint",(0,V.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}de({text:i,entities:o,attachments:n,scheduledAt:t,isSilent:e})}N&&pe({scheduledAt:t,isSilent:e}),Oe.current=(0,p.b)(r),ue({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&si(l),requestAnimationFrame((()=>{An()}))}),[b,nt,xt,N,ue,g,$,An,Nt,me,gn,hn,de,pe,Te,Le]),qn=(0,i.I4)((()=>{"webApp"===(null==oe?void 0:oe.type)&&Ee({botId:g,chatId:g,isFromBotMenu:!0,url:oe.url})}),[oe,Ee,g]),$n=(0,i.I4)((()=>{gt(),lt()}),[gt,lt]),Gn=(0,i.I4)((()=>{dt(),wt(),mt()}),[dt,wt,mt]),Hn=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:s,isSilent:a}=e;return void Pe({id:n,queryId:s,scheduledAt:t,isSilent:a})}const{isSilent:n,...s}=e||{};e&&0!==Object.keys(s).length?de({...e,scheduledAt:t}):Dn(Boolean(n),t)}),[Dn,Pe,de]);(0,i.d4)((()=>{H&&Qe((e=>{Hn(H,e)}))}),[H,Hn,Qe]),(0,i.d4)((()=>{ie&&(_e(ie),Se(),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Ja.Z)(e,!0)})))}),[ie,Se,_e]);const Vn=(0,i.I4)((e=>{if(!e.isFree&&!Z&&!E){const e=Ye.current;return Ae(e?{message:Te("UnlockPremiumEmojiHint2"),action:()=>we({id:q,shouldReplaceHistory:!0}),actionText:Te("Open")}:{message:Te("UnlockPremiumEmojiHint"),action:()=>Re({initialSection:"animated_emoji"}),actionText:Te("PremiumMore")}),void(Ye.current=Number(!e))}Rn(e)}),[q,Rn,E,Z,Te,we,Re,Ae]),_n=(0,i.I4)((function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||s?($e(),Qe((n=>{Ge(),Hn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{An(a)}))}))):(de({sticker:e,isSilent:t}),requestAnimationFrame((()=>{An(a)})))}),[n,$e,Qe,Ge,Hn,An,de]),zn=(0,i.I4)(((e,t,s)=>{n||s?($e(),Qe((n=>{Ge(),Hn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{An(!0)}))}))):(de({gif:e,isSilent:t}),requestAnimationFrame((()=>{An(!0)})))}),[n,$e,Qe,Ge,Hn,An,de]),Wn=(0,i.I4)(((e,t,s)=>{if("connectionStateReady"!==b)return;n||s?Qe((n=>{Hn({id:e.id,queryId:e.queryId,isSilent:t},n)})):Pe({id:e.id,queryId:e.queryId,isSilent:t});const i=document.querySelector(a.Ed);h.cj&&i&&i===document.activeElement&&si(i),ue({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{An()}))}),[g,ue,b,Hn,Qe,An,Pe,n]),Xn=(0,i.I4)((()=>{ue({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{An()}))}),[g,ue,An]),Jn=(0,i.I4)((e=>{n?(Qe((t=>{Hn({poll:e},t)})),ve()):(de({poll:e}),ve())}),[ve,Hn,Qe,de,n]),Kn=(0,i.I4)((()=>{n?Qe((e=>{Hn({isSilent:!0},e)})):Dn(!0)}),[Hn,Dn,Qe,n]),Qn=(0,i.I4)((e=>{"stickers"===e?(he({query:""}),ge({query:void 0})):(ge({query:""}),he({query:void 0}))}),[he,ge]),es=(0,i.I4)((()=>{const e=document.querySelector(a.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{dt(),mt()}),100)):mt()}),[mt,dt]),ts=(0,i.I4)((()=>{const e=document.querySelector(a.Ed);if(!h.wB||e!==document.activeElement)return dt(),gt(),void vt();null==e||e.blur(),setTimeout((()=>{dt(),gt(),vt()}),100)}),[dt,gt,vt]),ns=(0,i.I4)((()=>{we({id:g,threadId:v,type:"scheduled"})}),[we,g,v]);(0,i.d4)((()=>{A&&h.wB&&gt()}),[A,gt]),(0,i.d4)((()=>{c&&(T?Mt():setTimeout((()=>{Rt()}),200))}),[T,Rt,Mt,c]);const ss=!(jt!==po.Record||dn&&C),as=(0,i.I4)((()=>{switch(jt){case po.Send:Dn();break;case po.Record:ss?C||Ae({message:Te("VoiceMessagesRestrictedByPrivacy",null==y?void 0:y.title)}):At();break;case po.Edit:Bn();break;case po.Schedule:xt&&Bt(),Qe((e=>{Hn({},e)}))}}),[jt,Dn,Bn,xt,Qe,ss,C,Ae,Te,null==y?void 0:y.title,At,Bt,Hn]),is=(0,sn.Z)(m,!0),os=m||is,rs=new Date;rs.setSeconds(0),rs.setMilliseconds(0);const cs=new Date;cs.setFullYear(cs.getFullYear()+1);let ls="SendMessage";switch(jt){case po.Edit:ls="Save edited message";break;case po.Record:ls=dn?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const ds=(0,He.Z)("Composer",!T&&"shown",St&&"hover-disabled"),us=(0,He.Z)("mobile-symbol-menu-button",!c&&"not-ready",Ct?ut&&"menu-opened":ut&&"is-loading"),ms=(0,i.I4)((()=>{Qe((e=>{Hn({},e)}))}),[Hn,Qe]),hs=jt===po.Edit?Bn:jt===po.Schedule?ms:Dn,gs=oe&&"commands"===(null==oe?void 0:oe.type);return i.ZP.createElement("div",{className:ds},dn&&c&&i.ZP.createElement(lo,{isOpen:t!==Kt.t.None,withQuick:t===Kt.t.QuickFile||Ue===Kt.t.QuickFile,onHide:u,onFileSelect:Un}),i.ZP.createElement(oo,{chatId:g,threadId:v,canShowCustomSendMenu:Ft,attachments:nt,captionLimit:$,caption:nt.length?Be:"",groupChatMembers:F,currentUserId:q,recentEmojis:J,isReady:c,isChatWithSelf:E,onCaptionUpdate:_e,baseEmojiKeywords:W,emojiKeywords:X,shouldSchedule:n,onSendSilent:Kn,onSend:Dn,onSendScheduled:ms,onFileAppend:jn,onClear:Fn,shouldSuggestCustomEmoji:z,customEmojiForEmoji:j}),i.ZP.createElement(co,{isOpen:B.isOpen,isQuiz:B.isQuiz,shouldBeAnonymous:M,onClear:ve,onSend:Jn}),os&&i.ZP.createElement(Bi,{isOpen:yt,isSchedule:"scheduled"===I,onClose:Zt,message:os}),i.ZP.createElement(ho,{isOpen:ft,onClose:wt,chatId:g,selectedSendAsId:se,sendAsPeerIds:Fe,isCurrentUserPremium:Z}),i.ZP.createElement(Wi,{isOpen:Dt,onClose:qt,onInsertUserName:$t,filteredUsers:Gt}),i.ZP.createElement(zi,{isOpen:Ht,botId:Vt,isGallery:_t,inlineBotResults:Wt,switchPm:zt,onSelectResult:Wn,loadMore:Yt,onClose:Xt,isSavedMessages:E,canSendGifs:ln,isCurrentUserPremium:Z}),i.ZP.createElement(Qi,{isOpen:Qt,withUsername:Boolean(ee),botCommands:tn,onClick:Xn,onClose:en}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:Ne}),i.ZP.createElement(io,{onClear:On}),i.ZP.createElement(mo,{chatId:g,threadId:v,messageText:nt.length?"":Be,disabled:!mn}),i.ZP.createElement("div",{className:"message-input-wrapper"},S&&oe&&"webApp"===oe.type&&!m&&i.ZP.createElement(go,{isOpen:!Be&&!xt,onClick:qn,text:oe.text,isDisabled:Boolean(xt)}),S&&gs&&!1!==Q&&!xt&&!m&&i.ZP.createElement(Ui,{className:(0,He.Z)("bot-commands",ct&&"activated"),round:!0,disabled:void 0===Q,color:"translucent",onActivate:$n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),De&&(te||ne)&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",onClick:ft?wt:ts,ariaLabel:Te("SendMessageAsTitle"),className:(0,He.Z)("send-as-button",tt.current&&"appear-animation")},i.ZP.createElement(Ln.Z,{user:te,chat:ne,size:"tiny"})),h.wB?i.ZP.createElement(Et.Z,{className:us,round:!0,color:"translucent",onClick:ut?gt:es,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"}),i.ZP.createElement("i",{className:"icon-keyboard"}),ut&&!Ct&&i.ZP.createElement(Tt.Z,{color:"gray"})):i.ZP.createElement(Ui,{className:ut?"activated":"",round:!0,color:"translucent",onActivate:Gn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"})),i.ZP.createElement(to.Z,{id:"message-input-text",chatId:g,threadId:v,html:nt.length?"":Be,placeholder:xt&&je<=600?"":L||Te("Message"),forcedPlaceholder:Jt,canAutoFocus:c&&!nt.length,shouldSuppressFocus:h.wB&&ut,shouldSuppressTextFormatter:yn||Dt||Ht,onUpdate:_e,onSend:hs,onSuppressedFocus:gt}),K&&Boolean(Vt)&&i.ZP.createElement(Tt.Z,{color:"gray"}),O&&i.ZP.createElement(Et.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:ns,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),x&&!xt&&!m&&i.ZP.createElement(Ui,{className:at?"activated":"",round:!0,color:"translucent",onActivate:ot,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),xt&&Lt&&i.ZP.createElement("span",{className:"recording-state"},(0,V.rM)(Lt-Ut.current)),i.ZP.createElement(Vi,{chatId:g,isButtonVisible:!xt&&!m,canAttachMedia:dn,canAttachPolls:un,onFileSelect:Un,onPollCreate:fe,isScheduled:n,attachBots:re,peerType:ce,theme:le}),x&&i.ZP.createElement(eo,{messageId:x,isOpen:at,onClose:rt}),Q&&i.ZP.createElement(ro,{isOpen:ct,botCommands:Q,onClose:dt}),i.ZP.createElement(Ji,{chatId:g,threadId:v,isOpen:pn,onStickerSelect:_n}),i.ZP.createElement(Yi.Z,{chatId:g,isOpen:vn,onCustomEmojiSelect:wn,addRecentCustomEmoji:ke}),i.ZP.createElement(Ki.Z,{isOpen:yn,emojis:Zn,customEmojis:Cn,onClose:Pn,onEmojiSelect:bn,addRecentEmoji:ye,onCustomEmojiSelect:Sn,addRecentCustomEmoji:ke}),i.ZP.createElement(_i,{chatId:g,threadId:v,isOpen:ut||qe,canSendGifs:ln,canSendStickers:cn,onLoad:bt,onClose:gt,onEmojiSelect:Mn,onStickerSelect:_n,onCustomEmojiSelect:Vn,onGifSelect:zn,onRemoveSymbol:kn,onSearchOpen:Qn,addRecentEmoji:ye,addRecentCustomEmoji:ke}))),xt&&i.ZP.createElement(Et.Z,{round:!0,color:"danger",className:"cancel",onClick:Nt,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(Et.Z,{ref:Ot,round:!0,color:"secondary",className:(0,He.Z)(jt,!c&&"not-ready",xt&&"recording"),disabled:ss,allowDisabledClick:!0,ariaLabel:Te(ls),onClick:as,onContextMenu:jt===po.Send&&Ft?an: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"})),Ft&&i.ZP.createElement(Xi.Z,{isOpen:nn,onSendSilent:E?void 0:Kn,onSendSchedule:n?void 0:ms,onClose:on,onCloseAnimationEnd:rn,isSavedMessages:E}),et)}))),Io=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,rt.Z)(ot.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),wo=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,rt.Z)(ot.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),yo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),Po=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),Zo=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,rt.Z)(ot.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),Co=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),bo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0})),So=h.wB?450+a.fK:void 0;function Eo(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const Mo=(0,i.X$)((0,s.c$)((e=>{var t;const n=(0,c.Pu)(e),{isBlurred:s,background:a,backgroundColor:i,patternColor:r}=e.settings.themes[n]||{},{messageLists:l}=e.messages,u=(0,c.Bt)(e),{isLeftColumnShown:m,chats:{listIds:g},activeEmojiInteractions:p,lastSyncTime:f}=e,v={theme:n,customBackground:a,backgroundColor:i,patternColor:r,isLeftColumnShown:m,isRightColumnShown:(0,c.Jf)(e),isBackgroundBlurred:s,isMobileSearchActive:Boolean(h.wB&&(0,c.n5)(e)),isSelectModeActive:(0,c.CA)(e),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),isGiftPremiumModalOpen:null===(t=e.giftPremiumModal)||void 0===t?void 0:t.isOpen,animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,l.length-1),activeEmojiInteractions:p,lastSyncTime:f};if(!u||!g.active)return v;const{chatId:I,threadId:w,type:y}=u,P=(0,d.YC)(I),Z=(0,c.Z1)(e,I),C=(0,c.IK)(e,I),b=(0,c.KB)(e,I),{chatId:S,messageId:E}=e.audioPlayer,M=Z&&(0,d.Qm)(Z,w),R=(0,c.pk)(e,I),k="pinned"===y,A="scheduled"===y,T="thread"===y&&w===o._f,N=Boolean(Z&&(0,d.eA)(Z)),B=Boolean(Z&&T&&(N||(0,d.ZV)(Z))&&Z.isNotJoined&&!Z.joinRequests),x=Boolean((null==Z?void 0:Z.isNotJoined)&&Z.isJoinToSend),L=Boolean((null==Z?void 0:Z.isNotJoined)&&Z.isJoinRequest),O=Boolean(C&&(0,c.s4)(e,C.id)),U=!O&&R;return{...v,chatId:I,threadId:w,messageListType:y,isPrivate:P,areChatSettingsLoaded:Boolean(null==Z?void 0:Z.settings),canPost:!k&&(!Z||M)&&!R&&!(x&&null!=Z&&Z.isNotJoined),isPinnedMessageList:k,isScheduledMessageList:A,currentUserBannedRights:null==Z?void 0:Z.currentUserBannedRights,defaultBannedRights:null==Z?void 0:Z.defaultBannedRights,hasPinnedOrAudioPlayer:w!==o._f||Boolean(!k&&(null==b?void 0:b.length))||Boolean(S&&E),pinnedMessagesCount:b?b.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:N,canSubscribe:B,canStartBot:U,canRestartBot:O,shouldJoinToSend:x,shouldSendJoinRequest:L}}))((e=>{let{chatId:t,threadId:n,messageListType:o,isPrivate:r,isPinnedMessageList:c,canPost:l,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:p,customBackground:f,theme:v,backgroundColor:I,patternColor:w,isLeftColumnShown:y,isRightColumnShown:P,isBackgroundBlurred:Z,isMobileSearchActive:C,isSelectModeActive:b,isSeenByModalOpen:S,isReactorListModalOpen:E,isGiftPremiumModalOpen:M,animationLevel:R,shouldSkipHistoryAnimations:k,currentTransitionKey:A,isChannel:T,areChatSettingsLoaded:N,canSubscribe:B,canStartBot:x,canRestartBot:L,activeEmojiInteractions:O,shouldJoinToSend:U,shouldSendJoinRequest:j,lastSyncTime:F}=e;const{openChat:D,openPreviousChat:q,unpinAllMessages:$,loadUser:G,loadChatSettings:H,closeLocalTextSearch:V,exitMessageSelectMode:_,joinChannel:z,sendBotCommand:W,restartBot:X,showNotification:J}=(0,s.Sv)(),{width:Y}=(0,tn.Z)(),K=(0,It.Z)(),[Q,ee]=(0,i.eJ)(Kt.t.None),[te,ne]=(0,i.eJ)(),[se,ae]=(0,i.eJ)(),[ie,oe]=(0,i.eJ)(!1),re=g&&(Y<a.l3||P&&Y>a._m&&Y<a.QU||Y>=a.ks&&Y<a.jT),ce=(0,nn.Z)(t,So),le=(0,nn.Z)(n,So),de=(0,nn.Z)(o,So),ue=(0,nn.Z)(B,So),me=(0,nn.Z)(x,So),he=(0,nn.Z)(L,So),ge=(0,nn.Z)(l,So)&&!he&&!me&&!ue,pe=(0,nn.Z)(re,So),fe=(0,nn.Z)(te,So),ve=(0,nn.Z)(T,So),be=(0,nn.Z)(U,So),Se=(0,nn.Z)(j,So),Ee=(0,sn.Z)(A),Me=void 0!==Ee&&Ee<A?Ee:void 0,{isReady:Re,handleOpenEnd:ke,handleSlideStop:Ae}=function(e,t,n,s){const[a,o]=(0,i.eJ)(!h.wB),r=(0,tt.Z)(),c=void 0!==n&&n!==t;return c&&(e?o(!1):r()),(0,Je.Z)((()=>{e||o(!0)}),[e]),{isReady:a&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&o(Boolean(s))}:void 0,handleSlideStop:e?function(){o(!0)}:void 0}}(!k&&R!==a.oB,A,Ee,t);(0,i.d4)((()=>t?(0,ht.Z)((()=>{D({id:void 0})})):void 0),[t,D]),(0,Je.Z)((()=>{ee(Kt.t.None),ne(void 0),ae(void 0)}),[t]),(0,i.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{window.visualViewport.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)((()=>{r&&G({userId:t})}),[t,r,G]),(0,i.d4)((()=>{!N&&F&&H({chatId:t})}),[t,r,N,F,H]);const Te=(0,i.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Eo);ee(n?Kt.t.QuickFile:Kt.t.Document)}),[]),Ne=(0,i.I4)((()=>{ee(Kt.t.None)}),[]),Be=(0,i.I4)((()=>{oe(!0)}),[]),xe=(0,i.I4)((()=>{oe(!1)}),[]),Le=(0,i.I4)((()=>{$({chatId:t}),xe(),q()}),[$,t,xe,q]),Oe=(0,i.I4)((()=>{D({id:t})}),[D,t]),Ue=(0,i.I4)((()=>{z({chatId:t}),Se&&J({message:K(T?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[z,t,Se,J,T,K]),je=(0,i.I4)((()=>{W({command:"/start"})}),[W]),Fe=(0,i.I4)((()=>{X({chatId:t})}),[t,X]),De=((e,t)=>{const[n,s]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?s(t):Qt.fetch(a.fo,e,Qt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,en.pt)(t).then((()=>{s(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(v,f),qe=(0,He.Z)(pe&&"has-header-tools",h.aZ?"mask-image-disabled":"mask-image-enabled"),$e=(0,He.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",f&&"Ik9ZZlj3eKtKXRrUZKVk",I&&"avVozLQe3SaWcSkIt6pG",f&&Z&&"Tipa66fYcSvl6w0587Xz",P&&"vhOr8s3T_LCKSt2BF7fs"),Ge=(0,He.Z)("messaging-disabled",!b&&"shown"),Ve=(0,d.q8)(K,u,m),{composerHiddenScale:_e,toolbarHiddenScale:ze,composerTranslateX:We,toolbarTranslateX:Xe,unpinHiddenScale:Ye,toolbarForUnpinHiddenScale:Ke}=(0,i.Ye)((()=>function(e,t){const n=e<=a.l3?Ie.Gw:2*Ie.Gw,s=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,Ze),Pe),n=Math.min(.25*e,Pe);return Math.min(e-t-n,ye)}if(e>a.ks){const t=Math.min(Math.max(.4*e,Ze),Pe);return Math.min(e-t,ye)}return e>ye?ye:e}(e),i=e<=a.l3?3.375*Ie.Gw:4*Ie.Gw,o=t?s-n-i:s-n,r=e>a.l3?Math.min(s-n,we):s-n,c=r/o,l=o/r;return{composerHiddenScale:c,toolbarHiddenScale:l,composerTranslateX:t?i/2*l:0,toolbarTranslateX:t?i/2*-1*c:0,unpinHiddenScale:r/Ce,toolbarForUnpinHiddenScale:Ce/r}}(Y,ge)),[ge,Y]),Qe=(0,He.Z)("middle-column-footer",!ge&&"no-composer",ge&&se&&!b&&"with-notch");(0,nt.Z)({isActive:b,onBack:_}),(0,nt.Z)({isActive:C,onBack:V});const et=Boolean(!c&&!ge&&!he&&!me&&!ue&&Ve),st=Boolean(he||ue||me||c),at=Boolean(et||b||c);return i.ZP.createElement("div",{id:"MiddleColumn",className:qe,onTransitionEnd:ke,style:`\n --composer-hidden-scale: ${_e};\n --toolbar-hidden-scale: ${ze};\n --unpin-hidden-scale: ${Ye};\n --toolbar-unpin-hidden-scale: ${Ke};\n --composer-translate-x: ${We}px;\n --toolbar-translate-x: ${Xe}px;\n --pattern-color: ${w};\n --theme-background-color:\n ${I||("dark"===v?a.It:a.p3)};\n `,onClick:h.p7&&y?Oe:void 0},i.ZP.createElement("div",{className:$e,style:De?`--custom-background: ${De}`:void 0}),i.ZP.createElement("div",{id:"middle-column-portals"}),ce&&le&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"messages-layout",onDragEnter:ge?Te:void 0},i.ZP.createElement(Fn,{chatId:ce,threadId:le,messageListType:de,isReady:Re}),i.ZP.createElement(vt.Z,{name:k?"none":R===a.zy?"slide":"fade",activeKey:A,shouldCleanup:!0,cleanupExceptionKey:Me,onStop:Ae},i.ZP.createElement(za,{key:`${ce}-${le}-${de}`,chatId:ce,threadId:le,type:de,canPost:ge,hasTools:pe,onFabToggle:ne,onNotchToggle:ae,isReady:Re,withBottomShift:st,withDefaultBg:Boolean(!f&&!I)}),i.ZP.createElement("div",{className:Qe},ge&&i.ZP.createElement(vo,{chatId:ce,threadId:le,messageListType:de,dropAreaState:Q,onDropHide:Ne,isReady:Re}),c&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Be},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,K("Chat.Pinned.UnpinAll",p,"i")))),et&&i.ZP.createElement("div",{className:Ge},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,Ve))),h.wB&&(ue||be&&!Se)&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ue},K(ve?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&Se&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ue},K("ChannelJoinRequest"))),h.wB&&me&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:je},K("BotStart"))),h.wB&&he&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(Et.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Fe},K("BotRestart"))),i.ZP.createElement(wo,{messageListType:de,isActive:b,canPost:ge}),i.ZP.createElement(Po,{isOpen:S}),i.ZP.createElement(Co,{isOpen:E}))),i.ZP.createElement(Xa,{isShown:fe,canPost:ge,withExtraShift:at})),h.wB&&i.ZP.createElement(Io,{isActive:Boolean(C)})),t&&i.ZP.createElement(yo,{isOpen:ie,chatId:t,pinnedMessagesCount:p,onClose:xe,onUnpin:Le}),i.ZP.createElement("div",{teactFastList:!0},null==O?void 0:O.map(((e,t)=>i.ZP.createElement(Zo,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(bo,{isOpen:M}))}))),Ro=450+a.fK,ko=(0,R.Ds)((e=>e()),200,!1);var Ao;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Statistics=4]="Statistics",e[e.MessageStatistics=5]="MessageStatistics",e[e.Management=6]="Management",e[e.ManageInitial=7]="ManageInitial",e[e.ManageChannelSubscribers=8]="ManageChannelSubscribers",e[e.ManageChatAdministrators=9]="ManageChatAdministrators",e[e.ManageChatPrivacyType=10]="ManageChatPrivacyType",e[e.ManageDiscussion=11]="ManageDiscussion",e[e.ManageGroupPermissions=12]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=13]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=14]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=15]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=16]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=17]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=18]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=19]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=20]="ManageGroupMembers",e[e.ManageGroupAddAdmins=21]="ManageGroupAddAdmins",e[e.StickerSearch=22]="StickerSearch",e[e.GifSearch=23]="GifSearch",e[e.PollResults=24]="PollResults",e[e.AddingMembers=25]="AddingMembers",e[e.ManageInvites=26]="ManageInvites",e[e.ManageEditInvite=27]="ManageEditInvite",e[e.ManageReactions=28]="ManageReactions",e[e.ManageInviteInfo=29]="ManageInviteInfo",e[e.ManageJoinRequests=30]="ManageJoinRequests"}(Ao||(Ao={}));const To=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s,a,i;let{chatId:o,isProfile:r,isManagement:l}=t;const{query:u}=(0,c.n5)(e)||{},{query:m}=(0,c.y5)(e)||{},{query:h}=(0,c.yN)(e)||{},g=o?(0,c.Z1)(e,o):void 0,p=g&&(0,d.eA)(g),f=r&&o&&(0,d.YC)(o)?(0,c.dy)(e,o):void 0,v=f&&(0,d.kw)(f),I=Boolean(!l&&r&&!v&&g&&!(0,c.FM)(e,g.id)&&((0,d.YC)(g.id)||((0,d.Nl)(g)||g.isCreator)&&!g.isNotJoined)),w=Boolean(o&&(null===(n=e.management.byChatId[o])||void 0===n?void 0:n.editingInvite)),y=null==g||null===(s=g.fullInfo)||void 0===s?void 0:s.canViewStatistics,P=o?null===(a=e.management.byChatId[o])||void 0===a||null===(i=a.inviteInfo)||void 0===i?void 0:i.invite:void 0;return{canManage:I,canAddContact:v,canViewStatistics:y,isChannel:p,userId:null==f?void 0:f.id,messageSearchQuery:u,stickerSearchQuery:m,gifSearchQuery:h,isEditingInvite:w,currentInviteInfo:P,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,isColumnOpen:a,isProfile:o,isSearch:r,isManagement:c,isStatistics:l,isMessageStatistics:d,isStickerSearch:u,isGifSearch:g,isPollResults:p,isAddingChatMembers:f,profileState:v,managementScreen:I,canAddContact:w,userId:y,canManage:P,isChannel:Z,onClose:C,onScreenSelect:b,messageSearchQuery:S,stickerSearchQuery:E,gifSearchQuery:M,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:A,shouldSkipHistoryAnimations:T}=e;const{setLocalTextSearchQuery:N,setStickerSearchQuery:B,setGifSearchQuery:x,searchTextMessagesLocal:L,toggleManagement:O,openHistoryCalendar:U,openAddContactDialog:j,toggleStatistics:F,setEditingExportedInvite:D,deleteExportedChatInvite:q}=(0,s.Sv)(),[$,G,H]=(0,pt.Z)(),_=(0,i.I4)((()=>{D({chatId:n,invite:A}),b(m.u1.EditInvite)}),[n,A,b,D]),z=(0,i.I4)((()=>{q({chatId:n,link:A.link}),b(m.u1.Invites),H()}),[n,H,A,q,b]),W=(0,i.I4)((e=>{N({query:e}),e.length&&ko(L)}),[L,N]),X=(0,i.I4)((e=>{B({query:e})}),[B]),J=(0,i.I4)((e=>{x({query:e})}),[x]),Y=(0,i.I4)((()=>{j({userId:y})}),[j,y]),[K,Q]=(0,i.eJ)(!a);(0,i.d4)((()=>{setTimeout((()=>{Q(!a)}),Ro)}),[a]);const ee=(0,It.Z)(),te=o?v===m.vi.Profile?Ao.Profile:v===m.vi.SharedMedia?Ao.SharedMedia:v===m.vi.MemberList?Ao.MemberList:-1:r?Ao.Search:p?Ao.PollResults:u?Ao.StickerSearch:g?Ao.GifSearch:f?Ao.AddingMembers:c?I===m.u1.Initial?Ao.ManageInitial:I===m.u1.ChatPrivacyType?Ao.ManageChatPrivacyType:I===m.u1.Discussion?Ao.ManageDiscussion:I===m.u1.ChannelSubscribers?Ao.ManageChannelSubscribers:I===m.u1.GroupPermissions?Ao.ManageGroupPermissions:I===m.u1.ChatAdministrators?Ao.ManageChatAdministrators:I===m.u1.GroupRemovedUsers?Ao.ManageGroupRemovedUsers:I===m.u1.ChannelRemovedUsers?Ao.ManageChannelRemovedUsers:I===m.u1.GroupUserPermissionsCreate?Ao.ManageGroupUserPermissionsCreate:I===m.u1.GroupUserPermissions?Ao.ManageGroupUserPermissions:I===m.u1.GroupRecentActions?Ao.ManageGroupRecentActions:I===m.u1.ChatAdminRights?Ao.ManageGroupAdminRights:I===m.u1.ChatNewAdminRights?Ao.ManageGroupNewAdminRights:I===m.u1.GroupMembers?Ao.ManageGroupMembers:I===m.u1.Invites?Ao.ManageInvites:I===m.u1.EditInvite?Ao.ManageEditInvite:I===m.u1.GroupAddAdmins?Ao.ManageGroupAddAdmins:I===m.u1.Reactions?Ao.ManageReactions:I===m.u1.InviteInfo?Ao.ManageInviteInfo:I===m.u1.JoinRequests?Ao.ManageJoinRequests:void 0:l?Ao.Statistics:d?Ao.MessageStatistics:void 0,ne=null!==(t=(0,rn.Z)(te,!0))&&void 0!==t?t:-1,se=h.wB||te===Ao.SharedMedia||te===Ao.MemberList||te===Ao.AddingMembers||te===Ao.MessageStatistics||c,ae=(0,He.Z)("animated-close-icon",se&&"state-back",(K||T)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(Et.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:C,ariaLabel:ee(se?"Common.Back":"Common.Close")},i.ZP.createElement("div",{className:ae})),i.ZP.createElement(vt.Z,{name:K||T?"none":"slide-fade",activeKey:ne},function(){if(-1!==ne)switch(ne){case Ao.PollResults:return i.ZP.createElement("h3",null,ee("PollResults"));case Ao.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Mt.Z,{parentContainerClassName:"RightSearch",value:S,onChange:W}),i.ZP.createElement(Et.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>U({selectedAt:(0,V._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon-calendar"})));case Ao.AddingMembers:return i.ZP.createElement("h3",null,ee(Z?"ChannelAddSubscribers":"GroupAddMembers"));case Ao.ManageInitial:return i.ZP.createElement("h3",null,ee("Edit"));case Ao.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ee(Z?"ChannelTypeHeader":"GroupTypeHeader"));case Ao.ManageDiscussion:return i.ZP.createElement("h3",null,ee("Discussion"));case Ao.ManageChatAdministrators:return i.ZP.createElement("h3",null,ee("ChannelAdministrators"));case Ao.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ee("Group.Info.AdminLog"));case Ao.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ee("EditAdminRights"));case Ao.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ee("SetAsAdmin"));case Ao.ManageGroupPermissions:return i.ZP.createElement("h3",null,ee("ChannelPermissions"));case Ao.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ee("BlockedUsers"));case Ao.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ee("ChannelBlockedUsers"));case Ao.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ee("ChannelAddException"));case Ao.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ee("UserRestrictions"));case Ao.ManageInvites:return i.ZP.createElement("h3",null,ee("lng_group_invite_title"));case Ao.ManageEditInvite:return i.ZP.createElement("h3",null,ee(R?"EditLink":"NewLink"));case Ao.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ee("InviteLink")),i.ZP.createElement("section",{className:"tools"},A&&!A.isRevoked&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:_},i.ZP.createElement("i",{className:"icon-edit"})),A&&A.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Et.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ee("Delete"),onClick:G},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(fn.Z,{isOpen:$,onClose:H,title:ee("DeleteLink"),text:ee("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ee("Delete"),confirmHandler:z}))));case Ao.ManageJoinRequests:return i.ZP.createElement("h3",null,ee(Z?"SubscribeRequests":"MemberRequests"));case Ao.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ee("Channel.Management.AddModerator"));case Ao.StickerSearch:return i.ZP.createElement(Mt.Z,{value:E,placeholder:ee("SearchStickersHint"),autoFocusSearch:!0,onChange:X});case Ao.GifSearch:return i.ZP.createElement(Mt.Z,{value:M,placeholder:ee("SearchGifsTitle"),autoFocusSearch:!0,onChange:J});case Ao.Statistics:return i.ZP.createElement("h3",null,ee(Z?"ChannelStats.Title":"GroupStats.Title"));case Ao.MessageStatistics:return i.ZP.createElement("h3",null,ee("Stats.MessageTitle"));case Ao.SharedMedia:return i.ZP.createElement("h3",null,ee("SharedMedia"));case Ao.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ee("ChannelSubscribers"));case Ao.MemberList:case Ao.ManageGroupMembers:return i.ZP.createElement("h3",null,ee("GroupMembers"));case Ao.ManageReactions:return i.ZP.createElement("h3",null,ee("Reactions"));default:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,"Profile"),i.ZP.createElement("section",{className:"tools"},w&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("AddContact"),onClick:Y},i.ZP.createElement("i",{className:"icon-add-user"})),P&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:O},i.ZP.createElement("i",{className:"icon-edit"})),k&&i.ZP.createElement(Et.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Statistics"),onClick:F},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var No=n(91),Bo=n(3474),xo=n(27407);function Lo(e,t,n,s){const[i,o]=(0,xo.Z)(n?t:void 0,s,void 0,a.Vk);return[i,o,!(!i||!s||i[0]===s[0])]}function Oo(e,t,n,s,o,r){const c=(0,i.sO)();(0,Je.Z)((()=>{t===e&&o&&r&&(c.current=(0,d.R5)(o,r,e))}),[o,r,t,e]);const[l,u]=(0,xo.Z)(s?n:void 0,c.current,void 0,"media"===e?a.EN:a.pn);return[l,u,!(!l||!c.current||l[0]===c.current[0])]}const Uo=(0,R.P2)((e=>e()),250,!1);let jo=!1;var Fo=n(21273),Do=n(31876),qo=n(20787),$o=n(70180),Go=n(13709),Ho=n(45418),Vo=n(47262),_o=n(41151),zo=n(22275);const Wo=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function Xo(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Jo=(0,i.X$)((0,s.c$)(((e,t)=>{var n,s;let{chatId:a}=t;const i=(0,c.Z1)(e,a),o=(0,c.Zw)(e,a),{currentType:r,resultsByType:l}=(0,c.we)(e)||{},{foundIds:u}=l&&r&&l[r]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,p=i&&(0,d.Bf)(i),f=i&&(0,d.eA)(i),v=p||f&&(0,d.Nl)(i),I=null==i||null===(n=i.fullInfo)||void 0===n?void 0:n.members,w=v&&i&&(i.isForbidden||i.fullInfo&&!i.fullInfo.canViewMembers),y=v&&i&&((0,d.VE)(i,"inviteUsers")||!(0,d.Mg)(i,"inviteUsers")||i.isCreator),P=v&&i&&((0,d.VE)(i,"banUsers")||i.isCreator),Z=(0,c.xs)(e,a);let C,b,S;return(0,d.YC)(a)&&(b=a,S=(0,c.dy)(e,b),C=S&&!S.isSelf&&!(0,d.cS)(S)),{theme:(0,c.Pu)(e),isChannel:f,resolvedUserId:b,chatMessages:o,foundIds:u,mediaSearchType:r,hasCommonChatsTab:C,hasMembersTab:v,areMembersHidden:w,canAddMembers:y,canDeleteMembers:P,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:null==i?void 0:i.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:Z,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==i?void 0:i.isProtected,...v&&I&&{members:I},...C&&S&&{commonChatIds:null===(s=S.commonChats)||void 0===s?void 0:s.ids}}}))((e=>{let{chatId:t,profileState:n,onProfileStateChange:r,theme:c,isChannel:l,resolvedUserId:u,currentUserId:g,chatMessages:p,foundIds:f,mediaSearchType:v,hasCommonChatsTab:I,hasMembersTab:w,areMembersHidden:y,canAddMembers:P,canDeleteMembers:Z,commonChatIds:C,members:b,usersById:S,userStatusesById:E,chatsById:M,isRightColumnShown:R,isRestricted:k,lastSyncTime:A,activeDownloadIds:T,serverTimeOffset:N,isChatProtected:B}=e;const{setLocalMediaSearchType:x,loadMoreMembers:L,loadCommonChats:O,openChat:U,searchMediaMessagesLocal:j,openMediaViewer:F,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:$,setNewChatMembersDialogState:G}=(0,s.Sv)(),H=(0,i.sO)(null),V=(0,i.sO)(null),_=(0,It.Z)(),[z,W]=(0,i.eJ)(0),[X,J]=(0,i.eJ)(),Y=(0,i.Ye)((()=>[...w?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...Wo,...I?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[I,w,l]),K=Y[z].type,[Q,ee,te,ne]=function(e,t,n,s,a,o,r,c,l,u,m,h,g,p,f){let v=arguments.length>15&&void 0!==arguments[15]?arguments[15]:0;const I="members"!==a&&o?o:a,w=(0,i.Ye)((()=>{if(r&&l&&u)return(0,d.Z0)(r.map((e=>{let{userId:t}=e;return t})),l,u,void 0,v)}),[r,v,l,u]),y=(0,i.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[P,Z,C]=Lo(0,t,f,w),[b,S,E]=Oo("media",I,s,f,h,g),[M,R,k]=Oo("documents",I,s,f,h,g),[A,T,N]=Oo("links",I,s,f,h,g),[B,x,L]=Oo("audio",I,s,f,h,g),[O,U,j]=Oo("voice",I,s,f,h,g),[F,D,q]=Lo(0,n,f,y);let $,G,H=!1;switch(I){case"members":$=P,G=Z,H=C;break;case"commonChats":$=F,G=D,H=q;break;case"media":$=b,G=S,H=E;break;case"documents":$=M,G=R,H=k;break;case"links":$=A,G=T,H=N;break;case"audio":$=B,G=x,H=L;break;case"voice":$=O,G=U,H=j}return[I,$,G,H]}(R,L,O,j,K,v,b,C,S,E,M,p,f,t,A,N),se=Y.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:ae}=function(e,t,n,s){(0,ze.Z)((n=>{let[a]=n;if(a&&a!==t){const n=e.current,a=n.querySelector(".TabList");n.scrollTop<a.offsetTop&&(s("members"===t?m.vi.MemberList:m.vi.SharedMedia),jo=!0,(0,Hn.Z)(n,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{jo=!1}),350))}}),[t,s]),(0,ze.Z)((t=>{let[a]=t;if(n!==m.vi.Profile||n===a)return;const i=e.current;if(!i)return;const o=i.querySelector(".TabList");!o||o.offsetTop>i.scrollTop||(jo=!0,(0,Hn.Z)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{jo=!1}),350),s(n))}),[n]);const a=(0,i.I4)((()=>{const n=e.current;if(!n)return;const a=n.querySelector(".TabList");if(!a)return;let i=m.vi.Profile;n.scrollTop>=a.offsetTop&&(i="members"===t?m.vi.MemberList:m.vi.SharedMedia),s(i)}),[e,s,t]);return(0,i.d4)((()=>{jo||a()}),[a,t]),{handleScroll:(0,i.I4)((()=>{jo||Uo(a)}),[a])}}(H,K,n,r),{applyTransitionFix:ie,releaseTransitionFix:oe}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,i.d4)((()=>{function n(){const n=e.current,s=n.querySelector(t),a=n.querySelector(".TabList");s&&a&&(s.style.minHeight=n.offsetHeight-a.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,i.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=`${e}px`}}),[e]),s=(0,i.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e]);return{applyTransitionFix:n,releaseTransitionFix:s}}(H),[re,ce]=(0,Bo.Z)(),{observe:le}=(0,Wn.S1)({rootRef:H,throttleMs:500}),de=(0,i.I4)((()=>{oe(),ce()}),[oe,ce]),ue=(0,i.I4)((()=>{G(m.WB.InProgress)}),[G]);(0,i.d4)((()=>{x({mediaType:K})}),[x,K]);const me=u||t;(0,i.d4)((()=>{A&&$({profileId:me})}),[$,me,A]);const he=(0,i.I4)((e=>{F({chatId:me,threadId:o._f,mediaId:e,origin:m.bZ.SharedMedia})}),[me,F]),ge=(0,i.I4)((e=>{D({chatId:me,messageId:e})}),[me,D]),pe=(0,i.I4)((e=>{U({id:e})}),[U]),fe=(0,i.I4)((e=>{q({chatId:me,messageId:e})}),[me,q]),ve=(0,i.I4)((()=>{J(void 0)}),[]);let Ie;(0,i.d4)((()=>{if(V.current&&h.$b)return(0,xt.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===xt.eM.Left?(W(Math.min(z+1,Y.length-1)),!0):t===xt.eM.Right&&(W(Math.max(0,z-1)),!0)})}),[z,Y.length]);const we="members"===Q||!w&&"media"===Q;we?Ie=R?0:1e3:ee||(Ie=a.Y);const ye=(0,no.Z)([t,Q],Ie);return i.ZP.createElement(Fo.Z,{ref:H,className:"Profile custom-scroll",itemSelector:Xo(Q),items:ye?ee:void 0,cacheBuster:re,sensitiveArea:a.qU,preloadBackwards:ye?"members"===Q?a.Vk:a.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:te,onScroll:ae},!ne&&function(e,t,n){return i.ZP.createElement("div",{className:"profile-info"},i.ZP.createElement(qo.Z,{userId:t||e,canPlayVideo:n}),i.ZP.createElement($o.Z,{chatOrUserId:t||e}))}(t,u,R&&ye),!k&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(vt.Z,{ref:V,name:_.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:se,renderCount:Y.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ie,onStop:de},function(){if(!ee||!ye||!p){const e=we&&!ye,t=Boolean("members"===Q&&y);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(Tt.Z,null),t&&i.ZP.createElement(Vo.Z,{text:"You have no access to group members list."}))}if(!ee.length){let e;switch(Q){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=_("NoGroupsInCommon");break;case"documents":e=_("lng_media_file_empty");break;case"links":e=_("lng_media_link_empty");break;case"audio":e=_("lng_media_song_empty");break;case"voice":e=_("lng_media_audio_empty");break;default:e=_("SharedMedia.EmptyTitle")}return i.ZP.createElement("div",{className:"content empty-list"},i.ZP.createElement(Vo.Z,{text:e}))}return i.ZP.createElement("div",{className:`content ${Q}-list`,dir:_.isRtl&&"media"===Q?"rtl":void 0,teactFastList:!0},"media"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Go.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Zs.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:T.includes(e),observeIntersection:le,onDateClick:fe}))):"links"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Ho.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onMessageClick:fe}))):"audio"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Cs.ZP,{key:e,theme:c,message:p[e],origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:A,className:"scroll-item",onPlay:ge,onDateClick:fe,canDownload:!B&&!p[e].isProtected,isDownloading:T.includes(e)}))):"voice"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Cs.ZP,{key:e,theme:c,message:p[e],senderTitle:(0,No.F)(_,p[e],M,S),origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:A,className:"scroll-item",onPlay:ge,onDateClick:fe,canDownload:!B&&!p[e].isProtected,isDownloading:T.includes(e)}))):"members"===Q?ee.map(((e,t)=>{return i.ZP.createElement(Do.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>pe(e),contextActions:(n=e,n!==g&&Z?[{title:_("lng_context_remove_from_group"),icon:"stop",handler:()=>{J(n)}}]:void 0)},i.ZP.createElement(cn.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>i.ZP.createElement(Do.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},i.ZP.createElement(ln.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(Lt.Z,{big:!0,activeTab:z,tabs:Y,onSwitchTab:W})),P&&i.ZP.createElement(_o.Z,{isShown:"members"===Q,onClick:ue,ariaLabel:_("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon-add-user-filled"})),Z&&i.ZP.createElement(zo.Z,{isOpen:Boolean(X),userId:X,onClose:ve}))}))),Yo=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)})),Ko=(0,i.X$)((e=>{const t=(0,rt.Z)(ot.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)})),Qo=e=>{const t=(0,rt.Z)(ot.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)},er=e=>{const t=(0,rt.Z)(ot.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(jt.Z,null)},tr=(0,i.X$)((()=>{const e=(0,rt.Z)(ot.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(jt.Z,null)})),nr=(0,i.X$)((()=>{const e=(0,rt.Z)(ot.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(jt.Z,null)})),sr=(0,i.X$)((()=>{const e=(0,rt.Z)(ot.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(jt.Z,null)}));var ar=n(11820);const ir=(0,i.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:s}=t;const a=(0,c.Z1)(e,s),{userIds:i}=e.contactList||{},{byId:o}=e.chats,{currentUserId:r,newChatMembersProgress:l}=e,u=a&&(0,d.eA)(a),{query:h,fetchingStatus:g,globalUserIds:p,localUserIds:f}=e.userSearch;return{isChannel:u,members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,currentUserId:r,chatsById:o,localContactIds:i,searchQuery:h,isSearching:g,isLoading:l===m.WB.Loading,globalUserIds:p,localUserIds:f}}))((e=>{let{isChannel:t,members:n,onNextStep:a,currentUserId:o,chatsById:r,localContactIds:c,isLoading:l,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,onClose:f,isActive:v}=e;const{setUserSearchQuery:I}=(0,s.Sv)(),w=(0,It.Z)(),[y,P]=(0,i.eJ)([]),Z=(0,sn.Z)(y)===y;(0,nt.Z)({isActive:v,onBack:f});const C=(0,i.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),b=(0,i.I4)((e=>{I({query:e})}),[I]),S=(0,i.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=c?(0,d.kK)(c,e,u):[];return(0,d.ih)((0,g.Tw)([...n,...h||[],...p||[]]).filter((n=>{const s=e[n];return!C.includes(n)&&n!==o&&(!s||!(0,d.cS)(s)||!t&&s.canBeInvitedToGroup)})),r)}),[c,r,u,h,p,o,C,t]),E=(0,i.I4)((()=>{y.length&&(I({query:""}),a(y))}),[y,I,a]);return i.ZP.createElement("div",{className:"AddChatMembers"},i.ZP.createElement("div",{className:"AddChatMembers-inner"},i.ZP.createElement(ar.Z,{itemIds:S,selectedIds:y,filterValue:u,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:P,onFilterChange:b,noScrollRestore:Z}),i.ZP.createElement(_o.Z,{isShown:Boolean(y.length),disabled:l,ariaLabel:w("lng_channel_add_users"),onClick:E},l?i.ZP.createElement(Tt.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),or=450+a.fK,rr=Object.keys(m.qt).length/2,cr=Object.keys(m.u1).length/2;function lr(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const dr=(0,i.X$)((0,s.c$)((e=>{var t;const{chatId:n,threadId:s}=(0,c.Bt)(e)||{},a=(0,c.g4)(e),i=n?null===(t=e.management.byChatId[n])||void 0===t?void 0:t.nextScreen:void 0;return{contentKey:(0,c.Wq)(e),chatId:n,threadId:s,isChatSelected:Boolean(n&&a),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,nextManagementScreen:i}}))((e=>{var t;let{contentKey:n,chatId:o,threadId:r,isChatSelected:c,shouldSkipHistoryAnimations:l,nextManagementScreen:d}=e;const{toggleChatInfo:u,toggleManagement:h,closeLocalTextSearch:g,setStickerSearchQuery:p,setGifSearchQuery:f,closePollResults:v,addChatMembers:I,setNewChatMembersDialogState:w,setEditingExportedInvite:y,toggleStatistics:P,toggleMessageStatistics:Z,setOpenedInviteInfo:C,requestNextManagementScreen:b}=(0,s.Sv)(),{width:S}=(0,tn.Z)(),[E,M]=(0,i.eJ)(m.vi.Profile),[R,k]=(0,i.eJ)(m.u1.Initial),[A,T]=(0,i.eJ)(),[N,B]=(0,i.eJ)(),x=E!==m.vi.Profile,L=void 0!==n,O=n===m.qt.ChatInfo,U=n===m.qt.Search,j=n===m.qt.Management,F=n===m.qt.Statistics,D=n===m.qt.MessageStatistics,q=n===m.qt.StickerSearch,$=n===m.qt.GifSearch,G=n===m.qt.PollResults,H=n===m.qt.AddingMembers,V=S<=a._m,[_,z]=(0,i.eJ)(!L),W=null!==(t=(0,rn.Z)(n,!0,!c))&&void 0!==t?t:-1,X=(0,i.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case m.qt.AddingMembers:w(m.WB.Closed);break;case m.qt.ChatInfo:if(x&&e){M(m.vi.Profile);break}u(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(R){case m.u1.Initial:h();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:k(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:k(m.u1.GroupPermissions),T(void 0),B(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:k(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:k(m.u1.Invites),C({invite:void 0}),y({chatId:o,invite:void 0})}break;case m.qt.MessageStatistics:Z();break;case m.qt.Statistics:P();break;case m.qt.Search:lr(),g();break;case m.qt.StickerSearch:lr(),p({query:void 0});break;case m.qt.GifSearch:lr(),f({query:void 0});break;case m.qt.PollResults:v()}}),[n,x,u,v,w,R,h,g,p,f,y,o,C,P,Z]),J=(0,i.I4)(((e,t)=>{T(e),B(t)}),[]),Y=(0,i.I4)((e=>{I({chatId:o,memberIds:e})}),[I,o]);function K(e){if(-1!==W)switch(W){case m.qt.AddingMembers:return i.ZP.createElement(ir,{key:o,chatId:o,isActive:L&&e,onNextStep:Y,onClose:X});case m.qt.ChatInfo:return i.ZP.createElement(Jo,{key:o,chatId:o,profileState:E,onProfileStateChange:M});case m.qt.Search:return i.ZP.createElement(Yo,{chatId:o,threadId:r,onClose:X,isActive:L&&e});case m.qt.Management:return i.ZP.createElement(Ko,{key:o,chatId:o,currentScreen:R,isPromotedByCurrentUser:N,selectedChatMemberId:A,isActive:L&&e,onScreenSelect:k,onChatMemberSelect:J,onClose:X});case m.qt.Statistics:return i.ZP.createElement(Qo,{chatId:o});case m.qt.MessageStatistics:return i.ZP.createElement(er,{chatId:o,isActive:L&&e});case m.qt.StickerSearch:return i.ZP.createElement(tr,{onClose:X,isActive:L&&e});case m.qt.GifSearch:return i.ZP.createElement(nr,{onClose:X,isActive:L&&e});case m.qt.PollResults:return i.ZP.createElement(sr,{onClose:X,isActive:L&&e})}}return(0,i.d4)((()=>L?(0,ht.Z)(X):void 0),[L,X]),(0,i.d4)((()=>{setTimeout((()=>{z(!L)}),or)}),[L]),(0,i.d4)((()=>{d&&(k(d),b(void 0))}),[d,b]),(0,i.d4)((()=>{L&&V&&X()}),[V]),(0,zn.Z)((e=>{let[t]=e;t!==o&&(M(m.vi.Profile),k(m.u1.Initial))}),[o]),(0,nt.Z)({isActive:c&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers),onBack:()=>X(!1)}),i.ZP.createElement("div",{id:"RightColumn-wrapper",className:c?void 0:"is-hidden"},V&&i.ZP.createElement("div",{className:"overlay-backdrop",onClick:X}),i.ZP.createElement("div",{id:"RightColumn"},i.ZP.createElement(To,{chatId:o,isColumnOpen:L,isProfile:O,isSearch:U,isManagement:j,isStatistics:F,isMessageStatistics:D,isStickerSearch:q,isGifSearch:$,isPollResults:G,isAddingChatMembers:H,profileState:E,managementScreen:R,onClose:X,onScreenSelect:k}),i.ZP.createElement(vt.Z,{name:_||l?"none":"zoom-fade",renderCount:rr+cr,activeKey:j?rr+R:W,shouldCleanup:!0,cleanupExceptionKey:W===m.qt.MessageStatistics?m.qt.Statistics:void 0},K)))}))),ur=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,rt.Z)(ot.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0}));let mr=[],hr=!1;function gr(e,t){mr.push({url:e,filename:t}),hr||(hr=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of mr)pr(t),e++,10===e&&(await(0,R.wO)(1e3),e=0);mr=[]}(),hr=!1}),1e3))}function pr(e){let{url:t,filename:n}=e;const s=document.createElement("a");s.href=t,s.download=n;try{s.click()}catch(e){console.error(e)}}const fr=new Set,vr=new Set,Ir=(0,i.X$)((0,s.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:a,showNotification:r}=(0,s.Sv)(),c=(0,Vn.Z)(1e3,!0),l=(0,i.I4)((e=>{vr.add(e),c((()=>{vr.size&&(a({messages:Array.from(vr)}),vr.clear())}))}),[a,c]);(0,i.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,s]=e;return s.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{var t;if(fr.has(e))return;fr.add(e);const n=(0,d.Ti)(e,"download");if(!n)return void l(e);const s=fe.UV(n);if(s)return gr(s,(0,d.w6)(e)),void l(e);const{document:a,video:i,audio:c}=e.content;if(((null===(t=a||i||c)||void 0===t?void 0:t.size)||0)>h.l0&&!h.rT&&!h.Mc)return r({message:"Downloading files bigger than 2GB is not supported in your browser."}),void l(e);const u=(0,d.kG)(e,"download");fe.he(n,u,!0).then((t=>{if(u===o.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),s=(0,d.w6)(e);n.searchParams.set("filename",encodeURIComponent(s));const a=window.open(n.toString());null==a||a.addEventListener("beforeunload",(()=>{r({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&gr(t,(0,d.w6)(e));l(e)}))})):fr.clear()}),[n,t,a,l,r])})));var wr=n(13103);const yr=(0,i.X$)((0,s.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:s}=n||{},a=s&&(0,c.Z1)(e,s);return{canPost:Boolean(a)&&(0,d.Qm)(a,o._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:s}=e;const{closeGame:a,openForwardMenu:o}=(0,X.Sv)(),r=(0,It.Z)(),{url:c,chatId:l,messageId:d}=t||{},u=Boolean(c),m=(0,ci.Z)(l);(0,it.Z)((()=>{m({type:"playingGame"})}),u&&s?5e3:void 0);const h=(0,i.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:l,messageIds:[d],withMyScore:!0}),a()),"share_game"===t.eventType&&(o({fromChatId:l,messageIds:[d]}),a())}catch(e){}}),[l,a,d,o]),g=(0,i.I4)((e=>{e.currentTarget.focus()}),[]);return(0,i.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,i.d4)((()=>{if(u)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[u]),i.ZP.createElement(wr.Z,{className:"GameModal",isOpen:u,onClose:a,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"}))}))),Pr=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,rt.Z)(ot.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),Zr=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,rt.Z)(ot.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),Cr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"ForwardRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),br=(0,i.X$)((e=>{const{url:t}=e,n=(0,rt.Z)(ot.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),Sr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),Er=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,rt.Z)(ot.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),Mr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,rt.Z)(ot.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),Rr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,rt.Z)(ot.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0}));var kr=n(15780);function Ar(){return Ar=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ar.apply(this,arguments)}const Tr=(0,i.X$)((0,X.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,X.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},a=e=>{let{chatId:t,type:n,threadId:a}=e;(0,nt.Z)({isActive:!0,hash:(0,kr.q)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,null==t?void 0:t.map(((e,t)=>i.ZP.createElement(a,Ar({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),Nr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0})),Br=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0})),xr=(0,i.X$)((e=>{const{webApp:t}=e,n=(0,rt.Z)(ot.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0})),Lr=(0,i.X$)((e=>{const{bot:t}=e,n=(0,rt.Z)(ot.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0})),Or=(0,i.X$)((e=>{const{bot:t}=e,n=(0,rt.Z)(ot.gl.Extra,"AttachBotInstallModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ur={root:"vfd0Bo1X6k19aaxQ577t"},jr=h.wB?50:100,Fr=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Dr=(0,i.X$)((0,s.c$)((e=>(0,g.ei)(e,["confetti"])))((e=>{let{confetti:t}=e;const n=(0,i.sO)(null),s=(0,i.sO)([]),a=(0,i.sO)(!1),o=(0,tn.Z)(),r=(0,tt.Z)(),{lastConfettiTime:c,top:l,width:d,left:u,height:m}=t||{},h=()=>{if(!n.current||!a.current)return;const e=n.current,t=e.getContext("2d");if(!t)return;const{width:i,height:o}=e;t.clearRect(0,0,i,o);const r=[];s.current.forEach(((e,n)=>{const{pos:a,velocity:i,size:c,color:l,flicker:d,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:a.x+i.x*p,y:a.y+i.y*p},v={x:.98*i.x,y:i.y+=1e3*p},I=c*Math.abs(Math.sin(g*u)),w=5*g*u*(Math.PI/180),y=g+1,P=Date.now();if(f.y>o+e.size)return void r.push(e);const Z={...e,pos:f,velocity:v,flicker:I,rotation:w,lastDrawnAt:P,frameCount:y};s.current[n]=Z,t.fillStyle=l,t.beginPath(),t.ellipse(a.x,a.y,c,d,m,0,2*Math.PI),t.fill()})),s.current=s.current.filter((e=>!r.includes(e))),s.current.length?requestAnimationFrame(h):a.current=!1};if((0,Je.Z)((e=>{let t,[n]=e;return n!==c&&(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jr;for(let a=0;a<n;a++){const n=a%2,i={x:e*(n?-.1:1.1),y:.75*t},o=Math.random()*e*1.5,r={x:n?o:-1*o,y:-t/2-Math.random()*t},c=Fr[Math.floor(Math.random()*Fr.length)],l=10;s.current.push({pos:i,size:l,color:c,velocity:r,flicker:l,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}(d||o.width,m||o.height),t=setTimeout(r,1e4),a.current||(a.current=!0,requestAnimationFrame(h))),()=>{t&&clearTimeout(t)}}),[c,h]),!c||Date.now()-c>1e4)return;const g=(0,Bs.Z)(Boolean(l)&&`top: ${l}px`,Boolean(u)&&`left: ${u}px`,Boolean(d)&&`width: ${d}px`,Boolean(m)&&`height: ${m}px`);return i.ZP.createElement("div",{id:"Confetti",className:Ur.root,style:g},i.ZP.createElement("canvas",{ref:n,className:Ur.canvas,width:o.width,height:o.height}))}))),qr=(0,i.X$)((e=>{const{urlAuth:t}=e,n=(0,rt.Z)(ot.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0})),$r=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0})),Gr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),Hr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,rt.Z)(ot.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),Vr=(0,i.X$)((e=>{const{limit:t}=e,n=(0,rt.Z)(ot.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0})),_r=(0,i.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,rt.Z)(ot.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0})),zr=(0,i.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,rt.Z)(ot.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Wr=(0,i.X$)((e=>{const{requestedDraft:t}=e,n=(0,rt.Z)(ot.gl.Extra,"DraftRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),Xr=(0,i.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,rt.Z)(ot.gl.Extra,"AttachBotRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0}));let Jr,Yr=!1;function Kr(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function Qr(e){document.title!==e&&(document.title=e)}const ec=(0,i.X$)((0,s.c$)((e=>{var t,n,s,a,i;const{settings:{byKey:{animationLevel:o,language:r,wasTimeFormatSetManually:l}},botTrustRequest:d,requestedAttachBotInstall:u,requestedAttachBotInChat:m,requestedDraft:h,urlAuth:g,webApp:p,safeLinkModalUrl:f,lastSyncTime:v,openedStickerSetShortName:I,openedCustomEmojiSetIds:w,shouldSkipHistoryAnimations:y}=e,{chatId:P,messageId:Z}=e.audioPlayer,C=P&&Z?(0,c.hj)(e,P,Z):void 0,b=e.openedGame,S=b&&(0,c.hj)(e,b.chatId,b.messageId),E=null==S||null===(t=S.content.game)||void 0===t?void 0:t.title,M=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;return{lastSyncTime:v,isLeftColumnOpen:e.isLeftColumnShown,isRightColumnOpen:(0,c.Jf)(e),isMediaViewerOpen:(0,c.zQ)(e),isForwardModalOpen:(0,c.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:C,safeLinkModalUrl:f,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:y,openedStickerSetShortName:I,openedCustomEmojiSetIds:w,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:o,language:r,wasTimeFormatSetManually:l,isPhoneCallActive:Boolean(e.phoneCall),addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:null===(n=e.newContact)||void 0===n?void 0:n.userId,newContactByPhoneNumber:null===(s=e.newContact)||void 0===s?void 0:s.isByPhoneNumber,openedGame:b,gameTitle:E,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall),botTrustRequest:d,botTrustRequestBot:d&&(0,c.dy)(e,d.botId),attachBotToInstall:u&&(0,c.dy)(e,u.botId),requestedAttachBotInChat:m,webApp:p,currentUser:M,urlAuth:g,isPremiumModalOpen:null===(a=e.premiumModal)||void 0===a?void 0:a.isOpen,limitReached:null===(i=e.limitReachedModal)||void 0===i?void 0:i.limit,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),deleteFolderDialogId:e.deleteFolderDialogModal,requestedDraft:h}}))((e=>{let{lastSyncTime:t,isLeftColumnOpen:n,isRightColumnOpen:o,isMediaViewerOpen:r,isForwardModalOpen:c,hasNotifications:l,hasDialogs:d,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:f,limitReached:v,openedStickerSetShortName:I,openedCustomEmojiSetIds:w,isServiceChatReady:y,animationLevel:P,language:Z,wasTimeFormatSetManually:C,addedSetIds:b,addedCustomEmojiIds:S,isPhoneCallActive:E,newContactUserId:M,newContactByPhoneNumber:k,openedGame:A,gameTitle:T,isRatePhoneCallModalOpen:N,botTrustRequest:B,botTrustRequestBot:x,attachBotToInstall:L,requestedAttachBotInChat:O,requestedDraft:U,webApp:j,currentUser:F,urlAuth:D,isPremiumModalOpen:q,isPaymentModalOpen:$,isReceiptModalOpen:G,deleteFolderDialogId:H}=e;const{loadAnimatedEmojis:V,loadNotificationSettings:_,loadNotificationExceptions:z,updateIsOnline:W,loadTopInlineBots:X,loadEmojiKeywords:Y,loadCountryList:K,loadAvailableReactions:Q,loadStickerSets:ee,loadPremiumGifts:te,loadAddedStickers:ne,loadFavoriteStickers:se,ensureTimeFormat:ae,closeStickerSetModal:ie,closeCustomEmojiSets:oe,checkVersionNotification:re,loadAppConfig:ce,loadAttachBots:le,loadContactList:de,loadCustomEmojis:ue,closePaymentModal:me,clearReceipt:he,checkAppVersion:ge}=(0,s.Sv)();a.eM&&!Yr&&(Yr=!0,console.log(">>> RENDER MAIN")),(0,it.Z)(ge,3e5,!0),(0,i.d4)((()=>{t&&(W(!0),ce(),Q(),V(),_(),z(),X(),Y({language:a.pR}),le(),de(),te(),ge())}),[t,V,Y,z,_,X,W,Q,ce,le,de,te,ge]),(0,i.d4)((()=>{t&&(Z!==a.pR&&Y({language:Z}),K({langCode:Z}))}),[Z,t,K,Y]),(0,ze.Z)((e=>{let[n]=e;!n&&t&&ue({ids:Object.keys((0,s.Rd)().customEmojis.byId),ignoreCache:!0})}),[t]),(0,i.d4)((()=>{t&&(b&&S||(ee(),se()),b&&S&&ne())}),[t,b,ee,se,ne,S]),(0,i.d4)((()=>{t&&y&&re()}),[t,y,re]),(0,i.d4)((()=>{t&&!C&&ae()}),[t,C,ae]),(0,i.d4)((()=>{t&&nt.O.startsWith("#?tgaddr=")&&(0,_e.ou)(decodeURIComponent(nt.O.substr("#?tgaddr=".length)))}),[t]),(0,i.d4)((()=>{if(m||E)return be.Z.disableRefresh(),()=>{be.Z.enableRefresh()}}),[m,E]);const pe=(0,st.Z)(n,void 0,!0,void 0,f),fe=(0,i.sO)(!1),ve=(0,tt.Z)();(0,Je.Z)((e=>{let[t]=e;if(void 0===t||0===P)return;fe.current=!0,h.wZ&&(0,R.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!n)}));const s=(0,at.YW)();(0,Ve.L)(document.getElementById("MiddleColumn"),(()=>{s(),fe.current=!1,ve()}))}),[n]);const Ie=(0,st.Z)(o,void 0,!0,void 0,f),we=(0,i.sO)(!1),[ye,Pe]=(0,i.eJ)(o);(0,Je.Z)((e=>{let[t]=e;if(void 0===t)return;if(0===P)return void Pe(o);we.current=!0;const n=(0,at.YW)();(0,Ve.L)(document.getElementById("RightColumn"),(()=>{n(),we.current=!1,ve(),Pe(o)}))}),[o]);const Ze=(0,He.Z)(pe.hasShownClass&&"left-column-shown",pe.hasOpenClass&&"left-column-open",fe.current&&"left-column-animating",Ie.hasShownClass&&"right-column-shown",Ie.hasOpenClass&&"right-column-open",we.current&&"right-column-animating",ye&&"narrow-message-list",f&&"history-animation-disabled"),Ce=(0,i.I4)((()=>{W(!1);const e=(0,J.xW)();let t=0;clearInterval(Jr),Jr=window.setInterval((()=>{if(document.title.includes(a.ou))Kr(!1);else{if(t%2==0){const t=(0,J.xW)()-e;t>0&&(Qr(`${t} notification${t>1?"s":""}`),Kr(!0))}else Qr(a.Ti),Kr(!1);t++}}),1e3)}),[W]),Se=(0,i.I4)((()=>{W(!0),clearInterval(Jr),Jr=void 0,document.title.includes(a.ou)||Qr(a.Ti),Kr(!1)}),[W]),Ee=(0,i.I4)((()=>{ie()}),[ie]),Me=(0,i.I4)((()=>{oe()}),[oe]);return(0,We.Z)(Ce,Se),Xe(Ce),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(h.$b){if(!e)return null==Ye||Ye.setAttribute("content",Ke),h.cj&&!h.fl&&document.addEventListener("gesturestart",et),()=>{null==Ye||Ye.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",et)};null==Ye||Ye.setAttribute("content",Qe)}}),[e])}(r),i.ZP.createElement("div",{id:"Main",className:Ze},i.ZP.createElement(Yt,null),i.ZP.createElement(Mo,null),i.ZP.createElement(dr,null),i.ZP.createElement(ur,{isOpen:r}),i.ZP.createElement(Cr,{isOpen:c}),i.ZP.createElement(Wr,{requestedDraft:U}),i.ZP.createElement(Pr,{isOpen:l}),i.ZP.createElement(Zr,{isOpen:d}),u&&i.ZP.createElement(xn,{key:u.id,message:u,noUi:!0}),i.ZP.createElement(br,{url:g}),i.ZP.createElement(qr,{urlAuth:D,currentUser:F}),i.ZP.createElement(Sr,{isOpen:p}),i.ZP.createElement(ct,{isOpen:Boolean(I),onClose:Ee,stickerSetShortName:I}),i.ZP.createElement(zr,{customEmojiSetIds:w,onClose:Me}),m&&i.ZP.createElement(Er,{groupCallId:m}),i.ZP.createElement(Mr,{isActive:Boolean(m||E)}),i.ZP.createElement(Nr,{isOpen:Boolean(M||k),userId:M,isByPhoneNumber:k}),i.ZP.createElement(yr,{openedGame:A,gameTitle:T}),i.ZP.createElement(xr,{webApp:j}),i.ZP.createElement(Ir,null),i.ZP.createElement(Dr,null),i.ZP.createElement(Rr,{isActive:E}),i.ZP.createElement(mt,{isForAppBadge:!0}),i.ZP.createElement(Br,{isOpen:N}),i.ZP.createElement(Lr,{bot:x,type:null==B?void 0:B.type}),i.ZP.createElement(Or,{bot:L}),i.ZP.createElement(Xr,{requestedAttachBotInChat:O}),i.ZP.createElement(Tr,null),q&&i.ZP.createElement($r,{isOpen:q}),i.ZP.createElement(Vr,{limit:v}),i.ZP.createElement(Gr,{isOpen:$,onClose:me}),i.ZP.createElement(Hr,{isOpen:G,onClose:he}),i.ZP.createElement(_r,{deleteFolderDialogId:H}))})));var tc=n(99364),nc=n(8337);var sc=n(2092);const ac=(0,i.X$)((0,s.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:a,signOut:o,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,s.Sv)(),{invalidAttemptsCount:l,isLoading:d}=n,u=(0,It.Z)(),[m,h]=(0,i.eJ)(""),[g,p]=(0,i.eJ)(!1),[f,v,I]=(0,pt.Z)(!1),{shouldRender:w}=(0,st.Z)(t);(0,ma.Z)(c,l&&l>=5?18e4:void 0);const y=(0,i.I4)((()=>{h("")}),[]),P=(0,i.I4)((e=>{l&&l>=5?h(u("FloodWait")):(h(""),(0,E.so)(e).then(a,(()=>{r(),h(u("lng_passcode_wrong"))})))}),[l,u,r,a]);(0,i.d4)((()=>{l&&l>=5?h(u("FloodWait")):0===l&&h("")}),[l,u]);const Z=(0,i.I4)((()=>{I(),o()}),[I,o]);if(w)return i.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},i.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:u.isRtl?"rtl":void 0},i.ZP.createElement(Ls.Z,{tgsUrl:Ts.l.Lock,previewUrl:sc,size:160,className:"ar9YdQbWJreREHmnZa9m"}),i.ZP.createElement(tc.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:d,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:y,isPasswordVisible:g,noRipple:!0,onChangePasswordVisibility:p,onSubmit:P}),i.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},i.ZP.createElement("p",null,i.ZP.createElement(nc.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),i.ZP.createElement("p",null,i.ZP.createElement(Et.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},u("AccountSettings.Logout"))))),i.ZP.createElement(fn.Z,{isOpen:f,onClose:I,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:Z,confirmIsDestructive:!0}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{connectionState:ic,passcode:{isScreenLocked:oc}}=(0,s.Rd)();ic||oc||(0,s.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
//# sourceMappingURL=5769.9474b1eea191c21d23ca.js.map