2 lines
336 KiB
JavaScript
2 lines
336 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{86475:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>gc,Main:()=>lc});var s=n(33555),a=n(83716),o=n(14050),i=(n(89005),n(6137)),r=n(5161),c=n(11192),d=n(70735),l=n(56112);function u(e){const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};return t&&n?(e=(0,r.qr)(e,t,n,!1),e=(0,r.Pb)(e,t,n,void 0)):e}(0,s.iw)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(t&&n)return(0,r.qr)(e,t,n,!0)})),(0,s.iw)("closeLocalTextSearch",u),(0,s.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:s,threadId:a}=(0,c.Bt)(e)||{};if(!s||!a)return;const{query:o}=n,i=(0,l.uw)(s,a),{query:u}=e.localTextSearch.byChatThreadKey[i]||{};return o!==u&&(e=(0,r.Pb)(e,s,a,d.D)),(0,r.qr)(e,s,a,!0,o)})),(0,s.iw)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:s}=(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)=>{const{id:s,threadId:a=i._f,type:o="thread",shouldReplaceHistory:d=!1}=n,l=(0,c.Bt)(e);return e.premiumModal?.promo&&e.premiumModal?.isOpen&&(e={...e,premiumModal:{...e.premiumModal,isOpen:!1}}),l&&l.chatId===s&&l.threadId===a&&l.type===o||(s&&(e=(0,r.pf)(e,s,a,"replyStack",[])),e=u(e=(0,r.i9)(e)),e={...e,isStatisticsShown:!1,messages:{...e.messages,contentToBeScheduled:void 0},...s!==e.forwardMessages.toChatId&&{forwardMessages:{}}}),(0,r.Wy)(e,s,a,o,d)})),(0,s.iw)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,s.iw)("openChatWithInfo",((e,t,n)=>{(0,s.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,s.iw)("openChatWithDraft",((e,t,n)=>{const{chatId:s,text:a,files:o}=n;return s&&t.openChat({id:s}),{...e,requestedDraft:{chatId:s,text:a,files:o}}})),(0,s.iw)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,s.iw)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,s.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:s,orderedIds:a}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return void t.openChat({id:a[0]});const i=a.indexOf(o);if(-1===i)return;const r=a[i+s];t.openChat({id:r,shouldReplaceHistory:!0})})),(0,s.iw)("openDeleteChatFolderModal",((e,t,n)=>{const{folderId:s}=n;return{...e,deleteFolderDialogModal:s}})),(0,s.iw)("closeDeleteChatFolderModal",(e=>({...e,deleteFolderDialogModal:void 0})));var m=n(91713),h=n(77361),g=n(60782),p=n(82267),f=n(83099),I=n(50711),v=n(64319),w=n(996),y=n(42986);const P=a.ck+a.fK;let Z;function C(e,t,n){const{type:s,threadId:a}=(0,c.Bt)(e)||{},o=I.i0,i="scheduled"===s?(0,c.Fn)(e,t):(0,c.Zw)(e,t);if(!i||!a)return;const r=n.map((e=>i[e])).filter((t=>(0,c._k)(e,t,a).canCopy)).sort(((e,t)=>e.id-t.id)),d=r.reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,l.OU)(o,s):""}:`),t.push(`${function(e,t){const n=(0,y.Eb)(t),s=n?`${n} `:"",a=(0,w.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${s}${(0,y.Kk)(e,t,a,!0,!0)}`}(o,n)}\n`),t}),[]),u=r.reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,l.OU)(o,s):""}:`),t.push(`${(0,l.MK)(o,n,!1,0,void 0,!0)}\n`),t}),[]);(0,v.qN)(d.join("\n"),u.join("\n"))}(0,s.iw)("setScrollOffset",((e,t,n)=>{const{chatId:s,threadId:a,scrollOffset:o}=n;return(0,r.pf)(e,s,a,"scrollOffset",o)})),(0,s.iw)("setReplyingToId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o,threadId:i}=a;return(0,r.pf)(e,o,i,"replyingToId",s)})),(0,s.iw)("setEditingId",((e,t,n)=>{const{messageId:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o,threadId:i,type:d}=a,l="scheduled"===d?"editingScheduledId":"editingId";return(0,r.pf)(e,o,i,l,s)})),(0,s.iw)("setEditingDraft",((e,t,n)=>{const{text:s,chatId:a,threadId:o,type:i}=n,c="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,r.pf)(e,a,o,c,s)})),(0,s.iw)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(!t||!n)return;const s=(0,c.Zw)(e,t),a=(0,c.Cb)(e,t,n);if(!s||!a)return;const o=(0,g.dF)(a,(t=>Boolean(s[t]&&(0,c._k)(e,s[t],n).canEdit)));return o?(0,r.pf)(e,t,n,"editingId",o):void 0})),(0,s.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:s}=n,{chatId:a,threadId:o}=(0,c.Bt)(e)||{};if(!a||!o)return;const r=(0,c.Zw)(e,a),d=(0,c.Cb)(e,a,o);if(!r||!d)return;const l=(0,c.Yy)(e,a,o);let u;if((0,c.b9)(e,a,o)&&l){const e=Object.keys(r),t=e.indexOf(l.toString())+s;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else u=o===i._f?(0,c.Z1)(e,a)?.lastMessage?.id:(0,c.tZ)(e,a,o)?.lastMessageId;t.setReplyingToId({messageId:u}),t.focusMessage({chatId:a,threadId:o,messageId:u})})),(0,s.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:s,threadId:a,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d}=n;return{...e,audioPlayer:{chatId:s,threadId:a,messageId:o,origin:null!=i?i:e.audioPlayer.origin,volume:null!=r?r:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:d||e.audioPlayer.isMuted}}})),(0,s.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:s,isMuted:!1}}})),(0,s.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:s}}})),(0,s.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:s}}})),(0,s.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:s}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:s}}})),(0,s.iw)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,s.iw)("openPollResults",((e,t,n)=>{const{chatId:a,messageId:o}=n;if((0,c.Jf)(e)){if(a!==e.pollResults.chatId||o!==e.pollResults.messageId)return{...e,pollResults:{chatId:a,messageId:o,voters:{}}}}else window.setTimeout((()=>{e=(0,s.Rd)(),(0,s.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}})}),450)})),(0,s.iw)("closePollResults",(e=>({...e,pollResults:{}}))),(0,s.iw)("focusLastMessage",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:s,threadId:a}=n;let o;o=a===i._f?(0,c.Z1)(e,s)?.lastMessage?.id:(0,c.tZ)(e,s,a)?.lastMessageId,o&&t.focusMessage({chatId:s,threadId:a,messageId:o,noHighlight:!0})})),(0,s.iw)("focusNextReply",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:a,threadId:o}=n,i=(0,c.p9)(e,a,o);if(i&&0!==i.length){const n=i.pop();e=(0,r.pf)(e,a,o,"replyStack",[...i]),(0,s.R3)(e),t.focusMessage({chatId:a,threadId:o,messageId:n})}else t.focusLastMessage()})),(0,s.iw)("focusMessage",((e,t,n)=>{const{chatId:a,threadId:o=i._f,messageListType:d="thread",noHighlight:l,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f}=n;let{messageId:I}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);t?.length&&([I]=t)}const v=(0,c.Bt)(e),w=!v||a!==v.chatId||o!==v.threadId||d!==v.type;if(Z&&(clearTimeout(Z),Z=void 0),Z=window.setTimeout((()=>{let e=(0,s.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,s.R3)(e)}),l?P:1500),e=(0,r.cq)(e,a,I,l,p),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,a,o)||[];e=(0,r.pf)(e,a,o,"replyStack",[...t,g])}w&&(e=(0,r.wV)(e,m.fo.Static));const y=(0,c.Cb)(e,a,o);if(y&&y.includes(I))return(0,s.R3)(e),void t.openChat({id:a,threadId:o,shouldReplaceHistory:f});if(w&&(e=(0,r.pf)(e,a,o,"viewportIds",void 0)),e=(0,r.pf)(e,a,o,"outlyingIds",void 0),y&&!w){const t=I>y[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,s.R3)(e),t.openChat({id:a,threadId:o,shouldReplaceHistory:f}),t.loadViewportMessages()})),(0,s.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:s,messageIds:a,groupedId:o,withMyScore:i}=n;let r;return o&&(r=(0,c.xH)(e,s,o)),{...e,forwardMessages:{fromChatId:s,messageIds:r||a,isModalShown:!0,withMyScore:i}}})),(0,s.iw)("changeForwardRecipient",(e=>({...e,forwardMessages:{...e.forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}}))),(0,s.iw)("setForwardNoAuthors",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noAuthors:n,noCaptions:n&&e.forwardMessages.noCaptions}}))),(0,s.iw)("setForwardNoCaptions",((e,t,n)=>({...e,forwardMessages:{...e.forwardMessages,noCaptions:n,noAuthors:n}}))),(0,s.iw)("exitForwardMode",(e=>{(0,s.R3)({...e,forwardMessages:{}})})),(0,s.iw)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:s})})),(0,s.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:a}=n,o=e.activeDownloads.byChatId[a.chatId];o&&o.length&&(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:o.filter((e=>e!==a.id))}}})})),(0,s.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:s}=n,a=e.activeDownloads.byChatId,o={};return Object.keys(a).forEach((e=>{o[e]=a[e].filter((e=>!s.find((t=>t.id===e))))})),{...e,activeDownloads:{byChatId:o}}})),(0,s.iw)("downloadMessageMedia",((e,t,n)=>{const{message:a}=n;(0,s.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:[...e.activeDownloads.byChatId[a.chatId]||[],a.id]}}})})),(0,s.iw)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:s}=e.selectedMessages,{threadId:a}=(0,c.Bt)(e)||{},o=(0,c.Zw)(e,n);o&&a&&s.map((e=>o[e])).filter((t=>(0,c._k)(e,t,a).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,s.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:s}=n||{},a=(0,c.jr)(e);return a?(0,r.M6)(e,a.id,s):e})),(0,s.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:a,groupedId:o,childMessageIds:i,withShift:d}=n,l=(0,c.Bt)(e);if(!l)return;const{chatId:u,threadId:m,type:g}=l;e=(0,r.Ob)(e,u,m,g,a,o,i,d),(0,s.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.$b?"long tap":"right click"} on a message.`}))})),(0,s.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,s.iw)("exitMessageSelectMode",r.i9),(0,s.iw)("openPollModal",((e,t,n)=>{const{isQuiz:s}=n||{};return{...e,pollModal:{isOpen:!0,isQuiz:s}}})),(0,s.iw)("closePollModal",(e=>({...e,pollModal:{isOpen:!1}}))),(0,s.iw)("checkVersionNotification",((e,t)=>{if(a.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 o={chatId:a.aw,date:(0,p.b)(e.serverTimeOffset),content:{text:(0,f.Z)("**Telegram Web Z was updated to version 1.57**\n\n[👏](customEmoji:5471921242866981303) **Harder**\n• Custom emoji now animate as you write a message.\n• Voice messages can now be played with more speed options like 0.5x, 0.75x and 1.5x.\n• You can now set a main photo for your profile, group or channel in the Media Viewer.\n• Messages will now display 'admin', 'owner' and 'imported' labels.\n• A notification will appear when camera or microphone access is needed.\n\n[🤩](customEmoji:5373026167722876724) **Better**\n• Unread message counters animate as their number increases.\n• Custom Emoji have even better quality at larger sizes.\n• Clicking on live locations now requires a confirmation before opening Google Maps.\n\n[🚀](customEmoji:5445284980978621387) **Faster**\n• Uploading media and documents is drastically accelerated.\n• Video messages now load even more smoothly.\n\n[💪](customEmoji:5471883477219549006) **Stronger**\n• Fixed copying selected text in messages.\n• Fixed outgoing messages sometimes being displayed as incoming.\n• Fixed group descriptions being uneditable.\n• Fixed streaming video from files.\n• Fixed auto-closing calendar after rescheduling.\n• Fixed scrolling to the bottom of the chat after sending a new message.\n• Various layout improvements.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,s.iw)("createServiceNotification",((e,t,n)=>{const{message:o,version:i}=n,{serviceNotifications:r}=e,d=(0,c.Z1)(e,a.aw),l=Math.max(d.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),u=(r.length+1)/1e3,m=Math.floor(l)+u;o.previousLocalId=o.id,o.id=m;const h={id:m,message:o,version:i,isUnread:!0};(0,s.R3)({...e,serviceNotifications:[...r.slice(-1e3),h]}),t.apiUpdate({"@type":"newMessage",id:o.id,chatId:o.chatId,message:o})})),(0,s.iw)("openReactorListModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,reactorModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,s.iw)("openSeenByModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,seenByModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,s.iw)("copySelectedMessages",(e=>{if(!e.selectedMessages)return;const{chatId:t,messageIds:n}=e.selectedMessages;C(e,t,n)})),(0,s.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.jr)(e);s&&0!==s.length&&a&&C(e,a.id,s)})),(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s}=n,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:s})})),(0,s.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:s}=n,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[s]});const o=a.filter((e=>e!==s));return o.unshift(s),o.length>10&&o.pop(),(0,r.No)(e,{recentlyFoundChatIds:o})})),(0,s.iw)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,s.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:s}=n;return(0,r.Og)(e,s)})),(0,s.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:s}=n;return(0,r.No)(e,{chatId:s,query:void 0,resultsByType:void 0})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s})})),(0,s.iw)("openAddContactDialog",((e,t,n)=>{const{userId:s}=n;return{...e,newContact:{userId:s}}})),(0,s.iw)("openNewContactDialog",(e=>({...e,newContact:{isByPhoneNumber:!0}}))),(0,s.iw)("closeNewContactDialog",(e=>(0,r.ft)(e))),n(73456);var b=n(91947),E=n(26926);(0,s.iw)("toggleChatInfo",((e,t,n)=>({...e,isChatInfoShown:void 0!==n?n:!e.isChatInfoShown}))),(0,s.iw)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,s.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,s.iw)("toggleManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,s.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:s}=n||{},{chatId:a}=(0,c.Bt)(e)||{};if(a)return{...e,management:{byChatId:{...e.management.byChatId,[a]:{...e.management.byChatId[a],isActive:!0,nextScreen:s}}}}})),(0,s.iw)("closeManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,s.iw)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,s.iw)("toggleStatistics",(e=>({...e,isStatisticsShown:!e.isStatisticsShown,statistics:{...e.statistics,currentMessageId:void 0}}))),(0,s.iw)("toggleMessageStatistics",((e,t,n)=>({...e,statistics:{...e.statistics,currentMessageId:n?.messageId}}))),(0,s.iw)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,s.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:s}=n,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[s]};const o=a.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentEmojis:o}})),(0,s.iw)("addRecentSticker",((e,t,n)=>{const{sticker:s}=n,{recent:a}=e.stickers;if(!a)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[s]}}};const o=a.stickers.filter((e=>e.id!==s.id));return o.unshift(s),{...e,stickers:{...e.stickers,recent:{...a,stickers:o}}}})),(0,s.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:s}=n,{recentCustomEmojis:a}=e;if(!a)return{...e,recentCustomEmojis:[s]};const o=a.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentCustomEmojis:o}})),(0,s.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,s.iw)("reorderStickerSets",((e,t,n)=>{const{order:s,isCustomEmoji:a}=n;return{...e,stickers:{...e.stickers,[a?"customEmoji":"added"]:{setIds:s}}}})),(0,s.iw)("showNotification",((e,t,n)=>{const s=n;s.localId=(0,E.Z)({});const a=[...e.notifications],o=a.findIndex((e=>e.message===s.message));return-1!==o&&a.splice(o,1),a.push(s),{...e,notifications:a}})),(0,s.iw)("dismissNotification",((e,t,n)=>{const s=e.notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return{...e,notifications:s}})),(0,s.iw)("showDialog",((e,t,n)=>{const{data:s}=n;if("message"in s&&s.hasErrorKey&&!(0,b.ZP)(s))return e;const a=[...e.dialogs];if("message"in s){const e=a.findIndex((e=>e.message===s.message));-1!==e&&a.splice(e,1)}return a.push(s),{...e,dialogs:a}})),(0,s.iw)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,s.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:s}=n;return{...e,safeLinkModalUrl:s}})),(0,s.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:s}=n;return{...e,historyCalendarSelectedAt:s}})),(0,s.iw)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,s.iw)("openGame",((e,t,n)=>{const{url:a,chatId:o,messageId:i}=n,r=(0,c.hj)(e,o,i);if(!r)return;const d=r.viaBotId||r.senderId;d&&((0,c.LM)(e,d)?(0,s.R3)({...e,openedGame:{url:a,chatId:o,messageId:i}}):(0,s.R3)({...e,botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:n}}}))})),(0,s.iw)("closeGame",(e=>({...e,openedGame:void 0}))),(0,s.iw)("requestConfetti",((e,t,n)=>{const{top:s,left:a,width:o,height:i}=n||{},{animationLevel:r}=e.settings.byKey;if(0!==r)return{...e,confetti:{lastConfettiTime:Date.now(),top:s,left:a,width:o,height:i}}})),(0,s.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:s}=n;return{...e,limitReachedModal:{limit:s}}})),(0,s.iw)("closeLimitReachedModal",(e=>({...e,limitReachedModal:void 0}))),(0,s.iw)("closeStickerSetModal",(e=>({...e,openedStickerSetShortName:void 0}))),(0,s.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:s}=n;return{...e,openedCustomEmojiSetIds:s}})),(0,s.iw)("closeCustomEmojiSets",(e=>({...e,openedCustomEmojiSetIds:void 0}))),(0,s.iw)("updateLastRenderedCustomEmojis",((e,t,n)=>{const{ids:s}=n,{lastRendered:o}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,g.Tw)([...o,...s]).slice(0,a.j7)}}})),(0,s.iw)("checkAppVersion",(()=>{const e=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{t=t.trim(),e.test(t)&&t!==a.Ji&&(0,s.R3)({...(0,s.Rd)(),isUpdateAvailable:!0})})).catch((e=>{a.eM&&console.error("[checkAppVersion failed] ",e)}))})),(0,s.iw)("closePaymentModal",(e=>{const t=e.payment.status;return e=(0,r.bp)(e),e=(0,r.WY)(e),{...e,payment:{...e.payment,status:t}}})),(0,s.iw)("addPaymentError",((e,t,n)=>{const{error:s}=n;return{...e,payment:{...e.payment,status:"failed",error:s}}}));var S=n(88422);(0,s.iw)("openMediaViewer",((e,t,n)=>{const{chatId:s,threadId:a,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:d,playbackRate:l,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:s,threadId:a,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=d?d:e.mediaViewer.volume,playbackRate:l||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,s.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:s,isHidden:a}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,isHidden:a,playbackRate:s}}})),(0,s.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:s,isMuted:!1}}})),(0,s.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:s}}})),(0,s.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:s}}})),(0,s.iw)("setMediaViewerHidden",((e,t,n)=>{const s=n;return{...e,mediaViewer:{...e.mediaViewer,isHidden:s}}}));var M=n(50214),R=n(95281),k=n(5872),N=n(69118),T=n(35369);let A=!1;(0,N.Gq)((()=>{(0,s.Rd)().passcode.hasPasscode&&!A&&(0,M.jv)()})),(0,s.iw)("setPasscode",(async(e,t,n)=>{let{passcode:a}=n;(0,s.R3)((0,r.vu)(e,{isLoading:!0})),await(0,R.AU)(a);const o=JSON.stringify({...(0,M.K8)(),userId:e.currentUserId}),i=(0,k.Uf)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,R.H4)(o,i),(0,s.R3)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1})),(0,k.jA)(!0)})),(0,s.iw)("clearPasscode",(e=>((0,R.C8)(),(0,r.Kn)(e)))),(0,s.iw)("unlockScreen",((e,t,n)=>{let{sessionJson:a,globalJson:o}=n;const i=JSON.parse(a);(0,M.wX)(i,i.userId),e=JSON.parse(o),(0,k.nE)(e,(0,g.Xh)(T.Y)),(0,s.R3)((0,r.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0})),t.initApi()})),(0,s.iw)("logInvalidUnlockAttempt",(e=>{var t;return(0,r.vu)(e,{invalidAttemptsCount:(null!==(t=e.passcode?.invalidAttemptsCount)&&void 0!==t?t:0)+1})})),(0,s.iw)("resetInvalidUnlockAttempts",(e=>(0,r.vu)(e,{invalidAttemptsCount:0}))),(0,s.iw)("setPasscodeError",((e,t,n)=>{const{error:s}=n;return(0,r.vu)(e,{error:s})})),(0,s.iw)("clearPasscodeError",(e=>(0,r.vu)(e,{error:void 0}))),(0,s.iw)("skipLockOnUnload",(()=>{A=!0})),n(65456);var B=n(27225),x=n(71226),L=n(81396);const O=new Map,F=(0,N.Ds)((e=>e()),500,!1);async function U(e,t,n,o){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],d=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=e.id;let u;switch(o){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(a.hT/2)+1);break;case m.Uq.Forwards:u=-(a.hT+1)}const h=await(0,x.t9)("fetchMessages",{chat:(0,c.Cm)((0,s.Rd)(),l,t),offsetId:n,addOffset:u,limit:a.hT,threadId:t});if(!h)return;const{messages:p,users:f,chats:I,threadInfos:v}=h;let w=(0,s.Rd)();const y=l===a.aw?w.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],P=[].concat(p,y),Z=(0,g.ee)(P,"id"),C=Object.keys(Z).map(Number);w=(0,r.c_)(w,l,Z),w=i?(0,r.ff)(w,l,t,C):(0,r.xj)(w,l,t,C),w=(0,r.Sh)(w,(0,g.ee)(f,"id")),w=(0,r.fZ)(w,(0,g.ee)(I,"id")),w=(0,r.j6)(w,l,v);let b=(0,c.gb)(w,l,t);const E=(0,c.qC)(w,l,t);if(i&&b&&E&&(E.length&&!(0,g.YE)(b,E)||(w=(0,r.xj)(w,l,t,E),b=(0,c.gb)(w,l,t),w=(0,r.pf)(w,l,t,"outlyingIds",void 0),i=!1)),!d){const e=i?E:b,{newViewportIds:s}=j(e,n,o);w=(0,r.y9)(w,l,t,s)}(0,s.R3)(w)}function j(e,t,n){const{length:s}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,s)=>n===t||n<t&&e[s+1]>t))}(e,t):-1,i=n===m.Uq.Backwards?o:o+1||s,r=i-a.hT,c=i+a.hT-1,d=e.slice(Math.max(0,r),c+1);let l,u;switch(n){case m.Uq.Backwards:l=i>0,u=r>=0;break;case m.Uq.Forwards:l=i<s,u=c<=s-1;break;case m.Uq.Around:default:l=d.length>0,u=d.length===a.hT}return{newViewportIds:d,areSomeLocal:l,areAllLocal:u}}async function D(e){let t;const n=e.attachment?(e,a)=>{O.has(a)||(t=a,O.set(a,n));const o=(0,s.Rd)();(0,s.R3)({...o,fileUploads:{byMessageLocalId:{...o.fileUploads.byMessageLocalId,[a]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,N.Pn)();const a=(0,s.Rd)();e.serverTimeOffset=a.serverTimeOffset;const o=(0,c.Bt)(a);if(!o)return;const{threadId:r}=o;e.replyingTo||r===i._f||(e.replyingTo=(0,c.qS)(a,e.chat.id,r)),e.replyingTo&&!e.replyingToTopId&&r!==i._f&&(e.replyingToTopId=(0,c.qS)(a,e.chat.id,r)),await(0,x.t9)("sendMessage",e,n),n&&t&&O.delete(t)}(0,s.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:i,threadId:d}=n||{};if(!i){const t=(0,c.Bt)(e);if(!t)return;i=t.chatId,d=t.threadId}const l=(0,c.Z1)(e,i);if(!l||l.isRestricted)return;const u=(0,c.Cb)(e,i,d),h=(0,c.gb)(e,i,d),g=(0,c.qC)(e,i,d);if(u&&u.length&&s!==m.Uq.Around){const n=s===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),c=a?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:I}=j(c,n,s);if(f&&(e=(0,r.y9)(e,i,d,p)),(0,N.R3)((()=>{!async function(e,t,n,s,a,o,i,r){t||await U(a,o,r,i,n,s),s||e.loadViewportMessages({chatId:a.id,threadId:o,direction:i,isBudgetPreload:!0})}(t,I,a,o,l,d,s,n)})),o)return}else{const t=(0,c.G$)(e,i)||(0,c.rd)(e,i,d),n=Boolean(t&&h&&!h.includes(t)),s=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=j(s,t,m.Uq.Around);p&&u.length>=a.hT&&(e=(0,r.y9)(e,i,d,u)),f||(0,N.R3)((()=>{U(l,d,t,m.Uq.Around,n,o)}))}return e})),(0,s.iw)("loadMessage",(async(e,t,n)=>{const{chatId:a,messageId:o,replyOriginForId:d,threadUpdate:l}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await async function(e,t,n){const a=await(0,x.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===i._Q){if(n){let t=(0,s.Rd)();const a=(0,c.hj)(t,e.id,n);t=(0,r.cY)(t,e.id,n,{...a,replyToMessageId:void 0}),(0,s.R3)(t)}return}let o=(0,s.Rd)();return o=(0,r.cY)(o,e.id,t,a.message),o=(0,r.Sh)(o,(0,g.ee)(a.users,"id")),(0,s.R3)(o),a.message}(u,o,d);if(m&&l){const{lastMessageId:e,isDeleting:t}=l;(0,s.R3)((0,r.lG)((0,s.Rd)(),m,a,e,t))}})),(0,s.iw)("sendMessage",((e,t,n)=>{const s=(0,c.Bt)(e);if(!s)return;const{chatId:o,threadId:i,type:r}=s;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const d=(0,c.Z1)(e,o),l={...n,chat:d,replyingTo:(0,c.Yy)(e,o,i),noWebPage:(0,c.tV)(e,o,i),sendAs:(0,c._5)(e,o)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1});const u=!n.attachments||n.attachments.length<=1,m=!u&&n.attachments&&n.attachments.length>1;if(u){const{attachments:e,...t}=l;D({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...s}=l,o=(0,g.Vl)(n,a.DU);for(let n=0;n<o.length;n++){const[a,...i]=o[n],r=`${Date.now()}${n}`;D({...s,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:a,groupedId:i.length>0?r:void 0}),i.forEach((e=>{D({...s,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:s,...a}=l;e&&D({...a,text:e,entities:t,replyingTo:s}),n.forEach((e=>{D({...a,attachment:e})}))}})),(0,s.iw)("editMessage",((e,t,n)=>{const{serverTimeOffset:s}=e,{text:a,entities:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r,threadId:d,type:l}=i,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,d,l);u&&m&&((0,x.t9)("editMessage",{chat:u,message:m,text:a,entities:o,noWebPage:(0,c.tV)(e,r,d),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))})),(0,s.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.hj)(e,s,a),i=o&&O.get((0,l.KK)(o));i&&(0,x.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:s})})),(0,s.iw)("saveDraft",(async(e,t,n)=>{const{chatId:a,threadId:o,draft:d}=n;if(!d)return;const{text:u,entities:m}=d,h=(0,c.Z1)(e,a),g=(0,c.dy)(e,a);g&&(0,l.NB)(g)||(o===i._f&&(await(0,x.t9)("saveDraft",{chat:h,text:u,entities:m,replyToMsgId:(0,c.Yy)(e,a,o)})||(d.isLocal=!0)),e=(0,s.Rd)(),e=(0,r.pf)(e,a,o,"draft",d),e=(0,r.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)}),(0,s.R3)(e))})),(0,s.iw)("clearDraft",((e,t,n)=>{const{chatId:s,threadId:a,localOnly:o}=n;if(!(0,c.Ms)(e,s,a))return;const d=(0,c.Z1)(e,s);return o||a!==i._f||(0,x.t9)("clearDraft",d),e=(0,r.pf)(e,s,a,"draft",void 0),(0,r.a4)(e,s,{draftDate:void 0})})),(0,s.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:s,threadId:a,noWebPage:o}=n;return(0,r.pf)(e,s,a,"noWebPage",o)})),(0,s.iw)("pinMessage",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageId:a,isUnpin:o,isOneSide:i,isSilent:r}=n;(0,x.t9)("pinMessage",{chat:s,messageId:a,isUnpin:o,isOneSide:i,isSilent:r})})),(0,s.iw)("unpinAllMessages",((e,t,n)=>{const a=(0,c.Z1)(e,n.chatId);a&&async function(e){await(0,x.t9)("unpinAllMessages",{chat:e});let t=(0,s.Rd)();t=(0,r.pf)(t,e.id,i._f,"pinnedIds",[]),(0,s.R3)(t)}(a)})),(0,s.iw)("deleteMessages",((e,t,n)=>{const{messageIds:s,shouldDeleteForAll:a}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:i,threadId:r}=o,d=(0,c.Z1)(e,i);(0,x.t9)("deleteMessages",{chat:d,messageIds:s,shouldDeleteForAll:a});const l=(0,c._$)(e,i,r);s.includes(l)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o}=a,i=(0,c.Z1)(e,o);(0,x.t9)("deleteScheduledMessages",{chat:i,messageIds:s});const r=(0,c.wU)(e,o);s.includes(r)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:a}=n,o=(0,c.Z1)(e,s);if(!o)return;await(0,x.t9)("deleteHistory",{chat:o,shouldDeleteForAll:a});const i=(0,c.Bt)(e);i&&i.chatId===s&&t.openChat({id:void 0})})),(0,s.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:s,reason:a,description:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r}=i,d=(0,c.Z1)(e,r),l=await(0,x.t9)("reportMessages",{peer:d,messageIds:s,reason:a,description:o});t.showNotification({message:l?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("sendMessageAction",(async(e,t,n)=>{const{action:s,chatId:a,threadId:o}=n;if(a===e.currentUserId)return;const i=(0,c.Z1)(e,a);if(!i)return;const r=(0,c.dy)(e,a);r&&((0,l.cS)(r)||(0,l.NB)(r))||await(0,x.t9)("sendMessageAction",{peer:i,threadId:o,action:s})})),(0,s.iw)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:s}=e,o=(0,c.Bt)(e);if(!o)return;const{chatId:d,threadId:l}=o,u=(0,c.Cm)(e,d,l);if(!u)return;const{maxId:m}=n;if(F((()=>{(0,x.t9)("markMessageListRead",{serverTimeOffset:s,chat:u,threadId:l,maxId:m})})),l!==i._f)return;d===a.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,c.Cb)(e,d,l),g=(0,c.It)(e,d,l);if(!h||!g||!u.unreadCount)return e;const p=function(e,t,n){let s=0;for(let a=0,o=e.length;a<o&&(e[a]>=t&&e[a]<=n&&s++,!(e[a]>=n));a++);return s}(h,g,m);return p?(0,r.a4)(e,d,{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,x.t9)("markMessagesRead",{chat:s,messageIds:a})})),(0,s.iw)("loadWebPagePreview",((e,t,n)=>{const{text:a}=n;!async function(e){const t=await(0,x.t9)("fetchWebPagePreview",{message:e});(0,s.R3)({...(0,s.Rd)(),webPagePreview:t})}(a)})),(0,s.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,s.iw)("sendPollVote",((e,t,n)=>{const{chatId:s,messageId:a,options:o}=n,i=(0,c.Z1)(e,s);i&&(0,x.t9)("sendPollVote",{chat:i,messageId:a,options:o})})),(0,s.iw)("cancelPollVote",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.Z1)(e,s);o&&(0,x.t9)("sendPollVote",{chat:o,messageId:a,options:[]})})),(0,s.iw)("closePoll",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.Z1)(e,s),i=(0,c.hj)(e,s,a)?.content.poll;o&&i&&(0,x.t9)("closePoll",{chat:o,messageId:a,poll:i})})),(0,s.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:a,messageId:o,option:i,offset:c,limit:d,shouldResetVoters:l}=n;!async function(e,t,n,a,o,i){const c=await(0,x.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:a,limit:o});if(!c)return;let d=(0,s.Rd)();d=(0,r.Sh)(d,(0,g.ee)(c.users,"id"));const{voters:l}=d.pollResults;(0,s.R3)({...d,pollResults:{...d.pollResults,voters:{...l,[n]:(0,g.Tw)([...!i&&l&&l[n]?l[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...d.pollResults.offsets?d.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(a,o,i,c,d,l)})),(0,s.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:s,ids:a}=n,o=(0,c.Z1)(e,s);o&&(0,x.t9)("fetchExtendedMedia",{chat:o,ids:a})})),(0,s.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:a,messageIds:o,toChatId:i,withMyScore:r,noAuthors:d,noCaptions:u}=e.forwardMessages,m=(0,c.wV)(e),h=a?(0,c.Z1)(e,a):void 0,g=i?(0,c.Z1)(e,i):void 0,p=a&&o?o.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:I}=n,v=(0,c._5)(e,i),w=p.filter((e=>!(0,l.jM)(e)));w.length&&(0,x.t9)("forwardMessages",{fromChat:h,toChat:g,messages:w,serverTimeOffset:(0,s.Rd)().serverTimeOffset,isSilent:f,scheduledAt:I,sendAs:v,withMyScore:r,noAuthors:d,noCaptions:u,isCurrentUserPremium:m}),p.filter((e=>(0,l.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:s,poll:a}=e.content;D({chat:g,text:t,entities:n,sticker:s,poll:a,isSilent:f,scheduledAt:I,sendAs:v})})),(0,s.R3)({...(0,s.Rd)(),forwardMessages:{}})})),(0,s.iw)("loadScheduledHistory",((e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&async function(e){const t=await(0,x.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,a=(0,g.ee)(n,"id"),o=Object.keys(a).map(Number).sort(((e,t)=>t-e));let c=(0,s.Rd)();c=(0,r.w3)(c,e.id,a),c=(0,r.pf)(c,e.id,i._f,"scheduledIds",o),(0,s.R3)(c)}(o)})),(0,s.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:s,id:a}=n,o=(0,c.Z1)(e,s);o&&(0,x.t9)("sendScheduledMessages",{chat:o,ids:[a]})})),(0,s.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:s,messageId:a,scheduledAt:o}=n,i=(0,c.Z1)(e,s),r=i&&(0,c.Tm)(e,i.id,a);i&&r&&(0,x.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,s.iw)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:s,threadId:a}=n,o=(0,c.Cm)(e,s,a);o&&(0,x.t9)("requestThreadInfoUpdate",{chat:o,threadId:a})})),(0,s.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:a,chatId:o}=n,i=(0,c.Z1)(e,o);if(!i)return;e=(0,r.cY)(e,o,a,{transcriptionId:""}),(0,s.R3)(e);const d=await(0,x.t9)("transcribeAudio",{chat:i,messageId:a});e=(0,r.cY)((0,s.Rd)(),o,a,{transcriptionId:d,isTranscriptionError:!d}),(0,s.R3)(e)})),(0,s.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:a,ignoreCache:o}=n,i=o?a:(0,g.Tw)(a.filter((t=>!e.customEmojis.byId[t]))),r=await(0,x.t9)("fetchCustomEmoji",{documentId:i});r&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,g.ee)(r,"id")}}}))})),(0,s.iw)("loadPinnedMessages",((e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&async function(e){const t=await(0,x.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:a,users:o}=t,c=(0,g.ee)(n,"id"),d=Object.keys(c).map(Number).sort(((e,t)=>t-e));let l=(0,s.Rd)();l=(0,r.c_)(l,e.id,c),l=(0,r.pf)(l,e.id,i._f,"pinnedIds",d),l=(0,r.Sh)(l,(0,g.ee)(o,"id")),l=(0,r.fZ)(l,(0,g.ee)(a,"id")),(0,s.R3)(l)}(o)})),(0,s.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,x.t9)("fetchSeenBy",{chat:i,messageId:o});d&&(0,s.R3)((0,r.cY)((0,s.Rd)(),a,o,{seenByUserIds:d}))})),(0,s.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:s,sendAsId:a}=n,o=(0,c.Z1)(e,s),i=(0,c.Z1)(e,a)||(0,c.dy)(e,a);if(o&&i)return(0,x.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,r.a4)(e,s,{fullInfo:{...o.fullInfo,sendAsId:a}})})),(0,s.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);if(!o)return;const i=await(0,x.t9)("fetchSendAs",{chat:o});i?(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),e=(0,r.a4)(e,a,{sendAsPeerIds:i.sendAs}),(0,s.R3)(e)):(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{sendAsPeerIds:[]}))})),(0,s.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);if(!o)return;const i=await(0,x.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,s.Rd)(),e=(0,r.Fn)(e,a,i.messages[0]),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),(0,s.R3)(e))})),(0,s.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:s}=n,a=(0,c.Z1)(e,s),o=(0,c.fS)(e,s);a&&o&&(0,x.t9)("viewSponsoredMessage",{chat:a,random:o.randomId})})),(0,s.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:a,offsetId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,x.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!d)return;const{messages:l,chats:u,users:m}=d,h=(0,g.ee)(l,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=(0,r.fZ)(e,(0,g.ee)(u,"id")),e=(0,r.a4)(e,a,{unreadMentions:[...i.unreadMentions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:a}=n,o=(0,c.jr)(e);if(!o)return;const i=(o.unreadMentions||[]).filter((e=>!a.includes(e)));e=(0,r.a4)(e,o.id,{unreadMentions:i}),(0,s.R3)(e),t.markMessagesRead({messageIds:a})})),(0,s.iw)("focusNextMention",((e,t)=>{const n=(0,c.jr)(e);n?.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0]})})),(0,s.iw)("readAllMentions",(e=>{const t=(0,c.jr)(e);if(t)return(0,x.t9)("readAllMentions",{chat:t}),(0,r.a4)(e,t.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,s.iw)("openUrl",((e,t,n)=>{const{url:s,shouldSkipModal:o}=n,i=(0,L.X)(s);if(i.match(a.FS)||i.match(a.g$))return void t.openTelegramLink({url:s});const{appConfig:r}=e;if(r){const e=new URL(i);if(r.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",r.autologinToken),void window.open(e.href,"_blank","noopener");if(r.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:s})}i.match(a.jL)||o?window.open(i,"_blank","noopener"):t.toggleSafeLinkModal({url:i})})),(0,s.iw)("setForwardChatId",(async(e,t,n)=>{const{id:a}=n;let o=(0,c.dy)(e,a);if(o&&(0,c.Nm)(e)){if(!o.fullInfo){const{accessHash:t}=o;o=await(0,x.t9)("fetchFullUser",{id:a,accessHash:t}),e=(0,s.Rd)()}if(o?.fullInfo.noVoiceMessages)return void t.showDialog({data:{message:(0,I.i0)("VoiceMessagesRestrictedByPrivacy",(0,l.Js)(o))}})}(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,isModalShown:!1}}),t.openChat({id:a}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,s.iw)("forwardToSavedMessages",((e,t)=>{(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:e.currentUserId}}),t.exitMessageSelectMode(),t.forwardMessages({isSilent:!0})}));var q=n(85765),$=n(9211);const G=(0,N.P2)((e=>e()),500,!1);async function H(e){const t=await(0,x.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,recent:t}})}async function V(e){const t=await(0,x.t9)("fetchStickers",{stickerSetInfo:e});let n=(0,s.Rd)();if(!t)return(0,N.R3)((()=>{(0,s.Sv)().showNotification({message:(0,I.i0)("StickerPack.ErrorNotFound")})})),void("shortName"in e&&n.openedStickerSetShortName===e.shortName&&(0,s.R3)({...n,openedStickerSetShortName:void 0}));const{set:a,stickers:o,packs:i}=t;n=(0,r.Rg)(n,a.id,{...a,stickers:o,packs:i});const c=n.stickers.forEmoji.emoji;c&&i[c]&&(n=(0,r.vy)(n)),(0,s.R3)(n)}async function _(e,t){const n=await(0,x.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,x.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,x.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,o=[...n,...a];if(o.length)for(let e=0;e<o.length;e++){const n=o[e];s[n]?.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:s[n].accessHash}}),e%10==0&&e>0&&await(0,N.wO)(200))}})),(0,s.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};H(t)})),(0,s.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,x.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,x.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,x.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,x.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,x.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,x.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)=>{const{stickerSetInfo:s}=n,a=(0,c.Ny)(e,s);a&&a.count===a?.stickers?.length||V(s)})),(0,s.iw)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,x.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,x.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,x.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,s.iw)("saveGif",(async(e,t,n)=>{const{gif:a,shouldUnsave:o}=n,i=e.gifs.saved.gifs?.length,r=(0,$.M)(e,"savedGifs"),d=(0,$.P)(e,"savedGifs"),l=(0,c.wV)(e);if(!o&&i&&i>=r&&t.showNotification({title:I.i0("LimitReachedFavoriteGifs",r.toString()),message:l?I.i0("LimitReachedFavoriteGifsSubtitlePremium"):I.i0("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:t.openPremiumModal},className:"bold-link"}),!await(0,x.t9)("saveGif",{gif:a,shouldUnsave:o}))return;const u=(e=(0,s.Rd)()).gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==a.id}))||[],m=o?u:[a,...u];(0,s.R3)({...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:m}}})})),(0,s.iw)("faveSticker",((e,t,n)=>{const{sticker:s}=n,a=e.stickers.favorite.stickers.length,o=(0,$.M)(e,"stickersFaved"),i=(0,$.P)(e,"stickersFaved"),r=(0,c.wV)(e);a>=o&&t.showNotification({title:I.i0("LimitReachedFavoriteStickers",o.toString()),message:r?I.i0("LimitReachedFavoriteStickersSubtitlePremium"):I.i0("LimitReachedFavoriteStickersSubtitle",i.toString()),...!r&&{action:t.openPremiumModal},className:"bold-link"}),s&&(0,x.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,x.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,s.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,x.t9)("removeRecentSticker",{sticker:s})&&H()})),(0,s.iw)("clearRecentStickers",(async e=>{await(0,x.t9)("clearRecentStickers")&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,recent:{stickers:[]}}}))})),(0,s.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:s}=n,a=(0,c.Ny)(e,s);if(!a)return;const{accessHash:o,installedDate:i}=a;(0,x.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:o})})),(0,s.iw)("loadEmojiKeywords",(async(e,t,n)=>{const{language:a}=n;let o=e.emojiKeywords[a];if(o?.isLoading)return;(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{...o,isLoading:!0}}});const i=await(0,x.t9)("fetchEmojiKeywords",{language:a,fromVersion:o?o.version:0});o=(e=(0,s.Rd)()).emojiKeywords[a],i?(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{isLoading:!1,version:i.version,keywords:{...o?.keywords,...i.keywords}}}}):(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[a]:{...o,isLoading:!1}}})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;a&&G((()=>{!async function(e,t){const n=await(0,x.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const a=(0,s.Rd)(),{setsById:o,added:i}=a.stickers,c=n.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=o[t]||{};n&&(0,q.Z)(n,e)&&c.unshift(t)}})),(0,s.R3)((0,r.z3)(a,"search",n.hash,n.sets,c))}(a)}))})),(0,s.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s}=n;"string"==typeof s&&G((()=>{_(s)}))})),(0,s.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&G((()=>{_(t,n)}))})),(0,s.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:a}=n,{hash:o}=e.stickers.forEmoji;G((()=>{!async function(e,t){let n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const a=await(0,x.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,s.Rd)(),a&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,a.stickers,a.hash),(0,s.R3)(n))}(a,o)}))})),(0,s.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,s.iw)("loadCustomEmojiForEmoji",((e,t,n)=>{const{emoji:s}=n;return(0,r.AA)(e,s)})),(0,s.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,s.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,x.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,s.Rd)(),(0,s.R3)({...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,g.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,g.ee)(t.sets,"id")}}}))})),(0,s.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:a}=n;(0,c.Ny)(e,a)||await V(a),e=(0,s.Rd)();const o=(0,c.Ny)(e,a);o?.shortName?(0,s.R3)({...e,openedStickerSetShortName:o.shortName}):t.showNotification({message:(0,I.i0)("StickerPack.ErrorNotFound")})}));var z=n(790);const W=(0,N.P2)((e=>e()),500,!1);async function X(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0;if(i){const s=await(0,x.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:a.Hk,offsetId:o,minDate:l,maxDate:d});if(s){const{messages:t,users:n,totalCount:a,nextOffsetId:o}=s;e={messages:t,users:n,chats:[],totalCount:a,nextRate:o}}}else e=await(0,x.t9)("searchMessagesGlobal",{query:t,offsetRate:o,limit:a.Hk,type:n,maxDate:d,minDate:l});let u=(0,s.Rd)();const m=(0,c.JX)(u);if(!e||""!==t&&t!==m)return void(0,s.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:I,nextRate:v}=e;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,I,n,v),(0,s.R3)(u)}async function J(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=await(0,x.t9)("searchMessagesLocal",{chat:e,type:t,limit:2*a.EN,offsetId:n});if(!i)return;const{chats:d,users:l,messages:u,totalCount:m,nextOffsetId:h}=i,p=(0,g.ee)(u,"id"),f=Object.keys(p).map(Number);let I=(0,s.Rd)();const v=(0,c.we)(I);v&&(I=(0,r.fZ)(I,(0,g.ee)(d,"id")),I=(0,r.Sh)(I,(0,g.ee)(l,"id")),I=(0,r.c_)(I,e.id,p),I=(0,r.c1)(I,e.id,t,f,m,h),(0,s.R3)(I),o||J(e,t,h,!0))}(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:a}=e.globalSearch,{query:o}=n;o&&!a&&W((()=>{!async function(e){const t=await(0,x.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=(0,c.JX)(n);if(!t||!a||e!==a)return void(0,s.R3)((0,r.xv)(n,{chats:!1}));const{localChats:o,localUsers:i,globalChats:d,globalUsers:l}=t;(o.length||d.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...o,...d],"id"))),(i.length||l.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...i,...l],"id"))),n=(0,r.xv)(n,{chats:!1}),n=(0,r.No)(n,{localResults:{chatIds:o.map((e=>{let{id:t}=e;return t})),userIds:i.map((e=>{let{id:t}=e;return t}))},globalResults:{...n.globalSearch.globalResults,chatIds:d.map((e=>{let{id:t}=e;return t})),userIds:l.map((e=>{let{id:t}=e;return t}))}}),(0,s.R3)(n)}(o)}))})),(0,s.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:a}=n,o=a?(0,z.IS)(a):a;e=(0,r.No)(e,{date:a,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}}),(0,s.R3)(e);const{chatId:i}=e.globalSearch;X("","text",void 0,i?(0,c.Z1)(e,i):void 0,o,a)})),(0,s.iw)("searchMessagesGlobal",((e,t,n)=>{const{query:s,resultsByType:a,chatId:o,date:i}=e.globalSearch,r=i?(0,z.IS)(i):i,{type:d}=n,l=a?.[d]?.nextOffsetId;X(s,d,l,o?(0,c.Z1)(e,o):void 0,r,i)})),(0,s.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},o=t?(0,c.Z1)(e,t):void 0,d=(0,c.n5)(e);if(!o||!d||!n)return;const{query:l,results:u}=d,m=u?.nextOffsetId;let h;n!==i._f&&(h=(0,c.tZ)(e,t,n)?.topMessageId),async function(e,t,n,o,i){if(!o)return;const d=await(0,x.t9)("searchMessagesLocal",{chat:e,type:"text",query:o,topMessageId:n,limit:a.pn,offsetId:i});if(!d)return;const{chats:l,users:u,messages:m,totalCount:h,nextOffsetId:p}=d,f=(0,g.ee)(m,"id"),I=Object.keys(f).map(Number);let v=(0,s.Rd)();const w=(0,c.n5)(v);w&&o===w.query&&(v=(0,r.fZ)(v,(0,g.ee)(l,"id")),v=(0,r.Sh)(v,(0,g.ee)(u,"id")),v=(0,r.c_)(v,e.id,f),v=(0,r.dx)(v,e.id,t,I,h,p),(0,s.R3)(v))}(o,n,h,l,m)})),(0,s.iw)("searchMediaMessagesLocal",(e=>{const{chatId:t}=(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:o}=s,i=(a&&o&&o[a])?.nextOffsetId;a&&J(n,a,i)})),(0,s.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:a}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.Z1)(e,o);i&&async function(e,t){const n=await(0,x.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,s.Sv)().focusMessage({chatId:e.id,messageId:n})}(i,a)})),(0,s.iw)("checkPublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};if(!a)return;if(e.management.progress===m.wv.InProgress)return;const{username:o}=n;e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0}),(0,s.R3)(e);const i=await(0,x.t9)("checkChatUsername",{username:o});e=(0,s.Rd)(),e=(0,r.H9)(e,i?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:i,checkedUsername:o}),(0,s.R3)(e),void 0===i&&t.openLimitReachedModal({limit:"channelsPublic"})})),(0,s.iw)("updatePublicLink",(async(e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};let o=a&&(0,c.Z1)(e,a);if(!a||!o)return;const{username:i}=n;if(e=(0,r.H9)(e,m.wv.InProgress),(0,s.R3)(e),(0,l.G9)(o)){if(o=await(0,B.bZ)(o),!o)return;t.openChat({id:o.id})}const d=await(0,x.t9)("setChatUsername",{chat:o,username:i});e=(0,s.Rd)(),e=(0,r.H9)(e,d?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0,checkedUsername:void 0}),(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,x.t9)("updatePrivateLink",{chat:n})})),(0,s.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:a,invite:o}=n;(0,s.R3)((0,r.fw)(e,a,{editingInvite:o}))})),(0,s.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:a,invite:o}=n,i=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};(0,s.R3)((0,r.fw)(e,a,i))})),(0,s.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:o,isRevoked:i,limit:d}=n,l=(0,c.Z1)(e,a),u=(0,c.dy)(e,o||e.currentUserId);if(!l||!u)return;const m=await(0,x.t9)("fetchExportedChatInvites",{peer:l,admin:u,isRevoked:i,limit:d});if(!m)return;const h=i?{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:o,isRevoked:i,expireDate:d,usageLimit:l,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,a);if(!h)return;const g=await(0,x.t9)("editExportedChatInvite",{peer:h,link:o,isRevoked:i,expireDate:d,usageLimit:l,isRequestNeeded:u,title:m});if(!g)return;const{oldInvite:p,newInvite:f}=g,I=((e=(0,s.Rd)()).management.byChatId[a].invites||[]).filter((e=>e.link!==p.link)),v=[...e.management.byChatId[a].revokedInvites||[]];f.isRevoked?v.unshift(f):I.push(f),(0,s.R3)((0,r.fw)(e,a,{invites:I,revokedInvites:v}))})),(0,s.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:a,expireDate:o,usageLimit:i,isRequestNeeded:d,title:l}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await(0,x.t9)("exportChatInvite",{peer:u,expireDate:o,usageLimit:i,isRequestNeeded:d,title:l});if(!m)return;const h=(e=(0,s.Rd)()).management.byChatId[a].invites||[];(0,s.R3)((0,r.fw)(e,a,{invites:[...h,m]}))})),(0,s.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:a,link:o}=n,i=(0,c.Z1)(e,a);if(!i)return;if(!await(0,x.t9)("deleteExportedChatInvite",{peer:i,link:o}))return;const d=(e=(0,s.Rd)()).management.byChatId[a];(0,s.R3)((0,r.fw)(e,a,{invites:d?.invites?.filter((e=>e.link!==o)),revokedInvites:d?.revokedInvites?.filter((e=>e.link!==o))}))})),(0,s.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:o}=n,i=(0,c.Z1)(e,a),d=(0,c.dy)(e,o||e.currentUserId);i&&d&&await(0,x.t9)("deleteRevokedExportedChatInvites",{peer:i,admin:d})&&(e=(0,s.Rd)(),(0,s.R3)((0,r.fw)(e,a,{revokedInvites:[]})))})),(0,s.iw)("loadChatInviteImporters",(async(e,t,n)=>{const{chatId:a,link:o,offsetDate:i,offsetUserId:d,limit:l}=n,u=(0,c.Z1)(e,a),m=(0,c.dy)(e,d);if(!u||d&&!m)return;const h=await(0,x.t9)("fetchChatInviteImporters",{peer:u,link:o,offsetDate:i,offsetUser:m,limit:l});if(!h)return;const{importers:g,users:p}=h,f=(e=(0,s.Rd)()).management.byChatId[a]?.inviteInfo;f?.invite&&f.invite.link===o&&(e=(0,r.fw)(e,a,{inviteInfo:{...f,importers:g}}),e=(0,r.Sh)(e,p),(0,s.R3)(e))})),(0,s.iw)("loadChatInviteRequesters",(async(e,t,n)=>{const{chatId:a,link:o,offsetDate:i,offsetUserId:d,limit:l}=n,u=(0,c.Z1)(e,a),m=(0,c.dy)(e,d);if(!u||d&&!m)return;const h=await(0,x.t9)("fetchChatInviteImporters",{peer:u,link:o,offsetDate:i,offsetUser:m,limit:l,isRequested:!0});if(!h)return;const{importers:g,users:p}=h,f=(e=(0,s.Rd)()).management.byChatId[a]?.inviteInfo;f?.invite&&f.invite.link===o&&(e=(0,r.fw)(e,a,{inviteInfo:{...f,requesters:g}}),e=(0,r.Sh)(e,p),(0,s.R3)(e))})),(0,s.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:a,offsetDate:o,offsetUserId:i,limit:d}=n,l=(0,c.Z1)(e,a),u=(0,c.dy)(e,i);if(!l||i&&!u)return;const m=await(0,x.t9)("fetchChatInviteImporters",{peer:l,offsetDate:o,offsetUser:u,limit:d,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,s.Rd)(),e=(0,r.a4)(e,a,{joinRequests:h}),e=(0,r.Sh)(e,g),(0,s.R3)(e)})),(0,s.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:a,userId:o,isApproved:i}=n,d=(0,c.Z1)(e,a),l=(0,c.dy)(e,o);if(!d||!l)return;if(!await(0,x.t9)("hideChatJoinRequest",{peer:d,user:l,isApproved:i}))return;e=(0,s.Rd)();const u=(0,c.Z1)(e,a);u&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:u.joinRequests?.filter((e=>e.userId!==o))}))})),(0,s.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:a,isApproved:o,link:i}=n,d=(0,c.Z1)(e,a);if(!d)return;if(!await(0,x.t9)("hideAllChatJoinRequests",{peer:d,isApproved:o,link:i}))return;e=(0,s.Rd)();const l=(0,c.Z1)(e,a);l&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:[],fullInfo:{...l.fullInfo,recentRequesterIds:[],requestsPending:0}}))})),(0,s.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&await(0,x.t9)("hideChatReportPanel",o)&&(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{settings:void 0}))}));var Y=n(65116),K=n(16974);let Q,ee;function te(e){return(0,x.t9)("fetchMessages",{chat:e,threadId:i._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(a.hT/2)+1),limit:a.hT})}(0,s.iw)("sync",(()=>{a.eM&&console.log(">>> START SYNC"),Q&&clearTimeout(Q),(0,s.R3)({...(0,s.Rd)(),isSyncing:!0}),Q=window.setTimeout((()=>{(0,s.R3)({...(0,s.Rd)(),isSyncing:!1}),Q=void 0}),15e3);const{loadAllChats:e,preloadTopChatMessages:t}=(0,s.Sv)();e({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(){let e=!1,t=(0,s.Rd)();const n=Object.keys(t.messages.byChatId).reduce(((e,n)=>(e[n]={},e[n].draft=(0,c.Ms)(t,n,i._f),e[n].editingId=(0,c._$)(t,n,i._f),e[n].editingDraft=(0,c.s)(t,n,i._f),e)),{}),{chatId:o,threadId:d}=(0,c.Bt)(t)||{},l=o?t.chats.byId[o]:void 0;if(o&&l){const n=await te(l);t=(0,s.Rd)();const{chatId:u}=(0,c.Bt)(t)||{},m=d&&(0,c.tZ)(t,o,d);if(n&&u===o){const c=t.messages.byChatId[o],l=o===a.aw?t.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],u=[].concat(n.messages,l),h=(0,g.ee)(u,"id"),p=Object.keys(h).map(Number);if(t={...t,messages:{...t.messages,byChatId:{}}},t=(0,r.c_)(t,o,h),t=(0,r.xj)(t,o,i._f,p),t=(0,r.y9)(t,o,i._f,p),d&&m&&m.originChannelId){const{originChannelId:e}=m,n=t.messages.byChatId[e],a=await te(t.chats.byId[e]);if(t=(0,s.Rd)(),a){const e=(0,g.ee)(a.messages,"id"),s=Object.keys(e).map(Number);t={...t,messages:{...t.messages,byChatId:{...t.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[i._f]:{...n?.threadsById[i._f],listedIds:s,viewportIds:s,outlyingIds:void 0}}},[o]:{...t.messages.byChatId[o],threadsById:{...t.messages.byChatId[o].threadsById,[d]:{...c?.threadsById[d],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,o,n.threadInfos),e=!0}}e||(t={...t,messages:{...t.messages,byChatId:{}}}),Object.keys(n).forEach((e=>{t=(0,r.sN)(t,e,i._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,K.S1)(),e({listType:"archived",shouldReplace:!0}),(0,x.t9)("fetchCurrentUser"),t()}})})),(0,Y.ll)((e=>{const{connectionState:t,authState:n}=e;ee?.connectionState===t&&ee?.authState===n||("connectionStateReady"===t&&"authorizationStateReady"===n&&(0,s.Sv)().sync(),ee=e)})),(0,s.iw)("reportPeer",(async(e,t,n)=>{const{chatId:s,reason:a,description:o}=n;if(!s)return;const i=(0,c.Z1)(e,s);if(!i)return;const r=await(0,x.t9)("reportPeer",{peer:i,reason:a,description:o});t.showNotification({message:r?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:s,reason:a,description:o,photo:i}=n;if(!s)return;const r=(0,c.Z1)(e,s);if(!r||!i)return;const d=await(0,x.t9)("reportProfilePhoto",{peer:r,photo:i,reason:a,description:o});t.showNotification({message:d?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("loadAuthorizations",(async()=>{const e=await(0,x.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,x.t9)("terminateAuthorization",a))return;e=(0,s.Rd)();const{[a]:o,...i}=e.activeSessions.byHash;(0,s.R3)({...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,x.t9)("terminateAllAuthorizations"))return;const t=(e=(0,s.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];(0,s.R3)({...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}})})),(0,s.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:a,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,x.t9)("changeSessionSettings",{hash:a,areCallsEnabled:o,areSecretChatsEnabled:i})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[a]:{...e.activeSessions.byHash[a],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0}}}}))})),(0,s.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:a}=n;await(0,x.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,x.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,x.t9)("terminateWebAuthorization",a))return;e=(0,s.Rd)();const{[a]:o,...i}=e.activeWebSessions.byHash;(0,s.R3)({...e,activeWebSessions:{byHash:i,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==a))}})})),(0,s.iw)("terminateAllWebAuthorizations",(async e=>{await(0,x.t9)("terminateAllWebAuthorizations")&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeWebSessions:{byHash:{},orderedHashes:[]}}))}));const ne=(0,N.P2)((e=>e()),500,!1);function se(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function ae(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,s.iw)("loadFullUser",((e,t,n)=>{const{userId:s}=n,a=(0,c.dy)(e,s);if(!a)return;const{id:o,accessHash:i}=a;(0,x.t9)("fetchFullUser",{id:o,accessHash:i})})),(0,s.iw)("loadUser",(async(e,t,n)=>{const{userId:a}=n,o=(0,c.dy)(e,a);if(!o)return;const i=await(0,x.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:d,userStatusesById:l}=i;e=(0,s.Rd)(),e=(0,r.eD)(e,(0,g.ee)(d,"id")),e=(0,r.ps)(e,{...e.users.statusesById,...l}),(0,s.R3)(e)})),(0,s.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,x.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,x.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,s.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id")),t=(0,r.zn)(t,e.userStatusesById);const n=e=>e.lastName||e.firstName||"",a=new Intl.Collator("en-US"),o=e.users.sort(((e,t)=>a.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,s.R3)({...t,contactList:{userIds:o.map((e=>e.id))}})}()})),(0,s.iw)("loadCurrentUser",(()=>{(0,x.t9)("fetchCurrentUser")})),(0,s.iw)("loadCommonChats",(async e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t?(0,c.dy)(e,t):void 0;if(!n||(0,l.cS)(n)||n.commonChats?.isFullyLoaded)return;const a=n.commonChats?.maxId,o=await(0,x.t9)("fetchCommonChats",n.id,n.accessHash,a);if(!o)return;const{chats:i,chatIds:d,isFullyLoaded:u}=o;e=(0,s.Rd)(),i.length&&(e=(0,r.fZ)(e,(0,g.ee)(i,"id"))),e=(0,r.Nq)(e,n.id,{commonChats:{maxId:d.length?d[d.length-1]:"0",ids:(0,g.Tw)((n.commonChats?.ids||[]).concat(d)),isFullyLoaded:u}}),(0,s.R3)(e)})),(0,s.iw)("updateContact",((e,t,n)=>{const{userId:a,isMuted:o=!1,firstName:i,lastName:d,shouldSharePhoneNumber:l}=n;!async function(e,t,n,a,o){let i=(0,s.Rd)();const d=(0,c.dy)(i,e);if(!d)return;let l;if((0,s.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,s.R3)((0,r.H9)((0,s.Rd)(),m.wv.InProgress)),!d.isContact&&d.phoneNumber)l=await(0,x.t9)("importContact",{phone:d.phoneNumber,firstName:n,lastName:a});else{const{id:e,accessHash:t}=d;l=await(0,x.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:a,shouldSharePhoneNumber:o})}l&&((0,s.Sv)().loadChatSettings({chatId:e}),(0,s.R3)((0,r.Nq)((0,s.Rd)(),d.id,{firstName:n,lastName:a}))),i=(0,s.Rd)(),i=(0,r.H9)(i,m.wv.Complete),i=(0,r.ft)(i),(0,s.R3)(i)}(a,o,i,d,l)})),(0,s.iw)("deleteContact",((e,t,n)=>{const{userId:a}=n;!async function(e){const t=(0,s.Rd)(),n=(0,c.dy)(t,e);if(!n)return;const{id:a,accessHash:o}=n;await(0,x.t9)("deleteContact",{id:a,accessHash:o})}(a)})),(0,s.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:a}=n,o=(0,l.YC)(a),i=o?(0,c.dy)(e,a):void 0,d=o?void 0:(0,c.Z1)(e,a);if(!i&&!d)return;const u=await(0,x.t9)("fetchProfilePhotos",i,d);if(!u||!u.photos)return;e=(0,s.Rd)();const m=i||d,{photos:h}=u;h.sort((e=>e.id===m?.avatarHash?-1:1)),o?e=(0,r.Nq)(e,a,{photos:h}):(e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,r.a4)(e,a,{photos:h})),(0,s.R3)(e)})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;a&&ne((()=>{!async function(e){const t=await(0,x.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=n.userSearch.query;if(!t||!a||e!==a)return void(0,s.R3)((0,r.Q3)(n,!1));const{localUsers:o,globalUsers:i}=t;let c,d;o.length&&(n=(0,r.Sh)(n,(0,g.ee)(o,"id")),c=o.map((e=>{let{id:t}=e;return t}))),i.length&&(n=(0,r.Sh)(n,(0,g.ee)(i,"id")),d=i.map((e=>{let{id:t}=e;return t}))),n=(0,r.Q3)(n,!1),n=(0,r.Lm)(n,{localUserIds:c,globalUserIds:d}),(0,s.R3)(n)}(a)}))})),(0,s.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:a,firstName:o,lastName:i}=n,c=await(0,x.t9)("importContact",{phone:a,firstName:o,lastName:i});c?(t.openChat({id:c}),(0,s.R3)((0,r.ft)((0,s.Rd)()))):t.showNotification({message:I.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,s.iw)("reportSpam",((e,t,n)=>{const{chatId:s}=n,a=(0,l.YC)(s)?(0,c.dy)(e,s):(0,c.Z1)(e,s);a&&(0,x.t9)("reportSpam",a)}));var oe=n(18629);const ie=h.cj||h.wZ;class re{constructor(e,t){var n,s,a;this.features=e,this.onFail=t,n=this,a=void 0,(s=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(s="preOpened"))in n?Object.defineProperty(n,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[s]=a}preOpenIfNeeded(){ie&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():this.onFail?.())}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!ie){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const ce="https://prizes.gamee.com/",de=(0,N.Ds)((e=>e()),500,!1);async function le(e,t){await(0,x.t9)("toggleAttachBot",{bot:e,isEnabled:t}),await ue()}async function ue(e){const t=await(0,x.t9)("loadAttachBots",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}function me(e,t){if("request"===t.type){const e=(0,s.Rd)();if(!e.urlAuth)return;const{domain:n,bot:a,shouldRequestWriteAccess:o}=t;return void(0,s.R3)({...e,urlAuth:{...e.urlAuth,request:{domain:n,botId:a.id,shouldRequestWriteAccess:o}}})}const n="accepted"===t.type?t.url:e;window.open(n,"_blank","noopener"),(0,s.Sv)().closeUrlAuthModal()}async function he(e,t,n,s,a){await(0,x.t9)("sendMessage",{chat:e,text:n,replyingTo:s,sendAs:a})}let ge;async function pe(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{showDialog:o,showNotification:i,openUrl:r,openGame:c}=(0,s.Sv)();a&&(ge||(ge=new re("popup,width=800,height=600",(()=>{i({message:"Allow browser to open popup window"})}))),ge.preOpenIfNeeded());const d=await(0,x.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n,isGame:a});if(!d)return;const{message:l,alert:u,url:m}=d;u?o({data:{message:l||"Error"}}):l?i({message:l}):m&&(a?m.includes(ce)?ge.open(m):(ge.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}async function fe(e){const t=await(0,x.t9)("getPaymentForm",e);if(!t)return;const{form:n,invoice:a}=t;let o=(0,r._7)((0,s.Rd)(),n);return o=(0,r.Q$)(o,m.KB.Checkout),(0,s.R3)(o),a}async function Ie(e,t,n){const a=await(0,x.t9)("validateRequestedInfo",{inputInvoice:e,requestInfo:t,shouldSave:n});if(!a)return;const{id:o,shippingOptions:i}=a;let c=(0,r.vT)((0,s.Rd)(),o);i?(c=(0,r.TM)(c,i),c=(0,r.Q$)(c,m.KB.Shipping)):c=(0,r.Q$)(c,m.KB.Checkout),(0,s.R3)(c)}(0,s.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:s,button:a}=n;switch(a.type){case"command":t.sendBotCommand({command:a.text});break;case"url":{const{url:e}=a;t.openUrl({url:e});break}case"callback":{const t=(0,c.jr)(e);if(!t)return;pe(t,s,a.data);break}case"requestPoll":t.openPollModal({isQuiz:a.isQuiz});break;case"requestPhone":{const n=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id}});break}case"receipt":{const n=(0,c.jr)(e);if(!n)return;const{receiptMessageId:o}=a;t.getReceipt({receiptMessageId:o,chatId:n.id,messageId:s});break}case"buy":{const n=(0,c.jr)(e);if(!n)return;t.openInvoice({chatId:n.id,messageId:s});break}case"game":{const t=(0,c.jr)(e);if(!t)return;pe(t,s,void 0,!0);break}case"switchBotInline":{const{query:e,isSamePeer:n}=a;t.switchBotInline({query:e,isSamePeer:n,messageId:s});break}case"userProfile":{const{userId:e}=a;t.openChatWithInfo({id:e});break}case"simpleWebView":{const{url:n}=a,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.hj)(e,o,s);if(!i?.senderId)return;const r=(0,oe.BS)();t.requestSimpleWebView({url:n,botId:i?.senderId,theme:r,buttonText:a.text});break}case"webView":{const{url:n}=a,o=(0,c.jr)(e);if(!o)return;const i=(0,c.hj)(e,o.id,s);if(!i)return;const r=i.viaBotId||i.senderId;if(!r)return;const d=(0,oe.BS)();t.requestWebView({url:n,botId:r,peerId:o.id,theme:d,buttonText:a.text});break}case"urlAuth":{const{url:n}=a,o=(0,c.jr)(e);if(!o)return;t.requestBotUrlAuth({chatId:o.id,messageId:s,buttonId:a.buttonId,url:n});break}}})),(0,s.iw)("sendBotCommand",((e,t,n)=>{const{command:s,chatId:a}=n,{currentUserId:o}=e,i=a?(0,c.Z1)(e,a):(0,c.jr)(e),r=(0,c.Bt)(e);if(!o||!i||!r)return;const{threadId:d}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:d,value:!1}),he(i,0,s,(0,c.Yy)(e,i.id,d),(0,c._5)(e,a))})),(0,s.iw)("restartBot",(async(e,t,n)=>{const{chatId:a}=n,{currentUserId:o}=e,i=(0,c.jr)(e),d=o&&(0,c.IK)(e,a);o&&i&&d&&await(0,x.t9)("unblockContact",d.id,d.accessHash)&&((0,s.R3)((0,r.rB)((0,s.Rd)(),d.id)),he(i,0,"/start",void 0,(0,c._5)(e,a)))})),(0,s.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,p.b)(e.serverTimeOffset)-t<60)return;const n=await(0,x.t9)("fetchTopInlineBots");if(!n)return;const{ids:a,users:o}=n;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:a,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,s.R3)(e)})),(0,s.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:a,username:o,query:i,offset:d}=n;let l=e.inlineBots.byUsername[o];if(!1!==l){if(void 0===l){const{user:t,chat:n}=await(0,x.t9)("fetchInlineBot",{username:o})||{};if(e=(0,s.Rd)(),!t||!n)return void(0,s.R3)(se(e,o,!1));e=(0,r.Sh)(e,{[t.id]:t}),e=(0,r.fZ)(e,{[n.id]:n}),l={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=se(e,o,l),(0,s.R3)(e)}(i!==l.query||l.canLoadMore)&&de((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:a,query:o,offset:i}=e,r=(0,s.Rd)();const d=(0,c.dy)(r,n.id),l=(0,c.Z1)(r,a);if(!d||!l)return;const u=n.query!==o;r=ae(r,!0),r=se(r,t,{...n,query:o,...u&&{offset:void 0,results:[]}}),(0,s.R3)(r);const m=await(0,x.t9)("fetchInlineBotResults",{bot:d,chat:l,query:o,offset:u?void 0:i}),h=r.inlineBots.byUsername[t];if(r=ae((0,s.Rd)(),!1),!m||!h||o!==h.query)return void(0,s.R3)(r);const g=new Set((h.results||[]).map((e=>e.id))),p=m.results.filter((e=>!g.has(e.id)));r=se(r,t,{...h,help:m.help,...p.length&&{isGallery:m.isGallery},...m.switchPm&&{switchPm:m.switchPm},canLoadMore:m.results.length>0&&Boolean(m.nextOffset),results:""===h.offset||h.offset===m.nextOffset?m.results:(h.results||[]).concat(p),offset:p.length?m.nextOffset:""}),(0,s.R3)(r)}({username:o,inlineBotData:l,chatId:a,query:i,offset:d})}))}})),(0,s.iw)("switchBotInline",((e,t,n)=>{const{query:s,isSamePeer:a,messageId:o}=n,i=(0,c.jr)(e);if(!i)return;const r=(0,c.hj)(e,i.id,o);if(!r)return;const d=(0,c.dy)(e,r.viaBotId||r.senderId);d&&t.openChatWithDraft({text:`@${d.username} ${s}`,chatId:a?i.id:void 0})})),(0,s.iw)("sendInlineBotResult",((e,t,n)=>{const{id:s,queryId:a,isSilent:o,scheduledAt:i}=n,r=(0,c.Bt)(e);if(!r||!s)return;const{chatId:d,threadId:l}=r,u=(0,c.Z1)(e,d);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:d,threadId:l,value:!1}),(0,x.t9)("sendInlineBotResult",{chat:u,resultId:s,queryId:a,replyingTo:(0,c.Yy)(e,d,l),sendAs:(0,c._5)(e,d),isSilent:o,scheduleDate:i})})),(0,s.iw)("resetInlineBot",((e,t,n)=>{const{username:a}=n;let o=e.inlineBots.byUsername[a];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,s.R3)(se(e,a,o)))})),(0,s.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:o}=n;let i=(0,c.dy)(e,a);i&&(i.fullInfo||await(0,x.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash}),i=(0,c.dy)((0,s.Rd)(),a),i.fullInfo?.isBlocked&&await(0,x.t9)("unblockContact",i.id,i.accessHash),await(0,x.t9)("startBot",{bot:i,startParam:o}))})),(0,s.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:a,botId:o,theme:i,buttonText:r}=n,d=(0,c.dy)(e,o);if(!d)return;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}});const l=await(0,x.t9)("requestSimpleWebView",{url:a,bot:d,theme:i});l&&(e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:l,botId:o,buttonText:r}}))})),(0,s.iw)("requestWebView",(async(e,t,n)=>{const{url:a,botId:o,peerId:i,theme:r,isSilent:d,buttonText:l,isFromBotMenu:u,startParam:m}=n,h=(0,c.dy)(e,o);if(!h)return;const g=(0,c.Z1)(e,i);if(!g)return;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}});const p=(0,c.Bt)(e);if(!p)return;const{chatId:f,threadId:I}=p,v=f&&(0,c.Yy)(e,f,I),w=(0,c._5)(e,f),y=await(0,x.t9)("requestWebView",{url:a,bot:h,peer:g,theme:r,isSilent:d,replyToMessageId:v||void 0,isFromBotMenu:u,startParam:m,sendAs:w});if(!y)return;const{url:P,queryId:Z}=y;e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:P,botId:o,queryId:Z,buttonText:l}})})),(0,s.iw)("prolongWebView",(async(e,t,n)=>{const{botId:s,peerId:a,isSilent:o,replyToMessageId:i,queryId:r}=n,d=(0,c.dy)(e,s);if(!d)return;const l=(0,c.Z1)(e,a);if(!l)return;const u=(0,c._5)(e,a);await(0,x.t9)("prolongWebView",{bot:d,peer:l,isSilent:o,replyToMessageId:i,queryId:r,sendAs:u})||t.closeWebApp()})),(0,s.iw)("sendWebViewData",((e,t,n)=>{const{bot:s,data:a,buttonText:o}=n;(0,x.t9)("sendWebViewData",{bot:s,data:a,buttonText:o})})),(0,s.iw)("closeWebApp",(e=>({...e,webApp:void 0}))),(0,s.iw)("setWebAppPaymentSlug",((e,t,n)=>{if(e.webApp?.url)return{...e,webApp:{...e.webApp,slug:n.slug}}})),(0,s.iw)("cancelBotTrustRequest",(e=>({...e,botTrustRequest:void 0}))),(0,s.iw)("markBotTrusted",((e,t,n)=>{const{botId:a}=n,{trustedBotIds:o}=e,i=new Set(o);if(i.add(a),(0,s.R3)({...e,botTrustRequest:void 0,trustedBotIds:Array.from(i)}),e.botTrustRequest?.onConfirm){const{action:n,payload:s}=e.botTrustRequest.onConfirm;t[n](s)}})),(0,s.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:s}=n||{};await ue(s)})),(0,s.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:s,isEnabled:a}=n,o=(0,c.dy)(e,s);o&&await le(o,a)})),(0,s.iw)("callAttachBot",((e,t,n)=>{const{chatId:s,botId:a,isFromBotMenu:o,url:i,startParam:r}=n,{attachMenu:{bots:c}}=e;if(!o&&!c[a])return{...e,requestedAttachBotInstall:{botId:a,onConfirm:{action:"callAttachBot",payload:{chatId:s,botId:a,startParam:r}}}};const d=(0,oe.BS)();t.openChat({id:s}),t.requestWebView({url:i,peerId:s,botId:a,theme:d,buttonText:"",isFromBotMenu:o,startParam:r})})),(0,s.iw)("confirmAttachBotInstall",(async e=>{const{requestedAttachBotInstall:t}=e,{botId:n,onConfirm:a}=t;(0,s.R3)({...e,requestedAttachBotInstall:void 0});const o=(0,c.dy)(e,n);if(o&&(await le(o,!0),a)){const{action:e,payload:t}=a;(0,s.Sv)()[e](t)}})),(0,s.iw)("cancelAttachBotInstall",(e=>({...e,requestedAttachBotInstall:void 0}))),(0,s.iw)("requestAttachBotInChat",((e,t,n)=>{const{botId:a,filter:o,startParam:i}=n,r=(0,c.Bt)(e)?.chatId,{attachMenu:{bots:d}}=e,l=d[a];if(!l)return;const u=l.peerTypes.filter((e=>"self"!==e&&o.includes(e)));u.length?(0,s.R3)({...e,requestedAttachBotInChat:{botId:a,filter:u,startParam:i}}):t.callAttachBot({chatId:r||a,botId:a,startParam:i})})),(0,s.iw)("cancelAttachBotInChat",(e=>({...e,requestedAttachBotInChat:void 0}))),(0,s.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:a,buttonId:o,messageId:i,url:r}=n,d=(0,c.Z1)(e,a);if(!d)return;const l=await(0,x.t9)("requestBotUrlAuth",{chat:d,buttonId:o,messageId:i});l&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:d.id}}}),me(r,l))})),(0,s.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s}=n;if(!e.urlAuth?.button)return;const{button:a,url:o}=e.urlAuth,{chatId:i,messageId:r,buttonId:d}=a,l=(0,c.Z1)(e,i);if(!l)return;const u=await(0,x.t9)("acceptBotUrlAuth",{chat:l,messageId:r,buttonId:d,isWriteAllowed:s});u&&me(o,u)})),(0,s.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:a}=n,o=await(0,x.t9)("requestLinkUrlAuth",{url:a});o&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:a}}),me(a,o))})),(0,s.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s}=n;if(!e.urlAuth?.url)return;const{url:a}=e.urlAuth,o=await(0,x.t9)("acceptLinkUrlAuth",{url:a,isWriteAllowed:s});o&&me(a,o)})),(0,s.iw)("closeUrlAuthModal",(e=>({...e,urlAuth:void 0}))),n(51371),(0,s.iw)("loadPasswordInfo",(async e=>{const t=await(0,x.t9)("getPasswordInfo");t&&(e=(0,s.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),e=(0,r.IE)(e,{hint:t.hint}),(0,s.R3)(e))})),(0,s.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,x.t9)("checkPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),i&&o()})),(0,s.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,x.t9)("clearPassword",a);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),i&&o()})),(0,s.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:a,password:o,hint:i,email:c,onSuccess:d}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const l=await(0,x.t9)("updatePassword",a,o,i,c);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),l&&d()})),(0,s.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:a,email:o,onSuccess:i}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,x.t9)("updateRecoveryEmail",a,o);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),c&&i()})),(0,s.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:s}=n;(0,x.t9)("provideRecoveryEmailCode",s)})),(0,s.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,s.iw)("validateRequestedInfo",((e,t,n)=>{const s=(0,c.kb)(e);if(!s)return;const{requestInfo:a,saveInfo:o}=n;if("slug"in s)Ie(s,a,o);else{const t=(0,c.Z1)(e,s.chatId);if(!t)return;Ie({chat:t,messageId:s.messageId},a,o)}})),(0,s.iw)("openInvoice",(async(e,t,n)=>{let a;if("slug"in n)a=await fe({slug:n.slug});else{const t=(0,c.Z1)(e,n.chatId);if(!t)return;a=await fe({chat:t,messageId:n.messageId})}a&&(e=(0,s.Rd)(),e=(0,r.bs)(e,a),(0,s.R3)({...e,payment:{...e.payment,inputInvoice:n,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:n.isExtendedMedia}}))})),(0,s.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:a,chatId:o,messageId:i}=n,d=o&&(0,c.Z1)(e,o);i&&a&&d&&async function(e,t,n){const a=await(0,x.t9)("getReceipt",e,n);if(!a)return;let o=(0,s.Rd)();const i=(0,c.hj)(o,e.id,t);o=(0,r.Dq)(o,a,i),(0,s.R3)(o)}(d,i,a)})),(0,s.iw)("clearPaymentError",(e=>{(0,s.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,s.iw)("clearReceipt",(e=>{(0,s.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,s.iw)("sendCredentialsInfo",((e,t,n)=>{const{nativeProvider:o}=e.payment,{credentials:i}=n,{data:d}=i;if("stripe"===o){const t=(0,c.$$)(e);if(!t)return;!async function(e,t){const n=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),a=await fetch(`https://api.stripe.com/v1/tokens${n}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),o=await a.json();if(o.error){const e=(0,l.Ow)(o.error),t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let i=(0,r.QH)((0,s.Rd)(),{type:o.type,id:o.id});i=(0,r.Q$)(i,m.KB.Checkout),(0,s.R3)(i)}(d,t)}else if("smartglocal"===o){const t=(0,c.EB)(e);if(!t)return;!async function(e,t){const n={card:{number:e.cardNumber.replace(/\D+/g,""),expiration_month:e.expiryMonth,expiration_year:e.expiryYear,security_code:e.cvv.replace(/\D+/g,"")}},o=a.eA?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",i=await fetch(o,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":t},body:JSON.stringify(n)}),c=await i.json();if("ok"!==c.status){const e={description:"payment error"},t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,status:"failed",error:{...e}}})}let d=(0,r.QD)((0,s.Rd)(),{type:"card",token:c.data.token});d=(0,r.Q$)(d,m.KB.Checkout),(0,s.R3)(d)}(d,t)}})),(0,s.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:a,saveCredentials:o,savedCredentialId:i,tipAmount:d}=n,l=(0,c.kb)(e),u=(0,c.eh)(e),m=(0,c.sp)(e),{nativeProvider:h,temporaryPassword:g}=e.payment,p="stripe"===h?(0,c.$$)(e):(0,c.EB)(e);if(!(l&&p&&u&&h))return;let f;if("slug"in l)f={slug:l.slug};else{const t=(0,c.Z1)(e,l.chatId);if(!t)return;f={chat:t,messageId:l.messageId}}(0,s.R3)((0,r.cQ)(e,{status:"pending"}));const I={save:o,data:"stripe"===h?(0,c.i3)(e):(0,c.Jg)(e)};await(0,x.t9)("sendPaymentForm",{inputInvoice:f,formId:u,credentials:I,requestedInfoId:m,shippingOptionId:a,savedCredentialId:i,temporaryPassword:g?.value,tipAmount:d})&&(e=(0,s.Rd)(),e=(0,r.cQ)(e,{status:"paid"}),e=(0,r.WY)(e),(0,s.R3)(e))})),(0,s.iw)("setPaymentStep",(function(e,t){var n;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,null!==(n=s.step)&&void 0!==n?n:m.KB.Checkout)})),(0,s.iw)("closePremiumModal",((e,t,n)=>{if(!e.premiumModal)return;const{isClosed:s}=n||{};return{...e,premiumModal:{...e.premiumModal,...s&&{isOpen:!1},isClosing:!s}}})),(0,s.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:a,fromUserId:o,isSuccess:i,isGift:c,monthsAmount:d,toUserId:l}=n||{};t.loadPremiumStickers();const u=await(0,x.t9)("fetchPremiumPromo");u&&(e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),(0,s.R3)({...e,premiumModal:{promo:u.promo,initialSection:a,isOpen:!0,fromUserId:o,toUserId:l,isGift:c,monthsAmount:d,isSuccess:i}}))})),(0,s.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:a}=n||{},o=await(0,x.t9)("fetchPremiumPromo");if(!o)return;e=(0,s.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id"));const i=o.promo.options.find((e=>1===e.months));(0,s.R3)({...e,giftPremiumModal:{isOpen:!0,forUserId:a,monthlyCurrency:i.currency,monthlyAmount:i.amount}})})),(0,s.iw)("closeGiftPremiumModal",(e=>{(0,s.R3)({...e,giftPremiumModal:{isOpen:!1}})})),(0,s.iw)("validatePaymentPassword",(async(e,t,n)=>{let{password:a}=n;const o=await(0,x.t9)("fetchTemporaryPaymentPassword",a);e=(0,s.Rd)(),e=o?"error"in o?(0,r.cQ)(e,{error:{message:o.error,field:"password"}}):(0,r.cQ)(e,{temporaryPassword:o,step:m.KB.Checkout}):(0,r.cQ)(e,{error:{message:"Unknown Error",field:"password"}}),(0,s.R3)(e)}));var ve=n(40647),we=n(4907),ye=n(74399);const Pe=32*ye.Gw,Ze=45.5*ye.Gw,Ce=26.5*ye.Gw,be=18*ye.Gw,Ee=16.125*ye.Gw;var Se=n(43858),Me=n(53475);function Re(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=Se.Z.get().width)>a._m?Math.min(Math.max(.25*n,be),.33*n):n>a.ks?Math.min(Math.max(.33*n,be),.4*n):Ce):0);var n}function ke(e,t,n){return(0,Me.a4)(e,t,n,void 0,!0)}let Ne=0;(0,s.iw)("loadAvailableReactions",(async()=>{const e=await(0,x.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&ve.he(`sticker${e.aroundAnimation.id}`,i.IU.BlobUrl),e.centerIcon&&ve.he(`sticker${e.centerIcon.id}`,i.IU.BlobUrl)})),(0,s.R3)({...(0,s.Rd)(),availableReactions:e}))})),(0,s.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:s,x:a,y:o,localEffect:i,startSize:r,isReversed:c}=n,d={id:Ne++,animatedEffect:s||i,x:Re(e,a)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:r,isReversed:c};return{...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],d]}})),(0,s.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:s,chatId:a,emoji:o,interactions:i,localEffect:r}=n,d=(0,c.Z1)(e,a);d&&(o||r)&&a!==e.currentUserId&&(0,x.t9)("sendEmojiInteraction",{chat:d,messageId:s,emoticon:o||(0,c.ji)(r),timestamps:i})})),(0,s.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:s,messageId:a,x:o,y:i}=n,r=(0,c.q6)(e,s),d=(0,c.hj)(e,s,a);r&&d&&!(0,l.CI)(d)&&t.sendReaction({chatId:s,messageId:a,reaction:r,x:o,y:i})})),(0,s.iw)("sendReaction",((e,t,n)=>{const{chatId:s}=n;let{messageId:o}=n,{reaction:i}=n;const r=(0,c.Z1)(e,s);let d=(0,c.hj)(e,s,o);if(!r||!d)return;const l=Boolean(d.groupedId)&&!d.isInAlbum,u=l?(0,c.xH)(e,s,d.groupedId)[0]:void 0;d=l&&(0,c.hj)(e,s,u)||d,o=d?.id||o,d.reactions?.results?.some((e=>e.reaction===i&&e.isChosen))&&(i=void 0),(0,x.t9)("sendReaction",{chat:r,messageId:o,reaction:i});const{animationLevel:m}=e.settings.byKey;return m===a.zy&&(e={...e,activeReactions:{...i?e.activeReactions:(0,g.CE)(e.activeReactions,[o]),...i&&{[o]:{reaction:i,messageId:o}}}}),function(e,t,n,s){const{reactions:a}=(0,c.hj)(e,t,n)||{};if(!a)return e;let o=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:i}=a;if(s&&!o.some((e=>e.reaction===s))){const{currentUserId:t}=e;o=[...o,{reaction:s,isChosen:!0,count:1}],a.canSeeList&&(i=[...i||[],{userId:t,reaction:s}])}return(0,we.cY)(e,t,n,{reactions:{...a,results:o,recentReactions:i}})}(e,s,o,i)})),(0,s.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,s.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:s,reaction:a}=n;return e.activeReactions[s]?.reaction!==a?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[s])}})),(0,s.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:a}=n;await(0,x.t9)("setDefaultReaction",{reaction:a})&&(0,s.R3)({...(0,s.Rd)(),appConfig:{...e.appConfig,defaultReaction:a}})})),(0,s.iw)("stopActiveEmojiInteraction",((e,t,n)=>{const{id:s}=n;return{...e,activeEmojiInteractions:e.activeEmojiInteractions?.filter((e=>e.id!==s))}})),(0,s.iw)("loadReactors",(async(e,t,n)=>{const{chatId:a,messageId:o,reaction:i}=n,d=(0,c.Z1)(e,a),l=(0,c.hj)(e,a,o);if(!d||!l)return;const u=l.reactors?.nextOffset,m=await(0,x.t9)("fetchMessageReactionsList",{reaction:i,chat:d,messageId:o,offset:u});if(!m)return;e=(0,s.Rd)(),m.users?.length&&(e=(0,r.Sh)(e,(0,g.ee)(m.users,"id")));const{nextOffset:h,count:p,reactions:f}=m;(0,s.R3)((0,r.cY)(e,a,o,{reactors:{nextOffset:h,count:p,reactions:[...l.reactors?.reactions||[],...f]}}))})),(0,s.iw)("loadMessageReactions",((e,t,n)=>{const{ids:s,chatId:a}=n,o=(0,c.Z1)(e,a);o&&(0,x.t9)("fetchMessageReactions",{ids:s,chat:o})})),(0,s.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:s,emoticon:a,x:o,y:i,startSize:r,isReversed:d,id:l}=n,u=(0,c.Z1)(e,s);if(u&&e.activeEmojiInteractions?.some((e=>e.id===l))&&s!==e.currentUserId)return(0,x.t9)("sendWatchingEmojiInteraction",{chat:u,emoticon:a}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===l?{...t,x:Re(e,o),y:i,startSize:r,isReversed:d}:t))}})),(0,s.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:a,offsetId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const d=await(0,x.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!d||!d.messages.length)return e=ke(e=(0,s.Rd)(),a,{unreadReactionsCount:0}),void(0,s.R3)(e);const{messages:l,chats:u,users:m}=d,h=(0,g.ee)(l,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=ke(e=(0,r.fZ)(e,(0,g.ee)(u,"id")),a,{unreadReactions:[...i.unreadReactions||[],...p]}),(0,s.R3)(e)})),(0,s.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:o}=n,{animationLevel:i}=e.settings.byKey,r=(0,c.jr)(e);if(r){if(r.unreadReactionsCount){const n=r.unreadReactionsCount-o.length,a=(r.unreadReactions||[]).filter((e=>!o.includes(e)));e=ke(e,r.id,{unreadReactions:a}),(0,s.R3)(e),!a.length&&n&&t.fetchUnreadReactions({chatId:r.id,offsetId:Math.min(...o)})}if(t.markMessagesRead({messageIds:o}),i===a.zy)return e=(0,s.Rd)(),{...e,activeReactions:{...e.activeReactions,...Object.fromEntries(o.map((t=>{const n=(0,c.hj)(e,r.id,t);if(!n)return;const s=n.reactions?.recentReactions?.find((e=>e.isUnread));if(!s)return;const a=s?.reaction;return[t,{messageId:t,reaction:a}]})).filter(Boolean))}}}})),(0,s.iw)("focusNextReaction",((e,t)=>{const n=(0,c.jr)(e);n?.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0]})})),(0,s.iw)("readAllReactions",(e=>{const t=(0,c.jr)(e);if(t)return(0,x.t9)("readAllReactions",{chat:t}),ke(e,t.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,s.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:a,isGroup:o}=n,i=(0,c.Z1)(e,a);if(!i?.fullInfo)return;const d=await(0,x.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:i});if(d){if(e=(0,s.Rd)(),d.recentTopMessages?.length){const t=(0,c.Zw)(e,a);d.recentTopMessages=d.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}(0,s.R3)((0,r.ze)(e,a,d))}})),(0,s.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(!i?.fullInfo)return;let d=await(0,x.t9)("fetchMessageStatistics",{chat:i,messageId:o});d||(d={}),e=(0,s.Rd)();const{views:l,forwards:u}=(0,c.Zw)(e,a)[o];d.views=l,d.forwards=u;const m=i.fullInfo.statisticsDcId,h=await(0,x.t9)("fetchMessagePublicForwards",{chat:i,messageId:o,dcId:m});d.publicForwards=h?.length,d.publicForwardsData=h,e=(0,s.Rd)(),(0,s.R3)((0,r.kM)(e,d))})),(0,s.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:a,token:o,name:i,isPercentage:d}=n,l=(0,c.Z1)(e,a);if(!l?.fullInfo)return;const u=l.fullInfo.statisticsDcId,m=await(0,x.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:u,isPercentage:d});m&&(0,s.R3)((0,r.yC)((0,s.Rd)(),a,i,m))})),n(28304);var Te=n(28406);function Ae(e,t){const n=typeof e;if(n!==typeof t)return!1;if("object"!==n)return e===t;const s=Array.isArray(e);if(s!==Array.isArray(t))return!1;if(s){const n=e,s=t;return n.length===s.length&&n.every(((e,t)=>Ae(e,s[t])))}const a=e,o=t;return Object.keys(a).every((e=>Ae(a[e],o[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,Te.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 o=(0,c.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.id}))}case"updateChatLeave":return(0,r.Dd)(e,n.id);case"updateChatInbox":return(0,r.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,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:o,threadId:d,type:l}=(0,c.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const u=(0,c.Z1)(e,n.chatId);if(!u)return;const m="thread"===l&&d===i._f&&n.chatId===o,h=Boolean(n.message.id&&n.message.hasUnreadMention);return m?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):e=(0,r.a4)(e,n.chatId,{unreadCount:(u.unreadCount||0)+1,...h&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1}}),h&&(e=(0,r.a4)(e,n.chatId,{unreadMentions:[...u.unreadMentions||[],n.message.id]})),(0,s.R3)(e),void(0,Te.rh)({chat:u,message:a})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;return t.forEach((t=>{const s="channelId"in n?n.channelId:(0,c.X5)(e,t),a=(0,c.Z1)(e,s);a?.unreadReactionsCount&&(e=ke(e,s,{unreadReactionsCount:a.unreadReactionsCount-1||void 0,unreadReactions:a.unreadReactions?.filter((e=>e!==t))})),a?.unreadMentionsCount&&(e=(0,r.a4)(e,s,{unreadMentionsCount:a.unreadMentionsCount-1||void 0,unreadMentions:a.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,s=e.chats.byId[n.id];if(!s)return;return(0,r.a4)(e,n.id,{fullInfo:{...s.fullInfo,...t}})}case"updatePinnedChatIds":{const{ids:t,folderId:s}=n,o=s===a.WS?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:s}=n,o=(0,c.Ek)(e,t);if(!o)return;const{[o]:i}=e.chats.orderedPinnedIds;let r=i||[];if(s){if(!r.includes(t)){if("active"===o&&r.length>=a.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,[o]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:s}=n;return(0,r.Pi)(e,t,s)}case"updateChatFolder":{const{id:t,folder:s}=n,{byId:a,orderedIds:o}=e.chatFolders,i=s?{...a,[t]:s}:(0,g.ei)(a,Object.keys(a).map(Number).filter((e=>e!==t))),r=s?o&&o.includes(t)?o:[...o||[],t]:o?o.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:r}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:a,deletedMemberId:o}=n;if(!t)return;let i=!1,c=t.fullInfo?.members?[...t.fullInfo.members]:[];if(s)c=s,i=!0;else if(a)c.length&&c.some((e=>e.userId===a.userId))||(c.push(a),i=!0);else if(c.length&&o){const e=c.findIndex((e=>e.userId===o));e>-1&&(c.slice(e,1),i=!0)}if(i){const s=c.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,r.a4)(e,n.id,{membersCount:c.length,fullInfo:{...t.fullInfo,members:c,adminMembersById:(0,g.ee)(s,"userId")}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,a=e.chats.byId[t];return a?.photos?(0,r.a4)(e,t,{photos:a.photos.filter((e=>!s.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:s,date:a,replyingToId:o}=n;if(!e.chats.byId[t])return;return e=(0,r.pf)(e,t,i._f,"draft",s),e=(0,r.pf)(e,t,i._f,"replyingToId",o),e=(0,r.a4)(e,t,{draftDate:a})}case"showInvite":{const{data:e}=n;return void t.showDialog({data:e})}case"updatePendingJoinRequests":{const{chatId:a,requestsPending:o,recentRequesterIds:i}=n,c=e.chats.byId[a];if(!c)return;e=(0,r.a4)(e,a,{fullInfo:{...c.fullInfo,requestsPending:o,recentRequesterIds:i}}),(0,s.R3)(e),t.loadChatJoinRequests({chatId:a})}}}));const Be=350;function xe(e,t,n,s,a,o,i){const d=i?.reactions;if(d&&Ae(s,d))return e;if(e=(0,r.cY)(e,t,n,{reactions:s}),!o)return e;const u=a.unreadReactions?.includes(n);if((0,l.yL)(e,s)&&!u){e=ke(e,t,{unreadReactionsCount:(a?.unreadReactionsCount||0)+1,unreadReactions:[...a?.unreadReactions||[],n]});const s=(0,c.hj)(e,t,n);if(!a||!s)return e;(0,N.R3)((()=>{(0,Te.rh)({chat:a,message:s,isReaction:!0})}))}else u&&(e=ke(e,t,{unreadReactionsCount:(a?.unreadReactionsCount||1)-1,unreadReactions:a?.unreadReactions?.filter((e=>e!==n))}));return e}function Le(e,t,n,s){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=a?(0,c.Tm)(e,t,n):(0,c.hj)(e,t,n);if(o&&s.content){const{photo:e,video:t,sticker:n,document:a}=(0,l.qp)(o);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:n&&s.content.sticker?s.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:a&&s.content.document&&(s.content.document.previewBlobUrl=a.previewBlobUrl)}return a?(0,r.P4)(e,t,n,s):(0,r.cY)(e,t,n,s)}function Oe(e,t,n,s){const{chatId:a}=n,{threadInfo:o}=(0,c.Db)(e,a,n)||{};if(!o&&n.replyToMessageId){const o=(0,c.hj)(e,a,n.replyToMessageId);o?e=(0,r.lG)(e,o,a,n.id,s):t.loadMessage({chatId:a,messageId:n.replyToMessageId,threadUpdate:{isDeleting:s,lastMessageId:n.id}})}return e}function Fe(e,t,n){const{id:s,chatId:a}=n,{threadInfo:o,firstMessageId:d}=(0,c.Db)(e,a,n)||{},u=(0,c.Z1)(e,a)?.unreadCount&&!(0,c.gb)(e,a,i._f);if(e=Oe(e,t,n),o&&(!d&&(0,l.CI)(n)||(e=(0,r.xj)(e,a,o.threadId,[s]),(0,c.b9)(e,a,o.threadId)&&(e=(0,r.$S)(e,a,o.threadId,s),d||(e=(0,r.pf)(e,a,o.threadId,"firstMessageId",n.id)))),e=(0,r.pf)(e,a,o.threadId,"threadInfo",{...o,lastMessageId:n.id,messagesCount:o.messagesCount+1})),u)return e;if(e=(0,r.xj)(e,a,i._f,[s]),(0,c.b9)(e,a,i._f)){const t=(0,c.It)(e,a,i._f),n=(0,r.$S)(e,a,i._f,s),o=(0,c.Cb)(n,a,i._f);t&&!o.includes(t)||(e=n)}return e}function Ue(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:a}=e,o=a.byId[t]?.lastMessage;return!o||s||o.id===n.id||o.id===n.previousLocalId||n.id>o.id?(0,r.a4)(e,t,{lastMessage:n}):e}function je(e,t){const n=(0,c.Zw)(e,t),s=(0,c.gb)(e,t,i._f);if(!n||!s)return;let a=s.length;for(;a--;){const e=n[s[a]];if(!e.isDeleting)return e}}function De(e,t,n,a){if(e){t.forEach((t=>{const n=je(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);n&&(a=Ue(a,e,n,!0))})),n.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const s=(0,c.hj)(a,e,t);if(!s)return;a=Oe(a,n,s,!0);const{threadInfo:i}=(0,c.Db)(a,e,s)||{};i&&o.push(i.threadId)})),(0,s.R3)(a),void setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),Be)}const o=[];t.forEach((e=>{const t=(0,c.X5)(a,e);if(t){o.push(t);const n=je(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);n&&(a=Ue(a,t,n,!0)),setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),t,[e]))}),Be)}})),(0,s.R3)(a),(0,g.Tw)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:a,id:o,message:d,shouldForceReply:u}=n;e=Fe(e=Le(e,a,o,d),t,d),d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo));const m=(0,c.hj)(e,a,o),h=(0,l.CI)(d);if((0,c.KA)(e,a,d)){if(h&&d.isOutgoing&&!d.content?.action){const n=(0,c.Bt)(e);n&&t.focusMessage({chatId:a,threadId:n.threadId,messageId:d.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,a,d)||{};n&&t.requestThreadInfoUpdate({chatId:a,threadId:n.threadId}),h||setTimeout((()=>{let e=(0,s.Rd)();u&&(e=(0,r.pf)(e,a,i._f,"replyingToId",o)),(0,s.R3)(Ue(e,a,m))}),Be)}else e=Ue(e,a,m);(0,s.R3)(e),(0,c.N)(e,a)||t.loadTopChats();break}case"updateStartEmojiInteraction":{const{chatId:t}=(0,c.Bt)(e)||{};if(t!==n.id)return;const a=(0,c.hj)(e,t,n.messageId);if(!a)return;if((0,l.UD)(a)!==n.emoji)return;const o=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:e.activeEmojiInteractions?.length||0,animatedEffect:o?(0,c.cu)(o):n.emoji,messageId:n.messageId}]},(0,s.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:a,message:o}=n;e=Le(e,t,a,o,!0);const d=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",(0,g.Tw)([...d,a])),(0,s.R3)(e);break}case"updateMessage":{const{chatId:a,id:o,message:d}=n,l=(0,c.hj)(e,a,o),u=(0,c.Z1)(e,a);e=Le(e,a,o,d);const m=(0,c.hj)(e,a,o);d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),l&&(e=Ue(e,a,m)),d.reactions&&u&&(e=xe(e,a,o,d.reactions,u,d.isOutgoing,l)),(0,s.R3)(e),l&&u&&!d.isOutgoing&&u.lastMessage?.id===d.id&&(0,c.xo)(e,u)&&(0,c.KA)(e,a,d)&&(0,c.b9)(e,a,d.threadInfo?.threadId||i._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:a,message:o}=n;if(!(0,c.Tm)(e,t,a))return;e=Le(e,t,a,o,!0);const d=Object.keys((0,c.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,i._f,"scheduledIds",d),(0,s.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:o,message:i}=n;e=Fe(e,t,i);const d=(0,c.hj)(e,a,o);e=(0,r.K4)(e,a,[o]),i.isScheduled&&(e=(0,r.bV)(e,a,[o])),e=(0,r.cY)(e,a,i.id,{...d,...i,previousLocalId:o});const l=(0,c.hj)(e,a,i.id);e=Ue(e,a,l);const u=(0,c.Db)(e,a,i);u?.threadInfo&&(t.markMessageListRead({maxId:i.id}),e=(0,r.pf)(e,a,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),(0,s.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:a,message:o}=n,d=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",[...d,o.id]);const l=(0,c.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,o.id,{...l,...o,previousLocalId:a}),(0,s.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:o}=n,d=(0,c.KB)(e,t)||[],l=a?[...d,...o].sort(((e,t)=>t-e)):d.filter((e=>!o.includes(e)));(0,s.R3)((0,r.pf)(e,t,i._f,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:o,firstMessageId:i}=n,d={...(0,c.tZ)(e,t,a),...o};if(!d.threadId)return;e=(0,r.Xg)(e,t,a,d),i&&(e=(0,r.pf)(e,t,a,"firstMessageId",i)),(0,s.R3)(e);break}case"resetMessages":{const{id:a}=n,o=(0,c.Zw)(e,a);o&&!(0,l.YC)(a)&&(e=(0,r.K4)(e,a,Object.keys(o).map(Number)),(0,s.R3)(e),t.loadFullChat({chatId:a,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:a}=n;De(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,i._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,s.R3)(a)}),Be))}(a,t,0,e);break}case"deleteHistory":{const{chatId:o}=n,i=e.messages.byChatId[o];o===a.aw&&(0,s.R3)({...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))}),i?De(o,Object.keys(i.byId).map(Number),t,(0,s.Rd)()):t.requestChatUpdate({chatId:o});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:a}=n;t.forEach((t=>{const n=(0,c.X5)(e,t);n&&(e=(0,r.cY)(e,n,t,a))})),(0,s.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:a,messageUpdate:o}=n;a.forEach((n=>{e=(0,r.cY)(e,t,n,o)})),(0,s.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:a}=n,o=(0,c.ZB)(e,t);if(o?.content.poll){const t=o.content.poll.results;let n=t;a.results?.results&&(t.results&&a.results.isMin?t.results&&(n={...a.results,results:a.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):n=a.results);const i={...o.content.poll,...a,results:n};(0,s.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:i}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:a,options:o}=n,i=(0,c.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:d}=i.content,{recentVoterIds:l,totalVoters:u,results:m}=d.results,h=l?[...l]:[],g=u?u+1:1,p=m?[...m]:[];h.push(a),o.forEach((t=>{const n=p.findIndex((e=>e.option===t)),s=p[n],o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,a===e.currentUserId&&(o.isChosen=!0),n?p[n]=o:p.push(o)})),(0,s.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...d,results:{...d.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:s}=n;(0,c.UW)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:t,id:a,reactions:o}=n,i=(0,c.hj)(e,t,a),r=(0,c.Z1)(e,n.chatId);if(!r||!i)return;(0,s.R3)(xe(e,t,a,o,r,i.isOutgoing,i));break}case"updateMessageExtendedMedia":{const{chatId:t,id:a,media:o,preview:i}=n,d=(0,c.hj)(e,t,a);if(!(0,c.Z1)(e,n.chatId)||!d)return;if(i){if(!d.content.invoice)return;(0,s.R3)((0,r.cY)(e,t,a,{content:{...d.content,invoice:{...d.content.invoice,extendedMedia:i}}}))}else o&&(0,s.R3)((0,r.cY)(e,t,a,{content:{...o}}));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:a,isPending:o}=n;(0,s.R3)({...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:a,isPending:o}}});break}}}));const qe=(0,N.P2)((function(){const e=(0,s.Rd)();(0,s.R3)((0,r.ps)(e,{...e.users.statusesById,...$e})),$e={}}),3e3,!0);let $e={};(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,r.GK)(e,n.id);case"updateUser":return n.id===e.currentUserId&&n.user.isPremium&&!(0,c.wV)(e)&&t.openPremiumModal({isSuccess:!0}),(0,r.Nq)(e,n.id,n.user);case"updateUserEmojiStatus":return(0,r.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return s=n.userId,a=n.status,$e[s]=a,void qe();case"updateUserFullInfo":{const{id:t,fullInfo:s}=n,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...s}})}case"updateBotMenuButton":{const{botId:t,button:s}=n,a=(0,c.dy)(e,t);if(!a?.fullInfo?.botInfo)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,botInfo:{...a.fullInfo.botInfo,menuButton:s}}})}}var s,a})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,r.Rg)(e,n.id,n.stickerSet)})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,r.O4)((0,s.Rd)(),n.id):(0,r.rB)((0,s.Rd)(),n.id);case"updateResetContactList":(0,s.R3)({...(0,s.Rd)(),contactList:{userIds:[]}});break;case"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":e.webApp?.queryId===n.queryId&&(t.setReplyingToId({messageId:void 0}),t.closeWebApp())}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,r.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent:o,shouldShowPreviews:i}=n;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:a})),(0,s.R3)((0,r.aK)(e,t,{isMuted:a,isSilent:o,shouldShowPreviews:i}));break}}})),(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 Ge=n(78958),He=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,Ge.dc)(e,n.call.id):(0,Ge.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,c.Z1)(e,n.chatId);return t&&(e=(0,r.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:a,nextOffset:o}=n,{currentUserId:i}=e;return e=(0,s.Rd)(),a.forEach((n=>{n.id&&(e=(0,Ge.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,Ge.AH)(e,t,{nextOffset:o})),e}case"updatePhoneCall":{if(!h.Bi)return;const{phoneCall:a,currentUserId:o}=e,{call:i}=n;if(a)return"discarded"===i.state?(t.playGroupCallSound({sound:"end"}),{...e,...i.needRating&&{ratingPhoneCall:i},isCallPanelVisible:void 0,phoneCall:void 0}):void 0;if(i?.adminId!==o&&"requested"===i.state)return(0,N.R3)((()=>{(0,Te.TO)({call:i,user:(0,He.fu)((0,s.Rd)())})})),(0,S.o5)(),(0,S.CW)(i.isVideo),{...e,phoneCall:i,isCallPanelVisible:!1}}}}));var Ve=n(9937);(0,s.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"]){const{inputInvoice:s}=e.payment;if(s&&"chatId"in s&&"messageId"in s){const n=(0,c.hj)(e,s.chatId,s.messageId);if(n&&n.content.invoice){const{amount:e,currency:s,title:a}=n.content.invoice;t.showNotification({message:I.i0("PaymentInfoHint",[(0,Ve.x)(e,s,I.i0.code),a])})}}return h.Xp||(e=(0,r.WY)(e)),n.slug&&s&&"slug"in s&&s.slug!==n.slug?h.Xp?void 0:e:{...e,payment:{...e.payment,status:"paid"}}}}));var _e=n(46752),ze=n(1279),We=n(53551),Xe=n(274),Je=n(45332);function Ye(e){(0,o.d4)((()=>(0,N.Gq)(e)),[e])}var Ke=n(29290);const Qe=document.querySelector('meta[name="viewport"]'),et=Qe?.getAttribute("content")||"",tt="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function nt(e){e.preventDefault()}var st=n(65326),at=n(31212),ot=n(18674),it=n(62357),rt=n(15780),ct=n(99203),dt=n(48778);const lt=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"StickerSetModal",!t);return n?o.ZP.createElement(n,e):void 0}));var ut=n(2155),mt=n(95616),ht=n(17358);const gt=(0,o.X$)((e=>{let{isForAppBadge:t}=e;(0,mt.yi)();const n=(0,K.xW)();if((0,o.d4)((()=>{t&&(0,ht.w)(n)}),[t,n]),!t&&n)return o.ZP.createElement("div",{className:"unread-count active"},(0,ut.bi)(n))}));var pt=n(23989),ft=n(53455),It=n(60706),vt=n(73541),wt=n(2255),yt=n(59107),Pt=n(27370),Zt=n(706);let Ct;function bt(e,t,n,s,a,i){let r,c,d;return r=function(){const[e,t]=(0,o.eJ)(window.navigator.onLine);return(0,o.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?n?Ct.syncing:Ct.online:Ct.waitingForNetwork,c=r===Ct.online||i?"none":s?"middleHeader":a?"minimized":"overlay",r===Ct.waitingForNetwork?d=e("WaitingForNetwork"):r===Ct.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(Ct||(Ct={}));var Et=n(36046),St=n(53106),Mt=n(58964),Rt=n(231),kt=n(69589),Nt=n(49187),Tt=n(83321),At=n(40126),Bt=n(49204);const xt=(0,o.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:s}=e;const a=(0,yt.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},o.ZP.createElement(Bt.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(wt.Z,{activeKey:t,name:"slide-fade"},n)),o.ZP.createElement(Rt.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon-close"})))})),Lt=(0,o.X$)((0,s.c$)((e=>{const{query:t,fetchingStatus:n,chatId:s,date:a}=e.globalSearch,{currentUserId:o,connectionState:i,isSyncing:r}=e,{byId:d}=e.chats,{isConnectionStatusMinimized:l,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:o,chatsById:d,globalSearchChatId:s,searchDate:a,theme:(0,c.Pu)(e),animationLevel:u,connectionState:i,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:l,areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(e.canInstall)}}))((e=>{let{content:t,contactsFilter:n,onSearchQuery:i,onSelectSettings:r,onSelectContacts:c,onSelectArchived:d,onReset:u,searchQuery:g,isLoading:p,shouldSkipTransition:f,currentUserId:I,globalSearchChatId:v,searchDate:w,theme:y,animationLevel:P,chatsById:Z,connectionState:C,isSyncing:b,isMessageListOpen:E,isConnectionStatusMinimized:S,areChatsLoaded:M,hasPasscode:R,canInstall:k}=e;const{openChat:N,setGlobalSearchDate:T,setSettingOption:A,setGlobalSearchChatId:B,openChatByUsername:x,lockScreen:L,requestNextSettingsScreen:O,skipLockOnUnload:F}=(0,s.Sv)(),U=(0,yt.Z)(),j=t===m.du.ChatList,D=(0,o.Ye)((()=>w?(0,z.xH)(new Date(1e3*w)):void 0),[w]),q=(0,o.Ye)((()=>j&&Z?Object.values(Z).reduce(((e,t)=>(0,l.pE)(t)&&t.unreadCount?e+1:e),0):0),[j,Z]),{connectionStatus:$,connectionStatusText:G,connectionStatusPosition:H}=bt(U,C,b,E,S,!M),V=(0,o.I4)((e=>{e.preventDefault(),e.stopPropagation(),R?L():O(m.MT.PasscodeDisabled)}),[R,L,O]);(0,vt.y)({"Ctrl+Shift+L":V,"Alt+Shift+L":V,"Meta+Shift+L":V,...h.fl&&{"Mod+L":V}});const _=window.location.hostname===a.xH||a.Cg,W=(0,o.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return o.ZP.createElement(Rt.Z,{round:!0,ripple:j&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:j?t:()=>u(),ariaLabel:j?U("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,_e.Z)("animated-menu-icon",!j&&"state-back",f&&"no-animation")}))}),[j,U,u,f]),X=(0,o.I4)((()=>{g||i("")}),[g,i]),J=(0,o.I4)((()=>{A({isConnectionStatusMinimized:!S})}),[S,A]),Y=(0,o.I4)((()=>{N({id:I,shouldReplaceHistory:!0})}),[I,N]),K=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";A({theme:t}),A({shouldUseSystemTheme:!1}),(0,Pt.Z)(t,P===a.zy)}),[P,A,y]),Q=(0,o.I4)((()=>{window.open(a.ul,"_blank","noopener")}),[]),ee=(0,o.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,Zt.W8)(),F()}),[F]),te=(0,o.I4)((()=>{F()}),[F]),ne=(0,o.I4)((()=>{x({username:U("Settings.TipsUsername")})}),[U,x]),se=(0,o.I4)((()=>{L()}),[L]),ae=Boolean(v)||t===m.du.GlobalSearch||t===m.du.Contacts;(0,o.d4)((()=>ae?(0,pt.Z)((()=>u())):void 0),[ae,u]);const oe=t===m.du.Contacts?U("SearchFriends"):U("Search"),ie=a.Tj?`${a.Ji} Beta (master)`:a.eM?"master":a.Ji;return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},o.ZP.createElement(St.Z,{trigger:W,footer:`${a.iC} ${ie}`},o.ZP.createElement(Mt.Z,{icon:"saved-messages",onClick:Y},U("SavedMessages")),o.ZP.createElement(Mt.Z,{icon:"archive",onClick:d},o.ZP.createElement("span",{className:"menu-item-name"},U("ArchivedChats")),q>0&&o.ZP.createElement("div",{className:"archived-badge"},q)),o.ZP.createElement(Mt.Z,{icon:"user",onClick:c},U("Contacts")),o.ZP.createElement(Mt.Z,{icon:"settings",onClick:r},U("Settings")),o.ZP.createElement(Mt.Z,{icon:"darkmode",onClick:K},o.ZP.createElement("span",{className:"menu-item-name"},U("lng_menu_night_mode")),o.ZP.createElement(Tt.Z,{id:"darkmode",label:U("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),o.ZP.createElement(Mt.Z,{icon:"help",onClick:ne},U("TelegramFeatures")),o.ZP.createElement(Mt.Z,{icon:"bug",href:a.mU},"Report Bug"),a.Tj&&o.ZP.createElement(Mt.Z,{icon:"permissions",onClick:Q},"Beta Changelog"),_&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Mt.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:ee},"Switch to K Version"),o.ZP.createElement(Mt.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:te},"Switch to Old Version")),k&&o.ZP.createElement(Mt.Z,{icon:"install",onClick:(0,Et.G)()},"Install App")),o.ZP.createElement(kt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:v||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:oe,autoComplete:"off",canClose:Boolean(v||w),onChange:i,onReset:u,onFocus:X,onSpinnerClick:"minimized"===H?J:void 0},D&&o.ZP.createElement(Nt.Z,{icon:"calendar",title:D,canClose:!0,isMinimized:Boolean(v),className:"search-date",onClick:T,clickArg:{date:void 0}}),v&&o.ZP.createElement(Nt.Z,{chatOrUserId:v,onClick:B,canClose:!0,clickArg:{id:void 0}})),R&&o.ZP.createElement(Rt.Z,{round:!0,ripple:!h.wB,size:"smaller",color:"translucent",ariaLabel:`${U("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:se,className:"passcode-lock"},o.ZP.createElement("i",{className:"icon-lock"})),o.ZP.createElement(At.Z,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},o.ZP.createElement(xt,{connectionStatus:$,connectionStatusText:G,onClick:J}))))})));var Ot=n(64963),Ft=n(46590),Ut=n(93133),jt=n(1080);const Dt=(0,o.X$)((0,s.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,activeChatFolder:s},currentUserId:a,lastSyncTime:o,shouldSkipHistoryAnimations:i}=e;return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:s,currentUserId:a,lastSyncTime:o,shouldSkipHistoryAnimations:i,maxFolders:(0,$.M)(e,"dialogFilters")}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:i,orderedFolderIds:r,activeChatFolder:c,currentUserId:d,lastSyncTime:l,shouldSkipHistoryAnimations:u,maxFolders:m}=e;const{loadChatFolders:g,setActiveChatFolder:p,openChat:f}=(0,s.Sv)(),I=(0,o.sO)(null),v=(0,yt.Z)();(0,o.d4)((()=>{l&&g()}),[l,g]);const w=(0,o.Ye)((()=>({id:a.Nf,title:r?.[0]===a.Nf?v("FilterAllChatsShort"):v("FilterAllChats")})),[r,v]),y=(0,o.Ye)((()=>r?r.map((e=>e===a.Nf?w:i[e]||{})).filter(Boolean):void 0),[i,w,r]),P=y?.findIndex((e=>e.id===a.Nf)),Z=P===c,C=0===c,b=(0,mt.yi)(),E=(0,o.Ye)((()=>{if(y&&y.length)return y.map(((e,t)=>{let{id:n,title:s}=e;const o=n!==a.Nf&&t>m-1;return{id:n,title:s,badgeCount:b[n]?.chatsCount,isBadgeActive:Boolean(b[n]?.notificationsCount),isBlocked:o}}))}),[y,b,m]),S=(0,o.I4)((e=>{p(e,{forceOnHeavyAnimation:!0})}),[p]);(0,o.d4)((()=>{E&&E.length&&c>=E.length&&p(0)}),[c,E,p]),(0,o.d4)((()=>{if(I.current&&h.$b&&E&&E.length)return(0,Ot.sf)(I.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Ot.eM.Left?(p(Math.min(c+1,E.length-1),{forceOnHeavyAnimation:!0}),!0):t===Ot.eM.Right&&(p(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,E,p]);const M=(0,o.sO)();M.current=!C,(0,o.d4)((()=>M.current?(0,pt.Z)((()=>{M.current&&p(0)})):void 0),[c,p]),(0,Ft.Z)({isActive:!C,onBack:()=>p(0,{forceOnHeavyAnimation:!0})}),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&E){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void f({id:d,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>E.length-1)return;p(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[d,E,f,p]);const{shouldRender:R,transitionClassNames:k}=(0,at.Z)(!r,void 0,!0);function N(e){const s=Object.values(i).find((e=>{let{id:t}=e;return t===E[c].id}));return!s||Z?o.ZP.createElement(jt.Z,{folderType:"all",isActive:e,lastSyncTime:l,foldersDispatch:t,onScreenSelect:n}):o.ZP.createElement(jt.Z,{folderType:"folder",folderId:s.id,isActive:e,lastSyncTime:l,onScreenSelect:n,foldersDispatch:t})}const T=E&&E.length>1;return o.ZP.createElement("div",{className:"ChatFolders"},T?o.ZP.createElement(Ut.Z,{tabs:E,activeTab:c,onSwitchTab:S,areFolders:!0}):R?o.ZP.createElement("div",{className:(0,_e.Z)("tabs-placeholder",k)}):void 0,o.ZP.createElement(wt.Z,{ref:I,name:u?"none":v.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:T?E.length:void 0},N))})));var qt=n(34288);const $t=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)})),Gt=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)}));var Ht=n(52328);const Vt=(0,o.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:s,onNewGroup:a}=e;const[i,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{t||r(!1)}),[t]);const c=(0,yt.Z)(),d=(0,_e.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),l=(0,o.I4)((()=>{r(!i)}),[i]),u=(0,o.I4)((()=>{r(!1)}),[]);return o.ZP.createElement("div",{className:d,dir:c.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{round:!0,color:"primary",className:i?"active":"",onClick:l,ariaLabel:c(i?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Ht.Z,{isOpen:i,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},o.ZP.createElement(Mt.Z,{icon:"channel",onClick:s},c("NewChannel")),o.ZP.createElement(Mt.Z,{icon:"group",onClick:a},c("NewGroup")),o.ZP.createElement(Mt.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),_t=Object.keys(m.du).length/2;let zt;const Wt=(0,o.X$)((e=>{let{content:t,searchQuery:n,searchDate:s,contactsFilter:a,shouldSkipTransition:i,foldersDispatch:r,isUpdateAvailable:c,onSearchQuery:d,onContentChange:l,onScreenSelect:u,onReset:g}=e;const[p,f]=(0,o.eJ)(h.$b),{shouldRender:I,transitionClassNames:v}=(0,at.Z)(c),w=(0,o.sO)(!1),y=(0,o.I4)((()=>{t===m.du.ChatList&&(w.current=!0,f(!0))}),[t]),P=(0,o.I4)((()=>{w.current=!1,zt&&(clearTimeout(zt),zt=void 0),zt=window.setTimeout((()=>{w.current||f(!1)}),250)}),[]),Z=(0,o.I4)((()=>{l(m.du.Settings)}),[l]),C=(0,o.I4)((()=>{l(m.du.Contacts)}),[l]),b=(0,o.I4)((()=>{l(m.du.Archived)}),[l]),E=(0,o.I4)((()=>{window.location.reload()}),[]),S=(0,o.I4)((()=>{l(m.du.NewChannelStep1)}),[l]),M=(0,o.I4)((()=>{l(m.du.NewGroupStep1)}),[l]);(0,o.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,yt.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:y,onMouseLeave:h.$b?void 0:P},o.ZP.createElement(Lt,{content:t,contactsFilter:a,onSearchQuery:d,onSelectSettings:Z,onSelectContacts:C,onSelectArchived:b,onReset:g,shouldSkipTransition:i}),o.ZP.createElement(wt.Z,{name:i?"none":"zoom-fade",renderCount:_t,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return o.ZP.createElement(Dt,{onScreenSelect:u,foldersDispatch:r});case m.du.GlobalSearch:return o.ZP.createElement($t,{searchQuery:n,searchDate:s,isActive:e,onReset:g});case m.du.Contacts:return o.ZP.createElement(Gt,{filter:a,isActive:e,onReset:g});default:return}})),I&&o.ZP.createElement(Rt.Z,{fluid:!0,pill:!0,className:(0,_e.Z)("btn-update",v),onClick:E},R("lng_update_telegram")),o.ZP.createElement(Vt,{isShown:p,onNewPrivateChat:C,onNewChannel:S,onNewGroup:M}))})),Xt=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)})),Jt=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)})),Yt=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)}));var Kt;!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"}(Kt||(Kt={}));const Qt=Object.keys(Kt).length/2,en=(0,o.X$)((0,s.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:s},shouldSkipHistoryAnimations:a,leftColumnWidth:o,currentUserId:i,passcode:{hasPasscode:r},settings:{nextScreen:d},isUpdateAvailable:l}=e;return{searchQuery:t,searchDate:n,isFirstChatFolderActive:0===s,shouldSkipHistoryAnimations:a,leftColumnWidth:o,currentUserId:i,hasPasscode:r,nextSettingsScreen:d,isChatOpen:Boolean((0,c.jr)(e)?.id),isUpdateAvailable:l}}))((e=>{let{searchQuery:t,searchDate:n,isFirstChatFolderActive:a,shouldSkipHistoryAnimations:i,leftColumnWidth:r,currentUserId:c,hasPasscode:d,nextSettingsScreen:l,isChatOpen:u,isUpdateAvailable:g}=e;const{setGlobalSearchQuery:p,setGlobalSearchChatId:f,resetChatCreation:I,setGlobalSearchDate:v,loadPasswordInfo:w,clearTwoFaError:y,setLeftColumnWidth:P,resetLeftColumnWidth:Z,openChat:C,requestNextSettingsScreen:b}=(0,s.Sv)(),E=(0,o.sO)(null),[S,M]=(0,o.eJ)(m.du.ChatList),[R,k]=(0,o.eJ)(m.MT.Main),[N,T]=(0,o.eJ)(""),[A,B]=(0,ft.ZP)(),[x,L]=(0,o.eJ)(0);let O=Kt.Main;switch(S){case m.du.Archived:O=Kt.Archived;break;case m.du.Settings:O=Kt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:O=Kt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:O=Kt.NewGroup}const F=(0,o.I4)((e=>{function t(){M(m.du.ChatList),T(""),p({query:""}),v({date:void 0}),f({id:void 0}),I(),setTimeout((()=>{L(Date.now())}),250)}if(!0!==e)if(S!==m.du.NewGroupStep2)if(S!==m.du.NewChannelStep2){if(S===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(S===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(d?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled);case m.MT.PasscodeChangePasscodeCurrent:case m.MT.PasscodeTurnOff:return void k(m.MT.PasscodeEnabled);case m.MT.PasscodeNewPasscodeConfirm:return void k(m.MT.PasscodeNewPasscode);case m.MT.PasscodeChangePasscodeNew:return void k(m.MT.PasscodeChangePasscodeCurrent);case m.MT.PasscodeChangePasscodeConfirm:return void k(m.MT.PasscodeChangePasscodeNew);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void k(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void k(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void k(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void k(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void k(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void k(m.MT.PrivacyForwarding);case m.MT.PrivacyVoiceMessagesAllowedContacts:case m.MT.PrivacyVoiceMessagesDeniedContacts:return void k(m.MT.PrivacyVoiceMessages);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void k(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void k(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void k(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void k(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void k(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void k(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void k(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void k(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void k(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void k(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void k(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void k(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void k(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void k(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return M(m.du.ChatList),void k(m.MT.Main);case m.MT.QuickReaction:case m.MT.CustomEmoji:return void k(m.MT.Stickers)}S===m.du.ChatList&&a?M(m.du.GlobalSearch):t()}else M(m.du.NewChannelStep1);else M(m.du.NewGroupStep1);else t()}),[S,a,R,p,v,f,I,d]),U=(0,o.I4)((e=>{S!==m.du.Contacts?(M(m.du.GlobalSearch),e!==t&&p({query:e})):T(e)}),[S,t,p]);(0,o.d4)((()=>S!==m.du.ChatList||a&&!u?(0,pt.Z)((()=>F())):void 0),[a,S,F,u]);const j=(0,o.I4)((e=>{S!==m.du.GlobalSearch&&(e.preventDefault(),M(m.du.GlobalSearch))}),[S]),D=(0,o.I4)((e=>{e.preventDefault(),C({id:c,shouldReplaceHistory:!0})}),[c,C]),q=(0,o.I4)((e=>{e.preventDefault(),M(m.du.Settings)}),[]);(0,vt.y)({"Mod+Shift+F":j,"Mod+Shift+S":D,"Mod+0":D,...h.jm&&h.fl&&{"Mod+,":q}}),(0,o.d4)((()=>{y(),R===m.MT.Privacy&&w()}),[y,w,R]),(0,Ke.Z)((()=>{l&&(M(m.du.Settings),k(l),b(void 0))}),[l,b]);const{initResize:$,resetResize:G,handleMouseUp:H}=function(e,t,n,s){const[a,i,r]=(0,It.Z)(),[c,d]=(0,o.eJ)(),[l,u]=(0,o.eJ)();function m(){document.body.classList.remove("cursor-ew-resize")}return(0,o.bt)((()=>{e.current&&s&&(e.current.style.width=`${s}px`)}),[e,s]),(0,o.d4)((()=>{if(!a)return;const n=t=>{const n=Math.ceil(l+t.clientX-c);e.current.style.width=`${n}px`};function s(){o(),t(e.current.offsetWidth)}function o(){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),o}),[l,c,e,t,a,r]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),d(t.clientX),u(e.current.offsetWidth),i()},resetResize:function(t){t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}}(E,P,Z,r),V=(0,o.I4)((e=>{M(m.du.Settings),k(e)}),[]);return o.ZP.createElement("div",{id:"LeftColumn",ref:E},o.ZP.createElement(wt.Z,{name:i?"none":h.s0,renderCount:Qt,activeKey:O,shouldCleanup:!0,cleanupExceptionKey:Kt.Main},(e=>{switch(O){case Kt.Archived:return o.ZP.createElement(Yt,{isActive:e,onReset:F,onContentChange:M});case Kt.Settings:return o.ZP.createElement(Xt,{isActive:e,currentScreen:R,foldersState:A,foldersDispatch:B,onScreenSelect:V,onReset:F,shouldSkipTransition:i});case Kt.NewChannel:return o.ZP.createElement(Jt,{key:x,isActive:e,isChannel:!0,content:S,onContentChange:M,onReset:F});case Kt.NewGroup:return o.ZP.createElement(Jt,{key:x,isActive:e,content:S,onContentChange:M,onReset:F});default:return o.ZP.createElement(Wt,{content:S,searchQuery:t,searchDate:n,contactsFilter:N,foldersDispatch:B,onContentChange:M,onSearchQuery:U,onScreenSelect:V,onReset:F,shouldSkipTransition:i,isUpdateAvailable:g})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:$,onMouseUp:H,onDoubleClick:G}))})));var tn=n(12420),nn=n(49524),sn=n(71394);var an=n(12255),on=n(52678),rn=n(87204),cn=n(3570),dn=n(75790),ln=n(18360),un=n(6058),mn=n(98799);const hn=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"HeaderMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),gn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,messageListType:o}=t;const r=(0,c.Z1)(e,n),d=Boolean(r&&(0,l.eA)(r));if(!r||r.isRestricted||(0,c.CA)(e))return{noMenu:!0};const u=(0,c.IK)(e,n),m=(0,c.FM)(e,n),g="thread"===o&&s===i._f,p="thread"===o&&s!==i._f,f=(0,c.Jf)(e),I=Boolean(u&&(0,c.s4)(e,u.id)),v=!I&&Boolean((0,c.pk)(e,n)),w=Boolean(g&&(d||(0,l.ZV)(r))&&r.isNotJoined),y=g||p,P=h.Bi&&(0,l.YC)(r.id)&&!m&&!u,Z=g&&!m&&!w,C=g&&!w,b=h.Bi&&r.isCallActive,E=h.Bi&&!r.isCallActive&&(r.adminRights?.manageCall||r.isCreator&&(0,l.G9)(r)),S=r.fullInfo?.canViewStatistics,M=r.fullInfo?.requestsPending;return{noMenu:!1,isChannel:d,isRightColumnShown:f,canStartBot:v,canRestartBot:I,canSubscribe:w,canSearch:y,canCall:P,canMute:Z,canViewStatistics:S,canLeave:C,canEnterVoiceChat:b,canCreateVoiceChat:E,pendingJoinRequests:M,shouldJoinToSend:Boolean(r?.isNotJoined&&r.isJoinToSend),shouldSendJoinRequest:Boolean(r?.isNotJoined&&r.isJoinRequest),noAnimation:e.settings.byKey.animationLevel===a.oB}}))((e=>{let{chatId:t,threadId:n,noMenu:a,isChannel:i,canStartBot:r,canRestartBot:c,canSubscribe:d,canSearch:l,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:I,canCreateVoiceChat:v,pendingJoinRequests:w,isRightColumnShown:y,canExpandActions:P,shouldJoinToSend:Z,shouldSendJoinRequest:C,noAnimation:b}=e;const{joinChannel:E,sendBotCommand:S,openLocalTextSearch:M,restartBot:R,requestCall:k,requestNextManagementScreen:N,showNotification:T}=(0,s.Sv)(),A=(0,o.sO)(null),B=(0,yt.Z)(),[x,L]=(0,o.eJ)(!1),[O,F]=(0,o.eJ)(void 0),U=(0,o.I4)((()=>{L(!0);const e=A.current.getBoundingClientRect();F({x:e.right,y:e.bottom})}),[]),j=(0,o.I4)((()=>{L(!1)}),[]),D=(0,o.I4)((()=>{F(void 0)}),[]),q=(0,o.I4)((()=>{E({chatId:t}),C&&T({message:B(i?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[E,t,C,T,i,B]),$=(0,o.I4)((()=>{S({command:"/start"})}),[S]),G=(0,o.I4)((()=>{R({chatId:t})}),[t,R]),H=(0,o.I4)((()=>{N({screen:m.u1.JoinRequests})}),[N]),V=(0,o.I4)((()=>{M(),h.wB?document.querySelector("#MobileSearch input").focus():b?requestAnimationFrame((()=>{requestAnimationFrame(pn)})):setTimeout(pn,320)}),[b,M]),_=(0,o.I4)((e=>{l&&h.fl&&!e.shiftKey&&(e.preventDefault(),V())}),[l,V]);return(0,vt.y)({"Mod+F":_}),o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,P&&!C&&(d||Z)&&o.ZP.createElement(Rt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:q},B(i?"ProfileJoinChannel":"ProfileJoinGroup")),P&&C&&o.ZP.createElement(Rt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:q},B("ChannelJoinRequest")),P&&r&&o.ZP.createElement(Rt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:$},B("BotStart")),P&&c&&o.ZP.createElement(Rt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:G},B("BotRestart")),l&&o.ZP.createElement(Rt.Z,{round:!0,ripple:y,color:"translucent",size:"smaller",onClick:V,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),u&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",size:"smaller",onClick:function(){k({userId:t})},ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),Boolean(w)&&o.ZP.createElement(Rt.Z,{round:!0,className:"badge-button",ripple:y,color:"translucent",size:"smaller",onClick:H,ariaLabel:B(i?"SubscribeRequests":"MemberRequests")},o.ZP.createElement("i",{className:"icon-user"}),o.ZP.createElement("div",{className:"badge"},w)),o.ZP.createElement(Rt.Z,{ref:A,className:x?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:U},o.ZP.createElement("i",{className:"icon-more"})),O&&o.ZP.createElement(hn,{chatId:t,threadId:n,isOpen:x,anchor:O,withExtraActions:h.wB||!P,isChannel:i,canStartBot:r,canRestartBot:c,canSubscribe:d,canSearch:l,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:I,canCreateVoiceChat:v,onSubscribeChannel:q,onSearchClick:V,onClose:j,onCloseAnimationEnd:D}))})));function pn(){document.querySelector(".RightHeader .SearchInput input")?.focus()}var fn=n(6202),In=n(2903),vn=n(68512),wn=n(17551);function yn(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 Pn=(0,o.X$)((e=>{let{count:t,index:n}=e;const s=(0,o.sO)(null),a=(0,o.Ye)((()=>function(e,t){const n=e-t-1,s=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),a=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),i=`clipPath${e}`,r=function(e,t,n){let s="";if(3===n)s=yn(0,0,2,t,1)+yn(0,12,2,t+1,1)+yn(0,25,2,t,1);else for(let e=0;e<n;e++)s+=yn(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(i,s,e),c=function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,s,e),d=function(e,t,n,s){return t<=4||e<=1?0:e>=t-2?s-36:(n+4)/2+(e-2)*(n+2)}(n,e,s,o);return{markHeight:a,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:o,clipPathId:i}}(t,n)),[t,n]);if((0,o.d4)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:o,clipPathId:i,clipPath:r}=a,c=s.current.firstElementChild;if(s?.current){const a=s.current,{style:d}=a;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${n}px`,u.style.transform=`translateY(${o}px)`)}}),[a]),1===t)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:s}));const{trackHeight:i,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=a;return o.ZP.createElement("div",{className:(0,_e.Z)("pinned-message-border",t>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:s,style:`clip-path: url("#${l}"); width: 2px;\n height: ${i}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${c}px; transform: translateY(${d}px);`})))}));var Zn=n(45370);const Cn=(0,o.X$)((e=>{let{message:t,count:n,index:a,customTitle:i,className:r,onUnpinMessage:c,onClick:d,onAllPinnedClick:u}=e;const{clickBotInlineButton:m}=(0,s.Sv)(),g=(0,yt.Z)(),p=(0,In.Z)(t),f=(0,fn.Z)((0,l.Ti)(t,"pictogram")),[I,v,w]=(0,It.Z)(),y=(0,o.I4)((()=>{w(),c&&c(t.id)}),[w,c,t.id]),P=(0,l.eH)(t),Z=(0,o.I4)((()=>{P&&m({messageId:t.id,button:P})}),[m,P,t.id]),[C,b,E]=(0,It.Z)();return o.ZP.createElement("div",{className:(0,_e.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&o.ZP.createElement(Rt.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:u},o.ZP.createElement("i",{className:"icon-pin-list"})),c&&o.ZP.createElement(Rt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:v},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(wn.Z,{isOpen:I,onClose:w,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:y}),o.ZP.createElement("div",{className:(0,_e.Z)("HeaderPinnedMessage",C&&"no-hover"),onClick:d,dir:g.isRtl?"rtl":void 0},o.ZP.createElement(Pn,{count:n,index:a}),p&&function(e,t){const{width:n,height:s}=(0,ye.W7)();return o.ZP.createElement("img",{src:t||e,width:n,height:s,alt:""})}(p,f),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},i||`${g("PinnedMessage")} ${a>0?"#"+(n-a):""}`),o.ZP.createElement("p",{dir:"auto"},o.ZP.createElement(Zn.Z,{lang:g,message:t,noEmoji:Boolean(p)})),o.ZP.createElement(vn.Z,null)),P&&o.ZP.createElement(Rt.Z,{size:"tiny",className:"inline-button",onClick:Z,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:b,onMouseLeave:h.$b?void 0:E},P.text)))}));var bn=n(10396),En=n(64532),Sn=n(32340),Mn=n(23186),Rn=n(75851);const kn=240;function Nn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,a=new Image;return new Promise((o=>{a.onload=()=>{Tn(a,a.width*t,a.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},a.src=s}))}async function Tn(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return An(e,t,n,void 0,s);try{const a=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(a.height!==n||a.width!==t)throw new Error("Image bitmap resize not supported!");const o=await(0,Rn.ix)(e.src),i=(0,Rn.rZ)(o)<kn?"#fff":"#000";return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const n=t.getContext("2d");n.fillStyle=i,n.fillRect(0,0,t.width,t.height);const o=t.getContext("bitmaprenderer");o?o.transferFromImageBitmap(a):n.drawImage(a,0,0),t.toBlob(e,s)}))}catch(a){return An(e,t,n,void 0,s)}}async function An(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"image/png";const o=document.createElement("canvas"),i=o.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(o.width=t,o.height=n,e.width*s>t){const n=1/s;let a={width:Math.floor(e.width*s),height:Math.floor(e.height*s)};for(r.width=a.width,r.height=a.height,c.drawImage(e,0,0,a.width,a.height);a.width*s>t;)a={width:Math.floor(a.width*s),height:Math.floor(a.height*s)},c.drawImage(r,0,0,a.width*n,a.height*n,0,0,a.width,a.height);i.drawImage(r,0,0,a.width,a.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);const d=await(0,Rn.ix)(e.src),l=(0,Rn.rZ)(d)<kn?"#fff":"#000";return i.fillStyle=l,i.globalCompositeOperation="destination-over",i.fillRect(0,0,o.width,o.height),new Promise((e=>{o.toBlob(e,a)}))}var Bn=n(77510);const xn=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Ln={width:200,height:200},On=115;var Fn=n(17240),Un=n(18051);const jn={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8};function Dn(e,t,n){return o.ZP.createElement(Mt.Z,{onClick:()=>n(e),icon:t===jn[e]?"check":void 0,customIcon:t!==jn[e]?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0},e,"X")}const qn=(0,s.c$)(((e,t)=>{let{message:n}=t;const s=(0,c.Ur)(e,n),a=(0,c.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r}=e.audioPlayer;return{sender:s,chat:a,volume:o,playbackRate:i,isMuted:r}}))((e=>{let{message:t,className:n,noUi:i,sender:r,chat:c,volume:d,playbackRate:u,isMuted:m}=e;const{setAudioPlayerVolume:g,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:I,closeAudioPlayer:v}=(0,s.Sv)(),w=(0,o.sO)(null),y=(0,yt.Z)(),{audio:P,voice:Z,video:C}=(0,l.qp)(t),b=Boolean(Z||C),E=b||(P?.duration||0)>a.J0,S=r?(0,l.OU)(y,r):void 0,M=ve.UV((0,l.Ti)(t,"inline")),R=((e,t,n)=>{const s=(0,yt.Z)(),{audio:a,voice:i}=(0,l.qp)(e),r=a?a.title||a.fileName:i?"Voice message":"",c=a?.performer||t&&(0,l.OU)(s,t),d=n&&(0,l.U)(s,n)||"Telegram",u=a&&(0,l.MR)(a)&&(0,l.Ti)(e,"pictogram"),m=t&&(0,l.RT)(t,"big"),h=a&&u||i&&m,g=(0,fn.Z)(h),p=(0,o.Ye)((()=>function(e,t,n){if(!n)return Ln;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?ye.vY:void 0}(a,i,g)),[a,g,i]),{result:f}=(0,Bn.Z)((()=>function(e,t){if(!e)return Promise.resolve(xn);if(!t)return function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{Tn(o,t,n,s).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},o.src=a}))}(e,On,On);const n=Math.min(t.width,t.height);return n<On?Nn(e,On/n):Promise.resolve(e)}(g,p)),[g,p],xn);return(0,o.Ye)((()=>(0,En.Of)({title:r,artist:c,album:d,artwork:[{src:f}]})),[d,c,r,f])})(t,r,c),{playPause:k,stop:N,isPlaying:T,requestNextTrack:A,requestPreviousTrack:B,isFirst:x,isLast:L,setVolume:O,toggleMuted:F,setPlaybackRate:U}=(0,Mn.Z)((0,bn.An)(t),(0,l.XV)(t),b?"voice":"audio",M,void 0,R,void 0,!0,void 0,void 0,(0,l.CI)(t),!0),j=b&&T;(0,o.d4)((()=>{if(j)return Se.Z.disableRefresh(),()=>{Se.Z.enableRefresh()}}),[j]);const{isContextMenuOpen:D,handleBeforeContextMenu:q,handleContextMenu:$,handleContextMenuClose:G,handleContextMenuHide:H}=(0,Fn.Z)(w),V=(0,o.I4)((()=>{I({chatId:t.chatId,messageId:t.id})}),[I,t.chatId,t.id]),_=(0,o.I4)((()=>{T&&k(),v(),(0,En.Ay)(),N()}),[v,T,k,N]),z=(0,o.I4)((e=>{g({volume:e/100}),O(e/100)}),[g,O]),W=(0,o.I4)((()=>{h.$b&&!h.cj||(F(),f({isMuted:!m}))}),[m,f,F]),X=(0,o.I4)((e=>{const t=jn[e];p({playbackRate:t}),U(t)}),[p,U]),J=(0,o.I4)((()=>{D||X(1===u?2:1)}),[D,u,X]),Y=(0,o.I4)((()=>{const e=Object.entries(jn).find((e=>{let[,t]=e;return t===u}))?.[0]||1;return o.ZP.createElement(Rt.Z,{round:!0,className:(0,_e.Z)("playback-button",1!==u&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:J,onMouseDown:q,onContextMenu:$},o.ZP.createElement("span",{className:"playback-button-inner"},1===u?2:e,"Х"))}),[q,$,J,u]),K=(0,o.Ye)((()=>0===d||m?"icon-muted":d<.3?"icon-volume-1":d<.6?"icon-volume-2":"icon-volume-3"),[d,m]);if(!i)return o.ZP.createElement("div",{className:(0,_e.Z)("AudioPlayer",n),dir:y.isRtl?"rtl":void 0,ref:w},o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:V},P?function(e){const{title:t,performer:n,fileName:s}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,Sn.Z)(t||s)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Sn.Z)(n)))}(P):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Sn.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(y("AttachAudio"),S),o.ZP.createElement(vn.Z,null)),o.ZP.createElement(Rt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:x(),onClick:B,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(Rt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,_e.Z)("toggle-play","player-button",T?"pause":"play"),onClick:k,ariaLabel:T?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(Rt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:L(),onClick:A,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement(Rt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},o.ZP.createElement("i",{className:K,onClick:W}),!h.cj&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"volume-slider-spacer"}),o.ZP.createElement("div",{className:"volume-slider"},o.ZP.createElement(Un.Z,{bold:!0,value:m?0:100*d,onChange:z})))),E&&o.ZP.createElement(St.Z,{forceOpen:D,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Y,onClose:G,onHide:H},Dn(.5,u,X),Dn(.75,u,X),Dn(1,u,X),Dn(1.5,u,X),Dn(2,u,X)),o.ZP.createElement(Rt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:_,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var $n=n(70172);const Gn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),a=(0,He.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!==a?.id,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{chatId:t,isActive:n,groupCall:a,hasPinnedOffset:i,usersById:r,chatsById:c,animationLevel:d}=e;const{joinGroupCall:l,subscribeToGroupCallUpdates:u}=(0,s.Sv)(),m=(0,yt.Z)(),h=(0,o.I4)((()=>{l({chatId:t})}),[l,t]),g=a?.participants,p=(0,o.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,o.d4)((()=>{if(a?.id&&(n||!a.isLoaded))return u({id:a.id,subscribed:!0}),()=>{u({id:a.id,subscribed:!1})}}),[a?.id,a?.isLoaded,n,u]),a)return o.ZP.createElement("div",{className:(0,_e.Z)("GroupCallTopPane",i&&"has-pinned-offset",!n&&"is-hidden"),onClick:h},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},m("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},m("Participants",a.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},p.map((e=>{if(e)return e.user?o.ZP.createElement($n.Z,{key:e.user.id,user:e.user,animationLevel:d}):o.ZP.createElement($n.Z,{key:e.chat.id,chat:e.chat,animationLevel:d})}))),o.ZP.createElement(Rt.Z,{round:!0,className:"join"},m("VoipChatJoin")))})));var Hn=n(14605);const Vn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,c.Z1)(e,n),user:(0,l.YC)(n)?(0,c.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:a,user:i,settings:r,currentUserId:c}=e;const{openAddContactDialog:d,blockContact:u,reportSpam:m,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:I,hideChatReportPanel:v}=(0,s.Sv)(),w=(0,yt.Z)(),[y,P,Z]=(0,It.Z)(),[C,b]=(0,o.eJ)(!0),[E,S]=(0,o.eJ)(!0),{accessHash:M}=a||{},{isAutoArchived:R,canReportSpam:k,canAddContact:N,canBlockContact:T}=r||{},A=a&&(0,l.G9)(a),B=(0,o.I4)((()=>{d({userId:t}),R&&I({chatId:t})}),[d,R,I,t]),x=(0,o.I4)((()=>{Z(),u({contactId:t,accessHash:M}),k&&C&&m({chatId:t}),E&&h({chatId:t})}),[M,u,Z,h,m,k,E,C,t]),L=(0,o.I4)((()=>{v({chatId:t})}),[t,v]),O=(0,o.I4)((()=>{Z(),m({chatId:t}),A?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,Z,c,p,f,A,g,m]);if(r)return o.ZP.createElement("div",{className:(0,_e.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},N&&o.ZP.createElement(Rt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},w("lng_new_contact_add")),T&&o.ZP.createElement(Rt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_new_contact_block")),k&&!T&&o.ZP.createElement(Rt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_report_spam_and_leave")),o.ZP.createElement(Rt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(wn.Z,{isOpen:y,onClose:Z,title:w("BlockUserTitle",i?(0,l.Vl)(i):(0,l.U)(w,a)),text:i?w("UserInfo.BlockConfirmationTitle",(0,l.Js)(i)):w("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:i?x:O},i&&o.ZP.createElement(Hn.Z,{label:w("DeleteThisChat"),checked:E,onCheck:S}),i&&k&&o.ZP.createElement(Hn.Z,{label:w("ReportChat"),checked:C,onCheck:b})))}))),_n=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,messageListType:a}=t;const{isLeftColumnShown:o,lastSyncTime:r,shouldSkipHistoryAnimations:d}=e,u=(0,c.Z1)(e,n),{typingStatus:m}=u||{},{chatId:h,messageId:g}=e.audioPlayer,p=h&&g?(0,c.hj)(e,h,g):void 0;let f;"pinned"===a?f=(0,c.KB)(e,n)?.length:"scheduled"===a?f=(0,c.qy)(e,n)?.length:"thread"===a&&s!==i._f&&(f=(0,c.tZ)(e,n,s)?.messagesCount||0);const I="thread"===a&&s===i._f,v=u&&(0,c.xo)(e,u),w=Boolean(v&&(0,c.s4)(e,n)),y=v&&!w&&Boolean((0,c.pk)(e,n)),P=Boolean(I&&u&&((0,l.eA)(u)||(0,l.ZV)(u))&&u.isNotJoined),Z=Boolean(u?.isNotJoined&&u.isJoinRequest),C={typingStatus:m,isLeftColumnShown:o,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:d,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:y||w||P||Z},b=(0,c.Zw)(e,n);if("thread"!==a||!b)return C;if(Object.assign(C,{messagesById:b}),s!==i._f){const t=(0,c.qS)(e,n,s),a=t?(0,c.hj)(e,n,t):void 0,o=a?(0,c.cv)(e,a):void 0;return{...C,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o}}const E=(0,c.KB)(e,n);if(E?.length){const t=b[E[0]],{canUnpin:n}=t&&(0,c._k)(e,t,s)||{};return{...C,pinnedMessageIds:E,canUnpin:n}}return C}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:d,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:w,chat:y,messagesCount:P,isChatWithSelf:Z,lastSyncTime:C,hasButtonInHeader:b,shouldSkipHistoryAnimations:E,currentTransitionKey:S,connectionState:M,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:A,openPreviousChat:B,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,s.Sv)(),F=(0,yt.Z)(),U=(0,o.sO)(!0),[j,D]=(0,o.eJ)(0),q=Array.isArray(d)?d[j]:d,$=u&&q?u[q]:void 0,G=Array.isArray(d)?d.length:d?1:void 0,H=y&&(0,l.U)(F,y).length,V=g?(0,l.OU)(F,g):void 0,{settings:_}=y||{};(0,o.d4)((()=>{n===i._f&&C&&c&&x({chatId:t})}),[t,x,C,n,c]),(0,o.d4)((()=>{D(0)}),[d]),(0,dn.Z)(t,q,$);const{width:z}=(0,an.Z)(),W=z<=a.ks,X=h.p7&&I,J=(0,o.sO)(null),Y=(0,o.sO)(!0),K=(0,o.I4)((()=>{k({id:t})}),[k,t]),Q=(0,o.I4)((e=>{N({chatId:t,messageId:e,isUnpin:!0})}),[N,t]),ee=(0,o.I4)((()=>{if($){T({chatId:$.chatId,threadId:n,messageId:$.id});const e=(0,cn.Z)(G||1,j+1);D(e)}}),[$,T,n,G,j]),te=(0,o.I4)((()=>{A({id:t,threadId:i._f,type:"pinned"})}),[A,t]),ne=(0,o.I4)((()=>{setTimeout((()=>{U.current=!0}),450)}),[]),se=(0,o.I4)((e=>{if(U.current){if(U.current=!1,h.wB&&document.querySelector(a.Ed)?.blur(),f)return O(),void ne();if(n===i._f&&"thread"===r&&0===S)return h.wB||X?(e.stopPropagation(),A({id:void 0},{forceOnHeavyAnimation:!0})):L(),void ne();B(),ne()}}),[n,r,S,f,B,X,A,L,O,ne]),ae=z>=a.ks&&z<a.jT||z>a.l3&&z<a.ks&&(!H||H>30),oe=ae||z>a._m&&z<a.QU,ie=Boolean(_?.canAddContact||_?.canBlockContact||_?.canReportSpam),{shouldRender:re,transitionClassNames:ce}=(0,at.Z)(ie),de=(0,ln.Z)(ie?_:void 0,!0),{shouldRender:le,transitionClassNames:ue}=(0,at.Z)(Boolean(w)),me=(0,ln.Z)(w,!0),{shouldRender:he,transitionClassNames:ge}=(0,at.Z)(Boolean($)),pe=(0,ln.Z)($,!0),fe=(0,ln.Z)(G,!0),Ie=(0,ln.Z)(m,!0),ve=(0,ln.Z)(V),we=(0,rn.Z)(S),ye=void 0!==we&&we<S?we:void 0,Pe=he&&pe||le&&me;(0,o.d4)((()=>{const e=J.current;if(e)return oe&&Pe?void(v||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))}),[oe,Pe,ae,v]);const{connectionStatusText:Ze}=bt(F,M,R,!0);function Ce(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(Rt.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:F(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,_e.Z)("animated-close-icon",!e&&"state-back")})),t&&o.ZP.createElement(gt,null))}const be=Boolean(le&&me),Ee=be||!h.wB&&b&&z<a.sg;return o.ZP.createElement("div",{className:"MiddleHeader",ref:J},o.ZP.createElement(wt.Z,{name:E?"none":"slide-fade",activeKey:S,shouldCleanup:!0,cleanupExceptionKey:ye},"thread"===r&&n===i._f?o.ZP.createElement(o.ZP.Fragment,null,(W||S>0)&&Ce(X,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:K},(0,l.YC)(t)?o.ZP.createElement(un.Z,{key:t,userId:t,typingStatus:p,status:Ze,withDots:Boolean(Ze),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:c,emojiStatusSize:22,noRtl:!0}):o.ZP.createElement(mn.Z,{key:t,chatId:t,typingStatus:p,status:Ze,withDots:Boolean(Ze),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0}))):"thread"===r?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,F("CommentsCount",P,"i"))):"pinned"===r?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,F("PinnedMessagesCount",P,"i"))):"scheduled"===r?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,Z?F("Reminders"):F("messages",P,"i"))):void 0),o.ZP.createElement(Gn,{hasPinnedOffset:he&&Boolean(pe)||le&&Boolean(me),chatId:t}),he&&pe&&o.ZP.createElement(Cn,{key:t,message:pe,count:fe||0,index:j,customTitle:ve,className:(0,_e.Z)(ge,Ee&&"full-width"),onUnpinMessage:Ie?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&o.ZP.createElement(Vn,{key:t,chatId:t,settings:de,className:ce}),o.ZP.createElement("div",{className:"header-tools"},be&&o.ZP.createElement(qn,{key:(0,l.Tp)(me),message:me,className:ue}),o.ZP.createElement(gn,{chatId:t,threadId:n,messageListType:r,canExpandActions:!be})))})));function zn(e){return"albumId"in e}function Wn(e,t){let n,s=[],a={originalDate:e[0].date,datetime:(0,z._F)(1e3*e[0].date),senderGroups:[s]};const o=[a];return e.forEach(((i,r)=>{i.isInAlbum?n?(n.messages.push(i),i.content.text&&(n.mainMessage=i)):n={albumId:i.groupedId,messages:[i],mainMessage:i}:s.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(s.push(n),n=void 0),c){const e=(0,z._F)(1e3*c.date);a.datetime!==e?(a={originalDate:c.date,datetime:e,senderGroups:[]},o.push(a),s=[],a.senderGroups.push(s)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,l.FT)(i)||(0,l.FT)(c)||i.forwardInfo&&c.forwardInfo&&(i.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||i.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||i.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||i.inlineButtons||c.inlineButtons||c.date-i.date>600)&&(s=[],a.senderGroups.push(s))}})),o}var Xn=n(30386),Jn=n(87675),Yn=n(60539),Kn=n(88957);var Qn=n(60998);var es=n(72645),ts=n(78722),ns=n(3657);const ss=h.wZ?1e3:350,as=h.wB?300:500;function os(e,t){return e?t?238:175:t?238:100}function is(e,t,n){const s=(0,l.B4)(e),a=(0,l.O$)(e)||(0,l.F$)(e),o=(0,l.b7)(e),i=Boolean((0,l.F$)(e)),r=Boolean((0,l.Cg)(e)),{width:c,height:d}=a?(0,ye.Eh)(a,s,t,i,n):(0,ye.GC)(o,s,t,r,n),u=os(Boolean((0,l.UD)(e)));let m=1;c<u&&u-c<12&&(m=u/c),d*m<90&&90-d*m<12&&(m=90/d);const h=Math.round(c*m),g=Math.round(d*m);return{width:h,height:g,isSmall:h<u||g<90}}var rs=n(28712);function cs(e,t){return e.reduce(((e,t)=>e+t),t)}function ds(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:s}=e;2&s&&(t.width=n.width+n.x),4&s&&(t.height=n.height+n.y)})),t}function ls(e,t,n,s){const a=function(e){return e.map((e=>{const t=is(e);return t.width/t.height}))}(s.messages),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(a),i=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(a),r=a.length,c=a.some((e=>e>2)),d=(0,ye.kc)(e,t,!1,n)-(t?2.5:0)*ye.Gw;let l;const u={ratios:a,proportions:o,averageRatio:i,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return l=r>=5||c?function(e){let{ratios:t,averageRatio:n,maxWidth:s,minWidth:a,spacing:o,maxHeight:i=4*s/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,rs.uZ)(e,1,2.75):(0,rs.uZ)(e,.6667,1)))}(t,n),c=t.length,d=new Array(c),l=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=cs(r.slice(e,e+t),0);return(s-(t-1)*o)/n})(n,e)),n+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const s=c-e-t;e<=3&&t<=(n<.85?4:3)&&s<=3&&u([e,t,s])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let n=1;n!==c-e-t;++n){const s=c-e-t-n;e<=3&&t<=3&&n<=3&&s<=4&&u([e,t,n,s])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:n}=l[e],s=n.length,r=cs(t,0)+o*(s-1),c=Math.min(...t)<a?1.5:1,d=(()=>{for(let e=1;e!==s;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-i)*c*d;(!m||u<h)&&(m=l[e],h=u)}const g=m.lineCounts,p=m.heights,f=g.length;let I=0,v=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],a=Math.round(n);let i=0;for(let c=0;c!==t;++c){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[I],m=c===t-1?s-i:Math.round(u*n);d[I]={dimensions:{x:i,y:v,width:m,height:a},sides:l},i+=m+o,++I}v+=a+o}return d}(u):2===r?function(e){const{ratios:t,proportions:n,averageRatio:s}=e;return"ww"===n&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(a-s)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:11},{dimensions:{x:0,y:o+s,width:n,height:o},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,o=(n-s)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],a)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:13},{dimensions:{x:o+s,y:0,width:o,height:i},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:s,spacing:a,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(s-a),(s-a)/t[0]/(1/t[0]+1/t[1]))),s-a-i),c=s-r-a,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+a,y:0,width:r,height:d},sides:7}]}(e)}(u):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:s,maxWidth:a,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,s[1]*(a-n)/(s[2]+s[1]))),c=i-r-n,d=Math.max(o,Math.round(Math.min((a-n)/2,Math.min(r*s[2],c*s[1])))),l=Math.min(Math.round(i*s[0]),a-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:s,spacing:a}=e,o=t,i=Math.round(Math.min(o/n[0],.66*(s-a))),r=(t-a)/2,c=Math.min(s-i-a,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+a,width:r,height:c},sides:12},{dimensions:{x:r+a,y:i+a,width:o-r-a,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:s,maxHeight:a,minWidth:o}=e;const i=t,r=Math.round(Math.min(i/n[0],.66*(a-s))),c=Math.round((t-2*s)/(n[1]+n[2]+n[3])),d=Math.max(o,Math.round(Math.min(.4*(t-2*s),c*n[1]))),l=Math.round(Math.max(Math.max(o,.33*(t-2*s)),c*n[3])),u=i-d-l-2*s,m=Math.min(a-r-s,c);return[{dimensions:{x:0,y:0,width:i,height:r},sides:11},{dimensions:{x:0,y:r+s,width:d,height:m},sides:12},{dimensions:{x:d+s,y:r+s,width:u,height:m},sides:4},{dimensions:{x:d+s+u+s,y:r+s,width:l,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:s,spacing:a,minWidth:o}=e;const i=t,r=Math.round(Math.min(i*n[0],.6*(s-a))),c=Math.round((t-2*a)/(1/n[1]+1/n[2]+1/n[3])),d=Math.round(c/n[1]),l=Math.round(c/n[2]),u=i-d-l-2*a,m=Math.max(o,Math.min(s-r-a,c));return[{dimensions:{x:0,y:0,width:r,height:i},sides:13},{dimensions:{x:r+a,y:0,width:m,height:d},sides:3},{dimensions:{x:r+a,y:d+a,width:m,height:l},sides:2},{dimensions:{x:r+a,y:d+l+2*a,width:m,height:u},sides:6}]}(e)}(u),{layout:l,containerStyle:ds(l)}}let us,ms;function hs(e){return ms||(ms=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),us||(us=document.createElement("span"),us.style.font=`400 12px ${ms}`,us.style.whiteSpace="nowrap",us.style.position="absolute",us.style.left="-999px",us.style.opacity=".01",document.body.appendChild(us)),us.innerHTML=e,us.offsetWidth}function gs(e,t,n,s,a,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Yn.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s,void 0,i)}}),[e,t,n,s,a,i])}var ps=n(3858);const fs=3*ye.Gw,Is=Number(ye.Gw),vs="data-is-document-group-hover";function ws(e,t,n,a,i,r,c,d,l,u,m,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,s.Sv)(),[w,y,P]=(0,It.Z)(),[Z,C,b]=(0,It.Z)(),E=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,Ot.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===Ot.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&(I({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,I,C,b,r,m]),{handleMouseDown:i?void 0:function(e){(0,Xn.q)(e),l(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return E.current?(clearInterval(E.current),E.current=void 0,void function(e){const{pageX:t,pageY:s}=e;v({chatId:u,messageId:n,x:t,y:s})}(t)):void(E.current=setTimeout((()=>{E.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;Se.Z.getIsKeyboardVisible()?setTimeout((()=>{d(e)}),350):d(e)}}(t)}),200))},handleContextMenu:i?c?ps.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else d(t)},handleDoubleClick:i?void 0:function(){h.$b||I({messageId:n})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:s}=e,{x:a,width:o,y:i,height:r}=t.getBoundingClientRect(),c=Math.abs(p?n-a:a+o-n)<fs,d=Math.abs(i+r-s)<Is;c&&d?y():P()},handleSendQuickReaction:function(e){const{x:t,y:s}=e.currentTarget.getBoundingClientRect();v({chatId:u,messageId:n,x:t,y:s})},handleMouseLeave:function(e){P(),f&&function(e){const t=Ps(e.currentTarget);t&&t.removeAttribute(vs)}(e)},isSwiped:Z,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:ys}}function ys(e){const t=Ps(e.currentTarget);t&&t.setAttribute(vs,"")}function Ps(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Zs=n(55254),Cs=n(44139),bs=n(18005);const Es=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0}));var Ss=n(45601);const Ms=(0,o.X$)((0,s.c$)(((e,t)=>{let{message:n}=t;const{byId:s}=e.users,a=n.senderId,{targetUserIds:o,targetChatId:i}=n.content.action||{},r=n.replyToMessageId,d=r?(0,c.hj)(e,n.chatId,r):void 0,u=(0,c._X)(e,n),{direction:m,noHighlight:h}=u&&e.focusedMessage||{},g=(0,c.Z1)(e,n.chatId),p=g&&((0,l.eA)(g)||a===n.chatId),f=!p&&a?(0,c.dy)(e,a):void 0,I=p?g:void 0,v=e.premiumGifts?.stickers?.[0];return{usersById:s,senderUser:f,senderChat:I,targetChatId:i,targetUserIds:o,targetMessage:d,isFocused:u,premiumGiftSticker:v,...u&&{focusDirection:m,noFocusHighlight:h}}}))((e=>{let{message:t,observeIntersectionForReading:n,observeIntersectionForLoading:a,observeIntersectionForPlaying:i,isEmbedded:r,appearanceOrder:c=0,isLastInList:d,usersById:u,senderUser:m,senderChat:h,targetUserIds:g,targetMessage:p,targetChatId:f,isFocused:I,focusDirection:v,noFocusHighlight:w,premiumGiftSticker:y,memoFirstUnreadIdRef:P}=e;const{openPremiumModal:Z,requestConfetti:C}=(0,s.Sv)(),b=(0,yt.Z)(),E=(0,o.sO)(null);(0,ns._N)(E,n),(0,dn.Z)(t.chatId,t.replyToMessageId,p),gs(E,t.chatId,I,v,w);const S=c<=0,[M,R]=(0,It.Z)(S),k=Boolean(t.content.action?.text.startsWith("ActionGift"));(0,o.d4)((()=>{S||setTimeout(R,10*c)}),[c,R,S]);const N=(0,ns.Op)(E,i),T=(0,o.sO)((()=>{const e=P?.current&&t.id>=P.current;return k&&!t.isOutgoing&&e})());(0,o.d4)((()=>{N&&T.current&&(T.current=!1,C())}),[N,C]);const{transitionClassNames:A}=(0,at.Z)(M,void 0,S,!1),B=(0,o.Ye)((()=>g?g.map((e=>u?.[e])).filter(Boolean):void 0),[g,u]),x=(0,bs.D)(b,t,m,h,B,p,f,{isEmbedded:r},a,i),{isContextMenuOpen:L,contextMenuPosition:O,handleBeforeContextMenu:F,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:D}=(0,Fn.Z)(E),q=void 0!==O;if(r)return o.ZP.createElement("span",{ref:E,className:"embedded-action-message"},x);const $=(0,_e.Z)("ActionMessage message-list-item",I&&!w&&"focused",k&&"premium-gift",q&&"has-menu-open",d&&"last-in-list",A);return o.ZP.createElement("div",{ref:E,id:(0,l.d0)(t.id),className:$,"data-message-id":t.id,onMouseDown:e=>{(0,Xn.q)(e),F(e)},onContextMenu:U},o.ZP.createElement("span",null,x),k&&o.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{Z({isGift:!0,fromUserId:m?.id,toUserId:g?.[0],monthsAmount:t.content.action?.months||0})}},o.ZP.createElement(Ss.Z,{key:t.id,sticker:y,play:!0,noLoop:!0,nonInteractive:!0}),o.ZP.createElement("strong",null,b("ActionGiftPremiumTitle")),o.ZP.createElement("span",null,b("ActionGiftPremiumSubtitle",b("Months",t.content.action?.months,"i"))),o.ZP.createElement("span",{className:"action-message-button"},b("ActionGiftPremiumView"))),O&&o.ZP.createElement(Es,{isOpen:L,anchor:O,message:t,messageListType:"thread",onClose:j,onCloseAnimationEnd:D}))}))),Rs=e=>{let{className:t,message:n,sender:s,title:a,customText:i,isProtected:r,noUserColors:c,hasContextMenu:d,observeIntersectionForLoading:u,observeIntersectionForPlaying:m,onClick:h}=e;const g=(0,o.sO)(null),p=(0,ns.Op)(g,u),f=(0,fn.Z)(n&&(0,l.Ti)(n,"pictogram"),!p),I=(0,In.Z)(n),v=Boolean(n&&(0,l.Y5)(n)),w=(0,yt.Z)(),y=s?(0,l.OU)(w,s):n?.forwardInfo?.hiddenUserName;return o.ZP.createElement("div",{ref:g,className:(0,_e.Z)("EmbeddedMessage",t,s&&!c&&`color-${(0,l.Rs)(s)}`),onClick:n?h:void 0},I&&function(e,t,n,s){const{width:a,height:i}=(0,ye.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{src:t||e,width:a,height:i,alt:"",className:(0,_e.Z)("pictogram",n&&"round"),draggable:!s}),s&&o.ZP.createElement("span",{className:"protector"}))}(I,f,v,r),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},n?(0,l.FT)(n)?o.ZP.createElement(Ms,{message:n,isEmbedded:!0,observeIntersectionForLoading:u,observeIntersectionForPlaying:m}):o.ZP.createElement(Zn.Z,{lang:w,message:n,noEmoji:Boolean(I),observeIntersectionForLoading:u,observeIntersectionForPlaying:m}):i||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Sn.Z)(y||a||" "))),d&&o.ZP.createElement("i",{className:"embedded-more icon-more"}))};var ks=n(82535),Ns=n(54752),Ts=n(8018),As=n(48198),Bs=n(97799);const xs=(0,o.X$)((e=>{let{reaction:t,activeReaction:n,isInMeta:a,availableReactions:i}=e;const{stopActiveReaction:r}=(0,s.Sv)(),c=i?.find((e=>e.reaction===t)),d=c?.centerIcon?.id,l=c?.aroundAnimation?.id,u=d&&`sticker${d}`,m=l&&`sticker${l}`,h=(0,fn.Z)(u,!d),g=(0,fn.Z)(m,!l),p=Boolean(n?.reaction===t&&h&&g),{shouldRender:f,transitionClassNames:I}=(0,at.Z)(p,void 0,!0,"slow"),v=(0,o.I4)((()=>{r({messageId:n?.messageId,reaction:t})}),[n?.messageId,t,r]),[w,y,P]=(0,It.Z)(),Z=!p||!w,C=(0,_e.Z)("ReactionAnimatedEmoji",a&&"in-meta",f&&"is-animating");return o.ZP.createElement("div",{className:C},Z&&o.ZP.createElement(As.Z,{reaction:t}),f&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Bs.Z,{key:d,className:I,size:30,tgsUrl:h,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:y,onEnded:P}),o.ZP.createElement(Bs.Z,{key:l,className:(0,_e.Z)("effect",I),size:100,tgsUrl:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:v})))})),Ls=(0,o.X$)((e=>{let{message:t,outgoingStatus:n,signature:a,onClick:i,withReactions:r,activeReaction:c,withReactionOffset:d,availableReactions:l,reactionMessage:u}=e;const{showNotification:m}=(0,s.Sv)(),h=(0,yt.Z)(),[g,p]=(0,It.Z)(),f=r&&u?.reactions?.results.filter((e=>e.count>0)),I=e=>{e.stopPropagation(),m({message:h("ImportedInfo")})},v=(0,o.Ye)((()=>{if(!g)return;const e=(0,z.SA)(1e3*t.date,h.code),n=t.isEdited&&(0,z.SA)(1e3*t.editDate,h.code),s=t.forwardInfo&&(0,z.SA)(1e3*t.forwardInfo.date,h.code);let a=e;return n&&(a+="\n",a+=h("lng_edited_date").replace("{date}",n)),s&&(a+="\n",a+=h("lng_forwarded_date").replace("{date}",s)),a}),[g,h,t]),w=(0,_e.Z)("MessageMeta",d&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return o.ZP.createElement("span",{className:w,dir:h.isRtl?"rtl":"ltr",onClick:i,"data-ignore-on-paste":!0},f&&f.map((e=>o.ZP.createElement(xs,{activeReaction:c,reaction:e.reaction,isInMeta:!0,availableReactions:l}))),Boolean(t.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,ut.bi)(t.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),a&&o.ZP.createElement("span",{className:"message-signature"},(0,Sn.Z)(a)),o.ZP.createElement("span",{className:"message-time",title:v,onMouseEnter:p},t.forwardInfo?.isImported&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-imported",onClick:I},(0,z.SA)(1e3*t.forwardInfo.date,h.code,!0)),o.ZP.createElement("span",{className:"message-imported",onClick:I},h("ImportedMessage"))),t.isEdited&&`${h("EditedMessage")} `,(0,z.mr)(h,1e3*t.date)),n&&o.ZP.createElement(Ts.Z,{status:n}))}));var Os=n(36765);const Fs=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:r,lastSyncTime:c,shouldPlayEffect:d,onPlayEffect:u,onStopEffect:m}=e;const{showNotification:g,openStickerSet:p}=(0,s.Sv)(),f=(0,yt.Z)(),I=(0,o.sO)(null),v=t.content.sticker,{stickerSetInfo:w,isVideo:y,hasEffect:P}=v,Z=v.isPreloadedGlobally?void 0:(0,l.Ti)(t,y&&!h.Hh?"pictogram":"inline"),C=(0,ns.Op)(I,n),b=(0,ns.Op)(I,a),E=`sticker${v.id}?size=f`,S=(0,fn.Z)(E,!C||!P,i.IU.BlobUrl,c),[M,R,k]=(0,It.Z)(),N=(0,o.I4)((()=>{k(),m?.()}),[m,k]);(0,o.d4)((()=>{P&&b&&d&&(R(),u?.())}),[P,b,u,d,R]);const T=(0,o.I4)((()=>{p({stickerSetInfo:v.stickerSetInfo})}),[p,v]),A=(0,o.I4)((()=>{if(P)return M?void g({message:f("PremiumStickerTooltip"),action:T,actionText:f("ViewAction")}):(R(),void u?.());T()}),[P,M,f,u,T,g,R]),B="isMissing"in w,{width:x,height:L}=(0,ye.Wr)(v),O=(0,_e.Z)("Sticker media-inner",B&&"inactive",P&&!t.isOutgoing&&"reversed");return o.ZP.createElement("div",{ref:I,className:O,style:`width: ${x}px; height: ${L}px;`,onClick:B?void 0:A},o.ZP.createElement(Os.Z,{containerRef:I,sticker:v,fullMediaHash:Z,fullMediaClassName:"full-media",size:x,shouldLoop:r,noLoad:!C,noPlay:!b,withSharedAnimation:!0,cacheBuster:c}),P&&C&&M&&o.ZP.createElement(Bs.Z,{key:E,className:"effect-sticker",tgsUrl:S,size:1.49*x,play:!0,isLowPriority:!0,noLoop:!0,onEnded:N}))};var Us=n(13365),js=n(74753),Ds=n(80036);const qs=7*ye.Gw;function $s(e,t,n,a,i,r,d,l){const{interactWithAnimatedEmoji:u,sendEmojiInteraction:m,sendWatchingEmojiInteraction:h}=(0,s.Sv)(),g=r||d,p=(0,o.sO)(null),f=(0,o.sO)(null),I=(0,fn.Z)(n?`document${n}`:void 0,!n),v=l||qs,w=(0,Ds.Z)(`width: ${v}px`,`height: ${v}px`,(d||r)&&"cursor: pointer"),y=(0,o.sO)(void 0),P=(0,o.sO)(void 0),Z=(0,o.I4)((()=>{p.current&&(m({chatId:e,messageId:t,localEffect:r,emoji:d,interactions:y.current}),P.current=void 0,y.current=void 0)}),[m,e,t,r,d]),C=(0,o.I4)((()=>{const e=f.current;I&&(e&&(e.pause(),e.remove()),f.current=new Audio,f.current.src=I,(0,js.Z)(f.current),f.current.addEventListener("ended",(()=>{f.current=void 0}),{once:!0}))}),[I]),b=(0,o.I4)((()=>{C();const n=p.current;if(!(g&&n&&t&&e))return;const{x:s,y:a}=n.getBoundingClientRect();u({localEffect:r,emoji:d,x:s,y:a,startSize:v,isReversed:!i}),y.current||(y.current=[],P.current=performance.now(),setTimeout(Z,1e3)),y.current.push(P.current?(performance.now()-P.current)/1e3:0)}),[e,d,g,u,i,r,t,C,Z,v]);return(0,o.d4)((()=>{const n=p.current;n&&a&&a.forEach((s=>{let{id:a,startSize:o,messageId:l}=s;if(o||t!==l)return;const{x:u,y:m}=n.getBoundingClientRect();h({id:a,chatId:e,emoticon:r?(0,c.ji)(r):d,startSize:v,x:u,y:m,isReversed:!i}),C()}))}),[a,e,d,i,r,t,C,h,v]),{ref:p,size:v,style:w,handleClick:b}}var Gs=n(21179);const Hs=(0,o.X$)((0,s.c$)(((e,t)=>{let{emoji:n,withEffects:s}=t;const a=(0,c.CP)(e,n);return{sticker:(0,c.zB)(e,n),effect:s?(0,c.tH)(e,n):void 0,soundId:(0,c.Oh)(e,n),localSticker:a,localEffect:a&&s?(0,c.cu)(a):void 0}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:s,forceLoadPreview:a,messageId:i,chatId:r,activeEmojiInteractions:c,sticker:d,effect:l,localSticker:u,localEffect:m,soundId:h}=e;const{ref:g,size:p,style:f,handleClick:I}=$s(r,i,h,c,t,m,l?.emoji),v=(0,ns.Op)(g,n);return u?o.ZP.createElement(Gs.Z,{tgsUrl:Us.l[u],size:p,quality:1,play:v,forceOnHeavyAnimation:!0,ref:g,className:"AnimatedEmoji media-inner",style:f,onClick:I}):o.ZP.createElement(Ss.Z,{sticker:d,size:p,quality:1,noLoad:!v,forcePreview:a,lastSyncTime:s,play:v,forceOnHeavyAnimation:!0,ref:g,className:(0,_e.Z)("AnimatedEmoji media-inner",d?.id===ye.wB&&"like-sticker-thumb"),style:f,onClick:I})})));var Vs=n(34358);const _s=(0,o.X$)((0,s.c$)(((e,t)=>{let{customEmojiId:n,withEffects:s}=t;const a=e.customEmojis.byId[n];return{sticker:a,effect:a?.emoji&&s?(0,c.tH)(e,a.emoji):void 0,soundId:a?.emoji&&(0,c.Oh)(e,a.emoji)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:s,chatId:a,activeEmojiInteractions:i,sticker:r,effect:c,soundId:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:g}=$s(a,s,d,i,t,void 0,c?.emoji,(0,Cs.qo)(1));return o.ZP.createElement(Vs.Z,{ref:u,documentId:n,className:(0,_e.Z)("AnimatedEmoji media-inner",r?.id===ye.wB&&"like-sticker-thumb"),style:h,size:m,isBig:!0,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:l,onClick:g})}))),zs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Ws(e,t,n,s,a){return s?Promise.resolve(zs[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.crossOrigin="anonymous",n.width||await new Promise((e=>{n.onload=e}));const s=document.createElement("canvas"),a=s.getContext("2d");s.width=n.width,s.height=n.height,a.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(a.getImageData(o,i,1,1).data).join(",")})`}(e,t)}var Xs=n(92566),Js=n(15866);function Ys(e,t){return(0,Js.Z)((0,l.DH)(e),Boolean(t),h.wB&&!h.vX)}var Ks=n(70692),Qs=n(39196);const ea=e=>{let{id:t,message:n,observeIntersection:s,noAvatars:i,canAutoLoad:r,isInSelectMode:c,isSelected:d,uploadProgress:u,size:m="inline",dimensions:h,asForwarded:g,nonInteractive:p,shouldAffectAppendix:f,isDownloading:I,isProtected:v,theme:w,onClick:y,onCancelUpload:P}=e;const Z=(0,o.sO)(null),C=((0,l.O$)(n)||(0,l.F$)(n)).blobUrl,b=(0,ns.Op)(Z,s),[E,S]=(0,o.eJ)(r),M=E&&b,{mediaData:R,loadProgress:k}=(0,Xs.Z)((0,l.Ti)(n,m),!M),N=C||R,[T]=(0,o.eJ)(!N),A=Boolean(N),B=Ys(n,A),x=(0,Ks.Z)(!A),{loadProgress:L}=(0,Xs.Z)((0,l.Ti)(n,"download"),!I,(0,l.kG)(n,"download")),{isUploading:O,isTransferring:F,transferProgress:U}=(0,l.Sc)(n,u||(I?L:k),M&&!N),j=!1===(0,rn.Z)(E),{shouldRender:D,transitionClassNames:q}=(0,at.Z)(F,void 0,j,"slow"),{shouldRender:$,transitionClassNames:G}=(0,at.Z)(!N&&!E),H=(0,o.I4)((()=>{O?P&&P(n):N?y&&y(n.id):S((e=>!e))}),[N,O,n,P,y]),V=(0,l.B4)(n);(0,es.Z)((e=>{let[t]=e;if(!f)return void(t&&Z.current.closest(a.be).removeAttribute(a.s2));const n=Z.current.closest(a.be);N?Ws(N,V,0,d,w).then((e=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(a.s2,"")})):n.classList.add("has-appendix-thumb")}),[f,N,V,c,d,w]);const{width:_,height:z,isSmall:W}=h||is(n,g,i),X=(0,_e.Z)("media-inner",!O&&!p&&"interactive",W&&"small-image",_===z&&"square-image"),J=h?` width: ${_}px; left: ${h.x}px; top: ${h.y}px;`:"",Y="inline"===m?`height: ${z}px;${J}`:void 0;return o.ZP.createElement("div",{id:t,ref:Z,className:X,style:Y,onClick:O?void 0:H},o.ZP.createElement("img",{src:N,className:"full-media",alt:"",draggable:!v}),T&&o.ZP.createElement("canvas",{ref:B,className:(0,_e.Z)("thumbnail",x)}),v&&o.ZP.createElement("span",{className:"protector"}),D&&!$&&o.ZP.createElement("div",{className:`media-loading ${q}`},o.ZP.createElement(Qs.Z,{progress:U,onClick:O?H:void 0})),$&&o.ZP.createElement("i",{className:(0,_e.Z)("icon-download",G)}),F&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*U),"%"))};var ta=n(35148);const na=e=>{let{id:t,message:n,observeIntersectionForLoading:a,observeIntersectionForPlaying:i,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:u,lastSyncTime:m,dimensions:h,asForwarded:g,isDownloading:p,isProtected:f,onClick:I,onCancelUpload:v}=e;const w=(0,o.sO)(null),y=(0,o.sO)(null),P=(0,l.b7)(n)||(0,l.Cg)(n),Z=P.blobUrl,C=(0,ns.Op)(w,a),b=(0,ns.Op)(w,i)&&C,E=(0,o.sO)(C);b&&!E.current&&(E.current=!0);const[S,M]=(0,o.eJ)(c),R=Boolean(S&&C&&m),[k,N]=(0,o.eJ)(d),T=(0,l.Ti)(n,"inline"),[A]=(0,o.eJ)(Boolean(T&&ve.UV(T))),{mediaData:B,loadProgress:x}=(0,Xs.Z)(T,!R,(0,l.kG)(n,"inline"),m),L=Z||B,[O,F]=(0,It.Z)(),U=Boolean((0,l.DH)(n)),j=(0,l.Ti)(n,"preview"),[D]=(0,o.eJ)(Boolean(j&&ve.UV(j))),q=C&&m,$=(0,fn.Z)(j,!q,void 0,m),G=(0,Ks.Z)((U||$)&&!O),H=!U||$||O,V=Ys(n,H),_=(0,Ks.Z)(!H),W=L&&E.current,{loadProgress:X}=(0,Xs.Z)((0,l.Ti)(n,"download"),!p,(0,l.kG)(n,"download"),m),{isUploading:J,isTransferring:Y,transferProgress:K}=(0,l.Sc)(n,u||(p?X:x),R&&!O&&!A||p),Q=!1===(0,rn.Z)(S),{shouldRender:ee,transitionClassNames:te}=(0,at.Z)(Y,void 0,Q),{transitionClassNames:ne}=(0,at.Z)(Boolean((S||L)&&!k&&!ee)),[se,ae]=(0,o.eJ)(0),oe=(0,o.I4)((e=>{ae(Math.max(0,e.currentTarget.currentTime-1))}),[]),ie=y.current?.duration||P.duration||0,re=(0,l.B4)(n),ce=Boolean((0,l.Cg)(n)),{width:de,height:le}=h||(0,ye.GC)(P,re,g,ce,r),ue=(0,o.I4)((()=>{J?v&&v(n):p?(0,s.Sv)().cancelMessageMediaDownload({message:n}):L?L&&!k?N(!0):I&&I(n.id):M((e=>!e))}),[J,p,L,k,I,v,n]),me=(0,_e.Z)("media-inner dark",!J&&"interactive"),he=`height: ${le}px;${h?` width: ${de}px; left: ${h.x}px; top: ${h.y}px;`:""}`;return o.ZP.createElement("div",{ref:w,id:t,className:me,style:he,onClick:J?void 0:ue},W&&o.ZP.createElement(ta.Z,{ref:y,src:L,className:"full-media",canPlay:k&&b,muted:!0,loop:!0,playsInline:!0,draggable:!f,onTimeUpdate:oe,onReady:F}),o.ZP.createElement("img",{src:$,className:(0,_e.Z)("thumbnail",G),alt:"",draggable:!f}),U&&!D&&o.ZP.createElement("canvas",{ref:V,className:(0,_e.Z)("thumbnail",_)}),f&&o.ZP.createElement("span",{className:"protector"}),o.ZP.createElement("i",{className:(0,_e.Z)("icon-large-play",ne)}),ee&&o.ZP.createElement("div",{className:(0,_e.Z)("media-loading",te)},o.ZP.createElement(Qs.Z,{progress:K,onClick:ue})),!S&&!L&&o.ZP.createElement("i",{className:"icon-download"}),Y?o.ZP.createElement("span",{className:"message-transfer-progress"},J||p?`${Math.round(100*K)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,z.k9)(Math.max(ie-se,0))))};var sa=n(6272);const aa=(0,s.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:s}}=e;return{user:(0,c.dy)(e,n.userId),phoneCodeList:s,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{contact:t,user:n,phoneCodeList:a,animationLevel:i}=e;const{openChat:r}=(0,s.Sv)(),{firstName:c,lastName:d,phoneNumber:l,userId:u}=t,m="0"!==u,h=(0,o.I4)((()=>{r({id:u})}),[r,u]);return o.ZP.createElement("div",{className:(0,_e.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},o.ZP.createElement($n.Z,{size:"large",user:n,text:c||d,animationLevel:i,withVideo:!0}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},c," ",d),o.ZP.createElement("div",{className:"contact-phone"},(0,sa.WZ)(a,l))))}));var oa=n(20230),ia=n(51218),ra=n(14434),ca=n(96937);function da(e,t){return t>0?(e/t*100).toFixed():0}const la=e=>{let{answer:t,voteResults:n,totalVoters:s,maxVotersCount:a,correctResults:i,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),d=0===i.length||-1!==i.indexOf(t.option),l=i.length>0&&d||c?.isChosen,u=c?da(c.votersCount,s||0):0,[m,h]=(0,o.eJ)(r?0:u),g=(0,o.sO)(null),p=c?da(c.votersCount,a||0):0,f=m!==u;if((0,o.d4)((()=>{r&&h(u)}),[r,u]),(0,o.d4)((()=>{const e=g.current;if(e&&r){const t=e.firstElementChild,n=f?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",n):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${n}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[f,r]),!n||!c)return;const I=`width: ${p}%; transform:scaleX(${f?0:1})`;return o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",l&&o.ZP.createElement("span",{className:(0,_e.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},o.ZP.createElement("i",{className:d?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Sn.Z)(t.text)),o.ZP.createElement("div",{className:(0,_e.Z)("poll-option-answer",l&&!d&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:g}),o.ZP.createElement("div",{className:"poll-option-line",style:I}))))};function ua(e){e.stopPropagation()}const ma=(0,o.X$)((0,s.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:s}=n.results,{serverTimeOffset:a,users:{byId:o}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:o,serverTimeOffset:a}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:a,usersById:i,onSendVote:r,serverTimeOffset:c}=e;const{loadMessage:d,openPollResults:l,requestConfetti:u}=(0,s.Sv)(),{id:m,chatId:h}=t,{summary:g,results:p}=n,[f,I]=(0,o.eJ)(!1),[v,w]=(0,o.eJ)([]),[y,P]=(0,o.eJ)(!1),[Z,C]=(0,o.eJ)(!1),[b,E]=(0,o.eJ)(!g.closed&&g.closeDate&&g.closeDate>0?Math.min(g.closeDate-Math.floor(Date.now()/1e3)+c,g.closePeriod):0),S=(0,o.sO)(null),{results:M,totalVoters:R}=p,k=M&&M.some((e=>e.isChosen)),N=!g.closed&&!k,T=!N&&g.isPublic&&Number(p.totalVoters)>0,A=N&&g.multipleChoice,B=M?Math.max(...M.map((e=>e.votersCount))):R,x=M?M.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],L=g.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(g.quiz&&g.closePeriod&&b<=0)})));(0,o.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));f&&e&&(e.isCorrect&&u(),I(!1))}),[f,n.results.results,u]),(0,o.d4)((()=>{b>0&&setTimeout((()=>E(b-1)),1e3);const e=S.current;if(e){const t=12*Math.PI,n=e.lastElementChild,s=e.firstElementChild;if(b<=5&&e.classList.add("hurry-up"),n&&s){const e=(g.closePeriod-b)/g.closePeriod*t;s.textContent=(0,z.k9)(b),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,z.k9)(b)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[b,g.closePeriod]),(0,o.d4)((()=>{g.quiz&&(b<=0||k&&!g.closed)&&d({chatId:h,messageId:m})}),[h,b,k,d,m,g.closed,g.quiz]),(0,o.d4)((()=>{let e;return g.quiz&&!g.closed&&g.closePeriod&&g.closePeriod>0&&(e=window.setTimeout((()=>{d({chatId:h,messageId:m})}),1e3*g.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[N,h,d,m,g.closePeriod,g.closed,g.quiz]);const O=(0,o.Ye)((()=>a?a.reduce(((e,t)=>{const n=i[t];return n&&e.push(n),e}),[]):[]),[i,a]),F=(0,o.I4)((e=>{w([e]),I(!0),C(!0),r([e])}),[r]),U=(0,o.I4)((e=>{w(e)}),[]),j=(0,o.I4)((()=>{I(!0),C(!0),r(v)}),[r,v]),D=(0,o.I4)((()=>{l({chatId:h,messageId:m})}),[h,m,l]),q=(0,o.I4)((()=>{P(!0)}),[]),$=(0,o.I4)((()=>{P(!1),C(!1)}),[]);(0,o.d4)((()=>{Z&&k&&g.quiz&&p.results&&n.results.solution&&(p.results.find((e=>e.isChosen&&e.isCorrect))||P(!0))}),[k,Z,p.results,g.quiz,n.results.solution]);const G=(0,yt.Z)();return o.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&o.ZP.createElement(ca.Z,{message:(0,oa.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:$,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Sn.Z)(g.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},G(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(g)),O.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},O.map((e=>o.ZP.createElement($n.Z,{size:"micro",user:e})))),b>0&&N&&o.ZP.createElement("div",{ref:S,className:"poll-countdown"}),g.quiz&&n.results.solution&&!N&&o.ZP.createElement(Rt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:q,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),N&&o.ZP.createElement("div",{className:"poll-answers",onClick:ua},A?o.ZP.createElement(ia.Z,{options:L,onChange:U,disabled:t.isScheduled||f,loadingOptions:f?v:void 0,round:!0}):o.ZP.createElement(ra.Z,{name:`poll-${m}`,options:L,onChange:F,disabled:t.isScheduled||f,loadingOption:f?v[0]:void 0})),!N&&o.ZP.createElement("div",{className:"poll-results"},g.answers.map((function(e){return o.ZP.createElement(la,{key:e.option,shouldAnimate:Z||!N,answer:e,voteResults:M,totalVoters:R,maxVotersCount:B,correctResults:x})}))),!T&&!A&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(G,g.quiz,p.totalVoters)),A&&o.ZP.createElement(Rt.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:j},G("PollSubmitVotes")),T&&o.ZP.createElement(Rt.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var ha=n(48035),ga=n(10088);const pa=(0,o.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,inPreview:r,asForwarded:c,lastSyncTime:d,isDownloading:u=!1,isProtected:m,theme:h,onMediaClick:g,onCancelMediaTransfer:p}=e;const f=(0,l.s1)(t),I=(0,o.I4)((()=>{g()}),[g]);if(!f)return;const{siteName:v,url:w,displayUrl:y,title:P,description:Z,photo:C,video:b}=f,E=(0,ha.Z)(Z,170),S=Boolean(E||P||v);let M=!1;if(S&&f?.photo&&!f.video){const{width:e,height:n}=is(t);M=e===n}const R=(C||b)&&g&&!M,k=(0,_e.Z)("WebPage",r&&"in-preview",M&&"with-square-photo",!C&&!b&&!r&&"without-media",b&&"with-video",!S&&"no-article");return o.ZP.createElement("div",{className:k,"data-initial":(v||y)[0],dir:"auto"},C&&!b&&o.ZP.createElement(ea,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,size:M?"pictogram":"inline",asForwarded:c,nonInteractive:!R,isDownloading:u,isProtected:m,theme:h,onClick:R?I:void 0,onCancelUpload:p}),S&&o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(ga.Z,{className:"site-name",url:w,text:v||y}),!r&&P&&o.ZP.createElement("p",{className:"site-title"},(0,Sn.Z)(P)),E&&o.ZP.createElement("p",{className:"site-description"},(0,Sn.Z)(E,["emoji","br"]))),!r&&b&&o.ZP.createElement(na,{message:t,observeIntersectionForLoading:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,lastSyncTime:d,asForwarded:c,isDownloading:u,isProtected:m,onClick:R?I:void 0,onCancelUpload:p}))}));var fa=n(17921);const Ia=(0,o.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:s,isSelected:i,theme:r}=e;const c=(0,o.sO)(null),d=(0,yt.Z)(),u=(0,l.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photo:I}=u,v=(0,fn.Z)((0,l.O9)(I));return(0,es.Z)((e=>{let[t]=e;if(n){if(v){const e=c.current.closest(a.be);Ws(v,!1,0,i,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")}))}}else t&&c.current.closest(a.be).removeAttribute(a.s2)}),[n,v,s,i,r]),o.ZP.createElement("div",{ref:c,className:"Invoice"},m&&o.ZP.createElement("p",{className:"title"},(0,Sn.Z)(m)),h&&o.ZP.createElement("div",null,(0,Sn.Z)(h,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(I?"has-image":"")},v&&o.ZP.createElement("img",{className:"invoice-image",src:v,alt:"",crossOrigin:"anonymous"}),!v&&I&&o.ZP.createElement(fa.Z,{width:I.dimensions?.width,height:I.dimensions?.height,forceAspectRatio:!0}),o.ZP.createElement("p",{className:"description-text"},(0,Ve.x)(g,p,d.code),f&&o.ZP.createElement("span",null,d("PaymentTestInvoice")))))})),va={root:"rwnm0xOh31c2MY4kK2No",dots:"Nlcnrzv_f5cSxFsPOGt2",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",canvas:"a_WnxsI6X0B4j7QRRoOA"},wa=(0,o.X$)((e=>{let{message:t,lastSyncTime:n}=e;const{openInvoice:a,loadExtendedMedia:i}=(0,s.Sv)(),r=(0,yt.Z)(),c=(0,l.eO)(t),{chatId:d,id:u}=t,m=(0,o.I4)((()=>{i({chatId:d,ids:[u]})}),[d,u,i]);(0,it.Z)(m,n?3e4:void 0);const{amount:h,currency:g,extendedMedia:p}=c,{width:f,height:I,thumbnail:v,duration:w}=p,y=(0,Js.Z)(v?.dataUri,!1,void 0,25,f,I),P=(0,o.I4)((()=>{a({chatId:d,messageId:u,isExtendedMedia:!0})}),[d,u,a]);return o.ZP.createElement("div",{className:(0,_e.Z)(va.root,"media-inner"),onClick:P},o.ZP.createElement("canvas",{ref:y,className:va.canvas,width:f,height:I}),o.ZP.createElement("div",{className:va.dots}),Boolean(w)&&o.ZP.createElement("div",{className:va.duration},(0,z.k9)(w)),o.ZP.createElement("div",{className:va.buy},o.ZP.createElement("i",{className:(0,_e.Z)("icon-lock",va.lock)}),r("Checkout.PayPrice",(0,Ve.x)(h,g))))})),ya=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"})),Pa=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"];var Za=n(28183);const Ca=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",ba=1e-4,Ea={width:400,height:300,zoom:16,scale:2},Sa={__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>'},Ma=(0,o.X$)((e=>{let{message:t,peer:n,lastSyncTime:i,isInSelectMode:r,isSelected:c,theme:d,serverTimeOffset:u}=e;const{openUrl:m}=(0,s.Sv)(),h=(0,o.sO)(null),g=(0,o.sO)(null),f=(0,yt.Z)(),I=(0,st.Z)(),v=(0,l.nf)(t),{type:w,geo:y}=v,P=(0,p.b)(u),Z=(0,l.$R)(t,P),C="geoLive"!==w||Z?void 0:t.date+v.period-P,[b,E]=(0,o.eJ)(y),S="venue"===w||"geoLive"===w&&!Z,{width:M,height:R,zoom:k,scale:N}=Ea,T=Boolean(i)&&(0,l.k6)(b,M,R,k,N),A=(0,fn.Z)(T),B=(0,rn.Z)(A),x=A||B,L=n&&(0,l.YC)(n.id),O=n&&L?n:void 0,F=n&&!L?n:void 0,U=(0,l.B4)(t),j=(0,o.Ye)((()=>{if("geoLive"!==w||!b.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=b;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,k)}),[w,b,k]),D=(0,o.I4)((e=>{if("geoLive"!==w)return;const n=24*Math.PI,s=e.lastElementChild,a=e.firstElementChild,o=t.date+v.period-(0,p.b)(u),i=(1-o/v.period)*n,r=(0,z.mB)(f,1e3*o);s&&a?(a.textContent=r,s.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)):e.innerHTML=`\n <span class="geo-countdown-text">${r}</span>\n <svg width="32px" height="32px">\n <circle cx="16" cy="16" r="12" class="geo-countdown-progress" transform="rotate(-90, 16, 16)"\n stroke-dasharray="${n} ${n}"\n stroke-dashoffset="-${i}"\n />\n </svg>`}),[w,t.date,v,u,f]);return(0,o.bt)((()=>{g.current&&D(g.current)}),[D]),(0,es.Z)((e=>{let[t]=e;if(S)t||h.current.closest(a.be).removeAttribute(a.s2);else if(x){const e=h.current.closest(a.be);Ws(x,U,0,c,d).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(a.s2,"")}))}}),[S,U,r,c,d,x]),(0,o.d4)((()=>{Math.abs(y.lat-b.lat)<ba&&Math.abs(y.long-b.long)<ba?b.accuracyRadius!==y.accuracyRadius&&E({...b,accuracyRadius:y.accuracyRadius}):E(y)}),[y,b]),(0,Za.Z)((()=>{I()}),Z?void 0:1e3*(C||0)),(0,it.Z)((()=>{const e=g.current;e&&D(e)}),C?1e3:void 0),o.ZP.createElement("div",{ref:h,className:"Location media-inner interactive",onClick:()=>{const e=function(e,t,n){return`https://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(b.lat,b.long,k);m({url:e})}},o.ZP.createElement("div",{className:"map-wrapper"},x?o.ZP.createElement("img",{className:"full-media map",src:x,alt:"Location on a map",style:`width: ${Ea.width}px; height: ${Ea.height}px;`}):o.ZP.createElement(fa.Z,{width:M,height:R}),function(){if(x)return o.ZP.createElement(o.ZP.Fragment,null,Boolean(j)&&!Z&&o.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*j}px; height: ${2*j}px`}),function(){const e=(0,_e.Z)("pin",w,Z&&"expired");if("geoLive"===w)return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:Sa},o.ZP.createElement($n.Z,{chat:F,user:O,className:"location-avatar"}),void 0!==v.heading&&o.ZP.createElement("div",{className:"direction",style:`--direction: ${v.heading}deg`}));if("venue"===w){const t=function(e){return e?ya.get(e)||ya.get(e.split("/")[0])||Pa[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Pa.length)]:"#008df2";var t}(v.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(v.venueType);return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:Sa,style:`--pin-color: ${t}`},o.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return o.ZP.createElement("img",{className:e,src:Ca,alt:""})}())}()),function(){if(S)return"venue"===w?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},v.title),o.ZP.createElement("div",{className:"location-info-subtitle"},v.address)):"geoLive"===w?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},f("AttachLiveLocation")),o.ZP.createElement("div",{className:"location-info-subtitle"},(0,z.dJ)(f,P,t.editDate)),!Z&&o.ZP.createElement("div",{className:"geo-countdown",ref:g})):void 0}())})),Ra=(0,o.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:a}=e;const{clickBotInlineButton:i}=(0,s.Sv)(),r=t.content.game,{title:c,description:d}=r,u=Boolean(a)&&(0,l.N)(r),m=Boolean(a)&&(0,l.Wc)(r),h=(0,fn.Z)(u,!n),g=(0,fn.Z)(m,!n);return o.ZP.createElement("div",{className:"Game"},o.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{i({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&o.ZP.createElement(fa.Z,{className:"skeleton preview-content"}),h&&o.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&o.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:g})),o.ZP.createElement("div",{className:"title"},c),!(0,l.UD)(t)&&o.ZP.createElement("div",{className:"description"},d))}));function ka(e){return(0,o.X$)((0,s.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,c.CA)(e),isSelected:(0,c.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:a,message:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,s.Sv)(),d=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:e?.shiftKey})}),[c,i]),l=(0,o.Ye)((()=>{const{dimensions:e,onClick:s}=t;return{...t,isInSelectMode:n,isSelected:a,dimensions:{...e,x:0,y:0},onClick:n?void 0:s}}),[t,n,a]);return o.ZP.createElement("div",{className:(0,_e.Z)("album-item-select-wrapper",a&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},a&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,l))})))}const Na=ka(ea),Ta=ka(na),Aa=(0,s.c$)(((e,t)=>{let{album:n}=t;const{chatId:s}=n.mainMessage,a=(0,c.Pu)(e),o=(0,c.xs)(e,s);return{theme:a,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:a,lastSyncTime:i,isOwn:r,isProtected:d,albumLayout:u,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,s.Sv)(),I=t.messages.length,v=(0,o.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:w,height:y}=u.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${y}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,l.qp)(e),y=h[(0,l.KK)(e)]?.progress,{dimensions:P,sides:Z}=u.layout[t],C=(0,c.bH)((0,s.Rd)(),e),b=(0,c.__)((0,s.Rd)(),e);if(f){const s=a&&(r?t===I-1:Boolean(8&Z&&4&Z));return o.ZP.createElement(Na,{id:`album-media-${(0,l.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,shouldAffectAppendix:s,uploadProgress:y,dimensions:P,isProtected:d,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})}if(w)return o.ZP.createElement(Ta,{id:`album-media-${(0,l.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,canAutoPlay:b,uploadProgress:y,lastSyncTime:i,dimensions:P,isProtected:d,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})})))}));let Ba;const xa=e=>{let{message:t,observeIntersection:n,canAutoLoad:a,lastSyncTime:r,isDownloading:c}=e;const d=(0,o.sO)(null),u=(0,o.sO)(null),m=(0,o.sO)(null),h=t.content.video,g=(0,ns.Op)(d,n),[p,f]=(0,o.eJ)(a),I=Boolean(p&&g&&r),{mediaData:v,loadProgress:w}=(0,Xs.Z)((0,l.Ti)(t,"inline"),!I,(0,l.kG)(t,"inline"),r),{loadProgress:y}=(0,Xs.Z)((0,l.Ti)(t,"download"),!c,i.IU.BlobUrl,r),[P,Z]=(0,It.Z)(),C=!Boolean((0,l.DH)(t))||P,b=Ys(t,C),E=(0,Ks.Z)(!C),S=p&&!P||c,M=!1===(0,rn.Z)(p),{shouldRender:R,transitionClassNames:k}=(0,at.Z)(S,void 0,M),[T,A]=(0,o.eJ)(!1),[B,x]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!T)return;const e=ye.Rj/2,t=2*(e-6)*Math.PI,n=t-B*t,s=m.current,a=u.current,o=a.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${ye.Rj}px" height="${ye.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)}),[T,B]);const L=Boolean(v&&g),O=(0,o.I4)((()=>{m.current&&(A(!1),x(0),(0,js.Z)(m.current),(0,N.T2)((()=>{u.current.innerHTML=""})))}),[]),F=(0,o.I4)((()=>{Ba?.(),Ba=O}),[O]),U=(0,o.I4)((()=>{if(!v)return void f((e=>!e));if(c)return void(0,s.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;T?e.paused?((0,js.Z)(e),(0,bn.Es)()):e.pause():(F(),e.pause(),e.currentTime=0,(0,js.Z)(e),(0,bn.Es)(),A(!0))}),[F,T,c,v,t]),j=(0,o.I4)((e=>{const t=e.currentTarget;x(t.currentTime/t.duration)}),[]);return o.ZP.createElement("div",{ref:d,className:"RoundVideo media-inner",onClick:U},v&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement(ta.Z,{canPlay:L,ref:m,src:v,className:"full-media",width:ye.Rj,height:ye.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!T,loop:!T,playsInline:!0,onEnded:T?O:void 0,onTimeUpdate:T?j:void 0,onReady:Z})),o.ZP.createElement("canvas",{ref:b,className:(0,_e.Z)("thumbnail",E),style:`width: ${ye.Rj}px; height: ${ye.Rj}px`}),o.ZP.createElement("div",{className:"progress",ref:u}),R&&o.ZP.createElement("div",{className:`media-loading ${k}`},o.ZP.createElement(Qs.Z,{progress:c?y:w})),!v&&!p&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},T?(0,z.k9)(m.current.currentTime):(0,z.k9)(h.duration),(!T||m.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},La=e=>{let{message:t,onClick:n}=e;const s=(0,yt.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Rt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},o.ZP.createElement("span",{className:"inline-button-text"},(0,Sn.Z)(s(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!a.FS.test(e.url))return o.ZP.createElement("i",{className:"icon-arrow-right"});break;case"urlAuth":return o.ZP.createElement("i",{className:"icon-arrow-right"});case"buy":case"receipt":return o.ZP.createElement("i",{className:"icon-cart"});case"switchBotInline":return o.ZP.createElement("i",{className:"icon-share-filled"});case"webView":case"simpleWebView":return o.ZP.createElement("i",{className:"icon-webapp"})}})(e))))))))};var Oa=n(34076);const Fa=(0,o.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:a}=(0,s.Sv)(),i=(0,yt.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,o.I4)((()=>{a({id:c,threadId:r})}),[a,c,r]),p=(0,o.Ye)((()=>{if(!h?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,s.Rd)();return h.map((n=>(0,l.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===d)return;const f=Boolean(m&&u&&m<u),I=d?i("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?o.ZP.createElement(Oa.Z,{text:(0,ut.bi)(d)}):e)):void 0;return o.ZP.createElement("div",{"data-cnt":(0,ut.bi)(d),className:(0,_e.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:g},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!p||0===p.length)&&o.ZP.createElement("i",{className:"icon-comments"}),p&&p.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},p.map((e=>o.ZP.createElement($n.Z,{key:e.id,size:"small",user:(0,l.YC)(e.id)?e:void 0,chat:(0,l.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},d?I:i("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),Ua=(0,o.X$)((e=>{let{reaction:t,message:n,activeReaction:a,availableReactions:i}=e;const{sendReaction:r}=(0,s.Sv)(),{recentReactions:c}=n.reactions,d=(0,o.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]),l=(0,o.I4)((()=>{r({reaction:t.isChosen?void 0:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,r]);return o.ZP.createElement(Rt.Z,{className:(0,_e.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:l},o.ZP.createElement(xs,{activeReaction:a,reaction:t.reaction,availableReactions:i}),d?.length?o.ZP.createElement("div",{className:"avatars"},d.map((e=>o.ZP.createElement($n.Z,{user:e,size:"micro"})))):o.ZP.createElement(Oa.Z,{text:(0,ut.bi)(t.count)}))})),ja=(0,o.X$)((e=>{let{message:t,isOutside:n,activeReaction:s,availableReactions:a,metaChildren:i}=e;return o.ZP.createElement("div",{className:(0,_e.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>o.ZP.createElement(Ua,{key:e.reaction,reaction:e,message:t,activeReaction:s,availableReactions:a}))),i)})),Da=(0,o.X$)((e=>{let{phoneCall:t,message:n,chatId:a}=e;const{requestCall:i}=(0,s.Sv)(),r=(0,yt.Z)(),{isOutgoing:c,isVideo:d,reason:l}=t,u="missed"===l,m="busy"===l&&!c,g=(0,o.I4)((()=>{i({isVideo:d,userId:a})}),[a,d,i]),p=(0,o.Ye)((()=>d?m?"CallMessageVideoIncomingDeclined":u?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?"CallMessageIncomingDeclined":u?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":c?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,c,d]),f=(0,o.Ye)((()=>t.duration?(0,z.J_)(r,t.duration):void 0),[r,t.duration]),I=(0,z.mr)(r,1e3*n.date);return o.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},o.ZP.createElement(Rt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!h.Bi,ariaLabel:r(c?"CallAgain":"CallBack")},o.ZP.createElement("i",{className:d?"icon-video-outlined":"icon-phone"})),o.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},o.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},r(p)),o.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},o.ZP.createElement("i",{className:(0,_e.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",u&&"V5tKkKZpcY5yq_f5nO8l",!c&&"e0Vhbj8gfzQn1zJQoFLK")}),o.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?r("CallMessageWithDuration",[I,f]):I))))}));var qa=n(78780),$a=n(4863),Ga=n(50685),Ha=n(14612);const Va={__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>'},_a={__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>'},za=(0,o.X$)((0,s.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:s,lastSyncTime:a,serverTimeOffset:o}=e,{message:i,album:r,withSenderName:d,withAvatar:u,threadId:m,messageListType:h,isLastInDocumentGroup:g}=t,{id:p,chatId:f,viaBotId:I,replyToChatId:v,replyToMessageId:w,isOutgoing:y,threadInfo:P,forwardInfo:Z,transcriptionId:C}=i,b=(0,c.Z1)(e,f),E=(0,c.FM)(e,f),S=(0,l.pK)(f),M=b&&(0,l.eA)(b),R=b&&(0,l.Bf)(b),k=b?.username,N=s.messageIds&&s.messageIds.includes(p),T=!E&&(0,l.Ul)(i),A=d||u||T,B=(0,c.Ur)(e,i),x=(0,c.cv)(e,i),L=I?(0,c.dy)(e,I):void 0,O=B?.id&&R?b.fullInfo?.adminMembersById?.[B?.id]:void 0,F=m?(0,c.qS)(e,f,m):void 0,U=i.id===F,j=w===F,D=w&&!j?(0,c.hj)(e,S&&v?v:f,w):void 0,q=D&&(0,c.Bz)(e,D,Boolean(Z)),$=(0,c.uZ)(e,i),G="thread"===h&&(r?r.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,i)),{direction:H,noHighlight:V,isResizingContainer:_}=G&&n||{},{query:z}=(0,c.n5)(e)||{},W=(0,l.h_)(i),X=W&&((0,c.zB)(e,W)||(0,c.CP)(e,W))?W:void 0,J=(0,l.HW)(i);let Y;Y=r?.messages?r.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,p);const{canReply:K}="thread"===h&&(0,c._k)(e,i,m)||{},Q=(0,c.te)(e,i),ee=P?(0,c.tZ)(e,P.chatId,P.threadId)||P:void 0,te=Boolean(i.groupedId)&&!i.isInAlbum,ne=te?(0,c.xH)(e,f,i.groupedId)[0]:void 0,se=te?g?(0,c.hj)(e,f,ne):void 0:i,ae=b?.unreadReactions?.includes(i.id);return{theme:(0,c.Pu)(e),chatUsername:k,forceSenderName:T,sender:B,canShowSender:A,originSender:x,botSender:L,shouldHideReply:j,isThreadTop:U,replyMessage:D,replyMessageSender:q,isInDocumentGroup:te,isProtected:(0,c.EV)(e,i),isChatProtected:(0,c.Am)(e,f),isFocused:G,isForwarding:N,reactionMessage:se,isChatWithSelf:E,isRepliesChat:S,isChannel:M,isGroup:R,canReply:K,lastSyncTime:a,serverTimeOffset:o,highlight:z,animatedEmoji:X,animatedCustomEmoji:J,isInSelectMode:(0,c.CA)(e),isSelected:Y,isGroupSelected:Boolean(i.groupedId)&&!i.isInAlbum&&(0,c.a6)(e,f,i.groupedId),threadId:m,isDownloading:Q,isPinnedList:"pinned"===h,canAutoLoadMedia:(0,c.bH)(e,i),canAutoPlayMedia:(0,c.__)(e,i),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.yB)(e),threadInfo:ee,availableReactions:e.availableReactions,defaultReaction:(0,l.CI)(i)?void 0:(0,c.q6)(e,f),activeReaction:se&&e.activeReactions[se.id],activeEmojiInteractions:e.activeEmojiInteractions,...y&&{outgoingStatus:(0,c.dT)(e,i,"scheduled"===h)},..."number"==typeof $&&{uploadProgress:$},...G&&{focusDirection:H,noFocusHighlight:V,isResizingContainer:_},hasUnreadReaction:ae,isTranscribing:void 0!==C&&e.transcriptions[C]?.isPending,transcribedText:void 0!==C?e.transcriptions[C]?.text:void 0,isPremium:(0,c.wV)(e),animationLevel:e.settings.byKey.animationLevel,senderAdminMember:O}}))((e=>{let{message:t,chatUsername:n,observeIntersectionForBottom:r,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,album:u,noAvatars:g,withAvatar:f,withSenderName:I,areReactionsInMeta:v,noComments:w,appearanceOrder:y,isFirstInGroup:P,isPremium:Z,isLastInGroup:C,isFirstInDocumentGroup:b,isLastInDocumentGroup:E,isTranscribing:S,transcribedText:M,isLastInList:R,theme:k,forceSenderName:N,sender:T,canShowSender:A,originSender:B,botSender:x,isThreadTop:L,shouldHideReply:O,replyMessage:F,replyMessageSender:U,outgoingStatus:j,uploadProgress:D,isInDocumentGroup:q,isProtected:$,isChatProtected:G,isFocused:H,focusDirection:V,noFocusHighlight:_,isResizingContainer:z,isForwarding:W,isChatWithSelf:X,isRepliesChat:J,isChannel:Y,isGroup:K,canReply:Q,lastSyncTime:ee,serverTimeOffset:te,highlight:ne,animatedEmoji:se,animatedCustomEmoji:ae,isInSelectMode:oe,isSelected:ie,isGroupSelected:re,threadId:ce,reactionMessage:de,availableReactions:le,defaultReaction:ue,activeReaction:me,activeEmojiInteractions:he,messageListType:ge,isPinnedList:pe,isDownloading:fe,canAutoLoadMedia:Ie,canAutoPlayMedia:ve,shouldLoopStickers:we,autoLoadFileMaxSizeMb:Pe,threadInfo:Ze,hasUnreadReaction:Ce,memoFirstUnreadIdRef:be,animationLevel:Ee,senderAdminMember:Se}=e;const{toggleMessageSelection:Me,clickBotInlineButton:Re,disableContextMenuHint:ke,animateUnreadReaction:Ne,focusLastMessage:Te}=(0,s.Sv)(),Ae=(0,o.sO)(null),Be=(0,o.sO)(null),xe=(0,o.sO)(null),Le=(0,yt.Z)(),[Oe,Fe]=(0,o.eJ)(!1),[Ue,je,De]=(0,It.Z)();(0,ns._N)(Be,r);const{isContextMenuOpen:qe,contextMenuPosition:$e,handleBeforeContextMenu:Ge,handleContextMenu:He,handleContextMenuClose:Ve,handleContextMenuHide:ze}=(0,Fn.Z)(Ae,h.$b&&oe,!0,h.wZ);(0,o.d4)((()=>{qe&&ke()}),[qe,ke]);const We=y<=0,[Xe,Je]=(0,It.Z)(We);(0,o.d4)((()=>{We||setTimeout(Je,10*y)}),[y,Je,We]);const{transitionClassNames:Ye}=(0,at.Z)(Xe,void 0,We,!1),{id:Ke,chatId:Qe,forwardInfo:et,viaBotId:tt,isTranscriptionError:nt}=t,st=(0,l.CI)(t),ot=(0,l.B4)(t),it="scheduled"===ge||t.isScheduled,rt=(0,l.ss)(t)&&!O,ct=Boolean(Ze)&&"thread"===ge,dt=(0,l.$D)(t),lt=dt&&(se||ae),ut=de?.reactions&&!(0,l.JE)(de.reactions),mt=et&&(!X||it)&&!J&&!et.isLinkedChannelPost&&!dt,ht=Boolean(u)&&u.messages.length>1&&!u?.messages.some((e=>0===Object.keys(e.content).length)),gt=q&&!b,pt=q&&!E,ft=void 0!==$e,vt=!(ft||oe||W||pt),wt=Y&&!it&&t.isForwardingAllowed&&!G,Pt=Boolean(pe||et&&(et.isChannelPost||X&&!ot||J)&&et.fromMessageId),Zt=(0,o.I4)(((e,t)=>{Me({messageId:Ke,groupedId:t,...e?.shiftKey&&{withShift:!0},...ht&&{childMessageIds:u.messages.map((e=>{let{id:t}=e;return t}))}})}),[Me,Ke,ht,u]),Ct=A?T:void 0,bt=Boolean(!Oe&&(nt||M)),Et=et&&(X||J||!Ct)?B:Ct,St=et?B:Ct,{handleMouseDown:Mt,handleClick:kt,handleContextMenu:Nt,handleDoubleClick:Tt,handleContentDoubleClick:At,handleMouseMove:Bt,handleSendQuickReaction:xt,handleMouseLeave:Lt,isSwiped:Ot,isQuickReactionVisible:Ft,handleDocumentGroupMouseEnter:Ut}=ws(Zt,Ae,Ke,0,Boolean(oe),Boolean(Q),Boolean($),He,Ge,Qe,ft,xe,ot,pt),{handleAvatarClick:jt,handleSenderClick:Dt,handleViaBotClick:qt,handleReplyClick:$t,handleMediaClick:Gt,handleAudioPlay:Ht,handleAlbumMediaClick:Vt,handleMetaClick:_t,handleReadMedia:zt,handleCancelUpload:Wt,handleVoteSend:Xt,handleGroupForward:Jt,handleForward:Yt,handleFocus:Kt,handleFocusForwarded:Qt,handleDocumentGroupSelectAll:en}=function(e,t,n,a,r,c,d,l,u,h,g,p,f){const{openChat:I,showNotification:v,focusMessage:w,openMediaViewer:y,openAudioPlayer:P,markMessagesRead:Z,cancelSendingMessage:C,sendPollVote:b,openForwardMenu:E,focusMessageInComments:S}=(0,s.Sv)(),{id:M,forwardInfo:R,replyToMessageId:k,replyToChatId:N,replyToTopMessageId:T,groupedId:A}=n,B=(0,o.I4)((()=>{g&&I({id:g.id})}),[g,I]),x=(0,o.I4)((()=>{p?d&&R?.channelPostId?w({chatId:p.id,messageId:R.channelPostId}):I({id:p.id}):v({message:e("HidAccount")})}),[d,w,R,e,I,p,v]),L=(0,o.I4)((()=>{f&&I({id:f.id})}),[f,I]),O=(0,o.I4)((()=>{w({chatId:u&&N?N:a,threadId:r,messageId:k,replyMessageId:u&&N?void 0:M})}),[w,u,N,a,r,k,M]),F=(0,o.I4)((()=>{y({chatId:a,threadId:r,mediaId:M,origin:l?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,M,y,l]),U=(0,o.I4)((()=>{P({chatId:a,messageId:M})}),[a,M,P]),j=(0,o.I4)((e=>{y({chatId:a,threadId:r,mediaId:e,origin:l?m.bZ.ScheduledAlbum:m.bZ.Album})}),[a,r,y,l]),D=(0,o.I4)((()=>{Z({messageIds:[M]})}),[M,Z]),q=(0,o.I4)((()=>{C({chatId:a,messageId:M})}),[C,a,M]),$=(0,o.I4)((e=>{b({chatId:a,messageId:M,options:e})}),[a,M,b]),G=(0,o.I4)((()=>{E({fromChatId:a,groupedId:A})}),[E,a,A]),H=(0,o.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));E({fromChatId:a,messageIds:e})}else E({fromChatId:a,messageIds:[M]})}),[h,E,a,M]),V=(0,o.I4)((()=>{w({chatId:a,threadId:i._f,messageId:M})}),[w,a,M]),_=(0,o.I4)((()=>{c?w({chatId:R.fromChatId,groupedId:A,groupedChatId:a}):u&&N?S({chatId:N,threadId:T,messageId:R.fromMessageId}):w({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,N,w,R,A,a,S,T]),z=(0,o.I4)((e=>{e.stopPropagation(),t(e,A)}),[t,A]);return{handleAvatarClick:B,handleSenderClick:x,handleViaBotClick:L,handleReplyClick:O,handleMediaClick:F,handleAudioPlay:U,handleAlbumMediaClick:j,handleMetaClick:z,handleReadMedia:D,handleCancelUpload:q,handleVoteSend:$,handleGroupForward:G,handleForward:H,handleFocus:V,handleFocusForwarded:_,handleDocumentGroupSelectAll:z}}(Le,Zt,t,Qe,ce,q,mt,it,J,u,Et,St,x);(0,o.d4)((()=>{R&&bt&&M&&Te()}),[Te,R,M,bt]);const tn=(0,_e.Z)("Message message-list-item",P&&"first-in-group",$&&"is-protected",C&&"last-in-group",b&&"first-in-document-group",E&&"last-in-document-group",R&&"last-in-list",ot&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",rt&&"has-reply",ft&&"has-menu-open",H&&!_&&"focused",W&&"is-forwarding",t.isDeleting&&"is-deleting",q&&"is-in-document-group",ht&&"is-album",t.hasUnreadMention&&"has-unread-mention",ie&&"is-selected",oe&&"is-in-selection-mode",L&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Ot&&"is-swiped",Ye,(Boolean(me)||Ue)&&"has-active-reaction"),{text:nn,photo:sn,video:an,audio:on,voice:rn,document:cn,sticker:ln,contact:un,poll:mn,webPage:hn,invoice:gn,location:pn,action:fn,game:In}=(0,l.qp)(t),{phoneCall:vn}=fn||{},wn=Ze&&!pt&&"thread"===ge&&!w,yn=!h.$b&&!vn&&!oe&&ue&&!pt,Pn=function(e){let{hasReply:t,isCustomShape:n,isLastInGroup:s,asForwarded:o,hasThread:i,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:u,isGeoLiveActive:m,withVoiceTranscription:h}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:g,photo:p,video:f,audio:I,voice:v,document:w,poll:y,webPage:P,contact:Z,location:C,invoice:b}=(0,l.qp)(e),E=[a.gn],S=p||f||C||b?.extendedMedia,M=g||"venue"===C?.type||m,R=S&&!M,k=Boolean(e.viaBotId);return!S&&e.emojiOnlyCount?(E.push("emoji-only"),e.emojiOnlyCount<=a.L5&&E.push(`emoji-only-${e.emojiOnlyCount}`)):M&&E.push("text"),d&&E.push("has-action-button"),n&&(E.push("custom-shape"),f?.isRound&&E.push("round"),c&&E.push("has-comments")),S?E.push("media"):I?E.push("audio"):v?(E.push("voice"),h&&E.push("with-voice-transcription")):w?E.push("document"):Z?E.push("contact"):y?E.push("poll"):P&&(E.push("web-page"),(P.photo||P.video)&&E.push("media")),b&&!b.extendedMedia&&E.push("invoice"),o&&E.push("is-forwarded"),t&&E.push("is-reply"),i&&E.push("has-replies"),u&&E.push("has-reactions"),k&&E.push("is-via-bot"),r&&E.push("force-sender-name"),n||(E.push("has-shadow"),S&&c&&E.push("has-background"),(t||o||k||!R||r)&&E.push("has-solid-background"),s&&(p||C&&!M||!R)&&E.push("has-appendix")),E.join(" ")}(t,{hasReply:rt,isCustomShape:dt,isLastInGroup:C,asForwarded:mt,hasThread:ct,forceSenderName:N,hasComments:Ze&&Ze?.messagesCount>0,hasActionButton:wt||Pt,hasReactions:ut,isGeoLiveActive:"geoLive"===pn?.type&&!(0,l.$R)(t,(0,p.b)(te)),withVoiceTranscription:bt}),Zn=Pn.includes("has-appendix"),Cn=(0,l.fY)(t),bn=(0,Cs.qo)(t.emojiOnlyCount);let En,Mn;En=vn||pt?"none":!Cn||hn||lt?"standalone":"in-text",v?Mn="in-meta":ut?dt||(sn||an)&&!Cn?Mn="outside":mt?(En="standalone",Mn="inside"):Mn="inside":Mn="none",(0,dn.Z)(J&&t.replyToChatId?t.replyToChatId:Qe,rt?t.replyToMessageId:void 0,F,t.id),gs(Ae,Qe,H,V,_,z),(0,o.d4)((()=>{const e=Be.current;Ce&&e&&(0,Zs.P)(e)&&Ne({messageIds:[Ke]})}),[Ce,Ke,Ne]);let Rn,kn="",Nn=!1;const Tn=(0,o.Ye)((()=>ht?ls(ot,Boolean(mt),Boolean(g),u):void 0),[ht,ot,mt,g,u]),An=mt?28:0;if(!ht&&(sn||an||gn?.extendedMedia)){let e;if(sn)e=is(t,mt,g).width;else if(an)e=an.isRound?ye.Rj:is(t,mt,g).width;else if(gn?.extendedMedia&&gn.extendedMedia.width&&gn.extendedMedia.height){const{width:t,height:n}=gn.extendedMedia;e=(0,ye.Kf)({width:t,height:n,fromOwnMessage:ot,asForwarded:mt,noAvatars:g}).width}e&&(Rn=Math.max(os(Boolean(nn),wn),e),gn?.extendedMedia&&Rn-e>18&&(Nn=!0))}else Tn&&(Rn=Math.max(os(Boolean(nn),wn),Tn.containerStyle.width),Rn-Tn.containerStyle.width>18&&(Nn=!0));Rn&&(kn=`width: ${Rn+An}px`);const Bn=Y&&t.postAuthorTitle||!mt&&et?.postAuthorTitle||void 0,xn=(0,o.Ye)((()=>Bn?hs(Bn):void 0),[Bn]);function Ln(){const e=o.ZP.createElement(Ls,{message:t,reactionMessage:de,outgoingStatus:j,signature:Bn,withReactions:"in-meta"===Mn,withReactionOffset:"inside"===Mn,availableReactions:le,activeReaction:me,onClick:_t});return"inside"!==Mn?e:o.ZP.createElement(ja,{activeReaction:me,message:de,metaChildren:e,availableReactions:le})}const On=K&&mt?t.postAuthorTitle:void 0;return o.ZP.createElement("div",{ref:Ae,id:(0,l.d0)(t.id),className:tn,style:xn?`--meta-safe-author-width: ${xn}px`:void 0,"data-message-id":Ke,onMouseDown:Mt,onClick:kt,onContextMenu:Nt,onDoubleClick:Tt,onMouseEnter:pt?Ut:void 0,onMouseMove:yn?Bt:void 0,onMouseLeave:yn||pt?Lt:void 0},o.ZP.createElement("div",{ref:Be,className:"bottom-marker","data-message-id":Ke,"data-last-message-id":u?u.messages[u.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ce||void 0}),!q&&o.ZP.createElement("div",{className:"message-select-control"},ie&&o.ZP.createElement("i",{className:"icon-select"})),E&&o.ZP.createElement("div",{className:(0,_e.Z)("message-select-control group-select",re&&"is-selected"),onClick:en},re&&o.ZP.createElement("i",{className:"icon-select"})),f&&function(){const e=Et&&(0,l.YC)(Et.id),t=Et&&e?Et:void 0,n=Et&&!e?Et:void 0,s=!Et&&et?et.hiddenUserName:void 0;return o.ZP.createElement($n.Z,{size:"small",user:t,chat:n,text:s,lastSyncTime:ee,onClick:t||n?jt:void 0,observeIntersection:c,animationLevel:Ee,withVideo:!0})}(),o.ZP.createElement("div",{className:(0,_e.Z)("message-content-wrapper",Pn.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:xe,className:Pn,style:kn,dir:"auto"},mt&&!gt&&o.ZP.createElement("div",{className:"message-title"},Le("ForwardedMessage"),On&&o.ZP.createElement("span",{className:"admin-title",dir:"auto"},On)),function(){const e=(0,_e.Z)("content-inner",mt&&"forwarded-message",rt&&"reply-message",Nn&&"no-media-corners"),n=C&&!Cn&&!mt&&!ct,s=(0,_e.Z)("text-content","in-text"===En&&"with-meta",j&&"with-outgoing-icon");return o.ZP.createElement("div",{className:e,onDoubleClick:At,dir:"auto"},function(){if(dt&&!tt||!(I&&!(sn||an||pn)||mt||tt||N)||gt||rt&&dt)return;let e,n;!St||dt&&tt?et?.hiddenUserName&&(e=et.hiddenUserName):(e=(0,l.OU)(Le,St),mt||(n=`color-${(0,l.Rs)(St)}`));const s=St&&"emojiStatus"in St&&St.emojiStatus,i=St&&"isPremium"in St&&St.isPremium;return o.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?o.ZP.createElement("span",{className:(0,_e.Z)("message-title-name interactive",n),onClick:Dt,dir:"ltr"},(0,Sn.Z)(e),!mt&&s&&o.ZP.createElement(Vs.Z,{documentId:s.documentId,loopLimit:a.y3,observeIntersectionForLoading:c,observeIntersectionForPlaying:d}),!mt&&!s&&i&&o.ZP.createElement($a.Z,null),St?.fakeType&&o.ZP.createElement(Ga.Z,{fakeType:St.fakeType})):x?void 0:" ",x&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},Le("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:qt},(0,Sn.Z)(`@${x.username}`))),et?.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Le("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&K&&mt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&K&&!mt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):Se&&!mt?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Se.customTitle||Le(Se.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")):void 0)}(),rt&&o.ZP.createElement(Rs,{message:F,noUserColors:ot,isProtected:$,sender:U,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,onClick:$t}),ln&&o.ZP.createElement(Fs,{message:t,observeIntersection:c,observeIntersectionForPlaying:d,shouldLoop:we,lastSyncTime:ee,shouldPlayEffect:ln.hasEffect&&(be.current&&Ke>=be.current||st)||void 0,onPlayEffect:je,onStopEffect:De}),lt&&ae&&o.ZP.createElement(_s,{customEmojiId:ae,withEffects:(0,l.YC)(Qe),isOwn:ot,observeIntersection:c,lastSyncTime:ee,forceLoadPreview:st,messageId:Ke,chatId:Qe,activeEmojiInteractions:he}),lt&&se&&o.ZP.createElement(Hs,{emoji:se,withEffects:(0,l.YC)(Qe),isOwn:ot,observeIntersection:c,lastSyncTime:ee,forceLoadPreview:st,messageId:Ke,chatId:Qe,activeEmojiInteractions:he}),ht&&o.ZP.createElement(Aa,{album:u,albumLayout:Tn,observeIntersection:c,isOwn:ot,isProtected:$,hasCustomAppendix:n,lastSyncTime:ee,onMediaClick:Vt}),vn&&o.ZP.createElement(Da,{message:t,phoneCall:vn,chatId:Qe}),!ht&&sn&&o.ZP.createElement(ea,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:Ie,uploadProgress:D,shouldAffectAppendix:n,isDownloading:fe,isProtected:$,asForwarded:mt,theme:k,onClick:Gt,onCancelUpload:Wt}),!ht&&an&&an.isRound&&o.ZP.createElement(xa,{message:t,observeIntersection:c,canAutoLoad:Ie,lastSyncTime:ee,isDownloading:fe}),!ht&&an&&!an.isRound&&o.ZP.createElement(na,{message:t,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,noAvatars:g,canAutoLoad:Ie,canAutoPlay:ve,uploadProgress:D,lastSyncTime:ee,isDownloading:fe,isProtected:$,asForwarded:mt,onClick:Gt,onCancelUpload:Wt}),(on||rn)&&o.ZP.createElement(Ns.ZP,{theme:k,message:t,origin:m.Cr.Inline,uploadProgress:D,lastSyncTime:ee,isSelectable:q,isSelected:ie,noAvatars:g,onPlay:Ht,onReadMedia:!rn||ot&&!X?void 0:zt,onCancelUpload:Wt,isDownloading:fe,isTranscribing:S,isTranscriptionHidden:Oe,isTranscribed:Boolean(M),isTranscriptionError:nt,canDownload:!$,onHideTranscription:Fe,canTranscribe:Z}),cn&&o.ZP.createElement(ks.Z,{message:t,observeIntersection:c,canAutoLoad:Ie,autoLoadFileMaxSizeMb:Pe,uploadProgress:D,isSelectable:q,isSelected:ie,onMediaClick:Gt,onCancelUpload:Wt,isDownloading:fe}),un&&o.ZP.createElement(aa,{contact:un}),mn&&o.ZP.createElement(ma,{message:t,poll:mn,onSendVote:Xt}),In&&o.ZP.createElement(Ra,{message:t,canAutoLoadMedia:Ie,lastSyncTime:ee}),gn?.extendedMedia&&o.ZP.createElement(wa,{message:t,lastSyncTime:ee}),bt&&o.ZP.createElement("p",{className:(0,_e.Z)("transcription",!Oe&&nt&&"transcription-error"),dir:"auto"},nt?Le("NoWordsRecognized"):S&&M?o.ZP.createElement(qa.Z,{content:M}):M),!lt&&Cn&&o.ZP.createElement("div",{className:s,dir:"auto"},o.ZP.createElement(Ha.Z,{message:t,emojiSize:bn,highlight:ne,isProtected:$,observeIntersectionForLoading:c,observeIntersectionForPlaying:d,withTranslucentThumbs:dt}),"in-text"===En&&Ln()),hn&&o.ZP.createElement(pa,{message:t,observeIntersection:c,noAvatars:g,canAutoLoad:Ie,canAutoPlay:ve,asForwarded:mt,lastSyncTime:ee,isDownloading:fe,isProtected:$,theme:k,onMediaClick:Gt,onCancelMediaTransfer:Wt}),gn&&!gn.extendedMedia&&o.ZP.createElement(Ia,{message:t,shouldAffectAppendix:n,isInSelectMode:oe,isSelected:ie,theme:k}),pn&&o.ZP.createElement(Ma,{message:t,lastSyncTime:ee,isInSelectMode:oe,isSelected:ie,theme:k,peer:T,serverTimeOffset:te}))}(),!pt&&"standalone"===En&&Ln(),vt&&wt?o.ZP.createElement(Rt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Le("lng_context_forward_msg"),onClick:E?Jt:Yt},o.ZP.createElement("i",{className:"icon-share-filled"})):vt&&Pt?o.ZP.createElement(Rt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:pe?Kt:Qt},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,wn&&o.ZP.createElement(Fa,{threadInfo:Ze,disabled:w}),Zn&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:ot?Va:_a}),yn&&o.ZP.createElement("div",{className:(0,_e.Z)("quick-reaction",Ft&&!me&&"visible"),onClick:xt},o.ZP.createElement(As.Z,{reaction:ue}))),t.inlineButtons&&o.ZP.createElement(La,{message:t,onClick:Re}),"outside"===Mn&&o.ZP.createElement(ja,{message:de,isOutside:!0,activeReaction:me,availableReactions:le})),$e&&o.ZP.createElement(Es,{isOpen:qe,anchor:$e,message:t,album:u,chatUsername:n,messageListType:ge,onClose:Ve,onCloseAnimationEnd:ze}))}))),Wa=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"AboutAdsModal",!t);return n?o.ZP.createElement(n,e):void 0})),Xa=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Ja=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.fS)(e,n),{chatId:a,isBot:o}=s||{};return{message:s,bot:a&&o?(0,c.dy)(e,a):void 0,channel:!o&&a?(0,c.Z1)(e,a):void 0}}))((e=>{let{chatId:t,message:n,containerRef:a,bot:i,channel:r}=e;const{viewSponsoredMessage:c,openChat:d,openChatByInvite:u,startBot:m,focusMessage:g}=(0,s.Sv)(),p=(0,yt.Z)(),f=(0,o.sO)(null),I=(0,o.sO)(null),v=Boolean(n),{observe:w}=(0,ns.S1)({rootRef:a,debounceMs:200,threshold:1}),{isContextMenuOpen:y,contextMenuPosition:P,handleBeforeContextMenu:Z,handleContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:E}=(0,Fn.Z)(f,h.$b,!0,h.wZ),[S,M,R]=(0,It.Z)(!1);(0,o.d4)((()=>v?w(I.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,v,w,c]);const k=(0,o.I4)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?g({chatId:n.chatId,messageId:n.channelPostId}):(d({id:n.chatId}),n.startParam&&m({botId:n.chatId,param:n.startParam})))}),[g,n,d,u,m]);if(n)return o.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Xn.q)(e),Z(e)},onContextMenu:C},o.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},o.ZP.createElement("div",{className:"content-inner",dir:"auto"},o.ZP.createElement("div",{className:"message-title",dir:"ltr"},i&&(0,Sn.Z)((0,l.Js)(i)||""),r&&(0,Sn.Z)(n.chatInviteTitle||(0,l.U)(p,r,i)||"")),o.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:I},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,oa.H)(n.text.text,n.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},n.isRecommended?p("Message.RecommendedLabel"):p("SponsoredMessage")))),o.ZP.createElement(Rt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),P&&o.ZP.createElement(Xa,{isOpen:y,anchor:P,message:n,onAboutAds:M,onClose:b,onCloseAnimationEnd:E}),o.ZP.createElement(Wa,{isOpen:S,onClose:R}))}))),Ya=(0,o.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,messageIds:i,messageGroups:r,isViewportNewest:c,isUnread:d,withUsers:u,areReactionsInMeta:p,noAvatars:f,containerRef:I,anchorIdRef:v,memoUnreadDividerBeforeIdRef:w,memoFirstUnreadIdRef:y,threadId:P,type:Z,isReady:C,isScrollingRef:b,isScrollPatchNeededRef:E,threadTopMessageId:S,hasLinkedChat:M,isSchedule:R,noAppearanceAnimation:k,onFabToggle:T,onNotchToggle:A}=e;const{openHistoryCalendar:B}=(0,s.Sv)(),{observeIntersectionForReading:x,observeIntersectionForLoading:L,observeIntersectionForPlaying:O}=function(e,t,n){const{markMessageListRead:a,markMentionsRead:o,animateUnreadReaction:i}=(0,s.Sv)(),{observe:r,freeze:c,unfreeze:d}=(0,ns.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let s=0;const r=[],c=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:a}=n,o=Number(a.lastMessageId||a.messageId);o>s&&(s=o),a.hasUnreadMention&&r.push(o),a.hasUnreadReaction&&c.push(o)})),n.current&&s>=n.current&&a({maxId:s}),r.length&&o({messageIds:r}),c.length&&i({messageIds:c})}));(0,Je.Z)(c,d);const{observe:l}=(0,ns.S1)({rootRef:t,throttleMs:ss,margin:as}),{observe:u}=(0,ns.S1)({rootRef:t,throttleMs:ss});return{observeIntersectionForReading:r,observeIntersectionForLoading:l,observeIntersectionForPlaying:u}}(Z,I,y),{backwardsTriggerRef:F,forwardsTriggerRef:U,fabTriggerRef:j}=function(e,t,n,i,r,c,d,l,u,g){const{loadViewportMessages:p}=(0,s.Sv)(),[f,I]=(0,o.Ye)((()=>"thread"===e?[(0,N.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,N.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,n]),v=(0,o.sO)(null),w=(0,o.sO)(null),y=(0,o.sO)(null);function P(){if(!l)return;if(!n||!n.length)return c(!1),void d(!1);if(!i)return c(!0),void d(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:s,scrollTop:a}=t.current,o=Math.round(s-a-e),u=o<=1;c(r?!u:!(o<=50)),d(!u)}const{observe:Z}=(0,ns.S1)({rootRef:t,margin:h.gZ},(e=>{if(!I||!f)return;if(n[0]>a.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&&I()}));(0,ns._N)(v,Z),(0,ns._N)(w,Z);const{observe:C,freeze:b,unfreeze:E}=(0,ns.S1)({rootRef:t,margin:100},P);(0,ns._N)(y,C);const{observe:S,freeze:M,unfreeze:R}=(0,ns.S1)({rootRef:t,margin:1},P);return(0,ns._N)(y,S),(0,Ke.Z)((()=>{l&&P()}),[l]),(0,Ke.Z)((()=>{b(),M(),setTimeout((()=>{R(),E()}),250)}),[n]),{backwardsTriggerRef:v,forwardsTriggerRef:w,fabTriggerRef:y}}(Z,I,i,c,d,T,A,C,b,E),D=(0,yt.Z)(),q=o.ZP.createElement("div",{className:(0,_e.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,D("UnreadMessages"))),$=k?0: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)=>{if(1===e.length&&!zn(e[0])&&(0,l.FT)(e[0])&&!e[0].content.action?.phoneCall){const i=e[0],r=s===a.length-1&&t===n.length-1;return(0,g.oA)([i.id===w.current&&q,o.ZP.createElement(Ms,{key:i.id,message:i,observeIntersectionForReading:x,observeIntersectionForLoading:L,observeIntersectionForPlaying:O,memoFirstUnreadIdRef:y,appearanceOrder:$-++G,isLastInList:r})])}let i;return e.map(((r,c)=>{const d=zn(r)?r.mainMessage:r,m=zn(r)?r:void 0,h=(0,l.B4)(d),I=zn(r),C=e[c+1];d.previousLocalId&&v.current===(0,l.d0)(d.previousLocalId)&&(v.current=(0,l.d0)(d.id));const b=!I&&d.groupedId?d.groupedId:void 0,E=C&&!zn(C)?C.groupedId:void 0,R={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==i),isLastInDocumentGroup:Boolean(b&&b!==E),isLastInList:c===e.length-1&&s===a.length-1&&t===n.length-1};i=b;const k=(0,l.KK)(d),N=(0,l.jM)(d)?`${d.date}_${k}`:k;return(0,g.oA)([d.id===w.current&&q,o.ZP.createElement(za,{key:N,message:d,observeIntersectionForBottom:x,observeIntersectionForLoading:L,observeIntersectionForPlaying:O,album:m,noAvatars:f,withAvatar:R.isLastInGroup&&u&&!h&&!(d.id===S),withSenderName:R.isFirstInGroup&&u&&!h,areReactionsInMeta:p,threadId:P,messageListType:Z,noComments:!1===M,appearanceOrder:$-++G,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:y}),d.id===S&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,D("DiscussionStarted")))])})).flat()}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Xn.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,_e.Z)("sticky-date",!R&&"interactive"),key:"date-header",onMouseDown:Xn.q,onClick:R?void 0:()=>B({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===a.t4&&D("MessageScheduledUntilOnline"),R&&e.originalDate!==a.t4&&D("MessageScheduledOn",(0,z.j1)(D,e.datetime,void 0,!0)),!R&&(0,z.j1)(D,e.datetime))),s.flat())}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:F,key:"backwards-trigger",className:"backwards-trigger"}),H.flat(),!t&&c&&o.ZP.createElement(Ja,{key:n,chatId:n,containerRef:I}),o.ZP.createElement("div",{ref:U,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:j,key:"fab-trigger",className:"fab-trigger"}))}));var Ka=n(73547);const Qa=(0,o.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;const{stickers:s}=e.stickers.greeting,a=(0,l.db)(n)+(0,l.db)(e.currentUserId),o=s?.length?s[a%s.length]:void 0,i=(0,c.Z1)(e,n);return i?{sticker:o,lastUnreadMessageId:i.lastMessage&&i.lastMessage.id!==i.lastReadInboxMessageId?i.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:a}=e;const{loadGreetingStickers:i,sendMessage:r,markMessageListRead:c}=(0,s.Sv)(),d=(0,yt.Z)(),l=(0,o.sO)(null),{observe:u}=(0,ns.S1)({rootRef:l,debounceMs:200});(0,o.d4)((()=>{t||"connectionStateReady"!==n||i()}),[n,i,t]),(0,o.d4)((()=>{"connectionStateReady"===n&&a&&c({maxId:a})}),[n,c,a]);const m=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:l},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},d("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},d("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},t&&o.ZP.createElement(Ka.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),eo=(0,o.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:s}=e;const a=(0,yt.Z)();return"scheduled"===n?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(a):t?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("i",{className:"icon icon-cloud-download"}),o.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),o.ZP.createElement("ul",{className:"description"},o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(a):s?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},o.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),o.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),o.ZP.createElement("ul",{className:"list-checkmarks"},o.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(a):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,a("NoMessages")))})),to=(0,N.Ds)((e=>e()),200,!1),no=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,type:a}=t;const o=(0,c.Z1)(e,n);if(!o)return{};const r=(0,c.$W)(e,n,s,a),d="scheduled"===a?(0,c.Fn)(e,n):(0,c.Zw)(e,n),u=(0,c.qS)(e,n,s);if(s!==i._f&&!(d&&u&&d[u]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=o,p=(0,c.G$)(e,n),f=s===i._f&&!r&&!o.unreadCount&&!p&&g&&!g.groupedId,I=(0,c.IK)(e,n);let v,w=!1;return(0,c.pk)(e,n)&&(I.fullInfo?v=I.fullInfo.botInfo:w=!0),{isCurrentUserPremium:(0,c.wV)(e),isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,l.eA)(o),isGroupChat:(0,l.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,c.FM)(e,n),isRepliesChat:(0,l.pK)(n),isBot:Boolean(I),messageIds:r,messagesById:d,firstUnreadId:(0,c.It)(e,n,s),isViewportNewest:"thread"!==a||(0,c.b9)(e,n,s),threadFirstMessageId:(0,c.yZ)(e,n,s),focusingId:p,isSelectModeActive:(0,c.CA)(e),isLoadingBotInfo:w,botInfo:v,threadTopMessageId:u,hasLinkedChat:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...f&&{lastMessage:g}}}))((e=>{let{chatId:t,threadId:n,type:i,hasTools:r,onFabToggle:d,onNotchToggle:u,isCurrentUserPremium:p,isChatLoaded:f,isChannelChat:I,isGroupChat:v,canPost:w,isReady:y,isChatWithSelf:P,isRepliesChat:Z,isCreator:C,isBot:b,messageIds:E,messagesById:S,firstUnreadId:M,isViewportNewest:R,threadFirstMessageId:k,isRestricted:T,restrictionReason:A,focusingId:B,isSelectModeActive:x,lastMessage:L,isLoadingBotInfo:O,botInfo:F,threadTopMessageId:U,hasLinkedChat:j,lastSyncTime:D,withBottomShift:q,withDefaultBg:$}=e;const{loadViewportMessages:G,setScrollOffset:H,loadSponsoredMessages:V,loadMessageReactions:_,copyMessagesByIds:z}=(0,s.Sv)(),W=(0,o.sO)(null),X=(0,o.sO)("thread"===i&&(0,c.Vt)((0,s.Rd)(),t,n)||0),J=(0,o.sO)(),Y=(0,o.sO)(),K=(0,o.sO)(),Q=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(!1),se=(0,o.sO)(Boolean(L)),[ae,oe]=(0,o.eJ)(),ie=(0,fn.Z)(F?.photo?(0,l.NF)(F.photo):void 0),re=(0,fn.Z)(F?.gif?(0,l.ym)(F.gif):void 0),ce=F?.photo?(0,l.bV)(F.photo):F?.gif?(0,l.jC)(F.gif):void 0,de=ce&&{width:ce.width/h.cL,height:ce.height/h.cL},le=Boolean(E);(0,Ke.Z)((()=>{le&&(0,N.R3)((()=>{se.current=!1}))}),[le]),(0,Ke.Z)((()=>{Q.current=M}),[M]),(0,Ke.Z)((()=>{!p&&I&&y&&D&&V({chatId:t})}),[p,t,y,I,D]),(0,Ke.Z)((()=>{le&&(ee.current=Q.current)}),[le]),(0,Ke.Z)((()=>{te.current=B}),[B]),(e=>{(0,vt.y)({"Mod+C":function(t){const n=(0,Qn.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(z);const ue=(0,o.Ye)((()=>{if(!E||!S)return;const e=!U||E[0]&&k!==E[0]?E:[U,...E];if(!e.length)return;const t=e.map((e=>S[e])).filter(Boolean);return Wn((0,g.Xo)(t,["date","id"]),ee.current)}),[E,S,k,U]);(0,it.Z)((()=>{if(!E||!S)return;const e=E.filter((e=>S[e]?.reactions));e.length&&_({chatId:t,ids:e})}),15e3);const me=(0,o.Ye)((()=>{if("thread"===i)return(0,N.Ds)((()=>G({direction:m.Uq.Around})),1e3,!0,!1)}),[G,E]),{isScrolled:he,updateStickyDates:ge}=function(){const[e,t]=(0,It.Z)(!1),n=(0,Kn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,N.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,N.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:a}=e,o=n-s;return-a<=o&&o<=(t?60:10)}))}(e,s);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),pe=(0,o.sO)(),fe=(0,o.sO)(),Ie=(0,o.I4)((()=>{if(ne.current)return void(ne.current=!1);const e=W.current;e&&(pe.current=!0,te.current||ge(e,r),to((()=>{pe.current=!1,(0,N.T2)((()=>{e.parentElement&&(X.current=e.scrollHeight-e.scrollTop,"thread"===i&&H({chatId:t,threadId:n,scrollOffset:X.current}))}))})))}),[ge,r,i,H,t,n]),ve=(0,o.I4)((e=>{oe(e.contentRect.height)}),[]);(0,ts.y)(W,ve);const{height:we}=(0,an.Z)();(0,o.d4)((()=>{W.current.dataset.normalHeight=String(W.current.offsetHeight)}),[we,w]),(0,o.d4)((()=>{if(!me||!f||T||B)return;if(E&&E[E.length-1]>a.MP)return;const e=W.current;(!E||E.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&me()}),[f,E,me,B,T]),(0,Ke.Z)((()=>{if(!E||!K.current)return;const e=K.current.filter((e=>E.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(J.current=t.id,Y.current=t.getBoundingClientRect().top)}),[E,R,ae,r]),(0,es.Z)((e=>{let[t,n,s]=e;const o=W.current;K.current=Array.from(o.querySelectorAll(".message-list-item"));const i=E&&t&&E[E.length-1]!==t[t.length-1],c=E?.[0]!==t?.[0]&&E?.length===a.hT/2+1,d=i&&!c,l=E&&te.current===E[E.length-1],u=R&&d&&E&&E.length<a.hT/2&&!o.parentElement.classList.contains("force-messages-scroll")&&o.firstElementChild.clientHeight<=2*o.offsetHeight;u&&(o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&o.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:m,scrollHeight:h,offsetHeight:g}=o,p=X.current,f=K.current[K.current.length-1];let I=p-(s||g);d&&(I-=f?f.offsetHeight:0);const v=R&&n&&I<=50;let w;if(d&&v&&!l&&(f&&(0,N.T2)((()=>{(0,Yn.Z)(o,f,"end",20)})),w=h-g,X.current=Math.max(Math.ceil(h-w),g),!u))return;const y=void 0!==s&&s!==ae,P=J.current&&o.querySelector(`#${J.current}`),Z=!P&&ee.current&&o.querySelector(".unread-divider");if(v&&y){if((0,Yn.N)())return;w=h-g}else P?(fe.current&&(fe.current=!1,(0,Jn.z)(o)),w=m+(P.getBoundingClientRect().top-(Y.current||0))):w=Z?Math.min(Z.offsetTop-(r?60:10),h-p):h-p;(0,Jn.Z)(o,Math.ceil(w)),te.current||(ne.current=!0,(0,N.T2)((()=>{ne.current=!1}))),X.current=Math.max(Math.ceil(h-w),g)}),[E,R,ae,r]),(0,Xe.Z)((e=>{let[t]=e;void 0!==t&&(0,ot.YW)(200+a.fK)}),[x]);const ye=(0,yt.Z)(),Pe=Boolean(t&&(0,l.YC)(t)),Ze=Boolean(!Pe&&!I||P||Z),Ce=Boolean(!Ze||I),be=(0,l.YC)(t)&&!P&&!b&&(!ue&&!L&&E&&(!K.current||0===K.current.length)||1===E?.length&&"contactSignUp"===S?.[E[0]]?.content.action?.type||"contactSignUp"===L?.content?.action?.type),Ee=v&&C&&1===E?.length&&"chatCreate"===S?.[E[0]]?.content.action?.type,Se=(0,_e.Z)("MessageList custom-scroll",Ce&&"no-avatars",!w&&"no-composer","pinned"===i&&"type-pinned",q&&"with-bottom-shift",$&&"with-default-bg",x&&"select-mode-active",he&&"scrolled",!y&&"is-animating");return o.ZP.createElement("div",{ref:W,className:Se,onScroll:Ie,onMouseDown:Xn.q},T?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,A?A.text:"This is a private "+(I?"channel":"chat"))):F?o.ZP.createElement("div",{className:"empty"},O&&o.ZP.createElement("span",null,ye("Loading")),!F&&!O&&o.ZP.createElement("span",null,ye("NoMessages")),F&&o.ZP.createElement("div",{className:"bot-info",style:de&&`width: ${de.width}px`},ie&&o.ZP.createElement("img",{src:ie,width:de?.width,height:de?.height,alt:"Bot info"}),re&&o.ZP.createElement(ta.Z,{canPlay:!0,src:re,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),ce&&!ie&&!re&&o.ZP.createElement(fa.Z,{width:de?.width,height:de?.height}),F.description&&o.ZP.createElement("div",{className:"bot-info-description"},o.ZP.createElement("p",{className:"bot-info-title"},ye("BotInfoTitle")),(0,Sn.Z)(F.description,["br","emoji","links"])))):be?o.ZP.createElement(Qa,{userId:t}):!E||ue&&!Ee?E&&ue||L?o.ZP.createElement(Ya,{isCurrentUserPremium:p,chatId:t,messageIds:E||[L.id],messageGroups:ue||Wn([L]),isViewportNewest:Boolean(R),isUnread:Boolean(M),withUsers:Ze,areReactionsInMeta:Pe,noAvatars:Ce,containerRef:W,anchorIdRef:J,memoUnreadDividerBeforeIdRef:ee,memoFirstUnreadIdRef:Q,threadId:n,type:i,isReady:y,isScrollingRef:pe,isScrollPatchNeededRef:fe,threadTopMessageId:U,hasLinkedChat:j,isSchedule:!!ue&&"scheduled"===i,noAppearanceAnimation:!ue||!se.current,onFabToggle:d,onNotchToggle:u}):o.ZP.createElement(qt.Z,{color:"white",backgroundColor:"dark"}):o.ZP.createElement(eo,{chatId:t,type:i,isChatWithSelf:P,isGroupChatJustCreated:Ee}))}))),so=(0,o.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:s,onClick:a,onReadAll:i,className:r}=e;const c=(0,yt.Z)(),d=(0,o.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,Fn.Z)(d,!i);return o.ZP.createElement("div",{className:(0,_e.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},o.ZP.createElement(Rt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:a,onContextMenu:u,ariaLabel:c(n)},o.ZP.createElement("i",{className:(0,_e.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(s)&&o.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,ut.bi)(s)),i&&o.ZP.createElement(Ht.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},o.ZP.createElement(Mt.Z,{icon:"readchats",onClick:i},c("MarkAllAsRead"))))})),ao=(0,o.X$)((0,s.c$)((e=>{const t=(0,c.Bt)(e);if(!t)return{};const{chatId:n,threadId:s,type:a}=t,o=(0,c.Z1)(e,n),r=o&&s===i._f&&"thread"===a;return{messageListType:a,chatId:n,reactionsCount:r?o.unreadReactionsCount:void 0,mentionsCount:r?o.unreadMentionsCount:void 0,unreadCount:r?o.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:a,chatId:i,unreadCount:r,reactionsCount:c,mentionsCount:d,withExtraShift:l}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:I}=(0,s.Sv)(),v=(0,o.sO)(null),w=Boolean(c),y=Boolean(d);(0,o.d4)((()=>{w&&i&&g({chatId:i})}),[i,g,w]),(0,o.d4)((()=>{y&&i&&I({chatId:i})}),[i,I,y]);const P=(0,o.I4)((()=>{if(t)if("thread"===a)u();else{const e=v.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Yn.Z)(e,n,"end",20)}}),[t,a,u]),Z=(0,_e.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(d))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(d))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!l&&"S98OqutuQVCNVHgTrKv4");return o.ZP.createElement("div",{ref:v,className:Z},w&&o.ZP.createElement(so,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),y&&o.ZP.createElement(so,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d}),o.ZP.createElement(so,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:P,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var oo=n(65723);const io=1280,ro=/\.[^/.]+$/;async function co(e,t,s,o){const i=URL.createObjectURL(t),{type:r,size:c}=t;let d,l,u;if(a.oG.has(r))if(s){const t=await(0,sn.pt)(i),{width:n,height:s}=t,a=n>io||s>io;if(a||"image/jpeg"!==r){const t=await Nn(i,a?io/Math.max(n,s):1,"image/jpeg");return URL.revokeObjectURL(i),co(e,await(0,sn.gm)(t),!0,o)}"image/jpeg"===r&&(e=e.replace(ro,".jpg")),d={width:n,height:s}}else u=i;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,sn.jj)(i);d={width:e,height:t,duration:n},u=await(0,sn.ud)(i)}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:o,artist:i,picture:r},format:{duration:c}}=a,d=s(r);return{title:o,performer:i,duration:c,coverUrl:d?`data:${d.format};base64,${d.data.toString("base64")}`:void 0}}(i);l={duration:e||0,title:t,performer:s},u=a}return{blobUrl:i,filename:e,mimeType:r,size:c,quick:d,audio:l,previewBlobUrl:u,...o}}var lo=n(41098),uo=n(96391);let mo;function ho(e){mo.focus(),e.focus()}h.cj&&(mo=document.createElement("input"),mo.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(mo));var go=n(74288),po=n(94462),fo=n(52400);const Io=new RegExp(`^${a.t8.source}$`,"g");var vo=n(56389),wo=n(70971);const yo={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},Po={type:"audio/ogg"};let Zo,Co,bo;async function Eo(){return Zo||(Zo=n.e(1161).then(n.t.bind(n,1161,23)),Co=(await Zo).default,bo=new Co(yo)),Zo}async function So(e){await async function(){await Eo(),await bo.start()}();const t=Date.now();let n;const s=[],a=[];bo.ondataavailable=e=>{s.push(e)};const o=function(t,n){const s=t.sourceNode,o=s.context.createAnalyser();o.fftSize=64,s.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{a.push(255*t),e(t)})(n<.1?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(bo);return{stop:()=>new Promise(((e,i)=>{bo.onstop=()=>{e({blob:new Blob(s,Po),duration:Math.round(((n||Date.now())-t)/1e3),waveform:a})},bo.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{bo.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{bo.pause(),n=Date.now(),o()}),e)}}}var Mo=n(21262),Ro=n(56266);const ko=["image/png","image/jpeg","image/gif"],No=/<style>(.*?)<\/style>/gs;let To,Ao;var Bo=n(72162),xo=n(29295);function Lo(e,t,n){const[s,a]=(0,o.eJ)(),{isFrozen:i,updateWhenUnfrozen:r}=function(){const e=(0,o.sO)(!1),t=(0,o.I4)((()=>{e.current=!0}),[]),n=(0,st.Z)(),s=(0,o.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,ot.ZP)(Oo,s),{isFrozen:(0,ot.zG)(),updateWhenUnfrozen:t}}(),c=(0,Kn.Z)(t,!0);return(0,Ke.Z)((()=>{i?r():c((()=>{a(e())}))}),[...n,i]),s}function Oo(){}const Fo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Uo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,jo={username:"",query:"",canShowHelp:!1,usernameLowered:""},Do=document.createElement("div");const qo=(0,N.P2)((e=>e()),500,!0),$o=/^[\w@]{1,32}\s?/i;var Go=n(33057),Ho=n(60130);const Vo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function _o(){return _o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_o.apply(this,arguments)}let zo,Wo=!0;const Xo=(0,o.X$)((e=>{let{onActivate:t,...n}=e;const s=(0,o.sO)(!1),a=(0,o.I4)((()=>{if(s.current=!0,Wo)return Wo=!1,void t();zo&&(clearTimeout(zo),zo=void 0),zo=window.setTimeout((()=>{s.current&&t()}),200)}),[t]),i=(0,o.I4)((()=>{s.current=!1}),[]),r=(0,o.I4)((()=>{s.current=!0,t()}),[t]);return o.ZP.createElement(Rt.Z,_o({},n,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:i,onClick:h.$b?r:t}))}));var Jo=n(85655),Yo=n(56503),Ko=n(62898);const Qo="N3E1geoPu1vesCKf545F",ei=/#fff/gi,ti=(0,o.X$)((e=>{let{icon:t,theme:n}=e;const s=(0,fn.Z)((0,l.ym)(t),!1,i.IU.Text),a=(0,o.Ye)((()=>{if(!s)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=s.replace(ei,e),a=(new DOMParser).parseFromString(t,"image/svg+xml");return a.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${a.documentElement.outerHTML}`}),[s,n]);return o.ZP.createElement("i",{className:(0,_e.Z)("vL8HfVVnjTeFmp1ECFj8",h.FW&&Qo)},o.ZP.createElement("img",{src:a,alt:"",className:(0,_e.Z)("Fb4aIyDYEwOlaqY8oZkV",h.FW&&Qo)}))})),ni=(0,o.X$)((e=>{let{bot:t,theme:n,chatId:a,onMenuOpened:i,onMenuClosed:r}=e;const{callAttachBot:c,toggleAttachBot:d}=(0,s.Sv)(),l=(0,yt.Z)(),u=(0,o.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[m,h,g]=(0,It.Z)(),[p,f]=(0,o.eJ)(void 0),I=(0,o.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();f({x:t.right,y:t.bottom}),i(),h()}),[i,h]),v=(0,o.I4)((()=>{g(),r()}),[g,r]),w=(0,o.I4)((()=>{f(void 0)}),[]),y=(0,o.I4)((()=>{d({botId:t.id,isEnabled:!1})}),[t.id,d]);return o.ZP.createElement(Mt.Z,{key:t.id,customIcon:u&&o.ZP.createElement(ti,{icon:u,theme:n}),icon:u?void 0:"bots",onClick:()=>c({botId:t.id,chatId:a}),onContextMenu:I},t.shortName,p&&o.ZP.createElement(Ko.Z,null,o.ZP.createElement(Ht.Z,{isOpen:m,positionX:"right",style:`left: ${p.x}px;top: ${p.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:v,onCloseAnimationEnd:w},o.ZP.createElement(Mt.Z,{icon:"stop",destructive:!0,onClick:y},l("WebApp.RemoveBot")))))})),si=(0,o.X$)((e=>{let{chatId:t,isButtonVisible:n,canAttachMedia:s,canAttachPolls:i,attachBots:r,peerType:c,isScheduled:d,onFileSelect:l,onPollCreate:u,theme:m}=e;const[g,p,f]=(0,It.Z)(),[I,v,w]=(0,Yo.Z)(g,f),[y,P,Z]=(0,It.Z)();(0,o.d4)((()=>{g&&w()}),[g,w]);const C=(0,o.I4)((()=>{g?f():p()}),[g,p,f]),b=(0,o.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&l(Array.from(n),t)}),[l]),E=(0,o.I4)((()=>{(0,Jo.g)(Array.from(a.dI).join(","),(e=>b(e,!0)))}),[b]),S=(0,o.I4)((()=>{(0,Jo.g)("*",(e=>b(e,!1)))}),[b]),M=(0,o.Ye)((()=>Object.values(r).filter((e=>!!c&&(!("bots"!==c||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(c))))),[r,t,c]),R=(0,yt.Z)();if(n)return o.ZP.createElement("div",{className:"AttachMenu"},o.ZP.createElement(Xo,{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},o.ZP.createElement("i",{className:"icon-attach"})),o.ZP.createElement(Ht.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:I,onMouseLeave:h.$b?void 0:v,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!s&&o.ZP.createElement(Mt.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),s&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Mt.Z,{icon:"photo",onClick:E},R("AttachmentMenu.PhotoOrVideo")),o.ZP.createElement(Mt.Z,{icon:"document",onClick:S},R("AttachDocument"))),i&&o.ZP.createElement(Mt.Z,{icon:"poll",onClick:u},R("Poll")),s&&!d&&M.map((e=>o.ZP.createElement(ni,{bot:e,chatId:t,theme:m,onMenuOpened:P,onMenuClosed:Z})))))})),ai=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),oi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),ii=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var ri=n(67146);const ci=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var di=n(93219),li=n(19830);const ui=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),mi=(0,o.X$)((0,s.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:s}=(0,c.Bt)(e)||{};return s?{message:(0,c.hj)(e,s,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:a}=e;const{clickBotInlineButton:i}=(0,s.Sv)(),[r,c]=(0,Yo.Z)(t,a),{isKeyboardSingleUse:d}=n||{};if(n&&n.keyboardButtons)return o.ZP.createElement(Ht.Z,{isOpen:t,autoClose:d,positionX:"right",positionY:"bottom",onClose:a,className:"BotKeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:h.$b?void 0:r,onMouseLeave:h.$b?void 0:c,noCompact:!0},o.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Rt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>i({messageId:n.id,button:e})},e.text))))))))})));var hi=n(49841),gi=n(17891),pi=n(63394),fi=n(66902);const Ii=(0,o.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,type:s}=(0,c.Bt)(e)||{};if(!t||!n||!s)return{};const{forwardMessages:{fromChatId:a,toChatId:o,messageIds:i,noAuthors:r,noCaptions:d}}=e,u=(0,c.Yy)(e,t,n),m="scheduled"===s?(0,c.wU)(e,t):(0,c._$)(e,t,n),h=e.settings.byKey.animationLevel>=1,g=o===t,p=i?.map((t=>(0,c.hj)(e,a,t)));let f,I;if(u?f=(0,c.hj)(e,t,u):m?f=(0,c.kK)(e,t,n,s):g&&1===i.length&&(f=p?.[0]),u&&f){const{forwardInfo:n}=f,s=(0,c.FM)(e,t);n&&(n.isChannelPost||s)&&(I=(0,c.cv)(e,f)),I||n?.hiddenUserName||(I=(0,c.Ur)(e,f))}else g&&(f&&(I=(0,c.cv)(e,f),I||(I=(0,c.Ur)(e,f))),I||(I=(0,l.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a)));const v=p?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:u,editingId:m,message:f,sender:I,shouldAnimate:h,forwardedMessagesCount:g?i.length:void 0,noAuthors:r,noCaptions:d,forwardsHaveCaptions:v,isCurrentUserPremium:(0,c.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:a,sender:i,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:u,forwardsHaveCaptions:m,isCurrentUserPremium:h,onClear:g}=e;const{setReplyingToId:p,setEditingId:f,focusMessage:I,changeForwardRecipient:v,setForwardNoAuthors:w,setForwardNoCaptions:y,exitForwardMode:P}=(0,s.Sv)(),Z=(0,o.sO)(null),C=(0,yt.Z)(),b=Boolean(c),E=Boolean((t||n)&&a||i&&c),S=(0,gi.Z)([c],c?300:void 0),{shouldRender:M,transitionClassNames:R}=(0,at.Z)(S&&E,void 0,!r,void 0,!r),k=(0,o.I4)((()=>{t?p({messageId:void 0}):n?f({messageId:void 0}):c&&P(),g?.()}),[t,n,c,g,p,f,P]);(0,o.d4)((()=>E?(0,pt.Z)(k):void 0),[E,k]);const N=(0,o.I4)((()=>{b||I({chatId:a.chatId,messageId:a.id})}),[I,b,a]),T=(0,o.I4)((e=>{e.stopPropagation(),k()}),[k]),A=(0,o.I4)((()=>{v()}),[v]),{isContextMenuOpen:B,contextMenuPosition:x,handleContextMenu:L,handleContextMenuClose:O,handleContextMenuHide:F}=(0,Fn.Z)(Z),U=(0,o.I4)((()=>Z.current),[]),j=(0,o.I4)((()=>Z.current),[]),D=(0,o.I4)((()=>Z.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:q,positionY:$,transformOriginX:G,transformOriginY:H,style:V}=(0,pi.Z)(x,U,j,D),_=(0,_e.Z)("ComposerEmbeddedMessage",R),z=(0,o.Ye)((()=>t?"icon-reply":n?"icon-edit":b?"icon-forward":void 0),[n,b,t]),W=c&&c>1?C("ForwardedMessageCount",c):void 0,X=(0,o.Ye)((()=>{if(!a||!b||!a.content.text||!d||h)return a;const e=(0,l.If)(a.content.text);return{...a,content:{...a.content,text:e}}}),[h,b,a,d]);if(M)return o.ZP.createElement("div",{className:_,ref:Z,onContextMenu:L,onClick:L},o.ZP.createElement("div",null,o.ZP.createElement("div",{className:"embedded-left-icon"},o.ZP.createElement("i",{className:z})),o.ZP.createElement(Rs,{className:"inside-input",message:X,sender:d?void 0:i,customText:W,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:N,hasContextMenu:b}),o.ZP.createElement(Rt.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:T},o.ZP.createElement("i",{className:"icon-close"})),b&&o.ZP.createElement(Ht.Z,{isOpen:B,transformOriginX:G,transformOriginY:H,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:O,onCloseAnimationEnd:F},o.ZP.createElement(Mt.Z,{icon:d?void 0:"message-succeeded",customIcon:d?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>w(!1)},C(c>1?"ShowSenderNames":"ShowSendersName")),o.ZP.createElement(Mt.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:o.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>w(!0)},C(c>1?"HideSenderNames":"HideSendersName")),m&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(fi.Z,null),o.ZP.createElement(Mt.Z,{icon:u?void 0:"message-succeeded",customIcon:u?o.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>y(!1)},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),o.ZP.createElement(Mt.Z,{icon:u?"message-succeeded":void 0,customIcon:u?void 0:o.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>y(!0)},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),o.ZP.createElement(fi.Z,null),o.ZP.createElement(Mt.Z,{icon:"replace",onClick:A},C("ChangeRecipient")))))}))),vi=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,dt.Z)(ct.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),wi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),yi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),Pi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),Zi=new RegExp(a.FM,"i"),Ci=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s}=t;const a=(0,c.tV)(e,n,s);return{theme:(0,c.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:a}}))((e=>{let{chatId:t,threadId:n,messageText:a,disabled:r,webPagePreview:c,noWebPage:d,theme:l}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,s.Sv)(),g=Lo((()=>{const{text:e,entities:t}=(0,f.Z)(a),n=t?.find((e=>e.type===i.Vv.TextUrl));if(n)return n.url;const s=e.match(Zi);return s?s[0]:void 0}),300,[a]);(0,o.d4)((()=>{g?u({text:g}):(m(),h({chatId:t,threadId:n}))}),[t,h,m,g,u,n]),(0,Ke.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&a.length&&!d&&!r),{shouldRender:I,transitionClassNames:v}=(0,at.Z)(p),w=(0,ln.Z)(c,!0),y=(0,o.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!I||!w)return;const{photo:P,...Z}=w,C={content:{webPage:Z}};return o.ZP.createElement("div",{className:(0,_e.Z)("WebPagePreview",v)},o.ZP.createElement("div",null,o.ZP.createElement("div",{className:"WebPagePreview-left-icon"},o.ZP.createElement("i",{className:"icon-link"})),o.ZP.createElement(pa,{message:C,inPreview:!0,theme:l}),o.ZP.createElement(Rt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},o.ZP.createElement("i",{className:"icon-close"}))))}))),bi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Ei=(0,o.X$)((e=>{let{isOpen:t,onClick:n,text:s,isDisabled:a}=e;const i=(0,o.sO)(null);return(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,s]),(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),o.ZP.createElement(Rt.Z,{className:(0,_e.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:a,onClick:n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:(0,_e.Z)("bot-menu-icon","icon-webapp",t&&"open")}),o.ZP.createElement("span",{ref:i,className:"bot-menu-text"},s))}));var Si;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(Si||(Si={}));const Mi="wonderful-voice-message.ogg",Ri=(0,o.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:s,threadId:o,messageListType:r}=t;const d=(0,c.Z1)(e,s),u=s!==a.FV?(0,c.IK)(e,s):void 0,m=Boolean(u),h=(0,c.FM)(e,s),g=m&&(0,c.FT)(e,s),p=(0,c.qy)(e,s),{language:f,shouldSuggestStickers:I,shouldSuggestCustomEmoji:v}=e.settings.byKey,w=e.emojiKeywords[a.pR],y=f!==a.pR?e.emojiKeywords[f]:void 0,P=g?g.id:void 0,Z=P?(0,c.hj)(e,s,P):void 0,{currentUserId:C}=e,b=d?.fullInfo?d?.fullInfo?.sendAsId||C:void 0,E=d?.sendAsPeerIds&&b&&d.sendAsPeerIds.some((e=>e.id===b))?b:d?.adminRights?.anonymous?d?.id:void 0,S=E?(0,c.dy)(e,E):void 0,M=!S&&E?(0,c.Z1)(e,E):void 0,R=(0,c.uH)(e,s),k=(0,c.nA)(e,s),N=(0,c.Bt)(e),T=s===N?.chatId&&o===N?.threadId&&r===N?.type,A=(0,c.dy)(e,s),B=null===(n=A&&!A.fullInfo?.noVoiceMessages)||void 0===n||n,x="scheduled"===r?(0,c.hI)(e,s):(0,c.s)(e,s,o);return{editingMessage:(0,c.kK)(e,s,o,r),connectionState:e.connectionState,draft:(0,c.Ms)(e,s,o),chat:d,isChatWithBot:m,isChatWithSelf:h,isForCurrentMessageList:T,canScheduleUntilOnline:(0,c.Eh)(e,s),isChannel:d?(0,l.eA)(d):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:o===i._f&&"thread"===r&&Boolean(p?.length),shouldSchedule:"scheduled"===r,botKeyboardMessageId:P,botKeyboardPlaceholder:Z?.keyboardPlaceholder,isForwarding:s===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:d?.fullInfo?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:C,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:I,shouldSuggestCustomEmoji:v,recentEmojis:e.recentEmojis,baseEmojiKeywords:w?.keywords,emojiKeywords:y?.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:d?.fullInfo&&d.fullInfo.botCommands,botCommands:u?.fullInfo?u.fullInfo.botInfo?.commands||!1:void 0,botMenuButton:u?.fullInfo?.botInfo?.menuButton,sendAsUser:S,sendAsChat:M,sendAsId:E,editingDraft:x,requestedDraftText:R,requestedDraftFiles:k,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,c.t)(e,s),theme:(0,c.Pu)(e),fileSizeLimit:(0,$.M)(e,"uploadMaxFileparts")*a.pJ,captionLimit:(0,$.M)(e,"captionLength"),isCurrentUserPremium:(0,c.wV)(e),canSendVoiceByPrivacy:B}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:I,messageListType:v,draft:w,chat:y,isForCurrentMessageList:P,isCurrentUserPremium:Z,canSendVoiceByPrivacy:C,connectionState:b,isChatWithBot:E,isChatWithSelf:S,isChannel:M,fileSizeLimit:R,isRightColumnShown:k,isSelectModeActive:T,isForwarding:A,pollModal:B,botKeyboardMessageId:x,botKeyboardPlaceholder:L,withScheduledButton:O,stickersForEmoji:F,customEmojiForEmoji:U,groupChatMembers:j,topInlineBotIds:D,currentUserId:q,captionLimit:$,lastSyncTime:G,contentToBeScheduled:H,shouldSuggestStickers:V,shouldSuggestCustomEmoji:_,baseEmojiKeywords:W,emojiKeywords:X,recentEmojis:J,inlineBots:Y,isInlineBotLoading:K,botCommands:Q,chatBotCommands:ee,sendAsUser:te,sendAsChat:ne,sendAsId:se,editingDraft:ae,requestedDraftText:oe,requestedDraftFiles:ie,botMenuButton:re,attachBots:ce,attachMenuPeerType:de,theme:le}=e;const{sendMessage:ue,clearDraft:me,showDialog:he,setStickerSearchQuery:ge,setGifSearchQuery:pe,forwardMessages:fe,openPollModal:Ie,closePollModal:ve,loadScheduledHistory:we,openChat:ye,addRecentEmoji:Pe,sendInlineBotResult:Ze,loadSendAs:Ce,resetOpenChatWithDraft:be,callAttachBot:Ee,openLimitReachedModal:Me,openPremiumModal:Re,addRecentCustomEmoji:ke,showNotification:Ne}=(0,s.Sv)(),Te=(0,yt.Z)(),Ae=(0,o.sO)(null),[Be,xe]=(0,o.eJ)(""),Le=(0,wo.Y)(Be),Oe=(0,o.sO)(),Fe=(0,rn.Z)(t),{width:Ue}=Se.Z.get(),je=y?.sendAsPeerIds,De=je&&(je.length>1||!je.some((e=>e.id===q))),[qe,$e,Ge]=(0,It.Z)(),He=(0,vo.Z)(g,I),Ve=(0,o.I4)((e=>{xe(e),requestAnimationFrame((()=>{(0,go.AU)()}))}),[]),ze=(0,o.sO)(0),We=(0,o.I4)((()=>{Ge()}),[Ge]),[Qe,et]=(0,Go.Z)(r,We);(0,o.d4)((()=>{Oe.current=void 0}),[g]),(0,o.d4)((()=>{g&&G&&I===i._f&&c&&we({chatId:g})}),[c,g,we,G,I]),(0,o.d4)((()=>{g&&y&&G&&!je&&c&&(0,l.ZV)(y)&&Ce({chatId:g})}),[y,g,c,G,Ce,je]);const tt=(0,o.sO)(!1);(0,Ke.Z)((e=>{let[t,n]=e;tt.current=Boolean(g===t&&je&&!n)}),[g,je]),(0,o.bt)((()=>{Ae.current&&(Ae.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')}),[]);const[nt,st]=(0,o.eJ)([]),[at,ot,rt]=(0,It.Z)(),[ct,dt,lt]=(0,It.Z)(),[ut,mt,ht]=(0,It.Z)(),[gt,ft,vt]=(0,It.Z)(),[wt,Pt,Zt]=(0,It.Z)(),[Ct,bt]=(0,It.Z)(),[Et,St,Mt]=(0,It.Z)(),kt=(0,o.I4)((e=>{const t="function"==typeof e?e(nt):e;t&&t.some((e=>e.size>R))?Me({limit:"uploadMaxFileparts"}):st(t)}),[nt,R,Me]),{startRecordingVoice:Nt,stopRecordingVoice:Tt,pauseRecordingVoice:At,activeVoiceRecording:xt,currentRecordTime:Lt,recordButtonRef:Ot,startRecordTimeRef:Ft}=(()=>{const e=(0,o.sO)(null),[t,n]=(0,o.eJ)(),s=(0,o.sO)(),[a,i]=(0,o.eJ)();(0,o.d4)((()=>{h.s$&&h.mh&&Eo()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:a}=await So((t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),i(Date.now()))}));s.current=Date.now(),i(Date.now()),n({stop:t,pause:a})}catch(e){console.error(e)}}),[]),c=(0,o.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),d=(0,o.I4)((()=>{if(t){n(void 0),s.current=void 0,i(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,o.d4)((()=>t?(0,pt.Z)(d):void 0),[t,d]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:d,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:s}})();(0,it.Z)((()=>{He({type:"recordAudio"})}),xt&&a.o_),(0,o.d4)((()=>{xt||He({type:"cancel"})}),[xt,He]),(0,o.d4)((()=>{Be&&!m&&He({type:"typing"})}),[m,Be,He]);const Ut=m?Si.Edit:!h.mh||xt||Be&&!nt.length||A?n?Si.Schedule:Si.Send:Si.Record,jt=!n,{isMentionTooltipOpen:Dt,closeMentionTooltip:qt,insertMention:$t,mentionFilteredUsers:Gt}=(0,xo.Z)(!nt.length,a.Ed,Ve,j,D,q),{isOpen:Ht,id:Vt,isGallery:_t,switchPm:zt,results:Wt,closeTooltip:Xt,help:Jt,loadMore:Yt}=function(e,t,n,a){const{queryInlineBot:i,resetInlineBot:r}=(0,s.Sv)(),[c,d,l]=(0,It.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=Lo((()=>function(e){const t=function(e){return Do.innerHTML=e.replace(/<br>/g,"\n"),Do.innerText}(e),n=t.match(Fo);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Uo),usernameLowered:n[1].toLowerCase()}:jo}(n)),300,[n])||{},p=(0,rn.Z)(m),f=(0,rn.Z)(u),I=g?a?.[g]:void 0,{id:v,switchPm:w,offset:y,results:P,isGallery:Z,help:C}=I||{};(0,o.d4)((()=>{p!==m&&l()}),[p,m,l]),(0,o.d4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m})}),[m,e,i,t,g]);const b=(0,o.I4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m,offset:y})}),[e,g,t,i,m,y]);return(0,o.d4)((()=>{e&&v&&(w||P?.length)?d():l()}),[v,e,d,P,w,l]),f!==u&&r({username:f}),{isOpen:c,id:v,isGallery:Z,switchPm:w,results:P,closeTooltip:l,help:h&&C?`@${u} ${C}`:void 0,loadMore:b}}(Boolean(!nt.length&&G),g,Be,Y),{isOpen:Kt,close:Qt,filteredBotCommands:en}=function(e,t,n,s){const[a,i,r]=(0,It.Z)(),[c,d]=(0,o.eJ)(),l=(0,o.I4)((e=>{n||s?qo((()=>{const t=(n||s||[]).filter((t=>{let{command:n}=t;return!e||n.includes(e)}));d(t&&t.length?t:void 0)})):d(void 0)}),[n,s]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,fo._)(t.substr(1)).match($o);l(e?e[0]:"")}else d(void 0);else d(void 0)}),[l,t,e,r]),(0,o.d4)((()=>{c&&c.length&&t.length>0?i():r()}),[c,t.length,i,r]),{isOpen:a,close:r,filteredBotCommands:c}}(Boolean(Q&&Q.length||ee&&ee.length),Be,Q,ee),{isContextMenuOpen:nn,handleContextMenu:an,handleContextMenuClose:on,handleContextMenuHide:cn}=(0,Fn.Z)(Ot,!(Ut===Si.Send&&jt)),{canSendStickers:dn,canSendGifs:ln,canAttachMedia:un,canAttachPolls:mn,canAttachEmbedLinks:hn}=(0,o.Ye)((()=>(0,l.H5)(y,E)),[y,E]),gn=y&&(0,l.Nl)(y),pn=(0,l.Hd)(y),{isStickerTooltipOpen:fn,closeStickerTooltip:In}=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=(0,o.Ye)((()=>(0,fo._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,s.Sv)(),d=h.op&&1===(0,po.Z)(i)||!h.op&&Boolean(t.match(Io)),l=Boolean(n?.length)&&d;return(0,o.d4)((()=>{a||(e&&d?r({emoji:h.op?i:i.match(/alt="(.+)"/)?.[1]}):!l&&d||c())}),[t,d,c,r,e,a]),{isStickerTooltipOpen:l,closeStickerTooltip:c}}(Boolean(V&&dn&&!nt.length),Be,F,!c),{isCustomEmojiTooltipOpen:vn,closeCustomEmojiTooltip:wn,insertCustomEmoji:yn}=(0,Ho.Z)(Boolean(_&&!nt.length),a.Ed,Be,Ve,U,!c),{isEmojiTooltipOpen:Pn,closeEmojiTooltip:Zn,filteredEmojis:Cn,filteredCustomEmojis:bn,insertEmoji:En,insertCustomEmoji:Mn}=(0,Bo.Z)(Boolean(V&&dn&&!nt.length),Le,J,void 0,Ve,W,X,!c),Rn=(0,o.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,uo.R)(a,t))return(0,lo.t)(e),void s.dispatchEvent(new Event("input",{bubbles:!0}))}Ve(`${Le.current}${e}`),requestAnimationFrame((()=>{(0,oo.Z)(s)}))}),[Le,Ve]),kn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=(0,oa.z)(e);Rn(n,t)}),[Rn]),Nn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=(0,Sn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Rn(n,t)}),[Rn]),Tn=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;Rn((0,Cs.yR)(e),t)}),[Rn]),An=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,uo.R)(t,a.R2))return void document.execCommand("delete",!1)}Ve(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const s=n.textContent.length,a=document.createRange(),o=window.getSelection();a.setStart(n,s),a.setEnd(n,s),o.removeAllRanges(),o.addRange(a),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(Le.current))}),[Le,Ve]),Bn=(0,o.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ve(""),st(d.D),In(),wn(),qt(),Zn(),h.wB?setTimeout((()=>ht()),350):ht()}),[In,wn,qt,Zn,ht,Ve]),xn=(0,o.sO)();xn.current=Tt,(0,o.d4)((()=>()=>{xn.current(),Bn()}),[g,Bn,xn]);const Ln=(0,o.I4)((()=>{const e=ze.current;Ne(e?{message:Te("UnlockPremiumEmojiHint2"),action:()=>ye({id:q,shouldReplaceHistory:!0}),actionText:Te("Open")}:{message:Te("UnlockPremiumEmojiHint"),action:()=>Re({initialSection:"animated_emoji"}),actionText:Te("PremiumMore")}),ze.current=Number(!e)}),[q,Te,ye,Re,Ne]),[On,Un]=((e,t,n,i,r,c,d,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,s.Sv)();(0,Xe.Z)((e=>{let[s]=e;if(!n)return;if(s?.id===n.id)return;const o=!s&&h?.text.length?h:n.content.text,i=(0,oa.z)(o);t(i),requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,oo.Z)(e,!0)}))}),[n,t]),(0,o.d4)((()=>{if(n)return()=>{const t=(0,f.Z)(e.current),n=t.text.length?t:void 0;p({chatId:c,threadId:d,type:u,text:n})}}),[c,n,e,p,d,u]);const I=(0,o.I4)((()=>{m&&(0,N.T2)((()=>{t((0,oa.z)(m));const e=document.querySelector(a.Ed);e&&requestAnimationFrame((()=>{(0,oo.Z)(e,!0)}))}))}),[m,t]),v=(0,o.I4)((()=>{i(),I()}),[i,I]),w=(0,o.I4)((()=>{const{text:t,entities:s}=(0,f.Z)(e.current);n&&(t||(0,l.u8)(n)?(g({messageId:n.id,text:t,entities:s}),i(),I()):r())}),[g,n,e,r,i,I]),y=(0,o.I4)((()=>{if(!n)return;const t=(0,f.Z)(e.current),s=t.text.length?t:void 0;p({chatId:c,threadId:d,type:u,text:s})}),[c,n,e,p,d,u]);return(0,Je.Z)(y),Ye(y),[w,v]})(Le,Ve,m,Bn,Pt,g,I,v,w,ae);((e,t,n,r,c,d,l)=>{const{saveDraft:u,clearDraft:m,loadCustomEmojis:g}=(0,s.Sv)(),p=(0,rn.Z)(e),I=(0,o.I4)(((e,t)=>{const n=r.current;void 0!==n&&!d&&l&&(n.length?u({chatId:e,threadId:t,draft:(0,f.Z)(n)}):m({chatId:e,threadId:t}))}),[m,d,r,l,u]),v=(0,o.Ye)((()=>(0,N.Ds)((e=>e()),a.r_,!1)),[t]),w=(0,rn.Z)(t),y=(0,rn.Z)(n);(0,o.d4)((()=>(To=t,Ao=n,()=>{To=void 0,Ao=void 0,I(t,n)})),[t,n,I]),(0,o.d4)((()=>{if(t===w&&n===y)return void(!e&&p&&c(""));if(d||!e)return;c((0,oa.z)(e));const s=e.entities?.map((e=>e.type===i.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];s.length&&g({ids:s}),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,oo.Z)(e,!0)}))}),[t,n,e,c,I,w,y,d,p,g]);const P=r.current,Z=(0,rn.Z)(P);(0,o.d4)((()=>{t&&n&&w===t&&y===n&&Z!==P&&(P.length?v((()=>{To===t&&Ao===n&&I(t,n)})):I(t,n))}),[t,P,w,Z,y,v,n,I]);const C=(0,o.I4)((()=>{t&&n&&I(t,n)}),[t,n,I]);(0,Je.Z)(C),Ye(C)})(w,g,I,Le,Ve,m,G),((e,t,n,s,r,c)=>{(0,o.d4)((()=>{if(e)return document.addEventListener("paste",o,!1),()=>{document.removeEventListener("paste",o,!1)};async function o(e){if(!e.clipboardData)return;const o=document.activeElement;if(o&&![a.R2,a.nY].includes(o.id))return;const d=e.clipboardData.getData("text").substring(0,4096),l=e.clipboardData.getData("text/html");let u=l?(0,f.Z)(function(e){let t=document.createElement("div");t.innerHTML=e.replace(/\u00a0/g," ").replace(No,"");const n=t.querySelectorAll(".text-content");return n.length&&(t=n[n.length-1]),Array.from(t.getElementsByTagName("*")).forEach((e=>{if(e instanceof HTMLElement)switch(e.removeAttribute("style"),"BR"===e.tagName&&e.replaceWith("\n"),"P"===e.tagName&&e.appendChild(document.createTextNode("\n")),"IMG"!==e.tagName||e.dataset.entityType||e.replaceWith(e.getAttribute("alt")||""),e.dataset.ignoreOnPaste&&e.remove(),f.x[e.tagName]&&e.setAttribute("data-entity-type",f.x[e.tagName]),e.dataset.entityType||e.textContent!==e.innerText||e.replaceWith(e.textContent),e.dataset.alt&&e.setAttribute("alt",e.dataset.alt),e.dataset.entityType){case i.Vv.MentionName:e.replaceWith(e.textContent||"");break;case i.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(l),void 0,!0):void 0;u&&(0,Ro.Lo)(u)&&r&&(u=(0,Ro.If)(u),c?.());const{items:m}=e.clipboardData;let h=[];if(e.preventDefault(),m.length>0&&(h=await(0,Mo.Z)(m)),0===h.length&&!d)return;if(h.length>0&&!s){const e=await Promise.all(h.map((e=>co(e.name,e,1===h.length&&ko.includes(e.type)))));n((t=>t.concat(e)))}const g=u?.entities?.length?u:{text:d};g&&t(g,o?.id)}}),[t,s,n,e,r,c])})(P,kn,kt,m,!Z&&!S,Ln);const jn=(0,o.I4)((()=>{m&&Un()}),[m,Un]),Dn=(0,o.I4)((async(e,t)=>{kt(await Promise.all(e.map((e=>co(e.name,e,t)))))}),[kt]),qn=(0,o.I4)((async(e,t)=>{kt([...nt,...await Promise.all(e.map((e=>co(e.name,e,t))))])}),[nt,kt]),Gn=(0,o.I4)((()=>{st(d.D)}),[]),Hn=(0,o.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==b)return;let n=nt;if(xt){const e=await Tt();if(e){const{blob:t,duration:s,waveform:a}=e;n=[await co(Mi,t,!1,{voice:{duration:s,waveform:a}})]}}const{text:o,entities:i}=(0,f.Z)(Le.current);if(!n.length&&!o&&!A)return;const{serverTimeOffset:r}=(0,s.Rd)(),c=n.length?$:4096;if(o?.length>c){const e=o.length-c;return void he({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const d=document.querySelector(a.Ed);if(n.length||o){if(pn&&!gn){const e=(0,p.b)(r),t=Oe.current&&Math.floor(e-Oe.current),n=pn.nextSendDate&&pn.nextSendDate>e;if(t&&t<pn.seconds||n){const s=n?pn.nextSendDate-e:pn.seconds-t;return he({data:{message:Te("SlowModeHint",(0,z.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),void d?.blur()}}ue({text:o,entities:i,attachments:n,scheduledAt:t,isSilent:e})}A&&fe({scheduledAt:t,isSilent:e}),Oe.current=(0,p.b)(r),me({chatId:g,localOnly:!0}),h.cj&&d&&d===document.activeElement&&ho(d),requestAnimationFrame((()=>{Bn()}))}),[b,nt,xt,A,me,g,$,Bn,Tt,he,pn,gn,ue,fe,Te,Le]),Vn=(0,o.I4)((()=>{"webApp"===re?.type&&Ee({botId:g,chatId:g,isFromBotMenu:!0,url:re.url})}),[re,Ee,g]),_n=(0,o.I4)((()=>{ht(),dt()}),[ht,dt]),zn=(0,o.I4)((()=>{lt(),vt(),mt()}),[lt,vt,mt]),Wn=(0,o.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:s,isSilent:a}=e;return void Ze({id:n,queryId:s,scheduledAt:t,isSilent:a})}const{isSilent:n,...s}=e||{};e&&0!==Object.keys(s).length?ue({...e,scheduledAt:t}):Hn(Boolean(n),t)}),[Hn,Ze,ue]);(0,o.d4)((()=>{H&&Qe((e=>{Wn(H,e)}))}),[H,Wn,Qe]),(0,o.d4)((()=>{oe&&(Ve(oe),be(),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,oo.Z)(e,!0)})))}),[oe,be,Ve]),(0,o.d4)((()=>{if(ie?.length){const e=ie.every((e=>(0,sn.MD)(e)));Dn(ie,e),be()}}),[Dn,ie,be]);const Xn=(0,o.I4)((e=>{e.isFree||Z||S?Tn(e):Ln()}),[Tn,S,Z,Ln]),Jn=(0,o.I4)((function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||s?($e(),Qe((n=>{Ge(),Wn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{Bn(a)}))}))):(ue({sticker:e,isSilent:t}),requestAnimationFrame((()=>{Bn(a)})))}),[n,$e,Qe,Ge,Wn,Bn,ue]),Yn=(0,o.I4)(((e,t,s)=>{n||s?($e(),Qe((n=>{Ge(),Wn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{Bn(!0)}))}))):(ue({gif:e,isSilent:t}),requestAnimationFrame((()=>{Bn(!0)})))}),[n,$e,Qe,Ge,Wn,Bn,ue]),Kn=(0,o.I4)(((e,t,s)=>{if("connectionStateReady"!==b)return;n||s?Qe((n=>{Wn({id:e.id,queryId:e.queryId,isSilent:t},n)})):Ze({id:e.id,queryId:e.queryId,isSilent:t});const o=document.querySelector(a.Ed);h.cj&&o&&o===document.activeElement&&ho(o),me({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{Bn()}))}),[g,me,b,Wn,Qe,Bn,Ze,n]),Qn=(0,o.I4)((()=>{me({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{Bn()}))}),[g,me,Bn]),es=(0,o.I4)((e=>{n?(Qe((t=>{Wn({poll:e},t)})),ve()):(ue({poll:e}),ve())}),[ve,Wn,Qe,ue,n]),ts=(0,o.I4)((()=>{n?Qe((e=>{Wn({isSilent:!0},e)})):Hn(!0)}),[Wn,Hn,Qe,n]),ns=(0,o.I4)((e=>{"stickers"===e?(ge({query:""}),pe({query:void 0})):(pe({query:""}),ge({query:void 0}))}),[ge,pe]),ss=(0,o.I4)((()=>{const e=document.querySelector(a.Ed);h.wB&&e===document.activeElement?(e?.blur(),setTimeout((()=>{lt(),mt()}),100)):mt()}),[mt,lt]),as=(0,o.I4)((()=>{const e=document.querySelector(a.Ed);if(!h.wB||e!==document.activeElement)return lt(),ht(),void ft();e?.blur(),setTimeout((()=>{lt(),ht(),ft()}),100)}),[lt,ht,ft]),os=(0,o.I4)((()=>{ye({id:g,threadId:I,type:"scheduled"})}),[ye,g,I]);(0,o.d4)((()=>{k&&h.wB&&ht()}),[k,ht]),(0,o.d4)((()=>{c&&(T?St():setTimeout((()=>{Mt()}),200))}),[T,Mt,St,c]);const is=!(Ut!==Si.Record||un&&C),rs=(0,o.I4)((()=>{switch(Ut){case Si.Send:Hn();break;case Si.Record:is?C||Ne({message:Te("VoiceMessagesRestrictedByPrivacy",y?.title)}):Nt();break;case Si.Edit:On();break;case Si.Schedule:xt&&At(),Qe((e=>{Wn({},e)}))}}),[Ut,Hn,On,xt,Qe,is,C,Ne,Te,y?.title,Nt,At,Wn]),cs=(0,rn.Z)(m,!0),ds=m||cs,ls=new Date;ls.setSeconds(0),ls.setMilliseconds(0);const us=new Date;us.setFullYear(us.getFullYear()+1);let ms="SendMessage";switch(Ut){case Si.Edit:ms="Save edited message";break;case Si.Record:ms=un?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const hs=(0,_e.Z)("Composer",!T&&"shown",Et&&"hover-disabled"),gs=(0,_e.Z)("mobile-symbol-menu-button",!c&&"not-ready",Ct?ut&&"menu-opened":ut&&"is-loading"),ps=(0,o.I4)((()=>{Qe((e=>{Wn({},e)}))}),[Wn,Qe]),fs=Ut===Si.Edit?On:Ut===Si.Schedule?ps:Hn,Is=re&&"commands"===re?.type;return o.ZP.createElement("div",{className:hs},un&&c&&o.ZP.createElement(Pi,{isOpen:t!==tn.t.None,withQuick:t===tn.t.QuickFile||Fe===tn.t.QuickFile,onHide:u,onFileSelect:Dn}),o.ZP.createElement(vi,{chatId:g,threadId:I,canShowCustomSendMenu:jt,attachments:nt,captionLimit:$,caption:nt.length?Be:"",groupChatMembers:j,currentUserId:q,recentEmojis:J,isReady:c,isChatWithSelf:S,onCaptionUpdate:Ve,baseEmojiKeywords:W,emojiKeywords:X,shouldSchedule:n,onSendSilent:ts,onSend:Hn,onSendScheduled:ps,onFileAppend:qn,onClear:Gn,shouldSuggestCustomEmoji:_,customEmojiForEmoji:U}),o.ZP.createElement(yi,{isOpen:B.isOpen,isQuiz:B.isQuiz,shouldBeAnonymous:M,onClear:ve,onSend:es}),ds&&o.ZP.createElement(Vo,{isOpen:wt,isSchedule:"scheduled"===v,onClose:Zt,message:ds}),o.ZP.createElement(bi,{isOpen:gt,onClose:vt,chatId:g,selectedSendAsId:se,sendAsPeerIds:je,isCurrentUserPremium:Z}),o.ZP.createElement(ii,{isOpen:Dt,onClose:qt,onInsertUserName:$t,filteredUsers:Gt}),o.ZP.createElement(oi,{isOpen:Ht,botId:Vt,isGallery:_t,inlineBotResults:Wt,switchPm:zt,onSelectResult:Kn,loadMore:Yt,onClose:Xt,isSavedMessages:S,canSendGifs:ln,isCurrentUserPremium:Z}),o.ZP.createElement(ui,{isOpen:Kt,withUsername:Boolean(ee),botCommands:en,onClick:Qn,onClose:Qt}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:Ae}),o.ZP.createElement(Ii,{onClear:jn}),o.ZP.createElement(Ci,{chatId:g,threadId:I,messageText:nt.length?"":Be,disabled:!hn}),o.ZP.createElement("div",{className:"message-input-wrapper"},E&&re&&"webApp"===re.type&&!m&&o.ZP.createElement(Ei,{isOpen:!Be&&!xt,onClick:Vn,text:re.text,isDisabled:Boolean(xt)}),E&&Is&&!1!==Q&&!xt&&!m&&o.ZP.createElement(Xo,{className:(0,_e.Z)("bot-commands",ct&&"activated"),round:!0,disabled:void 0===Q,color:"translucent",onActivate:_n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),De&&(te||ne)&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",onClick:gt?vt:as,ariaLabel:Te("SendMessageAsTitle"),className:(0,_e.Z)("send-as-button",tt.current&&"appear-animation")},o.ZP.createElement($n.Z,{user:te,chat:ne,size:"tiny"})),h.wB?o.ZP.createElement(Rt.Z,{className:gs,round:!0,color:"translucent",onClick:ut?ht:ss,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),ut&&!Ct&&o.ZP.createElement(Bt.Z,{color:"gray"})):o.ZP.createElement(Xo,{className:(0,_e.Z)("symbol-menu-button",ut&&"activated"),round:!0,color:"translucent",onActivate:zn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(hi.Z,{id:"message-input-text",editableInputId:a.R2,chatId:g,threadId:I,html:nt.length?"":Be,placeholder:xt&&Ue<=600?"":L||Te("Message"),forcedPlaceholder:Jt,canAutoFocus:c&&!nt.length,noFocusInterception:nt.length>0,shouldSuppressFocus:h.wB&&ut,shouldSuppressTextFormatter:Pn||Dt||Ht,onUpdate:Ve,onSend:fs,onSuppressedFocus:ht}),K&&Boolean(Vt)&&o.ZP.createElement(Bt.Z,{color:"gray"}),O&&o.ZP.createElement(Rt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:os,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),x&&!xt&&!m&&o.ZP.createElement(Xo,{className:at?"activated":"",round:!0,color:"translucent",onActivate:ot,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),xt&&Lt&&o.ZP.createElement("span",{className:"recording-state"},(0,z.rM)(Lt-Ft.current)),o.ZP.createElement(si,{chatId:g,isButtonVisible:!xt&&!m,canAttachMedia:un,canAttachPolls:mn,onFileSelect:Dn,onPollCreate:Ie,isScheduled:n,attachBots:ce,peerType:de,theme:le}),x&&o.ZP.createElement(mi,{messageId:x,isOpen:at,onClose:rt}),Q&&o.ZP.createElement(wi,{isOpen:ct,botCommands:Q,onClose:lt}),o.ZP.createElement(di.Z,{chatId:g,isOpen:vn,onCustomEmojiSelect:yn,addRecentCustomEmoji:ke}),o.ZP.createElement(ci,{chatId:g,threadId:I,isOpen:fn,onStickerSelect:Jn}),o.ZP.createElement(li.Z,{isOpen:Pn,emojis:Cn,customEmojis:bn,onClose:Zn,onEmojiSelect:En,addRecentEmoji:Pe,onCustomEmojiSelect:Mn,addRecentCustomEmoji:ke}),o.ZP.createElement(ai,{chatId:g,threadId:I,isOpen:ut||qe,canSendGifs:ln,canSendStickers:dn,onLoad:bt,onClose:ht,onEmojiSelect:Nn,onStickerSelect:Jn,onCustomEmojiSelect:Xn,onGifSelect:Yn,onRemoveSymbol:An,onSearchOpen:ns,addRecentEmoji:Pe,addRecentCustomEmoji:ke}))),xt&&o.ZP.createElement(Rt.Z,{round:!0,color:"danger",className:"cancel",onClick:Tt,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(Rt.Z,{ref:Ot,round:!0,color:"secondary",className:(0,_e.Z)(Ut,!c&&"not-ready",xt&&"recording"),disabled:is,allowDisabledClick:!0,ariaLabel:Te(ms),onClick:rs,onContextMenu:Ut===Si.Send&&jt?an:void 0},o.ZP.createElement("i",{className:"icon-send"}),o.ZP.createElement("i",{className:"icon-schedule"}),o.ZP.createElement("i",{className:"icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon-check"})),jt&&o.ZP.createElement(ri.Z,{isOpen:nn,onSendSilent:S?void 0:ts,onSendSchedule:n?void 0:ps,onClose:on,onCloseAnimationEnd:cn,isSavedMessages:S}),et)}))),ki=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,dt.Z)(ct.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),Ni=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,dt.Z)(ct.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Ti=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ai=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),Bi=(0,o.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,dt.Z)(ct.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),xi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),Li=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"GiftPremiumModal",!t);return n?o.ZP.createElement(n,e):void 0})),Oi=h.wB?450+a.fK:void 0;function Fi(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const Ui=(0,o.X$)((0,s.c$)((e=>{const t=(0,c.Pu)(e),{isBlurred:n,background:s,backgroundColor:a,patternColor:o}=e.settings.themes[t]||{},{messageLists:r}=e.messages,d=(0,c.Bt)(e),{isLeftColumnShown:u,chats:{listIds:m},activeEmojiInteractions:g,lastSyncTime:p}=e,f={theme:t,customBackground:s,backgroundColor:a,patternColor:o,isLeftColumnShown:u,isRightColumnShown:(0,c.Jf)(e),isBackgroundBlurred:n,isMobileSearchActive:Boolean(h.wB&&(0,c.n5)(e)),isSelectModeActive:(0,c.CA)(e),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),isGiftPremiumModalOpen:e.giftPremiumModal?.isOpen,animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,r.length-1),activeEmojiInteractions:g,lastSyncTime:p};if(!d||!m.active)return f;const{chatId:I,threadId:v,type:w}=d,y=(0,l.YC)(I),P=(0,c.Z1)(e,I),Z=(0,c.IK)(e,I),C=(0,c.KB)(e,I),{chatId:b,messageId:E}=e.audioPlayer,S=P&&(0,l.Qm)(P,v),M=(0,c.pk)(e,I),R="pinned"===w,k="scheduled"===w,N="thread"===w&&v===i._f,T=Boolean(P&&(0,l.eA)(P)),A=Boolean(P&&N&&(T||(0,l.ZV)(P))&&P.isNotJoined&&!P.joinRequests),B=Boolean(P?.isNotJoined&&P.isJoinToSend),x=Boolean(P?.isNotJoined&&P.isJoinRequest),L=Boolean(Z&&(0,c.s4)(e,Z.id)),O=!L&&M,F=Boolean(P&&(0,l.Bf)(P)&&!P.fullInfo&&p);return{...f,chatId:I,threadId:v,messageListType:w,isPrivate:y,areChatSettingsLoaded:Boolean(P?.settings),canPost:!R&&(!P||S)&&!M&&!(B&&P?.isNotJoined),isPinnedMessageList:R,isScheduledMessageList:k,currentUserBannedRights:P?.currentUserBannedRights,defaultBannedRights:P?.defaultBannedRights,hasPinnedOrAudioPlayer:v!==i._f||Boolean(!R&&C?.length)||Boolean(b&&E),pinnedMessagesCount:C?C.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:T,canSubscribe:A,canStartBot:O,canRestartBot:L,shouldJoinToSend:B,shouldSendJoinRequest:x,shouldLoadFullChat:F}}))((e=>{let{chatId:t,threadId:n,messageListType:i,isPrivate:r,isPinnedMessageList:c,canPost:d,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:p,customBackground:f,theme:I,backgroundColor:v,patternColor:w,isLeftColumnShown:y,isRightColumnShown:P,isBackgroundBlurred:Z,isMobileSearchActive:C,isSelectModeActive:b,isSeenByModalOpen:E,isReactorListModalOpen:S,isGiftPremiumModalOpen:M,animationLevel:R,shouldSkipHistoryAnimations:k,currentTransitionKey:N,isChannel:T,areChatSettingsLoaded:A,canSubscribe:B,canStartBot:x,canRestartBot:L,activeEmojiInteractions:O,shouldJoinToSend:F,shouldSendJoinRequest:U,shouldLoadFullChat:j,lastSyncTime:D}=e;const{openChat:q,openPreviousChat:$,unpinAllMessages:G,loadUser:H,loadChatSettings:V,closeLocalTextSearch:_,exitMessageSelectMode:z,joinChannel:W,sendBotCommand:X,restartBot:J,showNotification:Y,loadFullChat:K}=(0,s.Sv)(),{width:Q}=(0,an.Z)(),ee=(0,yt.Z)(),[te,ne]=(0,o.eJ)(tn.t.None),[se,ae]=(0,o.eJ)(),[oe,ie]=(0,o.eJ)(),[re,ce]=(0,o.eJ)(!1),de=g&&(Q<a.l3||P&&Q>a._m&&Q<a.QU||Q>=a.ks&&Q<a.jT),le=(0,on.Z)(t,Oi),ue=(0,on.Z)(n,Oi),me=(0,on.Z)(i,Oi),he=(0,on.Z)(B,Oi),ge=(0,on.Z)(x,Oi),pe=(0,on.Z)(L,Oi),fe=(0,on.Z)(d,Oi)&&!pe&&!ge&&!he,Ie=(0,on.Z)(de,Oi),ve=(0,on.Z)(se,Oi),we=(0,on.Z)(T,Oi),Se=(0,on.Z)(F,Oi),Me=(0,on.Z)(U,Oi),Re=(0,rn.Z)(N),ke=void 0!==Re&&Re<N?Re:void 0,{isReady:Ne,handleOpenEnd:Te,handleSlideStop:Ae}=function(e,t,n,s){const[a,i]=(0,o.eJ)(!h.wB),r=(0,st.Z)(),c=void 0!==n&&n!==t;return c&&(e?i(!1):r()),(0,Ke.Z)((()=>{e||i(!0)}),[e]),{isReady:a&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&i(Boolean(s))}:void 0,handleSlideStop:e?function(){i(!0)}:void 0}}(!k&&R!==a.oB,N,Re,t);(0,o.d4)((()=>t?(0,pt.Z)((()=>{q({id:void 0})})):void 0),[t,q]),(0,Ke.Z)((()=>{ne(tn.t.None),ae(void 0),ie(void 0)}),[t]),(0,o.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{e.height!==document.documentElement.clientHeight?document.body.classList.add("keyboard-visible"):document.body.classList.remove("keyboard-visible")};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}}),[]),(0,o.d4)((()=>{r&&H({userId:t})}),[t,r,H]),(0,o.d4)((()=>{!A&&D&&V({chatId:t})}),[t,r,A,D,V]),(0,o.d4)((()=>{t&&j&&Ne&&K({chatId:t})}),[j,t,Ne,K]);const Be=(0,o.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Fi);ne(n?tn.t.QuickFile:tn.t.Document)}),[]),xe=(0,o.I4)((()=>{ne(tn.t.None)}),[]),Le=(0,o.I4)((()=>{ce(!0)}),[]),Oe=(0,o.I4)((()=>{ce(!1)}),[]),Fe=(0,o.I4)((()=>{G({chatId:t}),Oe(),$()}),[G,t,Oe,$]),Ue=(0,o.I4)((()=>{q({id:t})}),[q,t]),je=(0,o.I4)((()=>{W({chatId:t}),Me&&Y({message:ee(T?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[W,t,Me,Y,T,ee]),De=(0,o.I4)((()=>{X({command:"/start"})}),[X]),qe=(0,o.I4)((()=>{J({chatId:t})}),[t,J]),$e=((e,t)=>{const[n,s]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?s(t):nn.fetch(a.fo,e,nn.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,sn.pt)(t).then((()=>{s(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(I,f),Ge=(0,_e.Z)(Ie&&"has-header-tools",h.aZ?"mask-image-disabled":"mask-image-enabled"),He=(0,_e.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",f&&"Ik9ZZlj3eKtKXRrUZKVk",v&&"avVozLQe3SaWcSkIt6pG",f&&Z&&"Tipa66fYcSvl6w0587Xz",P&&"vhOr8s3T_LCKSt2BF7fs"),Ve=(0,_e.Z)("messaging-disabled",!b&&"shown"),ze=(0,l.q8)(ee,u,m),{composerHiddenScale:We,toolbarHiddenScale:Xe,composerTranslateX:Je,toolbarTranslateX:Ye,unpinHiddenScale:Qe,toolbarForUnpinHiddenScale:et}=(0,o.Ye)((()=>function(e,t){const n=e<=a.l3?ye.Gw:2*ye.Gw,s=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,be),Ce),n=Math.min(.25*e,Ce);return Math.min(e-t-n,Ze)}if(e>a.ks){const t=Math.min(Math.max(.4*e,be),Ce);return Math.min(e-t,Ze)}return e>Ze?Ze:e}(e),o=e<=a.l3?3.375*ye.Gw:4*ye.Gw,i=t?s-n-o:s-n,r=e>a.l3?Math.min(s-n,Pe):s-n,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/Ee,toolbarForUnpinHiddenScale:Ee/r}}(Q,fe)),[fe,Q]),tt=(0,_e.Z)("middle-column-footer",!fe&&"no-composer",fe&&oe&&!b&&"with-notch");(0,Ft.Z)({isActive:b,onBack:z}),(0,Ft.Z)({isActive:C,onBack:_});const nt=Boolean(!c&&!fe&&!pe&&!ge&&!he&&ze),at=Boolean(pe||he||ge||c),ot=Boolean(nt||b||c);return o.ZP.createElement("div",{id:"MiddleColumn",className:Ge,onTransitionEnd:Te,style:`\n --composer-hidden-scale: ${We};\n --toolbar-hidden-scale: ${Xe};\n --unpin-hidden-scale: ${Qe};\n --toolbar-unpin-hidden-scale: ${et};\n --composer-translate-x: ${Je}px;\n --toolbar-translate-x: ${Ye}px;\n --pattern-color: ${w};\n --theme-background-color:\n ${v||("dark"===I?a.It:a.p3)};\n `,onClick:h.p7&&y?Ue:void 0},o.ZP.createElement("div",{className:He,style:$e?`--custom-background: ${$e}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),le&&ue&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:fe?Be:void 0},o.ZP.createElement(_n,{chatId:le,threadId:ue,messageListType:me,isReady:Ne}),o.ZP.createElement(wt.Z,{name:k?"none":R===a.zy?"slide":"fade",activeKey:N,shouldCleanup:!0,cleanupExceptionKey:ke,onStop:Ae},o.ZP.createElement(no,{key:`${le}-${ue}-${me}`,chatId:le,threadId:ue,type:me,canPost:fe,hasTools:Ie,onFabToggle:ae,onNotchToggle:ie,isReady:Ne,withBottomShift:at,withDefaultBg:Boolean(!f&&!v)}),o.ZP.createElement("div",{className:tt},fe&&o.ZP.createElement(Ri,{chatId:le,threadId:ue,messageListType:me,dropAreaState:te,onDropHide:xe,isReady:Ne}),c&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ee.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Le},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,ee("Chat.Pinned.UnpinAll",p,"i")))),nt&&o.ZP.createElement("div",{className:Ve},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,ze))),h.wB&&(he||Se&&!Me)&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ee.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:je},ee(we?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&Me&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ee.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:je},ee("ChannelJoinRequest"))),h.wB&&ge&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ee.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:De},ee("BotStart"))),h.wB&&pe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:ee.isRtl?"rtl":void 0},o.ZP.createElement(Rt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:qe},ee("BotRestart"))),o.ZP.createElement(Ni,{messageListType:me,isActive:b,canPost:fe}),o.ZP.createElement(Ai,{isOpen:E}),o.ZP.createElement(xi,{isOpen:S}))),o.ZP.createElement(ao,{isShown:ve,canPost:fe,withExtraShift:ot})),h.wB&&o.ZP.createElement(ki,{isActive:Boolean(C)})),t&&o.ZP.createElement(Ti,{isOpen:re,chatId:t,pinnedMessagesCount:p,onClose:Oe,onUnpin:Fe}),o.ZP.createElement("div",{teactFastList:!0},O?.map(((e,t)=>o.ZP.createElement(Bi,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),o.ZP.createElement(Li,{isOpen:M}))}))),ji=450+a.fK,Di=(0,N.Ds)((e=>e()),200,!1);var qi;!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"}(qi||(qi={}));const $i=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,isProfile:s,isManagement:a}=t;const{query:o}=(0,c.n5)(e)||{},{query:i}=(0,c.y5)(e)||{},{query:r}=(0,c.yN)(e)||{},d=n?(0,c.Z1)(e,n):void 0,u=d&&(0,l.eA)(d),m=s&&n&&(0,l.YC)(n)?(0,c.dy)(e,n):void 0,h=m&&(0,l.kw)(m),g=Boolean(!a&&s&&!h&&d&&!(0,c.FM)(e,d.id)&&((0,l.YC)(d.id)||((0,l.Nl)(d)||d.isCreator)&&!d.isNotJoined)),p=Boolean(n&&e.management.byChatId[n]?.editingInvite),f=d?.fullInfo?.canViewStatistics,I=n?e.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:g,canAddContact:h,canViewStatistics:f,isChannel:u,userId:m?.id,messageSearchQuery:o,stickerSearchQuery:i,gifSearchQuery:r,isEditingInvite:p,currentInviteInfo:I,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,isColumnOpen:a,isProfile:i,isSearch:r,isManagement:c,isStatistics:d,isMessageStatistics:l,isStickerSearch:u,isGifSearch:g,isPollResults:p,isAddingChatMembers:f,profileState:I,managementScreen:v,canAddContact:w,userId:y,canManage:P,isChannel:Z,onClose:C,onScreenSelect:b,messageSearchQuery:E,stickerSearchQuery:S,gifSearchQuery:M,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N,shouldSkipHistoryAnimations:T}=e;const{setLocalTextSearchQuery:A,setStickerSearchQuery:B,setGifSearchQuery:x,searchTextMessagesLocal:L,toggleManagement:O,openHistoryCalendar:F,openAddContactDialog:U,toggleStatistics:j,setEditingExportedInvite:D,deleteExportedChatInvite:q}=(0,s.Sv)(),[$,G,H]=(0,It.Z)(),V=(0,o.I4)((()=>{D({chatId:n,invite:N}),b(m.u1.EditInvite)}),[n,N,b,D]),_=(0,o.I4)((()=>{q({chatId:n,link:N.link}),b(m.u1.Invites),H()}),[n,H,N,q,b]),W=(0,o.I4)((e=>{A({query:e}),e.length&&Di(L)}),[L,A]),X=(0,o.I4)((e=>{B({query:e})}),[B]),J=(0,o.I4)((e=>{x({query:e})}),[x]),Y=(0,o.I4)((()=>{U({userId:y})}),[U,y]),[K,Q]=(0,o.eJ)(!a);(0,o.d4)((()=>{setTimeout((()=>{Q(!a)}),ji)}),[a]);const ee=(0,yt.Z)(),te=i?I===m.vi.Profile?qi.Profile:I===m.vi.SharedMedia?qi.SharedMedia:I===m.vi.MemberList?qi.MemberList:-1:r?qi.Search:p?qi.PollResults:u?qi.StickerSearch:g?qi.GifSearch:f?qi.AddingMembers:c?v===m.u1.Initial?qi.ManageInitial:v===m.u1.ChatPrivacyType?qi.ManageChatPrivacyType:v===m.u1.Discussion?qi.ManageDiscussion:v===m.u1.ChannelSubscribers?qi.ManageChannelSubscribers:v===m.u1.GroupPermissions?qi.ManageGroupPermissions:v===m.u1.ChatAdministrators?qi.ManageChatAdministrators:v===m.u1.GroupRemovedUsers?qi.ManageGroupRemovedUsers:v===m.u1.ChannelRemovedUsers?qi.ManageChannelRemovedUsers:v===m.u1.GroupUserPermissionsCreate?qi.ManageGroupUserPermissionsCreate:v===m.u1.GroupUserPermissions?qi.ManageGroupUserPermissions:v===m.u1.GroupRecentActions?qi.ManageGroupRecentActions:v===m.u1.ChatAdminRights?qi.ManageGroupAdminRights:v===m.u1.ChatNewAdminRights?qi.ManageGroupNewAdminRights:v===m.u1.GroupMembers?qi.ManageGroupMembers:v===m.u1.Invites?qi.ManageInvites:v===m.u1.EditInvite?qi.ManageEditInvite:v===m.u1.GroupAddAdmins?qi.ManageGroupAddAdmins:v===m.u1.Reactions?qi.ManageReactions:v===m.u1.InviteInfo?qi.ManageInviteInfo:v===m.u1.JoinRequests?qi.ManageJoinRequests:void 0:d?qi.Statistics:l?qi.MessageStatistics:void 0,ne=null!==(t=(0,ln.Z)(te,!0))&&void 0!==t?t:-1,se=h.wB||te===qi.SharedMedia||te===qi.MemberList||te===qi.AddingMembers||te===qi.MessageStatistics||c,ae=(0,_e.Z)("animated-close-icon",se&&"state-back",(K||T)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(Rt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:C,ariaLabel:ee(se?"Common.Back":"Common.Close")},o.ZP.createElement("div",{className:ae})),o.ZP.createElement(wt.Z,{name:K||T?"none":"slide-fade",activeKey:ne},function(){if(-1!==ne)switch(ne){case qi.PollResults:return o.ZP.createElement("h3",null,ee("PollResults"));case qi.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(kt.Z,{parentContainerClassName:"RightSearch",value:E,onChange:W}),o.ZP.createElement(Rt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>F({selectedAt:(0,z._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case qi.AddingMembers:return o.ZP.createElement("h3",null,ee(Z?"ChannelAddSubscribers":"GroupAddMembers"));case qi.ManageInitial:return o.ZP.createElement("h3",null,ee("Edit"));case qi.ManageChatPrivacyType:return o.ZP.createElement("h3",null,ee(Z?"ChannelTypeHeader":"GroupTypeHeader"));case qi.ManageDiscussion:return o.ZP.createElement("h3",null,ee("Discussion"));case qi.ManageChatAdministrators:return o.ZP.createElement("h3",null,ee("ChannelAdministrators"));case qi.ManageGroupRecentActions:return o.ZP.createElement("h3",null,ee("Group.Info.AdminLog"));case qi.ManageGroupAdminRights:return o.ZP.createElement("h3",null,ee("EditAdminRights"));case qi.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,ee("SetAsAdmin"));case qi.ManageGroupPermissions:return o.ZP.createElement("h3",null,ee("ChannelPermissions"));case qi.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,ee("BlockedUsers"));case qi.ManageChannelRemovedUsers:return o.ZP.createElement("h3",null,ee("ChannelBlockedUsers"));case qi.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,ee("ChannelAddException"));case qi.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,ee("UserRestrictions"));case qi.ManageInvites:return o.ZP.createElement("h3",null,ee("lng_group_invite_title"));case qi.ManageEditInvite:return o.ZP.createElement("h3",null,ee(R?"EditLink":"NewLink"));case qi.ManageInviteInfo:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,ee("InviteLink")),o.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:V},o.ZP.createElement("i",{className:"icon-edit"})),N&&N.isRevoked&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Rt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ee("Delete"),onClick:G},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(wn.Z,{isOpen:$,onClose:H,title:ee("DeleteLink"),text:ee("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ee("Delete"),confirmHandler:_}))));case qi.ManageJoinRequests:return o.ZP.createElement("h3",null,ee(Z?"SubscribeRequests":"MemberRequests"));case qi.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,ee("Channel.Management.AddModerator"));case qi.StickerSearch:return o.ZP.createElement(kt.Z,{value:S,placeholder:ee("SearchStickersHint"),autoFocusSearch:!0,onChange:X});case qi.GifSearch:return o.ZP.createElement(kt.Z,{value:M,placeholder:ee("SearchGifsTitle"),autoFocusSearch:!0,onChange:J});case qi.Statistics:return o.ZP.createElement("h3",null,ee(Z?"ChannelStats.Title":"GroupStats.Title"));case qi.MessageStatistics:return o.ZP.createElement("h3",null,ee("Stats.MessageTitle"));case qi.SharedMedia:return o.ZP.createElement("h3",null,ee("SharedMedia"));case qi.ManageChannelSubscribers:return o.ZP.createElement("h3",null,ee("ChannelSubscribers"));case qi.MemberList:case qi.ManageGroupMembers:return o.ZP.createElement("h3",null,ee("GroupMembers"));case qi.ManageReactions:return o.ZP.createElement("h3",null,ee("Reactions"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},w&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("AddContact"),onClick:Y},o.ZP.createElement("i",{className:"icon-add-user"})),P&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:O},o.ZP.createElement("i",{className:"icon-edit"})),k&&o.ZP.createElement(Rt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Statistics"),onClick:j},o.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var Gi=n(91),Hi=n(3474),Vi=n(27407);function _i(e,t,n,s){const[o,i]=(0,Vi.Z)(n?t:void 0,s,void 0,a.Vk);return[o,i,!(!o||!s||o[0]===s[0])]}function zi(e,t,n,s,i,r){const c=(0,o.sO)();(0,Ke.Z)((()=>{t===e&&i&&r&&(c.current=(0,l.R5)(i,r,e))}),[i,r,t,e]);const[d,u]=(0,Vi.Z)(s?n:void 0,c.current,void 0,"media"===e?a.EN:a.pn);return[d,u,!(!d||!c.current||d[0]===c.current[0])]}const Wi=(0,N.P2)((e=>e()),250,!1);let Xi=!1;var Ji=n(21273),Yi=n(31876),Ki=n(20787),Qi=n(70180),er=n(13709),tr=n(45418),nr=n(47262),sr=n(41151),ar=n(22275);const or=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function ir(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const rr=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),a=(0,c.Zw)(e,n),{currentType:o,resultsByType:i}=(0,c.we)(e)||{},{foundIds:r}=i&&o&&i[o]||{},{byId:d,statusesById:u}=e.users,{byId:m}=e.chats,h=s&&(0,l.Bf)(s),g=s&&(0,l.eA)(s),p=h||g&&(0,l.Nl)(s),f=s?.fullInfo?.members,I=s?.fullInfo?.adminMembersById,v=p&&s&&(s.isForbidden||s.fullInfo&&!s.fullInfo.canViewMembers),w=p&&s&&((0,l.VE)(s,"inviteUsers")||!(0,l.Mg)(s,"inviteUsers")||s.isCreator),y=p&&s&&((0,l.VE)(s,"banUsers")||s.isCreator),P=(0,c.xs)(e,n);let Z,C,b;return(0,l.YC)(n)&&(C=n,b=(0,c.dy)(e,C),Z=b&&!b.isSelf&&!(0,l.cS)(b)),{theme:(0,c.Pu)(e),isChannel:g,resolvedUserId:C,chatMessages:a,foundIds:r,mediaSearchType:o,hasCommonChatsTab:Z,hasMembersTab:p,areMembersHidden:v,canAddMembers:w,canDeleteMembers:y,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:s?.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:P,usersById:d,userStatusesById:u,chatsById:m,isChatProtected:s?.isProtected,...p&&f&&{members:f,adminMembersById:I},...Z&&b&&{commonChatIds:b.commonChats?.ids}}}))((e=>{let{chatId:t,profileState:n,onProfileStateChange:r,theme:c,isChannel:d,resolvedUserId:u,currentUserId:g,chatMessages:p,foundIds:f,mediaSearchType:I,hasCommonChatsTab:v,hasMembersTab:w,areMembersHidden:y,canAddMembers:P,canDeleteMembers:Z,commonChatIds:C,members:b,adminMembersById:E,usersById:S,userStatusesById:M,chatsById:R,isRightColumnShown:k,isRestricted:N,lastSyncTime:T,activeDownloadIds:A,serverTimeOffset:B,isChatProtected:x}=e;const{setLocalMediaSearchType:L,loadMoreMembers:O,loadCommonChats:F,openChat:U,searchMediaMessagesLocal:j,openMediaViewer:D,openAudioPlayer:q,focusMessage:$,loadProfilePhotos:G,setNewChatMembersDialogState:H}=(0,s.Sv)(),V=(0,o.sO)(null),_=(0,o.sO)(null),z=(0,yt.Z)(),[W,X]=(0,o.eJ)(0),[J,Y]=(0,o.eJ)(),K=(0,o.Ye)((()=>[...w?[{type:"members",title:d?"ChannelSubscribers":"GroupMembers"}]:[],...or,...v?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[v,w,d]),Q=K[W].type,[ee,te,ne,se]=function(e,t,n,s,a,i,r,c,d,u,m,h,g,p,f){let I=arguments.length>15&&void 0!==arguments[15]?arguments[15]:0;const v="members"!==a&&i?i:a,w=(0,o.Ye)((()=>{if(r&&d&&u)return(0,l.Z0)(r.map((e=>{let{userId:t}=e;return t})),d,u,void 0,I)}),[r,I,d,u]),y=(0,o.Ye)((()=>{if(c&&m)return(0,l.ih)(c,m,!0)}),[m,c]),[P,Z,C]=_i(0,t,f,w),[b,E,S]=zi("media",v,s,f,h,g),[M,R,k]=zi("documents",v,s,f,h,g),[N,T,A]=zi("links",v,s,f,h,g),[B,x,L]=zi("audio",v,s,f,h,g),[O,F,U]=zi("voice",v,s,f,h,g),[j,D,q]=_i(0,n,f,y);let $,G,H=!1;switch(v){case"members":$=P,G=Z,H=C;break;case"commonChats":$=j,G=D,H=q;break;case"media":$=b,G=E,H=S;break;case"documents":$=M,G=R,H=k;break;case"links":$=N,G=T,H=A;break;case"audio":$=B,G=x,H=L;break;case"voice":$=O,G=F,H=U}return[v,$,G,H]}(k,O,F,j,Q,I,b,C,S,M,R,p,f,t,T,B),ae=K.findIndex((e=>{let{type:t}=e;return t===ee})),{handleScroll:oe}=function(e,t,n,s){(0,Xe.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),Xi=!0,(0,Yn.Z)(n,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{Xi=!1}),350))}}),[t,s]),(0,Xe.Z)((t=>{let[a]=t;if(n!==m.vi.Profile||n===a)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(Xi=!0,(0,Yn.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{Xi=!1}),350),s(n))}),[n]);const a=(0,o.I4)((()=>{const n=e.current;if(!n)return;const a=n.querySelector(".TabList");if(!a)return;let o=m.vi.Profile;n.scrollTop>=a.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),s(o)}),[e,s,t]);return(0,o.d4)((()=>{Xi||a()}),[a,t]),{handleScroll:(0,o.I4)((()=>{Xi||Wi(a)}),[a])}}(V,Q,n,r),{applyTransitionFix:ie,releaseTransitionFix:re}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,o.d4)((()=>{function n(){const n=e.current,s=n.querySelector(t),a=n.querySelector(".TabList");s&&a&&(s.style.minHeight=n.offsetHeight-a.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,o.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=`${e}px`}}),[e]),s=(0,o.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e]);return{applyTransitionFix:n,releaseTransitionFix:s}}(V),[ce,de]=(0,Hi.Z)(),{observe:le}=(0,ns.S1)({rootRef:V,throttleMs:500}),ue=(0,o.I4)((()=>{re(),de()}),[re,de]),me=(0,o.I4)((()=>{H(m.WB.InProgress)}),[H]);(0,o.d4)((()=>{L({mediaType:Q})}),[L,Q]);const he=u||t;(0,o.d4)((()=>{T&&G({profileId:he})}),[G,he,T]);const ge=(0,o.I4)((e=>{D({chatId:he,threadId:i._f,mediaId:e,origin:m.bZ.SharedMedia})}),[he,D]),pe=(0,o.I4)((e=>{q({chatId:he,messageId:e})}),[he,q]),fe=(0,o.I4)((e=>{U({id:e})}),[U]),Ie=(0,o.I4)((e=>{$({chatId:he,messageId:e})}),[he,$]),ve=(0,o.I4)((()=>{Y(void 0)}),[]);let we;(0,o.d4)((()=>{if(_.current&&h.$b)return(0,Ot.sf)(_.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Ot.eM.Left?(X(Math.min(W+1,K.length-1)),!0):t===Ot.eM.Right&&(X(Math.max(0,W-1)),!0)})}),[W,K.length]);const ye="members"===ee||!w&&"media"===ee;ye?we=k?0:1e3:te||(we=a.Y);const Pe=(0,gi.Z)([t,ee],we);return o.ZP.createElement(Ji.Z,{ref:V,className:"Profile custom-scroll",itemSelector:ir(ee),items:Pe?te:void 0,cacheBuster:ce,sensitiveArea:a.qU,preloadBackwards:Pe?"members"===ee?a.Vk:a.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:ne,onScroll:oe},!se&&function(e,t,n){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(Ki.Z,{userId:t||e,canPlayVideo:n}),o.ZP.createElement(Qi.Z,{chatOrUserId:t||e}))}(t,u,k&&Pe),!N&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(wt.Z,{ref:_,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ae,renderCount:K.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ie,onStop:ue},function(){if(!te||!Pe||!p){const e=ye&&!Pe,t=Boolean("members"===ee&&y);return o.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&o.ZP.createElement(Bt.Z,null),t&&o.ZP.createElement(nr.Z,{text:"You have no access to group members list."}))}if(!te.length){let e;switch(ee){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=z("NoGroupsInCommon");break;case"documents":e=z("lng_media_file_empty");break;case"links":e=z("lng_media_link_empty");break;case"audio":e=z("lng_media_song_empty");break;case"voice":e=z("lng_media_audio_empty");break;default:e=z("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(nr.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${ee}-list`,dir:z.isRtl&&"media"===ee?"rtl":void 0,teactFastList:!0},"media"===ee?te.map((e=>p[e]&&o.ZP.createElement(er.Z,{key:e,message:p[e],isProtected:x||p[e].isProtected,observeIntersection:le,onClick:ge}))):"documents"===ee?te.map((e=>p[e]&&o.ZP.createElement(ks.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:A.includes(e),observeIntersection:le,onDateClick:Ie}))):"links"===ee?te.map((e=>p[e]&&o.ZP.createElement(tr.Z,{key:e,message:p[e],isProtected:x||p[e].isProtected,observeIntersection:le,onMessageClick:Ie}))):"audio"===ee?te.map((e=>p[e]&&o.ZP.createElement(Ns.ZP,{key:e,theme:c,message:p[e],origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:T,className:"scroll-item",onPlay:pe,onDateClick:Ie,canDownload:!x&&!p[e].isProtected,isDownloading:A.includes(e)}))):"voice"===ee?te.map((e=>p[e]&&o.ZP.createElement(Ns.ZP,{key:e,theme:c,message:p[e],senderTitle:(0,Gi.F)(z,p[e],R,S),origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:T,className:"scroll-item",onPlay:pe,onDateClick:Ie,canDownload:!x&&!p[e].isProtected,isDownloading:A.includes(e)}))):"members"===ee?te.map(((e,t)=>{return o.ZP.createElement(Yi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>fe(e),contextActions:(n=e,n!==g&&Z?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{Y(n)}}]:void 0)},o.ZP.createElement(un.Z,{userId:e,adminMember:E?.[e],forceShowSelf:!0}));var n})):"commonChats"===ee?te.map(((e,t)=>o.ZP.createElement(Yi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},o.ZP.createElement(mn.Z,{chatId:e})))):void 0)}()),o.ZP.createElement(Ut.Z,{big:!0,activeTab:W,tabs:K,onSwitchTab:X})),P&&o.ZP.createElement(sr.Z,{isShown:"members"===ee,onClick:me,ariaLabel:z("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),Z&&o.ZP.createElement(ar.Z,{isOpen:Boolean(J),userId:J,onClose:ve}))}))),cr=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)})),dr=(0,o.X$)((e=>{const t=(0,dt.Z)(ct.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)})),lr=e=>{const t=(0,dt.Z)(ct.gl.Extra,"Statistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)},ur=e=>{const t=(0,dt.Z)(ct.gl.Extra,"MessageStatistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(qt.Z,null)},mr=(0,o.X$)((()=>{const e=(0,dt.Z)(ct.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(qt.Z,null)})),hr=(0,o.X$)((()=>{const e=(0,dt.Z)(ct.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(qt.Z,null)})),gr=(0,o.X$)((()=>{const e=(0,dt.Z)(ct.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(qt.Z,null)}));var pr=n(11820);const fr=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),{userIds:a}=e.contactList||{},{byId:o}=e.chats,{currentUserId:i,newChatMembersProgress:r}=e,d=s&&(0,l.eA)(s),{query:u,fetchingStatus:h,globalUserIds:g,localUserIds:p}=e.userSearch;return{isChannel:d,members:s?.fullInfo?.members,currentUserId:i,chatsById:o,localContactIds:a,searchQuery:u,isSearching:h,isLoading:r===m.WB.Loading,globalUserIds:g,localUserIds:p}}))((e=>{let{isChannel:t,members:n,onNextStep:a,currentUserId:i,chatsById:r,localContactIds:c,isLoading:d,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,onClose:f,isActive:I}=e;const{setUserSearchQuery:v}=(0,s.Sv)(),w=(0,yt.Z)(),[y,P]=(0,o.eJ)([]),Z=(0,rn.Z)(y)===y;(0,Ft.Z)({isActive:I,onBack:f});const C=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),b=(0,o.I4)((e=>{v({query:e})}),[v]),E=(0,o.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=c?(0,l.kK)(c,e,u):[];return(0,l.ih)((0,g.Tw)([...n,...h||[],...p||[]]).filter((n=>{const s=e[n];return!C.includes(n)&&n!==i&&(!s||!(0,l.cS)(s)||!t&&s.canBeInvitedToGroup)})),r)}),[c,r,u,h,p,i,C,t]),S=(0,o.I4)((()=>{y.length&&(v({query:""}),a(y))}),[y,v,a]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(pr.Z,{itemIds:E,selectedIds:y,filterValue:u,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:P,onFilterChange:b,noScrollRestore:Z}),o.ZP.createElement(sr.Z,{isShown:Boolean(y.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:S},d?o.ZP.createElement(Bt.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Ir=450+a.fK,vr=Object.keys(m.qt).length/2,wr=Object.keys(m.u1).length/2;function yr(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Pr=(0,o.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},s=(0,c.g4)(e),a=t?e.management.byChatId[t]?.nextScreen:void 0;return{contentKey:(0,c.Wq)(e),chatId:t,threadId:n,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,nextManagementScreen:a}}))((e=>{var t;let{contentKey:n,chatId:i,threadId:r,isChatSelected:c,shouldSkipHistoryAnimations:d,nextManagementScreen:l}=e;const{toggleChatInfo:u,toggleManagement:h,closeLocalTextSearch:g,setStickerSearchQuery:p,setGifSearchQuery:f,closePollResults:I,addChatMembers:v,setNewChatMembersDialogState:w,setEditingExportedInvite:y,toggleStatistics:P,toggleMessageStatistics:Z,setOpenedInviteInfo:C,requestNextManagementScreen:b}=(0,s.Sv)(),{width:E}=(0,an.Z)(),[S,M]=(0,o.eJ)(m.vi.Profile),[R,k]=(0,o.eJ)(m.u1.Initial),[N,T]=(0,o.eJ)(),[A,B]=(0,o.eJ)(),x=S!==m.vi.Profile,L=void 0!==n,O=n===m.qt.ChatInfo,F=n===m.qt.Search,U=n===m.qt.Management,j=n===m.qt.Statistics,D=n===m.qt.MessageStatistics,q=n===m.qt.StickerSearch,$=n===m.qt.GifSearch,G=n===m.qt.PollResults,H=n===m.qt.AddingMembers,V=E<=a._m,[_,z]=(0,o.eJ)(!L),W=null!==(t=(0,ln.Z)(n,!0,!c))&&void 0!==t?t:-1,X=(0,o.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case m.qt.AddingMembers:w(m.WB.Closed);break;case m.qt.ChatInfo:if(x&&e){M(m.vi.Profile);break}u(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(R){case m.u1.Initial:h();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:k(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:k(m.u1.GroupPermissions),T(void 0),B(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:k(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:k(m.u1.Invites),C({invite:void 0}),y({chatId:i,invite:void 0})}break;case m.qt.MessageStatistics:Z();break;case m.qt.Statistics:P();break;case m.qt.Search:yr(),g();break;case m.qt.StickerSearch:yr(),p({query:void 0});break;case m.qt.GifSearch:yr(),f({query:void 0});break;case m.qt.PollResults:I()}}),[n,x,u,I,w,R,h,g,p,f,y,i,C,P,Z]),J=(0,o.I4)(((e,t)=>{T(e),B(t)}),[]),Y=(0,o.I4)((e=>{v({chatId:i,memberIds:e})}),[v,i]);function K(e){if(-1!==W)switch(W){case m.qt.AddingMembers:return o.ZP.createElement(fr,{key:i,chatId:i,isActive:L&&e,onNextStep:Y,onClose:X});case m.qt.ChatInfo:return o.ZP.createElement(rr,{key:i,chatId:i,profileState:S,onProfileStateChange:M});case m.qt.Search:return o.ZP.createElement(cr,{chatId:i,threadId:r,onClose:X,isActive:L&&e});case m.qt.Management:return o.ZP.createElement(dr,{key:i,chatId:i,currentScreen:R,isPromotedByCurrentUser:A,selectedChatMemberId:N,isActive:L&&e,onScreenSelect:k,onChatMemberSelect:J,onClose:X});case m.qt.Statistics:return o.ZP.createElement(lr,{chatId:i});case m.qt.MessageStatistics:return o.ZP.createElement(ur,{chatId:i,isActive:L&&e});case m.qt.StickerSearch:return o.ZP.createElement(mr,{onClose:X,isActive:L&&e});case m.qt.GifSearch:return o.ZP.createElement(hr,{onClose:X,isActive:L&&e});case m.qt.PollResults:return o.ZP.createElement(gr,{onClose:X,isActive:L&&e})}}return(0,o.d4)((()=>L?(0,pt.Z)(X):void 0),[L,X]),(0,o.d4)((()=>{setTimeout((()=>{z(!L)}),Ir)}),[L]),(0,o.d4)((()=>{l&&(k(l),b(void 0))}),[l,b]),(0,o.d4)((()=>{L&&V&&X()}),[V]),(0,es.Z)((e=>{let[t]=e;t!==i&&(M(m.vi.Profile),k(m.u1.Initial))}),[i]),(0,Ft.Z)({isActive:c&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers),onBack:()=>X(!1)}),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:c?void 0:"is-hidden"},V&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:X}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement($i,{chatId:i,isColumnOpen:L,isProfile:O,isSearch:F,isManagement:U,isStatistics:j,isMessageStatistics:D,isStickerSearch:q,isGifSearch:$,isPollResults:G,isAddingChatMembers:H,profileState:S,managementScreen:R,onClose:X,onScreenSelect:k}),o.ZP.createElement(wt.Z,{name:_||d?"none":"zoom-fade",renderCount:vr+wr,activeKey:U?vr+R:W,shouldCleanup:!0,cleanupExceptionKey:W===m.qt.MessageStatistics?m.qt.Statistics:void 0},K)))}))),Zr=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,dt.Z)(ct.gl.Extra,"MediaViewer",!t);return n?o.ZP.createElement(n,null):void 0}));let Cr=[],br=!1;function Er(e,t){Cr.push({url:e,filename:t}),br||(br=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Cr)Sr(t),e++,10===e&&(await(0,N.wO)(1e3),e=0);Cr=[]}(),br=!1}),1e3))}function Sr(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 Mr=new Set,Rr=new Set,kr=(0,o.X$)((0,s.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:a,showNotification:r}=(0,s.Sv)(),c=(0,Kn.Z)(1e3,!0),d=(0,o.I4)((e=>{Rr.add(e),c((()=>{Rr.size&&(a({messages:Array.from(Rr)}),Rr.clear())}))}),[a,c]);(0,o.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,s]=e;return s.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{if(Mr.has(e))return;Mr.add(e);const t=(0,l.Ti)(e,"download");if(!t)return void d(e);const n=ve.UV(t);if(n)return Er(n,(0,l.w6)(e)),void d(e);const{document:s,video:a,audio:o}=e.content;if(((s||a||o)?.size||0)>h.l0&&!h.rT&&!h.Mc)return r({message:"Downloading files bigger than 2GB is not supported in your browser."}),void d(e);const c=(0,l.kG)(e,"download");ve.he(t,c,!0).then((t=>{if(c===i.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),s=(0,l.w6)(e);n.searchParams.set("filename",encodeURIComponent(s)),window.open(n.toString())?.addEventListener("beforeunload",(()=>{r({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&Er(t,(0,l.w6)(e));d(e)}))})):Mr.clear()}),[n,t,a,d,r])})));var Nr=n(13103);const Tr=(0,o.X$)((0,s.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:s}=n||{},a=s&&(0,c.Z1)(e,s);return{canPost:Boolean(a)&&(0,l.Qm)(a,i._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:s}=e;const{closeGame:a,openForwardMenu:i}=(0,Y.Sv)(),r=(0,yt.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,vo.Z)(d);(0,it.Z)((()=>{m({type:"playingGame"})}),u&&s?5e3:void 0);const h=(0,o.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:d,messageIds:[l],withMyScore:!0}),a()),"share_game"===t.eventType&&(i({fromChatId:d,messageIds:[l]}),a())}catch(e){}}),[d,a,l,i]),g=(0,o.I4)((e=>{e.currentTarget.focus()}),[]);return(0,o.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,o.d4)((()=>{if(u)return Se.Z.disableRefresh(),()=>{Se.Z.enableRefresh()}}),[u]),o.ZP.createElement(Nr.Z,{className:"GameModal",isOpen:u,onClose:a,title:n,hasCloseButton:!0},u&&o.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),Ar=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,dt.Z)(ct.gl.Extra,"Notifications",!t);return n?o.ZP.createElement(n,null):void 0})),Br=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,dt.Z)(ct.gl.Extra,"Dialogs",!t);return n?o.ZP.createElement(n,null):void 0})),xr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"ForwardRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),Lr=(0,o.X$)((e=>{const{url:t}=e,n=(0,dt.Z)(ct.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),Or=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Fr=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,dt.Z)(ct.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),Ur=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,dt.Z)(ct.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),jr=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,dt.Z)(ct.gl.Calls,"PhoneCall",!t);return n?o.ZP.createElement(n,null):void 0}));function Dr(){return Dr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Dr.apply(this,arguments)}const qr=(0,o.X$)((0,Y.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,Y.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},a=e=>{let{chatId:t,type:n,threadId:a}=e;(0,Ft.Z)({isActive:!0,hash:(0,rt.q2)(t,n,a),onBack:s})};return o.ZP.createElement("div",null,t?.map(((e,t)=>o.ZP.createElement(a,Dr({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),$r=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"NewContactModal",!t);return n?o.ZP.createElement(n,e):void 0})),Gr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Calls,"RatePhoneCallModal",!t);return n?o.ZP.createElement(n,e):void 0})),Hr=(0,o.X$)((e=>{const{webApp:t}=e,n=(0,dt.Z)(ct.gl.Extra,"WebAppModal",!t);return n?o.ZP.createElement(n,e):void 0})),Vr=(0,o.X$)((e=>{const{bot:t}=e,n=(0,dt.Z)(ct.gl.Extra,"BotTrustModal",!t);return n?o.ZP.createElement(n,e):void 0})),_r=(0,o.X$)((e=>{const{bot:t}=e,n=(0,dt.Z)(ct.gl.Extra,"AttachBotInstallModal",!t);return n?o.ZP.createElement(n,e):void 0})),zr={root:"vfd0Bo1X6k19aaxQ577t"},Wr=h.wB?50:100,Xr=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Jr=(0,o.X$)((0,s.c$)((e=>(0,g.ei)(e,["confetti"])))((e=>{let{confetti:t}=e;const n=(0,o.sO)(null),s=(0,o.sO)([]),a=(0,o.sO)(!1),i=(0,an.Z)(),r=(0,st.Z)(),{lastConfettiTime:c,top:d,width:l,left:u,height:m}=t||{},h=()=>{if(!n.current||!a.current)return;const e=n.current,t=e.getContext("2d");if(!t)return;const{width:o,height:i}=e;t.clearRect(0,0,o,i);const r=[];s.current.forEach(((e,n)=>{const{pos:a,velocity:o,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:a.x+o.x*p,y:a.y+o.y*p},I={x:.98*o.x,y:o.y+=1e3*p},v=c*Math.abs(Math.sin(g*u)),w=5*g*u*(Math.PI/180),y=g+1,P=Date.now();if(f.y>i+e.size)return void r.push(e);const Z={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:P,frameCount:y};s.current[n]=Z,t.fillStyle=d,t.beginPath(),t.ellipse(a.x,a.y,c,l,m,0,2*Math.PI),t.fill()})),s.current=s.current.filter((e=>!r.includes(e))),s.current.length?requestAnimationFrame(h):a.current=!1};if((0,Ke.Z)((e=>{let t,[n]=e;return n!==c&&(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wr;for(let a=0;a<n;a++){const n=a%2,o={x:e*(n?-.1:1.1),y:.75*t},i=Math.random()*e*1.5,r={x:n?i:-1*i,y:-t/2-Math.random()*t},c=Xr[Math.floor(Math.random()*Xr.length)],d=10;s.current.push({pos:o,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}(l||i.width,m||i.height),t=setTimeout(r,1e4),a.current||(a.current=!0,requestAnimationFrame(h))),()=>{t&&clearTimeout(t)}}),[c,h]),!c||Date.now()-c>1e4)return;const g=(0,Ds.Z)(Boolean(d)&&`top: ${d}px`,Boolean(u)&&`left: ${u}px`,Boolean(l)&&`width: ${l}px`,Boolean(m)&&`height: ${m}px`);return o.ZP.createElement("div",{id:"Confetti",className:zr.root,style:g},o.ZP.createElement("canvas",{ref:n,className:zr.canvas,width:i.width,height:i.height}))}))),Yr=(0,o.X$)((e=>{const{urlAuth:t}=e,n=(0,dt.Z)(ct.gl.Extra,"UrlAuthModal",!t);return n?o.ZP.createElement(n,e):void 0})),Kr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"PremiumMainModal",!t);return n?o.ZP.createElement(n,e):void 0})),Qr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),ec=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,dt.Z)(ct.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),tc=(0,o.X$)((e=>{const{limit:t}=e,n=(0,dt.Z)(ct.gl.Extra,"PremiumLimitReachedModal",!t);return n?o.ZP.createElement(n,e):void 0})),nc=(0,o.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,dt.Z)(ct.gl.Extra,"DeleteFolderDialog",!t);return n?o.ZP.createElement(n,e):void 0})),sc=(0,o.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,dt.Z)(ct.gl.Extra,"CustomEmojiSetsModal",!t);return n?o.ZP.createElement(n,e):void 0})),ac=(0,o.X$)((e=>{const{requestedDraft:t}=e,n=(0,dt.Z)(ct.gl.Extra,"DraftRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),oc=(0,o.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,dt.Z)(ct.gl.Extra,"AttachBotRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0}));let ic,rc=!1;function cc(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function dc(e){document.title!==e&&(document.title=e)}const lc=(0,o.X$)((0,s.c$)((e=>{const{settings:{byKey:{animationLevel:t,language:n,wasTimeFormatSetManually:s}},botTrustRequest:a,requestedAttachBotInstall:o,requestedAttachBotInChat:i,requestedDraft:r,urlAuth:d,webApp:l,safeLinkModalUrl:u,lastSyncTime:m,openedStickerSetShortName:h,openedCustomEmojiSetIds:g,shouldSkipHistoryAnimations:p}=e,{chatId:f,messageId:I}=e.audioPlayer,v=f&&I?(0,c.hj)(e,f,I):void 0,w=e.openedGame,y=(w&&(0,c.hj)(e,w.chatId,w.messageId))?.content.game?.title,P=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;return{lastSyncTime:m,isLeftColumnOpen:e.isLeftColumnShown,isRightColumnOpen:(0,c.Jf)(e),isMediaViewerOpen:(0,c.zQ)(e),isForwardModalOpen:(0,c.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:v,safeLinkModalUrl:u,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:p,openedStickerSetShortName:h,openedCustomEmojiSetIds:g,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:t,language:n,wasTimeFormatSetManually:s,isPhoneCallActive:Boolean(e.phoneCall),addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:e.newContact?.userId,newContactByPhoneNumber:e.newContact?.isByPhoneNumber,openedGame:w,gameTitle:y,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall),botTrustRequest:a,botTrustRequestBot:a&&(0,c.dy)(e,a.botId),attachBotToInstall:o&&(0,c.dy)(e,o.botId),requestedAttachBotInChat:i,webApp:l,currentUser:P,urlAuth:d,isPremiumModalOpen:e.premiumModal?.isOpen,limitReached:e.limitReachedModal?.limit,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),deleteFolderDialogId:e.deleteFolderDialogModal,requestedDraft:r}}))((e=>{let{lastSyncTime:t,isLeftColumnOpen:n,isRightColumnOpen:i,isMediaViewerOpen:r,isForwardModalOpen:c,hasNotifications:d,hasDialogs:l,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:f,limitReached:I,openedStickerSetShortName:v,openedCustomEmojiSetIds:w,isServiceChatReady:y,animationLevel:P,language:Z,wasTimeFormatSetManually:C,addedSetIds:b,addedCustomEmojiIds:E,isPhoneCallActive:S,newContactUserId:M,newContactByPhoneNumber:R,openedGame:k,gameTitle:T,isRatePhoneCallModalOpen:A,botTrustRequest:B,botTrustRequestBot:x,attachBotToInstall:L,requestedAttachBotInChat:O,requestedDraft:F,webApp:U,currentUser:j,urlAuth:D,isPremiumModalOpen:q,isPaymentModalOpen:$,isReceiptModalOpen:G,deleteFolderDialogId:H}=e;const{loadAnimatedEmojis:V,loadNotificationSettings:_,loadNotificationExceptions:z,updateIsOnline:W,loadTopInlineBots:X,loadEmojiKeywords:J,loadCountryList:Y,loadAvailableReactions:Q,loadStickerSets:ee,loadPremiumGifts:te,loadAddedStickers:ne,loadFavoriteStickers:se,ensureTimeFormat:ae,closeStickerSetModal:oe,closeCustomEmojiSets:ie,checkVersionNotification:re,loadAppConfig:ce,loadAttachBots:de,loadContactList:le,loadCustomEmojis:ue,closePaymentModal:me,clearReceipt:he,checkAppVersion:ge,openChat:pe}=(0,s.Sv)();a.eM&&!rc&&(rc=!0,console.log(">>> RENDER MAIN")),(0,it.Z)(ge,3e5,!0),(0,o.d4)((()=>{t&&(W(!0),ce(),Q(),V(),_(),z(),X(),J({language:a.pR}),de(),le(),te(),ge())}),[t,V,J,z,_,X,W,Q,ce,de,le,te,ge]),(0,o.d4)((()=>{t&&(Z!==a.pR&&J({language:Z}),Y({langCode:Z}))}),[Z,t,Y,J]),(0,Xe.Z)((e=>{let[n]=e;!n&&t&&ue({ids:Object.keys((0,s.Rd)().customEmojis.byId),ignoreCache:!0})}),[t]),(0,o.d4)((()=>{t&&(b&&E||(ee(),se()),b&&E&&ne())}),[t,b,ee,se,ne,E]),(0,o.d4)((()=>{t&&y&&re()}),[t,y,re]),(0,o.d4)((()=>{t&&!C&&ae()}),[t,C,ae]),(0,o.d4)((()=>{const e=(0,rt.dx)();t&&e?.tgaddr&&(0,We.ou)(decodeURIComponent(e.tgaddr))}),[t]),(0,Xe.Z)((e=>{let[n]=e;const s=(0,rt.VX)();s&&!n&&t&&pe({id:s.chatId,threadId:s.threadId,type:s.type})}),[t]),(0,o.d4)((()=>{if(m||S)return Se.Z.disableRefresh(),()=>{Se.Z.enableRefresh()}}),[m,S]);const fe=(0,at.Z)(n,void 0,!0,void 0,f),Ie=(0,o.sO)(!1),ve=(0,st.Z)();(0,Ke.Z)((e=>{let[t]=e;if(void 0===t||0===P)return;Ie.current=!0,h.wZ&&(0,N.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!n)}));const s=(0,ot.YW)();(0,ze.L)(document.getElementById("MiddleColumn"),(()=>{s(),Ie.current=!1,ve()}))}),[n]);const we=(0,at.Z)(i,void 0,!0,void 0,f),ye=(0,o.sO)(!1),[Pe,Ze]=(0,o.eJ)(i);(0,Ke.Z)((e=>{let[t]=e;if(void 0===t)return;if(0===P)return void Ze(i);ye.current=!0;const n=(0,ot.YW)();(0,ze.L)(document.getElementById("RightColumn"),(()=>{n(),ye.current=!1,ve(),Ze(i)}))}),[i]);const Ce=(0,_e.Z)(fe.hasShownClass&&"left-column-shown",fe.hasOpenClass&&"left-column-open",Ie.current&&"left-column-animating",we.hasShownClass&&"right-column-shown",we.hasOpenClass&&"right-column-open",ye.current&&"right-column-animating",Pe&&"narrow-message-list",f&&"history-animation-disabled"),be=(0,o.I4)((()=>{W(!1);const e=(0,K.xW)();let t=0;clearInterval(ic),ic=window.setInterval((()=>{if(document.title.includes(a.ou))cc(!1);else{if(t%2==0){const t=(0,K.xW)()-e;t>0&&(dc(`${t} notification${t>1?"s":""}`),cc(!0))}else dc(a.Ti),cc(!1);t++}}),1e3)}),[W]),Ee=(0,o.I4)((()=>{W(!0),clearInterval(ic),ic=void 0,document.title.includes(a.ou)||dc(a.Ti),cc(!1)}),[W]),Me=(0,o.I4)((()=>{oe()}),[oe]),Re=(0,o.I4)((()=>{ie()}),[ie]);return(0,Je.Z)(be,Ee),Ye(be),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,o.d4)((()=>{if(h.$b){if(!e)return Qe?.setAttribute("content",et),h.cj&&!h.fl&&document.addEventListener("gesturestart",nt),()=>{Qe?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",nt)};Qe?.setAttribute("content",tt)}}),[e])}(r),o.ZP.createElement("div",{id:"Main",className:Ce},o.ZP.createElement(en,null),o.ZP.createElement(Ui,null),o.ZP.createElement(Pr,null),o.ZP.createElement(Zr,{isOpen:r}),o.ZP.createElement(xr,{isOpen:c}),o.ZP.createElement(ac,{requestedDraft:F}),o.ZP.createElement(Ar,{isOpen:d}),o.ZP.createElement(Br,{isOpen:l}),u&&o.ZP.createElement(qn,{key:u.id,message:u,noUi:!0}),o.ZP.createElement(Lr,{url:g}),o.ZP.createElement(Yr,{urlAuth:D,currentUser:j}),o.ZP.createElement(Or,{isOpen:p}),o.ZP.createElement(lt,{isOpen:Boolean(v),onClose:Me,stickerSetShortName:v}),o.ZP.createElement(sc,{customEmojiSetIds:w,onClose:Re}),m&&o.ZP.createElement(Fr,{groupCallId:m}),o.ZP.createElement(Ur,{isActive:Boolean(m||S)}),o.ZP.createElement($r,{isOpen:Boolean(M||R),userId:M,isByPhoneNumber:R}),o.ZP.createElement(Tr,{openedGame:k,gameTitle:T}),o.ZP.createElement(Hr,{webApp:U}),o.ZP.createElement(kr,null),o.ZP.createElement(Jr,null),o.ZP.createElement(jr,{isActive:S}),o.ZP.createElement(gt,{isForAppBadge:!0}),o.ZP.createElement(Gr,{isOpen:A}),o.ZP.createElement(Vr,{bot:x,type:B?.type}),o.ZP.createElement(_r,{bot:L}),o.ZP.createElement(oc,{requestedAttachBotInChat:O}),o.ZP.createElement(qr,null),q&&o.ZP.createElement(Kr,{isOpen:q}),o.ZP.createElement(tc,{limit:I}),o.ZP.createElement(Qr,{isOpen:$,onClose:me}),o.ZP.createElement(ec,{isOpen:G,onClose:he}),o.ZP.createElement(nc,{deleteFolderDialogId:H}))})));var uc=n(99364),mc=n(8337);var hc=n(2092);const gc=(0,o.X$)((0,s.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:a,signOut:i,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,s.Sv)(),{invalidAttemptsCount:d,isLoading:l}=n,u=(0,yt.Z)(),[m,h]=(0,o.eJ)(""),[g,p]=(0,o.eJ)(!1),[f,I,v]=(0,It.Z)(!1),{shouldRender:w}=(0,at.Z)(t);(0,Za.Z)(c,d&&d>=5?18e4:void 0);const y=(0,o.I4)((()=>{h("")}),[]),P=(0,o.I4)((e=>{d&&d>=5?h(u("FloodWait")):(h(""),(0,R.so)(e).then(a,(()=>{r(),h(u("lng_passcode_wrong"))})))}),[d,u,r,a]);(0,o.d4)((()=>{d&&d>=5?h(u("FloodWait")):0===d&&h("")}),[d,u]);const Z=(0,o.I4)((()=>{v(),i()}),[v,i]);if(w)return o.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},o.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:u.isRtl?"rtl":void 0},o.ZP.createElement(Gs.Z,{tgsUrl:Us.l.Lock,previewUrl:hc,size:160,className:"ar9YdQbWJreREHmnZa9m"}),o.ZP.createElement(uc.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:l,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:y,isPasswordVisible:g,noRipple:!0,onChangePasswordVisibility:p,onSubmit:P}),o.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},o.ZP.createElement("p",null,o.ZP.createElement(mc.Z,{onClick:I},"Log out")," ","if you don't remember your passcode."),o.ZP.createElement("p",null,o.ZP.createElement(Rt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:I},u("AccountSettings.Logout"))))),o.ZP.createElement(wn.Z,{isOpen:f,onClose:v,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:Z,confirmIsDestructive:!0}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{connectionState:pc,passcode:{isScreenLocked:fc}}=(0,s.Rd)();pc||fc||(0,s.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
|
||
//# sourceMappingURL=5769.da38c612e52261d1e09b.js.map
|