mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-14 18:27:10 +01:00
2 lines
330 KiB
JavaScript
2 lines
330 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{45910:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Hr,Main:()=>Dr});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(83158);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)("openChatWithText",((e,t,n)=>{const{chatId:s,text:a}=n;return t.openChat({id:s}),{...e,openChatWithText:{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 Z(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),Z=!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])}Z&&(e=(0,r.wV)(e,m.fo.Static));const P=(0,c.Cb)(e,a,i);if(P&&P.includes(v))return(0,s.R3)(e),void t.openChat({id:a,threadId:i,shouldReplaceHistory:f});if(Z&&(e=(0,r.pf)(e,a,i,"viewportIds",void 0)),e=(0,r.pf)(e,a,i,"outlyingIds",void 0),P&&!Z){const t=v>P[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.52**\n\n👏 **Harder**\n• Added support for username.t.me links.\n• ‘Update Telegram’ button now automatically appears when an update is available.\n• Games can now request a share window.\n\n🤩 **Better**\n• Square images for web page previews are now properly displayed.\n• Auth screen transitions are now smoother.\n• Changelog notifications are only delivered every 3 days.\n\n🚀 **Faster**\n• Interface performance was heavily optimized.\n• Initial app bundle is now even more lightweight.\n\n💪 **Stronger**\n• Fixed several issues causing missing chats.\n• Fixed frozen UI on Android after selecting ‘Nice and Fast’ animation setting.\n• Fixed Play button overlapping with Slide Left button in Media Viewer.\n• Fixed quick reaction button not showing in some cases.\n• Fixed names and profile pictures for deleted accounts.\n• Numerous other layout fixes.\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;Z(e,t,n)})),(0,s.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.jr)(e);s&&0!==s.length&&a&&Z(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 P=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)("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,P.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})}))})),(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,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}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,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}}}));var S=n(3100),M=n(95281),E=n(5872),R=n(69118),k=n(35369);let N=!1;(0,R.Gq)((()=>{(0,s.Rd)().passcode.hasPasscode&&!N&&(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,M.AU)(a);const i=JSON.stringify({...(0,S.K8)(),userId:e.currentUserId}),o=(0,E.Uf)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,M.H4)(i,o),(0,s.R3)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1})),(0,E.jA)(!0)})),(0,s.iw)("clearPasscode",(e=>((0,M.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,E.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",(()=>{N=!0})),n(65456);var T=n(27225),A=n(71226),x=n(81396);const B=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,A.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=>!e.isHidden)).map((e=>{let{message:t}=e;return t})):[],Z=[].concat(p,y),P=(0,g.ee)(Z,"id"),C=Object.keys(P).map(Number);w=(0,r.c_)(w,d,P),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 F(e){let t;const n=e.attachment?(e,a)=>{B.has(a)||(t=a,B.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,A.t9)("sendMessage",e,n),n&&t&&B.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,A.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;F({...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}`;F({...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=>{F({...s,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:s,...a}=d;e&&F({...a,text:e,entities:t,replyingTo:s}),n.forEach((e=>{F({...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,A.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&&B.get((0,d.KK)(i));o&&(0,A.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,A.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,A.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,A.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,A.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,A.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,A.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)=>{var s;const{chatId:a,shouldDeleteForAll:i}=n,o=(0,c.Z1)(e,a);if(!o)return;const r=null===(s=o.lastMessage)||void 0===s?void 0:s.id;await(0,A.t9)("deleteHistory",{chat:o,shouldDeleteForAll:i,maxId:r});const l=(0,c.Bt)(e);l&&l.chatId===a&&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,A.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,A.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,A.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,A.t9)("markMessagesRead",{chat:s,messageIds:a})})),(0,s.iw)("loadWebPagePreview",((e,t,n)=>{const{text:a}=n;!async function(e){const t=await(0,A.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,A.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,A.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,A.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,A.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,A.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;F({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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,{sendAsIds:o.ids}),(0,s.R3)(e)):(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{sendAsIds:[]}))})),(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,A.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,A.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,A.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;if(!i.unreadMentionsCount)return;const o=i.unreadMentionsCount-a.length,l=(i.unreadMentions||[]).filter((e=>!a.includes(e)));e=(0,r.a4)(e,i.id,{unreadMentions:l}),(0,s.R3)(e),!l.length&&o&&t.fetchUnreadMentions({chatId:i.id,offsetId:Math.max(...a)}),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,A.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,x.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,A.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()}));var q=n(85765),D=n(9211);const $=(0,R.P2)((e=>e()),500,!1);async function j(e){const t=await(0,A.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,A.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,A.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,A.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,A.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||{};j(t)})),(0,s.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,s.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,A.t9)("removeRecentSticker",{sticker:s})&&j()})),(0,s.iw)("clearRecentStickers",(async e=>{await(0,A.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,A.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,A.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&&$((()=>{!async function(e,t){const n=await(0,A.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,q.Z)(n,e)&&c.unshift(t)}})),(0,s.R3)((0,r.z3)(a,"search",n.hash,n.sets,c))}(a)}))})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;"string"==typeof s&&$((()=>{H(s)}))})),(0,s.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&$((()=>{H(t,n)}))})),(0,s.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:a}=n,{hash:i}=e.stickers.forEmoji;$((()=>{!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,A.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)("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,A.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,A.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,A.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,A.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,A.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,A.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.H9)(e,m.wv.InProgress),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,s.R3)(e);const o=await(0,A.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}),(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,A.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}),(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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.t9)("hideChatReportPanel",i)&&(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{settings:void 0}))}));var X=n(16974);let J;function Y(e){return(0,A.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"),J&&clearTimeout(J),(0,s.R3)({...(0,s.Rd)(),isSyncing:!0}),J=window.setTimeout((()=>{(0,s.R3)({...(0,s.Rd)(),isSyncing:!1}),J=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 Y(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=>!e.isHidden)).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 Y(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,X.S1)(),e({listType:"archived",shouldReplace:!0}),(0,A.t9)("fetchCurrentUser"),t()}})})),(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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.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,A.t9)("terminateAllWebAuthorizations")&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeWebSessions:{byHash:{},orderedHashes:[]}}))}));const K=(0,R.P2)((e=>e()),500,!1);function Q(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function ee(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,A.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,A.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,A.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,A.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,A.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,A.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,A.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:a});else{const{id:e,accessHash:t}=l;d=await(0,A.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,A.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,A.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&&K((()=>{!async function(e){const t=await(0,A.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,A.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,A.t9)("reportSpam",a)}));var te=n(18629);const ne=h.cj||h.wZ;class se{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;ne&&(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(!ne){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 ae="https://prizes.gamee.com/",ie=(0,R.Ds)((e=>e()),500,!1);async function oe(e,t){await(0,A.t9)("toggleBotInAttachMenu",{bot:e,isEnabled:t}),await re()}async function re(e){const t=await(0,A.t9)("loadAttachMenuBots",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}function ce(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 le(e,t,n,s,a){await(0,A.t9)("sendMessage",{chat:e,text:n,replyingTo:s,sendAs:a})}let de;async function ue(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&&(de||(de=new se("popup,width=800,height=600",(()=>{o({message:"Allow browser to open popup window"})}))),de.preOpenIfNeeded());const l=await(0,A.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(ae)?de.open(m):(de.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}async function me(e,t,n){const a=await(0,A.t9)("validateRequestedInfo",{inputInvoice:e,requestInfo:t,shouldSave:n});if(!a)return;const{id:i,shippingOptions:o}=a;if(!i)return;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.PaymentInfo),(0,s.R3)(c)}async function he(e){const t=await(0,A.t9)("getPaymentForm",e);if(!t)return;const{form:n,invoice:a}=t;let i=(0,r._7)((0,s.Rd)(),n),o=m.KB.PaymentInfo;const{shippingAddressRequested:c,nameRequested:l,phoneRequested:d,emailRequested:u}=i.payment.invoice||{};return(c||l||d||u)&&(o=m.KB.ShippingInfo),i=(0,r.Q$)(i,o),(0,s.R3)(i),a}(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;ue(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;ue(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,te.B)();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,te.B)();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}),le(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,A.t9)("unblockContact",l.id,l.accessHash)&&((0,s.R3)((0,r.rB)((0,s.Rd)(),l.id)),le(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,A.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,A.t9)("fetchInlineBot",{username:i})||{};if(e=(0,s.Rd)(),!t||!n)return void(0,s.R3)(Q(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=Q(e,i,d),(0,s.R3)(e)}(o!==d.query||d.canLoadMore)&&ie((()=>{!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=ee(r,!0),r=Q(r,t,{...n,query:i,...u&&{offset:void 0,results:[]}}),(0,s.R3)(r);const m=await(0,A.t9)("fetchInlineBotResults",{bot:l,chat:d,query:i,offset:u?void 0:o}),h=r.inlineBots.byUsername[t];if(r=ee((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=Q(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.IK)(e,r.senderId);if(!l)return;const d=`@${l.username} ${s}`;if(!a)return{...e,switchBotInline:{query:s,botUsername:l.username}};t.openChatWithText({chatId:o.id,text:d})})),(0,s.iw)("resetSwitchBotInline",(e=>({...e,switchBotInline: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,A.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)(Q(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,A.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,A.t9)("unblockContact",r.id,r.accessHash),await(0,A.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,A.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,A.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:Z,queryId:P}=y;e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:Z,botId:i,queryId:P,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,A.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,A.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)("loadAttachMenuBots",(async(e,t,n)=>{const{hash:s}=n||{};await re(s)})),(0,s.iw)("toggleBotInAttachMenu",(async(e,t,n)=>{const{botId:s,isEnabled:a}=n,i=(0,c.dy)(e,s);i&&await oe(i,a)})),(0,s.iw)("callAttachMenuBot",((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,botAttachRequest:{botId:a,chatId:s,startParam:r}};const l=(0,te.B)();t.requestWebView({url:o,peerId:s,botId:a,theme:l,buttonText:"",isFromBotMenu:i,startParam:r})})),(0,s.iw)("confirmBotAttachRequest",(async(e,t)=>{const{botAttachRequest:n}=e;if(!n)return;const{botId:a,chatId:i,startParam:o}=n;(0,s.R3)({...e,botAttachRequest:void 0});const r=(0,c.dy)(e,a);r&&(await oe(r,!0),t.callAttachMenuBot({chatId:i,botId:a,startParam:o}))})),(0,s.iw)("closeBotAttachRequestModal",(e=>({...e,botAttachRequest: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,A.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}}}),ce(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,A.t9)("acceptBotUrlAuth",{chat:u,messageId:l,buttonId:d,isWriteAllowed:a});m&&ce(o,m)})),(0,s.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:a}=n,i=await(0,A.t9)("requestLinkUrlAuth",{url:a});i&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:a}}),ce(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,A.t9)("acceptLinkUrlAuth",{url:i,isWriteAllowed:a});o&&ce(i,o)})),(0,s.iw)("closeUrlAuthModal",(e=>({...e,urlAuth:void 0}))),n(51371),(0,s.iw)("loadPasswordInfo",(async e=>{const t=await(0,A.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,A.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,A.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,A.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,A.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,A.t9)("provideRecoveryEmailCode",s)})),(0,s.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,s.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:s,saveInfo:a}=n,i=(0,c.kb)(e);if(i)if("slug"in i)me(i,s,a);else{const t=(0,c.Z1)(e,i.chatId);if(!t)return;me({chat:t,messageId:i.messageId},s,a)}})),(0,s.iw)("openInvoice",(async(e,t,n)=>{let a;if("slug"in n)a=await he({slug:n.slug});else{const t=(0,c.Z1)(e,n.chatId);if(!t)return;a=await he({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,A.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",((e,t,n)=>{const{shippingOptionId:a,saveCredentials:i}=n,o=(0,c.kb)(e),l=(0,c.eh)(e),d=(0,c.sp)(e),{nativeProvider:u}=e.payment,m="stripe"===u?(0,c.$$)(e):(0,c.EB)(e);if(!(o&&m&&l&&u))return;let h;if("slug"in o)h={slug:o.slug};else{const t=(0,c.Z1)(e,o.chatId);if(!t)return;h={chat:t,messageId:o.messageId}}return async function(e,t,n,a,i){if(!0===await(0,A.t9)("sendPaymentForm",{inputInvoice:e,formId:t,credentials:n,requestedInfoId:a,shippingOptionId:i})){let e=(0,r.bp)((0,s.Rd)());e={...e,payment:{...e.payment,status:"paid"}},(0,s.R3)((0,r.WY)(e))}}(h,l,{save:i,data:"stripe"===u?(0,c.i3)(e):(0,c.Jg)(e)},d,a),{...e,payment:{...e.payment,status:"pending"}}})),(0,s.iw)("setPaymentStep",(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,n.step||m.KB.ShippingInfo)})),(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,A.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,A.t9)("fetchPremiumPromo");i&&(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),(0,s.R3)({...e,giftPremiumModal:{isOpen:!0,forUserId:a,monthlyCurrency:i.promo.currency,monthlyAmount:i.promo.monthlyAmount}}))})),(0,s.iw)("closeGiftPremiumModal",(e=>{(0,s.R3)({...e,giftPremiumModal:{isOpen:!1}})}));var ge=n(40647),pe=n(4907);const fe=728,ve=424,Ie=288;var we=n(43858),ye=n(53475);function Ze(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=we.Z.get().width)>a._m?Math.min(Math.max(.25*n,Ie),.33*n):n>a.ks?Math.min(Math.max(.33*n,Ie),.4*n):ve):0);var n}function Pe(e,t,n){return(0,ye.a4)(e,t,n,void 0,!0)}let Ce=0;(0,s.iw)("loadAvailableReactions",(async()=>{const e=await(0,A.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&ge.he(`sticker${e.aroundAnimation.id}`,o.IU.BlobUrl),e.centerIcon&&ge.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:Ce++,animatedEffect:s||o,x:Ze(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,A.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,A.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,pe.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,A.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,A.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,A.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,A.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:i}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:Ze(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,A.t9)("fetchUnreadReactions",{chat:o,offsetId:i,addOffset:i?-1:void 0});if(!l||!l.messages.length)return e=Pe(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=Pe(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=Pe(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,A.t9)("readAllReactions",{chat:t}),Pe(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,A.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,A.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,A.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,A.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:u,isPercentage:l});m&&(0,s.R3)((0,r.yC)((0,s.Rd)(),a,o,m))})),n(28304);var be=n(28406);function Se(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)=>Se(e,s[t])))}const a=e,i=t;return Object.keys(a).every((e=>Se(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,be.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;return"thread"===d&&l===o._f&&n.chatId===i&&setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500),(0,s.R3)((0,r.a4)(e,n.chatId,{unreadCount:u.unreadCount?u.unreadCount+1:1,...n.message.id&&n.message.hasUnreadMention&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1,unreadMentions:[...u.unreadMentions||[],n.message.id]}})),void(0,be.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=Pe(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 Me=350;function Ee(e,t,n,s,a,i,o){var l;const u=null==o?void 0:o.reactions;if(u&&Se(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=Pe(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,be.rh)({chat:a,message:s,isReaction:!0})}))}else if(m){var h;e=Pe(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 Re(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 ke(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 Ne(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=ke(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 Te(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 Ae(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 xe(e,t,n,a){if(e){t.forEach((t=>{const n=Ae(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);n&&(a=Te(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=ke(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})}))}),Me)}const i=[];t.forEach((e=>{const t=(0,c.X5)(a,e);if(t){i.push(t);const n=Ae(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);n&&(a=Te(a,t,n,!0)),setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),t,[e]))}),Me)}})),(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=Ne(e=Re(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)(Te(e,a,h))}),Me)}else e=Te(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=Re(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=Re(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=Te(e,a,g)),l.reactions&&h&&(e=Ee(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=Re(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=Ne(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=Te(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;xe(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)}),Me))}(a,t,0,e);break}case"deleteHistory":{const{chatId:i}=n,o=e.messages.byChatId[i];if(i===a.aw){var h;const t=null===(h=e.serviceNotifications.sort(((e,t)=>t.id-e.id)))||void 0===h?void 0:h[0],n=t?[{...t,isHidden:!0}]:[];(0,s.R3)({...e,serviceNotifications:n})}o?xe(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 p;const t=i.content.poll.results;let n=t;null!==(p=a.results)&&void 0!==p&&p.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)(Ee(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 Be=(0,R.P2)((function(){const e=(0,s.Rd)();(0,s.R3)((0,r.ps)(e,{...e.users.statusesById,...Le})),Le={}}),3e3,!0);let Le={};(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"updateUserStatus":return a=n.userId,i=n.status,Le[a]=i,void Be();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 Oe=n(78958),Ue=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,Oe.dc)(e,n.call.id):(0,Oe.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,Oe.B6)(e,t,n.id,n,Boolean(i)||o===n.id))})),i&&(e=(0,Oe.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,be.TO)({call:o,user:(0,Ue.fu)((0,s.Rd)())})})),(0,b.o5)(),{...e,phoneCall:o,isCallPanelVisible:!1}}}})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"]){const{inputInvoice:t}=e.payment;return h.Xp||(e=(0,r.bp)(e)),n.slug&&t&&"slug"in t&&t.slug!==n.slug?h.Xp?void 0:e:{...e,payment:{...e.payment,status:"paid"}}}}));var Fe=n(46752),qe=n(1279),De=n(53551),$e=n(274),je=n(45332);function Ge(e){(0,i.d4)((()=>(0,R.Gq)(e)),[e])}var He=n(29290);const Ve=document.querySelector('meta[name="viewport"]'),_e=(null==Ve?void 0:Ve.getAttribute("content"))||"",ze="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function We(e){e.preventDefault()}var Xe=n(65326),Je=n(46590),Ye=n(31212),Ke=n(18674),Qe=n(62357),et=n(99203),tt=n(48778);const nt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0}));var st=n(2155),at=n(95616),it=n(17358);const ot=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,at.yi)();const n=(0,X.xW)();if((0,i.d4)((()=>{t&&(0,it.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,st.bi)(n))}));var rt=n(23989),ct=n(53455),lt=n(60706),dt=n(73541),ut=n(2255),mt=n(59107),ht=n(27370),gt=n(706);let pt;function ft(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 vt=n(36046),It=n(53106),wt=n(58964),yt=n(231),Zt=n(69589),Pt=n(49187),Ct=n(83321),bt=n(40126),St=n(49204);const Mt=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:s}=e;const a=(0,mt.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},i.ZP.createElement(St.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(ut.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(yt.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))})),Et=(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:Z,chatsById:P,connectionState:C,isSyncing:b,isMessageListOpen:S,isConnectionStatusMinimized:M,areChatsLoaded:E,hasPasscode:R,canInstall:k}=e;const{openChat:N,setGlobalSearchDate:T,setSettingOption:A,setGlobalSearchChatId:x,openChatByUsername:B,lockScreen:L,requestNextSettingsScreen:O,skipLockOnUnload:U}=(0,s.Sv)(),F=(0,mt.Z)(),q=t===m.du.ChatList,D=(0,i.Ye)((()=>w?(0,V.xH)(new Date(1e3*w)):void 0),[w]),$=(0,i.Ye)((()=>q&&P?Object.values(P).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[q,P]),{connectionStatus:j,connectionStatusText:G,connectionStatusPosition:H}=ft(F,C,b,S,M,!E),_=(0,i.I4)((e=>{e.preventDefault(),e.stopPropagation(),R?L():O(m.MT.PasscodeDisabled)}),[R,L,O]);(0,dt.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(yt.Z,{round:!0,ripple:q&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:q?t:()=>u(),ariaLabel:q?F("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,Fe.Z)("animated-menu-icon",!q&&"state-back",f&&"no-animation")}))}),[q,F,u,f]),X=(0,i.I4)((()=>{g||o("")}),[g,o]),J=(0,i.I4)((()=>{A({isConnectionStatusMinimized:!M})}),[M,A]),Y=(0,i.I4)((()=>{N({id:v,shouldReplaceHistory:!0})}),[v,N]),K=(0,i.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";A({theme:t}),A({shouldUseSystemTheme:!1}),(0,ht.Z)(t,Z===a.zy)}),[Z,A,y]),Q=(0,i.I4)((()=>{window.open(a.ul,"_blank","noopener")}),[]),ee=(0,i.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,gt.W8)(),U()}),[U]),te=(0,i.I4)((()=>{U()}),[U]),ne=(0,i.I4)((()=>{B({username:F("Settings.TipsUsername")})}),[F,B]),se=(0,i.I4)((()=>{L()}),[L]),ae=Boolean(I)||t===m.du.GlobalSearch||t===m.du.Contacts;(0,i.d4)((()=>ae?(0,rt.Z)((()=>u())):void 0),[ae,u]);const ie=t===m.du.Contacts?F("SearchFriends"):F("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(It.Z,{trigger:W,footer:`${a.iC} ${oe}`},i.ZP.createElement(wt.Z,{icon:"saved-messages",onClick:Y},F("SavedMessages")),i.ZP.createElement(wt.Z,{icon:"archive",onClick:l},i.ZP.createElement("span",{className:"menu-item-name"},F("ArchivedChats")),$>0&&i.ZP.createElement("div",{className:"archived-badge"},$)),i.ZP.createElement(wt.Z,{icon:"user",onClick:c},F("Contacts")),i.ZP.createElement(wt.Z,{icon:"settings",onClick:r},F("Settings")),i.ZP.createElement(wt.Z,{icon:"darkmode",onClick:K},i.ZP.createElement("span",{className:"menu-item-name"},F("lng_menu_night_mode")),i.ZP.createElement(Ct.Z,{id:"darkmode",label:F("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),i.ZP.createElement(wt.Z,{icon:"help",onClick:ne},F("TelegramFeatures")),i.ZP.createElement(wt.Z,{icon:"bug",href:a.mU},"Report Bug"),a.Tj&&i.ZP.createElement(wt.Z,{icon:"permissions",onClick:Q},"Beta Changelog"),z&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(wt.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:ee},"Switch to K Version"),i.ZP.createElement(wt.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:te},"Switch to Old Version")),k&&i.ZP.createElement(wt.Z,{icon:"install",onClick:(0,vt.G)()},"Install App")),i.ZP.createElement(Zt.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(Pt.Z,{icon:"calendar",title:D,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:T,clickArg:{date:void 0}}),I&&i.ZP.createElement(Pt.Z,{chatOrUserId:I,onClick:x,canClose:!0,clickArg:{id:void 0}})),R&&i.ZP.createElement(yt.Z,{round:!0,ripple:!h.wB,size:"smaller",color:"translucent",ariaLabel:`${F("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:se,className:"passcode-lock"},i.ZP.createElement("i",{className:"icon-lock"})),i.ZP.createElement(bt.Z,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(Mt,{connectionStatus:j,connectionStatusText:G,onClick:J}))))})));var Rt=n(64963),kt=n(93133),Nt=n(1080);const Tt=(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,mt.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]),Z=(null==y?void 0:y.findIndex((e=>e.id===a.Nf)))===c,P=0===c,C=(0,at.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,Rt.sf)(v.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Rt.eM.Left?(p(Math.min(c+1,b.length-1),{forceOnHeavyAnimation:!0}),!0):t===Rt.eM.Right&&(p(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,b,p]);const M=(0,i.sO)();M.current=!P,(0,i.d4)((()=>M.current?(0,rt.Z)((()=>{M.current&&p(0)})):void 0),[c,p]),(0,Je.Z)({isActive:!P,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:E,transitionClassNames:R}=(0,Ye.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||Z?i.ZP.createElement(Nt.Z,{folderType:"all",isActive:e,lastSyncTime:d,foldersDispatch:t,onScreenSelect:n}):i.ZP.createElement(Nt.Z,{folderType:"folder",folderId:s.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t})}const N=b&&b.length>1;return i.ZP.createElement("div",{className:"ChatFolders"},N?i.ZP.createElement(kt.Z,{tabs:b,activeTab:c,onSwitchTab:S,areFolders:!0}):E?i.ZP.createElement("div",{className:(0,Fe.Z)("tabs-placeholder",R)}):void 0,i.ZP.createElement(ut.Z,{ref:v,name:u?"none":I.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:N?b.length:void 0},k))})));var At=n(34288);const xt=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)})),Bt=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)}));var Lt=n(52328);const Ot=(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,mt.Z)(),l=(0,Fe.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(yt.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(Lt.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},i.ZP.createElement(wt.Z,{icon:"channel",onClick:s},c("NewChannel")),i.ZP.createElement(wt.Z,{icon:"group",onClick:a},c("NewGroup")),i.ZP.createElement(wt.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),Ut=Object.keys(m.du).length/2;let Ft;const qt=(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,Ye.Z)(c),w=(0,i.sO)(!1),y=(0,i.I4)((()=>{t===m.du.ChatList&&(w.current=!0,f(!0))}),[t]),Z=(0,i.I4)((()=>{w.current=!1,Ft&&(clearTimeout(Ft),Ft=void 0),Ft=window.setTimeout((()=>{w.current||f(!1)}),250)}),[]),P=(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()}),[]),M=(0,i.I4)((()=>{d(m.du.NewChannelStep1)}),[d]),E=(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,mt.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:y,onMouseLeave:h.$b?void 0:Z},i.ZP.createElement(Et,{content:t,contactsFilter:a,onSearchQuery:l,onSelectSettings:P,onSelectContacts:C,onSelectArchived:b,onReset:g,shouldSkipTransition:o}),i.ZP.createElement(ut.Z,{name:o?"none":"zoom-fade",renderCount:Ut,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return i.ZP.createElement(Tt,{onScreenSelect:u,foldersDispatch:r});case m.du.GlobalSearch:return i.ZP.createElement(xt,{searchQuery:n,searchDate:s,isActive:e,onReset:g});case m.du.Contacts:return i.ZP.createElement(Bt,{filter:a,isActive:e,onReset:g});default:return}})),v&&i.ZP.createElement(yt.Z,{fluid:!0,pill:!0,className:(0,Fe.Z)("btn-update",I),onClick:S},R("lng_update_telegram")),i.ZP.createElement(Ot,{isShown:p,onNewPrivateChat:C,onNewChannel:M,onNewGroup:E}))})),Dt=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)})),$t=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)})),jt=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)}));var Gt;!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"}(Gt||(Gt={}));const Ht=Object.keys(Gt).length/2,Vt=(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:Z,resetLeftColumnWidth:P,openChat:C,requestNextSettingsScreen:b}=(0,s.Sv)(),S=(0,i.sO)(null),[M,E]=(0,i.eJ)(m.du.ChatList),[R,k]=(0,i.eJ)(m.MT.Main),[N,T]=(0,i.eJ)(""),[A,x]=(0,ct.ZP)(),[B,L]=(0,i.eJ)(0);let O=Gt.Main;switch(M){case m.du.Archived:O=Gt.Archived;break;case m.du.Settings:O=Gt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:O=Gt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:O=Gt.NewGroup}const U=(0,i.I4)((e=>{function t(){E(m.du.ChatList),T(""),p({query:""}),I({date:void 0}),f({id:void 0}),v(),setTimeout((()=>{L(Date.now())}),250)}if(!0!==e)if(M!==m.du.NewGroupStep2)if(M!==m.du.NewChannelStep2){if(M===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(M===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 E(m.du.ChatList),void k(m.MT.Main);case m.MT.QuickReaction:case m.MT.CustomEmoji:return void k(m.MT.Stickers)}M===m.du.ChatList&&a?E(m.du.GlobalSearch):t()}else E(m.du.NewChannelStep1);else E(m.du.NewGroupStep1);else t()}),[M,a,R,p,I,f,v,l]),F=(0,i.I4)((e=>{M!==m.du.Contacts?(E(m.du.GlobalSearch),e!==t&&p({query:e})):T(e)}),[M,t,p]);(0,i.d4)((()=>M!==m.du.ChatList||a&&!u?(0,rt.Z)((()=>U())):void 0),[a,M,U,u]);const q=(0,i.I4)((e=>{M!==m.du.GlobalSearch&&(e.preventDefault(),E(m.du.GlobalSearch))}),[M]),D=(0,i.I4)((e=>{e.preventDefault(),C({id:c,shouldReplaceHistory:!0})}),[c,C]),$=(0,i.I4)((e=>{e.preventDefault(),E(m.du.Settings)}),[]);(0,dt.y)({"Mod+Shift+F":q,"Mod+Shift+S":D,"Mod+0":D,...h.jm&&h.fl&&{"Mod+,":$}}),(0,i.d4)((()=>{y(),R===m.MT.Privacy&&w()}),[y,w,R]),(0,He.Z)((()=>{d&&(E(m.du.Settings),k(d),b(void 0))}),[d,b]);const{initResize:j,resetResize:G,handleMouseUp:H}=function(e,t,n,s){const[a,o,r]=(0,lt.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,Z,P,r),V=(0,i.I4)((e=>{E(m.du.Settings),k(e)}),[]);return i.ZP.createElement("div",{id:"LeftColumn",ref:S},i.ZP.createElement(ut.Z,{name:o?"none":h.s0,renderCount:Ht,activeKey:O,shouldCleanup:!0,cleanupExceptionKey:Gt.Main},(e=>{switch(O){case Gt.Archived:return i.ZP.createElement(jt,{isActive:e,onReset:U,onContentChange:E});case Gt.Settings:return i.ZP.createElement(Dt,{isActive:e,currentScreen:R,foldersState:A,foldersDispatch:x,onScreenSelect:V,onReset:U,shouldSkipTransition:o});case Gt.NewChannel:return i.ZP.createElement($t,{key:B,isActive:e,isChannel:!0,content:M,onContentChange:E,onReset:U});case Gt.NewGroup:return i.ZP.createElement($t,{key:B,isActive:e,content:M,onContentChange:E,onReset:U});default:return i.ZP.createElement(qt,{content:M,searchQuery:t,searchDate:n,contactsFilter:N,foldersDispatch:x,onContentChange:E,onSearchQuery:F,onScreenSelect:V,onReset:U,shouldSkipTransition:o,isUpdateAvailable:g})}})),i.ZP.createElement("div",{className:"resize-handle",onMouseDown:j,onMouseUp:H,onDoubleClick:G}))})));var _t=n(12420),zt=n(49524),Wt=n(71394);var Xt=n(12255),Jt=n(52678),Yt=n(87204),Kt=n(3570),Qt=n(75790),en=n(18360),tn=n(6058),nn=n(98799);const sn=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"HeaderMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),an=(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)),Z=Boolean(f&&(m||(0,d.ZV)(u))&&u.isNotJoined),P=f||v,C=h.Bi&&(0,d.YC)(u.id)&&!p&&!g,b=f&&!p&&!Z,S=f&&!Z,M=h.Bi&&u.isCallActive,E=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:Z,canSearch:P,canCall:C,canMute:b,canViewStatistics:null===(s=u.fullInfo)||void 0===s?void 0:s.canViewStatistics,canLeave:S,canEnterVoiceChat:M,canCreateVoiceChat:E,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:Z,shouldJoinToSend:P,shouldSendJoinRequest:C}=e;const{joinChannel:b,sendBotCommand:S,openLocalTextSearch:M,restartBot:E,requestCall:R,requestNextManagementScreen:k,showNotification:N}=(0,s.Sv)(),T=(0,i.sO)(null),A=(0,mt.Z)(),[x,B]=(0,i.eJ)(!1),[L,O]=(0,i.eJ)(void 0),U=(0,i.I4)((()=>{B(!0);const e=T.current.getBoundingClientRect();O({x:e.right,y:e.bottom})}),[]),F=(0,i.I4)((()=>{B(!1)}),[]),q=(0,i.I4)((()=>{O(void 0)}),[]),D=(0,i.I4)((()=>{b({chatId:t}),C&&N({message:A(o?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[b,t,C,N,o,A]),$=(0,i.I4)((()=>{S({command:"/start"})}),[S]),j=(0,i.I4)((()=>{E({chatId:t})}),[t,E]),G=(0,i.I4)((()=>{k({screen:m.u1.JoinRequests})}),[k]),H=(0,i.I4)((()=>{M(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[M]),V=(0,i.I4)((e=>{d&&h.fl&&!e.shiftKey&&(e.preventDefault(),H())}),[d,H]);return(0,dt.y)({"Mod+F":V}),i.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&i.ZP.createElement(i.ZP.Fragment,null,Z&&!C&&(l||P)&&i.ZP.createElement(yt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:D},A(o?"ProfileJoinChannel":"ProfileJoinGroup")),Z&&C&&i.ZP.createElement(yt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:D},A("ChannelJoinRequest")),Z&&r&&i.ZP.createElement(yt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:$},A("BotStart")),Z&&c&&i.ZP.createElement(yt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:j},A("BotRestart")),d&&i.ZP.createElement(yt.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(yt.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(yt.Z,{round:!0,className:"badge-button",ripple:y,color:"translucent",size:"smaller",onClick:G,ariaLabel:A(o?"SubscribeRequests":"MemberRequests")},i.ZP.createElement("i",{className:"icon-user"}),i.ZP.createElement("div",{className:"badge"},w)),i.ZP.createElement(yt.Z,{ref:T,className:x?"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(sn,{chatId:t,threadId:n,isOpen:x,anchor:L,withExtraActions:h.wB||!Z,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:F,onCloseAnimationEnd:q}))})));var on=n(74399),rn=n(996),cn=n(6202),ln=n(2903),dn=n(68512),un=n(17551);function mn(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 hn=(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=mn(0,0,2,t,1)+mn(0,12,2,t+1,1)+mn(0,25,2,t,1);else for(let e=0;e<n;e++)s+=mn(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,Fe.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);`})))})),gn=(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,mt.Z)(),p=(0,ln.Z)(t),f=(0,cn.Z)((0,d.Ti)(t,"pictogram")),v=(0,rn.e)(g,t,Boolean(p)),[I,w,y]=(0,lt.Z)(),Z=(0,i.I4)((()=>{y(),c&&c(t.id)}),[y,c,t.id]),P=(0,d.eH)(t),C=(0,i.I4)((()=>{P&&m({messageId:t.id,button:P})}),[m,P,t.id]),[b,S,M]=(0,lt.Z)();return i.ZP.createElement("div",{className:(0,Fe.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&i.ZP.createElement(yt.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(yt.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(un.Z,{isOpen:I,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:Z}),i.ZP.createElement("div",{className:(0,Fe.Z)("HeaderPinnedMessage",b&&"no-hover"),onClick:l,dir:g.isRtl?"rtl":void 0},i.ZP.createElement(hn,{count:n,index:a}),p&&function(e,t){const{width:n,height:s}=(0,on.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(dn.Z,null)),P&&i.ZP.createElement(yt.Z,{size:"tiny",className:"inline-button",onClick:C,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:S,onMouseLeave:h.$b?void 0:M},P.text)))}));var pn=n(10396),fn=n(64532),vn=n(23186),In=n(75851);const wn=240;function yn(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=()=>{Zn(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 Zn(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return Pn(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,In.ix)(e.src),o=(0,In.rZ)(i)<wn?"#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 Pn(e,t,n,void 0,s)}}async function Pn(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,In.ix)(e.src),d=(0,In.rZ)(l)<wn?"#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 Cn=n(77510);const bn=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Sn={width:200,height:200},Mn=115;var En=n(32340),Rn=n(18051);const kn=(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,mt.Z)(),{audio:y,voice:Z,video:P}=(0,d.qp)(t),C=Boolean(Z||P),b=C||((null==y?void 0:y.duration)||0)>a.J0,S=r?(0,d.OU)(w,r):void 0,M=ge.UV((0,d.Ti)(t,"inline")),E=((e,t,n)=>{const s=(0,mt.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,cn.Z)(h),p=(0,i.Ye)((()=>function(e,t,n){if(!n)return Sn;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?on.vY:void 0}(a,o,g)),[a,g,o]),{result:f}=(0,Cn.Z)((()=>function(e,t){if(!e)return Promise.resolve(bn);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=()=>{Zn(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,Mn,Mn);const n=Math.min(t.width,t.height);return n<Mn?yn(e,Mn/n):Promise.resolve(e)}(g,p)),[g,p],bn);return(0,i.Ye)((()=>(0,fn.Of)({title:r,artist:c,album:l,artwork:[{src:f}]})),[l,c,r,f])})(t,r,c),{playPause:R,stop:k,isPlaying:N,requestNextTrack:T,requestPreviousTrack:A,isFirst:x,isLast:B,setVolume:L,toggleMuted:O,setPlaybackRate:U}=(0,vn.Z)((0,pn.An)(t),(0,d.XV)(t),C?"voice":"audio",M,void 0,E,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),F=C&&N;(0,i.d4)((()=>{if(F)return we.Z.disableRefresh(),()=>{we.Z.enableRefresh()}}),[F]);const q=(0,i.I4)((()=>{v({chatId:t.chatId,messageId:t.id})}),[v,t.chatId,t.id]),D=(0,i.I4)((()=>{N&&R(),I(),(0,fn.Ay)(),k()}),[I,N,R,k]),$=(0,i.I4)((e=>{g({volume:e/100}),L(e/100)}),[g,L]),j=(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,Fe.Z)("AudioPlayer",n),dir:w.isRtl?"rtl":void 0},i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:q},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,En.Z)(t||s)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,En.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,En.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(w("AttachAudio"),S),i.ZP.createElement(dn.Z,null)),i.ZP.createElement(yt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:x(),onClick:A,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon-skip-previous"})),i.ZP.createElement(yt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,Fe.Z)("toggle-play","player-button",N?"pause":"play"),onClick:R,ariaLabel:N?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon-play"}),i.ZP.createElement("i",{className:"icon-pause"})),i.ZP.createElement(yt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:B(),onClick:T,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon-skip-next"})),i.ZP.createElement(yt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},i.ZP.createElement("i",{className:H,onClick:j}),!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(Rn.Z,{bold:!0,value:m?0:100*l,onChange:$})))),b&&i.ZP.createElement(yt.Z,{round:!0,className:(0,Fe.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(yt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:D,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var Nn=n(70172);const Tn=(0,i.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),a=(0,Ue.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,mt.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,Fe.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(Nn.Z,{key:e.user.id,user:e.user,animationLevel:l}):i.ZP.createElement(Nn.Z,{key:e.chat.id,chat:e.chat,animationLevel:l})}))),i.ZP.createElement(yt.Z,{round:!0,className:"join"},m("VoipChatJoin")))})));var An=n(14605);const xn=(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,mt.Z)(),[y,Z,P]=(0,lt.Z)(),[C,b]=(0,i.eJ)(!0),[S,M]=(0,i.eJ)(!0),{accessHash:E}=a||{},{isAutoArchived:R,canReportSpam:k,canAddContact:N,canBlockContact:T}=r||{},A=a&&(0,d.G9)(a),x=(0,i.I4)((()=>{l({userId:t}),R&&v({chatId:t})}),[l,R,v,t]),B=(0,i.I4)((()=>{P(),u({contactId:t,accessHash:E}),k&&C&&m({chatId:t}),S&&h({chatId:t})}),[E,u,P,h,m,k,S,C,t]),L=(0,i.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,i.I4)((()=>{P(),m({chatId:t}),A?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,P,c,p,f,A,g,m]);if(r)return i.ZP.createElement("div",{className:(0,Fe.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},N&&i.ZP.createElement(yt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),T&&i.ZP.createElement(yt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_new_contact_block")),k&&!T&&i.ZP.createElement(yt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_report_spam_and_leave")),i.ZP.createElement(yt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(un.Z,{isOpen:y,onClose:P,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?B:O},o&&i.ZP.createElement(An.Z,{label:w("DeleteThisChat"),checked:S,onCheck:M}),o&&k&&i.ZP.createElement(An.Z,{label:w("ReportChat"),checked:C,onCheck:b})))}))),Bn=(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)),Z=Boolean(v&&u&&((0,d.eA)(u)||(0,d.ZV)(u))&&u.isNotJoined),P=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||Z||P},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:Z,isChatWithSelf:P,lastSyncTime:C,hasButtonInHeader:b,shouldSkipHistoryAnimations:S,currentTransitionKey:M,connectionState:E,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:A,openPreviousChat:x,loadPinnedMessages:B,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,s.Sv)(),U=(0,mt.Z)(),F=(0,i.sO)(!0),[q,D]=(0,i.eJ)(0),$=Array.isArray(l)?l[q]:l,j=u&&$?u[$]: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&&B({chatId:t})}),[t,B,C,n,c]),(0,i.d4)((()=>{D(0)}),[l]),(0,Qt.Z)(t,$,j);const{width:z}=(0,Xt.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=>{N({chatId:t,messageId:e,isUnpin:!0})}),[N,t]),ee=(0,i.I4)((()=>{if(j){T({chatId:j.chatId,threadId:n,messageId:j.id});const e=(0,Kt.Z)(G||1,q+1);D(e)}}),[j,T,n,G,q]),te=(0,i.I4)((()=>{A({id:t,threadId:o._f,type:"pinned"})}),[A,t]),ne=(0,i.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),se=(0,i.I4)((e=>{if(F.current){if(F.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===M)return h.wB||X?(e.stopPropagation(),A({id:void 0},{forceOnHeavyAnimation:!0})):L(),void ne();x(),ne()}}),[n,r,M,f,x,X,A,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,Ye.Z)(oe),le=(0,en.Z)(oe?_:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,Ye.Z)(Boolean(w)),me=(0,en.Z)(w,!0),{shouldRender:he,transitionClassNames:ge}=(0,Ye.Z)(Boolean(j)),pe=(0,en.Z)(j,!0),fe=(0,en.Z)(G,!0),ve=(0,en.Z)(m,!0),Ie=(0,en.Z)(V),we=he&&pe||de&&me;(0,i.d4)((()=>{const e=J.current;if(e)return ie&&we?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,we,ae,I]);const{connectionStatusText:ye}=ft(U,E,R,!0);function Ze(){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(yt.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:U(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,Fe.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(ot,null))}const Pe=Boolean(de&&me),Ce=Pe||!h.wB&&b&&z<a.sg;return i.ZP.createElement("div",{className:"MiddleHeader",ref:J},i.ZP.createElement(ut.Z,{name:S?"none":"slide-fade",activeKey:M},"thread"===r&&n===o._f?i.ZP.createElement(i.ZP.Fragment,null,(W||M>0)&&Ze(X,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:K},(0,d.YC)(t)?i.ZP.createElement(tn.Z,{userId:t,typingStatus:p,status:ye,withDots:Boolean(ye),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0}):i.ZP.createElement(nn.Z,{chatId:t,typingStatus:p,status:ye,withDots:Boolean(ye),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0}))):"thread"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,U("CommentsCount",Z,"i"))):"pinned"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,U("PinnedMessagesCount",Z,"i"))):"scheduled"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,P?U("Reminders"):U("messages",Z,"i"))):void 0),i.ZP.createElement(Tn,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&i.ZP.createElement(gn,{key:t,message:pe,count:fe||0,index:q,customTitle:Ie,className:(0,Fe.Z)(ge,Ce&&"full-width"),onUnpinMessage:ve?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&i.ZP.createElement(xn,{key:t,chatId:t,settings:le,className:ce}),i.ZP.createElement("div",{className:"header-tools"},Pe&&i.ZP.createElement(kn,{key:(0,d.Tp)(me),message:me,className:ue}),i.ZP.createElement(an,{chatId:t,threadId:n,messageListType:r,canExpandActions:!Pe})))})));function Ln(e){return"albumId"in e}function On(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 Un=n(30386),Fn=n(87675),qn=n(60539),Dn=n(88957);var $n=n(60998);var jn=n(72645),Gn=n(3657);const Hn=h.wZ?1e3:350,Vn=h.wB?300:500;var _n=n(17240);function zn(e){return"number"==typeof e}function Wn(e,t){return e?t?238:175:t?238:100}function Xn(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,on.Eh)(a,n,s,o,t):(0,on.GC)(i,n,s,t),l=Wn(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 Jn=n(28712);function Yn(e,t){return e.reduce(((e,t)=>e+t),t)}function Kn(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 Qn(e,t,n,s){const a=function(e){return e.map((e=>{const t=Xn(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,on.kc)(e,t,!1,n)-(t?2.5:0)*on.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,Jn.uZ)(e,1,2.75):(0,Jn.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=Yn(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=Yn(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:Kn(d)}}let es,ts;function ns(e){return ts||(ts=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),es||(es=document.createElement("span"),es.style.font=`400 12px ${ts}`,es.style.whiteSpace="nowrap",es.style.position="absolute",es.style.left="-999px",es.style.opacity=".01",document.body.appendChild(es)),es.innerHTML=e,es.offsetWidth}function ss(e,t,n,s,a,o){(0,i.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,qn.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 as=n(3858);const is=3*on.Gw,os=Number(on.Gw),rs="data-is-document-group-hover";function cs(e,t,n,a,o,r,c,l,d,u,m,g,p,f){const{setReplyingToId:v,sendDefaultReaction:I}=(0,s.Sv)(),[w,y,Z]=(0,lt.Z)(),[P,C,b]=(0,lt.Z)(),S=(0,i.sO)();return(0,i.d4)((()=>{if(!h.$b||o||!r||m)return;let e;return(0,Rt.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===Rt.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,Un.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;we.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:o?c?as.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)<is,l=Math.abs(o+r-s)<os;c&&l?y():Z()},handleSendQuickReaction:function(e){const{x:t,y:s}=e.currentTarget.getBoundingClientRect();I({chatId:u,messageId:n,x:t,y:s})},handleMouseLeave:function(e){Z(),f&&function(e){const t=ds(e.currentTarget);t&&t.removeAttribute(rs)}(e)},isSwiped:P,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:ls}}function ls(e){const t=ds(e.currentTarget);t&&t.setAttribute(rs,"")}function ds(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var us=n(55254),ms=n(18005);const hs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0}));var gs=n(45601);const ps=(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:Z}=e;const{openPremiumModal:P,requestConfetti:C}=(0,s.Sv)(),b=(0,mt.Z)(),S=(0,i.sO)(null);(0,Gn._N)(S,a),(0,Qt.Z)(n.chatId,n.replyToMessageId,p),ss(S,n.chatId,v,I,w);const M=c<=0,[E,R]=(0,lt.Z)(M),k=Boolean(null===(t=n.content.action)||void 0===t?void 0:t.text.startsWith("ActionGift"));(0,i.d4)((()=>{M||setTimeout(R,10*c)}),[c,R,M]);const N=(0,Gn.Op)(S,o),T=(0,i.sO)((()=>{const e=(null==Z?void 0:Z.current)&&n.id>=Z.current;return k&&!n.isOutgoing&&e})());(0,i.d4)((()=>{N&&T.current&&(T.current=!1,C())}),[N,C]);const{transitionClassNames:A}=(0,Ye.Z)(E,void 0,M,!1),x=(0,i.Ye)((()=>g?g.map((e=>null==u?void 0:u[e])).filter(Boolean):void 0),[g,u]),B=(0,ms.D)(b,n,m,h,x,p,f,{asTextWithSpoilers:r}),{isContextMenuOpen:L,contextMenuPosition:O,handleBeforeContextMenu:U,handleContextMenu:F,handleContextMenuClose:q,handleContextMenuHide:D}=(0,_n.Z)(S),$=void 0!==O;if(r)return i.ZP.createElement("span",{className:"embedded-action-message"},B);const j=(0,Fe.Z)("ActionMessage message-list-item",v&&!w&&"focused",k&&"premium-gift",$&&"has-menu-open",l&&"last-in-list",A);return i.ZP.createElement("div",{ref:S,id:(0,d.d0)(n.id),className:j,"data-message-id":n.id,onMouseDown:e=>{(0,Un.q)(e),U(e)},onContextMenu:F},i.ZP.createElement("span",null,B),k&&i.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{var e;P({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(gs.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(hs,{isOpen:L,anchor:O,message:n,messageListType:"thread",onClose:q,onCloseAnimationEnd:D}));var G}))),fs=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,Gn.Op)(g,m),f=(0,cn.Z)(s&&(0,d.Ti)(s,"pictogram"),!p),v=(0,ln.Z)(s),I=Boolean(s&&(0,d.Y5)(s)),w=(0,mt.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,Fe.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,on.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(ps,{message:s,isEmbedded:!0}):(0,rn.e)(w,s,Boolean(v)):r||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,En.Z)(y||o||" "))),u&&i.ZP.createElement("i",{className:"embedded-more icon-more"}))};var vs=n(82535),Is=n(54752),ws=n(8018),ys=n(48198),Zs=n(97799);const Ps=(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=(0,cn.Z)(`sticker${u}`,!u),g=(0,cn.Z)(`sticker${m}`,!m),p=Boolean((null==o?void 0:o.reaction)===a&&h&&g),{shouldRender:f,transitionClassNames:v}=(0,Ye.Z)(p,void 0,!0,"slow"),I=(0,i.I4)((()=>{l({messageId:null==o?void 0:o.messageId,reaction:a})}),[null==o?void 0:o.messageId,a,l]),[w,y,Z]=(0,lt.Z)(),P=!p||!w,C=(0,Fe.Z)("ReactionAnimatedEmoji",r&&"in-meta",f&&"is-animating");return i.ZP.createElement("div",{className:C},P&&i.ZP.createElement(ys.Z,{reaction:a}),f&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Zs.Z,{key:u,className:v,size:30,tgsUrl:h,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:y,onEnded:Z}),i.ZP.createElement(Zs.Z,{key:m,className:(0,Fe.Z)("effect",v),size:100,tgsUrl:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:I})))})),Cs=(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,mt.Z)(),[h,g]=(0,lt.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,Fe.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:o},p&&p.map((e=>i.ZP.createElement(Ps,{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,st.bi)(n.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),a&&i.ZP.createElement("span",{className:"message-signature"},(0,En.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(ws.Z,{status:s}))}));var bs=n(74753),Ss=n(70692);const Ms=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,mt.Z)(),v=(0,i.sO)(null),I=t.content.sticker,{isLottie:w,stickerSetInfo:y,isVideo:Z,hasEffect:P}=I,C=h.Hh,b="isMissing"in y,[S,M,E]=(0,lt.Z)(),R=(0,Gn.Op)(v,n),k=(0,Gn.Op)(v,a),N=I.isPreloadedGlobally?`sticker${I.id}`:(0,d.Ti)(t,"inline"),T=`sticker${I.id}?size=f`,A=Z&&!C&&(I.isPreloadedGlobally?`sticker${I.id}?size=m`:(0,d.Ti)(t,"pictogram")),x=(0,cn.Z)(A),B=(0,ln.Z)(I),L=x||B,O=(0,cn.Z)(N,!R,(0,d.kG)(t,"inline"),c),U=(0,cn.Z)(T,!R||!P,o.IU.BlobUrl,c),F=Boolean(O),[q,D]=(0,lt.Z)(F),$=w?q:F,j=(0,Ss.Z)($),{width:G,height:H}=(0,on.Wr)(I),V=(0,Fe.Z)("thumbnail",!B&&"empty"),_=(0,Fe.Z)("Sticker media-inner",b&&"inactive",P&&!t.isOutgoing&&"reversed"),z=(0,i.I4)((()=>{E(),null==m||m()}),[m,E]);(0,i.d4)((()=>{if(!Z||!v.current)return;const e=v.current.querySelector("video");e&&(k?(0,bs.Z)(e):e.pause())}),[Z,k]),(0,i.d4)((()=>{P&&k&&l&&(M(),null==u||u())}),[P,l,u,k,M]);const W=(0,i.I4)((()=>{p({stickerSetInfo:I.stickerSetInfo})}),[p,I]),X=(0,i.I4)((()=>{if(P)return S?void g({message:f("PremiumStickerTooltip"),action:W,actionText:f("ViewAction")}):(M(),void(null==u||u()));W()}),[P,S,f,u,W,g,M]);return i.ZP.createElement("div",{ref:v,className:_,onClick:b?void 0:X},(!$||Z&&!C)&&i.ZP.createElement("img",{src:L,width:G,height:H,alt:"",className:V}),!w&&!Z&&i.ZP.createElement("img",{src:O,width:G,height:H,alt:"",className:(0,Fe.Z)("full-media",j)}),Z&&C&&$&&i.ZP.createElement("video",{src:O,width:G,height:H,autoPlay:k,playsInline:!0,disablePictureInPicture:!0,loop:r,muted:!0}),w&&F&&i.ZP.createElement(Zs.Z,{key:N,className:(0,Fe.Z)("full-media",j),tgsUrl:O,size:G,play:k,noLoop:!r,onLoad:D}),P&&R&&S&&i.ZP.createElement(Zs.Z,{key:T,className:"effect-sticker",tgsUrl:U,size:1.49*G,play:!0,isLowPriority:!0,noLoop:!0,onEnded:z}))};var Es=n(13365);var Rs=n(21179);const ks=(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:a,forceLoadPreview:o,messageId:r,chatId:l,activeEmojiInteractions:d,sticker:u,effect:m,localSticker:h,localEffect:g,soundId:p}=e;const{ref:f,size:v,style:I,handleClick:w}=function(e,t,n,a,o,r,l){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:u,sendWatchingEmojiInteraction:m}=(0,s.Sv)(),h=r||l,g=(0,i.sO)(null),p=(0,i.sO)(null),f=(0,cn.Z)(n?`document${n}`:void 0,!n),v=(0,i.sO)(void 0),I=(0,i.sO)(void 0),w=(0,i.I4)((()=>{g.current&&(u({chatId:e,messageId:t,localEffect:r,emoji:l,interactions:v.current}),I.current=void 0,v.current=void 0)}),[u,e,t,r,l]),y=(0,i.I4)((()=>{const e=p.current;f&&(e&&(e.pause(),e.remove()),p.current=new Audio,p.current.src=f,(0,bs.Z)(p.current),p.current.addEventListener("ended",(()=>{p.current=void 0}),{once:!0}))}),[f]),Z=(0,i.I4)((()=>{y();const n=g.current;if(!(h&&n&&t&&e))return;const{x:s,y:a}=n.getBoundingClientRect();d({localEffect:r,emoji:l,x:s,y:a,startSize:104,isReversed:!o}),v.current||(v.current=[],I.current=performance.now(),setTimeout(w,1e3)),v.current.push(I.current?(performance.now()-I.current)/1e3:0)}),[e,l,h,d,o,r,t,y,w]);return(0,i.d4)((()=>{const n=g.current;n&&a&&a.forEach((s=>{let{id:a,startSize:i,messageId:d}=s;if(i||t!==d)return;const{x:u,y:h}=n.getBoundingClientRect();m({id:a,chatId:e,emoticon:r?(0,c.ji)(r):l,startSize:104,x:u,y:h,isReversed:!o}),y()}))}),[a,e,l,o,r,t,y,m]),{ref:g,size:104,style:"width: 104px; height: 104px;",handleClick:Z}}(l,r,p,d,t,g,null==m?void 0:m.emoji),y=(0,Gn.Op)(f,n);return h?i.ZP.createElement(Rs.Z,{tgsUrl:Es.l[h],size:v,quality:1,play:y,forceOnHeavyAnimation:!0,ref:f,className:"AnimatedEmoji media-inner",style:I,onClick:w}):i.ZP.createElement(gs.Z,{sticker:u,size:v,quality:1,noLoad:!y,forcePreview:o,lastSyncTime:a,play:y,forceOnHeavyAnimation:!0,ref:f,className:(0,Fe.Z)("AnimatedEmoji media-inner",(null==u?void 0:u.id)===on.wB&&"like-sticker-thumb"),style:I,onClick:w})})));var Ns=n(92566),Ts=n(15866);function As(e,t){return(0,Ts.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const xs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Bs(e,t,n,s,a){return s?Promise.resolve(xs[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 Ls=n(39196);const Os=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:Z}=e;const P=(0,i.sO)(null),C=((0,d.O$)(n)||(0,d.F$)(n)).blobUrl,b=(0,Gn.Op)(P,s),[S,M]=(0,i.eJ)(r),E=S&&b,{mediaData:R,loadProgress:k}=(0,Ns.Z)((0,d.Ti)(n,m),!E),N=C||R,T=As(n,N),{loadProgress:A}=(0,Ns.Z)((0,d.Ti)(n,"download"),!f,(0,d.kG)(n,"download")),{isUploading:x,isTransferring:B,transferProgress:L}=(0,d.Sc)(n,u||(f?A:k),E&&!N),O=!1===(0,Yt.Z)(S),U=(0,Ss.Z)(N),{shouldRender:F,transitionClassNames:q}=(0,Ye.Z)(B,void 0,O,"slow"),{shouldRender:D,transitionClassNames:$}=(0,Ye.Z)(!N&&!S),j=(0,i.I4)((()=>{x?Z&&Z(n):N?y&&y(n.id):M((e=>!e))}),[N,x,n,Z,y]),G=(0,d.B4)(n);(0,i.bt)((()=>{if(!p)return;const e=P.current.closest(".message-content");N?Bs(N,G,0,l,w).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")})):e.classList.add("has-appendix-thumb")}),[N,G,p,c,l,w]);const{width:H,height:V,isSmall:_}=h||Xn(n,o),z=(0,Fe.Z)("media-inner",!x&&!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:P,className:z,style:X,onClick:x?void 0:j},i.ZP.createElement("canvas",{ref:T,className:"thumbnail",style:`width: ${H}px; height: ${V}px;${W}`}),i.ZP.createElement("img",{src:N,className:`full-media ${U}`,width:H,height:V,alt:"",draggable:!v}),v&&i.ZP.createElement("span",{className:"protector"}),F&&!D&&i.ZP.createElement("div",{className:`media-loading ${q}`},i.ZP.createElement(Ls.Z,{progress:L,onClick:x?j:void 0})),D&&i.ZP.createElement("i",{className:(0,Fe.Z)("icon-download",$)}),B&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*L),"%"))};var Us=n(12019),Fs=n(46898),qs=n(21747);function Ds(){return Ds=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},Ds.apply(this,arguments)}const $s=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),Z=(0,d.b7)(a)||(0,d.Cg)(a),P=Z.blobUrl,C=(0,Gn.Op)(w,o),[b,S]=(0,i.eJ)(c),M=Boolean(b&&C&&m),[E,R]=(0,i.eJ)(l),k=(0,cn.Z)((0,d.Ti)(a,"pictogram"),!(C&&m),(0,d.kG)(a,"pictogram"),m),N=(0,Ss.Z)(k),{mediaData:T,loadProgress:A}=(0,Ns.Z)((0,d.Ti)(a,"inline"),!M,(0,d.kG)(a,"inline"),m),x=P||T,B=Boolean(C&&x),L=As(a,k),{loadProgress:O}=(0,Ns.Z)((0,d.Ti)(a,"download"),!f,(0,d.kG)(a,"download"),m),{isBuffered:U,bufferingHandlers:F}=(0,Us.Z)(!c),{isUploading:q,isTransferring:D,transferProgress:$}=(0,d.Sc)(a,u||(f?O:A),M&&!U||f),j=!1===(0,Yt.Z)(b),{shouldRender:G,transitionClassNames:H}=(0,Ye.Z)(D,void 0,j),{shouldRender:_,transitionClassNames:z}=(0,Ye.Z)(b&&!E&&!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)||Z.duration||0,K=(0,d.B4)(a),Q=(0,d.MF)(a),{width:ee,height:te}=h||(0,on.GC)(Z,K,Q,r);(0,qs.Z)(y,B),(0,Fs.Z)(y,[B]);const ne=(0,i.I4)((()=>{q?p&&p(a):f?(0,s.Sv)().cancelMessageMediaDownload({message:a}):x?x&&!E?(R(!0),y.current.play()):g&&g(a.id):S((e=>!e))}),[q,f,x,E,g,p,a]),se=(0,Fe.Z)("media-inner dark",!q&&"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:q?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,Fe.Z)("thumbnail",N),style:`width: ${ee}px; height: ${te}px;${ae}`,alt:"",draggable:!v}),B&&i.ZP.createElement("video",Ds({ref:y,className:"full-media",width:ee,height:te,autoPlay:E,muted:!0,loop:!0,playsInline:!0},F,{draggable:!v,onTimeUpdate:J,style:ae}),i.ZP.createElement("source",{src:x})),v&&i.ZP.createElement("span",{className:"protector"}),_&&i.ZP.createElement("i",{className:(0,Fe.Z)("icon-large-play",z)}),G&&i.ZP.createElement("div",{className:(0,Fe.Z)("media-loading",H)},i.ZP.createElement(Ls.Z,{progress:$,onClick:ne})),!b&&i.ZP.createElement("i",{className:"icon-download"}),D?i.ZP.createElement("span",{className:"message-transfer-progress"},q||f?`${Math.round(100*$)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,V.k9)(Math.max(Y-W,0))))};var js=n(6272);const Gs=(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,Fe.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},i.ZP.createElement(Nn.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,js.WZ)(a,d))))}));var Hs=n(13049),Vs=n(51218),_s=n(14434),zs=n(96937);function Ws(e,t){return t>0?(e/t*100).toFixed():0}const Xs=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?Ws(c.votersCount,s||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),p=c?Ws(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,Fe.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,En.Z)(t.text)),i.ZP.createElement("div",{className:(0,Fe.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 Js(e){e.stopPropagation()}const Ys=(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,Z]=(0,i.eJ)(!1),[P,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),M=(0,i.sO)(null),{results:E,totalVoters:R}=p,k=E&&E.some((e=>e.isChosen)),N=!g.closed&&!k,T=!N&&g.isPublic&&Number(p.totalVoters)>0,A=N&&g.multipleChoice,x=E?Math.max(...E.map((e=>e.votersCount))):R,B=E?E.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=M.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)}}),[N,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]),F=(0,i.I4)((e=>{w(e)}),[]),q=(0,i.I4)((()=>{v(!0),C(!0),r(I)}),[r,I]),D=(0,i.I4)((()=>{d({chatId:h,messageId:m})}),[h,m,d]),$=(0,i.I4)((()=>{Z(!0)}),[]),j=(0,i.I4)((()=>{Z(!1),C(!1)}),[]);(0,i.d4)((()=>{P&&k&&g.quiz&&p.results&&n.results.solution&&(p.results.find((e=>e.isChosen&&e.isCorrect))||Z(!0))}),[k,P,p.results,g.quiz,n.results.solution]);const G=(0,mt.Z)();return i.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&i.ZP.createElement(zs.Z,{message:(0,Hs.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,En.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(Nn.Z,{size:"micro",user:e})))),b>0&&N&&i.ZP.createElement("div",{ref:M,className:"poll-countdown"}),g.quiz&&n.results.solution&&!N&&i.ZP.createElement(yt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:$,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon-lamp"}))),N&&i.ZP.createElement("div",{className:"poll-answers",onClick:Js},A?i.ZP.createElement(Vs.Z,{options:L,onChange:F,disabled:t.isScheduled||f,loadingOptions:f?I:void 0,round:!0}):i.ZP.createElement(_s.Z,{name:`poll-${m}`,options:L,onChange:U,disabled:t.isScheduled||f,loadingOption:f?I[0]:void 0})),!N&&i.ZP.createElement("div",{className:"poll-results"},g.answers.map((function(e){return i.ZP.createElement(Xs,{key:e.option,shouldAnimate:P||!N,answer:e,voteResults:E,totalVoters:R,maxVotersCount:x,correctResults:B})}))),!T&&!A&&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)),A&&i.ZP.createElement(yt.Z,{isText:!0,disabled:0===I.length,size:"tiny",onClick:q},G("PollSubmitVotes")),T&&i.ZP.createElement(yt.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var Ks=n(48035),Qs=n(10088);const ea=(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:Z,photo:P,video:C}=p,b=(0,Ks.Z)(Z,170),S=Boolean(b||y||v);let M=!1;if(S&&null!=p&&p.photo&&!p.video){const{width:e,height:n}=Xn(t);M=e===n}const E=(P||C)&&h&&!M,R=(0,Fe.Z)("WebPage",r&&"in-preview",M&&"with-square-photo",!P&&!C&&!r&&"without-media",C&&"with-video",!S&&"no-article");return i.ZP.createElement("div",{className:R,"data-initial":(v||w)[0],dir:"auto"},P&&!C&&i.ZP.createElement(Os,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,size:M?"pictogram":"inline",nonInteractive:!E,onClick:E?f:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0,theme:m}),S&&i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(Qs.Z,{className:"site-name",url:I,text:v||w}),!r&&y&&i.ZP.createElement("p",{className:"site-title"},(0,En.Z)(y)),b&&i.ZP.createElement("p",{className:"site-description"},(0,En.Z)(b,["emoji","br"]))),!r&&C&&i.ZP.createElement($s,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:o,lastSyncTime:c,onClick:E?f:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0}))}));var ta=n(9937),na=n(17921);const sa=(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,mt.Z)(),h=(0,d.eO)(s),{title:g,text:p,amount:f,currency:v,isTest:I,photo:w}=h,y=(0,cn.Z)((0,d.O9)(w));return(0,i.bt)((()=>{if(!o)return;const e=u.current.closest(".message-content");y&&Bs(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,En.Z)(g)),p&&i.ZP.createElement("div",null,(0,En.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(na.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,ta.x)(f,v,m.code),I&&i.ZP.createElement("span",null,m("PaymentTestInvoice")))))}));var aa=n(28183);const ia=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"})),oa=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],ra=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",ca=1e-4,la={width:400,height:300,zoom:16,scale:2},da={__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>'},ua=(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,mt.Z)(),g=(0,Xe.Z)(),f=(0,d.nf)(t),{type:v,geo:I}=f,w=(0,p.b)(l),y=(0,d.$R)(t,w),Z="geoLive"!==v||y?void 0:t.date+f.period-w,[P,C]=(0,i.eJ)(I),b="venue"===v||"geoLive"===v&&!y,{width:S,height:M,zoom:E,scale:R}=la,k=Boolean(s)&&(0,d.k6)(P,S,M,E,R),N=(0,cn.Z)(k),T=(0,Yt.Z)(N),A=N||T,x=n&&(0,d.YC)(n.id),B=n&&x?n:void 0,L=n&&!x?n:void 0,O=(0,d.B4)(t),U=(0,i.Ye)((()=>{if("geoLive"!==v||!P.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=P;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,E)}),[v,P,E]),F=(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&&F(m.current)}),[F]),(0,i.bt)((()=>{if(b)return;const e=u.current.closest(".message-content");A&&Bs(A,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,A,b]),(0,i.d4)((()=>{Math.abs(I.lat-P.lat)<ca&&Math.abs(I.long-P.long)<ca?P.accuracyRadius!==I.accuracyRadius&&C({...P,accuracyRadius:I.accuracyRadius}):C(I)}),[I,P]),(0,aa.Z)((()=>{g()}),y?void 0:1e3*(Z||0)),(0,Qe.Z)((()=>{const e=m.current;e&&F(e)}),Z?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`}(P.lat,P.long,E);null===(e=window.open(t,"_blank","noopener"))||void 0===e||e.focus()}},i.ZP.createElement("div",{className:"map-wrapper"},A?i.ZP.createElement("img",{className:"full-media map",src:A,alt:"Location on a map",width:la.width,height:la.height}):i.ZP.createElement(na.Z,{width:S,height:M}),function(){if(A)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,Fe.Z)("pin",v,y&&"expired");if("geoLive"===v)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:da},i.ZP.createElement(Nn.Z,{chat:L,user:B,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?ia.get(e)||ia.get(e.split("/")[0])||oa[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%oa.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:da,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:ra,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}())})),ma=(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,cn.Z)(u,!n),g=(0,cn.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(na.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 ha(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,Fe.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 ga=ha(Os),pa=ha($s),fa=(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)],Z=null==y?void 0:y.progress,{dimensions:P,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(ga,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,shouldAffectAppendix:s,uploadProgress:Z,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})}if(w)return i.ZP.createElement(pa,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,canAutoPlay:S,uploadProgress:Z,lastSyncTime:o,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})})))}));function va(){return va=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},va.apply(this,arguments)}let Ia;const wa=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,Gn.Op)(l,n),[p,f]=(0,i.eJ)(a),v=Boolean(p&&g&&r),{mediaData:I,loadProgress:w}=(0,Ns.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:y}=(0,Ns.Z)((0,d.Ti)(t,"download"),!c,o.IU.BlobUrl,r),Z=As(t,I),{isBuffered:P,bufferingHandlers:C}=(0,Us.Z)(),b=p&&!P||c,S=!1===(0,Yt.Z)(p),M=(0,Ss.Z)(I),{shouldRender:E,transitionClassNames:k}=(0,Ye.Z)(b||!P,void 0,S),[N,T]=(0,i.eJ)(!1),[A,x]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!N)return;const e=on.Rj/2,t=2*(e-6)*Math.PI,n=t-A*t,s=m.current,a=u.current,i=a.firstElementChild;i?i.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${on.Rj}px" height="${on.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>`,x(s.currentTime/s.duration)}),[N,A]);const B=Boolean(I&&g),L=(0,i.I4)((()=>{m.current&&(T(!1),x(0),(0,bs.Z)(m.current),(0,R.T2)((()=>{u.current.innerHTML=""})))}),[]),O=(0,i.I4)((()=>{var e;null===(e=Ia)||void 0===e||e(),Ia=L}),[L]);(0,i.d4)((()=>{m.current&&(B?(0,bs.Z)(m.current):m.current.pause())}),[B]),(0,qs.Z)(m,B),(0,Fs.Z)(m,[I]);const 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;N?e.paused?((0,bs.Z)(e),(0,pn.Es)()):e.pause():(O(),e.pause(),e.currentTime=0,(0,bs.Z)(e),(0,pn.Es)(),T(!0))}),[O,N,c,I,t]),F=(0,i.I4)((e=>{const t=e.currentTarget;x(t.currentTime/t.duration)}),[]),q=(0,Fe.Z)("full-media",M);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:Z,className:"thumbnail",style:`width: ${on.Rj}px; height: ${on.Rj}px`})),I&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement("video",va({ref:m,className:q,width:on.Rj,height:on.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?L:void 0},C,{onTimeUpdate:N?F:void 0}),i.ZP.createElement("source",{src:I}))),i.ZP.createElement("div",{className:"progress",ref:u}),E&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(Ls.Z,{progress:c?y:w})),!I&&!p&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},N?(0,V.k9)(m.current.currentTime):(0,V.k9)(h.duration),(!N||m.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},ya=e=>{let{message:t,onClick:n}=e;const s=(0,mt.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(yt.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,En.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))))))))},Za=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:a}=(0,s.Sv)(),o=(0,mt.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,st.bi)(l),className:(0,Fe.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(Nn.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"}))})),Pa=(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(yt.Z,{className:(0,Fe.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},i.ZP.createElement(Ps,{activeReaction:a,reaction:t.reaction,availableReactions:o}),null!=l&&l.length?i.ZP.createElement("div",{className:"avatars"},l.map((e=>i.ZP.createElement(Nn.Z,{user:e,size:"micro"})))):(0,st.bi)(t.count))})),Ca=(0,i.X$)((e=>{let{message:t,isOutside:n,activeReaction:s,availableReactions:a,metaChildren:o}=e;return i.ZP.createElement("div",{className:(0,Fe.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>i.ZP.createElement(Pa,{key:e.reaction,reaction:e,message:t,activeReaction:s,availableReactions:a}))),o)})),ba=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:a}=e;const{requestCall:o}=(0,s.Sv)(),r=(0,mt.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(yt.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,Fe.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",u&&"V5tKkKZpcY5yq_f5nO8l",!c&&"e0Vhbj8gfzQn1zJQoFLK")}),i.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?r("CallMessageWithDuration",[v,f]):v))))}));var Sa=n(4863),Ma=n(78780);const Ea={__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>'},Ra={__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>'},ka=(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:Z,replyToMessageId:P,isOutgoing:C,threadInfo:b,forwardInfo:S,transcriptionId:M}=u,E=(0,c.Z1)(e,w),R=(0,c.FM)(e,w),k=(0,d.pK)(w),N=E&&(0,d.eA)(E),T=null==E?void 0:E.username,A=!R&&(0,d.Ul)(u),x=h||g||A,B=(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,F=u.id===U,q=P===U,D=P&&!q?(0,c.hj)(e,k&&Z?Z:w,P):void 0,$=D&&(0,c.Bz)(e,D,Boolean(S)),j=(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._O)(u),J=X&&((0,c.zB)(e,X)||(0,c.CP)(e,X))?X:void 0;let Y;Y=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:K}="thread"===f&&(0,c._k)(e,u,p)||{},Q=(0,c.te)(e,u),ee=b?(0,c.tZ)(e,b.chatId,b.threadId)||b:void 0,te=Boolean(u.groupedId)&&!u.isInAlbum,ne=te?(0,c.xH)(e,w,u.groupedId)[0]:void 0,se=te?v?(0,c.hj)(e,w,ne):void 0:u,ae=null==E||null===(n=E.unreadReactions)||void 0===n?void 0:n.includes(u.id);return{theme:(0,c.Pu)(e),chatUsername:T,forceSenderName:A,sender:B,canShowSender:x,originSender:L,botSender:O,shouldHideReply:q,isThreadTop:F,replyMessage:D,replyMessageSender:$,isInDocumentGroup:te,isProtected:(0,c.EV)(e,u),isFocused:G,isForwarding:z,reactionMessage:se,isChatWithSelf:R,isRepliesChat:k,isChannel:N,canReply:K,lastSyncTime:r,serverTimeOffset:l,highlight:W,animatedEmoji:J,isInSelectMode:(0,c.CA)(e),isSelected:Y,isGroupSelected:Boolean(u.groupedId)&&!u.isInAlbum&&(0,c.a6)(e,w,u.groupedId),threadId:p,isDownloading:Q,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:ee,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(u)?void 0:(0,c.q6)(e,w),activeReaction:se&&e.activeReactions[se.id],activeEmojiInteractions:e.activeEmojiInteractions,...C&&{outgoingStatus:(0,c.dT)(e,u,"scheduled"===f)},..."number"==typeof j&&{uploadProgress:j},...G&&{focusDirection:H,noFocusHighlight:V,isResizingContainer:_},hasUnreadReaction:ae,isTranscribing:void 0!==M&&(null===(s=e.transcriptions[M])||void 0===s?void 0:s.isPending),transcribedText:void 0!==M?null===(a=e.transcriptions[M])||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:a,observeIntersectionForMedia:r,observeIntersectionForAnimatedStickers:c,album:l,noAvatars:u,withAvatar:g,withSenderName:f,areReactionsInMeta:v,noComments:I,appearanceOrder:w,isFirstInGroup:y,isPremium:Z,isLastInGroup:P,isFirstInDocumentGroup:C,isLastInDocumentGroup:b,isTranscribing:S,transcribedText:M,isLastInList:E,theme:R,forceSenderName:k,sender:N,canShowSender:T,originSender:A,botSender:x,isThreadTop:B,shouldHideReply:L,replyMessage:O,replyMessageSender:U,outgoingStatus:F,uploadProgress:q,isInDocumentGroup:D,isProtected:$,isFocused:j,focusDirection:G,noFocusHighlight:H,isResizingContainer:V,isForwarding:_,isChatWithSelf:z,isRepliesChat:W,isChannel:X,canReply:J,lastSyncTime:Y,serverTimeOffset:K,highlight:Q,animatedEmoji:ee,isInSelectMode:te,isSelected:ne,isGroupSelected:se,threadId:ae,reactionMessage:ie,availableReactions:oe,defaultReaction:re,activeReaction:ce,activeEmojiInteractions:le,messageListType:de,isPinnedList:ue,isDownloading:me,canAutoLoadMedia:he,canAutoPlayMedia:ge,shouldLoopStickers:pe,autoLoadFileMaxSizeMb:fe,threadInfo:ve,hasUnreadReaction:Ie,memoFirstUnreadIdRef:we,animationLevel:ye}=e;const{toggleMessageSelection:Ze,clickBotInlineButton:Pe,disableContextMenuHint:Ce,animateUnreadReaction:be,focusLastMessage:Se}=(0,s.Sv)(),Me=(0,i.sO)(null),Ee=(0,i.sO)(null),Re=(0,i.sO)(null),ke=(0,mt.Z)(),[Ne,Te]=(0,i.eJ)(!1),[Ae,xe,Be]=(0,lt.Z)();(0,Gn._N)(Ee,a);const{isContextMenuOpen:Le,contextMenuPosition:Oe,handleBeforeContextMenu:Ue,handleContextMenu:qe,handleContextMenuClose:De,handleContextMenuHide:$e}=(0,_n.Z)(Me,h.$b&&te,!0,h.wZ);(0,i.d4)((()=>{Le&&Ce()}),[Le,Ce]);const je=w<=0,[Ge,He]=(0,lt.Z)(je);(0,i.d4)((()=>{je||setTimeout(He,10*w)}),[w,He,je]);const{transitionClassNames:Ve}=(0,Ye.Z)(Ge,void 0,je,!1),{id:_e,chatId:ze,forwardInfo:We,viaBotId:Xe,isTranscriptionError:Je}=t,Ke=(0,d.CI)(t),Qe=(0,d.B4)(t),et="scheduled"===de||t.isScheduled,tt=(0,d.ss)(t)&&!L,nt=Boolean(ve)&&"thread"===de,st=(0,d.$D)(t),at=ee,it=(null==ie?void 0:ie.reactions)&&!(0,d.JE)(ie.reactions),ot=We&&(!z||et)&&!W&&!We.isLinkedChannelPost&&!st,rt=Boolean(l)&&l.messages.length>1&&!(null!=l&&l.messages.some((e=>0===Object.keys(e.content).length))),ct=D&&!C,dt=D&&!b,ut=void 0!==Oe,ht=!(ut||te||_||dt),gt=X&&!et&&!$,pt=Boolean(ue||We&&(We.isChannelPost||z&&!Qe||W)&&We.fromMessageId),ft=(0,i.I4)(((e,t)=>{Ze({messageId:_e,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...rt&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})}),[Ze,_e,rt,l]),vt=T?N:void 0,It=Boolean(!Ne&&(Je||M)),wt=We&&(z||W||!vt)?A:vt,Zt=We?A:vt,{handleMouseDown:Pt,handleClick:Ct,handleContextMenu:bt,handleDoubleClick:St,handleContentDoubleClick:Mt,handleMouseMove:Et,handleSendQuickReaction:Rt,handleMouseLeave:kt,isSwiped:Nt,isQuickReactionVisible:Tt,handleDocumentGroupMouseEnter:At}=cs(ft,Me,_e,0,Boolean(te),Boolean(J),Boolean($),qe,Ue,ze,ut,Re,Qe,dt),{handleAvatarClick:xt,handleSenderClick:Bt,handleViaBotClick:Lt,handleReplyClick:Ot,handleMediaClick:Ut,handleAudioPlay:Ft,handleAlbumMediaClick:qt,handleMetaClick:Dt,handleReadMedia:$t,handleCancelUpload:jt,handleVoteSend:Gt,handleGroupForward:Ht,handleForward:Vt,handleFocus:_t,handleFocusForwarded:zt,handleDocumentGroupSelectAll:Wt}=function(e,t,n,a,r,c,l,d,u,h,g,p,f){const{openChat:v,showNotification:I,focusMessage:w,openMediaViewer:y,openAudioPlayer:Z,markMessagesRead:P,cancelSendingMessage:C,sendPollVote:b,openForwardMenu:S,focusMessageInComments:M}=(0,s.Sv)(),{id:E,forwardInfo:R,replyToMessageId:k,replyToChatId:N,replyToTopMessageId:T,groupedId:A}=n,x=(0,i.I4)((()=>{g&&v({id:g.id})}),[g,v]),B=(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&&N?N:a,threadId:r,messageId:k,replyMessageId:u&&N?void 0:E})}),[w,u,N,a,r,k,E]),U=(0,i.I4)((()=>{y({chatId:a,threadId:r,mediaId:E,origin:d?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,E,y,d]),F=(0,i.I4)((()=>{Z({chatId:a,messageId:E})}),[a,E,Z]),q=(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)((()=>{P({messageIds:[E]})}),[E,P]),$=(0,i.I4)((()=>{C({chatId:a,messageId:E})}),[C,a,E]),j=(0,i.I4)((e=>{b({chatId:a,messageId:E,options:e})}),[a,E,b]),G=(0,i.I4)((()=>{S({fromChatId:a,groupedId:A})}),[S,a,A]),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:[E]})}),[h,S,a,E]),V=(0,i.I4)((()=>{w({chatId:a,threadId:o._f,messageId:E})}),[w,a,E]),_=(0,i.I4)((()=>{c?w({chatId:R.fromChatId,groupedId:A,groupedChatId:a}):u&&N?M({chatId:N,threadId:T,messageId:R.fromMessageId}):w({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,N,w,R,A,a,M,T]),z=(0,i.I4)((e=>{e.stopPropagation(),t(e,A)}),[t,A]);return{handleAvatarClick:x,handleSenderClick:B,handleViaBotClick:L,handleReplyClick:O,handleMediaClick:U,handleAudioPlay:F,handleAlbumMediaClick:q,handleMetaClick:z,handleReadMedia:D,handleCancelUpload:$,handleVoteSend:j,handleGroupForward:G,handleForward:H,handleFocus:V,handleFocusForwarded:_,handleDocumentGroupSelectAll:z}}(ke,ft,t,ze,ae,D,ot,et,W,l,wt,Zt,x);(0,i.d4)((()=>{E&&It&&M&&Se()}),[Se,E,M,It]);const Xt=(0,Fe.Z)("Message message-list-item",y&&"first-in-group",$&&"is-protected",P&&"last-in-group",C&&"first-in-document-group",b&&"last-in-document-group",E&&"last-in-list",Qe&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",tt&&"has-reply",ut&&"has-menu-open",j&&!H&&"focused",_&&"is-forwarding",t.isDeleting&&"is-deleting",D&&"is-in-document-group",rt&&"is-album",t.hasUnreadMention&&"has-unread-mention",ne&&"is-selected",te&&"is-in-selection-mode",B&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Nt&&"is-swiped",Ve,(Boolean(ce)||Ae)&&"has-active-reaction"),{text:Jt,photo:Yt,video:Kt,audio:en,voice:tn,document:nn,sticker:sn,contact:an,poll:cn,webPage:ln,invoice:dn,location:un,action:mn,game:hn}=(0,d.qp)(t),{phoneCall:gn}=mn||{},pn=ve&&!dt&&"thread"===de&&!I,fn=!h.$b&&!gn&&!te&&re&&!dt,vn=function(e){let{hasReply:t,customShape:n,isLastInGroup:s,asForwarded:a,hasThread:i,forceSenderName:o,hasComments:r,hasActionButton:c,hasReactions:l,isGeoLiveActive:u,withVoiceTranscription:m}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:h,photo:g,video:p,audio:f,voice:v,document:I,poll:w,webPage:y,contact:Z,location:P,invoice:C}=(0,d.qp)(e),b=["message-content"],S=g||p||P,M=h||"venue"===(null==P?void 0:P.type)||u,E=S&&!M,R=Boolean(e.viaBotId);return zn(n)?b.push(`emoji-only emoji-only-${n}`):M&&b.push("text"),c&&b.push("has-action-button"),n&&(b.push("custom-shape"),null!=p&&p.isRound&&b.push("round"),r&&b.push("has-comments")),S?b.push("media"):f?b.push("audio"):v?(b.push("voice"),m&&b.push("with-voice-transcription")):I?b.push("document"):Z?b.push("contact"):w?b.push("poll"):y&&(b.push("web-page"),(y.photo||y.video)&&b.push("media")),C&&b.push("invoice"),a&&b.push("is-forwarded"),t&&b.push("is-reply"),i&&b.push("has-replies"),l&&b.push("has-reactions"),R&&b.push("is-via-bot"),o&&b.push("force-sender-name"),n||(b.push("has-shadow"),S&&r&&b.push("has-background"),(t||a||!E||R||o)&&b.push("has-solid-background"),s&&(g||P&&!M||!E)&&b.push("has-appendix")),b.join(" ")}(t,{hasReply:tt,customShape:st,isLastInGroup:P,asForwarded:ot,hasThread:nt,forceSenderName:k,hasComments:ve&&(null==ve?void 0:ve.messagesCount)>0,hasActionButton:gt||pt,hasReactions:it,isGeoLiveActive:"geoLive"===(null==un?void 0:un.type)&&!(0,d.$R)(t,(0,p.b)(K)),withVoiceTranscription:It}),In=vn.includes("has-appendix"),wn=(0,rn.X)(t,Q,zn(st),void 0,void 0,$,c);let yn,Zn;yn=gn||dt?"none":!wn||at||ln?"standalone":"in-text",v?Zn="in-meta":it?st||(Yt||Kt||at)&&!wn?Zn="outside":ot?(yn="standalone",Zn="inside"):Zn="inside":Zn="none",(0,Qt.Z)(W&&t.replyToChatId?t.replyToChatId:ze,tt?t.replyToMessageId:void 0,O,t.id),ss(Me,ze,j,G,H,V),(0,i.d4)((()=>{const e=Ee.current;Ie&&e&&(0,us.P)(e)&&be({messageIds:[_e]})}),[Ie,_e,be]);let Pn,Cn="",bn=!1;const Sn=(0,i.Ye)((()=>rt?Qn(Qe,Boolean(ot),Boolean(u),l):void 0),[rt,Qe,ot,u,l]),Mn=ot?28:0;if(rt||!Yt&&!Kt)Sn&&(Pn=Math.max(Wn(Boolean(Jt),pn),Sn.containerStyle.width),Pn-Sn.containerStyle.width>18&&(bn=!0));else{let e;Yt?e=Xn(t,u).width:Kt&&(e=Kt.isRound?on.Rj:Xn(t,u).width),e&&(Pn=Math.max(Wn(Boolean(Jt),pn),e),Pn-e>18&&(bn=!0))}Pn&&(Cn=`width: ${Pn+Mn}px`);const Rn=X&&t.adminTitle||!ot&&(null==We?void 0:We.adminTitle)||void 0,kn=(0,i.Ye)((()=>Rn?ns(Rn):void 0),[Rn]);function Tn(){const e=i.ZP.createElement(Cs,{message:t,reactionMessage:ie,outgoingStatus:F,signature:Rn,withReactions:"in-meta"===Zn,withReactionOffset:"inside"===Zn,availableReactions:oe,activeReaction:ce,onClick:Dt});return"inside"!==Zn?e:i.ZP.createElement(Ca,{activeReaction:ce,message:ie,metaChildren:e,availableReactions:oe})}return i.ZP.createElement("div",{ref:Me,id:(0,d.d0)(t.id),className:Xt,style:kn?`--meta-safe-author-width: ${kn}px`:void 0,"data-message-id":_e,onMouseDown:Pt,onClick:Ct,onContextMenu:bt,onDoubleClick:St,onMouseEnter:dt?At:void 0,onMouseMove:fn?Et:void 0,onMouseLeave:fn||dt?kt:void 0},i.ZP.createElement("div",{ref:Ee,className:"bottom-marker","data-message-id":_e,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ie||void 0}),!D&&i.ZP.createElement("div",{className:"message-select-control"},ne&&i.ZP.createElement("i",{className:"icon-select"})),b&&i.ZP.createElement("div",{className:(0,Fe.Z)("message-select-control group-select",se&&"is-selected"),onClick:Wt},se&&i.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=wt&&(0,d.YC)(wt.id),t=wt&&e?wt:void 0,n=wt&&!e?wt:void 0,s=!wt&&We?We.hiddenUserName:void 0,a=null==t?void 0:t.isPremium;return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Nn.Z,{size:"small",user:t,chat:n,text:s,lastSyncTime:Y,onClick:t||n?xt:void 0,observeIntersection:r,animationLevel:ye,withVideo:!0}),a&&i.ZP.createElement(Sa.Z,{className:"chat-avatar-premium"}))}(),i.ZP.createElement("div",{className:(0,Fe.Z)("message-content-wrapper",vn.includes("text")&&"can-select-text")},i.ZP.createElement("div",{ref:Re,className:vn,style:Cn,dir:"auto"},ot&&!ct&&i.ZP.createElement("div",{className:"message-title"},ke("ForwardedMessage")),function(){const e=(0,Fe.Z)("content-inner",ot&&"forwarded-message",tt&&"reply-message",bn&&"no-media-corners"),n=P&&!wn&&!ot&&!nt,s=(0,Fe.Z)("text-content","in-text"===yn&&"with-meta",F&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:Mt,dir:"auto"},function(){if(st&&!Xe||!(f&&!(Yt||Kt||un)||ot||Xe||k)||ct||tt&&st)return;let e,n;return!Zt||st&&Xe?null!=We&&We.hiddenUserName&&(e=We.hiddenUserName):(e=(0,d.OU)(ke,Zt),ot||(n=`color-${(0,d.Rs)(Zt)}`)),i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,Fe.Z)("interactive",n),onClick:Bt,dir:"auto"},(0,En.Z)(e)):x?void 0:" ",x&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},ke("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:Lt},(0,En.Z)(`@${x.username}`))),null!=We&&We.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},ke("DiscussChannel")):t.adminTitle&&!X?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.adminTitle):void 0)}(),tt&&i.ZP.createElement(fs,{message:O,noUserColors:Qe,isProtected:$,sender:U,observeIntersection:r,onClick:Ot}),sn&&i.ZP.createElement(Ms,{message:t,observeIntersection:r,observeIntersectionForPlaying:c,shouldLoop:pe,lastSyncTime:Y,shouldPlayEffect:sn.hasEffect&&(we.current&&_e>=we.current||Ke)||void 0,onPlayEffect:xe,onStopEffect:Be}),ee&&i.ZP.createElement(ks,{emoji:ee,withEffects:(0,d.YC)(ze),isOwn:Qe,observeIntersection:r,lastSyncTime:Y,forceLoadPreview:Ke,messageId:_e,chatId:ze,activeEmojiInteractions:le}),rt&&i.ZP.createElement(fa,{album:l,albumLayout:Sn,observeIntersection:r,isOwn:Qe,isProtected:$,hasCustomAppendix:n,lastSyncTime:Y,onMediaClick:qt}),gn&&i.ZP.createElement(ba,{message:t,phoneCall:gn,chatId:ze}),!rt&&Yt&&i.ZP.createElement(Os,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:he,uploadProgress:q,shouldAffectAppendix:n,onClick:Ut,onCancelUpload:jt,isDownloading:me,isProtected:$,theme:R}),!rt&&Kt&&Kt.isRound&&i.ZP.createElement(wa,{message:t,observeIntersection:r,canAutoLoad:he,lastSyncTime:Y,isDownloading:me}),!rt&&Kt&&!Kt.isRound&&i.ZP.createElement($s,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:he,canAutoPlay:ge,uploadProgress:q,lastSyncTime:Y,onClick:Ut,onCancelUpload:jt,isDownloading:me,isProtected:$}),(en||tn)&&i.ZP.createElement(Is.ZP,{theme:R,message:t,origin:m.Cr.Inline,uploadProgress:q,lastSyncTime:Y,isSelectable:D,isSelected:ne,noAvatars:u,onPlay:Ft,onReadMedia:!tn||Qe&&!z?void 0:$t,onCancelUpload:jt,isDownloading:me,isTranscribing:S,isTranscriptionHidden:Ne,isTranscribed:Boolean(M),isTranscriptionError:Je,canDownload:!$,onHideTranscription:Te,canTranscribe:Z}),nn&&i.ZP.createElement(vs.Z,{message:t,observeIntersection:r,canAutoLoad:he,autoLoadFileMaxSizeMb:fe,uploadProgress:q,isSelectable:D,isSelected:ne,onMediaClick:Ut,onCancelUpload:jt,isDownloading:me}),an&&i.ZP.createElement(Gs,{contact:an}),cn&&i.ZP.createElement(Ys,{message:t,poll:cn,onSendVote:Gt}),hn&&i.ZP.createElement(ma,{message:t,canAutoLoadMedia:he,lastSyncTime:Y}),It&&i.ZP.createElement("p",{className:(0,Fe.Z)("transcription",!Ne&&Je&&"transcription-error"),dir:"auto"},Je?ke("NoWordsRecognized"):S&&M?i.ZP.createElement(Ma.Z,{content:M}):M),!at&&wn&&i.ZP.createElement("p",{className:s,dir:"auto"},wn,"in-text"===yn&&Tn()),ln&&i.ZP.createElement(ea,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:he,canAutoPlay:ge,lastSyncTime:Y,onMediaClick:Ut,onCancelMediaTransfer:jt,isDownloading:me,isProtected:$,theme:R}),dn&&i.ZP.createElement(sa,{message:t,shouldAffectAppendix:n,isInSelectMode:te,isSelected:ne,theme:R}),un&&i.ZP.createElement(ua,{message:t,lastSyncTime:Y,isInSelectMode:te,isSelected:ne,theme:R,peer:N,serverTimeOffset:K}))}(),!dt&&"standalone"===yn&&Tn(),ht&>?i.ZP.createElement(yt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:ke("lng_context_forward_msg"),onClick:b?Ht:Vt},i.ZP.createElement("i",{className:"icon-share-filled"})):ht&&pt?i.ZP.createElement(yt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ue?_t:zt},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,pn&&i.ZP.createElement(Za,{threadInfo:ve,disabled:I}),In&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:Qe?Ea:Ra}),fn&&i.ZP.createElement("div",{className:(0,Fe.Z)("quick-reaction",Tt&&!ce&&"visible"),onClick:Rt},i.ZP.createElement(ys.Z,{reaction:re}))),t.inlineButtons&&i.ZP.createElement(ya,{message:t,onClick:Pe}),"outside"===Zn&&i.ZP.createElement(Ca,{message:ie,isOutside:!0,activeReaction:ce,availableReactions:oe})),Oe&&i.ZP.createElement(hs,{isOpen:Le,anchor:Oe,message:t,album:l,chatUsername:n,messageListType:de,onClose:De,onCloseAnimationEnd:$e}))}))),Na=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ta=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),Aa=(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,mt.Z)(),f=(0,i.sO)(null),v=(0,i.sO)(null),I=Boolean(n),{observe:w}=(0,Gn.S1)({rootRef:a,debounceMs:200,threshold:1}),{isContextMenuOpen:y,contextMenuPosition:Z,handleBeforeContextMenu:P,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:S}=(0,_n.Z)(f,h.$b,!0,h.wZ),[M,E,R]=(0,lt.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,Un.q)(e),P(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,En.Z)((0,d.Js)(o)||""),r&&(0,En.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,Hs.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(yt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),Z&&i.ZP.createElement(Ta,{isOpen:y,anchor:Z,message:n,onAboutAds:E,onClose:b,onCloseAnimationEnd:S}),i.ZP.createElement(Na,{isOpen:M,onClose:R}))}))),xa=(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:Z,type:P,isReady:C,isScrollingRef:b,isScrollPatchNeededRef:S,threadTopMessageId:M,hasLinkedChat:E,isSchedule:k,noAppearanceAnimation:N,onFabToggle:T,onNotchToggle:A}=e;const{openHistoryCalendar:x}=(0,s.Sv)(),{observeIntersectionForMedia:B,observeIntersectionForReading:L,observeIntersectionForAnimatedStickers:O}=function(e,t,n){const{markMessageListRead:a,markMentionsRead:i,animateUnreadReaction:o}=(0,s.Sv)(),{observe:r}=(0,Gn.S1)({rootRef:t,throttleMs:Hn,margin:Vn}),{observe:c,freeze:l,unfreeze:d}=(0,Gn.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,je.Z)(l,d);const{observe:u}=(0,Gn.S1)({rootRef:t,throttleMs:Hn});return{observeIntersectionForMedia:r,observeIntersectionForReading:c,observeIntersectionForAnimatedStickers:u}}(P,v,y),{backwardsTriggerRef:U,forwardsTriggerRef:F,fabTriggerRef:q}=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 Z(){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:P}=(0,Gn.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,Gn._N)(I,P),(0,Gn._N)(w,P);const{observe:C,freeze:b,unfreeze:S}=(0,Gn.S1)({rootRef:t,margin:100},Z);(0,Gn._N)(y,C);const{observe:M,freeze:E,unfreeze:k}=(0,Gn.S1)({rootRef:t,margin:1},Z);return(0,Gn._N)(y,M),(0,He.Z)((()=>{d&&Z()}),[d]),(0,He.Z)((()=>{b(),E(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:w,fabTriggerRef:y}}(P,v,o,c,l,T,A,C,b,S),D=(0,mt.Z)(),$=i.ZP.createElement("div",{className:(0,Fe.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,D("UnreadMessages"))),j=N?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&&!Ln(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&&$,i.ZP.createElement(ps,{key:o.id,message:o,observeIntersection:L,observeIntersectionForAnimation:O,memoFirstUnreadIdRef:y,appearanceOrder:j-++G,isLastInList:r})])}let r;return e.map(((o,c)=>{const l=Ln(o)?o.mainMessage:o,m=Ln(o)?o:void 0,h=(0,d.B4)(l),v=Ln(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&&!Ln(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),N=(0,d.jM)(l)?`${l.date}_${k}`:k;return(0,g.oA)([l.id===w.current&&$,i.ZP.createElement(ka,{key:N,message:l,observeIntersectionForBottom:L,observeIntersectionForMedia:B,observeIntersectionForAnimatedStickers:O,album:m,noAvatars:f,withAvatar:R.isLastInGroup&&u&&!h&&!(l.id===M),withSenderName:R.isFirstInGroup&&u&&!h,areReactionsInMeta:p,threadId:Z,messageListType:P,noComments:!1===E,appearanceOrder:j-++G,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:y}),l.id===M&&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:Un.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,Fe.Z)("sticky-date",!k&&"interactive"),key:"date-header",onMouseDown:Un.q,onClick:k?void 0:()=>x({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(Aa,{key:n,chatId:n,containerRef:v}),i.ZP.createElement("div",{ref:F,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:q,key:"fab-trigger",className:"fab-trigger"}))}));var Ba=n(73547);const La=(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,mt.Z)(),d=(0,i.sO)(null),{observe:u}=(0,Gn.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(Ba.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),Oa=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:s}=e;const a=(0,mt.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")))})),Ua=(0,R.Ds)((e=>e()),200,!1),Fa=(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:Z,isChatLoaded:P,isChannelChat:C,isGroupChat:b,canPost:S,isReady:M,isChatWithSelf:E,isRepliesChat:k,isCreator:N,isBot:T,messageIds:A,messagesById:x,firstUnreadId:B,isViewportNewest:L,threadFirstMessageId:O,isRestricted:U,restrictionReason:F,focusingId:q,isSelectModeActive:D,lastMessage:$,isLoadingBotInfo:j,botInfo:G,threadTopMessageId:H,hasLinkedChat:V,lastSyncTime:_,withBottomShift:z}=e;const{loadViewportMessages:W,setScrollOffset:X,loadSponsoredMessages:J,loadMessageReactions:Y,copyMessagesByIds:K}=(0,s.Sv)(),Q=(0,i.sO)(null),ee=(0,i.sO)("thread"===v&&(0,c.Vt)((0,s.Rd)(),p,f)||0),te=(0,i.sO)(),ne=(0,i.sO)(),se=(0,i.sO)(),ae=(0,i.sO)(),ie=(0,i.sO)(),oe=(0,i.sO)(),re=(0,i.sO)(!1),ce=(0,i.sO)(Boolean($)),[le,de]=(0,i.eJ)(),ue=(0,cn.Z)(null!=G&&G.photo?(0,d.NF)(G.photo):void 0),me=(0,cn.Z)(null!=G&&G.gif?(0,d.ym)(G.gif):void 0),he=null!=G&&G.photo?(0,d.bV)(G.photo):null!=G&&G.gif?(0,d.jC)(G.gif):void 0,ge=he&&{width:he.width/h.cL,height:he.height/h.cL},pe=Boolean(A);(0,He.Z)((()=>{pe&&(0,R.R3)((()=>{ce.current=!1}))}),[pe]),(0,He.Z)((()=>{ae.current=B}),[B]),(0,He.Z)((()=>{!Z&&C&&M&&_&&J({chatId:p})}),[Z,p,M,C,_]),(0,He.Z)((()=>{pe&&(ie.current=ae.current)}),[pe]),(0,He.Z)((()=>{oe.current=q}),[q]),(e=>{(0,dt.y)({"Mod+C":function(t){const n=(0,$n.Z)();n&&n.length>0&&(t.preventDefault(),e({messageIds:n}))}})})(K);const fe=(0,i.Ye)((()=>{if(!A||!x)return;const e=!H||A[0]&&O!==A[0]?A:[H,...A];if(!e.length)return;const t=e.map((e=>x[e])).filter(Boolean);return On((0,g.Xo)(t,["date","id"]),ie.current)}),[A,x,O,H]);(0,Qe.Z)((()=>{if(!A||!x)return;const e=A.filter((e=>{var t;return null===(t=x[e])||void 0===t?void 0:t.reactions}));e.length&&Y({chatId:p,ids:e})}),15e3);const ve=(0,i.Ye)((()=>{if("thread"===v)return(0,R.Ds)((()=>W({direction:m.Uq.Around})),1e3,!0,!1)}),[W,A]),{isScrolled:Ie,updateStickyDates:we}=function(){const[e,t]=(0,lt.Z)(!1),n=(0,Dn.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])}}(),ye=(0,i.sO)(),Ze=(0,i.sO)(),Pe=(0,i.I4)((()=>{if(re.current)return void(re.current=!1);ye.current=!0;const e=Q.current;oe.current||we(e,I),Ua((()=>{ye.current=!1,(0,R.T2)((()=>{e.parentElement&&(ee.current=e.scrollHeight-e.scrollTop,"thread"===v&&X({chatId:p,threadId:f,scrollOffset:ee.current}))}))}))}),[we,I,v,X,p,f]);(0,i.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((e=>{let[t]=e;t.target.offsetParent&&de(t.contentRect.height)}));return e.observe(Q.current),()=>{e.disconnect()}}),[]);const{height:Ce}=(0,Xt.Z)();(0,i.d4)((()=>{Q.current.dataset.normalHeight=String(Q.current.offsetHeight)}),[Ce,S]),(0,i.d4)((()=>{if(!ve||!P||U||q)return;if(A&&A[A.length-1]>a.MP)return;const e=Q.current;(!A||A.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ve()}),[P,A,ve,q,U]),(0,He.Z)((()=>{if(!A||!se.current)return;const e=se.current.filter((e=>A.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(te.current=t.id,ne.current=t.getBoundingClientRect().top)}),[A,L,le,I]),(0,jn.Z)((e=>{let[t,n,s]=e;const i=Q.current;se.current=Array.from(i.querySelectorAll(".message-list-item"));const o=A&&t&&A[A.length-1]!==t[t.length-1],r=(null==A?void 0:A[0])!==(null==t?void 0:t[0])&&(null==A?void 0:A.length)===a.hT/2+1,c=o&&!r,l=A&&oe.current===A[A.length-1],d=L&&c&&A&&A.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=ee.current,p=se.current[se.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,qn.Z)(i,p,"end",20)})),w=m-h,ee.current=Math.max(Math.ceil(m-w),h),!d))return;const y=void 0!==s&&s!==le,Z=te.current&&i.querySelector(`#${te.current}`),P=!Z&&ie.current&&i.querySelector(".unread-divider");if(v&&y){if((0,qn.N)())return;w=m-h}else Z?(Ze.current&&(Ze.current=!1,(0,Fn.z)(i)),w=u+(Z.getBoundingClientRect().top-(ne.current||0))):w=P?Math.min(P.offsetTop-(I?60:10),m-g):m-g;(0,Fn.Z)(i,Math.ceil(w)),oe.current||(re.current=!0,(0,R.T2)((()=>{re.current=!1}))),ee.current=Math.max(Math.ceil(m-w),h)}),[A,L,le,I]),(0,$e.Z)((e=>{let[t]=e;void 0!==t&&(0,Ke.YW)(200+a.fK)}),[D]);const be=(0,mt.Z)(),Se=Boolean(p&&(0,d.YC)(p)),Me=Boolean(!Se&&!C||E||k),Ee=Boolean(!Me||C),Re=(0,d.YC)(p)&&!E&&!T&&(!fe&&!$&&A&&(!se.current||0===se.current.length)||1===(null==A?void 0:A.length)&&"contactSignUp"===(null==x||null===(t=x[A[0]])||void 0===t||null===(n=t.content.action)||void 0===n?void 0:n.type)||"contactSignUp"===(null==$||null===(o=$.content)||void 0===o||null===(r=o.action)||void 0===r?void 0:r.type)),ke=b&&N&&1===(null==A?void 0:A.length)&&"chatCreate"===(null==x||null===(l=x[A[0]])||void 0===l||null===(u=l.content.action)||void 0===u?void 0:u.type),Ne=G&&!G.description,Te=(0,Fe.Z)("MessageList custom-scroll",Ee&&"no-avatars",!S&&"no-composer","pinned"===v&&"type-pinned",z&&"with-bottom-shift",D&&"select-mode-active",Ie&&"scrolled",!M&&"is-animating");return i.ZP.createElement("div",{ref:Q,className:Te,onScroll:Pe,onMouseDown:Un.q},U?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,F?F.text:"This is a private "+(C?"channel":"chat"))):G?i.ZP.createElement("div",{className:"empty"},j&&i.ZP.createElement("span",null,be("Loading")),Ne&&i.ZP.createElement("span",null,be("NoMessages")),G&&i.ZP.createElement("div",{className:"bot-info",style:ge&&`width: ${ge.width}px`},ue&&i.ZP.createElement("img",{src:ue,width:null==ge?void 0:ge.width,height:null==ge?void 0:ge.height,alt:"Bot info"}),me&&i.ZP.createElement("video",{src:me,loop:!0,autoPlay:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),he&&!ue&&!me&&i.ZP.createElement(na.Z,{width:null==ge?void 0:ge.width,height:null==ge?void 0:ge.height}),G.description&&i.ZP.createElement("div",{className:"bot-info-description"},i.ZP.createElement("p",{className:"bot-info-title"},be("BotInfoTitle")),(0,En.Z)(G.description,["br","emoji","links"])))):Re?i.ZP.createElement(La,{userId:p}):!A||fe&&!ke?A&&fe||$?i.ZP.createElement(xa,{isCurrentUserPremium:Z,chatId:p,messageIds:A||[$.id],messageGroups:fe||On([$]),isViewportNewest:Boolean(L),isUnread:Boolean(B),withUsers:Me,areReactionsInMeta:Se,noAvatars:Ee,containerRef:Q,anchorIdRef:te,memoUnreadDividerBeforeIdRef:ie,memoFirstUnreadIdRef:ae,threadId:f,type:v,isReady:M,isScrollingRef:ye,isScrollPatchNeededRef:Ze,threadTopMessageId:H,hasLinkedChat:V,isSchedule:!!fe&&"scheduled"===v,noAppearanceAnimation:!fe||!ce.current,onFabToggle:w,onNotchToggle:y}):i.ZP.createElement(At.Z,{color:"white",backgroundColor:"dark"}):i.ZP.createElement(Oa,{chatId:p,type:v,isChatWithSelf:E,isGroupChatJustCreated:ke}))}))),qa=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:s,onClick:a,onReadAll:o,className:r}=e;const c=(0,mt.Z)(),l=(0,i.sO)(null),{isContextMenuOpen:d,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,_n.Z)(l,!o);return i.ZP.createElement("div",{className:(0,Fe.Z)("KboxtoWkfx23zfklH_Zg",r),ref:l},i.ZP.createElement(yt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:a,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,Fe.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(s)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,st.bi)(s)),o&&i.ZP.createElement(Lt.Z,{isOpen:d,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(wt.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),Da=(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 Z=(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,qn.Z)(e,n,"end",20)}}),[t,a,u]),P=(0,Fe.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:P},w&&i.ZP.createElement(qa,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),y&&i.ZP.createElement(qa,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:l}),i.ZP.createElement(qa,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var $a=n(65723);const ja=1280,Ga=/\.[^/.]+$/;async function Ha(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,Wt.pt)(o),{width:n,height:s}=t,a=n>ja||s>ja;if(a||"image/jpeg"!==r){const t=await yn(o,a?ja/Math.max(n,s):1,"image/jpeg");return URL.revokeObjectURL(o),Ha(e,await(0,Wt.gm)(t),!0,i)}"image/jpeg"===r&&(e=e.replace(Ga,".jpg")),l={width:n,height:s}}else u=o;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Wt.jj)(o);l={width:e,height:t,duration:n},u=await(0,Wt.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}}function Va(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const n=t.getRangeAt(0);n.deleteContents();const s=n.createContextualFragment(e),a=s.lastChild;n.insertNode(s),a?(n.setStartAfter(a),n.setEndAfter(a)):n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}var _a=n(96391);let za;function Wa(e){za.focus(),e.focus()}h.cj&&(za=document.createElement("input"),za.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(za));var Xa=n(64784),Ja=n(52400),Ya=n(56389),Ka=n(70971);const Qa={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},ei={type:"audio/ogg"};let ti,ni,si;async function ai(){return ti||(ti=n.e(1161).then(n.t.bind(n,1161,23)),ni=(await ti).default,si=new ni(Qa)),ti}async function ii(e){await async function(){await ai(),await si.start()}();const t=Date.now();let n;const s=[],a=[];si.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}}(si);return{stop:()=>new Promise(((e,o)=>{si.onstop=()=>{e({blob:new Blob(s,ei),duration:Math.round(((n||Date.now())-t)/1e3),waveform:a})},si.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{si.stop(),i()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{si.pause(),n=Date.now(),i()}),e)}}}var oi=n(21262);const ri=["image/png","image/jpeg","image/gif"];let ci,li;var di=n(72162),ui=n(29295);function mi(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,Xe.Z)(),s=(0,i.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,Ke.ZP)(hi,s),{isFrozen:(0,Ke.zG)(),updateWhenUnfrozen:t}}(),c=(0,Dn.Z)(t,!0);return(0,He.Z)((()=>{o?r():c((()=>{a(e())}))}),[...n,o]),s}function hi(){}const gi=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,pi=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,fi={username:"",query:"",canShowHelp:!1,usernameLowered:""},vi=document.createElement("div");const Ii=(0,R.P2)((e=>e()),500,!0),wi=/^[\w@]{1,32}\s?/i;var yi=n(33057);const Zi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function Pi(){return Pi=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},Pi.apply(this,arguments)}let Ci,bi=!0;const Si=(0,i.X$)((e=>{let{onActivate:t,...n}=e;const s=(0,i.sO)(!1),a=(0,i.I4)((()=>{if(s.current=!0,bi)return bi=!1,void t();Ci&&(clearTimeout(Ci),Ci=void 0),Ci=window.setTimeout((()=>{s.current&&t()}),200)}),[t]),o=(0,i.I4)((()=>{s.current=!1}),[]);return i.ZP.createElement(yt.Z,Pi({},n,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:o,onClick:t}))}));var Mi=n(85655),Ei=n(56503),Ri=n(62898);const ki="kq_1N12wqP7sbQ3EhVqO",Ni=/#fff/gi,Ti=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const s=(0,cn.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(Ni,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,Fe.Z)("JDpb9xn3FmOzR6pVNK6n",h.FW&&ki)},i.ZP.createElement("img",{src:a,alt:"",className:(0,Fe.Z)("Bo8mxv82IZ6uf0lrclLq",h.FW&&ki)}))})),Ai=(0,i.X$)((e=>{let{bot:t,theme:n,chatId:a,onMenuOpened:o,onMenuClosed:r}=e;const{callAttachMenuBot:c,toggleBotInAttachMenu:l}=(0,s.Sv)(),d=(0,mt.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,lt.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(wt.Z,{key:t.id,customIcon:u&&i.ZP.createElement(Ti,{icon:u,theme:n}),icon:u?void 0:"bots",onClick:()=>c({botId:t.id,chatId:a}),onContextMenu:v},t.shortName,p&&i.ZP.createElement(Ri.Z,null,i.ZP.createElement(Lt.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(wt.Z,{icon:"stop",destructive:!0,onClick:y},d("WebApp.RemoveBot")))))})),xi=(0,i.X$)((e=>{let{chatId:t,isButtonVisible:n,canAttachMedia:s,canAttachPolls:o,attachMenuBots:r,peerType:c,isScheduled:l,onFileSelect:d,onPollCreate:u,theme:m}=e;const[g,p,f]=(0,lt.Z)(),[v,I,w]=(0,Ei.Z)(g,f),[y,Z,P]=(0,lt.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,Mi.g)(Array.from(a.dI).join(","),(e=>b(e,!0)))}),[b]),M=(0,i.I4)((()=>{(0,Mi.g)("*",(e=>b(e,!1)))}),[b]),E=(0,i.Ye)((()=>Object.values(r).filter((e=>!!c&&(!("bot"!==c||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(c))))),[r,t,c]),R=(0,mt.Z)();if(n)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(Si,{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(Lt.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(wt.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(wt.Z,{icon:"photo",onClick:S},R("AttachmentMenu.PhotoOrVideo")),i.ZP.createElement(wt.Z,{icon:"document",onClick:M},R("AttachDocument"))),o&&i.ZP.createElement(wt.Z,{icon:"poll",onClick:u},R("Poll")),s&&!l&&E.map((e=>i.ZP.createElement(Ai,{bot:e,chatId:t,theme:m,onMenuOpened:Z,onMenuClosed:P})))))})),Bi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"SymbolMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Li=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Oi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Ui=n(67146);const Fi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var qi=n(19830);const Di=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),$i=(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,Ei.Z)(t,a),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,lt.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(Lt.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(yt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>o({messageId:n.id,button:e})},e.text))))))))})));var ji=n(13616),Gi=n(17891),Hi=n(63394),Vi=n(66902);const _i=(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:Z}=(0,s.Sv)(),P=(0,i.sO)(null),C=(0,mt.Z)(),b=Boolean(l),S=Boolean((t||n)&&a||r&&l),M=(0,Gi.Z)([l],l?300:void 0),{shouldRender:E,transitionClassNames:R}=(0,Ye.Z)(M&&S,void 0,!c,void 0,!c),k=(0,i.I4)((()=>{t?p({messageId:void 0}):n?f({messageId:void 0}):l&&Z(),null==g||g()}),[t,n,l,g,p,f,Z]);(0,i.d4)((()=>S?(0,rt.Z)(k):void 0),[S,k]);const N=(0,i.I4)((()=>{b||v({chatId:a.chatId,messageId:a.id})}),[v,b,a]),T=(0,i.I4)((e=>{e.stopPropagation(),k()}),[k]),A=(0,i.I4)((()=>{I()}),[I]),{isContextMenuOpen:x,contextMenuPosition:B,handleContextMenu:L,handleContextMenuClose:O,handleContextMenuHide:U}=(0,_n.Z)(P),F=(0,i.I4)((()=>P.current),[]),q=(0,i.I4)((()=>P.current),[]),D=(0,i.I4)((()=>P.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:$,positionY:j,transformOriginX:G,transformOriginY:H,style:V}=(0,Hi.Z)(B,F,q,D),_=(0,Fe.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(E)return i.ZP.createElement("div",{className:_,ref:P,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(fs,{className:"inside-input",message:X,sender:d?void 0:r,customText:W,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:N,hasContextMenu:b}),i.ZP.createElement(yt.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(Lt.Z,{isOpen:x,transformOriginX:G,transformOriginY:H,positionX:$,positionY:j,style:V,className:"forward-context-menu",onClose:O,onCloseAnimationEnd:U},i.ZP.createElement(wt.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(wt.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(Vi.Z,null),i.ZP.createElement(wt.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(wt.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(Vi.Z,null),i.ZP.createElement(wt.Z,{icon:"replace",onClick:A},C("ChangeRecipient")))))}))),zi=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,tt.Z)(et.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),Wi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Xi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ji=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),Yi=new RegExp(a.FM,"i"),Ki=(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=mi((()=>{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(Yi);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,He.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&a.length&&!l&&!r),{shouldRender:v,transitionClassNames:I}=(0,Ye.Z)(p),w=(0,en.Z)(c,!0),y=(0,i.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!v||!w)return;const{photo:Z,...P}=w,C={content:{webPage:P}};return i.ZP.createElement("div",{className:(0,Fe.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(ea,{message:C,inPreview:!0,theme:d}),i.ZP.createElement(yt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},i.ZP.createElement("i",{className:"icon-close"}))))}))),Qi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0})),eo=(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(yt.Z,{className:(0,Fe.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:a,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,Fe.Z)("bot-menu-icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},s))}));var to;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(to||(to={}));const no="wonderful-voice-message.ogg",so=(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),Z=(0,c.FM)(e,p),P=y&&(0,c.FT)(e,p),C=(0,c.qy)(e,p),{language:b,shouldSuggestStickers:S}=e.settings.byKey,M=e.emojiKeywords[a.pR],E=b!==a.pR?e.emojiKeywords[b]:void 0,R=P?P.id:void 0,k=R?(0,c.hj)(e,p,R):void 0,{currentUserId:N}=e,T=null!=I&&I.fullInfo?(null==I||null===(n=I.fullInfo)||void 0===n?void 0:n.sendAsId)||N:void 0,A=null!=I&&I.sendAsIds&&T&&I.sendAsIds.includes(T)?T:null!=I&&null!==(s=I.adminRights)&&void 0!==s&&s.anonymous?null==I?void 0:I.id:void 0,x=A?(0,c.dy)(e,A):void 0,B=!x&&A?(0,c.Z1)(e,A):void 0,L=(0,c.QV)(e,p),O=(0,c.Bt)(e),U=p===(null==O?void 0:O.chatId)&&f===(null==O?void 0:O.threadId)&&v===(null==O?void 0:O.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:Z,isForCurrentMessageList:U,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:R,botKeyboardPlaceholder:null==k?void 0:k.keyboardPlaceholder,isForwarding:p===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.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:N,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:S,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==M?void 0:M.keywords,emojiKeywords:null==E?void 0:E.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:B,sendAsId:A,editingDraft:$,requestedText:L,attachMenuBots:e.attachMenu.bots,attachMenuPeerType:(0,c.x$)(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:Z,isCurrentUserPremium:P,canSendVoiceByPrivacy:C,connectionState:b,isChatWithBot:S,isChatWithSelf:M,isChannel:E,fileSizeLimit:k,isRightColumnShown:N,isSelectModeActive:T,isForwarding:A,pollModal:x,botKeyboardMessageId:B,botKeyboardPlaceholder:L,withScheduledButton:O,stickersForEmoji:U,groupChatMembers:F,topInlineBotIds:q,currentUserId:D,captionLimit:$,lastSyncTime:j,contentToBeScheduled:G,shouldSuggestStickers:H,baseEmojiKeywords:_,emojiKeywords:z,recentEmojis:W,inlineBots:X,isInlineBotLoading:J,botCommands:Y,chatBotCommands:K,sendAsUser:Q,sendAsChat:ee,sendAsId:te,editingDraft:ne,requestedText:se,botMenuButton:ae,attachMenuBots:ie,attachMenuPeerType:oe,theme:re}=e;const{sendMessage:ce,clearDraft:le,showDialog:de,setStickerSearchQuery:ue,setGifSearchQuery:me,forwardMessages:he,openPollModal:ge,closePollModal:pe,loadScheduledHistory:fe,openChat:ve,addRecentEmoji:Ie,sendInlineBotResult:ye,loadSendAs:Ze,loadFullChat:Pe,resetOpenChatWithText:Ce,callAttachMenuBot:be,openLimitReachedModal:Se,showNotification:Me}=(0,s.Sv)(),Ee=(0,mt.Z)(),Re=(0,i.sO)(null),[ke,Ne]=(0,i.eJ)(""),Te=(0,Ka.Y)(ke),Ae=(0,i.sO)(),xe=(0,Yt.Z)(t),{width:Be}=we.Z.get(),Le=null==y?void 0:y.sendAsIds,Oe=Le&&(Le.length>1||!Le.includes(D)),[Ue,qe,De]=(0,lt.Z)(),Ve=(0,Ya.Z)(g,v),_e=(0,i.I4)((()=>{De()}),[De]),[ze,We]=(0,yi.Z)(r,_e);(0,i.d4)((()=>{Ae.current=void 0}),[g]),(0,i.d4)((()=>{g&&j&&v===o._f&&c&&fe({chatId:g})}),[c,g,fe,j,v]),(0,i.d4)((()=>{g&&y&&j&&!Le&&c&&(0,d.ZV)(y)&&Ze({chatId:g})}),[y,g,c,j,Ze,Le]),(0,i.d4)((()=>{g&&y&&j&&!y.fullInfo&&c&&(0,d.ZV)(y)&&Pe({chatId:g})}),[y,g,c,j,Pe]);const Xe=(0,i.sO)(!1);(0,He.Z)((e=>{let[t,n]=e;Xe.current=Boolean(g===t&&Le&&!n)}),[g,Le]),(0,i.bt)((()=>{Re.current&&(Re.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')}),[]);const[Je,Ye]=(0,i.eJ)([]),[Ke,et,tt]=(0,lt.Z)(),[nt,st,at]=(0,lt.Z)(),[it,ot,ct]=(0,lt.Z)(),[dt,ut,ht]=(0,lt.Z)(),[gt,pt,ft]=(0,lt.Z)(),[vt,It]=(0,lt.Z)(),[wt,Zt,Pt]=(0,lt.Z)(),Ct=(0,i.I4)((e=>{const t="function"==typeof e?e(Je):e;t&&t.some((e=>e.size>k))?Se({limit:"uploadMaxFileparts"}):Ye(t)}),[Je,k,Se]),{startRecordingVoice:bt,stopRecordingVoice:Mt,pauseRecordingVoice:Et,activeVoiceRecording:Rt,currentRecordTime:kt,recordButtonRef:Nt,startRecordTimeRef:Tt}=(()=>{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&&ai()}),[]);const r=(0,i.I4)((async()=>{try{const{stop:t,pause:a}=await ii((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,rt.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:s}})();(0,Qe.Z)((()=>{Ve({type:"recordAudio"})}),Rt&&a.o_),(0,i.d4)((()=>{Rt||Ve({type:"cancel"})}),[Rt,Ve]),(0,i.d4)((()=>{ke&&!m&&Ve({type:"typing"})}),[m,ke,Ve]);const At=m?to.Edit:!h.mh||Rt||ke&&!Je.length||A?n?to.Schedule:to.Send:to.Record,xt=!n,{isMentionTooltipOpen:Bt,closeMentionTooltip:Lt,insertMention:Ot,mentionFilteredUsers:Ut}=(0,ui.Z)(!Je.length,Te,Ne,void 0,F,q,D),{isOpen:Ft,id:qt,isGallery:Dt,switchPm:$t,results:jt,closeTooltip:Gt,help:Ht,loadMore:Vt}=function(e,t,n,a){const{queryInlineBot:o,resetInlineBot:r}=(0,s.Sv)(),[c,l,d]=(0,lt.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=mi((()=>function(e){const t=function(e){return vi.innerHTML=e.replace(/<br>/g,"\n"),vi.innerText}(e),n=t.match(gi);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(pi),usernameLowered:n[1].toLowerCase()}:fi}(n)),300,[n])||{},p=(0,Yt.Z)(m),f=(0,Yt.Z)(u),v=g?null==a?void 0:a[g]:void 0,{id:I,switchPm:w,offset:y,results:Z,isGallery:P,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)((()=>{o({chatId:t,username:g,query:m,offset:y})}),[y,t,m,o,g]);return(0,i.d4)((()=>{e&&I&&(w||null!=Z&&Z.length)?l():d()}),[I,e,l,Z,w,d]),f!==u&&r({username:f}),{isOpen:c,id:I,isGallery:P,switchPm:w,results:Z,closeTooltip:d,help:h&&C?`@${u} ${C}`:void 0,loadMore:b}}(Boolean(!Je.length&&j),g,ke,X),{isOpen:zt,close:Wt,filteredBotCommands:Xt}=function(e,t,n,s){const[a,o,r]=(0,lt.Z)(),[c,l]=(0,i.eJ)(),d=(0,i.I4)((e=>{n||s?Ii((()=>{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,Ja._)(t.substr(1)).match(wi);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(Y&&Y.length||K&&K.length),ke,Y,K),{isContextMenuOpen:Jt,handleContextMenu:Kt,handleContextMenuClose:Qt,handleContextMenuHide:en}=(0,_n.Z)(Nt,!(At===to.Send&&xt)),{canSendStickers:tn,canSendGifs:nn,canAttachMedia:sn,canAttachPolls:an,canAttachEmbedLinks:on}=(0,i.Ye)((()=>(0,d.H5)(y,S)),[y,S]),rn=y&&(0,d.Nl)(y),cn=(0,d.Hd)(y),{isStickerTooltipOpen:ln,closeStickerTooltip:dn}=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(0,i.Ye)((()=>(0,Ja._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,s.Sv)(),l=h.op&&1===(0,Xa.Z)(o)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),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(H&&tn&&!Je.length),ke,U,!c),{isEmojiTooltipOpen:un,closeEmojiTooltip:mn,filteredEmojis:hn,insertEmoji:gn}=(0,di.Z)(Boolean(H&&tn&&!Je.length),Te,W,void 0,Ne,_,z,!c),pn=(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,_a.R)(a,t))return Va(e),void s.dispatchEvent(new Event("input",{bubbles:!0}))}Ne(`${Te.current}${e}`),requestAnimationFrame((()=>{(0,$a.Z)(s)}))}),[Te]),fn=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=(0,En.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");pn(n,t)}),[pn]),vn=(0,i.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,_a.R)(t,a.R2))return void document.execCommand("delete",!1)}Ne(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}(Te.current))}),[Te]),In=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ne(""),Ye(l.D),dn(),Lt(),mn(),h.wB?setTimeout((()=>ct()),350):ct()}),[dn,Lt,mn,ct]),wn=(0,i.sO)();wn.current=Mt,(0,i.d4)((()=>()=>{wn.current(),In()}),[g,In,wn]);const[yn,Zn]=((e,t,n,o,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,s.Sv)();(0,$e.Z)((e=>{let[s]=e;if(!n)return;if((null==s?void 0:s.id)===n.id)return;const i=(0,Hs.z)(null!=h&&h.text.length?h:n.content.text);t(i),requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,$a.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,Hs.z)(m));const e=document.querySelector(a.Ed);e&&requestAnimationFrame((()=>{(0,$a.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,je.Z)(y),Ge(y),[w,I]})(Te,Ne,m,In,pt,g,v,I,w,ne);((e,t,n,o,r,c)=>{const{saveDraft:l,clearDraft:d}=(0,s.Sv)(),u=(0,i.I4)(((e,t)=>{const n=o.current;void 0===n||c||(n.length?l({chatId:e,threadId:t,draft:(0,f.Z)(n)}):d({chatId:e,threadId:t}))}),[d,c,o,l]),m=(0,i.Ye)((()=>(0,R.Ds)((e=>e()),a.r_,!1)),[t]),g=(0,Yt.Z)(t),p=(0,Yt.Z)(n);(0,i.d4)((()=>(ci=t,li=n,()=>{ci=void 0,li=void 0,u(t,n)})),[t,n,u]),(0,i.d4)((()=>{t===g&&n===p||!c&&e&&(r((0,Hs.z)(e)),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,$a.Z)(e,!0)})))}),[t,n,e,r,u,g,p,c]);const v=o.current,I=(0,Yt.Z)(v);(0,i.d4)((()=>{t&&n&&g===t&&p===n&&I!==v&&(v.length?m((()=>{ci===t&&li===n&&u(t,n)})):u(t,n))}),[t,v,g,I,p,m,n,u]);const w=(0,i.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,je.Z)(w),Ge(w)})(w,g,v,Te,Ne,m),((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,oi.Z)(r)),0!==c.length||o){if(c.length>0&&!s){const e=await Promise.all(c.map((e=>Ha(e.name,e,1===c.length&&ri.includes(e.type)))));n((t=>t.concat(e)))}o&&t(o,null==i?void 0:i.id)}}}),[t,s,n,e])})(Z,fn,Ct,m);const Pn=(0,i.I4)((()=>{m&&Zn()}),[m,Zn]),Cn=(0,i.I4)((async(e,t)=>{Ct(await Promise.all(e.map((e=>Ha(e.name,e,t)))))}),[Ct]),bn=(0,i.I4)((async(e,t)=>{Ct([...Je,...await Promise.all(e.map((e=>Ha(e.name,e,t))))])}),[Je,Ct]),Sn=(0,i.I4)((()=>{Ye(l.D)}),[]),Mn=(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=Je;if(Rt){const e=await Mt();if(e){const{blob:t,duration:s,waveform:a}=e;n=[await Ha(no,t,!1,{voice:{duration:s,waveform:a}})]}}const{text:i,entities:o}=(0,f.Z)(Te.current);if(!n.length&&!i&&!A)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 de({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(cn&&!rn){const e=(0,p.b)(r),t=Ae.current&&Math.floor(e-Ae.current),n=cn.nextSendDate&&cn.nextSendDate>e;if(t&&t<cn.seconds||n){const s=n?cn.nextSendDate-e:cn.seconds-t;return de({data:{message:Ee("SlowModeHint",(0,V.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}ce({text:i,entities:o,attachments:n,scheduledAt:t,isSilent:e})}A&&he({scheduledAt:t,isSilent:e}),Ae.current=(0,p.b)(r),le({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&Wa(l),requestAnimationFrame((()=>{In()}))}),[b,Je,Rt,A,le,g,$,In,Mt,de,cn,rn,ce,he,Ee,Te]),Rn=(0,i.I4)((()=>{"webApp"===(null==ae?void 0:ae.type)&&be({botId:g,chatId:g,isFromBotMenu:!0,url:ae.url})}),[ae,be,g]),kn=(0,i.I4)((()=>{ct(),st()}),[ct,st]),Tn=(0,i.I4)((()=>{at(),ht(),ot()}),[at,ht,ot]),An=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:s,isSilent:a}=e;return void ye({id:n,queryId:s,scheduledAt:t,isSilent:a})}const{isSilent:n,...s}=e||{};e&&0!==Object.keys(s).length?ce({...e,scheduledAt:t}):Mn(Boolean(n),t)}),[Mn,ye,ce]);(0,i.d4)((()=>{G&&ze((e=>{An(G,e)}))}),[G,An,ze]),(0,i.d4)((()=>{se&&(Ne(se),Ce(),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,$a.Z)(e,!0)})))}),[se,Ce]);const xn=(0,i.I4)((function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||s?(qe(),ze((n=>{De(),An({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{In(a)}))}))):(ce({sticker:e,isSilent:t}),requestAnimationFrame((()=>{In(a)})))}),[n,qe,ze,De,An,In,ce]),Bn=(0,i.I4)(((e,t,s)=>{n||s?(qe(),ze((n=>{De(),An({gif:e,isSilent:t},n),requestAnimationFrame((()=>{In(!0)}))}))):(ce({gif:e,isSilent:t}),requestAnimationFrame((()=>{In(!0)})))}),[n,qe,ze,De,An,In,ce]),Ln=(0,i.I4)(((e,t,s)=>{if("connectionStateReady"!==b)return;n||s?ze((n=>{An({id:e.id,queryId:e.queryId,isSilent:t},n)})):ye({id:e.id,queryId:e.queryId,isSilent:t});const i=document.querySelector(a.Ed);h.cj&&i&&i===document.activeElement&&Wa(i),le({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{In()}))}),[g,le,b,An,ze,In,ye,n]),On=(0,i.I4)((()=>{le({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{In()}))}),[g,le,In]),Un=(0,i.I4)((e=>{n?(ze((t=>{An({poll:e},t)})),pe()):(ce({poll:e}),pe())}),[pe,An,ze,ce,n]),Fn=(0,i.I4)((()=>{n?ze((e=>{An({isSilent:!0},e)})):Mn(!0)}),[An,Mn,ze,n]),qn=(0,i.I4)((e=>{"stickers"===e?(ue({query:""}),me({query:void 0})):(me({query:""}),ue({query:void 0}))}),[ue,me]),Dn=(0,i.I4)((()=>{const e=document.querySelector(a.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{at(),ot()}),100)):ot()}),[ot,at]),$n=(0,i.I4)((()=>{const e=document.querySelector(a.Ed);if(!h.wB||e!==document.activeElement)return at(),ct(),void ut();null==e||e.blur(),setTimeout((()=>{at(),ct(),ut()}),100)}),[at,ct,ut]),jn=(0,i.I4)((()=>{ve({id:g,threadId:v,type:"scheduled"})}),[ve,g,v]);(0,i.d4)((()=>{N&&h.wB&&ct()}),[N,ct]),(0,i.d4)((()=>{c&&(T?Zt():setTimeout((()=>{Pt()}),200))}),[T,Pt,Zt,c]);const Gn=!(At!==to.Record||sn&&C),Hn=(0,i.I4)((()=>{switch(At){case to.Send:Mn();break;case to.Record:Gn?C||Me({message:Ee("VoiceMessagesRestrictedByPrivacy",null==y?void 0:y.title)}):bt();break;case to.Edit:yn();break;case to.Schedule:Rt&&Et(),ze((e=>{An({},e)}))}}),[At,Mn,yn,Rt,ze,Gn,C,Me,Ee,null==y?void 0:y.title,bt,Et,An]),Vn=(0,Yt.Z)(m,!0),zn=m||Vn,Wn=new Date;Wn.setSeconds(0),Wn.setMilliseconds(0);const Xn=new Date;Xn.setFullYear(Xn.getFullYear()+1);let Jn="SendMessage";switch(At){case to.Edit:Jn="Save edited message";break;case to.Record:Jn=sn?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const Yn=(0,Fe.Z)("Composer",!T&&"shown",wt&&"hover-disabled"),Kn=(0,Fe.Z)("mobile-symbol-menu-button",!c&&"not-ready",vt?it&&"menu-opened":it&&"is-loading"),Qn=(0,i.I4)((()=>{ze((e=>{An({},e)}))}),[An,ze]),es=At===to.Edit?yn:At===to.Schedule?Qn:Mn,ts=ae&&"commands"===(null==ae?void 0:ae.type);return i.ZP.createElement("div",{className:Yn},sn&&c&&i.ZP.createElement(Ji,{isOpen:t!==_t.t.None,withQuick:t===_t.t.QuickFile||xe===_t.t.QuickFile,onHide:u,onFileSelect:Cn}),i.ZP.createElement(zi,{chatId:g,threadId:v,canShowCustomSendMenu:xt,attachments:Je,captionLimit:$,caption:Je.length?ke:"",groupChatMembers:F,currentUserId:D,recentEmojis:W,isReady:c,isChatWithSelf:M,onCaptionUpdate:Ne,baseEmojiKeywords:_,emojiKeywords:z,addRecentEmoji:Ie,shouldSchedule:n,onSendSilent:Fn,onSend:Mn,onSendScheduled:Qn,onFileAppend:bn,onClear:Sn}),i.ZP.createElement(Xi,{isOpen:x.isOpen,isQuiz:x.isQuiz,shouldBeAnonymous:E,onClear:pe,onSend:Un}),zn&&i.ZP.createElement(Zi,{isOpen:gt,isSchedule:"scheduled"===I,onClose:ft,message:zn}),i.ZP.createElement(Qi,{isOpen:dt,onClose:ht,chatId:g,selectedSendAsId:te,sendAsIds:Le}),i.ZP.createElement(Oi,{isOpen:Bt,onClose:Lt,onInsertUserName:Ot,filteredUsers:Ut}),i.ZP.createElement(Li,{isOpen:Ft,botId:qt,isGallery:Dt,inlineBotResults:jt,switchPm:$t,onSelectResult:Ln,loadMore:Vt,onClose:Gt,isSavedMessages:M,canSendGifs:nn,isCurrentUserPremium:P}),i.ZP.createElement(Di,{isOpen:zt,withUsername:Boolean(K),botCommands:Xt,onClick:On,onClose:Wt}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:Re}),i.ZP.createElement(_i,{onClear:Pn}),i.ZP.createElement(Ki,{chatId:g,threadId:v,messageText:Je.length?"":ke,disabled:!on}),i.ZP.createElement("div",{className:"message-input-wrapper"},S&&ae&&"webApp"===ae.type&&!m&&i.ZP.createElement(eo,{isOpen:!ke&&!Rt,onClick:Rn,text:ae.text,isDisabled:Boolean(Rt)}),S&&ts&&!1!==Y&&!Rt&&!m&&i.ZP.createElement(Si,{className:(0,Fe.Z)("bot-commands",nt&&"activated"),round:!0,disabled:void 0===Y,color:"translucent",onActivate:kn,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),Oe&&(Q||ee)&&i.ZP.createElement(yt.Z,{round:!0,color:"translucent",onClick:dt?ht:$n,ariaLabel:Ee("SendMessageAsTitle"),className:(0,Fe.Z)("send-as-button",Xe.current&&"appear-animation")},i.ZP.createElement(Nn.Z,{user:Q,chat:ee,size:"tiny"})),h.wB?i.ZP.createElement(yt.Z,{className:Kn,round:!0,color:"translucent",onClick:it?ct:Dn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"}),i.ZP.createElement("i",{className:"icon-keyboard"}),it&&!vt&&i.ZP.createElement(St.Z,{color:"gray"})):i.ZP.createElement(Si,{className:it?"activated":"",round:!0,color:"translucent",onActivate:Tn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"})),i.ZP.createElement(ji.Z,{id:"message-input-text",chatId:g,threadId:v,html:Je.length?"":ke,placeholder:Rt&&Be<=600?"":L||Ee("Message"),forcedPlaceholder:Ht,canAutoFocus:c&&!Je.length,shouldSuppressFocus:h.wB&&it,shouldSuppressTextFormatter:un||Bt||Ft,onUpdate:Ne,onSend:es,onSuppressedFocus:ct}),J&&Boolean(qt)&&i.ZP.createElement(St.Z,{color:"gray"}),O&&i.ZP.createElement(yt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:jn,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),B&&!Rt&&!m&&i.ZP.createElement(Si,{className:Ke?"activated":"",round:!0,color:"translucent",onActivate:et,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),Rt&&kt&&i.ZP.createElement("span",{className:"recording-state"},(0,V.rM)(kt-Tt.current)),i.ZP.createElement(xi,{chatId:g,isButtonVisible:!Rt&&!m,canAttachMedia:sn,canAttachPolls:an,onFileSelect:Cn,onPollCreate:ge,isScheduled:n,attachMenuBots:ie,peerType:oe,theme:re}),B&&i.ZP.createElement($i,{messageId:B,isOpen:Ke,onClose:tt}),Y&&i.ZP.createElement(Wi,{isOpen:nt,botCommands:Y,onClose:at}),i.ZP.createElement(Fi,{chatId:g,threadId:v,isOpen:ln,onStickerSelect:xn}),i.ZP.createElement(qi.Z,{isOpen:un,emojis:hn,onClose:mn,onEmojiSelect:gn,addRecentEmoji:Ie}),i.ZP.createElement(Bi,{chatId:g,threadId:v,isOpen:it||Ue,canSendGifs:nn,canSendStickers:tn,onLoad:It,onClose:ct,onEmojiSelect:fn,onStickerSelect:xn,onGifSelect:Bn,onRemoveSymbol:vn,onSearchOpen:qn,addRecentEmoji:Ie}))),Rt&&i.ZP.createElement(yt.Z,{round:!0,color:"danger",className:"cancel",onClick:Mt,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(yt.Z,{ref:Nt,round:!0,color:"secondary",className:(0,Fe.Z)(At,!c&&"not-ready",Rt&&"recording"),disabled:Gn,allowDisabledClick:!0,ariaLabel:Ee(Jn),onClick:Hn,onContextMenu:At===to.Send&&xt?Kt: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"})),xt&&i.ZP.createElement(Ui.Z,{isOpen:Jt,onSendSilent:M?void 0:Fn,onSendSchedule:n?void 0:Qn,onClose:Qt,onCloseAnimationEnd:en,isSavedMessages:M}),We)}))),ao=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,tt.Z)(et.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),io=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,tt.Z)(et.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),oo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),ro=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),co=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,tt.Z)(et.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),lo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),uo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0})),mo=h.wB?450+a.fK:void 0;function ho(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const go=(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,Z=(0,d.YC)(I),P=(0,c.Z1)(e,I),C=(0,c.IK)(e,I),b=(0,c.KB)(e,I),{chatId:S,messageId:M}=e.audioPlayer,E=P&&(0,d.Qm)(P,w),R=(0,c.pk)(e,I),k="pinned"===y,N="scheduled"===y,T="thread"===y&&w===o._f,A=Boolean(P&&(0,d.eA)(P)),x=Boolean(P&&T&&(A||(0,d.ZV)(P))&&P.isNotJoined&&!P.joinRequests),B=Boolean((null==P?void 0:P.isNotJoined)&&P.isJoinToSend),L=Boolean((null==P?void 0:P.isNotJoined)&&P.isJoinRequest),O=Boolean(C&&(0,c.s4)(e,C.id)),U=!O&&R;return{...v,chatId:I,threadId:w,messageListType:y,isPrivate:Z,areChatSettingsLoaded:Boolean(null==P?void 0:P.settings),canPost:!k&&(!P||E)&&!R&&!(B&&null!=P&&P.isNotJoined),isPinnedMessageList:k,isScheduledMessageList:N,currentUserBannedRights:null==P?void 0:P.currentUserBannedRights,defaultBannedRights:null==P?void 0:P.defaultBannedRights,hasPinnedOrAudioPlayer:w!==o._f||Boolean(!k&&(null==b?void 0:b.length))||Boolean(S&&M),pinnedMessagesCount:b?b.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:A,canSubscribe:x,canStartBot:U,canRestartBot:O,shouldJoinToSend:B,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:Z,isBackgroundBlurred:P,isMobileSearchActive:C,isSelectModeActive:b,isSeenByModalOpen:S,isReactorListModalOpen:M,isGiftPremiumModalOpen:E,animationLevel:R,shouldSkipHistoryAnimations:k,currentTransitionKey:N,isChannel:T,areChatSettingsLoaded:A,canSubscribe:x,canStartBot:B,canRestartBot:L,activeEmojiInteractions:O,shouldJoinToSend:U,shouldSendJoinRequest:F,lastSyncTime:q}=e;const{openChat:D,openPreviousChat:$,unpinAllMessages:j,loadUser:G,loadChatSettings:H,closeLocalTextSearch:V,exitMessageSelectMode:_,joinChannel:z,sendBotCommand:W,restartBot:X,showNotification:J}=(0,s.Sv)(),{width:Y}=(0,Xt.Z)(),K=(0,mt.Z)(),[Q,ee]=(0,i.eJ)(_t.t.None),[te,ne]=(0,i.eJ)(),[se,ae]=(0,i.eJ)(),[ie,oe]=(0,i.eJ)(!1),re=g&&(Y<a.l3||Z&&Y>a._m&&Y<a.QU||Y>=a.ks&&Y<a.jT),ce=(0,Jt.Z)(t,mo),le=(0,Jt.Z)(n,mo),de=(0,Jt.Z)(o,mo),ue=(0,Jt.Z)(x,mo),me=(0,Jt.Z)(B,mo),he=(0,Jt.Z)(L,mo),ge=(0,Jt.Z)(l,mo)&&!he&&!me&&!ue,pe=(0,Jt.Z)(re,mo),we=(0,Jt.Z)(te,mo),ye=(0,Jt.Z)(T,mo),Ze=(0,Jt.Z)(U,mo),Pe=(0,Jt.Z)(F,mo),Ce=(0,Yt.Z)(N),be=void 0!==Ce&&Ce<N?Ce:void 0,{isReady:Se,handleOpenEnd:Me,handleSlideStop:Ee}=function(e,t,n,s){const[a,o]=(0,i.eJ)(!h.wB),r=(0,Xe.Z)(),c=void 0!==n&&n!==t;return c&&(e?o(!1):r()),(0,He.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,N,Ce,t);(0,i.d4)((()=>t?(0,rt.Z)((()=>{D({id:void 0})})):void 0),[t,D]),(0,He.Z)((()=>{ee(_t.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)((()=>{!A&&q&&H({chatId:t})}),[t,r,A,q,H]);const Re=(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(ho);ee(n?_t.t.QuickFile:_t.t.Document)}),[]),ke=(0,i.I4)((()=>{ee(_t.t.None)}),[]),Ne=(0,i.I4)((()=>{oe(!0)}),[]),Te=(0,i.I4)((()=>{oe(!1)}),[]),Ae=(0,i.I4)((()=>{j({chatId:t}),Te(),$()}),[j,t,Te,$]),xe=(0,i.I4)((()=>{D({id:t})}),[D,t]),Be=(0,i.I4)((()=>{z({chatId:t}),Pe&&J({message:K(T?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[z,t,Pe,J,T,K]),Le=(0,i.I4)((()=>{W({command:"/start"})}),[W]),Oe=(0,i.I4)((()=>{X({chatId:t})}),[t,X]),Ue=((e,t)=>{const[n,s]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?s(t):zt.fetch(a.fo,e,zt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Wt.pt)(t).then((()=>{s(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(v,f),qe=(0,Fe.Z)(pe&&"has-header-tools",h.aZ?"mask-image-disabled":"mask-image-enabled"),De=(0,Fe.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",f&&"Ik9ZZlj3eKtKXRrUZKVk",I&&"avVozLQe3SaWcSkIt6pG",f&&P&&"Tipa66fYcSvl6w0587Xz",Z&&"vhOr8s3T_LCKSt2BF7fs"),$e=(0,Fe.Z)("messaging-disabled",!b&&"shown"),je=(0,d.q8)(K,u,m),{composerHiddenScale:Ge,toolbarHiddenScale:Ve,composerTranslateX:_e,toolbarTranslateX:ze,unpinHiddenScale:We,toolbarForUnpinHiddenScale:Ye}=(0,i.Ye)((()=>function(e,t){const n=e<=a.l3?16:32,s=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,Ie),ve),n=Math.min(.25*e,ve);return Math.min(e-t-n,fe)}if(e>a.ks){const t=Math.min(Math.max(.4*e,Ie),ve);return Math.min(e-t,fe)}return e>fe?fe:e}(e),i=e<=a.l3?54:64,o=t?s-n-i:s-n,r=e>a.l3?Math.min(s-n,512):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/258,toolbarForUnpinHiddenScale:258/r}}(Y,ge)),[ge,Y]),Ke=(0,Fe.Z)("middle-column-footer",!ge&&"no-composer",ge&&se&&!b&&"with-notch");(0,Je.Z)({isActive:b,onBack:_}),(0,Je.Z)({isActive:C,onBack:V});const Qe=Boolean(!c&&!ge&&!he&&!me&&!ue&&je),et=Boolean(he||ue||me||c),tt=Boolean(Qe||b||c);return i.ZP.createElement("div",{id:"MiddleColumn",className:qe,onTransitionEnd:Me,style:`\n --composer-hidden-scale: ${Ge};\n --toolbar-hidden-scale: ${Ve};\n --unpin-hidden-scale: ${We};\n --toolbar-unpin-hidden-scale: ${Ye};\n --composer-translate-x: ${_e}px;\n --toolbar-translate-x: ${ze}px;\n --pattern-color: ${w};\n --theme-background-color:\n ${I||("dark"===v?a.It:a.p3)};\n `,onClick:h.p7&&y?xe:void 0},i.ZP.createElement("div",{className:De,style:Ue?`--custom-background: ${Ue}`: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?Re:void 0},i.ZP.createElement(Bn,{chatId:ce,threadId:le,messageListType:de,isReady:Se}),i.ZP.createElement(ut.Z,{name:k?"none":R===a.zy?"slide":"fade",activeKey:N,shouldCleanup:!0,cleanupExceptionKey:be,onStop:Ee},i.ZP.createElement(Fa,{key:`${ce}-${le}-${de}`,chatId:ce,threadId:le,type:de,canPost:ge,hasTools:pe,onFabToggle:ne,onNotchToggle:ae,isReady:Se,withBottomShift:et}),i.ZP.createElement("div",{className:Ke},ge&&i.ZP.createElement(so,{chatId:ce,threadId:le,messageListType:de,dropAreaState:Q,onDropHide:ke,isReady:Se}),c&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(yt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Ne},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,K("Chat.Pinned.UnpinAll",p,"i")))),Qe&&i.ZP.createElement("div",{className:$e},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,je))),h.wB&&(ue||Ze&&!Pe)&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(yt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Be},K(ye?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&Pe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(yt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Be},K("ChannelJoinRequest"))),h.wB&&me&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(yt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Le},K("BotStart"))),h.wB&&he&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},i.ZP.createElement(yt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Oe},K("BotRestart"))),i.ZP.createElement(io,{messageListType:de,isActive:b,canPost:ge}),i.ZP.createElement(ro,{isOpen:S}),i.ZP.createElement(lo,{isOpen:M}))),i.ZP.createElement(Da,{isShown:we,canPost:ge,withExtraShift:tt})),h.wB&&i.ZP.createElement(ao,{isActive:Boolean(C)})),t&&i.ZP.createElement(oo,{isOpen:ie,chatId:t,pinnedMessagesCount:p,onClose:Te,onUnpin:Ae}),i.ZP.createElement("div",{teactFastList:!0},null==O?void 0:O.map(((e,t)=>i.ZP.createElement(co,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(uo,{isOpen:E}))}))),po=450+a.fK,fo=(0,R.Ds)((e=>e()),200,!1);var vo;!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"}(vo||(vo={}));const Io=(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,Z=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:Z,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:Z,isChannel:P,onClose:C,onScreenSelect:b,messageSearchQuery:S,stickerSearchQuery:M,gifSearchQuery:E,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N,shouldSkipHistoryAnimations:T}=e;const{setLocalTextSearchQuery:A,setStickerSearchQuery:x,setGifSearchQuery:B,searchTextMessagesLocal:L,toggleManagement:O,openHistoryCalendar:U,openAddContactDialog:F,toggleStatistics:q,setEditingExportedInvite:D,deleteExportedChatInvite:$}=(0,s.Sv)(),[j,G,H]=(0,lt.Z)(),_=(0,i.I4)((()=>{D({chatId:n,invite:N}),b(m.u1.EditInvite)}),[n,N,b,D]),z=(0,i.I4)((()=>{$({chatId:n,link:N.link}),b(m.u1.Invites),H()}),[n,H,N,$,b]),W=(0,i.I4)((e=>{A({query:e}),e.length&&fo(L)}),[L,A]),X=(0,i.I4)((e=>{x({query:e})}),[x]),J=(0,i.I4)((e=>{B({query:e})}),[B]),Y=(0,i.I4)((()=>{F({userId:y})}),[F,y]),[K,Q]=(0,i.eJ)(!a);(0,i.d4)((()=>{setTimeout((()=>{Q(!a)}),po)}),[a]);const ee=(0,mt.Z)(),te=o?v===m.vi.Profile?vo.Profile:v===m.vi.SharedMedia?vo.SharedMedia:v===m.vi.MemberList?vo.MemberList:-1:r?vo.Search:p?vo.PollResults:u?vo.StickerSearch:g?vo.GifSearch:f?vo.AddingMembers:c?I===m.u1.Initial?vo.ManageInitial:I===m.u1.ChatPrivacyType?vo.ManageChatPrivacyType:I===m.u1.Discussion?vo.ManageDiscussion:I===m.u1.ChannelSubscribers?vo.ManageChannelSubscribers:I===m.u1.GroupPermissions?vo.ManageGroupPermissions:I===m.u1.ChatAdministrators?vo.ManageChatAdministrators:I===m.u1.GroupRemovedUsers?vo.ManageGroupRemovedUsers:I===m.u1.ChannelRemovedUsers?vo.ManageChannelRemovedUsers:I===m.u1.GroupUserPermissionsCreate?vo.ManageGroupUserPermissionsCreate:I===m.u1.GroupUserPermissions?vo.ManageGroupUserPermissions:I===m.u1.GroupRecentActions?vo.ManageGroupRecentActions:I===m.u1.ChatAdminRights?vo.ManageGroupAdminRights:I===m.u1.ChatNewAdminRights?vo.ManageGroupNewAdminRights:I===m.u1.GroupMembers?vo.ManageGroupMembers:I===m.u1.Invites?vo.ManageInvites:I===m.u1.EditInvite?vo.ManageEditInvite:I===m.u1.GroupAddAdmins?vo.ManageGroupAddAdmins:I===m.u1.Reactions?vo.ManageReactions:I===m.u1.InviteInfo?vo.ManageInviteInfo:I===m.u1.JoinRequests?vo.ManageJoinRequests:void 0:l?vo.Statistics:d?vo.MessageStatistics:void 0,ne=null!==(t=(0,en.Z)(te,!0))&&void 0!==t?t:-1,se=h.wB||te===vo.SharedMedia||te===vo.MemberList||te===vo.AddingMembers||te===vo.MessageStatistics||c,ae=(0,Fe.Z)("animated-close-icon",se&&"state-back",(K||T)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(yt.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(ut.Z,{name:K||T?"none":"slide-fade",activeKey:ne},function(){if(-1!==ne)switch(ne){case vo.PollResults:return i.ZP.createElement("h3",null,ee("PollResults"));case vo.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Zt.Z,{parentContainerClassName:"RightSearch",value:S,onChange:W}),i.ZP.createElement(yt.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 vo.AddingMembers:return i.ZP.createElement("h3",null,ee(P?"ChannelAddSubscribers":"GroupAddMembers"));case vo.ManageInitial:return i.ZP.createElement("h3",null,ee("Edit"));case vo.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ee(P?"ChannelTypeHeader":"GroupTypeHeader"));case vo.ManageDiscussion:return i.ZP.createElement("h3",null,ee("Discussion"));case vo.ManageChatAdministrators:return i.ZP.createElement("h3",null,ee("ChannelAdministrators"));case vo.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ee("Group.Info.AdminLog"));case vo.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ee("EditAdminRights"));case vo.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ee("SetAsAdmin"));case vo.ManageGroupPermissions:return i.ZP.createElement("h3",null,ee("ChannelPermissions"));case vo.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ee("BlockedUsers"));case vo.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ee("ChannelBlockedUsers"));case vo.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ee("ChannelAddException"));case vo.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ee("UserRestrictions"));case vo.ManageInvites:return i.ZP.createElement("h3",null,ee("lng_group_invite_title"));case vo.ManageEditInvite:return i.ZP.createElement("h3",null,ee(R?"EditLink":"NewLink"));case vo.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ee("InviteLink")),i.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&i.ZP.createElement(yt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:_},i.ZP.createElement("i",{className:"icon-edit"})),N&&N.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(yt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ee("Delete"),onClick:G},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(un.Z,{isOpen:j,onClose:H,title:ee("DeleteLink"),text:ee("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ee("Delete"),confirmHandler:z}))));case vo.ManageJoinRequests:return i.ZP.createElement("h3",null,ee(P?"SubscribeRequests":"MemberRequests"));case vo.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ee("Channel.Management.AddModerator"));case vo.StickerSearch:return i.ZP.createElement(Zt.Z,{value:M,placeholder:ee("SearchStickersHint"),autoFocusSearch:!0,onChange:X});case vo.GifSearch:return i.ZP.createElement(Zt.Z,{value:E,placeholder:ee("SearchGifsTitle"),autoFocusSearch:!0,onChange:J});case vo.Statistics:return i.ZP.createElement("h3",null,ee(P?"ChannelStats.Title":"GroupStats.Title"));case vo.MessageStatistics:return i.ZP.createElement("h3",null,ee("Stats.MessageTitle"));case vo.SharedMedia:return i.ZP.createElement("h3",null,ee("SharedMedia"));case vo.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ee("ChannelSubscribers"));case vo.MemberList:case vo.ManageGroupMembers:return i.ZP.createElement("h3",null,ee("GroupMembers"));case vo.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(yt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("AddContact"),onClick:Y},i.ZP.createElement("i",{className:"icon-add-user"})),Z&&i.ZP.createElement(yt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:O},i.ZP.createElement("i",{className:"icon-edit"})),k&&i.ZP.createElement(yt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Statistics"),onClick:q},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var wo=n(91);var yo=n(27407);function Zo(e,t,n,s){const[i,o]=(0,yo.Z)(n?t:void 0,s,void 0,a.Vk);return[i,o,!(!i||!s||i[0]===s[0])]}function Po(e,t,n,s,o,r){const c=(0,i.sO)();(0,He.Z)((()=>{t===e&&o&&r&&(c.current=(0,d.R5)(o,r,e))}),[o,r,t,e]);const[l,u]=(0,yo.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 Co=(0,R.P2)((e=>e()),250,!1);let bo=!1;var So=n(21273),Mo=n(31876),Eo=n(20787),Ro=n(70180),ko=n(13709),No=n(45418),To=n(47262),Ao=n(41151),xo=n(22275);const Bo=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function Lo(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Oo=(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),Z=v&&i&&((0,d.VE)(i,"banUsers")||i.isCreator),P=(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:Z,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:null==i?void 0:i.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:P,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:Z,canDeleteMembers:P,commonChatIds:C,members:b,usersById:S,userStatusesById:M,chatsById:E,isRightColumnShown:R,isRestricted:k,lastSyncTime:N,activeDownloadIds:T,serverTimeOffset:A,isChatProtected:x}=e;const{setLocalMediaSearchType:B,loadMoreMembers:L,loadCommonChats:O,openChat:U,searchMediaMessagesLocal:F,openMediaViewer:q,openAudioPlayer:D,focusMessage:$,loadProfilePhotos:j,setNewChatMembersDialogState:G}=(0,s.Sv)(),H=(0,i.sO)(null),V=(0,i.sO)(null),_=(0,mt.Z)(),[z,W]=(0,i.eJ)(0),[X,J]=(0,i.eJ)(),Y=(0,i.Ye)((()=>[...w?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...Bo,...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]),[Z,P,C]=Zo(0,t,f,w),[b,S,M]=Po("media",I,s,f,h,g),[E,R,k]=Po("documents",I,s,f,h,g),[N,T,A]=Po("links",I,s,f,h,g),[x,B,L]=Po("audio",I,s,f,h,g),[O,U,F]=Po("voice",I,s,f,h,g),[q,D,$]=Zo(0,n,f,y);let j,G,H=!1;switch(I){case"members":j=Z,G=P,H=C;break;case"commonChats":j=q,G=D,H=$;break;case"media":j=b,G=S,H=M;break;case"documents":j=E,G=R,H=k;break;case"links":j=N,G=T,H=A;break;case"audio":j=x,G=B,H=L;break;case"voice":j=O,G=U,H=F}return[I,j,G,H]}(R,L,O,F,K,v,b,C,S,M,E,p,f,t,N,A),se=Y.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:ae}=function(e,t,n,s){(0,$e.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),bo=!0,(0,qn.Z)(n,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{bo=!1}),350))}}),[t,s]),(0,$e.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||(bo=!0,(0,qn.Z)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{bo=!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)((()=>{bo||a()}),[a,t]),{handleScroll:(0,i.I4)((()=>{bo||Co(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]=(()=>{const[e,t]=(0,i.eJ)(!1);return[e,(0,i.I4)((()=>{t((e=>!e))}),[])]})(),{observe:le}=(0,Gn.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)((()=>{B({mediaType:K})}),[B,K]);const me=u||t;(0,i.d4)((()=>{N&&j({profileId:me})}),[j,me,N]);const he=(0,i.I4)((e=>{q({chatId:me,threadId:o._f,mediaId:e,origin:m.bZ.SharedMedia})}),[me,q]),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=>{$({chatId:me,messageId:e})}),[me,$]),ve=(0,i.I4)((()=>{J(void 0)}),[]);let Ie;(0,i.d4)((()=>{if(V.current&&h.$b)return(0,Rt.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Rt.eM.Left?(W(Math.min(z+1,Y.length-1)),!0):t===Rt.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,Gi.Z)([t,Q],Ie);return i.ZP.createElement(So.Z,{ref:H,className:"Profile custom-scroll",itemSelector:Lo(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){return i.ZP.createElement("div",{className:"profile-info"},i.ZP.createElement(Eo.Z,{userId:t||e}),i.ZP.createElement(Ro.Z,{chatOrUserId:t||e}))}(t,u),!k&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(ut.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(St.Z,null),t&&i.ZP.createElement(To.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(To.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(ko.Z,{key:e,message:p[e],isProtected:x||p[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>p[e]&&i.ZP.createElement(vs.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(No.Z,{key:e,message:p[e],isProtected:x||p[e].isProtected,observeIntersection:le,onMessageClick:fe}))):"audio"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Is.ZP,{key:e,theme:c,message:p[e],origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,canDownload:!x&&!p[e].isProtected,isDownloading:T.includes(e)}))):"voice"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Is.ZP,{key:e,theme:c,message:p[e],senderTitle:(0,wo.F)(_,p[e],E,S),origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,canDownload:!x&&!p[e].isProtected,isDownloading:T.includes(e)}))):"members"===Q?ee.map(((e,t)=>{return i.ZP.createElement(Mo.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>pe(e),contextActions:(n=e,n!==g&&P?[{title:_("lng_context_remove_from_group"),icon:"stop",handler:()=>{J(n)}}]:void 0)},i.ZP.createElement(tn.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>i.ZP.createElement(Mo.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},i.ZP.createElement(nn.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(kt.Z,{big:!0,activeTab:z,tabs:Y,onSwitchTab:W})),Z&&i.ZP.createElement(Ao.Z,{isShown:"members"===Q,onClick:ue,ariaLabel:_("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&i.ZP.createElement(xo.Z,{isOpen:Boolean(X),userId:X,onClose:ve}))}))),Uo=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)})),Fo=(0,i.X$)((e=>{const t=(0,tt.Z)(et.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)})),qo=e=>{const t=(0,tt.Z)(et.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)},Do=e=>{const t=(0,tt.Z)(et.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(At.Z,null)},$o=(0,i.X$)((()=>{const e=(0,tt.Z)(et.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(At.Z,null)})),jo=(0,i.X$)((()=>{const e=(0,tt.Z)(et.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(At.Z,null)})),Go=(0,i.X$)((()=>{const e=(0,tt.Z)(et.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(At.Z,null)}));var Ho=n(11820);const Vo=(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,mt.Z)(),[y,Z]=(0,i.eJ)([]),P=(0,Yt.Z)(y)===y;(0,Je.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]),M=(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(Ho.Z,{itemIds:S,selectedIds:y,filterValue:u,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:Z,onFilterChange:b,noScrollRestore:P}),i.ZP.createElement(Ao.Z,{isShown:Boolean(y.length),disabled:l,ariaLabel:w("lng_channel_add_users"),onClick:M},l?i.ZP.createElement(St.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),_o=450+a.fK,zo=Object.keys(m.qt).length/2,Wo=Object.keys(m.u1).length/2;function Xo(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Jo=(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:Z,toggleMessageStatistics:P,setOpenedInviteInfo:C,requestNextManagementScreen:b}=(0,s.Sv)(),{width:S}=(0,Xt.Z)(),[M,E]=(0,i.eJ)(m.vi.Profile),[R,k]=(0,i.eJ)(m.u1.Initial),[N,T]=(0,i.eJ)(),[A,x]=(0,i.eJ)(),B=M!==m.vi.Profile,L=void 0!==n,O=n===m.qt.ChatInfo,U=n===m.qt.Search,F=n===m.qt.Management,q=n===m.qt.Statistics,D=n===m.qt.MessageStatistics,$=n===m.qt.StickerSearch,j=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,en.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(B&&e){E(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),x(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:P();break;case m.qt.Statistics:Z();break;case m.qt.Search:Xo(),g();break;case m.qt.StickerSearch:Xo(),p({query:void 0});break;case m.qt.GifSearch:Xo(),f({query:void 0});break;case m.qt.PollResults:v()}}),[n,B,u,v,w,R,h,g,p,f,y,o,C,Z,P]),J=(0,i.I4)(((e,t)=>{T(e),x(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(Vo,{key:o,chatId:o,isActive:L&&e,onNextStep:Y,onClose:X});case m.qt.ChatInfo:return i.ZP.createElement(Oo,{key:o,chatId:o,profileState:M,onProfileStateChange:E});case m.qt.Search:return i.ZP.createElement(Uo,{chatId:o,threadId:r,onClose:X,isActive:L&&e});case m.qt.Management:return i.ZP.createElement(Fo,{key:o,chatId:o,currentScreen:R,isPromotedByCurrentUser:A,selectedChatMemberId:N,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(Do,{chatId:o,isActive:L&&e});case m.qt.StickerSearch:return i.ZP.createElement($o,{onClose:X,isActive:L&&e});case m.qt.GifSearch:return i.ZP.createElement(jo,{onClose:X,isActive:L&&e});case m.qt.PollResults:return i.ZP.createElement(Go,{onClose:X,isActive:L&&e})}}return(0,i.d4)((()=>L?(0,rt.Z)(X):void 0),[L,X]),(0,i.d4)((()=>{setTimeout((()=>{z(!L)}),_o)}),[L]),(0,i.d4)((()=>{d&&(k(d),b(void 0))}),[d,b]),(0,i.d4)((()=>{L&&V&&X()}),[V]),(0,jn.Z)((e=>{let[t]=e;t!==o&&(E(m.vi.Profile),k(m.u1.Initial))}),[o]),(0,Je.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(Io,{chatId:o,isColumnOpen:L,isProfile:O,isSearch:U,isManagement:F,isStatistics:q,isMessageStatistics:D,isStickerSearch:$,isGifSearch:j,isPollResults:G,isAddingChatMembers:H,profileState:M,managementScreen:R,onClose:X,onScreenSelect:k}),i.ZP.createElement(ut.Z,{name:_||l?"none":"zoom-fade",renderCount:zo+Wo,activeKey:F?zo+R:W,shouldCleanup:!0,cleanupExceptionKey:W===m.qt.MessageStatistics?m.qt.Statistics:void 0},K)))}))),Yo=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,tt.Z)(et.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0}));let Ko=[],Qo=!1;function er(e,t){Ko.push({url:e,filename:t}),Qo||(Qo=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Ko)tr(t),e++,10===e&&(await(0,R.wO)(1e3),e=0);Ko=[]}(),Qo=!1}),1e3))}function tr(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 nr=new Set,sr=new Set,ar=(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,Dn.Z)(1e3,!0),l=(0,i.I4)((e=>{sr.add(e),c((()=>{sr.size&&(a({messages:Array.from(sr)}),sr.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(nr.has(e))return;nr.add(e);const n=(0,d.Ti)(e,"download");if(!n)return void l(e);const s=ge.UV(n);if(s)return er(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");ge.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&&er(t,(0,d.w6)(e));l(e)}))})):nr.clear()}),[n,t,a,l,r])})));var ir=n(65116),or=n(13103);const rr=(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,ir.Sv)(),r=(0,mt.Z)(),{url:c,chatId:l,messageId:d}=t||{},u=Boolean(c),m=(0,Ya.Z)(l);(0,Qe.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 we.Z.disableRefresh(),()=>{we.Z.enableRefresh()}}),[u]),i.ZP.createElement(or.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"}))}))),cr=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,tt.Z)(et.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),lr=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,tt.Z)(et.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),dr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"ForwardPicker",!t);return n?i.ZP.createElement(n,e):void 0})),ur=(0,i.X$)((e=>{const{url:t}=e,n=(0,tt.Z)(et.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),mr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),hr=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,tt.Z)(et.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),gr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,tt.Z)(et.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),pr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,tt.Z)(et.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0}));var fr=n(15780);function vr(){return vr=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},vr.apply(this,arguments)}const Ir=(0,i.X$)((0,ir.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,ir.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},a=e=>{let{chatId:t,type:n,threadId:a}=e;(0,Je.Z)({isActive:!0,hash:(0,fr.q)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,null==t?void 0:t.map(((e,t)=>i.ZP.createElement(a,vr({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),wr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0})),yr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0})),Zr=(0,i.X$)((e=>{const{webApp:t}=e,n=(0,tt.Z)(et.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0})),Pr=(0,i.X$)((e=>{const{bot:t}=e,n=(0,tt.Z)(et.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0})),Cr=(0,i.X$)((e=>{const{bot:t}=e,n=(0,tt.Z)(et.gl.Extra,"BotAttachModal",!t);return n?i.ZP.createElement(n,e):void 0}));var br=n(80036);const Sr={root:"vfd0Bo1X6k19aaxQ577t"},Mr=h.wB?50:100,Er=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Rr=(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,Xt.Z)(),r=(0,Xe.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,Z=Date.now();if(f.y>o+e.size)return void r.push(e);const P={...e,pos:f,velocity:v,flicker:I,rotation:w,lastDrawnAt:Z,frameCount:y};s.current[n]=P,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,He.Z)((e=>{let t,[n]=e;return n!==c&&(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mr;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=Er[Math.floor(Math.random()*Er.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,br.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:Sr.root,style:g},i.ZP.createElement("canvas",{ref:n,className:Sr.canvas,width:o.width,height:o.height}))}))),kr=(0,i.X$)((e=>{const{urlAuth:t}=e,n=(0,tt.Z)(et.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0})),Nr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0})),Tr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ar=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,tt.Z)(et.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),xr=(0,i.X$)((e=>{const{limit:t}=e,n=(0,tt.Z)(et.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0})),Br=(0,i.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,tt.Z)(et.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0})),Lr=(0,i.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,tt.Z)(et.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0}));let Or,Ur=!1;function Fr(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 Dr=(0,i.X$)((0,s.c$)((e=>{var t,n,s,a,i;const{settings:{byKey:{animationLevel:o,language:r,wasTimeFormatSetManually:l}},botTrustRequest:d,botAttachRequest:u}=e,{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,c.hj)(e,m,h):void 0,p=e.openedGame,f=p&&(0,c.hj)(e,p.chatId,p.messageId),v=null==f||null===(t=f.content.game)||void 0===t?void 0:t.title,I=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;return{connectionState:e.connectionState,authState:e.authState,lastSyncTime:e.lastSyncTime,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:g,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,openedCustomEmojiSetIds:e.openedCustomEmojiSetIds,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:p,gameTitle:v,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall),botTrustRequest:d,botTrustRequestBot:d&&(0,c.dy)(e,d.botId),botAttachRequestBot:u&&(0,c.dy)(e,u.botId),webApp:e.webApp,currentUser:I,urlAuth:e.urlAuth,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}}))((e=>{let{connectionState:t,authState:n,lastSyncTime:o,isLeftColumnOpen:r,isRightColumnOpen:c,isMediaViewerOpen:l,isForwardModalOpen:d,hasNotifications:u,hasDialogs:m,audioMessage:g,activeGroupCallId:p,safeLinkModalUrl:f,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:I,limitReached:w,openedStickerSetShortName:y,openedCustomEmojiSetIds:Z,isServiceChatReady:P,animationLevel:C,language:b,wasTimeFormatSetManually:S,addedSetIds:M,addedCustomEmojiIds:E,isPhoneCallActive:k,newContactUserId:N,newContactByPhoneNumber:T,openedGame:A,gameTitle:x,isRatePhoneCallModalOpen:B,botTrustRequest:L,botTrustRequestBot:O,botAttachRequestBot:U,webApp:F,currentUser:q,urlAuth:D,isPremiumModalOpen:$,isPaymentModalOpen:j,isReceiptModalOpen:G,deleteFolderDialogId:H}=e;const{sync:V,loadAnimatedEmojis:_,loadNotificationSettings:z,loadNotificationExceptions:W,updateIsOnline:J,loadTopInlineBots:Y,loadEmojiKeywords:K,loadCountryList:Q,loadAvailableReactions:ee,loadStickerSets:te,loadPremiumGifts:ne,loadAddedStickers:se,loadFavoriteStickers:ae,ensureTimeFormat:ie,closeStickerSetModal:oe,closeCustomEmojiSets:re,checkVersionNotification:ce,loadAppConfig:le,loadAttachMenuBots:de,loadContactList:ue,loadCustomEmojis:me,closePaymentModal:he,clearReceipt:ge,checkAppVersion:pe}=(0,s.Sv)();a.eM&&!Ur&&(Ur=!0,console.log(">>> RENDER MAIN")),(0,i.d4)((()=>{"connectionStateReady"===t&&"authorizationStateReady"===n&&V()}),[t,n,V]),(0,Qe.Z)(pe,3e5,!0),(0,i.d4)((()=>{o&&(J(!0),le(),ee(),_(),z(),W(),Y(),K({language:a.pR}),de(),ue(),ne(),pe())}),[o,_,K,W,z,Y,J,ee,le,de,ue,ne,pe]),(0,i.d4)((()=>{o&&(b!==a.pR&&K({language:b}),Q({langCode:b}))}),[b,o,Q,K]),(0,$e.Z)((e=>{let[t]=e;!t&&o&&me({ids:Object.keys((0,s.Rd)().customEmojis.byId),ignoreCache:!0})}),[o]),(0,i.d4)((()=>{o&&(M&&E||(te(),ae()),M&&E&&se())}),[o,M,te,ae,se,E]),(0,i.d4)((()=>{o&&P&&ce()}),[o,P,ce]),(0,i.d4)((()=>{o&&!S&&ie()}),[o,S,ie]),(0,i.d4)((()=>{o&&Je.O.startsWith("#?tgaddr=")&&(0,De.o)(decodeURIComponent(Je.O.substr("#?tgaddr=".length)))}),[o]),(0,i.d4)((()=>{if(p||k)return we.Z.disableRefresh(),()=>{we.Z.enableRefresh()}}),[p,k]);const fe=(0,Ye.Z)(r,void 0,!0,void 0,I),ve=(0,i.sO)(!1),Ie=(0,Xe.Z)();(0,He.Z)((e=>{let[t]=e;if(void 0===t||0===C)return;ve.current=!0,h.wZ&&(0,R.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!r)}));const n=(0,Ke.YW)();(0,qe.L)(document.getElementById("MiddleColumn"),(()=>{n(),ve.current=!1,Ie()}))}),[r]);const ye=(0,Ye.Z)(c,void 0,!0,void 0,I),Ze=(0,i.sO)(!1),[Pe,Ce]=(0,i.eJ)(c);(0,He.Z)((e=>{let[t]=e;if(void 0===t||0===C)return;Ze.current=!0;const n=(0,Ke.YW)();(0,qe.L)(document.getElementById("RightColumn"),(()=>{n(),Ze.current=!1,Ie(),Ce(c)}))}),[c]);const be=(0,Fe.Z)(fe.hasShownClass&&"left-column-shown",fe.hasOpenClass&&"left-column-open",ve.current&&"left-column-animating",ye.hasShownClass&&"right-column-shown",ye.hasOpenClass&&"right-column-open",Ze.current&&"right-column-animating",Pe&&"narrow-message-list",I&&"history-animation-disabled"),Se=(0,i.I4)((()=>{J(!1);const e=(0,X.xW)();let t=0;clearInterval(Or),Or=window.setInterval((()=>{if(document.title.includes(a.ou))Fr(!1);else{if(t%2==0){const t=(0,X.xW)()-e;t>0&&(qr(`${t} notification${t>1?"s":""}`),Fr(!0))}else qr(a.Ti),Fr(!1);t++}}),1e3)}),[J]),Me=(0,i.I4)((()=>{J(!0),clearInterval(Or),Or=void 0,document.title.includes(a.ou)||qr(a.Ti),Fr(!1)}),[J]),Ee=(0,i.I4)((()=>{oe()}),[oe]),Re=(0,i.I4)((()=>{re()}),[re]);return(0,je.Z)(Se,Me),Ge(Se),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(h.$b){if(!e)return null==Ve||Ve.setAttribute("content",_e),h.cj&&!h.fl&&document.addEventListener("gesturestart",We),()=>{null==Ve||Ve.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",We)};null==Ve||Ve.setAttribute("content",ze)}}),[e])}(l),i.ZP.createElement("div",{id:"Main",className:be},i.ZP.createElement(Vt,null),i.ZP.createElement(go,null),i.ZP.createElement(Jo,null),i.ZP.createElement(Yo,{isOpen:l}),i.ZP.createElement(dr,{isOpen:d}),i.ZP.createElement(cr,{isOpen:u}),i.ZP.createElement(lr,{isOpen:m}),g&&i.ZP.createElement(kn,{key:g.id,message:g,noUi:!0}),i.ZP.createElement(ur,{url:f}),i.ZP.createElement(kr,{urlAuth:D,currentUser:q}),i.ZP.createElement(mr,{isOpen:v}),i.ZP.createElement(nt,{isOpen:Boolean(y),onClose:Ee,stickerSetShortName:y}),i.ZP.createElement(Lr,{customEmojiSetIds:Z,onClose:Re}),p&&i.ZP.createElement(hr,{groupCallId:p}),i.ZP.createElement(gr,{isActive:Boolean(p||k)}),i.ZP.createElement(wr,{isOpen:Boolean(N||T),userId:N,isByPhoneNumber:T}),i.ZP.createElement(rr,{openedGame:A,gameTitle:x}),i.ZP.createElement(Zr,{webApp:F}),i.ZP.createElement(ar,null),i.ZP.createElement(Rr,null),i.ZP.createElement(pr,{isActive:k}),i.ZP.createElement(ot,{isForAppBadge:!0}),i.ZP.createElement(yr,{isOpen:B}),i.ZP.createElement(Pr,{bot:O,type:null==L?void 0:L.type}),i.ZP.createElement(Cr,{bot:U}),i.ZP.createElement(Ir,null),$&&i.ZP.createElement(Nr,{isOpen:$}),i.ZP.createElement(xr,{limit:w}),i.ZP.createElement(Tr,{isOpen:j,onClose:he}),i.ZP.createElement(Ar,{isOpen:G,onClose:ge}),i.ZP.createElement(Br,{deleteFolderDialogId:H}))})));var $r=n(99364),jr=n(8337);var Gr=n(2092);const Hr=(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,mt.Z)(),[m,h]=(0,i.eJ)(""),[g,p]=(0,i.eJ)(!1),[f,v,I]=(0,lt.Z)(!1),{shouldRender:w}=(0,Ye.Z)(t);(0,aa.Z)(c,l&&l>=5?18e4:void 0);const y=(0,i.I4)((()=>{h("")}),[]),Z=(0,i.I4)((e=>{l&&l>=5?h(u("FloodWait")):(h(""),(0,M.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 P=(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(Rs.Z,{tgsUrl:Es.l.Lock,previewUrl:Gr,size:160,className:"ar9YdQbWJreREHmnZa9m"}),i.ZP.createElement($r.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:Z}),i.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},i.ZP.createElement("p",null,i.ZP.createElement(jr.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),i.ZP.createElement("p",null,i.ZP.createElement(yt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},u("AccountSettings.Logout"))))),i.ZP.createElement(un.Z,{isOpen:f,onClose:I,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:P,confirmIsDestructive:!0}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{connectionState:Vr,passcode:{isScreenLocked:_r}}=(0,s.Rd)();Vr||_r||(0,s.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
|
||
//# sourceMappingURL=5769.59e9a929ab3c379e1faf.js.map
|