2 lines
309 KiB
JavaScript
2 lines
309 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{19518:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>br,Main:()=>wr});var s=n(33555),a=n(83716),o=n(14050),i=(n(89005),n(6137)),r=n(5161),c=n(11192),l=n(70735),d=n(75806);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,d.uw)(s,a),{query:u}=e.localTextSearch.byChatThreadKey[i]||{};return o!==u&&(e=(0,r.Pb)(e,s,a,l.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:l=!1}=n,d=(0,c.Bt)(e);return d&&d.chatId===s&&d.threadId===a&&d.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,l)})),(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)("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})}));var m=n(91713),h=n(77361),g=n(60782),p=n(82267),f=n(83099),v=n(50711),I=n(64319);const w=a.ck+a.fK;let y;function Z(e,t,n){const{threadId:s}=(0,c.Bt)(e)||{},a=v.i0,o=(0,c.Zw)(e,t);if(!o||!s)return;const i=n.map((e=>o[e])).filter((t=>(0,c._k)(e,t,s).canCopy)).sort(((e,t)=>e.id-t.id)).reduce(((t,n)=>{const s=(0,c.Ur)(e,n);return t.push(`> ${s?(0,d.OU)(a,s):""}:`),t.push(`${(0,d.MK)(a,n,!1,0,void 0,!0)}\n`),t}),[]);(0,I.TE)(i.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:l}=a,d="scheduled"===l?"editingScheduledId":"editingId";return(0,r.pf)(e,o,i,d,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),l=(0,c.Cb)(e,a,o);if(!r||!l)return;const d=(0,c.Yy)(e,a,o);let u;if((0,c.b9)(e,a,o)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+s;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===i._f){var m;const t=(0,c.Z1)(e,a);u=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,c.tZ)(e,a,o);u=null==t?void 0:t.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:l}=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:l||e.audioPlayer.isMuted}}})),(0,s.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:s,isMuted:!1}}})),(0,s.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:s}}})),(0,s.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:s}}})),(0,s.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:s}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:s}}})),(0,s.iw)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,s.iw)("openPollResults",((e,t,n)=>{const{chatId:a,messageId: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;if(a===i._f){var r;const t=(0,c.Z1)(e,s);o=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,c.tZ)(e,s,a);o=null==t?void 0:t.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:l="thread",noHighlight:d,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f}=n;let{messageId:v}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);null!=t&&t.length&&([v]=t)}const I=(0,c.Bt)(e),Z=!I||a!==I.chatId||o!==I.threadId||l!==I.type;if(y&&(clearTimeout(y),y=void 0),y=window.setTimeout((()=>{let e=(0,s.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,s.R3)(e)}),d?w:1500),e=(0,r.cq)(e,a,v,d,p),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,a,o)||[];e=(0,r.pf)(e,a,o,"replyStack",[...t,g])}Z&&(e=(0,r.wV)(e,m.fo.Static));const P=(0,c.Cb)(e,a,o);if(P&&P.includes(v))return(0,s.R3)(e),void t.openChat({id:a,threadId:o,shouldReplaceHistory:f});if(Z&&(e=(0,r.pf)(e,a,o,"viewportIds",void 0)),e=(0,r.pf)(e,a,o,"outlyingIds",void 0),P&&!Z){const t=v>P[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,s.R3)(e),t.openChat({id:a,threadId: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)("exitForwardMode",(e=>{(0,s.R3)({...e,forwardMessages:{}})})),(0,s.iw)("setForwardChatId",((e,t,n)=>{const{id:a}=n;(0,s.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,isModalShown:!1}}),t.openChat({id:a}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(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:l}=n,d=(0,c.Bt)(e);if(!d)return;const{chatId:u,threadId:m,type:g}=d;e=(0,r.Ob)(e,u,m,g,a,o,i,l),(0,s.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.$b?"long tap":"right click"} on a message.`}))})),(0,s.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,s.iw)("exitMessageSelectMode",r.i9),(0,s.iw)("openPollModal",((e,t,n)=>{const{isQuiz:s}=n||{};return{...e,pollModal:{isOpen:!0,isQuiz:s}}})),(0,s.iw)("closePollModal",(e=>({...e,pollModal:{isOpen:!1}}))),(0,s.iw)("checkVersionNotification",((e,t)=>{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.48**\n\n👏 **Harder**\n• Meet Seamless Web Bots (such as [@discussbot](https://t.me/discussbot)) helping you to log in with your Telegram account on websites.\n\n🤩 **Better**\n• Podcasts and long tracks can now be played at 2X speed.\n• Audio Player buttons do not jump anymore when navigating between tracks.\n\n💪 **Stronger**\n• Fixed pasting text after switching chat.\n• Fixed sending and playing `.mov` videos.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,s.iw)("createServiceNotification",((e,t,n)=>{var o;const{message:i,version:r}=n,{serviceNotifications:l}=e,d=(0,c.Z1)(e,a.aw),u=Math.max((null===(o=d.lastMessage)||void 0===o?void 0:o.id)||0,...l.map((e=>{let{id:t}=e;return t}))),m=(l.length+1)/1e3,h=Math.floor(u)+m;i.previousLocalId=i.id,i.id=h;const g={id:h,message:i,version:r,isUnread:!0};(0,s.R3)({...e,serviceNotifications:[...l.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(0,s.iw)("openReactorListModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,reactorModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,s.iw)("openSeenByModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,seenByModal:{chatId:s,messageId:a}}})),(0,s.iw)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,s.iw)("copySelectedMessages",(e=>{if(!e.selectedMessages)return;const{chatId:t,messageIds:n}=e.selectedMessages;Z(e,t,n)})),(0,s.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.jr)(e);s&&0!==s.length&&a&&Z(e,a.id,s)})),(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s}=n,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:s})})),(0,s.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:s}=n,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[s]});const 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 P=n(91947),b=n(26926);(0,s.iw)("toggleChatInfo",((e,t,n)=>({...e,isChatInfoShown:void 0!==n?n:!e.isChatInfoShown}))),(0,s.iw)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,s.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,s.iw)("toggleManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,s.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:s}=n||{},{chatId:a}=(0,c.Bt)(e)||{};if(a)return{...e,management:{byChatId:{...e.management.byChatId,[a]:{...e.management.byChatId[a],isActive:!0,nextScreen:s}}}}})),(0,s.iw)("closeManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,s.iw)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,s.iw)("toggleStatistics",(e=>({...e,isStatisticsShown:!e.isStatisticsShown,statistics:{...e.statistics,currentMessageId:void 0}}))),(0,s.iw)("toggleMessageStatistics",((e,t,n)=>({...e,statistics:{...e.statistics,currentMessageId:null==n?void 0:n.messageId}}))),(0,s.iw)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,s.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:s}=n,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[s]};const o=a.filter((e=>e!==s));return o.unshift(s),o.length>18&&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)("reorderStickerSets",((e,t,n)=>{const{order:s}=n;return{...e,stickers:{...e.stickers,added:{setIds:s}}}})),(0,s.iw)("showNotification",((e,t,n)=>{const s=n;s.localId=(0,b.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,P.ZP)(s))return e;const a=[...e.dialogs];if("message"in s){const e=a.findIndex((e=>e.message===s.message));-1!==e&&a.splice(e,1)}return a.push(s),{...e,dialogs:a}})),(0,s.iw)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,s.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:s}=n;return{...e,safeLinkModalUrl:s}})),(0,s.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:s}=n;return{...e,historyCalendarSelectedAt:s}})),(0,s.iw)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,s.iw)("openGame",((e,t,n)=>{const{url:a,chatId:o,messageId:i}=n,r=(0,c.hj)(e,o,i);if(!r)return;const l=r.viaBotId||r.senderId,d=l&&(0,c.kB)(e,l);d&&((0,c.LM)(e,d)?(0,s.R3)({...e,openedGame:{url:a,chatId:o,messageId:i}}):(0,s.R3)({...e,botTrustRequest:{bot:d,type:"game",onConfirm:{action:"openGame",payload:n}}}))})),(0,s.iw)("closeGame",(e=>({...e,openedGame:void 0}))),(0,s.iw)("openPaymentModal",((e,t,n)=>{const{chatId:s,messageId:a}=n;return{...e,payment:{...e.payment,chatId:s,messageId:a,isPaymentModalOpen:!0}}})),(0,s.iw)("closePaymentModal",(e=>(e=(0,r.bp)(e),(0,r.WY)(e)))),(0,s.iw)("addPaymentError",((e,t,n)=>{const{error:s}=n;return{...e,payment:{...e.payment,error:s}}}));var C=n(88422);(0,s.iw)("openMediaViewer",((e,t,n)=>{const{chatId:s,threadId:a,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:l,playbackRate:d,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:s,threadId:a,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:null!=l?l:e.mediaViewer.volume,playbackRate:d||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,s.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:s}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,playbackRate:s}}})),(0,s.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:s}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:s,isMuted:!1}}})),(0,s.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:s}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:s}}})),(0,s.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:s}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:s}}}));var S=n(3100),M=n(95281),E=n(5872),R=n(69118);let k=!1;(0,R.Gq)((()=>{(0,s.Rd)().passcode.hasPasscode&&!k&&(0,S.jv)()})),(0,s.iw)("setPasscode",(async(e,t,n)=>{let{passcode:a}=n;(0,s.R3)((0,r.vu)(e,{isLoading:!0})),await(0,M.AU)(a);const o=JSON.stringify({...(0,S.K8)(),userId:e.currentUserId}),i=(0,E.Uf)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,M.H4)(o,i),(0,s.R3)((0,r.vu)((0,s.Rd)(),{hasPasscode:!0,error:void 0,isLoading:!1})),(0,E.jA)(!0)})),(0,s.iw)("clearPasscode",(e=>((0,M.C8)(),(0,r.Kn)(e)))),(0,s.iw)("unlockScreen",((e,t,n)=>{let{sessionJson:a,globalJson:o}=n;const i=JSON.parse(a);(0,S.wX)(i,i.userId),e=JSON.parse(o),(0,s.R3)((0,r.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0})),t.initApi()})),(0,s.iw)("logInvalidUnlockAttempt",(e=>{var t,n;return(0,r.vu)(e,{invalidAttemptsCount:(null!==(t=null===(n=e.passcode)||void 0===n?void 0:n.invalidAttemptsCount)&&void 0!==t?t:0)+1})})),(0,s.iw)("resetInvalidUnlockAttempts",(e=>(0,r.vu)(e,{invalidAttemptsCount:0}))),(0,s.iw)("setPasscodeError",((e,t,n)=>{const{error:s}=n;return(0,r.vu)(e,{error:s})})),(0,s.iw)("clearPasscodeError",(e=>(0,r.vu)(e,{error:void 0}))),(0,s.iw)("skipLockOnUnload",(()=>{k=!0})),n(65456),n(27225);var N=n(71226),A=n(81396);const T=new Map,B=(0,R.Ds)((e=>e()),500,!1);async function x(e,t,n,o){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const d=e.id;let u;switch(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,N.t9)("fetchMessages",{chat:(0,c.Cm)((0,s.Rd)(),d,t),offsetId:n,addOffset:u,limit:a.hT,threadId:t});if(!h)return;const{messages:p,users:f,chats:v,threadInfos:I}=h;let w=(0,s.Rd)();const y=d===a.aw?w.serviceNotifications.map((e=>{let{message:t}=e;return t})):[],Z=[].concat(p,y),P=(0,g.ee)(Z,"id"),b=Object.keys(P).map(Number);w=(0,r.c_)(w,d,P),w=i?(0,r.ff)(w,d,t,b):(0,r.xj)(w,d,t,b),w=(0,r.Sh)(w,(0,g.ee)(f,"id")),w=(0,r.fZ)(w,(0,g.ee)(v,"id")),w=(0,r.j6)(w,d,I);let C=(0,c.gb)(w,d,t);const S=(0,c.qC)(w,d,t);if(i&&C&&S&&(S.length&&!(0,g.YE)(C,S)||(w=(0,r.xj)(w,d,t,S),C=(0,c.gb)(w,d,t),w=(0,r.pf)(w,d,t,"outlyingIds",void 0),i=!1)),!l){const e=i?S:C,{newViewportIds:s}=L(e,n,o);w=(0,r.y9)(w,d,t,s)}(0,s.R3)(w)}function L(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,l=e.slice(Math.max(0,r),c+1);let d,u;switch(n){case m.Uq.Backwards:d=i>0,u=r>=0;break;case m.Uq.Forwards:d=i<s,u=c<=s-1;break;case m.Uq.Around:default:d=l.length>0,u=l.length===a.hT}return{newViewportIds:l,areSomeLocal:d,areAllLocal:u}}async function O(e){let t;const n=e.attachment?(e,a)=>{T.has(a)||(t=a,T.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,R.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)),await(0,N.t9)("sendMessage",e,n),n&&t&&T.delete(t)}(0,s.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:i,threadId:l}=n||{};if(!i){const t=(0,c.Bt)(e);if(!t)return;i=t.chatId,l=t.threadId}const d=(0,c.Z1)(e,i);if(!d||d.isRestricted)return;const u=(0,c.Cb)(e,i,l),h=(0,c.gb)(e,i,l),g=(0,c.qC)(e,i,l);if(u&&u.length&&s!==m.Uq.Around){const n=s===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),c=a?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:v}=L(c,n,s);if(f&&(e=(0,r.y9)(e,i,l,p)),(0,R.R3)((()=>{!async function(e,t,n,s,a,o,i,r){t||await x(a,o,r,i,n,s),s||e.loadViewportMessages({chatId:a.id,threadId:o,direction:i,isBudgetPreload:!0})}(t,v,a,o,d,l,s,n)})),o)return}else{const t=(0,c.G$)(e,i)||(0,c.rd)(e,i,l),n=Boolean(t&&h&&!h.includes(t)),s=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=L(s,t,m.Uq.Around);p&&u.length>=a.hT&&(e=(0,r.y9)(e,i,l,u)),f||(0,R.R3)((()=>{x(d,l,t,m.Uq.Around,n,o)}))}return e})),(0,s.iw)("loadMessage",(async(e,t,n)=>{const{chatId:a,messageId:o,replyOriginForId:l,threadUpdate:d}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await async function(e,t,n){const a=await(0,N.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===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,l);if(m&&d){const{lastMessageId:e,isDeleting:t}=d;(0,s.R3)((0,r.lG)((0,s.Rd)(),m,a,e,t))}})),(0,s.iw)("sendMessage",((e,t,n)=>{const s=(0,c.Bt)(e);if(!s)return;const{chatId:o,threadId:i,type:r}=s;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const l=(0,c.Z1)(e,o),d={...n,chat:l,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}=d;O({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...s}=d,o=(0,g.Vl)(n,a.DU);for(let n=0;n<o.length;n++){const[a,...i]=o[n],r=`${Date.now()}${n}`;O({...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=>{O({...s,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:s,...a}=d;e&&O({...a,text:e,entities:t,replyingTo:s}),n.forEach((e=>{O({...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:l,type:d}=i,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,l,d);u&&m&&((0,N.t9)("editMessage",{chat:u,message:m,text:a,entities:o,noWebPage:(0,c.tV)(e,r,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))})),(0,s.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:s,messageId:a}=n,o=(0,c.hj)(e,s,a),i=o&&T.get((0,d.KK)(o));i&&(0,N.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:s})})),(0,s.iw)("saveDraft",((e,t,n)=>{const{chatId:s,threadId:a,draft:o}=n;if(!o)return;const{text:l,entities:d}=o,u=(0,c.Z1)(e,s);return a===i._f&&(0,N.t9)("saveDraft",{chat:u,text:l,entities:d,replyToMsgId:(0,c.Yy)(e,s,a)}),e=(0,r.pf)(e,s,a,"draft",o),(0,r.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)})})),(0,s.iw)("clearDraft",((e,t,n)=>{const{chatId:s,threadId:a,localOnly:o}=n;if(!(0,c.Ms)(e,s,a))return;const l=(0,c.Z1)(e,s);return o||a!==i._f||(0,N.t9)("clearDraft",l),e=(0,r.pf)(e,s,a,"draft",void 0),(0,r.a4)(e,s,{draftDate:void 0})})),(0,s.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:s,threadId:a,noWebPage: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,N.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,N.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,l=(0,c.Z1)(e,i);(0,N.t9)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:a});const d=(0,c._$)(e,i,r);s.includes(d)&&t.setEditingId({messageId:void 0})})),(0,s.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:s}=n,a=(0,c.Bt)(e);if(!a)return;const{chatId:o}=a,i=(0,c.Z1)(e,o);(0,N.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)=>{var s;const{chatId:a,shouldDeleteForAll:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const r=null===(s=i.lastMessage)||void 0===s?void 0:s.id;await(0,N.t9)("deleteHistory",{chat:i,shouldDeleteForAll:o,maxId:r});const l=(0,c.Bt)(e);l&&l.chatId===a&&t.openChat({id:void 0})})),(0,s.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:s,reason:a,description:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r}=i,l=(0,c.Z1)(e,r),d=await(0,N.t9)("reportMessages",{peer:l,messageIds:s,reason:a,description:o});t.showNotification({message:d?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("sendMessageAction",(async(e,t,n)=>{const{action:s,chatId:a,threadId:o}=n;if(a===e.currentUserId)return;const i=(0,c.Z1)(e,a);i&&await(0,N.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:l,threadId:d}=o,u=(0,c.Cm)(e,l,d);if(!u)return;const{maxId:m}=n;if(B((()=>{(0,N.t9)("markMessageListRead",{serverTimeOffset:s,chat:u,threadId:d,maxId:m})})),d!==i._f)return;l===a.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,c.Cb)(e,l,d),g=(0,c.It)(e,l,d);if(!h||!g||!u.unreadCount)return e;const p=function(e,t,n){let s=0;for(let a=0,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,l,{lastReadInboxMessageId:m,unreadCount:Math.max(0,u.unreadCount-p)}):e})),(0,s.iw)("markMessagesRead",((e,t,n)=>{const s=(0,c.jr)(e);if(!s)return;const{messageIds:a}=n;(0,N.t9)("markMessagesRead",{chat:s,messageIds:a})})),(0,s.iw)("loadWebPagePreview",((e,t,n)=>{const{text:a}=n;!async function(e){const t=await(0,N.t9)("fetchWebPagePreview",{message:e});(0,s.R3)({...(0,s.Rd)(),webPagePreview:t})}(a)})),(0,s.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,s.iw)("sendPollVote",((e,t,n)=>{const{chatId:s,messageId:a,options:o}=n,i=(0,c.Z1)(e,s);i&&(0,N.t9)("sendPollVote",{chat:i,messageId:a,options:o})})),(0,s.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:a,messageId:o,option:i,offset:c,limit:l,shouldResetVoters:d}=n;!async function(e,t,n,a,o,i){const c=await(0,N.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:a,limit:o});if(!c)return;let l=(0,s.Rd)();l=(0,r.Sh)(l,(0,g.ee)(c.users,"id"));const{voters:d}=l.pollResults;(0,s.R3)({...l,pollResults:{...l.pollResults,voters:{...d,[n]:(0,g.Tw)([...!i&&d&&d[n]?d[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(a,o,i,c,l,d)})),(0,s.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:a,messageIds:o,toChatId:i,withMyScore:r}=e.forwardMessages,l=a?(0,c.Z1)(e,a):void 0,u=i?(0,c.Z1)(e,i):void 0,m=a&&o?o.sort(((e,t)=>e-t)).map((t=>(0,c.hj)(e,a,t))).filter(Boolean):void 0;if(!l||!u||!m)return;const{isSilent:h,scheduledAt:g}=n,p=(0,c._5)(e,i),f=m.filter((e=>!(0,d.jM)(e)));f.length&&(0,N.t9)("forwardMessages",{fromChat:l,toChat:u,messages:f,serverTimeOffset:(0,s.Rd)().serverTimeOffset,isSilent:h,scheduledAt:g,sendAs:p,withMyScore:r}),m.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:s,poll:a}=e.content;O({chat:u,text:t,entities:n,sticker:s,poll:a,isSilent:h,scheduledAt:g,sendAs:p})})),(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,N.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,N.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,N.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,N.t9)("requestThreadInfoUpdate",{chat:o,threadId:a})})),(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,N.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:a,users:o}=t,c=(0,g.ee)(n,"id"),l=Object.keys(c).map(Number).sort(((e,t)=>t-e));let d=(0,s.Rd)();d=(0,r.c_)(d,e.id,c),d=(0,r.pf)(d,e.id,i._f,"pinnedIds",l),d=(0,r.Sh)(d,(0,g.ee)(o,"id")),d=(0,r.fZ)(d,(0,g.ee)(a,"id")),(0,s.R3)(d)}(o)})),(0,s.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(!i)return;const l=await(0,N.t9)("fetchSeenBy",{chat:i,messageId:o});l&&(0,s.R3)((0,r.cY)((0,s.Rd)(),a,o,{seenByUserIds:l}))})),(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,N.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,N.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,{sendAsIds:i.ids}),(0,s.R3)(e)):(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{sendAsIds:[]}))})),(0,s.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);if(!o)return;const i=await(0,N.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,N.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 l=await(0,N.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!l)return;const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,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;if(!o.unreadMentionsCount)return;const i=o.unreadMentionsCount-a.length,l=(o.unreadMentions||[]).filter((e=>!a.includes(e)));e=(0,r.a4)(e,o.id,{unreadMentions:l}),(0,s.R3)(e),!l.length&&i&&t.fetchUnreadMentions({chatId:o.id,offsetId:Math.max(...a)}),t.markMessagesRead({messageIds:a})})),(0,s.iw)("focusNextMention",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0]})})),(0,s.iw)("readAllMentions",(e=>{const t=(0,c.jr)(e);if(t)return(0,N.t9)("readAllMentions",{chat:t}),(0,r.a4)(e,t.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,s.iw)("openUrl",((e,t,n)=>{const{url:s,shouldSkipModal:o}=n,i=(0,A.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})}o?window.open(i,"_blank","noopener"):t.toggleSafeLinkModal({url:i})}));var U=n(85765);const F=(0,R.P2)((e=>e()),500,!1);async function $(e){const t=await(0,N.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,recent:t}})}async function q(e,t,n){const a=await(0,N.t9)("fetchStickers",{stickerSetShortName:n,stickerSetId:e,accessHash:t});let o=(0,s.Rd)();if(!a)return(0,R.R3)((()=>{(0,s.Sv)().showNotification({message:(0,v.i0)("StickerPack.ErrorNotFound")})})),void(o.openedStickerSetShortName===n&&(0,s.R3)({...o,openedStickerSetShortName:void 0}));const{set:i,stickers:c,packs:l}=a;o=(0,r.Rg)(o,i.id,{...i,stickers:c,packs:l});const d=o.stickers.forEmoji.emoji;d&&l[d]&&(o=(0,r.vy)(o)),(0,s.R3)(o)}async function D(e,t){const n=await(0,N.t9)("searchGifs",{query:e,offset:t});n&&(0,s.R3)((0,r.rq)((0,s.Rd)(),!t,n.gifs,n.nextOffset))}(0,s.iw)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,N.t9)("fetchStickerSets",{hash:e});t&&(0,s.R3)((0,r.z3)((0,s.Rd)(),"added",t.hash,t.sets))}(t)})),(0,s.iw)("loadAddedStickers",(async(e,t)=>{const{setIds:n}=e.stickers.added,s=e.stickers.setsById;if(n&&n.length)for(let e=0;e<n.length;e++){var a;const o=n[e];null!==(a=s[o])&&void 0!==a&&a.stickers||(t.loadStickers({stickerSetId:o}),e%10==0&&e>0&&await(0,R.wO)(200))}})),(0,s.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};$(t)})),(0,s.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,N.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,s.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,N.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}}))})),(0,s.iw)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,N.t9)("fetchFeaturedStickers",{hash:e});t&&(0,s.R3)((0,r.z3)((0,s.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,s.iw)("loadStickers",((e,t,n)=>{const{stickerSetId:a,stickerSetShortName:o}=n;let{stickerSetAccessHash:i}=n;if(!i&&!o){const t=(0,c.Ny)(e,a);if(!t)return void(e.openedStickerSetShortName===o&&(0,s.R3)({...e,openedStickerSetShortName:void 0}));i=t.accessHash}q(a,i,o)})),(0,s.iw)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,N.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)((0,r.g_)((0,s.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,N.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,s.R3)({...(0,s.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,s.iw)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,N.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,s.iw)("saveGif",(async(e,t,n)=>{var a;const{gif:o,shouldUnsave:i}=n;if(!await(0,N.t9)("saveGif",{gif:o,shouldUnsave:i}))return;const r=(null===(a=(e=(0,s.Rd)()).gifs.saved.gifs)||void 0===a?void 0:a.filter((e=>{let{id:t}=e;return t!==o.id})))||[],c=i?r:[o,...r];(0,s.R3)({...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:c}}})})),(0,s.iw)("faveSticker",((e,t,n)=>{const{sticker:s}=n;s&&(0,N.t9)("faveSticker",{sticker:s})})),(0,s.iw)("unfaveSticker",((e,t,n)=>{const{sticker:a}=n;a&&function(e){const t=(0,s.Rd)();(0,s.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((t=>{let{id:n}=t;return n!==e.id}))}}}),(0,N.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,s.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,N.t9)("removeRecentSticker",{sticker:s})&&$()})),(0,s.iw)("clearRecentStickers",(async e=>{await(0,N.t9)("clearRecentStickers")&&(e=(0,s.Rd)(),(0,s.R3)({...e,stickers:{...e.stickers,recent:{stickers:[]}}}))})),(0,s.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:s}=n,a=(0,c.Ny)(e,s);if(!a)return;const{accessHash:o,installedDate:i}=a;(0,N.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:o})})),(0,s.iw)("loadEmojiKeywords",(async(e,t,n)=>{var a,o;const{language:i}=n;let r=e.emojiKeywords[i];if(null!==(a=r)&&void 0!==a&&a.isLoading)return;(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{...r,isLoading:!0}}});const c=await(0,N.t9)("fetchEmojiKeywords",{language:i,fromVersion:r?r.version:0});r=(e=(0,s.Rd)()).emojiKeywords[i],c?(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{isLoading:!1,version:c.version,keywords:{...null===(o=r)||void 0===o?void 0:o.keywords,...c.keywords}}}}):(0,s.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{...r,isLoading:!1}}})})),(0,s.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;a&&F((()=>{!async function(e,t){const n=await(0,N.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const a=(0,s.Rd)(),{setsById: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,U.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&&F((()=>{D(s)}))})),(0,s.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&F((()=>{D(t,n)}))})),(0,s.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:a}=n,{hash:o}=e.stickers.forEmoji;F((()=>{!async function(e,t){let n=(0,s.Rd)();(0,s.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const a=await(0,N.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,s.Rd)(),a&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,a.stickers,a.hash),(0,s.R3)(n))}(a,o)}))})),(0,s.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,s.iw)("openStickerSetShortName",((e,t,n)=>{const{stickerSetShortName:s}=n;return{...e,openedStickerSetShortName:s}})),(0,s.iw)("openStickerSet",(async(e,t,n)=>{const{sticker:a}=n;if(!(0,c.Ny)(e,a.stickerSetId)){if(!a.stickerSetAccessHash)return void t.showNotification({message:(0,v.i0)("StickerPack.ErrorNotFound")});await q(a.stickerSetId,a.stickerSetAccessHash)}e=(0,s.Rd)();const o=(0,c.Ny)(e,a.stickerSetId);null!=o&&o.shortName&&(0,s.R3)({...e,openedStickerSetShortName:o.shortName})}));var j=n(790);const _=(0,R.P2)((e=>e()),500,!1);async function G(){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,l=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;if(i){const s=await(0,N.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:a.Hk,offsetId:o,minDate:d,maxDate:l});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,N.t9)("searchMessagesGlobal",{query:t,offsetRate:o,limit:a.Hk,type:n,maxDate:l,minDate:d});let u=(0,s.Rd)();const m=(0,c.JX)(u);if(!e||""!==t&&t!==m)return void(0,s.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:v,nextRate:I}=e;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,v,n,I),(0,s.R3)(u)}async function H(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=await(0,N.t9)("searchMessagesLocal",{chat:e,type:t,limit:2*a.EN,offsetId:n});if(!i)return;const{chats:l,users:d,messages:u,totalCount:m,nextOffsetId:h}=i,p=(0,g.ee)(u,"id"),f=Object.keys(p).map(Number);let v=(0,s.Rd)();const I=(0,c.we)(v);I&&(v=(0,r.fZ)(v,(0,g.ee)(l,"id")),v=(0,r.Sh)(v,(0,g.ee)(d,"id")),v=(0,r.c_)(v,e.id,p),v=(0,r.c1)(v,e.id,t,f,m,h),(0,s.R3)(v),o||H(e,t,h,!0))}(0,s.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:a}=e.globalSearch,{query:o}=n;o&&!a&&_((()=>{!async function(e){const t=await(0,N.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=(0,c.JX)(n);if(!t||!a||e!==a)return void(0,s.R3)((0,r.xv)(n,{chats:!1}));const{localChats:o,localUsers:i,globalChats:l,globalUsers:d}=t;(o.length||l.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...o,...l],"id"))),(i.length||d.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...i,...d],"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:l.map((e=>{let{id:t}=e;return t})),userIds:d.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,j.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;G("","text",void 0,i?(0,c.Z1)(e,i):void 0,o,a)})),(0,s.iw)("searchMessagesGlobal",((e,t,n)=>{var s;const{query:a,resultsByType:o,chatId:i,date:r}=e.globalSearch,l=r?(0,j.IS)(r):r,{type:d}=n;G(a,d,null==o||null===(s=o[d])||void 0===s?void 0:s.nextOffsetId,i?(0,c.Z1)(e,i):void 0,l,r)})),(0,s.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},o=t?(0,c.Z1)(e,t):void 0,l=(0,c.n5)(e);if(!o||!l||!n)return;const{query:d,results:u}=l,m=null==u?void 0:u.nextOffsetId;let h;if(n!==i._f){const s=(0,c.tZ)(e,t,n);h=null==s?void 0:s.topMessageId}!async function(e,t,n,o,i){if(!o)return;const l=await(0,N.t9)("searchMessagesLocal",{chat:e,type:"text",query:o,topMessageId:n,limit:a.pn,offsetId:i});if(!l)return;const{chats:d,users:u,messages:m,totalCount:h,nextOffsetId:p}=l,f=(0,g.ee)(m,"id"),v=Object.keys(f).map(Number);let I=(0,s.Rd)();const w=(0,c.n5)(I);w&&o===w.query&&(I=(0,r.fZ)(I,(0,g.ee)(d,"id")),I=(0,r.Sh)(I,(0,g.ee)(u,"id")),I=(0,r.c_)(I,e.id,f),I=(0,r.dx)(I,e.id,t,v,h,p),(0,s.R3)(I))}(o,n,h,d,m)})),(0,s.iw)("searchMediaMessagesLocal",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(!t)return;const n=(0,c.Z1)(e,t),s=(0,c.we)(e);if(!n||!s)return;const{currentType:a,resultsByType:o}=s,i=a&&o&&o[a],r=null==i?void 0:i.nextOffsetId;a&&H(n,a,r)})),(0,s.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:a}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.Z1)(e,o);i&&async function(e,t){const n=await(0,N.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.H9)(e,m.wv.InProgress),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,s.R3)(e);const i=await(0,N.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}),(0,s.R3)(e)})),(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,d.G9)(o)){if(o=await(0,N.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const l=await(0,N.t9)("setChatUsername",{chat:o,username:i});e=(0,s.Rd)(),e=(0,r.H9)(e,l?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,s.R3)(e)})),(0,s.iw)("updatePrivateLink",(e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t&&(0,c.Z1)(e,t);t&&n&&(0,N.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:l}=n,d=(0,c.Z1)(e,a),u=(0,c.dy)(e,o||e.currentUserId);if(!d||!u)return;const m=await(0,N.t9)("fetchExportedChatInvites",{peer:d,admin:u,isRevoked:i,limit:l});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:l,usageLimit:d,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,a);if(!h)return;const g=await(0,N.t9)("editExportedChatInvite",{peer:h,link:o,isRevoked:i,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m});if(!g)return;const{oldInvite:p,newInvite:f}=g,v=((e=(0,s.Rd)()).management.byChatId[a].invites||[]).filter((e=>e.link!==p.link)),I=[...e.management.byChatId[a].revokedInvites||[]];f.isRevoked?I.unshift(f):v.push(f),(0,s.R3)((0,r.fw)(e,a,{invites:v,revokedInvites:I}))})),(0,s.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:a,expireDate:o,usageLimit:i,isRequestNeeded:l,title:d}=n,u=(0,c.Z1)(e,a);if(!u)return;const m=await(0,N.t9)("exportChatInvite",{peer:u,expireDate:o,usageLimit:i,isRequestNeeded:l,title:d});if(!m)return;const h=(e=(0,s.Rd)()).management.byChatId[a].invites||[];(0,s.R3)((0,r.fw)(e,a,{invites:[...h,m]}))})),(0,s.iw)("deleteExportedChatInvite",(async(e,t,n)=>{var a,o;const{chatId:i,link:l}=n,d=(0,c.Z1)(e,i);if(!d)return;if(!await(0,N.t9)("deleteExportedChatInvite",{peer:d,link:l}))return;const u=(e=(0,s.Rd)()).management.byChatId[i];(0,s.R3)((0,r.fw)(e,i,{invites:null==u||null===(a=u.invites)||void 0===a?void 0:a.filter((e=>e.link!==l)),revokedInvites:null==u||null===(o=u.revokedInvites)||void 0===o?void 0:o.filter((e=>e.link!==l))}))})),(0,s.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:a,adminId:o}=n,i=(0,c.Z1)(e,a),l=(0,c.dy)(e,o||e.currentUserId);i&&l&&await(0,N.t9)("deleteRevokedExportedChatInvites",{peer:i,admin:l})&&(e=(0,s.Rd)(),(0,s.R3)((0,r.fw)(e,a,{revokedInvites:[]})))})),(0,s.iw)("loadChatInviteImporters",(async(e,t,n)=>{var a;const{chatId:o,link:i,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,o),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,N.t9)("fetchChatInviteImporters",{peer:m,link:i,offsetDate:l,offsetUser:h,limit:u});if(!g)return;const{importers:p,users:f}=g,v=null===(a=(e=(0,s.Rd)()).management.byChatId[o])||void 0===a?void 0:a.inviteInfo;null!=v&&v.invite&&v.invite.link===i&&(e=(0,r.fw)(e,o,{inviteInfo:{...v,importers:p}}),e=(0,r.Sh)(e,f),(0,s.R3)(e))})),(0,s.iw)("loadChatInviteRequesters",(async(e,t,n)=>{var a;const{chatId:o,link:i,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,o),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,N.t9)("fetchChatInviteImporters",{peer:m,link:i,offsetDate:l,offsetUser:h,limit:u,isRequested:!0});if(!g)return;const{importers:p,users:f}=g,v=null===(a=(e=(0,s.Rd)()).management.byChatId[o])||void 0===a?void 0:a.inviteInfo;null!=v&&v.invite&&v.invite.link===i&&(e=(0,r.fw)(e,o,{inviteInfo:{...v,requesters:p}}),e=(0,r.Sh)(e,f),(0,s.R3)(e))})),(0,s.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:a,offsetDate:o,offsetUserId:i,limit:l}=n,d=(0,c.Z1)(e,a),u=(0,c.dy)(e,i);if(!d||i&&!u)return;const m=await(0,N.t9)("fetchChatInviteImporters",{peer:d,offsetDate:o,offsetUser:u,limit:l,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,s.Rd)(),e=(0,r.a4)(e,a,{joinRequests:h}),e=(0,r.Sh)(e,g),(0,s.R3)(e)})),(0,s.iw)("hideChatJoinRequest",(async(e,t,n)=>{var a;const{chatId:o,userId:i,isApproved:l}=n,d=(0,c.Z1)(e,o),u=(0,c.dy)(e,i);if(!d||!u)return;if(!await(0,N.t9)("hideChatJoinRequest",{peer:d,user:u,isApproved:l}))return;e=(0,s.Rd)();const m=(0,c.Z1)(e,o);m&&(0,s.R3)((0,r.a4)(e,o,{joinRequests:null===(a=m.joinRequests)||void 0===a?void 0:a.filter((e=>e.userId!==i))}))})),(0,s.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:a,isApproved:o,link:i}=n,l=(0,c.Z1)(e,a);if(!l)return;if(!await(0,N.t9)("hideAllChatJoinRequests",{peer:l,isApproved:o,link:i}))return;e=(0,s.Rd)();const d=(0,c.Z1)(e,a);d&&(0,s.R3)((0,r.a4)(e,a,{joinRequests:[],fullInfo:{...d.fullInfo,recentRequesterIds:[],requestsPending:0}}))})),(0,s.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:a}=n,o=(0,c.Z1)(e,a);o&&await(0,N.t9)("hideChatReportPanel",o)&&(0,s.R3)((0,r.a4)((0,s.Rd)(),a,{settings:void 0}))}));var z=n(16974);let V;function W(e){return(0,N.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"),V&&clearTimeout(V),(0,s.R3)({...(0,s.Rd)(),isSyncing:!0}),V=window.setTimeout((()=>{(0,s.R3)({...(0,s.Rd)(),isSyncing:!1}),V=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:l}=(0,c.Bt)(t)||{},d=o?t.chats.byId[o]:void 0;if(o&&d){const n=await W(d);t=(0,s.Rd)();const{chatId:u}=(0,c.Bt)(t)||{},m=l&&(0,c.tZ)(t,o,l);if(n&&u===o){const s=t.messages.byChatId[o],c=o===a.aw?t.serviceNotifications.map((e=>{let{message:t}=e;return t})):[],d=[].concat(n.messages,c),u=(0,g.ee)(d,"id"),h=Object.keys(u).map(Number);if(t={...t,messages:{...t.messages,byChatId:{}}},t=(0,r.c_)(t,o,u),t=(0,r.xj)(t,o,i._f,h),t=(0,r.y9)(t,o,i._f,h),l&&m&&m.originChannelId){const{originChannelId:e}=m,n=t.messages.byChatId[e],a=await W(t.chats.byId[e]);if(a){const e=(0,g.ee)(a.messages,"id"),r=Object.keys(e).map(Number);t={...t,messages:{...t.messages,byChatId:{...t.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[i._f]:{...null==n?void 0:n.threadsById[i._f],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[o]:{...t.messages.byChatId[o],threadsById:{...t.messages.byChatId[o].threadsById,[l]:{...null==s?void 0:s.threadsById[l],outlyingIds:void 0}}}}}}}}t=(0,r.GL)(t,(0,g.ee)(n.chats,"id")),t=(0,r.eD)(t,(0,g.ee)(n.users,"id")),t=(0,r.j6)(t,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,z.S1)(),e({listType:"archived",shouldReplace:!0}),(0,N.t9)("fetchCurrentUser"),t()}})})),(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,N.t9)("reportPeer",{peer:i,reason:a,description:o});t.showNotification({message:r?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:s,reason:a,description:o,photo:i}=n;if(!s)return;const r=(0,c.Z1)(e,s);if(!r||!i)return;const l=await(0,N.t9)("reportProfilePhoto",{peer:r,photo:i,reason:a,description:o});t.showNotification({message:l?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,s.iw)("loadAuthorizations",(async()=>{const e=await(0,N.t9)("fetchAuthorizations");e&&(0,s.R3)({...(0,s.Rd)(),activeSessions:{byHash:e.authorizations,orderedHashes:Object.keys(e.authorizations),ttlDays:e.ttlDays}})})),(0,s.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,N.t9)("terminateAuthorization",a))return;e=(0,s.Rd)();const{[a]: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,N.t9)("terminateAllAuthorizations"))return;const t=(e=(0,s.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];(0,s.R3)({...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}})})),(0,s.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:a,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,N.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,N.t9)("changeSessionTtl",{days:a})&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeSessions:{...e.activeSessions,ttlDays:a}}))})),(0,s.iw)("loadWebAuthorizations",(async()=>{const e=await(0,N.t9)("fetchWebAuthorizations");e&&(0,s.R3)({...(0,s.Rd)(),activeWebSessions:{byHash:e,orderedHashes:Object.keys(e)}})})),(0,s.iw)("terminateWebAuthorization",(async(e,t,n)=>{const{hash:a}=n;if(!await(0,N.t9)("terminateWebAuthorization",a))return;e=(0,s.Rd)();const{[a]: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,N.t9)("terminateAllWebAuthorizations")&&(e=(0,s.Rd)(),(0,s.R3)({...e,activeWebSessions:{byHash:{},orderedHashes:[]}}))}));const X=(0,R.Ds)((e=>e()),500,!1,!0),K=(0,R.P2)((e=>e()),500,!1);function Y(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function J(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;X((()=>(0,N.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,N.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:l,userStatusesById:d}=i;e=(0,s.Rd)(),e=(0,r.eD)(e,(0,g.ee)(l,"id")),e=(0,r.ps)(e,{...e.users.statusesById,...d}),(0,s.R3)(e)})),(0,s.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,N.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let a=(0,s.Rd)();a=(0,r.Sh)(a,(0,g.ee)(n,"id")),a={...a,topPeers:{...a.topPeers,userIds:t,lastRequestedAt:(0,p.b)(a.serverTimeOffset)}},(0,s.R3)(a)}()})),(0,s.iw)("loadContactList",(()=>{!async function(){const e=await(0,N.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,s.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id")),t=(0,r.zn)(t,e.userStatusesById);const n=e=>e.lastName||e.firstName||"",a=new Intl.Collator("en-US"),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,N.t9)("fetchCurrentUser")})),(0,s.iw)("loadCommonChats",(async e=>{var t,n,a;const{chatId:o}=(0,c.Bt)(e)||{},i=o?(0,c.dy)(e,o):void 0;if(!i||(0,d.cS)(i)||null!==(t=i.commonChats)&&void 0!==t&&t.isFullyLoaded)return;const l=null===(n=i.commonChats)||void 0===n?void 0:n.maxId,u=await(0,N.t9)("fetchCommonChats",i.id,i.accessHash,l);if(!u)return;const{chats:m,chatIds:h,isFullyLoaded:p}=u;e=(0,s.Rd)(),m.length&&(e=(0,r.fZ)(e,(0,g.ee)(m,"id"))),e=(0,r.Nq)(e,i.id,{commonChats:{maxId:h.length?h[h.length-1]:"0",ids:(0,g.Tw)(((null===(a=i.commonChats)||void 0===a?void 0:a.ids)||[]).concat(h)),isFullyLoaded:p}}),(0,s.R3)(e)})),(0,s.iw)("updateContact",((e,t,n)=>{const{userId:a,isMuted:o=!1,firstName:i,lastName:l,shouldSharePhoneNumber:d}=n;!async function(e,t,n,a,o){let i=(0,s.Rd)();const l=(0,c.dy)(i,e);if(!l)return;let d;if((0,s.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,s.R3)((0,r.H9)((0,s.Rd)(),m.wv.InProgress)),!l.isContact&&l.phoneNumber)d=await(0,N.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:a});else{const{id:e,accessHash:t}=l;d=await(0,N.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:a,shouldSharePhoneNumber:o})}d&&((0,s.Sv)().loadChatSettings({chatId:e}),(0,s.R3)((0,r.Nq)((0,s.Rd)(),l.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,l,d)})),(0,s.iw)("deleteContact",((e,t,n)=>{const{userId:a}=n;!async function(e){const t=(0,s.Rd)(),n=(0,c.dy)(t,e);if(!n)return;const{id:a,accessHash:o}=n;await(0,N.t9)("deleteContact",{id:a,accessHash:o})}(a)})),(0,s.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:a}=n,o=(0,d.YC)(a),i=o?(0,c.dy)(e,a):void 0,l=o?void 0:(0,c.Z1)(e,a);if(!i&&!l)return;const u=await(0,N.t9)("fetchProfilePhotos",i,l);u&&u.photos&&(e=(0,s.Rd)(),o?e=(0,r.Nq)(e,a,{photos:u.photos}):(e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,r.a4)(e,a,{photos:u.photos})),(0,s.R3)(e))})),(0,s.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;a&&K((()=>{!async function(e){const t=await(0,N.t9)("searchChats",{query:e});let n=(0,s.Rd)();const a=n.userSearch.query;if(!t||!a||e!==a)return void(0,s.R3)((0,r.Q3)(n,!1));const{localUsers:o,globalUsers:i}=t;let c,l;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")),l=i.map((e=>{let{id:t}=e;return t}))),n=(0,r.Q3)(n,!1),n=(0,r.Lm)(n,{localUserIds:c,globalUserIds:l}),(0,s.R3)(n)}(a)}))})),(0,s.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:a,firstName:o,lastName:i}=n,c=await(0,N.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:v.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,s.iw)("reportSpam",((e,t,n)=>{const{chatId:s}=n,a=(0,d.YC)(s)?(0,c.dy)(e,s):(0,c.Z1)(e,s);a&&(0,N.t9)("reportSpam",a)}));var Q=n(18629);const ee=h.cj||h.wZ;class te{constructor(e,t){var n,s;this.features=e,this.onFail=t,s=void 0,(n="preOpened")in this?Object.defineProperty(this,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):this[n]=s}preOpenIfNeeded(){var e;ee&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():null===(e=this.onFail)||void 0===e||e.call(this))}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!ee){const n=window.open(e,void 0,this.features);var t;n?n.focus():null===(t=this.onFail)||void 0===t||t.call(this)}}cancelPreOpen(){var e;null===(e=this.preOpened)||void 0===e||e.close(),this.preOpened=void 0}}const ne="https://prizes.gamee.com/",se=(0,R.Ds)((e=>e()),500,!1);async function ae(e,t){await(0,N.t9)("toggleBotInAttachMenu",{bot:e,isEnabled:t}),await oe()}async function oe(e){const t=await(0,N.t9)("loadAttachMenuBots",{hash:e});if(!t)return;const n=(0,s.Rd)();(0,s.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}function ie(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 re(e,t,n,s,a){await(0,N.t9)("sendMessage",{chat:e,text:n,replyingTo:s,sendAs:a})}let ce;async function le(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&&(ce||(ce=new te("popup,width=800,height=600",(()=>{i({message:"Allow browser to open popup window"})}))),ce.preOpenIfNeeded());const l=await(0,N.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n,isGame:a});if(!l)return;const{message:d,alert:u,url:m}=l;u?o({data:{message:d||"Error"}}):d?i({message:d}):m&&(a?m.includes(ne)?ce.open(m):(ce.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}(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;le(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.getPaymentForm({chat:n,messageId:s}),t.setInvoiceMessageInfo((0,c.hj)(e,n.id,s)),t.openPaymentModal({chatId:n.id,messageId:s});break}case"game":{const t=(0,c.jr)(e);if(!t)return;le(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:s}=(0,c.Bt)(e)||{};if(!s)return;const o=(0,c.kB)(e,s);if(!o)return;const i=(0,Q.B)();t.requestSimpleWebView({url:n,bot:o,theme:i,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;if(!i.viaBotId&&!i.senderId)return;const r=(0,c.kB)(e,i.viaBotId||i.senderId);if(!r)return;const l=(0,Q.B)();t.requestWebView({url:n,bot:r,peer:o,theme:l,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:l}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:l,value:!1}),re(i,0,s,(0,c.Yy)(e,i.id,l),(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),l=o&&(0,c.IK)(e,a);o&&i&&l&&await(0,N.t9)("unblockContact",l.id,l.accessHash)&&((0,s.R3)((0,r.rB)((0,s.Rd)(),l.id)),re(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,N.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:l}=n;let d=e.inlineBots.byUsername[o];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,N.t9)("fetchInlineBot",{username:o})||{};if(e=(0,s.Rd)(),!t||!n)return void(0,s.R3)(Y(e,o,!1));e=(0,r.Sh)(e,{[t.id]:t}),e=(0,r.fZ)(e,{[n.id]:n}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=Y(e,o,d),(0,s.R3)(e)}(i!==d.query||d.canLoadMore)&&se((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:a,query:o,offset:i}=e,r=(0,s.Rd)();const l=(0,c.dy)(r,n.id),d=(0,c.Z1)(r,a);if(!l||!d)return;const u=n.query!==o;r=J(r,!0),r=Y(r,t,{...n,query:o,...u&&{offset:void 0,results:[]}}),(0,s.R3)(r);const m=await(0,N.t9)("fetchInlineBotResults",{bot:l,chat:d,query:o,offset:u?void 0:i}),h=r.inlineBots.byUsername[t];if(r=J((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=Y(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:d,chatId:a,query:i,offset:l})}))}})),(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 l=(0,c.IK)(e,r.senderId);if(!l)return;const d=`@${l.username} ${s}`;if(!a)return{...e,switchBotInline:{query:s,botUsername:l.username}};t.openChatWithText({chatId:i.id,text:d})})),(0,s.iw)("resetSwitchBotInline",(e=>({...e,switchBotInline:void 0}))),(0,s.iw)("sendInlineBotResult",((e,t,n)=>{const{id:s,queryId:a,isSilent:o,scheduledAt:i}=n,r=(0,c.Bt)(e);if(!r||!s)return;const{chatId:l,threadId:d}=r,u=(0,c.Z1)(e,l);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:l,threadId:d,value:!1}),(0,N.t9)("sendInlineBotResult",{chat:u,resultId:s,queryId:a,replyingTo:(0,c.Yy)(e,l,d),sendAs:(0,c._5)(e,l),isSilent: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)(Y(e,a,o)))})),(0,s.iw)("startBot",(async(e,t,n)=>{const{botId:s,param:a}=n,o=(0,c.dy)(e,s);o&&await(0,N.t9)("startBot",{bot:o,startParam:a})})),(0,s.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:a,bot:o,theme:i,buttonText:r}=n;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{bot:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}});const l=await(0,N.t9)("requestSimpleWebView",{url:a,bot:o,theme:i});l&&(e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:l,bot:o,buttonText:r}}))})),(0,s.iw)("requestWebView",(async(e,t,n)=>{const{url:a,bot:o,peer:i,theme:r,isSilent:l,buttonText:d,isFromBotMenu:u,startParam:m}=n;if(!(0,c.LM)(e,o))return void(0,s.R3)({...e,botTrustRequest:{bot:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}});const h=(0,c.Bt)(e);if(!h)return;const{chatId:g,threadId:p}=h,f=g&&(0,c.Yy)(e,g,p),v=await(0,N.t9)("requestWebView",{url:a,bot:o,peer:i,theme:r,isSilent:l,replyToMessageId:f||void 0,isFromBotMenu:u,startParam:m});if(!v)return;const{url:I,queryId:w}=v;e=(0,s.Rd)(),(0,s.R3)({...e,webApp:{url:I,bot:o,queryId:w,buttonText:d}})})),(0,s.iw)("prolongWebView",(async(e,t,n)=>{const{bot:s,peer:a,isSilent:o,replyToMessageId:i,queryId:r}=n;await(0,N.t9)("prolongWebView",{bot:s,peer:a,isSilent:o,replyToMessageId:i,queryId:r})||t.closeWebApp()})),(0,s.iw)("sendWebViewData",((e,t,n)=>{const{bot:s,data:a,buttonText:o}=n;(0,N.t9)("sendWebViewData",{bot:s,data:a,buttonText:o})})),(0,s.iw)("closeWebApp",(e=>({...e,webApp:void 0}))),(0,s.iw)("cancelBotTrustRequest",(e=>({...e,botTrustRequest:void 0}))),(0,s.iw)("markBotTrusted",((e,t,n)=>{var a;const{botId:o}=n,{trustedBotIds:i}=e,r=new Set(i);if(r.add(o),(0,s.R3)({...e,botTrustRequest:void 0,trustedBotIds:Array.from(r)}),null!==(a=e.botTrustRequest)&&void 0!==a&&a.onConfirm){const{action:n,payload:s}=e.botTrustRequest.onConfirm;t[n](s)}})),(0,s.iw)("loadAttachMenuBots",(async(e,t,n)=>{const{hash:s}=n||{};await oe(s)})),(0,s.iw)("toggleBotInAttachMenu",(async(e,t,n)=>{const{botId:s,isEnabled:a}=n,o=(0,c.dy)(e,s);o&&await ae(o,a)})),(0,s.iw)("callAttachMenuBot",((e,t,n)=>{const{chatId:s,botId:a,isFromBotMenu:o,url:i,startParam:r}=n,l=(0,c.Z1)(e,s),d=(0,c.IK)(e,a);if(!l||!d)return;const{attachMenu:{bots:u}}=e;if(!o&&!u[a])return{...e,botAttachRequest:{bot:d,chatId:s,startParam:r}};const m=(0,Q.B)();t.requestWebView({url:i,peer:l,bot:d,theme:m,buttonText:"",isFromBotMenu:o,startParam:r})})),(0,s.iw)("confirmBotAttachRequest",(async(e,t)=>{const{botAttachRequest:n}=e;if(!n)return;const{bot:a,chatId:o,startParam:i}=n;(0,s.R3)({...e,botAttachRequest:void 0}),await ae(a,!0),t.callAttachMenuBot({chatId:o,botId:a.id,startParam:i})})),(0,s.iw)("closeBotAttachRequestModal",(e=>({...e,botAttachRequest:void 0}))),(0,s.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:a,buttonId:o,messageId:i,url:r}=n,l=(0,c.Z1)(e,a);if(!l)return;const d=await(0,N.t9)("requestBotUrlAuth",{chat:l,buttonId:o,messageId:i});d&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:l.id}}}),ie(r,d))})),(0,s.iw)("acceptBotUrlAuth",(async(e,t,n)=>{var s;const{isWriteAllowed:a}=n;if(null===(s=e.urlAuth)||void 0===s||!s.button)return;const{button:o,url:i}=e.urlAuth,{chatId:r,messageId:l,buttonId:d}=o,u=(0,c.Z1)(e,r);if(!u)return;const m=await(0,N.t9)("acceptBotUrlAuth",{chat:u,messageId:l,buttonId:d,isWriteAllowed:a});m&&ie(i,m)})),(0,s.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:a}=n,o=await(0,N.t9)("requestLinkUrlAuth",{url:a});o&&(e=(0,s.Rd)(),(0,s.R3)({...e,urlAuth:{url:a}}),ie(a,o))})),(0,s.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{var s;const{isWriteAllowed:a}=n;if(null===(s=e.urlAuth)||void 0===s||!s.url)return;const{url:o}=e.urlAuth,i=await(0,N.t9)("acceptLinkUrlAuth",{url:o,isWriteAllowed:a});i&&ie(o,i)})),(0,s.iw)("closeUrlAuthModal",(e=>({...e,urlAuth:void 0}))),n(51371),(0,s.iw)("loadPasswordInfo",(async e=>{const t=await(0,N.t9)("getPasswordInfo");t&&(e=(0,s.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),e=(0,r.IE)(e,{hint:t.hint}),(0,s.R3)(e))})),(0,s.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:a,onSuccess:o}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,N.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,N.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:l}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const d=await(0,N.t9)("updatePassword",a,o,i,c);(0,s.R3)((0,r.IE)((0,s.Rd)(),{isLoading:!1})),d&&l()})),(0,s.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:a,email:o,onSuccess:i}=n;(0,s.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,N.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,N.t9)("provideRecoveryEmailCode",s)})),(0,s.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,s.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:a,saveInfo:o}=n,i=(0,c.gx)(e),l=i&&(0,c.Z1)(e,i),d=(0,c.Mz)(e);l&&d&&async function(e,t,n,a){const o=await(0,N.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:n,shouldSave:a});if(!o)return;const{id:i,shippingOptions:c}=o;if(!i)return;let l=(0,r.vT)((0,s.Rd)(),i);c?(l=(0,r.TM)(l,c),l=(0,r.Q$)(l,m.KB.Shipping)):l=(0,r.Q$)(l,m.KB.PaymentInfo),(0,s.R3)(l)}(l,d,a,o)})),(0,s.iw)("getPaymentForm",((e,t,n)=>{const{chat:a,messageId:o}=n;a&&o&&async function(e,t){const n=await(0,N.t9)("getPaymentForm",{chat:e,messageId:t});if(!n)return;let a=(0,r._7)((0,s.Rd)(),n),o=m.KB.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(o=m.KB.ShippingInfo),a=(0,r.Q$)(a,o),(0,s.R3)(a)}(a,o)})),(0,s.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:a,chatId:o,messageId:i}=n,l=o&&(0,c.Z1)(e,o);i&&a&&l&&async function(e,t,n){const a=await(0,N.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)}(l,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:l}=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,d.Ow)(o.error),t=(0,s.Rd)();return void(0,s.R3)({...t,payment:{...t.payment,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)}(l,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,error:{...e}}})}let l=(0,r.QD)((0,s.Rd)(),{type:"card",token:c.data.token});l=(0,r.Q$)(l,m.KB.Checkout),(0,s.R3)(l)}(l,t)}})),(0,s.iw)("sendPaymentForm",((e,t,n)=>{const{shippingOptionId:a,saveCredentials:o}=n,i=(0,c.gx)(e),l=i&&(0,c.Z1)(e,i),d=(0,c.Mz)(e),u=(0,c.eh)(e),m=(0,c.sp)(e),{nativeProvider:h}=e.payment,g="stripe"===h?(0,c.$$)(e):(0,c.EB)(e);l&&d&&g&&u&&h&&async function(e,t,n,a,o,i,c){if(!0===await(0,N.t9)("sendPaymentForm",{chat:e,messageId:t,formId:a,credentials:o,requestedInfoId:i,shippingOptionId:c})){const e=(0,r.bp)((0,s.Rd)());(0,s.R3)((0,r.WY)(e))}}(l,d,0,u,{save:o,data:"stripe"===h?(0,c.i3)(e):(0,c.Jg)(e)},m,a)})),(0,s.iw)("setPaymentStep",(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,n.step||m.KB.ShippingInfo)})),(0,s.iw)("setInvoiceMessageInfo",((e,t,n)=>(0,r.nA)(e,n)));var de=n(40647),ue=n(4907);const me=728,he=424,ge=288;var pe=n(43858),fe=n(53475);function ve(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=pe.Z.get().width)>a._m?Math.min(Math.max(.25*n,ge),.33*n):n>a.ks?Math.min(Math.max(.33*n,ge),.4*n):he):0);var n}function Ie(e,t,n){return(0,fe.a4)(e,t,n,void 0,!0)}let we=0;(0,s.iw)("loadAvailableReactions",(async()=>{const e=await(0,N.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&de.he(`sticker${e.aroundAnimation.id}`,i.IU.BlobUrl),e.centerIcon&&de.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,l={id:we++,animatedEffect:s||i,x:ve(e,a)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:r,isReversed:c};return{...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],l]}})),(0,s.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:s,chatId:a,emoji:o,interactions:i,localEffect:r}=n,l=(0,c.Z1)(e,a);l&&(o||r)&&a!==e.currentUserId&&(0,N.t9)("sendEmojiInteraction",{chat:l,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),l=(0,c.hj)(e,s,a);r&&l&&!(0,d.CI)(l)&&t.sendReaction({chatId:s,messageId:a,reaction:r,x:o,y:i})})),(0,s.iw)("sendReaction",((e,t,n)=>{var s,o,i;const{chatId:r}=n;let{messageId:l}=n,{reaction:d}=n;const u=(0,c.Z1)(e,r);let m=(0,c.hj)(e,r,l);if(!u||!m)return;const h=Boolean(m.groupedId)&&!m.isInAlbum,p=h?(0,c.xH)(e,r,m.groupedId)[0]:void 0;m=h&&(0,c.hj)(e,r,p)||m,l=(null===(s=m)||void 0===s?void 0:s.id)||l,null!==(o=m.reactions)&&void 0!==o&&null!==(i=o.results)&&void 0!==i&&i.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,N.t9)("sendReaction",{chat:u,messageId:l,reaction:d});const{animationLevel:f}=e.settings.byKey;return f===a.zy&&(e={...e,activeReactions:{...d?e.activeReactions:(0,g.CE)(e.activeReactions,[l]),...d&&{[l]:{reaction:d,messageId:l}}}}),function(e,t,n,s){const{reactions:a}=(0,c.hj)(e,t,n)||{};if(!a)return e;let 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,ue.cY)(e,t,n,{reactions:{...a,results:o,recentReactions:i}})}(e,r,l,d)})),(0,s.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,s.iw)("stopActiveReaction",((e,t,n)=>{var s;const{messageId:a,reaction:o}=n;return(null===(s=e.activeReactions[a])||void 0===s?void 0:s.reaction)!==o?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[a])}})),(0,s.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:a}=n;await(0,N.t9)("setDefaultReaction",{reaction:a})&&(0,s.R3)({...(0,s.Rd)(),appConfig:{...e.appConfig,defaultReaction:a}})})),(0,s.iw)("stopActiveEmojiInteraction",((e,t,n)=>{var s;const{id:a}=n;return{...e,activeEmojiInteractions:null===(s=e.activeEmojiInteractions)||void 0===s?void 0:s.filter((e=>e.id!==a))}})),(0,s.iw)("loadReactors",(async(e,t,n)=>{var a,o,i;const{chatId:l,messageId:d,reaction:u}=n,m=(0,c.Z1)(e,l),h=(0,c.hj)(e,l,d);if(!m||!h)return;const p=null===(a=h.reactors)||void 0===a?void 0:a.nextOffset,f=await(0,N.t9)("fetchMessageReactionsList",{reaction:u,chat:m,messageId:d,offset:p});if(!f)return;e=(0,s.Rd)(),null!==(o=f.users)&&void 0!==o&&o.length&&(e=(0,r.Sh)(e,(0,g.ee)(f.users,"id")));const{nextOffset:v,count:I,reactions:w}=f;(0,s.R3)((0,r.cY)(e,l,d,{reactors:{nextOffset:v,count:I,reactions:[...(null===(i=h.reactors)||void 0===i?void 0:i.reactions)||[],...w]}}))})),(0,s.iw)("loadMessageReactions",((e,t,n)=>{const{ids:s,chatId:a}=n,o=(0,c.Z1)(e,a);o&&(0,N.t9)("fetchMessageReactions",{ids:s,chat:o})})),(0,s.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{var s;const{chatId:a,emoticon:o,x:i,y:r,startSize:l,isReversed:d,id:u}=n,m=(0,c.Z1)(e,a);if(m&&null!==(s=e.activeEmojiInteractions)&&void 0!==s&&s.some((e=>e.id===u))&&a!==e.currentUserId)return(0,N.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:o}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:ve(e,i),y:r,startSize:l,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 l=await(0,N.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!l||!l.messages.length)return e=Ie(e=(0,s.Rd)(),a,{unreadReactionsCount:0}),void(0,s.R3)(e);const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,s.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=Ie(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=Ie(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=>{var n,s;const a=(0,c.hj)(e,r.id,t);if(!a)return;const o=null===(n=a.reactions)||void 0===n||null===(s=n.recentReactions)||void 0===s?void 0:s.find((e=>e.isUnread));return o?[t,{messageId:t,reaction:null==o?void 0:o.reaction}]:void 0})).filter(Boolean))}}}})),(0,s.iw)("focusNextReaction",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0]})})),(0,s.iw)("readAllReactions",(e=>{const t=(0,c.jr)(e);if(t)return(0,N.t9)("readAllReactions",{chat:t}),Ie(e,t.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,s.iw)("loadStatistics",(async(e,t,n)=>{var a;const{chatId:o,isGroup:i}=n,l=(0,c.Z1)(e,o);if(null==l||!l.fullInfo)return;const d=await(0,N.t9)(i?"fetchGroupStatistics":"fetchChannelStatistics",{chat:l});if(d){if(e=(0,s.Rd)(),null!==(a=d.recentTopMessages)&&void 0!==a&&a.length){const t=(0,c.Zw)(e,o);d.recentTopMessages=d.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}(0,s.R3)((0,r.ze)(e,o,d))}})),(0,s.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:a,messageId:o}=n,i=(0,c.Z1)(e,a);if(null==i||!i.fullInfo)return;let l=await(0,N.t9)("fetchMessageStatistics",{chat:i,messageId:o});l||(l={}),e=(0,s.Rd)();const{views:d,forwards:u}=(0,c.Zw)(e,a)[o];l.views=d,l.forwards=u;const m=i.fullInfo.statisticsDcId,h=await(0,N.t9)("fetchMessagePublicForwards",{chat:i,messageId:o,dcId:m});l.publicForwards=null==h?void 0:h.length,l.publicForwardsData=h,e=(0,s.Rd)(),(0,s.R3)((0,r.kM)(e,l))})),(0,s.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:a,token:o,name:i,isPercentage:l}=n,d=(0,c.Z1)(e,a);if(null==d||!d.fullInfo)return;const u=d.fullInfo.statisticsDcId,m=await(0,N.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:u,isPercentage:l});m&&(0,s.R3)((0,r.yC)((0,s.Rd)(),a,i,m))})),n(28304);var ye=n(28406);function Ze(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)=>Ze(e,s[t])))}const a=e,o=t;return Object.keys(a).every((e=>Ze(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,ye.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:l,type:d}=(0,c.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const u=(0,c.Z1)(e,n.chatId);if(!u)return;return"thread"===d&&l===i._f&&n.chatId===o&&setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500),(0,s.R3)((0,r.a4)(e,n.chatId,{unreadCount:u.unreadCount?u.unreadCount+1:1,...n.message.id&&n.message.hasUnreadMention&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1,unreadMentions:[...u.unreadMentions||[],n.message.id]}})),void(0,ye.rh)({chat:u,message:a})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;return t.forEach((t=>{const s="channelId"in n?n.channelId:(0,c.X5)(e,t),a=(0,c.Z1)(e,s);var o,i;null!=a&&a.unreadReactionsCount&&(e=Ie(e,s,{unreadReactionsCount:a.unreadReactionsCount-1||void 0,unreadReactions:null===(o=a.unreadReactions)||void 0===o?void 0:o.filter((e=>e!==t))})),null!=a&&a.unreadMentionsCount&&(e=(0,r.a4)(e,s,{unreadMentionsCount:a.unreadMentionsCount-1||void 0,unreadMentions:null===(i=a.unreadMentions)||void 0===i?void 0:i.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":{var o;const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:a,deletedMemberId:i}=n;if(!t)return;let c=!1,l=null!==(o=t.fullInfo)&&void 0!==o&&o.members?[...t.fullInfo.members]:[];if(s)l=s,c=!0;else if(a)l.length&&l.some((e=>e.userId===a.userId))||(l.push(a),c=!0);else if(l.length&&i){const e=l.findIndex((e=>e.userId===i));e>-1&&(l.slice(e,1),c=!0)}if(c){const s=l.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,r.a4)(e,n.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:s}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,a=e.chats.byId[t];return null!=a&&a.photos?(0,r.a4)(e,t,{photos:a.photos.filter((e=>!s.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:s,date:a,replyingToId: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 Pe=350;function be(e,t,n,s,a,o,i){var l;const u=null==i?void 0:i.reactions;if(u&&Ze(s,u))return e;if(e=(0,r.cY)(e,t,n,{reactions:s}),!o)return e;const m=null===(l=a.unreadReactions)||void 0===l?void 0:l.includes(n);if((0,d.yL)(e,s)&&!m){e=Ie(e,t,{unreadReactionsCount:((null==a?void 0:a.unreadReactionsCount)||0)+1,unreadReactions:[...(null==a?void 0:a.unreadReactions)||[],n]});const s=(0,c.hj)(e,t,n);if(!a||!s)return e;(0,R.R3)((()=>{(0,ye.rh)({chat:a,message:s,isReaction:!0})}))}else if(m){var h;e=Ie(e,t,{unreadReactionsCount:((null==a?void 0:a.unreadReactionsCount)||1)-1,unreadReactions:null==a||null===(h=a.unreadReactions)||void 0===h?void 0:h.filter((e=>e!==n))})}return e}function Ce(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,d.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 Se(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 Me(e,t,n){const{id:s,chatId:a}=n,{threadInfo:o,firstMessageId:l}=(0,c.Db)(e,a,n)||{},u=(0,c.Z1)(e,a),m=(null==u?void 0:u.unreadCount)&&!(0,c.gb)(e,a,i._f);if(e=Se(e,t,n),o&&(!l&&(0,d.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),l||(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})),m)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 Ee(e,t,n){var s;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:o}=e,i=null===(s=o.byId[t])||void 0===s?void 0:s.lastMessage;return!i||a||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,r.a4)(e,t,{lastMessage:n}):e}function Re(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 ke(e,t,n,a){if(e){t.forEach((t=>{const n=Re(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);n&&(a=Ee(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=Se(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})}))}),Pe)}const o=[];t.forEach((e=>{const t=(0,c.X5)(a,e);if(t){o.push(t);const n=Re(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);n&&(a=Ee(a,t,n,!0)),setTimeout((()=>{(0,s.R3)((0,r.K4)((0,s.Rd)(),t,[e]))}),Pe)}})),(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:o,id:l,message:u,shouldForceReply:m}=n;e=Me(e=Ce(e,o,l,u),t,u),u.threadInfo&&(e=(0,r.Xg)(e,u.threadInfo.chatId,u.threadInfo.threadId,u.threadInfo));const h=(0,c.hj)(e,o,l);if((0,c.KA)(e,o,u)){var a;if(u.isOutgoing&&(null===(a=u.content)||void 0===a||!a.action)){const n=(0,c.Bt)(e);n&&t.focusMessage({chatId:o,threadId:n.threadId,messageId:u.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,o,u)||{};n&&t.requestThreadInfoUpdate({chatId:o,threadId:n.threadId}),(0,d.CI)(u)||setTimeout((()=>{let e=(0,s.Rd)();m&&(e=(0,r.pf)(e,o,i._f,"replyingToId",l)),(0,s.R3)(Ee(e,o,h))}),Pe)}else e=Ee(e,o,h);(0,s.R3)(e),(0,c.N)(e,o)||t.loadTopChats();break}case"updateStartEmojiInteraction":{var o;const{chatId:t}=(0,c.Bt)(e)||{};if(t!==n.id)return;const a=(0,c.hj)(e,t,n.messageId);if(!a)return;if((0,d.UD)(a)!==n.emoji)return;const i=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:(null===(o=e.activeEmojiInteractions)||void 0===o?void 0:o.length)||0,animatedEffect:i?(0,c.cu)(i):n.emoji,messageId:n.messageId}]},(0,s.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:a,message:o}=n;e=Ce(e,t,a,o,!0);const l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",(0,g.Tw)([...l,a])),(0,s.R3)(e);break}case"updateMessage":{var l,u;const{chatId:a,id:o,message:d}=n,m=(0,c.hj)(e,a,o),h=(0,c.Z1)(e,a);e=Ce(e,a,o,d);const g=(0,c.hj)(e,a,o);d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),m&&(e=Ee(e,a,g)),d.reactions&&h&&(e=be(e,a,o,d.reactions,h,d.isOutgoing,m)),(0,s.R3)(e),m&&h&&!d.isOutgoing&&(null===(l=h.lastMessage)||void 0===l?void 0:l.id)===d.id&&(0,c.xo)(e,h)&&(0,c.KA)(e,a,d)&&(0,c.b9)(e,a,(null===(u=d.threadInfo)||void 0===u?void 0:u.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=Ce(e,t,a,o,!0);const l=Object.keys((0,c.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,i._f,"scheduledIds",l),(0,s.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:o,message:i}=n;e=Me(e,t,i);const l=(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,{...l,...i,previousLocalId:o});const d=(0,c.hj)(e,a,i.id);e=Ee(e,a,d);const u=(0,c.Db)(e,a,i);null!=u&&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,l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",[...l,o.id]);const d=(0,c.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,o.id,{...d,...o,previousLocalId:a}),(0,s.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:o}=n,l=(0,c.KB)(e,t)||[],d=a?[...l,...o].sort(((e,t)=>t-e)):l.filter((e=>!o.includes(e)));(0,s.R3)((0,r.pf)(e,t,i._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:o,firstMessageId:i}=n,l={...(0,c.tZ)(e,t,a),...o};if(!l.threadId)return;e=(0,r.Xg)(e,t,a,l),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,d.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;ke(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)}),Pe))}(a,t,0,e);break}case"deleteHistory":{const{chatId:s}=n,a=e.messages.byChatId[s];a?ke(s,Object.keys(a.byId).map(Number),t,e):t.requestChatUpdate({chatId:s});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(null!=o&&o.content.poll){const t={...o.content.poll,...a},{results:n}=t.results||{};if(n&&!n.some((e=>e.isChosen))){const{results:e}=o.content.poll.results,s=e&&e.filter((e=>e.isChosen));s&&s.forEach((e=>{const s=n.findIndex((t=>t.option===e.option));s>=0&&(t.results.results[s].isChosen=!0)}))}(0,s.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:t}}))}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:l}=i.content,{recentVoterIds:d,totalVoters:u,results:m}=l.results,h=d?[...d]:[],g=u?u+1:1,p=m?[...m]:[];h.push(a),o.forEach((t=>{const n=p.find((e=>e.option===t)),s=p.findIndex((e=>e.option===t)),o=n?{...n}:{option:t,votersCount:0};o.votersCount+=1,a===e.currentUserId&&(o.isChosen=!0),s?p[s]=o:p.push(o)})),(0,s.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:s}=n;(0,c.UW)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:t,id:a,reactions:o}=n,i=(0,c.hj)(e,t,a),r=(0,c.Z1)(e,n.chatId);if(!r||!i)return;(0,s.R3)(be(e,t,a,o,r,i.isOutgoing,i));break}}}));const Ne=(0,R.P2)((function(){const e=(0,s.Rd)();(0,s.R3)((0,r.ps)(e,{...e.users.statusesById,...Ae})),Ae={}}),3e3,!0);let Ae={};(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,r.GK)(e,n.id);case"updateUser":return(0,r.Nq)(e,n.id,n.user);case"updateUserStatus":return a=n.userId,o=n.status,Ae[a]=o,void Ne();case"updateUserFullInfo":{const{id:t,fullInfo:s}=n,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...s}})}case"updateBotMenuButton":{var s;const{botId:t,button:a}=n,o=(0,c.dy)(e,t);if(null==o||null===(s=o.fullInfo)||void 0===s||!s.botInfo)return;return(0,r.Nq)(e,t,{fullInfo:{...o.fullInfo,botInfo:{...o.fullInfo.botInfo,menuButton:a}}})}}var a,o})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,r.Rg)(e,n.id,n.stickerSet)})),(0,s.iw)("apiUpdate",((e,t,n)=>{var a;switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,r.O4)((0,s.Rd)(),n.id):(0,r.rB)((0,s.Rd)(),n.id);case"updateResetContactList":(0,s.R3)({...(0,s.Rd)(),contactList:{userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":t.reorderStickerSets({order:n.order});break;case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":(0,s.R3)({...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}});break;case"updatePaymentVerificationNeeded":e=(0,r.fS)((0,s.Rd)(),n.url),e=(0,r.Q$)(e,m.KB.ConfirmPayment),(0,s.R3)(e);break;case"updateWebViewResultSent":(null===(a=e.webApp)||void 0===a?void 0:a.queryId)===n.queryId&&(t.setReplyingToId({messageId:void 0}),t.closeWebApp())}})),(0,s.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,r.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent: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 Te=n(78958),Be=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,Te.dc)(e,n.call.id):(0,Te.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,Te.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,Te.AH)(e,t,{nextOffset:o})),e}case"updatePhoneCall":{if(!h.Bi)return;const{phoneCall:t,currentUserId:s}=e;if(t)return;const{call:a}=n;if((null==a?void 0:a.adminId)!==s&&"requested"===a.state)return(0,R.R3)((()=>{(0,ye.TO)({call:a,user:(0,Be.fu)(e)})})),(0,C.o5)(),{...e,phoneCall:a,isCallPanelVisible:!1}}}})),(0,s.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"])return(0,r.bp)(e)}));var xe=n(18674),Le=n(46752),Oe=n(1279),Ue=n(53551),Fe=n(3858),$e=n(45332);function qe(e){(0,o.d4)((()=>(0,R.Gq)(e)),[e])}var De=n(29290);const je=document.querySelector('meta[name="viewport"]'),_e=(null==je?void 0:je.getAttribute("content"))||"",Ge="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function He(e){e.preventDefault()}var ze=n(65326),Ve=n(46590),We=n(31212),Xe=n(94851),Ke=n(2155),Ye=n(95616),Je=n(17358);const Qe=(0,o.X$)((e=>{let{isForAppBadge:t}=e;(0,Ye.yi)();const n=(0,z.xW)();if((0,o.d4)((()=>{t&&(0,Je.w)(n)}),[t,n]),!t&&n)return o.ZP.createElement("div",{className:"unread-count active"},(0,Ke.bi)(n))}));var et=n(23989),tt=n(53455),nt=n(60706),st=n(73541),at=n(2255),ot=n(59107),it=n(27370),rt=n(17926),ct=n(706);let lt;function dt(e,t,n,s,a,i){let r,c,l;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?lt.syncing:lt.online:lt.waitingForNetwork,c=r===lt.online||i?"none":s?"middleHeader":a?"minimized":"overlay",r===lt.waitingForNetwork?l=e("WaitingForNetwork"):r===lt.syncing&&(l=e("Updating")),"middleHeader"===c&&(l=l.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:l}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(lt||(lt={}));var ut=n(36046),mt=n(53106),ht=n(58964),gt=n(231),pt=n(69589),ft=n(49187),vt=n(83321),It=n(40126),wt=n(49204);const yt=(0,o.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:s}=e;const a=(0,ot.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},o.ZP.createElement(wt.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(at.Z,{activeKey:t,name:"slide-fade"},n)),o.ZP.createElement(gt.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon-close"})))})),Zt=(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:l}=e.chats,{isConnectionStatusMinimized:d,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:o,chatsById:l,globalSearchChatId:s,searchDate:a,theme:(0,c.Pu)(e),animationLevel:u,connectionState:i,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:d,areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(e.canInstall)}}))((e=>{let{content:t,contactsFilter:n,onSearchQuery:i,onSelectSettings:r,onSelectContacts:c,onSelectArchived:l,onReset:u,searchQuery:g,isLoading:p,shouldSkipTransition:f,currentUserId:v,globalSearchChatId:I,searchDate:w,theme:y,animationLevel:Z,chatsById:P,connectionState:b,isSyncing:C,isMessageListOpen:S,isConnectionStatusMinimized:M,areChatsLoaded:E,hasPasscode:R,canInstall:k}=e;const{openChat:N,setGlobalSearchDate:A,setSettingOption:T,setGlobalSearchChatId:B,openChatByUsername:x,lockScreen:L,requestNextSettingsScreen:O,skipLockOnUnload:U}=(0,s.Sv)(),F=(0,ot.Z)(),$=t===m.du.ChatList,q=(0,o.Ye)((()=>w?(0,j.xH)(new Date(1e3*w)):void 0),[w]),D=(0,o.Ye)((()=>$&&P?Object.values(P).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[$,P]),{connectionStatus:_,connectionStatusText:G,connectionStatusPosition:H}=dt(F,b,C,S,M,!E),z=(0,o.I4)((e=>{e.preventDefault(),e.stopPropagation(),R?L():O(m.MT.PasscodeDisabled)}),[R,L,O]);(0,st.y)({"Ctrl+Shift+L":z,"Alt+Shift+L":z,"Meta+Shift+L":z,...h.fl&&{"Meta+L":z}});const V="web.telegram.org"===window.location.hostname||a.Cg,W=(0,o.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return o.ZP.createElement(gt.Z,{round:!0,ripple:$&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:$?t:()=>u(),ariaLabel:$?F("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,Le.Z)("animated-menu-icon",!$&&"state-back",f&&"no-animation")}))}),[$,F,u,f]),X=(0,o.I4)((()=>{g||i("")}),[g,i]),K=(0,o.I4)((()=>{T({isConnectionStatusMinimized:!M})}),[M,T]),Y=(0,o.I4)((()=>{N({id:v,shouldReplaceHistory:!0})}),[v,N]),J=(0,o.I4)((()=>{O(R?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled)}),[R,O]),Q=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";T({theme:t}),T({shouldUseSystemTheme:!1}),(0,it.Z)(t,Z===a.zy)}),[Z,T,y]),ee=(0,o.I4)((()=>{window.open(a.ul,"_blank","noopener")}),[]),te=(0,o.I4)((()=>{x({username:a.j3})}),[x]),ne=(0,o.I4)((()=>{x({username:a.$p})}),[x]),se=(0,o.I4)((()=>{(0,rt.L)("K"),(0,ct.W8)(),U()}),[U]),ae=(0,o.I4)((()=>{U()}),[U]),oe=(0,o.I4)((()=>{x({username:F("Settings.TipsUsername")})}),[F,x]),ie=(0,o.I4)((()=>{L()}),[L]),re=Boolean(I)||t===m.du.GlobalSearch||t===m.du.Contacts,ce=t===m.du.Contacts?F("SearchFriends"):F("Search"),le=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(mt.Z,{trigger:W,footer:`${a.iC} ${le}`},o.ZP.createElement(ht.Z,{icon:"saved-messages",onClick:Y},F("SavedMessages")),o.ZP.createElement(ht.Z,{icon:"archive",onClick:l},o.ZP.createElement("span",{className:"menu-item-name"},F("ArchivedChats")),D>0&&o.ZP.createElement("div",{className:"archived-badge"},D)),o.ZP.createElement(ht.Z,{icon:"user",onClick:c},F("Contacts")),o.ZP.createElement(ht.Z,{icon:"settings",onClick:r},F("Settings")),o.ZP.createElement(ht.Z,{icon:"lock",onClick:J},F("Passcode"),o.ZP.createElement("span",{className:"menu-item-badge"},F("New"))),o.ZP.createElement(ht.Z,{icon:"darkmode",onClick:Q},o.ZP.createElement("span",{className:"menu-item-name"},F("lng_menu_night_mode")),o.ZP.createElement(vt.Z,{id:"darkmode",label:F("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),o.ZP.createElement(ht.Z,{icon:"help",onClick:oe},F("TelegramFeatures")),o.ZP.createElement(ht.Z,{icon:"bug",href:a.mU},"Report Bug"),a.Tj&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(ht.Z,{icon:"permissions",onClick:ee},"Beta Changelog"),o.ZP.createElement(ht.Z,{icon:"comments",onClick:te},"Beta Discussion (ru)"),o.ZP.createElement(ht.Z,{icon:"comments",onClick:ne},"Beta Discussion (en)")),V&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(ht.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:se},"Switch to K Version"),o.ZP.createElement(ht.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:ae},"Switch to Old Version")),k&&o.ZP.createElement(ht.Z,{icon:"install",onClick:(0,ut.G)()},"Install App",o.ZP.createElement("span",{className:"menu-item-badge"},F("New")))),o.ZP.createElement(pt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||w?"with-picker-item":"",value:n||g,focused:re,isLoading:p||"minimized"===H,spinnerColor:"minimized"===H?"yellow":void 0,spinnerBackgroundColor:"minimized"===H&&"light"===y?"light":void 0,placeholder:ce,autoComplete:"off",canClose:Boolean(I||w),onChange:i,onReset:u,onFocus:X,onSpinnerClick:"minimized"===H?K:void 0},q&&o.ZP.createElement(ft.Z,{icon:"calendar",title:q,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:A,clickArg:{date:void 0}}),I&&o.ZP.createElement(ft.Z,{chatOrUserId:I,onClick:B,canClose:!0,clickArg:{id:void 0}})),R&&o.ZP.createElement(gt.Z,{round:!0,ripple:!h.wB,size:"smaller",color:"translucent",ariaLabel:`${F("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:ie,className:"passcode-lock"},o.ZP.createElement("i",{className:"icon-lock"})),o.ZP.createElement(It.Z,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},o.ZP.createElement(yt,{connectionStatus:_,connectionStatusText:G,onClick:K}))))})));var Pt=n(71174),bt=n(93133),Ct=n(1080);const St=(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}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:i,orderedFolderIds:r,activeChatFolder:c,currentUserId:l,lastSyncTime:d,shouldSkipHistoryAnimations:u}=e;const{loadChatFolders:m,setActiveChatFolder:g,openChat:p}=(0,s.Sv)(),f=(0,o.sO)(null),v=(0,ot.Z)();(0,o.d4)((()=>{d&&m()}),[d,m]);const I=(0,o.Ye)((()=>r?r.map((e=>i[e]||{})).filter(Boolean):void 0),[i,r]),w=(0,Ye.yi)(),y=(0,o.Ye)((()=>{if(I&&I.length)return[{id:a.Nf,title:"en"===v.code?"All":v("FilterAllChats")},...I.map((e=>{var t,n;let{id:s,title:a}=e;return{id:s,title:a,badgeCount:null===(t=w[s])||void 0===t?void 0:t.chatsCount,isBadgeActive:Boolean(null===(n=w[s])||void 0===n?void 0:n.notificationsCount)}}))]}),[I,w,v]),Z=(0,o.I4)((e=>{g(e,{forceOnHeavyAnimation:!0})}),[g]);(0,o.d4)((()=>{y&&y.length&&c>=y.length&&g(0)}),[c,y,g]),(0,o.d4)((()=>{if(f.current&&h.$b&&y&&y.length)return(0,Pt.sf)(f.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Pt.eM.Left?(g(Math.min(c+1,y.length-1),{forceOnHeavyAnimation:!0}),!0):t===Pt.eM.Right&&(g(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,y,g]);const P=(0,o.sO)();P.current=0!==c,(0,o.d4)((()=>P.current?(0,et.Z)((()=>{P.current&&g(0)})):void 0),[c,g]),(0,Ve.Z)({isActive:0!==c,onBack:()=>g(0,{forceOnHeavyAnimation:!0})}),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&y){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void p({id:l,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>y.length-1)return;g(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[l,y,p,g]);const{shouldRender:b,transitionClassNames:C}=(0,We.Z)(!r,void 0,!0);function S(e){const s=Object.values(i).find((e=>{let{id:t}=e;return t===y[c].id}));return s&&0!==c?o.ZP.createElement(Ct.Z,{folderType:"folder",folderId:s.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t}):o.ZP.createElement(Ct.Z,{folderType:"all",isActive:e,lastSyncTime:d,foldersDispatch:t,onScreenSelect:n})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=y&&y.length?o.ZP.createElement(bt.Z,{tabs:y,activeTab:c,onSwitchTab:Z}):b?o.ZP.createElement("div",{className:(0,Le.Z)("tabs-placeholder",C)}):void 0,o.ZP.createElement(at.Z,{ref:f,name:u?"none":v.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:y?y.length:void 0},S))})));var Mt=n(99203),Et=n(48778),Rt=n(34288);const kt=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)})),Nt=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)}));var At=n(52328);const Tt=(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,ot.Z)(),l=(0,Le.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),d=(0,o.I4)((()=>{r(!i)}),[i]),u=(0,o.I4)((()=>{r(!1)}),[]);return o.ZP.createElement("div",{className:l},o.ZP.createElement(gt.Z,{round:!0,color:"primary",className:i?"active":"",onClick:d,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(At.Z,{isOpen:i,positionX:"right",positionY:"bottom",autoClose:!0,onClose:u},o.ZP.createElement(ht.Z,{icon:"channel",onClick:s},c("NewChannel")),o.ZP.createElement(ht.Z,{icon:"group",onClick:a},c("NewGroup")),o.ZP.createElement(ht.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),Bt=Object.keys(m.du).length/2;let xt;const Lt=(0,o.X$)((e=>{let{content:t,searchQuery:n,searchDate:s,contactsFilter:a,shouldSkipTransition:i,foldersDispatch:r,onSearchQuery:c,onContentChange:l,onScreenSelect:d,onReset:u}=e;const[g,p]=(0,o.eJ)(h.$b),f=(0,o.sO)(!1),v=(0,o.I4)((()=>{l(m.du.Settings)}),[l]),I=(0,o.I4)((()=>{l(m.du.Contacts)}),[l]),w=(0,o.I4)((()=>{l(m.du.NewChannelStep1)}),[l]),y=(0,o.I4)((()=>{l(m.du.NewGroupStep1)}),[l]),Z=(0,o.I4)((()=>{l(m.du.Archived)}),[l]),P=(0,o.I4)((()=>{t===m.du.ChatList&&(f.current=!0,p(!0))}),[t]),b=(0,o.I4)((()=>{f.current=!1,xt&&(clearTimeout(xt),xt=void 0),xt=window.setTimeout((()=>{f.current||p(!1)}),250)}),[]);(0,o.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{p(!1)}),250):(f.current||h.$b)&&p(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const[C,S,M]=function(){const[e,t]=(0,nt.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:s}=(0,We.Z)(e);return[n,s,()=>{window.location.reload()}]}(),E=(0,ot.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:P,onMouseLeave:h.$b?void 0:b},o.ZP.createElement(Zt,{content:t,contactsFilter:a,onSearchQuery:c,onSelectSettings:v,onSelectContacts:I,onSelectArchived:Z,onReset:u,shouldSkipTransition:i}),o.ZP.createElement(at.Z,{name:i?"none":"zoom-fade",renderCount:Bt,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return o.ZP.createElement(St,{onScreenSelect:d,foldersDispatch:r});case m.du.GlobalSearch:return o.ZP.createElement(kt,{searchQuery:n,searchDate:s,isActive:e,onReset:u});case m.du.Contacts:return o.ZP.createElement(Nt,{filter:a,isActive:e,onReset:u});default:return}})),C&&o.ZP.createElement(gt.Z,{fluid:!0,pill:!0,className:(0,Le.Z)("btn-update",S),onClick:M},E("lng_update_telegram")),o.ZP.createElement(Tt,{isShown:g,onNewPrivateChat:I,onNewChannel:w,onNewGroup:y}))})),Ot=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)})),Ut=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)})),Ft=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)}));var $t;!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"}($t||($t={}));const qt=Object.keys($t).length/2,Dt=(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:c}}=e;return{searchQuery:t,searchDate:n,activeChatFolder:s,shouldSkipHistoryAnimations:a,leftColumnWidth:o,currentUserId:i,hasPasscode:r,nextSettingsScreen:c}}))((e=>{let{searchQuery:t,searchDate:n,activeChatFolder:a,shouldSkipHistoryAnimations:i,leftColumnWidth:r,currentUserId:c,hasPasscode:l,nextSettingsScreen:d}=e;const{setGlobalSearchQuery:u,setGlobalSearchChatId:g,resetChatCreation:p,setGlobalSearchDate:f,loadPasswordInfo:v,clearTwoFaError:I,setLeftColumnWidth:w,resetLeftColumnWidth:y,openChat:Z,requestNextSettingsScreen:P}=(0,s.Sv)(),b=(0,o.sO)(null),[C,S]=(0,o.eJ)(m.du.ChatList),[M,E]=(0,o.eJ)(m.MT.Main),[R,k]=(0,o.eJ)(""),[N,A]=(0,tt.ZP)(),[T,B]=(0,o.eJ)(0);let x=$t.Main;switch(C){case m.du.Archived:x=$t.Archived;break;case m.du.Settings:x=$t.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:x=$t.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:x=$t.NewGroup}const L=(0,o.I4)((e=>{function t(){S(m.du.ChatList),k(""),u({query:""}),f({date:void 0}),g({id:void 0}),p(),setTimeout((()=>{B(Date.now())}),250)}if(!0!==e)if(C!==m.du.NewGroupStep2)if(C!==m.du.NewChannelStep2){if(C===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(C===m.du.Settings)switch(M){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:return void E(m.MT.Main);case m.MT.GeneralChatBackground:case m.MT.QuickReaction:return void E(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void E(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.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 E(m.MT.Privacy);case m.MT.PasscodeNewPasscode:return void E(l?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled);case m.MT.PasscodeChangePasscodeCurrent:case m.MT.PasscodeTurnOff:return void E(m.MT.PasscodeEnabled);case m.MT.PasscodeNewPasscodeConfirm:return void E(m.MT.PasscodeNewPasscode);case m.MT.PasscodeChangePasscodeNew:return void E(m.MT.PasscodeChangePasscodeCurrent);case m.MT.PasscodeChangePasscodeConfirm:return void E(m.MT.PasscodeChangePasscodeNew);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void E(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void E(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void E(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void E(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void E(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void E(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void E(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void E(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void E(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void E(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void E(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void E(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void E(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void E(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void E(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void E(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void E(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void E(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void E(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void E(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return S(m.du.ChatList),void E(m.MT.Main)}C!==m.du.ChatList||0!==a?t():S(m.du.GlobalSearch)}else S(m.du.NewChannelStep1);else S(m.du.NewGroupStep1);else t()}),[C,a,M,u,f,g,p,l]),O=(0,o.I4)((e=>{C!==m.du.Contacts?(S(m.du.GlobalSearch),e!==t&&u({query:e})):k(e)}),[C,t,u]);(0,o.d4)((()=>C!==m.du.ChatList||0===a?(0,et.Z)((()=>L())):void 0),[a,C,L]);const U=(0,o.I4)((e=>{C!==m.du.GlobalSearch&&(e.preventDefault(),S(m.du.GlobalSearch))}),[C]),F=(0,o.I4)((e=>{e.preventDefault(),Z({id:c})}),[c,Z]);(0,st.y)({"mod+shift+F":U,"mod+shift+S":F}),(0,o.d4)((()=>{I(),M===m.MT.Privacy&&v()}),[I,v,M]),(0,De.Z)((()=>{d&&(S(m.du.Settings),E(d),P(void 0))}),[d,P]);const{initResize:$,resetResize:q,handleMouseUp:D}=function(e,t,n,s){const[a,i,r]=(0,nt.Z)(),[c,l]=(0,o.eJ)(),[d,u]=(0,o.eJ)();function m(){document.body.classList.remove("cursor-ew-resize")}return(0,o.d4)((()=>{e.current&&s&&(e.current.style.width=`${s}px`)}),[e,s]),(0,o.d4)((()=>{if(!a)return;const n=t=>{const n=Math.ceil(d+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}),[d,c,e,t,a,r]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),l(t.clientX),u(e.current.offsetWidth),i()},resetResize:function(t){t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}}(b,w,y,r),j=(0,o.I4)((e=>{S(m.du.Settings),E(e)}),[]);return o.ZP.createElement("div",{id:"LeftColumn",ref:b},o.ZP.createElement(at.Z,{name:i?"none":h.s0,renderCount:qt,activeKey:x,shouldCleanup:!0,cleanupExceptionKey:$t.Main},(e=>{switch(x){case $t.Archived:return o.ZP.createElement(Ft,{isActive:e,onReset:L,onContentChange:S});case $t.Settings:return o.ZP.createElement(Ot,{isActive:e,currentScreen:M,foldersState:N,foldersDispatch:A,onScreenSelect:j,onReset:L,shouldSkipTransition:i});case $t.NewChannel:return o.ZP.createElement(Ut,{key:T,isActive:e,isChannel:!0,content:C,onContentChange:S,onReset:L});case $t.NewGroup:return o.ZP.createElement(Ut,{key:T,isActive:e,content:C,onContentChange:S,onReset:L});default:return o.ZP.createElement(Lt,{content:C,searchQuery:t,searchDate:n,contactsFilter:R,foldersDispatch:A,onContentChange:S,onSearchQuery:O,onScreenSelect:j,onReset:L,shouldSkipTransition:i})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:$,onMouseUp:D,onDoubleClick:q}))})));var jt=n(12420),_t=n(49524),Gt=n(71394);var Ht=n(12255),zt=n(52678),Vt=n(87204),Wt=n(3570),Xt=n(75790),Kt=n(18360),Yt=n(6058),Jt=n(98799);const Qt=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"HeaderMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),en=(0,o.X$)((0,s.c$)(((e,t)=>{var n,s,a;let{chatId:o,threadId:r,messageListType:l}=t;const u=(0,c.Z1)(e,o),m=Boolean(u&&(0,d.eA)(u));if(!u||u.isRestricted||(0,c.CA)(e))return{noMenu:!0};const g=(0,c.IK)(e,o),p=(0,c.FM)(e,o),f="thread"===l&&r===i._f,v="thread"===l&&r!==i._f,I=(0,c.Jf)(e),w=Boolean(g&&(0,c.s4)(e,g.id)),y=!w&&Boolean((0,c.pk)(e,o)),Z=Boolean(f&&(m||(0,d.ZV)(u))&&u.isNotJoined),P=f||v,b=h.Bi&&(0,d.YC)(u.id)&&!p&&!g,C=f&&!p&&!Z,S=f&&!Z,M=h.Bi&&u.isCallActive,E=h.Bi&&!u.isCallActive&&((null===(n=u.adminRights)||void 0===n?void 0:n.manageCall)||u.isCreator&&(0,d.G9)(u));return{noMenu:!1,isChannel:m,isRightColumnShown:I,canStartBot:y,canRestartBot:w,canSubscribe:Z,canSearch:P,canCall:b,canMute:C,canViewStatistics:null===(s=u.fullInfo)||void 0===s?void 0:s.canViewStatistics,canLeave:S,canEnterVoiceChat:M,canCreateVoiceChat:E,pendingJoinRequests:null===(a=u.fullInfo)||void 0===a?void 0:a.requestsPending}}))((e=>{let{chatId:t,threadId:n,noMenu:a,isChannel:i,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,pendingJoinRequests:w,isRightColumnShown:y,canExpandActions:Z}=e;const{joinChannel:P,sendBotCommand:b,openLocalTextSearch:C,restartBot:S,requestCall:M,requestNextManagementScreen:E}=(0,s.Sv)(),R=(0,o.sO)(null),[k,N]=(0,o.eJ)(!1),[A,T]=(0,o.eJ)(void 0),B=(0,o.I4)((()=>{N(!0);const e=R.current.getBoundingClientRect();T({x:e.right,y:e.bottom})}),[]),x=(0,o.I4)((()=>{N(!1)}),[]),L=(0,o.I4)((()=>{T(void 0)}),[]),O=(0,o.I4)((()=>{P({chatId:t})}),[P,t]),U=(0,o.I4)((()=>{b({command:"/start"})}),[b]),F=(0,o.I4)((()=>{S({chatId:t})}),[t,S]),$=(0,o.I4)((()=>{E({screen:m.u1.JoinRequests})}),[E]),q=(0,o.I4)((()=>{C(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[C]),D=(0,o.I4)((e=>{d&&h.fl&&!e.shiftKey&&(e.preventDefault(),q())}),[d,q]);(0,st.y)({"Meta+F":D});const j=(0,ot.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,Z&&l&&o.ZP.createElement(gt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:O},j(i?"ProfileJoinChannel":"ProfileJoinGroup")),Z&&r&&o.ZP.createElement(gt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:U},j("BotStart")),Z&&c&&o.ZP.createElement(gt.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:F},j("BotRestart")),d&&o.ZP.createElement(gt.Z,{round:!0,ripple:y,color:"translucent",size:"smaller",onClick:q,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),u&&o.ZP.createElement(gt.Z,{round:!0,color:"translucent",size:"smaller",onClick:function(){M({userId:t})},ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),Boolean(w)&&o.ZP.createElement(gt.Z,{round:!0,className:"badge-button",ripple:y,color:"translucent",size:"smaller",onClick:$,ariaLabel:j(i?"SubscribeRequests":"MemberRequests")},o.ZP.createElement("i",{className:"icon-user"}),o.ZP.createElement("div",{className:"badge"},w)),o.ZP.createElement(gt.Z,{ref:R,className:k?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:B},o.ZP.createElement("i",{className:"icon-more"})),A&&o.ZP.createElement(Qt,{chatId:t,threadId:n,isOpen:k,anchor:A,withExtraActions:h.wB||!Z,isChannel:i,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,onSubscribeChannel:O,onSearchClick:q,onClose:x,onCloseAnimationEnd:L}))})));var tn=n(74399),nn=n(996),sn=n(6202),an=n(10862);function on(e){var t;const n=e&&(0,d.DH)(e),s=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,i=n&&s&&!(0,h.on)()&&n.includes("image/webp"),[r,c]=(0,o.eJ)(an.Hu),l=null==e?void 0:e.id;return(0,o.bt)((()=>{i&&(0,an.p6)(`b64-${l}`,n).then(c).catch((e=>{a.eM&&console.error(e)}))}),[l,i,n]),i?r:n}var rn=n(68512),cn=n(17551);function ln(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 dn=(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=ln(0,0,2,t,1)+ln(0,12,2,t+1,1)+ln(0,25,2,t,1);else for(let e=0;e<n;e++)s+=ln(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),l=function(e,t,n,s){return t<=4||e<=1?0:e>=t-2?s-36:(n+4)/2+(e-2)*(n+2)}(n,e,s,o);return{markHeight:a,clipPath:r,markTranslateY:c,trackTranslateY:l,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(null!=s&&s.current){const a=s.current,{style:l}=a;l.height=`${e}px`,l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${i}")`;const d=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");d||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${n}px`,u.style.transform=`translateY(${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:l,clipPathId:d}=a;return o.ZP.createElement("div",{className:(0,Le.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("#${d}"); 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(${l}px);`})))})),un=(0,o.X$)((e=>{let{message:t,count:n,index:a,customTitle:i,className:r,onUnpinMessage:c,onClick:l,onAllPinnedClick:u}=e;const{clickBotInlineButton:m}=(0,s.Sv)(),g=(0,ot.Z)(),p=on(t),f=(0,sn.Z)((0,d.Ti)(t,"pictogram")),v=(0,nn.e)(g,t,Boolean(p)),[I,w,y]=(0,nt.Z)(),Z=(0,o.I4)((()=>{y(),c&&c(t.id)}),[y,c,t.id]),P=(0,d.eH)(t),b=(0,o.I4)((()=>{P&&m({messageId:t.id,button:P})}),[m,P,t.id]),[C,S,M]=(0,nt.Z)();return o.ZP.createElement("div",{className:(0,Le.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&o.ZP.createElement(gt.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(gt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:w},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(cn.Z,{isOpen:I,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:Z}),o.ZP.createElement("div",{className:(0,Le.Z)("HeaderPinnedMessage",C&&"no-hover"),onClick:l,dir:g.isRtl?"rtl":void 0},o.ZP.createElement(dn,{count:n,index:a}),p&&function(e,t){const{width:n,height:s}=(0,tn.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"},v),o.ZP.createElement(rn.Z,null)),P&&o.ZP.createElement(gt.Z,{size:"tiny",className:"inline-button",onClick:b,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:S,onMouseLeave:h.$b?void 0:M},P.text)))}));var mn=n(10396),hn=n(64532),gn=n(23186);function pn(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=()=>{fn(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 fn(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return vn(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!");return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const n=t.getContext("bitmaprenderer");n?n.transferFromImageBitmap(a):t.getContext("2d").drawImage(a,0,0),t.toBlob(e,s)}))}catch(a){return vn(e,t,n,void 0,s)}}function vn(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);return new Promise((e=>{o.toBlob(e,a)}))}var In=n(77510);const wn=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg",yn={width:200,height:200},Zn=115;var Pn=n(32340),bn=n(18051);const Cn=(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:l,playbackRate:u,isMuted:m}=e;const{setAudioPlayerVolume:g,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:v,closeAudioPlayer:I}=(0,s.Sv)(),w=(0,ot.Z)(),{audio:y,voice:Z,video:P}=(0,d.qp)(t),b=Boolean(Z||P),C=b||((null==y?void 0:y.duration)||0)>a.J0,S=r?(0,d.OU)(w,r):void 0,M=de.UV((0,d.Ti)(t,"inline")),E=((e,t,n)=>{const s=(0,ot.Z)(),{audio:a,voice:i}=(0,d.qp)(e),r=a?a.title||a.fileName:i?"Voice message":"",c=(null==a?void 0:a.performer)||t&&(0,d.OU)(s,t),l=n&&(0,d.U)(s,n)||"Telegram",u=a&&(0,d.MR)(a)&&(0,d.Ti)(e,"pictogram"),m=t&&(0,d.RT)(t,"big"),h=a&&u||i&&m,g=(0,sn.Z)(h),p=(0,o.Ye)((()=>function(e,t,n){if(!n)return yn;if(e){var s;if(null===(s=e.thumbnailSizes)||void 0===s||!s.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?tn.vY:void 0}(a,i,g)),[a,g,i]),{result:f}=(0,In.Z)((()=>function(e,t){if(!e)return Promise.resolve(wn);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=()=>{fn(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,Zn,Zn);const n=Math.min(t.width,t.height);return n<Zn?pn(e,Zn/n):Promise.resolve(e)}(g,p)),[g,p],wn);return(0,o.Ye)((()=>(0,hn.Of)({title:r,artist:c,album:l,artwork:[{src:f}]})),[l,c,r,f])})(t,r,c),{playPause:R,stop:k,isPlaying:N,requestNextTrack:A,requestPreviousTrack:T,isFirst:B,isLast:x,setVolume:L,toggleMuted:O,setPlaybackRate:U}=(0,gn.Z)((0,mn.An)(t),(0,d.XV)(t),b?"voice":"audio",M,void 0,E,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),F=b&&N;(0,o.d4)((()=>{if(F)return pe.Z.disableRefresh(),()=>{pe.Z.enableRefresh()}}),[F]);const $=(0,o.I4)((()=>{v({chatId:t.chatId,messageId:t.id})}),[v,t.chatId,t.id]),q=(0,o.I4)((()=>{N&&R(),I(),(0,hn.Ay)(),k()}),[I,N,R,k]),D=(0,o.I4)((e=>{g({volume:e/100}),L(e/100)}),[g,L]),j=(0,o.I4)((()=>{h.$b&&!h.cj||(O(),f({isMuted:!m}))}),[m,f,O]),_=(0,o.I4)((()=>{1===u?(U(1.8),p({playbackRate:1.8})):(U(1),p({playbackRate:1}))}),[u,p,U]),G=(0,o.Ye)((()=>0===l||m?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,m]);if(!i)return o.ZP.createElement("div",{className:(0,Le.Z)("AudioPlayer",n),dir:w.isRtl?"rtl":void 0},o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:$},y?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,Pn.Z)(t||s)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Pn.Z)(n)))}(y):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Pn.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(w("AttachAudio"),S),o.ZP.createElement(rn.Z,null)),o.ZP.createElement(gt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:B(),onClick:T,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(gt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,Le.Z)("toggle-play","player-button",N?"pause":"play"),onClick:R,ariaLabel:N?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(gt.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:x(),onClick:A,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement(gt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},o.ZP.createElement("i",{className:G,onClick:j}),!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(bn.Z,{bold:!0,value:m?0:100*l,onChange:D})))),C&&o.ZP.createElement(gt.Z,{round:!0,className:(0,Le.Z)("playback-button",1!==u&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:_},o.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),o.ZP.createElement(gt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:q,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var Sn=n(70172);const Mn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;const s=(0,c.Z1)(e,n),a=(0,Be.Bj)(e,n);return{groupCall:a,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(a?a.participantsCount>0&&a.isLoaded:s&&s.isCallNotEmpty&&s.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==a?void 0:a.id)}}))((e=>{let{chatId:t,isActive:n,groupCall:a,hasPinnedOffset:i,usersById:r,chatsById:c}=e;const{joinGroupCall:l,subscribeToGroupCallUpdates:d}=(0,s.Sv)(),u=(0,ot.Z)(),m=(0,o.I4)((()=>{l({chatId:t})}),[l,t]),h=null==a?void 0:a.participants,g=(0,o.Ye)((()=>h?Object.values(h).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,h,r]);if((0,o.d4)((()=>{if(null!=a&&a.id&&(n||!a.isLoaded))return d({id:a.id,subscribed:!0}),()=>{d({id:a.id,subscribed:!1})}}),[null==a?void 0:a.id,null==a?void 0:a.isLoaded,n,d]),a)return o.ZP.createElement("div",{className:(0,Le.Z)("GroupCallTopPane",i&&"has-pinned-offset",!n&&"is-hidden"),onClick:m},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},u("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},u("Participants",a.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},g.map((e=>{if(e)return e.user?o.ZP.createElement(Sn.Z,{key:e.user.id,user:e.user}):o.ZP.createElement(Sn.Z,{key:e.chat.id,chat:e.chat})}))),o.ZP.createElement(gt.Z,{round:!0,className:"join"},u("VoipChatJoin")))})));var En=n(14605);const Rn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,c.Z1)(e,n),user:(0,d.YC)(n)?(0,c.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:a,user:i,settings:r,currentUserId:c}=e;const{openAddContactDialog:l,blockContact:u,reportSpam:m,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:v,hideChatReportPanel:I}=(0,s.Sv)(),w=(0,ot.Z)(),[y,Z,P]=(0,nt.Z)(),[b,C]=(0,o.eJ)(!0),[S,M]=(0,o.eJ)(!0),{accessHash:E}=a||{},{isAutoArchived:R,canReportSpam:k,canAddContact:N,canBlockContact:A}=r||{},T=a&&(0,d.G9)(a),B=(0,o.I4)((()=>{l({userId:t}),R&&v({chatId:t})}),[l,R,v,t]),x=(0,o.I4)((()=>{P(),u({contactId:t,accessHash:E}),k&&b&&m({chatId:t}),S&&h({chatId:t})}),[E,u,P,h,m,k,S,b,t]),L=(0,o.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,o.I4)((()=>{P(),m({chatId:t}),T?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,P,c,p,f,T,g,m]);if(r)return o.ZP.createElement("div",{className:(0,Le.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},N&&o.ZP.createElement(gt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},w("lng_new_contact_add")),A&&o.ZP.createElement(gt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_new_contact_block")),k&&!A&&o.ZP.createElement(gt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_report_spam_and_leave")),o.ZP.createElement(gt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(cn.Z,{isOpen:y,onClose:P,title:w("BlockUserTitle",i?(0,d.Vl)(i):(0,d.U)(w,a)),text:i?w("UserInfo.BlockConfirmationTitle",(0,d.Js)(i)):w("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:i?x:O},i&&o.ZP.createElement(En.Z,{label:w("DeleteThisChat"),checked:S,onCheck:M}),i&&k&&o.ZP.createElement(En.Z,{label:w("ReportChat"),checked:b,onCheck:C})))}))),kn=(0,o.X$)((0,s.c$)(((e,t)=>{let{chatId:n,threadId:s,messageListType:a}=t;const{isLeftColumnShown:o,lastSyncTime:r,shouldSkipHistoryAnimations:l}=e,d=(0,c.Z1)(e,n),{typingStatus:u}=d||{},{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,c.hj)(e,m,h):void 0;let p;if("pinned"===a){const t=(0,c.KB)(e,n);p=null==t?void 0:t.length}else if("scheduled"===a){const t=(0,c.qy)(e,n);p=null==t?void 0:t.length}else if("thread"===a&&s!==i._f){const t=(0,c.tZ)(e,n,s);p=(null==t?void 0:t.messagesCount)||0}const f={typingStatus:u,isLeftColumnShown:o,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),audioMessage:g,chat:d,messagesCount:p,isChatWithSelf:(0,c.FM)(e,n),isChatWithBot:d&&(0,c.xo)(e,d),lastSyncTime:r,shouldSkipHistoryAnimations:l,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing},v=(0,c.Zw)(e,n);if("thread"!==a||!v)return f;if(Object.assign(f,{messagesById:v}),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{...f,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o}}const I=(0,c.KB)(e,n);if(null!=I&&I.length){const t=v[I[0]],{canUnpin:n}=t&&(0,c._k)(e,t,s)||{};return{...f,pinnedMessageIds:I,canUnpin:n}}return f}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:v,isRightColumnShown:I,audioMessage:w,chat:y,messagesCount:Z,isChatWithSelf:P,isChatWithBot:b,lastSyncTime:C,shouldSkipHistoryAnimations:S,currentTransitionKey:M,connectionState:E,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:N,focusMessage:A,openChat:T,openPreviousChat:B,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,s.Sv)(),U=(0,ot.Z)(),F=(0,o.sO)(!0),[$,q]=(0,o.eJ)(0),D=Array.isArray(l)?l[$]:l,j=u&&D?u[D]:void 0,_=Array.isArray(l)?l.length:l?1:void 0,G=y&&(0,d.U)(U,y).length,H=g?(0,d.OU)(U,g):void 0,{settings:z}=y||{};(0,o.d4)((()=>{n===i._f&&C&&c&&x({chatId:t})}),[t,x,C,n,c]),(0,o.d4)((()=>{q(0)}),[l]),(0,Xt.Z)(t,D,j);const{width:V}=(0,Ht.Z)(),W=V<=a.ks,X=h.p7&&v,K=(0,o.sO)(null),Y=(0,o.sO)(!0),J=(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(j){A({chatId:j.chatId,threadId:n,messageId:j.id});const e=(0,Wt.Z)(_||1,$+1);q(e)}}),[j,A,n,_,$]),te=(0,o.I4)((()=>{T({id:t,threadId:i._f,type:"pinned"})}),[T,t]),ne=(0,o.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),se=(0,o.I4)((e=>{if(F.current){if(F.current=!1,h.wB){const e=document.querySelector(a.Ed);null==e||e.blur()}if(f)return O(),void ne();if(n===i._f&&"thread"===r&&0===M)return h.wB||X?(e.stopPropagation(),T({id:void 0})):L(),void ne();B(),ne()}}),[n,r,M,f,B,X,T,L,O,ne]),ae=V>=a.ks&&V<a.jT||V>a.l3&&V<a.ks&&(!G||G>30),oe=ae||V>a._m&&V<a.QU,ie=Boolean((null==z?void 0:z.canAddContact)||(null==z?void 0:z.canBlockContact)||(null==z?void 0:z.canReportSpam)),{shouldRender:re,transitionClassNames:ce}=(0,We.Z)(ie),le=(0,Kt.Z)(ie?z:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,We.Z)(Boolean(w)),me=(0,Kt.Z)(w,!0),{shouldRender:he,transitionClassNames:ge}=(0,We.Z)(Boolean(j)),pe=(0,Kt.Z)(j,!0),fe=(0,Kt.Z)(_,!0),ve=(0,Kt.Z)(m,!0),Ie=(0,Kt.Z)(H),we=he&&pe||de&&me;(0,o.d4)((()=>{const e=K.current;if(e)return oe&&we?void(I||ae?(Y.current&&(e.classList.add("tools-stacked","animated"),Y.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),Y.current=!0)):(e.classList.remove("tools-stacked","animated"),void(Y.current=!0))}),[oe,we,ae,I]);const{connectionStatusText:ye}=dt(U,E,R,!0);function Ze(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(gt.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:U(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,Le.Z)("animated-close-icon",!e&&"state-back")})),t&&o.ZP.createElement(Qe,null))}const Pe=Boolean(de&&me);return o.ZP.createElement("div",{className:"MiddleHeader",ref:K},o.ZP.createElement(at.Z,{name:S?"none":"slide-fade",activeKey:M},"thread"===r&&n===i._f?o.ZP.createElement(o.ZP.Fragment,null,(W||M>0)&&Ze(X,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:J},(0,d.YC)(t)?o.ZP.createElement(Yt.Z,{userId:t,typingStatus:p,status:ye,withDots:Boolean(ye),withFullInfo:b,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(Jt.Z,{chatId:t,typingStatus:p,status:ye,withDots:Boolean(ye),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,noRtl:!0}))):"thread"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("CommentsCount",Z,"i"))):"pinned"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("PinnedMessagesCount",Z,"i"))):"scheduled"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,P?U("Reminders"):U("messages",Z,"i"))):void 0),o.ZP.createElement(Mn,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&o.ZP.createElement(un,{key:t,message:pe,count:fe||0,index:$,customTitle:Ie,className:(0,Le.Z)(ge,Pe&&"full-width"),onUnpinMessage:ve?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&o.ZP.createElement(Rn,{key:t,chatId:t,settings:le,className:ce}),o.ZP.createElement("div",{className:"header-tools"},Pe&&o.ZP.createElement(Cn,{key:(0,d.Tp)(me),message:me,className:ue}),o.ZP.createElement(en,{chatId:t,threadId:n,messageListType:r,canExpandActions:!Pe})))})));var Nn=n(72645),An=n(274);function Tn(e){return"albumId"in e}function Bn(e,t){let n,s=[],a={originalDate:e[0].date,datetime:(0,j._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,j._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,d.Lo)(i)||(0,d.Lo)(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),Ln=n(88957);var On=n(87675),Un=n(60539),Fn=n(62357),$n=n(60998);var qn=n(3657);const Dn=h.wZ?1e3:350,jn=h.wB?300:500;var _n=n(17240);function Gn(e){return"number"==typeof e}function Hn(e,t){return e?t?238:175:t?238:100}function zn(e,t){const n=(0,d.B4)(e),s=(0,d.MF)(e),a=(0,d.O$)(e)||(0,d.F$)(e),o=(0,d.b7)(e),i=Boolean((0,d.F$)(e)),{width:r,height:c}=a?(0,tn.Eh)(a,n,s,i,t):(0,tn.GC)(o,n,s,t),l=Hn(Boolean((0,d.UD)(e)));let u=1;r<l&&l-r<12&&(u=l/r),c*u<90&&90-c*u<12&&(u=90/c);const m=Math.round(r*u),h=Math.round(c*u);return{width:m,height:h,isSmall:m<l||h<90}}var Vn=n(28712);function Wn(e,t){return e.reduce(((e,t)=>e+t),t)}function Xn(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 Kn(e,t,n,s){const a=function(e){return e.map((e=>{const t=zn(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)),l=(0,tn.kc)(e,t,!1,n)-(t?2.5:0)*tn.Gw;let d;const u={ratios:a,proportions:o,averageRatio:i,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||c?function(e){let{ratios:t,averageRatio:n,maxWidth:s,minWidth:a,spacing:o,maxHeight:i=4*s/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,Vn.uZ)(e,1,2.75):(0,Vn.uZ)(e,.6667,1)))}(t,n),c=t.length,l=new Array(c),d=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=Wn(r.slice(e,e+t),0);return(s-(t-1)*o)/n})(n,e)),n+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const s=c-e-t;e<=3&&t<=(n<.85?4:3)&&s<=3&&u([e,t,s])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let n=1;n!==c-e-t;++n){const s=c-e-t-n;e<=3&&t<=3&&n<=3&&s<=4&&u([e,t,n,s])}let m,h=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:n}=d[e],s=n.length,r=Wn(t,0)+o*(s-1),c=Math.min(...t)<a?1.5:1,l=(()=>{for(let e=1;e!==s;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-i)*c*l;(!m||u<h)&&(m=d[e],h=u)}const g=m.lineCounts,p=m.heights,f=g.length;let v=0,I=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],a=Math.round(n);let i=0;for(let c=0;c!==t;++c){const d=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[v],m=c===t-1?s-i:Math.round(u*n);l[v]={dimensions:{x:i,y:I,width:m,height:a},sides:d},i+=m+o,++v}I+=a+o}return l}(u):2===r?function(e){const{ratios:t,proportions:n,averageRatio:s}=e;return"ww"===n&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:s,maxHeight:a}=e,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,l=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:l},sides:13},{dimensions:{x:c+a,y:0,width:r,height:l},sides:7}]}(e)}(u):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:s,maxWidth:a,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,s[1]*(a-n)/(s[2]+s[1]))),c=i-r-n,l=Math.max(o,Math.round(Math.min((a-n)/2,Math.min(r*s[2],c*s[1])))),d=Math.min(Math.round(i*s[0]),a-n-l);return[{dimensions:{x:0,y:0,width:d,height:i},sides:13},{dimensions:{x:d+n,y:0,width:l,height:c},sides:3},{dimensions:{x:d+n,y:c+n,width:l,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:s,spacing:a}=e,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])),l=Math.max(o,Math.round(Math.min(.4*(t-2*s),c*n[1]))),d=Math.round(Math.max(Math.max(o,.33*(t-2*s)),c*n[3])),u=i-l-d-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:l,height:m},sides:12},{dimensions:{x:l+s,y:r+s,width:u,height:m},sides:4},{dimensions:{x:l+s+u+s,y:r+s,width:d,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:s,spacing:a,minWidth: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])),l=Math.round(c/n[1]),d=Math.round(c/n[2]),u=i-l-d-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:l},sides:3},{dimensions:{x:r+a,y:l+a,width:m,height:d},sides:2},{dimensions:{x:r+a,y:l+d+2*a,width:m,height:u},sides:6}]}(e)}(u),{layout:d,containerStyle:Xn(d)}}let Yn,Jn;function Qn(e){return Jn||(Jn=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),Yn||(Yn=document.createElement("span"),Yn.style.font=`400 12px ${Jn}`,Yn.style.whiteSpace="nowrap",Yn.style.position="absolute",Yn.style.left="-999px",Yn.style.opacity=".01",document.body.appendChild(Yn)),Yn.innerHTML=e,Yn.offsetWidth}function es(e,t,n,s,a,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Un.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s,void 0,i)}}),[e,t,n,s,a,i])}const ts=3*tn.Gw,ns=Number(tn.Gw),ss="data-is-document-group-hover";function as(e,t,n,a,i,r,c,l,d,u,m,g,p,f){const{setReplyingToId:v,sendDefaultReaction:I}=(0,s.Sv)(),[w,y,Z]=(0,nt.Z)(),[P,b,C]=(0,nt.Z)(),S=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,Pt.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===Pt.eM.Left&&(e||(e=Date.now()),b(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(C,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,v,b,C,r,m]),{handleMouseDown:i?void 0:function(e){(0,xn.q)(e),d(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return S.current?(clearInterval(S.current),S.current=void 0,void function(e){const{pageX:t,pageY:s}=e;I({chatId:u,messageId:n,x:t,y:s})}(t)):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;pe.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:i?c?Fe.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:i?void 0:function(){h.$b||v({messageId:n})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:s}=e,{x:a,width:o,y:i,height:r}=t.getBoundingClientRect(),c=Math.abs(p?n-a:a+o-n)<ts,l=Math.abs(i+r-s)<ns;c&&l?y():Z()},handleSendQuickReaction:function(e){const{x:t,y:s}=e.currentTarget.getBoundingClientRect();I({chatId:u,messageId:n,x:t,y:s})},handleMouseLeave:function(e){Z(),f&&function(e){const t=is(e.currentTarget);t&&t.removeAttribute(ss)}(e)},isSwiped:P,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:os}}function os(e){const t=is(e.currentTarget);t&&t.setAttribute(ss,"")}function is(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var rs=n(55254),cs=n(18005);const ls=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),ds=(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,l=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,d.eA)(g)||a===n.chatId);return{usersById:s,senderUser:!p&&a?(0,c.dy)(e,a):void 0,senderChat:p?g:void 0,targetChatId:i,targetUserIds:o,targetMessage:l,isFocused:u,...u&&{focusDirection:m,noFocusHighlight:h}}}))((e=>{let{message:t,observeIntersection:n,isEmbedded:s,appearanceOrder:a=0,isLastInList:i,usersById:r,senderUser:c,senderChat:l,targetUserIds:u,targetMessage:m,targetChatId:h,isFocused:g,focusDirection:p,noFocusHighlight:f}=e;const v=(0,o.sO)(null);(0,qn._N)(v,n),(0,Xt.Z)(t.chatId,t.replyToMessageId,m),es(v,t.chatId,g,p,f);const I=(0,ot.Z)(),w=a<=0,[y,Z]=(0,nt.Z)(w);(0,o.d4)((()=>{w||setTimeout(Z,10*a)}),[a,Z,w]);const{transitionClassNames:P}=(0,We.Z)(y,void 0,w,!1),b=(0,o.Ye)((()=>u?u.map((e=>null==r?void 0:r[e])).filter(Boolean):void 0),[u,r]),C=(0,cs.D)(I,t,c,l,b,m,h,{asTextWithSpoilers:s}),{isContextMenuOpen:S,contextMenuPosition:M,handleBeforeContextMenu:E,handleContextMenu:R,handleContextMenuClose:k,handleContextMenuHide:N}=(0,_n.Z)(v),A=void 0!==M;if(s)return o.ZP.createElement("span",{className:"embedded-action-message"},C);const T=(0,Le.Z)("ActionMessage message-list-item",g&&!f&&"focused",A&&"has-menu-open",i&&"last-in-list",P);return o.ZP.createElement("div",{ref:v,id:(0,d.d0)(t.id),className:T,"data-message-id":t.id,onMouseDown:e=>{(0,xn.q)(e),E(e)},onContextMenu:R},o.ZP.createElement("span",null,C),M&&o.ZP.createElement(ls,{isOpen:S,anchor:M,message:t,messageListType:"thread",onClose:k,onCloseAnimationEnd:N}))}))),us=e=>{var t;let{className:n,message:s,sender:a,title:i,customText:r,isProtected:c,observeIntersection:l,onClick:u}=e;const m=(0,o.sO)(null),h=(0,qn.Op)(m,l),g=(0,sn.Z)(s&&(0,d.Ti)(s,"pictogram"),!h),p=on(s),f=Boolean(s&&(0,d.Y5)(s)),v=(0,ot.Z)(),I=a?(0,d.OU)(v,a):null==s||null===(t=s.forwardInfo)||void 0===t?void 0:t.hiddenUserName;return o.ZP.createElement("div",{ref:m,className:(0,Le.Z)("EmbeddedMessage",n),onClick:s?u:void 0},p&&function(e,t,n,s){const{width:a,height:i}=(0,tn.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{src:t||e,width:a,height:i,alt:"",className:n?"round":"",draggable:!s}),s&&o.ZP.createElement("span",{className:"protector"}))}(p,g,f,c),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},s?(0,d.Lo)(s)?o.ZP.createElement(ds,{message:s,isEmbedded:!0}):(0,nn.e)(v,s,Boolean(p)):r||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Pn.Z)(I||i||" "))))};var ms=n(82535),hs=n(54752),gs=n(8018),ps=n(48198),fs=n(97799);const vs=(0,o.X$)((e=>{var t,n;let{reaction:a,activeReaction:i,isInMeta:r,availableReactions:c}=e;const{stopActiveReaction:l}=(0,s.Sv)(),d=null==c?void 0:c.find((e=>e.reaction===a)),u=null==d||null===(t=d.centerIcon)||void 0===t?void 0:t.id,m=null==d||null===(n=d.aroundAnimation)||void 0===n?void 0:n.id,h=(0,sn.Z)(`sticker${u}`,!u),g=(0,sn.Z)(`sticker${m}`,!m),p=Boolean((null==i?void 0:i.reaction)===a&&h&&g),{shouldRender:f,transitionClassNames:v}=(0,We.Z)(p,void 0,!0,"slow"),I=(0,o.I4)((()=>{l({messageId:null==i?void 0:i.messageId,reaction:a})}),[null==i?void 0:i.messageId,a,l]),[w,y,Z]=(0,nt.Z)(),P=!p||!w,b=(0,Le.Z)("ReactionAnimatedEmoji",r&&"in-meta",f&&"is-animating");return o.ZP.createElement("div",{className:b},P&&o.ZP.createElement(ps.Z,{reaction:a}),f&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(fs.Z,{key:u,className:v,size:30,tgsUrl:h,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:y,onEnded:Z}),o.ZP.createElement(fs.Z,{key:m,className:(0,Le.Z)("effect",v),size:100,tgsUrl:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:I})))})),Is=(0,o.X$)((e=>{var t;let{message:n,outgoingStatus:s,signature:a,onClick:i,withReactions:r,activeReaction:c,withReactionOffset:l,availableReactions:d,reactionMessage:u}=e;const m=(0,ot.Z)(),[h,g]=(0,nt.Z)(),p=r&&(null==u||null===(t=u.reactions)||void 0===t?void 0:t.results.filter((e=>e.count>0))),f=(0,o.Ye)((()=>{if(!h)return;const e=(0,j.SA)(1e3*n.date,m.code),t=n.isEdited&&(0,j.SA)(1e3*n.editDate,m.code),s=n.forwardInfo&&(0,j.SA)(1e3*n.forwardInfo.date,m.code);let a=e;return t&&(a+="\n",a+=m("lng_edited_date").replace("{date}",t)),s&&(a+="\n",a+=m("lng_forwarded_date").replace("{date}",s)),a}),[h,m,n]);return o.ZP.createElement("span",{className:(0,Le.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:i},p&&p.map((e=>o.ZP.createElement(vs,{activeReaction:c,reaction:e.reaction,isInMeta:!0,availableReactions:d}))),Boolean(n.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,Ke.bi)(n.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),a&&o.ZP.createElement("span",{className:"message-signature"},(0,Pn.Z)(a)),o.ZP.createElement("span",{className:"message-time",title:f,onMouseEnter:g},n.isEdited&&`${m("EditedMessage")} `,(0,j.mr)(m,1e3*n.date)),s&&o.ZP.createElement(gs.Z,{status:s}))}));var ws=n(70692),ys=n(74753);const Zs=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:s,shouldLoop:i,lastSyncTime:r}=e;const c=(0,o.sO)(null),[l,u,m]=(0,nt.Z)(),g=t.content.sticker,{isLottie:p,stickerSetId:f,isVideo:v}=g,I=h.Hh,w=f===a.$E,y=(0,qn.Op)(c,n),Z=(0,qn.Op)(c,s),P=g.isPreloadedGlobally?`sticker${g.id}`:(0,d.Ti)(t,"inline"),b=v&&!I&&(g.isPreloadedGlobally?`sticker${g.id}?size=m`:(0,d.Ti)(t,"pictogram")),C=(0,sn.Z)(b),S=on(t),M=C||S,E=(0,sn.Z)(P,!y,(0,d.kG)(t,"inline"),r),R=Boolean(E),[k,N]=(0,nt.Z)(R),A=p?k:R,T=(0,ws.Z)(A),{width:B,height:x}=(0,tn.Wr)(g),L=(0,Le.Z)("thumbnail",!S&&"empty"),O=(0,Le.Z)("Sticker media-inner",w&&"inactive");return(0,o.d4)((()=>{if(!v||!c.current)return;const e=c.current.querySelector("video");e&&(Z?(0,ys.Z)(e):e.pause())}),[v,Z]),o.ZP.createElement("div",{ref:c,className:O,onClick:w?void 0:u},(!A||v&&!I)&&o.ZP.createElement("img",{src:M,width:B,height:x,alt:"",className:L}),!p&&!v&&o.ZP.createElement("img",{src:E,width:B,height:x,alt:"",className:(0,Le.Z)("full-media",T)}),v&&I&&A&&o.ZP.createElement("video",{src:E,width:B,height:x,autoPlay:Z,playsInline:!0,loop:i,muted:!0}),p&&R&&o.ZP.createElement(fs.Z,{key:P,className:(0,Le.Z)("full-media",T),tgsUrl:E,size:B,play:Z,noLoop:!i,onLoad:N}),o.ZP.createElement(Xe.Z,{isOpen:l,fromSticker:g,onClose:m}))};var Ps=n(15258);var bs=n(45601),Cs=n(21179);const Ss=(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:a,forceLoadPreview:i,messageId:r,chatId:l,activeEmojiInteractions:d,sticker:u,effect:m,localSticker:h,localEffect:g,soundId:p}=e;const{ref:f,size:v,style:I,handleClick:w}=function(e,t,n,a,i,r,l){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:u,sendWatchingEmojiInteraction:m}=(0,s.Sv)(),h=r||l,g=(0,o.sO)(null),p=(0,o.sO)(null),f=(0,sn.Z)(n?`document${n}`:void 0,!n),v=(0,o.sO)(void 0),I=(0,o.sO)(void 0),w=(0,o.I4)((()=>{g.current&&(u({chatId:e,messageId:t,localEffect:r,emoji:l,interactions:v.current}),I.current=void 0,v.current=void 0)}),[u,e,t,r,l]),y=(0,o.I4)((()=>{const e=p.current;f&&(e&&(e.pause(),e.remove()),p.current=new Audio,p.current.src=f,(0,ys.Z)(p.current),p.current.addEventListener("ended",(()=>{p.current=void 0}),{once:!0}))}),[f]),Z=(0,o.I4)((()=>{y();const n=g.current;if(!(h&&n&&t&&e))return;const{x:s,y:a}=n.getBoundingClientRect();d({localEffect:r,emoji:l,x:s,y:a,startSize:104,isReversed:!i}),v.current||(v.current=[],I.current=performance.now(),setTimeout(w,1e3)),v.current.push(I.current?(performance.now()-I.current)/1e3:0)}),[e,l,h,d,i,r,t,y,w]);return(0,o.d4)((()=>{const n=g.current;n&&a&&a.forEach((s=>{let{id:a,startSize:o,messageId:d}=s;if(o||t!==d)return;const{x:u,y:h}=n.getBoundingClientRect();m({id:a,chatId:e,emoticon:r?(0,c.ji)(r):l,startSize:104,x:u,y:h,isReversed:!i}),y()}))}),[a,e,l,i,r,t,y,m]),{ref:g,size:104,style:"width: 104px; height: 104px;",handleClick:Z}}(l,r,p,d,t,g,null==m?void 0:m.emoji),y=(0,qn.Op)(f,n);return h?o.ZP.createElement(Cs.Z,{tgsUrl:Ps.l[h],size:v,quality:1,play:y,forceOnHeavyAnimation:!0,ref:f,className:"AnimatedEmoji media-inner",style:I,onClick:w}):o.ZP.createElement(bs.Z,{sticker:u,size:v,quality:1,noLoad:!y,forcePreview:i,lastSyncTime:a,play:y,forceOnHeavyAnimation:!0,ref:f,className:(0,Le.Z)("AnimatedEmoji media-inner",(null==u?void 0:u.id)===tn.wB&&"like-sticker-thumb"),style:I,onClick:w})})));var Ms=n(92566),Es=n(15866);function Rs(e,t){return(0,Es.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const ks={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Ns(e,t,n,s,a){return s?Promise.resolve(ks[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 As=n(39196);const Ts=e=>{let{id:t,message:n,observeIntersection:s,noAvatars:i,canAutoLoad:r,isInSelectMode:c,isSelected:l,uploadProgress:u,size:m="inline",dimensions:h,nonInteractive:g,shouldAffectAppendix:p,isDownloading:f,isProtected:v,withAspectRatio:I,theme:w,onClick:y,onCancelUpload:Z}=e;const P=(0,o.sO)(null),b=((0,d.O$)(n)||(0,d.F$)(n)).blobUrl,C=(0,qn.Op)(P,s),[S,M]=(0,o.eJ)(r),E=S&&C,{mediaData:R,loadProgress:k}=(0,Ms.Z)((0,d.Ti)(n,m),!E),N=b||R,A=Rs(n,N),{loadProgress:T}=(0,Ms.Z)((0,d.Ti)(n,"download"),!f),{isUploading:B,isTransferring:x,transferProgress:L}=(0,d.Sc)(n,u||(f?T:k),E&&!N),O=!1===(0,Vt.Z)(S),U=(0,ws.Z)(N),{shouldRender:F,transitionClassNames:$}=(0,We.Z)(x,void 0,O,"slow"),{shouldRender:q,transitionClassNames:D}=(0,We.Z)(!N&&!S),j=(0,o.I4)((()=>{B?Z&&Z(n):N?y&&y(n.id):M((e=>!e))}),[N,B,n,Z,y]),_=(0,d.B4)(n);(0,o.bt)((()=>{if(!p)return;const e=P.current.closest(".message-content");N?Ns(N,_,0,l,w).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")})):e.classList.add("has-appendix-thumb")}),[N,_,p,c,l,w]);const{width:G,height:H,isSmall:z}=h||zn(n,i),V=(0,Le.Z)("media-inner",!B&&!g&&"interactive",z&&"small-image",G===H&&"square-image"),W=I?`aspect-ratio: ${(G/H).toFixed(3)}/ 1`:"",X=h?`width: ${G}px; height: ${H}px; left: ${h.x}px; top: ${h.y}px;${W}`:"";return o.ZP.createElement("div",{id:t,ref:P,className:V,style:X,onClick:B?void 0:j},o.ZP.createElement("canvas",{ref:A,className:"thumbnail",style:`width: ${G}px; height: ${H}px;${W}`}),o.ZP.createElement("img",{src:N,className:`full-media ${U}`,width:G,height:H,alt:"",draggable:!v}),v&&o.ZP.createElement("span",{className:"protector"}),F&&!q&&o.ZP.createElement("div",{className:`media-loading ${$}`},o.ZP.createElement(As.Z,{progress:L,onClick:B?j:void 0})),q&&o.ZP.createElement("i",{className:(0,Le.Z)("icon-download",D)}),x&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*L),"%"))};var Bs=n(12019),xs=n(46898);function Ls(e,t){var n;const s=(0,o.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),a=(0,o.sO)();a.current=t;const i=(0,o.I4)((()=>{e.current&&(s.current=!e.current.paused,s.current&&e.current.pause())}),[e]),r=(0,o.I4)((()=>{e.current&&s.current&&a.current&&document.body.contains(e.current)&&(0,ys.Z)(e.current)}),[e]),c=(0,o.I4)((()=>{(0,R.T2)(r)}),[r]);(0,$e.Z)(i,c),(0,xe.ZP)(i,r)}function Os(){return Os=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Os.apply(this,arguments)}const Us=e=>{var t;let{id:n,message:a,observeIntersection:r,noAvatars:c,canAutoLoad:l,canAutoPlay:u,uploadProgress:m,lastSyncTime:h,dimensions:g,onClick:p,onCancelUpload:f,isDownloading:v,isProtected:I,withAspectRatio:w}=e;const y=(0,o.sO)(null),Z=(0,o.sO)(null),P=(0,d.b7)(a)||(0,d.Cg)(a),b=P.blobUrl,C=(0,qn.Op)(y,r),[S,M]=(0,o.eJ)(l),E=Boolean(S&&C&&h),[R,k]=(0,o.eJ)(u),N=(0,sn.Z)((0,d.Ti)(a,"pictogram"),!(C&&h),(0,d.kG)(a,"pictogram"),h),A=(0,ws.Z)(N),{mediaData:T,loadProgress:B}=(0,Ms.Z)((0,d.Ti)(a,"inline"),!E,(0,d.kG)(a,"inline"),h),x=b||T,L=Boolean(C&&x),O=Rs(a,N),{loadProgress:U}=(0,Ms.Z)((0,d.Ti)(a,"download"),!v,i.IU.BlobUrl,h),{isBuffered:F,bufferingHandlers:$}=(0,Bs.Z)(!l),{isUploading:q,isTransferring:D,transferProgress:_}=(0,d.Sc)(a,m||(v?U:B),E&&!F||v),G=!1===(0,Vt.Z)(S),{shouldRender:H,transitionClassNames:z}=(0,We.Z)(D,void 0,G),{shouldRender:V,transitionClassNames:W}=(0,We.Z)(S&&!R&&!H),[X,K]=(0,o.eJ)(0),Y=(0,o.I4)((e=>{K(Math.max(0,e.currentTarget.currentTime-1))}),[]),J=(null===(t=Z.current)||void 0===t?void 0:t.duration)||P.duration||0,Q=(0,d.B4)(a),ee=(0,d.MF)(a),{width:te,height:ne}=g||(0,tn.GC)(P,Q,ee,c);Ls(Z,L),(0,xs.Z)(Z,[L]);const se=(0,o.I4)((()=>{q?f&&f(a):v?(0,s.Sv)().cancelMessageMediaDownload({message:a}):x?x&&!R?(k(!0),Z.current.play()):p&&p(a.id):M((e=>!e))}),[q,v,x,R,p,f,a]),ae=(0,Le.Z)("media-inner dark",!q&&"interactive"),oe=w?`aspect-ratio: ${(te/ne).toFixed(3)}/ 1`:"",ie=g?`width: ${te}px; height: ${ne}px; left: ${g.x}px; top: ${g.y}px;${oe}`:"";return o.ZP.createElement("div",{ref:y,id:n,className:ae,style:ie,onClick:q?void 0:se},o.ZP.createElement("canvas",{ref:O,className:"thumbnail",style:`width: ${te}px; height: ${ne}px;${oe}`}),o.ZP.createElement("img",{src:N,className:(0,Le.Z)("thumbnail",A),style:`width: ${te}px; height: ${ne}px;${oe}`,alt:"",draggable:!I}),L&&o.ZP.createElement("video",Os({ref:Z,className:"full-media",width:te,height:ne,autoPlay:R,muted:!0,loop:!0,playsInline:!0},$,{draggable:!I,onTimeUpdate:Y,style:oe}),o.ZP.createElement("source",{src:x})),I&&o.ZP.createElement("span",{className:"protector"}),V&&o.ZP.createElement("i",{className:(0,Le.Z)("icon-large-play",W)}),H&&o.ZP.createElement("div",{className:(0,Le.Z)("media-loading",z)},o.ZP.createElement(As.Z,{progress:_,onClick:se})),!S&&o.ZP.createElement("i",{className:"icon-download"}),D?o.ZP.createElement("span",{className:"message-transfer-progress"},q||v?`${Math.round(100*_)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,j.k9)(Math.max(J-X,0))))};var Fs=n(6272);const $s=(0,s.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:s}}=e;return{user:(0,c.dy)(e,n.userId),phoneCodeList:s}}))((e=>{let{contact:t,user:n,phoneCodeList:a}=e;const{openChat:i}=(0,s.Sv)(),{firstName:r,lastName:c,phoneNumber:l,userId:d}=t,u="0"!==d,m=(0,o.I4)((()=>{i({id:d})}),[i,d]);return o.ZP.createElement("div",{className:(0,Le.Z)("Contact",u&&"interactive"),onClick:u?m:void 0},o.ZP.createElement(Sn.Z,{size:"large",user:n,text:r||c}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},r," ",c),o.ZP.createElement("div",{className:"contact-phone"},(0,Fs.WZ)(a,l))))}));var qs=n(20230),Ds=n(51218),js=n(14434),_s=n(96937);function Gs(e,t){return t>0?(e/t*100).toFixed():0}const Hs=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)),l=0===i.length||-1!==i.indexOf(t.option),d=i.length>0&&l||(null==c?void 0:c.isChosen),u=c?Gs(c.votersCount,s||0):0,[m,h]=(0,o.eJ)(r?0:u),g=(0,o.sO)(null),p=c?Gs(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 v=`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,"%",d&&o.ZP.createElement("span",{className:(0,Le.Z)("poll-option-chosen",!l&&"wrong",r&&"animate")},o.ZP.createElement("i",{className:l?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Pn.Z)(t.text)),o.ZP.createElement("div",{className:(0,Le.Z)("poll-option-answer",d&&!l&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:g}),o.ZP.createElement("div",{className:"poll-option-line",style:v}))))},zs=(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:l,openPollResults:d}=(0,s.Sv)(),{id:u,chatId:m}=t,{summary:h,results:g}=n,[p,f]=(0,o.eJ)(!1),[v,I]=(0,o.eJ)([]),[w,y]=(0,o.eJ)(!1),[Z,P]=(0,o.eJ)(!1),[b,C]=(0,o.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+c,h.closePeriod):0),S=(0,o.sO)(null),{results:M,totalVoters:E}=g,R=M&&M.some((e=>e.isChosen)),k=!h.closed&&!R,N=!k&&h.isPublic&&Number(g.totalVoters)>0,A=k&&h.multipleChoice,T=M?Math.max(...M.map((e=>e.votersCount))):E,B=M?M.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],x=h.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(h.quiz&&h.closePeriod&&b<=0)})));(0,o.d4)((()=>{p&&n.results.results&&n.results.results.some((e=>e.isChosen))&&f(!1)}),[p,n.results.results]),(0,o.d4)((()=>{b>0&&setTimeout((()=>C(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=(h.closePeriod-b)/h.closePeriod*t;s.textContent=(0,j.k9)(b),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,j.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,h.closePeriod]),(0,o.d4)((()=>{h.quiz&&(b<=0||R&&!h.closed)&&l({chatId:m,messageId:u})}),[m,b,R,l,u,h.closed,h.quiz]),(0,o.d4)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{l({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[k,m,l,u,h.closePeriod,h.closed,h.quiz]);const L=(0,o.Ye)((()=>a?a.reduce(((e,t)=>{const n=i[t];return n&&e.push(n),e}),[]):[]),[i,a]),O=(0,o.I4)((e=>{I([e]),f(!0),P(!0),r([e])}),[r]),U=(0,o.I4)((e=>{I(e)}),[]),F=(0,o.I4)((()=>{f(!0),P(!0),r(v)}),[r,v]),$=(0,o.I4)((()=>{d({chatId:m,messageId:u})}),[m,u,d]),q=(0,o.I4)((()=>{y(!0)}),[]),D=(0,o.I4)((()=>{y(!1),P(!1)}),[]);(0,o.d4)((()=>{Z&&R&&h.quiz&&g.results&&n.results.solution&&(g.results.find((e=>e.isChosen&&e.isCorrect))||y(!0))}),[R,Z,g.results,h.quiz,n.results.solution]);const _=(0,ot.Z)();return o.ZP.createElement("div",{className:"Poll",dir:_.isRtl?"auto":"ltr"},w&&n.results.solution&&o.ZP.createElement(_s.Z,{message:(0,qs.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:D,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Pn.Z)(h.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},_(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),L.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>o.ZP.createElement(Sn.Z,{size:"micro",user:e})))),b>0&&k&&o.ZP.createElement("div",{ref:S,className:"poll-countdown"}),h.quiz&&n.results.solution&&!k&&o.ZP.createElement(gt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:w,onClick:q,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),k&&o.ZP.createElement("div",{className:"poll-answers"},A?o.ZP.createElement(Ds.Z,{options:x,onChange:U,disabled:t.isScheduled||p,loadingOptions:p?v:void 0,round:!0}):o.ZP.createElement(js.Z,{name:`poll-${u}`,options:x,onChange:O,disabled:t.isScheduled||p,loadingOption:p?v[0]:void 0})),!k&&o.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return o.ZP.createElement(Hs,{key:e.option,shouldAnimate:Z,answer:e,voteResults:M,totalVoters:E,maxVotersCount:T,correctResults:B})}))),!N&&!A&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(_,h.quiz,g.totalVoters)),A&&o.ZP.createElement(gt.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:F},_("PollSubmitVotes")),N&&o.ZP.createElement(gt.Z,{isText:!0,size:"tiny",onClick:$},_("PollViewResults")))})));var Vs=n(48035),Ws=n(10088);const Xs=(0,o.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,inPreview:r,lastSyncTime:c,isDownloading:l=!1,isProtected:u,theme:m,onMediaClick:h,onCancelMediaTransfer:g}=e;const p=(0,d.s1)(t);let f=!1;if(null!=p&&p.photo&&!p.video){const{width:e,height:n}=zn(t);f=e===n}const v=(0,o.I4)((()=>{h()}),[h]);if(!p)return;const{siteName:I,url:w,displayUrl:y,title:Z,description:P,photo:b,video:C}=p,S=(b||C)&&h&&!f,M=(0,Vs.Z)(P,170),E=(0,Le.Z)("WebPage",r&&"in-preview",f&&"with-square-photo",!b&&!C&&!r&&"without-media",C&&"with-video");return o.ZP.createElement("div",{className:E,"data-initial":(I||y)[0],dir:"auto"},b&&!C&&o.ZP.createElement(Ts,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,size:f?"pictogram":"inline",nonInteractive:!S,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0,theme:m}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(Ws.Z,{className:"site-name",url:w,text:I||y}),!r&&Z&&o.ZP.createElement("p",{className:"site-title"},(0,Pn.Z)(Z)),M&&o.ZP.createElement("p",{className:"site-description"},(0,Pn.Z)(M,["emoji","br"]))),!r&&C&&o.ZP.createElement(Us,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:a,canAutoPlay:i,lastSyncTime:c,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0}))}));var Ks=n(9937);const Ys=(0,o.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:s,isSelected:i,theme:r}=e;const c=(0,o.sO)(null),l=(0,ot.Z)(),u=(0,d.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photoUrl:v,photoWidth:I,photoHeight:w}=u;(0,o.bt)((()=>{if(!n)return;const e=c.current.closest(".message-content");v&&Ns(v,!1,0,i,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(a.s2,"")}))}),[n,v,s,i,r]);const y=w&&I?`aspect-ratio: ${I/w};`:void 0;return o.ZP.createElement("div",{ref:c,className:"Invoice"},m&&o.ZP.createElement("p",{className:"title"},(0,Pn.Z)(m)),h&&o.ZP.createElement("div",null,(0,Pn.Z)(h,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(v?"has-image":"")},v&&o.ZP.createElement("img",{className:"invoice-image",src:v,alt:"",style:y,crossOrigin:"anonymous"}),o.ZP.createElement("p",{className:"description-text"},(0,Ks.x)(g,p,l.code),f&&o.ZP.createElement("span",null,l("PaymentTestInvoice")))))}));var Js=n(28183);const Qs=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"})),ea=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],ta=e=>{let{variant:t="rectangular",animation:n="wave",width:s,height:a,className:i}=e;const r=(0,Le.Z)("Skeleton",t,n,i),c=(s?`width: ${s}px;`:"")+(a?`height: ${a}px;`:"");return o.ZP.createElement("div",{className:r,style:c})},na=n.p+"map-pin.7b3c3e60ee24795e4bd2..svg",sa=1e-4,aa={width:400,height:300,zoom:16,scale:2},oa={__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>'},ia=(0,o.X$)((e=>{let{message:t,peer:n,lastSyncTime:s,isInSelectMode:i,isSelected:r,theme:c,serverTimeOffset:l}=e;const u=(0,o.sO)(null),m=(0,o.sO)(null),h=(0,ot.Z)(),g=(0,ze.Z)(),f=(0,d.nf)(t),{type:v,geo:I}=f,w=(0,p.b)(l),y=(0,d.$R)(t,w),Z="geoLive"!==v||y?void 0:t.date+f.period-w,[P,b]=(0,o.eJ)(I),C="venue"===v||"geoLive"===v&&!y,{width:S,height:M,zoom:E,scale:R}=aa,k=Boolean(s)&&(0,d.k6)(P,S,M,E,R),N=(0,sn.Z)(k),A=(0,Vt.Z)(N),T=N||A,B=n&&(0,d.YC)(n.id),x=n&&B?n:void 0,L=n&&!B?n:void 0,O=(0,d.B4)(t),U=(0,o.Ye)((()=>{if("geoLive"!==v||!P.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=P;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,E)}),[v,P,E]),F=(0,o.I4)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,s=e.lastElementChild,a=e.firstElementChild,o=t.date+f.period-(0,p.b)(l),i=(1-o/f.period)*n,r=(0,j.mB)(h,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>`}),[v,t.date,f,l,h]);return(0,o.bt)((()=>{m.current&&F(m.current)}),[F]),(0,o.bt)((()=>{if(C)return;const e=u.current.closest(".message-content");T&&Ns(T,O,0,r,c).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(a.s2,"")}))}),[O,i,r,c,T,C]),(0,o.d4)((()=>{Math.abs(I.lat-P.lat)<sa&&Math.abs(I.long-P.long)<sa?P.accuracyRadius!==I.accuracyRadius&&b({...P,accuracyRadius:I.accuracyRadius}):b(I)}),[I,P]),(0,Js.Z)((()=>{g()}),y?void 0:1e3*(Z||0)),(0,Fn.Z)((()=>{const e=m.current;e&&F(e)}),Z?1e3:void 0),o.ZP.createElement("div",{ref:u,className:"Location media-inner interactive",onClick:()=>{var e;const t=function(e,t,n){return`http://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(P.lat,P.long,E);null===(e=window.open(t,"_blank","noopener"))||void 0===e||e.focus()}},o.ZP.createElement("div",{className:"map-wrapper"},T?o.ZP.createElement("img",{className:"full-media map",src:T,alt:"Location on a map",width:aa.width,height:aa.height}):o.ZP.createElement(ta,{width:S,height:M}),function(){if(T)return o.ZP.createElement(o.ZP.Fragment,null,Boolean(U)&&!y&&o.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*U}px; height: ${2*U}px`}),function(){const e=(0,Le.Z)("pin",v,y&&"expired");if("geoLive"===v)return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:oa},o.ZP.createElement(Sn.Z,{chat:L,user:x,className:"location-avatar"}),void 0!==f.heading&&o.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===v){const t=function(e){return e?Qs.get(e)||Qs.get(e.split("/")[0])||ea[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%ea.length)]:"#008df2";var t}(f.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(f.venueType);return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:oa,style:`--pin-color: ${t}`},o.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return o.ZP.createElement("img",{className:e,src:na,alt:""})}())}()),function(){if(C)return"venue"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},f.title),o.ZP.createElement("div",{className:"location-info-subtitle"},f.address)):"geoLive"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},h("AttachLiveLocation")),o.ZP.createElement("div",{className:"location-info-subtitle"},(0,j.dJ)(h,w,t.editDate)),!y&&o.ZP.createElement("div",{className:"geo-countdown",ref:m})):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:l}=r,u=Boolean(a)&&(0,d.N)(r),m=Boolean(a)&&(0,d.Wc)(r),h=(0,sn.Z)(u,!n),g=(0,sn.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(ta,{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,autoPlay:!0,loop:!0,src:g})),o.ZP.createElement("div",{className:"title"},c),!(0,d.UD)(t)&&o.ZP.createElement("div",{className:"description"},l))}));function ca(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)(),l=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:null==e?void 0:e.shiftKey})}),[c,i]),d=(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,Le.Z)("album-item-select-wrapper",a&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?l:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},a&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,d))})))}const la=ca(Ts),da=ca(Us),ua=(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:l,albumLayout:u,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,s.Sv)(),v=t.messages.length,I=(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,d.qp)(e),y=h[(0,d.KK)(e)],Z=null==y?void 0:y.progress,{dimensions:P,sides:b}=u.layout[t],C=(0,c.bH)((0,s.Rd)(),e),S=(0,c.__)((0,s.Rd)(),e);if(f){const s=a&&(r?t===v-1:Boolean(8&b&&4&b));return o.ZP.createElement(la,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:C,shouldAffectAppendix:s,uploadProgress:Z,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})}if(w)return o.ZP.createElement(da,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:C,canAutoPlay:S,uploadProgress:Z,lastSyncTime:i,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})})))}));function ma(){return ma=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ma.apply(this,arguments)}let ha;const ga=e=>{let{message:t,observeIntersection:n,canAutoLoad:a,lastSyncTime:r,isDownloading:c}=e;const l=(0,o.sO)(null),u=(0,o.sO)(null),m=(0,o.sO)(null),h=t.content.video,g=(0,qn.Op)(l,n),[p,f]=(0,o.eJ)(a),v=Boolean(p&&g&&r),{mediaData:I,loadProgress:w}=(0,Ms.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:y}=(0,Ms.Z)((0,d.Ti)(t,"download"),!c,i.IU.BlobUrl,r),Z=Rs(t,I),{isBuffered:P,bufferingHandlers:b}=(0,Bs.Z)(),C=p&&!P||c,S=!1===(0,Vt.Z)(p),M=(0,ws.Z)(I),{shouldRender:E,transitionClassNames:k}=(0,We.Z)(C||!P,void 0,S),[N,A]=(0,o.eJ)(!1),[T,B]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!N)return;const e=tn.Rj/2,t=2*(e-6)*Math.PI,n=t-T*t,s=m.current,a=u.current,o=a.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${tn.Rj}px" height="${tn.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(s.currentTime/s.duration)}),[N,T]);const x=Boolean(I&&g),L=(0,o.I4)((()=>{m.current&&(A(!1),B(0),(0,ys.Z)(m.current),(0,R.T2)((()=>{u.current.innerHTML=""})))}),[]),O=(0,o.I4)((()=>{var e;null===(e=ha)||void 0===e||e(),ha=L}),[L]);(0,o.d4)((()=>{m.current&&(x?(0,ys.Z)(m.current):m.current.pause())}),[x]),Ls(m,x),(0,xs.Z)(m,[I]);const U=(0,o.I4)((()=>{if(!I)return void f((e=>!e));if(c)return void(0,s.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;N?e.paused?((0,ys.Z)(e),(0,mn.Es)()):e.pause():(O(),e.pause(),e.currentTime=0,(0,ys.Z)(e),(0,mn.Es)(),A(!0))}),[O,N,c,I,t]),F=(0,o.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]),$=(0,Le.Z)("full-media",M);return o.ZP.createElement("div",{ref:l,className:"RoundVideo media-inner",onClick:U},o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${tn.Rj}px; height: ${tn.Rj}px`})),I&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",ma({ref:m,className:$,width:tn.Rj,height:tn.Rj,autoPlay:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?L:void 0},b,{onTimeUpdate:N?F:void 0}),o.ZP.createElement("source",{src:I}))),o.ZP.createElement("div",{className:"progress",ref:u}),E&&o.ZP.createElement("div",{className:`media-loading ${k}`},o.ZP.createElement(As.Z,{progress:c?y:w})),!I&&!p&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},N?(0,j.k9)(m.current.currentTime):(0,j.k9)(h.duration),(!N||m.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},pa=e=>{let{message:t,onClick:n}=e;const s=(0,ot.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(gt.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,Pn.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))))))))},fa=(0,o.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:a}=(0,s.Sv)(),i=(0,ot.Z)(),{threadId:r,chatId:c,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,o.I4)((()=>{a({id:c,threadId:r})}),[a,c,r]),p=(0,o.Ye)((()=>{if(null==h||!h.length)return;const{users:{byId:e},chats:{byId:t}}=(0,s.Rd)();return h.map((n=>(0,d.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===l)return;const f=Boolean(m&&u&&m<u);return o.ZP.createElement("div",{"data-cnt":(0,Ke.bi)(l),className:(0,Le.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(Sn.Z,{key:e.id,size:"small",user:(0,d.YC)(e.id)?e:void 0,chat:(0,d.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},l?i("Comments",l,"i"):i("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),va=(0,o.X$)((e=>{let{reaction:t,message:n,activeReaction:a,availableReactions:i}=e;const{sendReaction:r}=(0,s.Sv)(),{recentReactions:c}=n.reactions,l=(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]),d=(0,o.I4)((()=>{r({reaction:t.isChosen?void 0:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,r]);return o.ZP.createElement(gt.Z,{className:(0,Le.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},o.ZP.createElement(vs,{activeReaction:a,reaction:t.reaction,availableReactions:i}),null!=l&&l.length?o.ZP.createElement("div",{className:"avatars"},l.map((e=>o.ZP.createElement(Sn.Z,{user:e,size:"micro"})))):(0,Ke.bi)(t.count))})),Ia=(0,o.X$)((e=>{let{message:t,isOutside:n,activeReaction:s,availableReactions:a,metaChildren:i}=e;return o.ZP.createElement("div",{className:(0,Le.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>o.ZP.createElement(va,{key:e.reaction,reaction:e,message:t,activeReaction:s,availableReactions:a}))),i)})),wa=(0,o.X$)((e=>{let{phoneCall:t,message:n,chatId:a}=e;const{requestCall:i}=(0,s.Sv)(),r=(0,ot.Z)(),{isOutgoing:c,isVideo:l,reason:d}=t,u="missed"===d,m="busy"===d&&!c,g=(0,o.I4)((()=>{i({isVideo:l,userId:a})}),[a,l,i]),p=(0,o.Ye)((()=>l?m?"CallMessageVideoIncomingDeclined":u?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?"CallMessageIncomingDeclined":u?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":c?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,c,l]),f=(0,o.Ye)((()=>t.duration?(0,j.J_)(r,t.duration):void 0),[r,t.duration]),v=(0,j.mr)(r,1e3*n.date);return o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__root"},o.ZP.createElement(gt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"src-components-middle-message-MessagePhoneCall-module__button",disabled:!h.Bi,ariaLabel:r(c?"CallAgain":"CallBack")},o.ZP.createElement("i",{className:l?"icon-video-outlined":"icon-phone"})),o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__info"},o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__reason"},r(p)),o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__meta"},o.ZP.createElement("i",{className:(0,Le.Z)("icon-arrow-right","src-components-middle-message-MessagePhoneCall-module__arrow",u&&"src-components-middle-message-MessagePhoneCall-module__missed",!c&&"src-components-middle-message-MessagePhoneCall-module__incoming")}),o.ZP.createElement("span",{className:"src-components-middle-message-MessagePhoneCall-module__duration"},f?r("CallMessageWithDuration",[v,f]):v))))})),ya={__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>'},Za={__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>'},Pa=(0,o.X$)((0,s.c$)(((e,t)=>{var n;const{focusedMessage:s,forwardMessages:a,lastSyncTime:o,serverTimeOffset:i}=e,{message:r,album:l,withSenderName:u,withAvatar:m,threadId:h,messageListType:g,isLastInDocumentGroup:p}=t,{id:f,chatId:v,viaBotId:I,replyToChatId:w,replyToMessageId:y,isOutgoing:Z,threadInfo:P,forwardInfo:b}=r,C=(0,c.Z1)(e,v),S=(0,c.FM)(e,v),M=(0,d.pK)(v),E=C&&(0,d.eA)(C),R=null==C?void 0:C.username,k=!S&&(0,d.Ul)(r),N=u||m||k,A=(0,c.Ur)(e,r),T=(0,c.cv)(e,r),B=I?(0,c.dy)(e,I):void 0,x=h?(0,c.qS)(e,v,h):void 0,L=r.id===x,O=y===x,U=y&&!O?(0,c.hj)(e,M&&w?w:v,y):void 0,F=U&&(0,c.Bz)(e,U,Boolean(b)),$=(0,c.uZ)(e,r),q="thread"===g&&(l?l.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,r)),{direction:D,noHighlight:j,isResizingContainer:_}=q&&s||{},G=a.messageIds&&a.messageIds.includes(f),{query:H}=(0,c.n5)(e)||{},z=(0,d._O)(r),V=z&&((0,c.zB)(e,z)||(0,c.CP)(e,z))?z:void 0;let W;W=null!=l&&l.messages?l.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,f);const{canReply:X}="thread"===g&&(0,c._k)(e,r,h)||{},K=(0,c.te)(e,r),Y=P?(0,c.tZ)(e,P.chatId,P.threadId)||P:void 0,J=Boolean(r.groupedId)&&!r.isInAlbum,Q=J?(0,c.xH)(e,v,r.groupedId)[0]:void 0,ee=J?p?(0,c.hj)(e,v,Q):void 0:r,te=null==C||null===(n=C.unreadReactions)||void 0===n?void 0:n.includes(r.id);return{theme:(0,c.Pu)(e),chatUsername:R,forceSenderName:k,sender:A,canShowSender:N,originSender:T,botSender:B,shouldHideReply:O,isThreadTop:L,replyMessage:U,replyMessageSender:F,isInDocumentGroup:J,isProtected:(0,c.EV)(e,r),isFocused:q,isForwarding:G,reactionMessage:ee,isChatWithSelf:S,isRepliesChat:M,isChannel:E,canReply:X,lastSyncTime:o,serverTimeOffset:i,highlight:H,animatedEmoji:V,isInSelectMode:(0,c.CA)(e),isSelected:W,isGroupSelected:Boolean(r.groupedId)&&!r.isInAlbum&&(0,c.a6)(e,v,r.groupedId),threadId:h,isDownloading:K,isPinnedList:"pinned"===g,canAutoLoadMedia:(0,c.bH)(e,r),canAutoPlayMedia:(0,c.__)(e,r),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.yB)(e),threadInfo:Y,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(r)?void 0:(0,c.q6)(e,v),activeReaction:ee&&e.activeReactions[ee.id],activeEmojiInteractions:e.activeEmojiInteractions,...Z&&{outgoingStatus:(0,c.dT)(e,r,"scheduled"===g)},..."number"==typeof $&&{uploadProgress:$},...q&&{focusDirection:D,noFocusHighlight:j,isResizingContainer:_},hasUnreadReaction:te}}))((e=>{let{message:t,chatUsername:n,observeIntersectionForBottom:a,observeIntersectionForMedia:r,observeIntersectionForAnimatedStickers:c,album:l,noAvatars:u,withAvatar:g,withSenderName:f,areReactionsInMeta:v,noComments:I,appearanceOrder:w,isFirstInGroup:y,isLastInGroup:Z,isFirstInDocumentGroup:P,isLastInDocumentGroup:b,isLastInList:C,theme:S,forceSenderName:M,sender:E,canShowSender:R,originSender:k,botSender:N,isThreadTop:A,shouldHideReply:T,replyMessage:B,replyMessageSender:x,outgoingStatus:L,uploadProgress:O,isInDocumentGroup:U,isProtected:F,isFocused:$,focusDirection:q,noFocusHighlight:D,isResizingContainer:j,isForwarding:_,isChatWithSelf:G,isRepliesChat:H,isChannel:z,canReply:V,lastSyncTime:W,serverTimeOffset:X,highlight:K,animatedEmoji:Y,isInSelectMode:J,isSelected:Q,isGroupSelected:ee,threadId:te,reactionMessage:ne,availableReactions:se,defaultReaction:ae,activeReaction:oe,activeEmojiInteractions:ie,messageListType:re,isPinnedList:ce,isDownloading:le,canAutoLoadMedia:de,canAutoPlayMedia:ue,shouldLoopStickers:me,autoLoadFileMaxSizeMb:he,threadInfo:ge,hasUnreadReaction:pe}=e;const{toggleMessageSelection:fe,clickBotInlineButton:ve,disableContextMenuHint:Ie,animateUnreadReaction:we}=(0,s.Sv)(),ye=(0,o.sO)(null),Ze=(0,o.sO)(null),Pe=(0,o.sO)(null),be=(0,ot.Z)();(0,qn._N)(Ze,a);const{isContextMenuOpen:Ce,contextMenuPosition:Se,handleBeforeContextMenu:Me,handleContextMenu:Ee,handleContextMenuClose:Re,handleContextMenuHide:ke}=(0,_n.Z)(ye,h.$b&&J,!0,h.wZ);(0,o.d4)((()=>{Ce&&Ie()}),[Ce,Ie]);const Ne=w<=0,[Ae,Te]=(0,nt.Z)(Ne);(0,o.d4)((()=>{Ne||setTimeout(Te,10*w)}),[w,Te,Ne]);const{transitionClassNames:Be}=(0,We.Z)(Ae,void 0,Ne,!1),{id:xe,chatId:Oe,forwardInfo:Ue,viaBotId:Fe}=t,$e=(0,d.CI)(t),qe=(0,d.B4)(t),De="scheduled"===re||t.isScheduled,je=(0,d.ss)(t)&&!T,_e=Boolean(ge)&&"thread"===re,Ge=(0,d.$D)(t),He=Y,ze=(null==ne?void 0:ne.reactions)&&!(0,d.JE)(ne.reactions),Ve=Ue&&(!G||De)&&!H&&!Ue.isLinkedChannelPost&&!Ge,Xe=Boolean(l)&&l.messages.length>1,Ke=U&&!P,Ye=U&&!b,Je=void 0!==Se,Qe=!(Je||J||_||Ye),et=z&&!De&&!F,tt=Boolean(ce||Ue&&(Ue.isChannelPost||G&&!qe||H)&&Ue.fromMessageId),st=(0,o.I4)(((e,t)=>{fe({messageId:xe,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...Xe&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})}),[fe,xe,Xe,l]),at=R?E:void 0,it=Ue&&(G||H||!at)?k:at,rt=Ue?k:at,{handleMouseDown:ct,handleClick:lt,handleContextMenu:dt,handleDoubleClick:ut,handleContentDoubleClick:mt,handleMouseMove:ht,handleSendQuickReaction:pt,handleMouseLeave:ft,isSwiped:vt,isQuickReactionVisible:It,handleDocumentGroupMouseEnter:wt}=as(st,ye,xe,0,Boolean(J),Boolean(V),Boolean(F),Ee,Me,Oe,Je,Pe,qe,Ye),{handleAvatarClick:yt,handleSenderClick:Zt,handleViaBotClick:Pt,handleReplyClick:bt,handleMediaClick:Ct,handleAudioPlay:St,handleAlbumMediaClick:Mt,handleMetaClick:Et,handleReadMedia:Rt,handleCancelUpload:kt,handleVoteSend:Nt,handleGroupForward:At,handleForward:Tt,handleFocus:Bt,handleFocusForwarded:xt,handleDocumentGroupSelectAll:Lt}=function(e,t,n,a,r,c,l,d,u,h,g,p,f){const{openChat:v,showNotification:I,focusMessage:w,openMediaViewer:y,openAudioPlayer:Z,markMessagesRead:P,cancelSendingMessage:b,sendPollVote:C,openForwardMenu:S,focusMessageInComments:M}=(0,s.Sv)(),{id:E,forwardInfo:R,replyToMessageId:k,replyToChatId:N,replyToTopMessageId:A,groupedId:T}=n,B=(0,o.I4)((()=>{g&&v({id:g.id})}),[g,v]),x=(0,o.I4)((()=>{p?l&&null!=R&&R.channelPostId?w({chatId:p.id,messageId:R.channelPostId}):v({id:p.id}):I({message:e("HidAccount")})}),[l,w,R,e,v,p,I]),L=(0,o.I4)((()=>{f&&v({id:f.id})}),[f,v]),O=(0,o.I4)((()=>{w({chatId:u&&N?N:a,threadId:r,messageId:k,replyMessageId:u&&N?void 0:E})}),[w,u,N,a,r,k,E]),U=(0,o.I4)((()=>{y({chatId:a,threadId:r,messageId:E,origin:d?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,E,y,d]),F=(0,o.I4)((()=>{Z({chatId:a,messageId:E})}),[a,E,Z]),$=(0,o.I4)((e=>{y({chatId:a,threadId:r,messageId:e,origin:d?m.bZ.ScheduledAlbum:m.bZ.Album})}),[a,r,y,d]),q=(0,o.I4)((()=>{P({messageIds:[E]})}),[E,P]),D=(0,o.I4)((()=>{b({chatId:a,messageId:E})}),[b,a,E]),j=(0,o.I4)((e=>{C({chatId:a,messageId:E,options:e})}),[a,E,C]),_=(0,o.I4)((()=>{S({fromChatId:a,groupedId:T})}),[S,a,T]),G=(0,o.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:a,messageIds:e})}else S({fromChatId:a,messageIds:[E]})}),[h,S,a,E]),H=(0,o.I4)((()=>{w({chatId:a,threadId:i._f,messageId:E})}),[w,a,E]),z=(0,o.I4)((()=>{c?w({chatId:R.fromChatId,groupedId:T,groupedChatId:a}):u&&N?M({chatId:N,threadId:A,messageId:R.fromMessageId}):w({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,N,w,R,T,a,M,A]),V=(0,o.I4)((e=>{e.stopPropagation(),t(e,T)}),[t,T]);return{handleAvatarClick:B,handleSenderClick:x,handleViaBotClick:L,handleReplyClick:O,handleMediaClick:U,handleAudioPlay:F,handleAlbumMediaClick:$,handleMetaClick:V,handleReadMedia:q,handleCancelUpload:D,handleVoteSend:j,handleGroupForward:_,handleForward:G,handleFocus:H,handleFocusForwarded:z,handleDocumentGroupSelectAll:V}}(be,st,t,Oe,te,U,Ve,De,H,l,it,rt,N),Ot=(0,Le.Z)("Message message-list-item",y&&"first-in-group",F&&"is-protected",Z&&"last-in-group",P&&"first-in-document-group",b&&"last-in-document-group",C&&"last-in-list",qe&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",je&&"has-reply",Je&&"has-menu-open",$&&!D&&"focused",_&&"is-forwarding",t.isDeleting&&"is-deleting",U&&"is-in-document-group",Xe&&"is-album",t.hasUnreadMention&&"has-unread-mention",Q&&"is-selected",J&&"is-in-selection-mode",A&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",vt&&"is-swiped",Be,Boolean(oe)&&"has-active-reaction"),{text:Ut,photo:Ft,video:$t,audio:qt,voice:Dt,document:jt,sticker:_t,contact:Gt,poll:Ht,webPage:zt,invoice:Vt,location:Wt,action:Kt,game:Yt}=(0,d.qp)(t),{phoneCall:Jt}=Kt||{},Qt=ge&&!Ye&&"thread"===re&&!I,en=!h.$b&&!Jt&&!J&&ae&&!Ye,sn=function(e){let{hasReply:t,customShape:n,isLastInGroup:s,asForwarded:a,hasThread:o,forceSenderName:i,hasComments:r,hasActionButton:c,hasReactions:l,isGeoLiveActive:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:m,photo:h,video:g,audio:p,voice:f,document:v,poll:I,webPage:w,contact:y,location:Z,invoice:P}=(0,d.qp)(e),b=["message-content"],C=h||g||Z,S=m||"venue"===(null==Z?void 0:Z.type)||u,M=C&&!S,E=Boolean(e.viaBotId);return Gn(n)?b.push(`emoji-only emoji-only-${n}`):S&&b.push("text"),c&&b.push("has-action-button"),n&&(b.push("custom-shape"),null!=g&&g.isRound&&b.push("round"),r&&b.push("has-comments")),C?b.push("media"):p?b.push("audio"):f?b.push("voice"):v?b.push("document"):y?b.push("contact"):I?b.push("poll"):w&&(b.push("web-page"),(w.photo||w.video)&&b.push("media")),P&&b.push("invoice"),a&&b.push("is-forwarded"),t&&b.push("is-reply"),o&&b.push("has-replies"),l&&b.push("has-reactions"),E&&b.push("is-via-bot"),i&&b.push("force-sender-name"),n||(b.push("has-shadow"),C&&r&&b.push("has-background"),(t||a||!M||E||i)&&b.push("has-solid-background"),s&&(h||Z&&!S||!M)&&b.push("has-appendix")),b.join(" ")}(t,{hasReply:je,customShape:Ge,isLastInGroup:Z,asForwarded:Ve,hasThread:_e,forceSenderName:M,hasComments:ge&&(null==ge?void 0:ge.messagesCount)>0,hasActionButton:et||tt,hasReactions:ze,isGeoLiveActive:"geoLive"===(null==Wt?void 0:Wt.type)&&!(0,d.$R)(t,(0,p.b)(X))}),an=sn.includes("has-appendix"),on=(0,nn.X)(t,K,Gn(Ge),void 0,void 0,F);let rn,cn;rn=Jt||Ye?"none":!on||He||zt?"standalone":"in-text",v?cn="in-meta":ze?Ge||(Ft||$t||He)&&!on?cn="outside":Ve?(rn="standalone",cn="inside"):cn="inside":cn="none",(0,Xt.Z)(H&&t.replyToChatId?t.replyToChatId:Oe,je?t.replyToMessageId:void 0,B,t.id),es(ye,Oe,$,q,D,j),(0,o.d4)((()=>{const e=Ze.current;pe&&e&&(0,rs.P)(e)&&we({messageIds:[xe]})}),[pe,xe,we]);let ln,dn="",un=!1;const mn=(0,o.Ye)((()=>Xe?Kn(qe,Boolean(Ve),Boolean(u),l):void 0),[Xe,qe,Ve,u,l]),hn=Ve?28:0;if(Xe||!Ft&&!$t)mn&&(ln=Math.max(Hn(Boolean(Ut),Qt),mn.containerStyle.width),ln-mn.containerStyle.width>18&&(un=!0));else{let e;Ft?e=zn(t,u).width:$t&&(e=$t.isRound?tn.Rj:zn(t,u).width),e&&(ln=Math.max(Hn(Boolean(Ut),Qt),e),ln-e>18&&(un=!0))}ln&&(dn=`width: ${ln+hn}px`);const gn=z&&t.adminTitle||!Ve&&(null==Ue?void 0:Ue.adminTitle)||void 0,pn=(0,o.Ye)((()=>gn?Qn(gn):void 0),[gn]);function fn(){const e=o.ZP.createElement(Is,{message:t,reactionMessage:ne,outgoingStatus:L,signature:gn,withReactions:"in-meta"===cn,withReactionOffset:"inside"===cn,availableReactions:se,activeReaction:oe,onClick:Et});return"inside"!==cn?e:o.ZP.createElement(Ia,{activeReaction:oe,message:ne,metaChildren:e,availableReactions:se})}return o.ZP.createElement("div",{ref:ye,id:(0,d.d0)(t.id),className:Ot,style:pn?`--meta-safe-author-width: ${pn}px`:void 0,"data-message-id":xe,onMouseDown:ct,onClick:lt,onContextMenu:dt,onDoubleClick:ut,onMouseEnter:Ye?wt:void 0,onMouseMove:en?ht:void 0,onMouseLeave:en||Ye?ft:void 0},o.ZP.createElement("div",{ref:Ze,className:"bottom-marker","data-message-id":xe,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":pe||void 0}),!U&&o.ZP.createElement("div",{className:"message-select-control"},Q&&o.ZP.createElement("i",{className:"icon-select"})),b&&o.ZP.createElement("div",{className:(0,Le.Z)("message-select-control group-select",ee&&"is-selected"),onClick:Lt},ee&&o.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=it&&(0,d.YC)(it.id),t=it&&e?it:void 0,n=it&&!e?it:void 0,s=!it&&Ue?Ue.hiddenUserName:void 0;return o.ZP.createElement(Sn.Z,{size:"small",user:t,chat:n,text:s,lastSyncTime:W,onClick:t||n?yt:void 0})}(),o.ZP.createElement("div",{className:(0,Le.Z)("message-content-wrapper",sn.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:Pe,className:sn,style:dn,dir:"auto"},Ve&&!Ke&&o.ZP.createElement("div",{className:"message-title"},be("ForwardedMessage")),function(){const e=(0,Le.Z)("content-inner",Ve&&"forwarded-message",je&&"reply-message",un&&"no-media-corners"),n=Z&&!on&&!Ve&&!_e,s=(0,Le.Z)("text-content","in-text"===rn&&"with-meta",L&&"with-outgoing-icon");return o.ZP.createElement("div",{className:e,onDoubleClick:mt,dir:"auto"},function(){if(Ge&&!Fe||!(f&&!(Ft||$t||Wt)||Ve||Fe||M)||Ke||je&&Ge)return;let e,n;return!rt||Ge&&Fe?null!=Ue&&Ue.hiddenUserName&&(e=Ue.hiddenUserName):(e=(0,d.OU)(be,rt),Ve||(n=`color-${(0,d.Rs)(rt)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?o.ZP.createElement("span",{className:(0,Le.Z)("interactive",n),onClick:Zt,dir:"auto"},(0,Pn.Z)(e)):N?void 0:" ",N&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},be("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:Pt},(0,Pn.Z)(`@${N.username}`))),null!=Ue&&Ue.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},be("DiscussChannel")):t.adminTitle&&!z?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.adminTitle):void 0)}(),je&&o.ZP.createElement(us,{message:B,isProtected:F,sender:x,observeIntersection:r,onClick:bt}),_t&&o.ZP.createElement(Zs,{message:t,observeIntersection:r,observeIntersectionForPlaying:c,shouldLoop:me,lastSyncTime:W}),Y&&o.ZP.createElement(Ss,{emoji:Y,withEffects:(0,d.YC)(Oe),isOwn:qe,observeIntersection:r,lastSyncTime:W,forceLoadPreview:$e,messageId:xe,chatId:Oe,activeEmojiInteractions:ie}),Xe&&o.ZP.createElement(ua,{album:l,albumLayout:mn,observeIntersection:r,isOwn:qe,isProtected:F,hasCustomAppendix:n,lastSyncTime:W,onMediaClick:Mt}),Jt&&o.ZP.createElement(wa,{message:t,phoneCall:Jt,chatId:Oe}),!Xe&&Ft&&o.ZP.createElement(Ts,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:de,uploadProgress:O,shouldAffectAppendix:n,onClick:Ct,onCancelUpload:kt,isDownloading:le,isProtected:F,theme:S}),!Xe&&$t&&$t.isRound&&o.ZP.createElement(ga,{message:t,observeIntersection:r,canAutoLoad:de,lastSyncTime:W,isDownloading:le}),!Xe&&$t&&!$t.isRound&&o.ZP.createElement(Us,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:de,canAutoPlay:ue,uploadProgress:O,lastSyncTime:W,onClick:Ct,onCancelUpload:kt,isDownloading:le,isProtected:F}),(qt||Dt)&&o.ZP.createElement(hs.Z,{theme:S,message:t,origin:m.Cr.Inline,uploadProgress:O,lastSyncTime:W,isSelectable:U,isSelected:Q,onPlay:St,onReadMedia:!Dt||qe&&!G?void 0:Rt,onCancelUpload:kt,isDownloading:le}),jt&&o.ZP.createElement(ms.Z,{message:t,observeIntersection:r,canAutoLoad:de,autoLoadFileMaxSizeMb:he,uploadProgress:O,isSelectable:U,isSelected:Q,onMediaClick:Ct,onCancelUpload:kt,isDownloading:le}),Gt&&o.ZP.createElement($s,{contact:Gt}),Ht&&o.ZP.createElement(zs,{message:t,poll:Ht,onSendVote:Nt}),Yt&&o.ZP.createElement(ra,{message:t,canAutoLoadMedia:de,lastSyncTime:W}),!He&&on&&o.ZP.createElement("p",{className:s,dir:"auto"},on,"in-text"===rn&&fn()),zt&&o.ZP.createElement(Xs,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:de,canAutoPlay:ue,lastSyncTime:W,onMediaClick:Ct,onCancelMediaTransfer:kt,isDownloading:le,isProtected:F,theme:S}),Vt&&o.ZP.createElement(Ys,{message:t,shouldAffectAppendix:n,isInSelectMode:J,isSelected:Q,theme:S}),Wt&&o.ZP.createElement(ia,{message:t,lastSyncTime:W,isInSelectMode:J,isSelected:Q,theme:S,peer:E,serverTimeOffset:X}))}(),!Ye&&"standalone"===rn&&fn(),Qe&&et?o.ZP.createElement(gt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:be("lng_context_forward_msg"),onClick:b?At:Tt},o.ZP.createElement("i",{className:"icon-share-filled"})):Qe&&tt?o.ZP.createElement(gt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ce?Bt:xt},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,Qt&&o.ZP.createElement(fa,{threadInfo:ge,disabled:I}),an&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:qe?ya:Za}),en&&o.ZP.createElement("div",{className:(0,Le.Z)("quick-reaction",It&&!oe&&"visible"),onClick:pt},o.ZP.createElement(ps.Z,{reaction:ae}))),t.inlineButtons&&o.ZP.createElement(pa,{message:t,onClick:ve}),"outside"===cn&&o.ZP.createElement(Ia,{message:ne,isOutside:!0,activeReaction:oe,availableReactions:se})),Se&&o.ZP.createElement(ls,{isOpen:Ce,anchor:Se,message:t,album:l,chatUsername:n,messageListType:re,onClose:Re,onCloseAnimationEnd:ke}))}))),ba=(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:l,openChatByInvite:u,startBot:m,focusMessage:h}=(0,s.Sv)(),g=(0,ot.Z)(),p=(0,o.sO)(null),f=Boolean(n),{observe:v}=(0,qn.S1)({rootRef:a,debounceMs:200,threshold:1});(0,o.d4)((()=>f?v(p.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,f,v,c]);const I=(0,o.I4)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?h({chatId:n.chatId,messageId:n.channelPostId}):(l({id:n.chatId}),n.startParam&&m({botId:n.chatId,param:n.startParam})))}),[h,n,l,u,m]);if(n)return o.ZP.createElement("div",{className:"SponsoredMessage Message open",key:"sponsored-message"},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,Pn.Z)((0,d.Js)(i)||""),r&&(0,Pn.Z)(n.chatInviteTitle||(0,d.U)(g,r,i)||"")),o.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:p},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,qs.H)(n.text.text,n.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},g("SponsoredMessage")))),o.ZP.createElement(gt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:I,className:"SponsoredMessage__button"},g(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),Ca=(0,o.X$)((e=>{let{chatId:t,messageIds:n,messageGroups:i,isViewportNewest:r,isUnread:c,withUsers:l,areReactionsInMeta:u,noAvatars:p,containerRef:f,anchorIdRef:v,memoUnreadDividerBeforeIdRef:I,memoFirstUnreadIdRef:w,threadId:y,type:Z,isReady:P,isScrollingRef:b,isScrollPatchNeededRef:C,threadTopMessageId:S,hasLinkedChat:M,isSchedule:E,noAppearanceAnimation:k,onFabToggle:N,onNotchToggle:A}=e;const{openHistoryCalendar:T}=(0,s.Sv)(),{observeIntersectionForMedia:B,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:L}=function(e,t,n){const{markMessageListRead:a,markMentionsRead:o,animateUnreadReaction:i}=(0,s.Sv)(),{observe:r}=(0,qn.S1)({rootRef:t,throttleMs:Dn,margin:jn}),{observe:c,freeze:l,unfreeze:d}=(0,qn.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,$e.Z)(l,d);const{observe:u}=(0,qn.S1)({rootRef:t,throttleMs:Dn});return{observeIntersectionForMedia:r,observeIntersectionForReading:c,observeIntersectionForAnimatedStickers:u}}(Z,f,w),{backwardsTriggerRef:O,forwardsTriggerRef:U,fabTriggerRef:F}=function(e,t,n,i,r,c,l,d,u,g){const{loadViewportMessages:p}=(0,s.Sv)(),[f,v]=(0,o.Ye)((()=>"thread"===e?[(0,R.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,R.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,n]),I=(0,o.sO)(null),w=(0,o.sO)(null),y=(0,o.sO)(null);function Z(){if(!d)return;if(!n||!n.length)return c(!1),void l(!1);if(!i)return c(!0),void l(!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)),l(!u)}const{observe:P}=(0,qn.S1)({rootRef:t,margin:h.gZ},(e=>{if(!v||!f)return;if(n[0]>a.MP)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:s}=t;"backwards-trigger"===s.className?(h.i4&&u.current&&n.length<=a.hT&&(g.current=!0),f()):"forwards-trigger"===s.className&&v()}));(0,qn._N)(I,P),(0,qn._N)(w,P);const{observe:b,freeze:C,unfreeze:S}=(0,qn.S1)({rootRef:t,margin:100},Z);(0,qn._N)(y,b);const{observe:M,freeze:E,unfreeze:k}=(0,qn.S1)({rootRef:t,margin:1},Z);return(0,qn._N)(y,M),(0,De.Z)((()=>{d&&Z()}),[d]),(0,De.Z)((()=>{C(),E(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:w,fabTriggerRef:y}}(Z,f,n,r,c,N,A,P,b,C),$=(0,ot.Z)(),q=o.ZP.createElement("div",{className:(0,Le.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,$("UnreadMessages"))),D=k?0:i.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let _=0;const G=i.map(((e,t,n)=>{const s=e.senderGroups.map(((e,s,a)=>{var i;if(1===e.length&&!Tn(e[0])&&(0,d.Lo)(e[0])&&(null===(i=e[0].content.action)||void 0===i||!i.phoneCall)){const i=e[0],r=s===a.length-1&&t===n.length-1;return(0,g.oA)([i.id===I.current&&q,o.ZP.createElement(ds,{key:i.id,message:i,observeIntersection:x,appearanceOrder:D-++_,isLastInList:r})])}let r;return e.map(((i,c)=>{const m=Tn(i)?i.mainMessage:i,h=Tn(i)?i:void 0,f=(0,d.B4)(m),w=Tn(i),P=e[c+1];m.previousLocalId&&v.current===(0,d.d0)(m.previousLocalId)&&(v.current=(0,d.d0)(m.id));const b=!w&&m.groupedId?m.groupedId:void 0,C=P&&!Tn(P)?P.groupedId:void 0,E={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==r),isLastInDocumentGroup:Boolean(b&&b!==C),isLastInList:c===e.length-1&&s===a.length-1&&t===n.length-1};r=b;const R=(0,d.KK)(m),k=(0,d.jM)(m)?`${m.date}_${R}`:R;return(0,g.oA)([m.id===I.current&&q,o.ZP.createElement(Pa,{key:k,message:m,observeIntersectionForBottom:x,observeIntersectionForMedia:B,observeIntersectionForAnimatedStickers:L,album:h,noAvatars:p,withAvatar:E.isLastInGroup&&l&&!f&&!(m.id===S),withSenderName:E.isFirstInGroup&&l&&!f,areReactionsInMeta:u,threadId:y,messageListType:Z,noComments:!1===M,appearanceOrder:D-++_,isFirstInGroup:E.isFirstInGroup,isLastInGroup:E.isLastInGroup,isFirstInDocumentGroup:E.isFirstInDocumentGroup,isLastInDocumentGroup:E.isLastInDocumentGroup,isLastInList:E.isLastInList}),m.id===S&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,$("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,Le.Z)("sticky-date",!E&&"interactive"),key:"date-header",onMouseDown:xn.q,onClick:E?void 0:()=>T({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},E&&e.originalDate===a.t4&&$("MessageScheduledUntilOnline"),E&&e.originalDate!==a.t4&&$("MessageScheduledOn",(0,j.j1)($,e.datetime,void 0,!0)),!E&&(0,j.j1)($,e.datetime))),s.flat())}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:O,key:"backwards-trigger",className:"backwards-trigger"}),G.flat(),r&&o.ZP.createElement(ba,{key:t,chatId:t,containerRef:f}),o.ZP.createElement("div",{ref:U,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:F,key:"fab-trigger",className:"fab-trigger"}))}));var Sa=n(73547);const Ma=(0,o.X$)((0,s.c$)(((e,t)=>{let{userId:n}=t;const{stickers:s}=e.stickers.greeting,a=(0,d.db)(n)+(0,d.db)(e.currentUserId),o=null!=s&&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)(),l=(0,ot.Z)(),d=(0,o.sO)(null),{observe:u}=(0,qn.S1)({rootRef:d,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:d},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},t&&o.ZP.createElement(Sa.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0}))))}))),Ea=(0,o.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:s}=e;const a=(0,ot.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")))})),Ra=(0,R.Ds)((e=>e()),200,!1),ka=(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),l="scheduled"===a?(0,c.Fn)(e,n):(0,c.Zw)(e,n),u=(0,c.qS)(e,n,s);if(s!==i._f&&!(l&&u&&l[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,v=(0,c.IK)(e,n);let I;var w;return(0,c.pk)(e,n)&&(I=v.fullInfo?(null===(w=v.fullInfo.botInfo)||void 0===w?void 0:w.description)||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,d.eA)(o),isGroupChat:(0,d.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,c.FM)(e,n),isRepliesChat:(0,d.pK)(n),isBot:Boolean(v),messageIds:r,messagesById:l,firstUnreadId:(0,c.It)(e,n,s),isViewportNewest:"thread"!==a||(0,c.b9)(e,n,s),threadFirstMessageId:(0,c.yZ)(e,n,s),focusingId:p,isSelectModeActive:(0,c.CA)(e),botDescription:I,threadTopMessageId:u,hasLinkedChat:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...f&&{lastMessage:g}}}))((e=>{var t,n,i,r,l,u;let{chatId:h,threadId:p,type:f,hasTools:v,onFabToggle:I,onNotchToggle:w,isChatLoaded:y,isChannelChat:Z,isGroupChat:P,canPost:b,isReady:C,isChatWithSelf:S,isRepliesChat:M,isCreator:E,isBot:k,messageIds:N,messagesById:A,firstUnreadId:T,isViewportNewest:B,threadFirstMessageId:x,isRestricted:L,restrictionReason:O,focusingId:U,isSelectModeActive:F,lastMessage:$,botDescription:q,threadTopMessageId:D,hasLinkedChat:j,lastSyncTime:_,withBottomShift:G}=e;const{loadViewportMessages:H,setScrollOffset:z,loadSponsoredMessages:V,loadMessageReactions:W,copyMessagesByIds:X}=(0,s.Sv)(),K=(0,o.sO)(null),Y=(0,o.sO)("thread"===f&&(0,c.Vt)((0,s.Rd)(),h,p)||0),J=(0,o.sO)(),Q=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(),se=(0,o.sO)(),ae=(0,o.sO)(!1),oe=(0,o.sO)(Boolean($)),[ie,re]=(0,o.eJ)(),ce=Boolean(N);(0,De.Z)((()=>{ce&&(0,R.R3)((()=>{oe.current=!1}))}),[ce]),(0,De.Z)((()=>{te.current=T}),[T]),(0,De.Z)((()=>{Z&&C&&_&&V({chatId:h})}),[h,C,Z,_]),(0,De.Z)((()=>{ce&&(ne.current=te.current)}),[ce]),(0,De.Z)((()=>{se.current=U}),[U]),(e=>{(0,st.y)({"Meta+C":function(t){const n=(0,$n.Z)();n&&n.length>0&&(t.preventDefault(),e({messageIds:n}))}})})(X);const le=(0,o.Ye)((()=>{if(!N||!A)return;const e=!D||N[0]&&x!==N[0]?N:[D,...N];if(!e.length)return;const t=e.map((e=>A[e])).filter(Boolean);return Bn((0,g.Xo)(t,["date","id"]),ne.current)}),[N,A,x,D]);(0,Fn.Z)((()=>{if(!N||!A)return;const e=N.filter((e=>{var t;return null===(t=A[e])||void 0===t?void 0:t.reactions}));e.length&&W({chatId:h,ids:e})}),15e3);const de=(0,o.Ye)((()=>{if("thread"===f)return(0,R.Ds)((()=>H({direction:m.Uq.Around})),1e3,!0,!1)}),[H,N]),{isScrolled:ue,updateStickyDates:me}=function(){const[e,t]=(0,nt.Z)(!1),n=(0,Ln.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,R.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,R.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:a}=e,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])}}(),he=(0,o.sO)(),ge=(0,o.sO)(),pe=(0,o.I4)((()=>{if(ae.current)return void(ae.current=!1);he.current=!0;const e=K.current;se.current||me(e,v),Ra((()=>{he.current=!1,(0,R.T2)((()=>{e.parentElement&&(Y.current=e.scrollHeight-e.scrollTop,"thread"===f&&z({chatId:h,threadId:p,scrollOffset:Y.current}))}))}))}),[me,v,f,z,h,p]);(0,o.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((e=>{let[t]=e;t.target.offsetParent&&re(t.contentRect.height)}));return e.observe(K.current),()=>{e.disconnect()}}),[]);const{height:fe}=(0,Ht.Z)();(0,o.d4)((()=>{K.current.dataset.normalHeight=String(K.current.offsetHeight)}),[fe,b]),(0,o.d4)((()=>{if(!de||!y||L||U)return;if(N&&N[N.length-1]>a.MP)return;const e=K.current;(!N||N.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&de()}),[y,N,de,U,L]),(0,De.Z)((()=>{if(!N||!ee.current)return;const e=ee.current.filter((e=>N.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(J.current=t.id,Q.current=t.getBoundingClientRect().top)}),[N,B,ie,v]),(0,Nn.Z)((e=>{let[t,n,s]=e;const o=K.current;ee.current=Array.from(o.querySelectorAll(".message-list-item"));const i=N&&t&&N[N.length-1]!==t[t.length-1],r=(null==N?void 0:N[0])!==(null==t?void 0:t[0])&&(null==N?void 0:N.length)===a.hT/2+1,c=i&&!r,l=N&&se.current===N[N.length-1],d=B&&c&&N&&N.length<a.hT/2&&!o.parentElement.classList.contains("force-messages-scroll")&&o.firstElementChild.clientHeight<=2*o.offsetHeight;d&&(o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&o.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=o,g=Y.current,p=ee.current[ee.current.length-1];let f=g-(s||h);c&&(f-=p?p.offsetHeight:0);const I=B&&n&&f<=20;let w;if(c&&I&&!l&&(p&&(0,R.T2)((()=>{(0,Un.Z)(o,p,"end",20)})),w=m-h,Y.current=Math.max(Math.ceil(m-w),h),!d))return;const y=void 0!==s&&s!==ie,Z=J.current&&o.querySelector(`#${J.current}`),P=!Z&&ne.current&&o.querySelector(".unread-divider");if(I&&y){if((0,Un.N)())return;w=m-h}else Z?(ge.current&&(ge.current=!1,(0,On.z)(o)),w=u+(Z.getBoundingClientRect().top-(Q.current||0))):w=P?Math.min(P.offsetTop-(v?60:10),m-g):m-g;(0,On.Z)(o,Math.ceil(w)),se.current||(ae.current=!0,(0,R.T2)((()=>{ae.current=!1}))),Y.current=Math.max(Math.ceil(m-w),h)}),[N,B,ie,v]),(0,An.Z)((e=>{let[t]=e;void 0!==t&&(0,xe.YW)(200+a.fK)}),[F]);const ve=(0,ot.Z)(),Ie=Boolean(h&&(0,d.YC)(h)),we=Boolean(!Ie&&!Z||S||M),ye=Boolean(!we||Z),Ze=(0,d.YC)(h)&&!S&&!k&&(!le&&!$&&N&&(!ee.current||0===ee.current.length)||1===(null==N?void 0:N.length)&&"contactSignUp"===(null==A||null===(t=A[N[0]])||void 0===t||null===(n=t.content.action)||void 0===n?void 0:n.type)||"contactSignUp"===(null==$||null===(i=$.content)||void 0===i||null===(r=i.action)||void 0===r?void 0:r.type)),Pe=P&&E&&1===(null==N?void 0:N.length)&&"chatCreate"===(null==A||null===(l=A[N[0]])||void 0===l||null===(u=l.content.action)||void 0===u?void 0:u.type),be=(0,Le.Z)("MessageList custom-scroll",ye&&"no-avatars",!b&&"no-composer","pinned"===f&&"type-pinned",G&&"with-bottom-shift",F&&"select-mode-active",ue&&"scrolled",!C&&"is-animating");return o.ZP.createElement("div",{ref:K,className:be,onScroll:pe,onMouseDown:xn.q},L?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,O?O.text:"This is a private "+(Z?"channel":"chat"))):q?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,Pn.Z)(ve(q),["br","emoji","links"]))):Ze?o.ZP.createElement(Ma,{userId:h}):!N||le&&!Pe?N&&le||$?o.ZP.createElement(Ca,{chatId:h,messageIds:N||[$.id],messageGroups:le||Bn([$]),isViewportNewest:Boolean(B),isUnread:Boolean(T),withUsers:we,areReactionsInMeta:Ie,noAvatars:ye,containerRef:K,anchorIdRef:J,memoUnreadDividerBeforeIdRef:ne,memoFirstUnreadIdRef:te,threadId:p,type:f,isReady:C,isScrollingRef:he,isScrollPatchNeededRef:ge,threadTopMessageId:D,hasLinkedChat:j,isSchedule:!!le&&"scheduled"===f,noAppearanceAnimation:!le||!oe.current,onFabToggle:I,onNotchToggle:w}):o.ZP.createElement(Rt.Z,{color:"white",backgroundColor:"dark"}):o.ZP.createElement(Ea,{chatId:h,type:f,isChatWithSelf:S,isGroupChatJustCreated:Pe}))}))),Na=(0,o.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:s,onClick:a,onReadAll:i,className:r}=e;const c=(0,ot.Z)(),l=(0,o.sO)(null),{isContextMenuOpen:d,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,_n.Z)(l,!i);return o.ZP.createElement("div",{className:(0,Le.Z)("src-components-middle-ScrollDownButton-module__root",r),ref:l},o.ZP.createElement(gt.Z,{color:"secondary",round:!0,className:"src-components-middle-ScrollDownButton-module__button",onClick:a,onContextMenu:u,ariaLabel:c(n)},o.ZP.createElement("i",{className:(0,Le.Z)("src-components-middle-ScrollDownButton-module__icon",`icon-${t}`)})),Boolean(s)&&o.ZP.createElement("div",{className:"src-components-middle-ScrollDownButton-module__unread-count"},(0,Ke.bi)(s)),i&&o.ZP.createElement(At.Z,{isOpen:d,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},o.ZP.createElement(ht.Z,{icon:"readchats",onClick:i},c("MarkAllAsRead"))))})),Aa=(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:l,withExtraShift:d}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:v}=(0,s.Sv)(),I=(0,o.sO)(null),w=Boolean(c),y=Boolean(l);(0,o.d4)((()=>{w&&i&&g({chatId:i})}),[i,g,w]),(0,o.d4)((()=>{y&&i&&v({chatId:i})}),[i,v,y]);const Z=(0,o.I4)((()=>{if(t)if("thread"===a)u();else{const e=I.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Un.Z)(e,n,"end",20)}}),[t,a,u]),P=(0,Le.Z)("src-components-middle-FloatingActionButtons-module__root",(t||Boolean(c)||Boolean(l))&&"src-components-middle-FloatingActionButtons-module__revealed",(Boolean(c)||Boolean(l))&&!t&&"src-components-middle-FloatingActionButtons-module__only-reactions",!n&&"src-components-middle-FloatingActionButtons-module__no-composer",!d&&"src-components-middle-FloatingActionButtons-module__no-extra-shift");return o.ZP.createElement("div",{ref:I,className:P},w&&o.ZP.createElement(Na,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),y&&o.ZP.createElement(Na,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:l}),o.ZP.createElement(Na,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"src-components-middle-FloatingActionButtons-module__unread"}))})));var Ta=n(65723);const Ba=1280,xa=/\.[^/.]+$/;async function La(e,t,s,o){const i=URL.createObjectURL(t),{type:r,size:c}=t;let l,d,u;if(a.oG.has(r))if(s){const t=await(0,Gt.pt)(i),{width:n,height:s}=t;if(n>Ba||s>Ba||"image/jpeg"!==r){const t=await pn(i,Ba/Math.max(n,s),"image/jpeg");return URL.revokeObjectURL(i),La(e,await(0,Gt.gm)(t),!0,o)}"image/jpeg"===r&&(e=e.replace(xa,".jpg")),l={width:n,height:s}}else u=i;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Gt.jj)(i);l={width:e,height:t,duration:n},u=await(0,Gt.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,l=s(r);return{title:o,performer:i,duration:c,coverUrl:l?`data:${l.format};base64,${l.data.toString("base64")}`:void 0}}(i);d={duration:e||0,title:t,performer:s},u=a}return{blobUrl:i,filename:e,mimeType:r,size:c,quick:l,audio:d,previewBlobUrl:u,...o}}function Oa(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const n=t.getRangeAt(0);n.deleteContents();const s=n.createContextualFragment(e),a=s.lastChild;n.insertNode(s),a?(n.setStartAfter(a),n.setEndAfter(a)):n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}var Ua=n(96391);let Fa;function $a(e){Fa.focus(),e.focus()}h.cj&&(Fa=document.createElement("input"),Fa.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Fa));var qa=n(64784),Da=n(52400),ja=n(56389),_a=n(70971);const Ga={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},Ha={type:"audio/ogg"};let za,Va,Wa;async function Xa(){return za||(za=n.e(1161).then(n.t.bind(n,1161,23)),Va=(await za).default,Wa=new Va(Ga)),za}async function Ka(e){await async function(){await Xa(),await Wa.start()}();const t=Date.now();let n;const s=[],a=[];Wa.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}}(Wa);return{stop:()=>new Promise(((e,i)=>{Wa.onstop=()=>{e({blob:new Blob(s,Ha),duration:Math.round(((n||Date.now())-t)/1e3),waveform:a})},Wa.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Wa.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Wa.pause(),n=Date.now(),o()}),e)}}}var Ya=n(21262);const Ja=["image/png","image/jpeg","image/gif"];let Qa,eo;var to=n(72162),no=n(29295);function so(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,ze.Z)(),s=(0,o.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,xe.ZP)(ao,s),{isFrozen:(0,xe.zG)(),updateWhenUnfrozen:t}}(),c=(0,Ln.Z)(t,!0);return(0,De.Z)((()=>{i?r():c((()=>{a(e())}))}),[...n,i]),s}function ao(){}const oo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,io=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,ro={username:"",query:"",canShowHelp:!1,usernameLowered:""},co=document.createElement("div");const lo=(0,R.P2)((e=>e()),500,!0),uo=/^[\w@]{1,32}\s?/i;var mo=n(33057);const ho=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function go(){return go=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},go.apply(this,arguments)}let po,fo=!0;const vo=(0,o.X$)((e=>{let{onActivate:t,...n}=e;const s=(0,o.sO)(!1),a=(0,o.I4)((()=>{if(s.current=!0,fo)return fo=!1,void t();po&&(clearTimeout(po),po=void 0),po=window.setTimeout((()=>{s.current&&t()}),200)}),[t]),i=(0,o.I4)((()=>{s.current=!1}),[]);return o.ZP.createElement(gt.Z,go({},n,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:i,onClick:t}))}));var Io=n(85655),wo=n(56503),yo=n(62898);const Zo="src-components-middle-composer-AttachmentMenuBotIcon-module__compact",Po=/#fff/gi,bo=(0,o.X$)((e=>{let{icon:t,theme:n}=e;const s=(0,sn.Z)((0,d.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(Po,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,Le.Z)("src-components-middle-composer-AttachmentMenuBotIcon-module__root",h.FW&&Zo)},o.ZP.createElement("img",{src:a,alt:"",className:(0,Le.Z)("src-components-middle-composer-AttachmentMenuBotIcon-module__image",h.FW&&Zo)}))})),Co=(0,o.X$)((e=>{let{bot:t,theme:n,chatId:a,onMenuOpened:i,onMenuClosed:r}=e;const{callAttachMenuBot:c,toggleBotInAttachMenu:l}=(0,s.Sv)(),d=(0,ot.Z)(),u=(0,o.Ye)((()=>{var e;return null===(e=t.icons.find((e=>{let{name:t}=e;return"default_static"===t})))||void 0===e?void 0:e.document}),[t.icons]),[m,h,g]=(0,nt.Z)(),[p,f]=(0,o.eJ)(void 0),v=(0,o.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();f({x:t.right,y:t.bottom}),i(),h()}),[i,h]),I=(0,o.I4)((()=>{g(),r()}),[g,r]),w=(0,o.I4)((()=>{f(void 0)}),[]),y=(0,o.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return o.ZP.createElement(ht.Z,{key:t.id,customIcon:u&&o.ZP.createElement(bo,{icon:u,theme:n}),icon:u?void 0:"bots",onClick:()=>c({botId:t.id,chatId:a}),onContextMenu:v},t.shortName,p&&o.ZP.createElement(yo.Z,null,o.ZP.createElement(At.Z,{isOpen:m,positionX:"right",style:`left: ${p.x}px;top: ${p.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:I,onCloseAnimationEnd:w},o.ZP.createElement(ht.Z,{icon:"stop",destructive:!0,onClick:y},d("WebApp.RemoveBot")))))})),So=(0,o.X$)((e=>{let{chatId:t,isButtonVisible:n,canAttachMedia:s,canAttachPolls:i,attachMenuBots:r,isScheduled:c,isPrivateChat:l,onFileSelect:d,onPollCreate:u,theme:m}=e;const[g,p,f]=(0,nt.Z)(),[v,I,w]=(0,wo.Z)(g,f),[y,Z,P]=(0,nt.Z)();(0,o.d4)((()=>{g&&w()}),[g,w]);const b=(0,o.I4)((()=>{g?f():p()}),[g,p,f]),C=(0,o.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&d(Array.from(n),t)}),[d]),S=(0,o.I4)((()=>{(0,Io.g)(Array.from(a.dI).join(","),(e=>C(e,!0)))}),[C]),M=(0,o.I4)((()=>{(0,Io.g)("*",(e=>C(e,!1)))}),[C]),E=(0,ot.Z)();if(n)return o.ZP.createElement("div",{className:"AttachMenu"},o.ZP.createElement(vo,{id:"attach-menu-button",className:g?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:b,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},o.ZP.createElement("i",{className:"icon-attach"})),o.ZP.createElement(At.Z,{id:"attach-menu-controls",isOpen:g||y,autoClose:!0,positionX:"right",positionY:"bottom",onClose:f,className:"AttachMenu--menu fluid",onCloseAnimationEnd:f,onMouseEnter:h.$b?void 0:v,onMouseLeave:h.$b?void 0:I,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!s&&o.ZP.createElement(ht.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(ht.Z,{icon:"photo",onClick:S},E("AttachmentMenu.PhotoOrVideo")),o.ZP.createElement(ht.Z,{icon:"document",onClick:M},E("AttachDocument"))),i&&o.ZP.createElement(ht.Z,{icon:"poll",onClick:u},E("Poll")),s&&!c&&l&&Object.values(r).map((e=>o.ZP.createElement(Co,{bot:e,chatId:t,theme:m,onMenuOpened:Z,onMenuClosed:P})))))})),Mo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Eo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Ro=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var ko=n(67146);const No=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Ao=n(19830);const To=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Bo=(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,wo.Z)(t,a),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,nt.Z)(!0),g=(0,o.I4)((()=>{m(),a()}),[a,m]);if((0,o.d4)((()=>{u()}),[u,null==n?void 0:n.keyboardButtons]),n&&n.keyboardButtons)return o.ZP.createElement(At.Z,{isOpen:t||d,autoClose:l,positionX:"right",positionY:"bottom",onClose:g,className:"BotKeyboardMenu",onCloseAnimationEnd:g,onMouseEnter:h.$b?void 0:r,onMouseLeave:h.$b?void 0:c,noCompact:!0},o.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(gt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>i({messageId:n.id,button:e})},e.text))))))))})));var xo=n(13616),Lo=n(17891);const Oo=(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}}=e,r=(0,c.Yy)(e,t,n),l="scheduled"===s?(0,c.wU)(e,t):(0,c._$)(e,t,n),u=e.settings.byKey.animationLevel>=1,m=o===t;let h,g;if(r?h=(0,c.hj)(e,t,r):l?h=(0,c.kK)(e,t,n,s):m&&1===i.length&&(h=(0,c.hj)(e,a,i[0])),r&&h){const{forwardInfo:n}=h,s=(0,c.FM)(e,t);n&&(n.isChannelPost||s)&&(g=(0,c.cv)(e,h)),g||null!=n&&n.hiddenUserName||(g=(0,c.Ur)(e,h))}else m&&(h&&(g=(0,c.cv)(e,h),g||(g=(0,c.Ur)(e,h))),g||(g=(0,d.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a)));return{replyingToId:r,editingId:l,message:h,sender:g,shouldAnimate:u,forwardedMessagesCount:m?i.length:void 0}}))((e=>{let{replyingToId:t,editingId:n,message:a,sender:i,shouldAnimate:r,forwardedMessagesCount:c,onClear:l}=e;const{setReplyingToId:d,setEditingId:u,focusMessage:m,exitForwardMode:h}=(0,s.Sv)(),g=Boolean((t||n)&&a||i&&c),p=(0,Lo.Z)([c],c?300:void 0),{shouldRender:f,transitionClassNames:v}=(0,We.Z)(p&&g,void 0,!r,void 0,!r),I=(0,o.I4)((()=>{t?d({messageId:void 0}):n?u({messageId:void 0}):c&&h(),null==l||l()}),[t,n,c,l,d,u,h]);(0,o.d4)((()=>g?(0,et.Z)(I):void 0),[g,I]);const w=(0,o.I4)((()=>{m({chatId:a.chatId,messageId:a.id})}),[m,a]),y=(0,Le.Z)("ComposerEmbeddedMessage",v),Z=c&&c>1?`${c} forwarded messages`:void 0;if(f)return o.ZP.createElement("div",{className:y},o.ZP.createElement("div",null,o.ZP.createElement(gt.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:I},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(us,{className:"inside-input",message:a,sender:i,customText:Z,title:n?"Edit Message":void 0,onClick:w})))}))),Uo=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),Fo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),$o=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),qo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),Do=new RegExp(a.FM,"i"),jo=(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:l,theme:d}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,s.Sv)(),g=so((()=>{const{text:e,entities:t}=(0,f.Z)(a),n=t&&t.find((e=>{let{type:t}=e;return t===i.Vv.TextUrl}));if(n)return n.url;const s=e.match(Do);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,De.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&a.length&&!l&&!r),{shouldRender:v,transitionClassNames:I}=(0,We.Z)(p),w=(0,Kt.Z)(c,!0),y=(0,o.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!v||!w)return;const{photo:Z,...P}=w,b={content:{webPage:P}};return o.ZP.createElement("div",{className:(0,Le.Z)("WebPagePreview",I)},o.ZP.createElement("div",null,o.ZP.createElement(gt.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:y},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Xs,{message:b,inPreview:!0,theme:d})))}))),_o=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Go=(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(gt.Z,{className:(0,Le.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:a,onClick:n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:(0,Le.Z)("bot-menu-icon","icon-webapp",t&&"open")}),o.ZP.createElement("span",{ref:i,className:"bot-menu-text"},s))}));var Ho;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(Ho||(Ho={}));const zo="wonderful-voice-message.ogg",Vo=(0,o.X$)((0,s.c$)(((e,t)=>{var n,s,o,r,l,u,m;let{chatId:h,threadId:g,messageListType:p}=t;const f=(0,c.Z1)(e,h),v=h!==a.FV?(0,c.IK)(e,h):void 0,I=Boolean(v),w=(0,c.FM)(e,h),y=Boolean((0,c.dy)(e,h)),Z=I&&(0,c.FT)(e,h),P=(0,c.qy)(e,h),{language:b,shouldSuggestStickers:C}=e.settings.byKey,S=e.emojiKeywords[a.pR],M=b!==a.pR?e.emojiKeywords[b]:void 0,E=Z?Z.id:void 0,R=E?(0,c.hj)(e,h,E):void 0,{currentUserId:k}=e,N=null!=f&&f.fullInfo?(null==f||null===(n=f.fullInfo)||void 0===n?void 0:n.sendAsId)||k:void 0,A=null!=f&&f.sendAsIds&&N&&f.sendAsIds.includes(N)?N:null!=f&&null!==(s=f.adminRights)&&void 0!==s&&s.anonymous?null==f?void 0:f.id:void 0,T=A?(0,c.dy)(e,A):void 0,B=!T&&A?(0,c.Z1)(e,A):void 0,x=(0,c.QV)(e,h),L=(0,c.Bt)(e),O=h===(null==L?void 0:L.chatId)&&g===(null==L?void 0:L.threadId)&&p===(null==L?void 0:L.type),U="scheduled"===p?(0,c.hI)(e,h):(0,c.s)(e,h,g);return{editingMessage:(0,c.kK)(e,h,g,p),connectionState:e.connectionState,draft:(0,c.Ms)(e,h,g),chat:f,isChatWithBot:I,isChatWithSelf:w,isPrivateChat:y,isForCurrentMessageList:O,canScheduleUntilOnline:(0,c.Eh)(e,h),isChannel:f?(0,d.eA)(f):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:g===i._f&&"thread"===p&&Boolean(null==P?void 0:P.length),shouldSchedule:"scheduled"===p,botKeyboardMessageId:E,botKeyboardPlaceholder:null==R?void 0:R.keyboardPlaceholder,isForwarding:h===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==f||null===(o=f.fullInfo)||void 0===o?void 0:o.members,topInlineBotIds:null===(r=e.topInlineBots)||void 0===r?void 0:r.userIds,currentUserId:k,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:C,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==S?void 0:S.keywords,emojiKeywords:null==M?void 0:M.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:(null==f?void 0:f.fullInfo)&&f.fullInfo.botCommands,botCommands:null!=v&&v.fullInfo?(null===(l=v.fullInfo.botInfo)||void 0===l?void 0:l.commands)||!1:void 0,botMenuButton:null==v||null===(u=v.fullInfo)||void 0===u||null===(m=u.botInfo)||void 0===m?void 0:m.menuButton,sendAsUser:T,sendAsChat:B,sendAsId:A,editingDraft:U,requestedText:x,attachMenuBots:e.attachMenu.bots,theme:(0,c.Pu)(e)}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:v,messageListType:I,draft:w,chat:y,isForCurrentMessageList:Z,connectionState:P,isChatWithBot:b,isChatWithSelf:C,isChannel:S,isRightColumnShown:M,isSelectModeActive:E,isForwarding:k,pollModal:N,botKeyboardMessageId:A,botKeyboardPlaceholder:T,withScheduledButton:B,stickersForEmoji:x,groupChatMembers:L,topInlineBotIds:O,currentUserId:U,lastSyncTime:F,contentToBeScheduled:$,shouldSuggestStickers:q,baseEmojiKeywords:D,emojiKeywords:_,recentEmojis:G,inlineBots:H,isInlineBotLoading:z,botCommands:V,chatBotCommands:W,sendAsUser:X,sendAsChat:K,sendAsId:Y,editingDraft:J,requestedText:Q,botMenuButton:ee,attachMenuBots:te,isPrivateChat:ne,theme:se}=e;const{sendMessage:ae,clearDraft:oe,showDialog:ie,setStickerSearchQuery:re,setGifSearchQuery:ce,forwardMessages:le,openPollModal:de,closePollModal:ue,loadScheduledHistory:me,openChat:he,addRecentEmoji:ge,sendInlineBotResult:fe,loadSendAs:ve,loadFullChat:Ie,resetOpenChatWithText:we,callAttachMenuBot:ye}=(0,s.Sv)(),Ze=(0,ot.Z)(),Pe=(0,o.sO)(null),[be,Ce]=(0,o.eJ)(""),Se=(0,_a.Y)(be),Me=(0,o.sO)(),Ee=(0,Vt.Z)(t),{width:Re}=pe.Z.get(),ke=null==y?void 0:y.sendAsIds,Ne=ke&&(ke.length>1||!ke.includes(U)),[Ae,Te,Be]=(0,nt.Z)(),xe=(0,ja.Z)(g,v),Oe=(0,o.I4)((()=>{Be()}),[Be]),[Ue,Fe]=(0,mo.Z)(r,Oe);(0,o.d4)((()=>{Me.current=void 0}),[g]),(0,o.d4)((()=>{g&&F&&v===i._f&&c&&me({chatId:g})}),[c,g,me,F,v]),(0,o.d4)((()=>{g&&y&&F&&!ke&&c&&(0,d.ZV)(y)&&ve({chatId:g})}),[y,g,c,F,ve,ke]),(0,o.d4)((()=>{g&&y&&F&&!y.fullInfo&&c&&(0,d.ZV)(y)&&Ie({chatId:g})}),[y,g,c,F,Ie]);const je=(0,o.sO)(!1);(0,De.Z)((e=>{let[t,n]=e;je.current=Boolean(g===t&&ke&&!n)}),[g,ke]),(0,o.bt)((()=>{Pe.current&&(Pe.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[_e,Ge]=(0,o.eJ)([]),[He,ze,Ve]=(0,nt.Z)(),[We,Xe,Ke]=(0,nt.Z)(),[Ye,Je,Qe]=(0,nt.Z)(),[tt,st,at]=(0,nt.Z)(),[it,rt,ct]=(0,nt.Z)(),[lt,dt]=(0,nt.Z)(),[ut,mt,ht]=(0,nt.Z)(),{startRecordingVoice:pt,stopRecordingVoice:ft,pauseRecordingVoice:vt,activeVoiceRecording:It,currentRecordTime:yt,recordButtonRef:Zt,startRecordTimeRef:Pt}=(()=>{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&&Xa()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:a}=await Ka((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]),l=(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,et.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:s}})();(0,Fn.Z)((()=>{xe({type:"recordAudio"})}),It&&a.o_),(0,o.d4)((()=>{It||xe({type:"cancel"})}),[It,xe]);const bt=m?Ho.Edit:!h.mh||It||be&&!_e.length||k?n?Ho.Schedule:Ho.Send:Ho.Record,Ct=!n,{isMentionTooltipOpen:St,closeMentionTooltip:Mt,insertMention:Et,mentionFilteredUsers:Rt}=(0,no.Z)(!_e.length,Se,Ce,void 0,L,O,U),{isOpen:kt,id:Nt,isGallery:At,switchPm:Tt,results:Bt,closeTooltip:xt,help:Lt,loadMore:Ot}=function(e,t,n,a){const{queryInlineBot:i,resetInlineBot:r}=(0,s.Sv)(),[c,l,d]=(0,nt.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=so((()=>function(e){const t=function(e){return co.innerHTML=e.replace(/<br>/g,"\n"),co.innerText}(e),n=t.match(oo);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(io),usernameLowered:n[1].toLowerCase()}:ro}(n)),300,[n])||{},p=(0,Vt.Z)(m),f=(0,Vt.Z)(u),v=g?null==a?void 0:a[g]:void 0,{id:I,switchPm:w,offset:y,results:Z,isGallery:P,help:b}=v||{};(0,o.d4)((()=>{p!==m&&d()}),[p,m,d]),(0,o.d4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m})}),[m,e,i,t,g]);const C=(0,o.I4)((()=>{i({chatId:t,username:g,query:m,offset:y})}),[y,t,m,i,g]);return(0,o.d4)((()=>{e&&I&&(w||null!=Z&&Z.length)?l():d()}),[I,e,l,Z,w,d]),f!==u&&r({username:f}),{isOpen:c,id:I,isGallery:P,switchPm:w,results:Z,closeTooltip:d,help:h&&b?`@${u} ${b}`:void 0,loadMore:C}}(Boolean(!_e.length&&F),g,be,H),{isOpen:Ut,close:Ft,filteredBotCommands:$t}=function(e,t,n,s){const[a,i,r]=(0,nt.Z)(),[c,l]=(0,o.eJ)(),d=(0,o.I4)((e=>{n||s?lo((()=>{const t=(n||s||[]).filter((t=>{let{command:n}=t;return!e||n.includes(e)}));l(t&&t.length?t:void 0)})):l(void 0)}),[n,s]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,Da._)(t.substr(1)).match(uo);d(e?e[0]:"")}else l(void 0);else l(void 0)}),[d,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(V&&V.length||W&&W.length),be,V,W),{isContextMenuOpen:qt,handleContextMenu:Dt,handleContextMenuClose:_t,handleContextMenuHide:Gt}=(0,_n.Z)(Zt,!(bt===Ho.Send&&Ct)),{canSendStickers:Ht,canSendGifs:zt,canAttachMedia:Wt,canAttachPolls:Xt,canAttachEmbedLinks:Kt}=(0,o.Ye)((()=>(0,d.H5)(y,b)),[y,b]),Yt=y&&(0,d.Nl)(y),Jt=(0,d.Hd)(y),{isStickerTooltipOpen:Qt,closeStickerTooltip:en}=function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=(0,o.Ye)((()=>(0,Da._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,s.Sv)(),l=h.op&&1===(0,qa.Z)(i)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),d=Boolean(n)&&l;return(0,o.d4)((()=>{var t;a||(e&&l?r({emoji:h.op?i:null===(t=i.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!d&&l||c())}),[t,l,c,r,e,a]),{isStickerTooltipOpen:d,closeStickerTooltip:c}}(Boolean(q&&Ht&&!_e.length),be,x,!c),{isEmojiTooltipOpen:tn,closeEmojiTooltip:nn,filteredEmojis:sn,insertEmoji:an}=(0,to.Z)(Boolean(q&&Ht&&!_e.length),Se,G,void 0,Ce,D,_,!c),on=(0,o.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.R2;const n=window.getSelection();let s;s=t===a.R2?document.querySelector(a.Ed):document.getElementById(t);const o=(0,Pn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,Ua.R)(e,t))return Oa(o),void s.dispatchEvent(new Event("input",{bubbles:!0}))}Ce(`${Se.current}${o}`),requestAnimationFrame((()=>{(0,Ta.Z)(s)}))}),[Se]),rn=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Ua.R)(t,a.R2))return void document.execCommand("delete",!1)}Ce(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}(Se.current))}),[Se]),cn=(0,o.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ce(""),Ge(l.D),en(),Mt(),nn(),h.wB?setTimeout((()=>Qe()),350):Qe()}),[en,Mt,nn,Qe]),ln=(0,o.sO)();ln.current=ft,(0,o.d4)((()=>()=>{ln.current(),cn()}),[g,cn,ln]);const[dn,un]=((e,t,n,i,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,s.Sv)();(0,An.Z)((e=>{let[s]=e;if(!n)return;if((null==s?void 0:s.id)===n.id)return;const o=(0,qs.z)(null!=h&&h.text.length?h:n.content.text);t(o),requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,Ta.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:l,type:u,text:n})}}),[c,n,e,p,l,u]);const v=(0,o.I4)((()=>{m&&(0,R.T2)((()=>{t((0,qs.z)(m));const e=document.querySelector(a.Ed);e&&requestAnimationFrame((()=>{(0,Ta.Z)(e,!0)}))}))}),[m,t]),I=(0,o.I4)((()=>{i(),v()}),[i,v]),w=(0,o.I4)((()=>{const{text:t,entities:s}=(0,f.Z)(e.current);n&&(t||(0,d.u8)(n)?(g({messageId:n.id,text:t,entities:s}),i(),v()):r())}),[g,n,e,r,i,v]),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:l,type:u,text:s})}),[c,n,e,p,l,u]);return(0,$e.Z)(y),qe(y),[w,I]})(Se,Ce,m,cn,rt,g,v,I,w,J);((e,t,n,i,r,c)=>{const{saveDraft:l,clearDraft:d}=(0,s.Sv)(),u=(0,o.I4)(((e,t)=>{const n=i.current;void 0===n||c||(n.length?l({chatId:e,threadId:t,draft:(0,f.Z)(n)}):d({chatId:e,threadId:t}))}),[d,c,i,l]),m=(0,o.Ye)((()=>(0,R.Ds)((e=>e()),a.r_,!1)),[t]),g=(0,Vt.Z)(t),p=(0,Vt.Z)(n);(0,o.d4)((()=>(Qa=t,eo=n,()=>{Qa=void 0,eo=void 0,u(t,n)})),[t,n,u]),(0,o.d4)((()=>{t===g&&n===p||!c&&e&&(r((0,qs.z)(e)),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(a.Ed);e&&(0,Ta.Z)(e,!0)})))}),[t,n,e,r,u,g,p,c]);const v=i.current,I=(0,Vt.Z)(v);(0,o.d4)((()=>{t&&n&&g===t&&p===n&&I!==v&&(v.length?m((()=>{Qa===t&&eo===n&&u(t,n)})):u(t,n))}),[t,v,g,I,p,m,n,u]);const w=(0,o.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,$e.Z)(w),qe(w)})(w,g,v,Se,Ce,m),((e,t,n,s)=>{(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 i=e.clipboardData.getData("text").substring(0,4096),{items:r}=e.clipboardData;let c=[];if(e.preventDefault(),r.length>0&&(c=await(0,Ya.Z)(r)),0!==c.length||i){if(c.length>0&&!s){const e=await Promise.all(c.map((e=>La(e.name,e,1===c.length&&Ja.includes(e.type)))));n((t=>t.concat(e)))}i&&t(i,null==o?void 0:o.id)}}}),[t,s,n,e])})(Z,on,Ge,m);const mn=(0,o.I4)((()=>{m&&un()}),[m,un]),hn=(0,o.I4)((async(e,t)=>{Ge(await Promise.all(e.map((e=>La(e.name,e,t)))))}),[]),gn=(0,o.I4)((async(e,t)=>{Ge([..._e,...await Promise.all(e.map((e=>La(e.name,e,t))))])}),[_e]),pn=(0,o.I4)((()=>{Ge(l.D)}),[]),fn=(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"!==P)return;let n=_e;if(It){const e=await ft();if(e){const{blob:t,duration:s,waveform:a}=e;n=[await La(zo,t,!1,{voice:{duration:s,waveform:a}})]}}const{text:o,entities:i}=(0,f.Z)(Se.current);if(!n.length&&!o&&!k)return;const{serverTimeOffset:r}=(0,s.Rd)(),c=n.length?1024:4096;if((null==o?void 0:o.length)>c){const e=o.length-c;return void ie({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const l=document.querySelector(a.Ed);if(n.length||o){if(Jt&&!Yt){const e=(0,p.b)(r),t=Me.current&&Math.floor(e-Me.current),n=Jt.nextSendDate&&Jt.nextSendDate>e;if(t&&t<Jt.seconds||n){const s=n?Jt.nextSendDate-e:Jt.seconds-t;return ie({data:{message:Ze("SlowModeHint",(0,j.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}ae({text:o,entities:i,attachments:n,scheduledAt:t,isSilent:e})}k&&le({scheduledAt:t,isSilent:e}),Me.current=(0,p.b)(r),oe({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&$a(l),requestAnimationFrame((()=>{cn()}))}),[P,_e,It,k,oe,g,cn,ft,ie,Jt,Yt,ae,le,Ze,Se]),vn=(0,o.I4)((()=>{"webApp"===(null==ee?void 0:ee.type)&&ye({botId:g,chatId:g,isFromBotMenu:!0,url:ee.url})}),[ee,ye,g]),In=(0,o.I4)((()=>{Qe(),Xe()}),[Qe,Xe]),wn=(0,o.I4)((()=>{Ke(),at(),Je()}),[Ke,at,Je]),yn=(0,o.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:s,isSilent:a}=e;return void fe({id:n,queryId:s,scheduledAt:t,isSilent:a})}const{isSilent:n,...s}=e||{};e&&0!==Object.keys(s).length?ae({...e,scheduledAt:t}):fn(Boolean(n),t)}),[fn,fe,ae]);(0,o.d4)((()=>{$&&Ue((e=>{yn($,e)}))}),[$,yn,Ue]),(0,o.d4)((()=>{Q&&(Ce(Q),we(),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Ta.Z)(e,!0)})))}),[Q,we]);const Zn=(0,o.I4)((function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||s?(Te(),Ue((n=>{Be(),yn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{cn(a)}))}))):(ae({sticker:e,isSilent:t}),requestAnimationFrame((()=>{cn(a)})))}),[n,Te,Ue,Be,yn,cn,ae]),bn=(0,o.I4)(((e,t,s)=>{n||s?(Te(),Ue((n=>{Be(),yn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{cn(!0)}))}))):(ae({gif:e,isSilent:t}),requestAnimationFrame((()=>{cn(!0)})))}),[n,Te,Ue,Be,yn,cn,ae]),Cn=(0,o.I4)(((e,t,s)=>{if("connectionStateReady"!==P)return;n||s?Ue((n=>{yn({id:e.id,queryId:e.queryId,isSilent:t},n)})):fe({id:e.id,queryId:e.queryId,isSilent:t});const o=document.querySelector(a.Ed);h.cj&&o&&o===document.activeElement&&$a(o),oe({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{cn()}))}),[g,oe,P,yn,Ue,cn,fe,n]),Mn=(0,o.I4)((()=>{oe({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{cn()}))}),[g,oe,cn]),En=(0,o.I4)((e=>{n?(Ue((t=>{yn({poll:e},t)})),ue()):(ae({poll:e}),ue())}),[ue,yn,Ue,ae,n]),Rn=(0,o.I4)((()=>{n?Ue((e=>{yn({isSilent:!0},e)})):fn(!0)}),[yn,fn,Ue,n]),kn=(0,o.I4)((e=>{"stickers"===e?(re({query:""}),ce({query:void 0})):(ce({query:""}),re({query:void 0}))}),[re,ce]),Nn=(0,o.I4)((()=>{const e=document.querySelector(a.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{Ke(),Je()}),100)):Je()}),[Je,Ke]),Tn=(0,o.I4)((()=>{const e=document.querySelector(a.Ed);if(!h.wB||e!==document.activeElement)return Ke(),Qe(),void st();null==e||e.blur(),setTimeout((()=>{Ke(),Qe(),st()}),100)}),[Ke,Qe,st]),Bn=(0,o.I4)((()=>{he({id:g,threadId:v,type:"scheduled"})}),[he,g,v]);(0,o.d4)((()=>{M&&h.wB&&Qe()}),[M,Qe]),(0,o.d4)((()=>{c&&(E?mt():setTimeout((()=>{ht()}),200))}),[E,ht,mt,c]);const xn=(0,o.I4)((()=>{switch(bt){case Ho.Send:fn();break;case Ho.Record:pt();break;case Ho.Edit:dn();break;case Ho.Schedule:It&&vt(),Ue((e=>{yn({},e)}))}}),[bt,fn,pt,dn,It,Ue,vt,yn]),Ln=bt===Ho.Record&&!Wt,On=(0,Vt.Z)(m,!0),Un=m||On,$n=new Date;$n.setSeconds(0),$n.setMilliseconds(0);const qn=new Date;qn.setFullYear(qn.getFullYear()+1);let Dn="SendMessage";switch(bt){case Ho.Edit:Dn="Save edited message";break;case Ho.Record:Dn=Ln?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const jn=(0,Le.Z)("Composer",!E&&"shown",ut&&"hover-disabled"),Gn=(0,Le.Z)("mobile-symbol-menu-button",!c&&"not-ready",lt?Ye&&"menu-opened":Ye&&"is-loading"),Hn=(0,o.I4)((()=>{Ue((e=>{yn({},e)}))}),[yn,Ue]),zn=bt===Ho.Edit?dn:bt===Ho.Schedule?Hn:fn,Vn=ee&&"commands"===(null==ee?void 0:ee.type);return o.ZP.createElement("div",{className:jn},Wt&&c&&o.ZP.createElement(qo,{isOpen:t!==jt.t.None,withQuick:t===jt.t.QuickFile||Ee===jt.t.QuickFile,onHide:u,onFileSelect:hn}),o.ZP.createElement(Uo,{chatId:g,threadId:v,canShowCustomSendMenu:Ct,attachments:_e,caption:_e.length?be:"",groupChatMembers:L,currentUserId:U,recentEmojis:G,isReady:c,isChatWithSelf:C,onCaptionUpdate:Ce,baseEmojiKeywords:D,emojiKeywords:_,addRecentEmoji:ge,shouldSchedule:n,onSendSilent:Rn,onSend:fn,onSendScheduled:Hn,onFileAppend:gn,onClear:pn}),o.ZP.createElement($o,{isOpen:N.isOpen,isQuiz:N.isQuiz,shouldBeAnonimous:S,onClear:ue,onSend:En}),Un&&o.ZP.createElement(ho,{isOpen:it,isSchedule:"scheduled"===I,onClose:ct,message:Un}),o.ZP.createElement(_o,{isOpen:tt,onClose:at,chatId:g,selectedSendAsId:Y,sendAsIds:ke}),o.ZP.createElement(Ro,{isOpen:St,onClose:Mt,onInsertUserName:Et,filteredUsers:Rt}),o.ZP.createElement(Eo,{isOpen:kt,botId:Nt,isGallery:At,inlineBotResults:Bt,switchPm:Tt,onSelectResult:Cn,loadMore:Ot,onClose:xt,isSavedMessages:C,canSendGifs:zt}),o.ZP.createElement(To,{isOpen:Ut,withUsername:Boolean(W),botCommands:$t,onClick:Mn,onClose:Ft}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:Pe}),o.ZP.createElement(Oo,{onClear:mn}),o.ZP.createElement(jo,{chatId:g,threadId:v,messageText:_e.length?"":be,disabled:!Kt}),o.ZP.createElement("div",{className:"message-input-wrapper"},b&&ee&&"webApp"===ee.type&&!m&&o.ZP.createElement(Go,{isOpen:!be&&!It,onClick:vn,text:ee.text,isDisabled:Boolean(It)}),b&&Vn&&!1!==V&&!It&&!m&&o.ZP.createElement(vo,{className:(0,Le.Z)("bot-commands",We&&"activated"),round:!0,disabled:void 0===V,color:"translucent",onActivate:In,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),Ne&&(X||K)&&o.ZP.createElement(gt.Z,{round:!0,color:"translucent",onClick:tt?at:Tn,ariaLabel:Ze("SendMessageAsTitle"),className:(0,Le.Z)("send-as-button",je.current&&"appear-animation")},o.ZP.createElement(Sn.Z,{user:X,chat:K,size:"tiny"})),h.wB?o.ZP.createElement(gt.Z,{className:Gn,round:!0,color:"translucent",onClick:Ye?Qe:Nn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),Ye&&!lt&&o.ZP.createElement(wt.Z,{color:"gray"})):o.ZP.createElement(vo,{className:Ye?"activated":"",round:!0,color:"translucent",onActivate:wn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(xo.Z,{id:"message-input-text",chatId:g,threadId:v,html:_e.length?"":be,placeholder:It&&Re<=600?"":T||Ze("Message"),forcedPlaceholder:Lt,canAutoFocus:c&&!_e.length,shouldSuppressFocus:h.wB&&Ye,shouldSuppressTextFormatter:tn||St||kt,onUpdate:Ce,onSend:zn,onSuppressedFocus:Qe}),z&&Boolean(Nt)&&o.ZP.createElement(wt.Z,{color:"gray"}),B&&o.ZP.createElement(gt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Bn,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),A&&!It&&!m&&o.ZP.createElement(vo,{className:He?"activated":"",round:!0,color:"translucent",onActivate:ze,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),It&&yt&&o.ZP.createElement("span",{className:"recording-state"},(0,j.rM)(yt-Pt.current)),o.ZP.createElement(So,{chatId:g,isButtonVisible:!It&&!m,canAttachMedia:Wt,canAttachPolls:Xt,onFileSelect:hn,onPollCreate:de,isScheduled:n,isPrivateChat:ne,attachMenuBots:te,theme:se}),A&&o.ZP.createElement(Bo,{messageId:A,isOpen:He,onClose:Ve}),V&&o.ZP.createElement(Fo,{isOpen:We,botCommands:V,onClose:Ke}),o.ZP.createElement(No,{chatId:g,threadId:v,isOpen:Qt,onStickerSelect:Zn}),o.ZP.createElement(Ao.Z,{isOpen:tn,emojis:sn,onClose:nn,onEmojiSelect:an,addRecentEmoji:ge}),o.ZP.createElement(Mo,{chatId:g,threadId:v,isOpen:Ye||Ae,canSendGifs:zt,canSendStickers:Ht,onLoad:dt,onClose:Qe,onEmojiSelect:on,onStickerSelect:Zn,onGifSelect:bn,onRemoveSymbol:rn,onSearchOpen:kn,addRecentEmoji:ge}))),It&&o.ZP.createElement(gt.Z,{round:!0,color:"danger",className:"cancel",onClick:ft,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(gt.Z,{ref:Zt,round:!0,color:"secondary",className:(0,Le.Z)(bt,!c&&"not-ready",It&&"recording"),disabled:Ln,ariaLabel:Ze(Dn),onClick:xn,onContextMenu:bt===Ho.Send&&Ct?Dt: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"})),Ct&&o.ZP.createElement(ko.Z,{isOpen:qt,onSendSilent:C?void 0:Rn,onSendSchedule:n?void 0:Hn,onClose:_t,onCloseAnimationEnd:Gt,isSavedMessages:C}),Fe)}))),Wo=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),Xo=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Ko=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),Yo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),Jo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),Qo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),ei=(0,o.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),ti=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),ni=h.wB?450+a.fK:void 0;function si(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const ai=(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,l=(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),isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,r.length-1),activeEmojiInteractions:g,lastSyncTime:p};if(!l||!m.active)return f;const{chatId:v,threadId:I,type:w}=l,y=(0,d.YC)(v),Z=(0,c.Z1)(e,v),P=(0,c.IK)(e,v),b=(0,c.KB)(e,v),{chatId:C,messageId:S}=e.audioPlayer,M=Z&&(0,d.Qm)(Z,I),E=(0,c.pk)(e,v),R="pinned"===w,k="scheduled"===w,N="thread"===w&&I===i._f,A=Boolean(Z&&(0,d.eA)(Z)),T=Boolean(Z&&N&&(A||(0,d.ZV)(Z))&&Z.isNotJoined),B=Boolean(P&&(0,c.s4)(e,P.id)),x=!B&&E;return{...f,chatId:v,threadId:I,messageListType:w,isPrivate:y,areChatSettingsLoaded:Boolean(null==Z?void 0:Z.settings),canPost:!R&&(!Z||M)&&!E,isPinnedMessageList:R,isScheduledMessageList:k,currentUserBannedRights:null==Z?void 0:Z.currentUserBannedRights,defaultBannedRights:null==Z?void 0:Z.defaultBannedRights,hasPinnedOrAudioPlayer:I!==i._f||Boolean(!R&&(null==b?void 0:b.length))||Boolean(C&&S),pinnedMessagesCount:b?b.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:A,canSubscribe:T,canStartBot:x,canRestartBot:B}}))((e=>{let{chatId:t,threadId:n,messageListType:i,isPrivate:r,isPinnedMessageList:c,canPost:l,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:p,customBackground:f,theme:v,backgroundColor:I,patternColor:w,isLeftColumnShown:y,isRightColumnShown:Z,isBackgroundBlurred:P,isMobileSearchActive:b,isSelectModeActive:C,isPaymentModalOpen:S,isReceiptModalOpen:M,isSeenByModalOpen:E,isReactorListModalOpen:R,animationLevel:k,shouldSkipHistoryAnimations:N,currentTransitionKey:A,isChannel:T,areChatSettingsLoaded:B,canSubscribe:x,canStartBot:L,canRestartBot:O,activeEmojiInteractions:U,lastSyncTime:F}=e;const{openChat:$,openPreviousChat:q,unpinAllMessages:D,loadUser:j,loadChatSettings:_,closeLocalTextSearch:G,exitMessageSelectMode:H,closePaymentModal:z,clearReceipt:V,joinChannel:W,sendBotCommand:X,restartBot:K}=(0,s.Sv)(),{width:Y}=(0,Ht.Z)(),J=(0,ot.Z)(),[Q,ee]=(0,o.eJ)(jt.t.None),[te,ne]=(0,o.eJ)(),[se,ae]=(0,o.eJ)(),[oe,ie]=(0,o.eJ)(!1),re=g&&(Y<a.l3||Z&&Y>a._m&&Y<a.QU||Y>=a.ks&&Y<a.jT),ce=(0,zt.Z)(t,ni),le=(0,zt.Z)(n,ni),de=(0,zt.Z)(i,ni),ue=(0,zt.Z)(x,ni),pe=(0,zt.Z)(L,ni),fe=(0,zt.Z)(O,ni),ve=(0,zt.Z)(l,ni)&&!fe&&!pe&&!ue,Ie=(0,zt.Z)(re,ni),we=(0,zt.Z)(te,ni),ye=(0,zt.Z)(T,ni),Ze=(0,Vt.Z)(A),Pe=void 0!==Ze&&Ze<A?Ze:void 0,{isReady:be,handleOpenEnd:Ce,handleSlideStop:Se}=function(e,t,n,s){const[a,i]=(0,o.eJ)(!h.wB),r=(0,ze.Z)(),c=void 0!==n&&n!==t;return c&&(e?i(!1):r()),(0,De.Z)((()=>{e||i(!0)}),[e]),{isReady:a&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&i(Boolean(s))}:void 0,handleSlideStop:e?function(){i(!0)}:void 0}}(!N&&k!==a.oB,A,Ze,t);(0,o.d4)((()=>t?(0,et.Z)((()=>{$({id:void 0})})):void 0),[t,$]),(0,De.Z)((()=>{ee(jt.t.None),ne(void 0),ae(void 0)}),[t]),(0,o.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{window.visualViewport.height!==document.documentElement.clientHeight?document.body.classList.add("keyboard-visible"):document.body.classList.remove("keyboard-visible")};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}}),[]),(0,o.d4)((()=>{r&&j({userId:t})}),[t,r,j]),(0,o.d4)((()=>{!B&&F&&_({chatId:t})}),[t,r,B,F,_]);const Me=(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(si);ee(n?jt.t.QuickFile:jt.t.Document)}),[]),Ee=(0,o.I4)((()=>{ee(jt.t.None)}),[]),Re=(0,o.I4)((()=>{ie(!0)}),[]),ke=(0,o.I4)((()=>{ie(!1)}),[]),Ne=(0,o.I4)((()=>{D({chatId:t}),ke(),q()}),[D,t,ke,q]),Ae=(0,o.I4)((()=>{$({id:t})}),[$,t]),Te=(0,o.I4)((()=>{W({chatId:t})}),[W,t]),Be=(0,o.I4)((()=>{X({command:"/start"})}),[X]),xe=(0,o.I4)((()=>{K({chatId:t})}),[t,K]),Oe=((e,t)=>{const[n,s]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?s(t):_t.fetch(a.fo,e,_t.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Gt.pt)(t).then((()=>{s(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(v,f),Ue=(0,Le.Z)(Ie&&"has-header-tools",h.aZ?"mask-image-disabled":"mask-image-enabled"),Fe=(0,Le.Z)("src-components-middle-MiddleColumn-module__background","src-components-middle-MiddleColumn-module__withTransition",f&&"src-components-middle-MiddleColumn-module__customBgImage",I&&"src-components-middle-MiddleColumn-module__customBgColor",f&&P&&"src-components-middle-MiddleColumn-module__blurred",Z&&"src-components-middle-MiddleColumn-module__withRightColumn"),$e=(0,Le.Z)("messaging-disabled",!C&&"shown"),qe=(0,d.q8)(J,u,m),{composerHiddenScale:je,toolbarHiddenScale:_e,composerTranslateX:Ge,toolbarTranslateX:He,unpinHiddenScale:We,toolbarForUnpinHiddenScale:Xe}=(0,o.Ye)((()=>function(e,t){const n=e<=a.l3?16:32,s=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,ge),he),n=Math.min(.25*e,he);return Math.min(e-t-n,me)}if(e>a.ks){const t=Math.min(Math.max(.4*e,ge),he);return Math.min(e-t,me)}return e>me?me:e}(e),o=e<=a.l3?54:64,i=t?s-n-o:s-n,r=e>a.l3?Math.min(s-n,512):s-n,c=r/i,l=i/r;return{composerHiddenScale:c,toolbarHiddenScale:l,composerTranslateX:t?o/2*l:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}(Y,ve)),[ve,Y]),Ke=(0,Le.Z)("middle-column-footer",!ve&&"no-composer",ve&&se&&!C&&"with-notch");(0,Ve.Z)({isActive:C,onBack:H}),(0,Ve.Z)({isActive:b,onBack:G});const Ye=Boolean(!c&&!ve&&!fe&&!pe&&!ue&&qe),Je=Boolean(fe||ue||pe||c),Qe=Boolean(Ye||C||c);return o.ZP.createElement("div",{id:"MiddleColumn",className:Ue,onTransitionEnd:Ce,style:`\n --composer-hidden-scale: ${je};\n --toolbar-hidden-scale: ${_e};\n --unpin-hidden-scale: ${We};\n --toolbar-unpin-hidden-scale: ${Xe};\n --composer-translate-x: ${Ge}px;\n --toolbar-translate-x: ${He}px;\n --pattern-color: ${w};\n --theme-background-color:\n ${I||("dark"===v?a.It:a.p3)};\n `,onClick:h.p7&&y?Ae:void 0},o.ZP.createElement("div",{className:Fe,style:Oe?`--custom-background: ${Oe}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),ce&&le&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:ve?Me:void 0},o.ZP.createElement(kn,{chatId:ce,threadId:le,messageListType:de,isReady:be}),o.ZP.createElement(at.Z,{name:N?"none":k===a.zy?"slide":"fade",activeKey:A,shouldCleanup:!0,cleanupExceptionKey:Pe,onStop:Se},o.ZP.createElement(ka,{key:`${ce}-${le}-${de}`,chatId:ce,threadId:le,type:de,canPost:ve,hasTools:Ie,onFabToggle:ne,onNotchToggle:ae,isReady:be,withBottomShift:Je}),o.ZP.createElement("div",{className:Ke},ve&&o.ZP.createElement(Vo,{chatId:ce,threadId:le,messageListType:de,dropAreaState:Q,onDropHide:Ee,isReady:be}),c&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(gt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Re},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,J("Chat.Pinned.UnpinAll",p,"i")))),Ye&&o.ZP.createElement("div",{className:$e},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,qe))),h.wB&&ue&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(gt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Te},J(ye?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&pe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(gt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Be},J("BotStart"))),h.wB&&fe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(gt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:xe},J("BotRestart"))),o.ZP.createElement(Xo,{messageListType:de,isActive:C,canPost:ve}),o.ZP.createElement(Yo,{isOpen:Boolean(S),onClose:z}),o.ZP.createElement(Jo,{isOpen:Boolean(M),onClose:V}),o.ZP.createElement(Qo,{isOpen:E}),o.ZP.createElement(ti,{isOpen:R}))),o.ZP.createElement(Aa,{isShown:we,canPost:ve,withExtraShift:Qe})),h.wB&&o.ZP.createElement(Wo,{isActive:Boolean(b)})),t&&o.ZP.createElement(Ko,{isOpen:oe,chatId:t,pinnedMessagesCount:p,onClose:ke,onUnpin:Ne}),o.ZP.createElement("div",{teactFastList:!0},null==U?void 0:U.map(((e,t)=>o.ZP.createElement(ei,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))))}))),oi=450+a.fK,ii=(0,R.Ds)((e=>e()),200,!1);var ri;!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"}(ri||(ri={}));const ci=(0,o.X$)((0,s.c$)(((e,t)=>{var n,s,a,o;let{chatId:i,isProfile:r,isManagement:l}=t;const{query:u}=(0,c.n5)(e)||{},{query:m}=(0,c.y5)(e)||{},{query:h}=(0,c.yN)(e)||{},g=i?(0,c.Z1)(e,i):void 0,p=g&&(0,d.eA)(g),f=r&&i&&(0,d.YC)(i)?(0,c.dy)(e,i):void 0,v=f&&(0,d.kw)(f),I=Boolean(!l&&r&&!v&&g&&!(0,c.FM)(e,g.id)&&((0,d.YC)(g.id)||((0,d.Nl)(g)||g.isCreator)&&!g.isNotJoined)),w=Boolean(i&&(null===(n=e.management.byChatId[i])||void 0===n?void 0:n.editingInvite)),y=null==g||null===(s=g.fullInfo)||void 0===s?void 0:s.canViewStatistics,Z=i?null===(a=e.management.byChatId[i])||void 0===a||null===(o=a.inviteInfo)||void 0===o?void 0:o.invite:void 0;return{canManage:I,canAddContact:v,canViewStatistics:y,isChannel:p,userId:null==f?void 0:f.id,messageSearchQuery:u,stickerSearchQuery:m,gifSearchQuery:h,isEditingInvite:w,currentInviteInfo:Z,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,isColumnOpen:a,isProfile:i,isSearch:r,isManagement:c,isStatistics:l,isMessageStatistics:d,isStickerSearch:u,isGifSearch:g,isPollResults:p,isAddingChatMembers:f,profileState:v,managementScreen:I,canAddContact:w,userId:y,canManage:Z,isChannel:P,onClose:b,onScreenSelect:C,messageSearchQuery:S,stickerSearchQuery:M,gifSearchQuery:E,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N,shouldSkipHistoryAnimations:A}=e;const{setLocalTextSearchQuery:T,setStickerSearchQuery:B,setGifSearchQuery:x,searchTextMessagesLocal:L,toggleManagement:O,openHistoryCalendar:U,openAddContactDialog:F,toggleStatistics:$,setEditingExportedInvite:q,deleteExportedChatInvite:D}=(0,s.Sv)(),_=(0,o.sO)(null),[G,H,z]=(0,nt.Z)(),V=(0,o.I4)((()=>{q({chatId:n,invite:N}),C(m.u1.EditInvite)}),[n,N,C,q]),W=(0,o.I4)((()=>{D({chatId:n,link:N.link}),C(m.u1.Invites),z()}),[n,z,N,D,C]),X=(0,o.I4)((e=>{T({query:e}),e.length&&ii(L)}),[L,T]),K=(0,o.I4)((e=>{B({query:e})}),[B]),Y=(0,o.I4)((e=>{x({query:e})}),[x]),J=(0,o.I4)((()=>{F({userId:y})}),[F,y]),[Q,ee]=(0,o.eJ)(!a);(0,o.d4)((()=>{setTimeout((()=>{ee(!a)}),oi)}),[a]);const te=(0,ot.Z)(),ne=i?v===m.vi.Profile?ri.Profile:v===m.vi.SharedMedia?ri.SharedMedia:v===m.vi.MemberList?ri.MemberList:-1:r?ri.Search:p?ri.PollResults:u?ri.StickerSearch:g?ri.GifSearch:f?ri.AddingMembers:c?I===m.u1.Initial?ri.ManageInitial:I===m.u1.ChatPrivacyType?ri.ManageChatPrivacyType:I===m.u1.Discussion?ri.ManageDiscussion:I===m.u1.ChannelSubscribers?ri.ManageChannelSubscribers:I===m.u1.GroupPermissions?ri.ManageGroupPermissions:I===m.u1.ChatAdministrators?ri.ManageChatAdministrators:I===m.u1.GroupRemovedUsers?ri.ManageGroupRemovedUsers:I===m.u1.ChannelRemovedUsers?ri.ManageChannelRemovedUsers:I===m.u1.GroupUserPermissionsCreate?ri.ManageGroupUserPermissionsCreate:I===m.u1.GroupUserPermissions?ri.ManageGroupUserPermissions:I===m.u1.GroupRecentActions?ri.ManageGroupRecentActions:I===m.u1.ChatAdminRights?ri.ManageGroupAdminRights:I===m.u1.ChatNewAdminRights?ri.ManageGroupNewAdminRights:I===m.u1.GroupMembers?ri.ManageGroupMembers:I===m.u1.Invites?ri.ManageInvites:I===m.u1.EditInvite?ri.ManageEditInvite:I===m.u1.GroupAddAdmins?ri.ManageGroupAddAdmins:I===m.u1.Reactions?ri.ManageReactions:I===m.u1.InviteInfo?ri.ManageInviteInfo:I===m.u1.JoinRequests?ri.ManageJoinRequests:void 0:l?ri.Statistics:d?ri.MessageStatistics:void 0,se=null!==(t=(0,Kt.Z)(ne,!0))&&void 0!==t?t:-1,ae=h.wB||ne===ri.SharedMedia||ne===ri.MemberList||ne===ri.AddingMembers||ne===ri.MessageStatistics||c,oe=(0,Le.Z)("animated-close-icon",ae&&"state-back",(Q||A)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(gt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:b,ariaLabel:te(ae?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:_,className:oe})),o.ZP.createElement(at.Z,{name:Q||A?"none":"slide-fade",activeKey:se},function(){if(-1!==se)switch(se){case ri.PollResults:return o.ZP.createElement("h3",null,te("PollResults"));case ri.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(pt.Z,{parentContainerClassName:"RightSearch",value:S,onChange:X}),o.ZP.createElement(gt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>U({selectedAt:(0,j._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case ri.AddingMembers:return o.ZP.createElement("h3",null,te(P?"ChannelAddSubscribers":"GroupAddMembers"));case ri.ManageInitial:return o.ZP.createElement("h3",null,te("Edit"));case ri.ManageChatPrivacyType:return o.ZP.createElement("h3",null,te(P?"ChannelTypeHeader":"GroupTypeHeader"));case ri.ManageDiscussion:return o.ZP.createElement("h3",null,te("Discussion"));case ri.ManageChatAdministrators:return o.ZP.createElement("h3",null,te("ChannelAdministrators"));case ri.ManageGroupRecentActions:return o.ZP.createElement("h3",null,te("Group.Info.AdminLog"));case ri.ManageGroupAdminRights:return o.ZP.createElement("h3",null,te("EditAdminRights"));case ri.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,te("SetAsAdmin"));case ri.ManageGroupPermissions:return o.ZP.createElement("h3",null,te("ChannelPermissions"));case ri.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,te("BlockedUsers"));case ri.ManageChannelRemovedUsers:return o.ZP.createElement("h3",null,te("ChannelBlockedUsers"));case ri.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,te("ChannelAddException"));case ri.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,te("UserRestrictions"));case ri.ManageInvites:return o.ZP.createElement("h3",null,te("lng_group_invite_title"));case ri.ManageEditInvite:return o.ZP.createElement("h3",null,te(R?"EditLink":"NewLink"));case ri.ManageInviteInfo:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,te("InviteLink")),o.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&o.ZP.createElement(gt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Edit"),onClick:V},o.ZP.createElement("i",{className:"icon-edit"})),N&&N.isRevoked&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(gt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:te("Delete"),onClick:H},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(cn.Z,{isOpen:G,onClose:z,title:te("DeleteLink"),text:te("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:te("Delete"),confirmHandler:W}))));case ri.ManageJoinRequests:return o.ZP.createElement("h3",null,te(P?"SubscribeRequests":"MemberRequests"));case ri.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,te("Channel.Management.AddModerator"));case ri.StickerSearch:return o.ZP.createElement(pt.Z,{value:M,placeholder:te("SearchStickersHint"),autoFocusSearch:!0,onChange:K});case ri.GifSearch:return o.ZP.createElement(pt.Z,{value:E,placeholder:te("SearchGifsTitle"),autoFocusSearch:!0,onChange:Y});case ri.Statistics:return o.ZP.createElement("h3",null,te(P?"ChannelStats.Title":"GroupStats.Title"));case ri.MessageStatistics:return o.ZP.createElement("h3",null,te("Stats.MessageTitle"));case ri.SharedMedia:return o.ZP.createElement("h3",null,te("SharedMedia"));case ri.ManageChannelSubscribers:return o.ZP.createElement("h3",null,te("ChannelSubscribers"));case ri.MemberList:case ri.ManageGroupMembers:return o.ZP.createElement("h3",null,te("GroupMembers"));case ri.ManageReactions:return o.ZP.createElement("h3",null,te("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(gt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("AddContact"),onClick:J},o.ZP.createElement("i",{className:"icon-add-user"})),Z&&o.ZP.createElement(gt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Edit"),onClick:O},o.ZP.createElement("i",{className:"icon-edit"})),k&&o.ZP.createElement(gt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Statistics"),onClick:$},o.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var li=n(91);var di=n(27407);function ui(e,t,n,s){const[o,i]=(0,di.Z)(n?t:void 0,s,void 0,a.Vk);return[o,i,!(!o||!s||o[0]===s[0])]}function mi(e,t,n,s,i,r){const c=(0,o.sO)();(0,De.Z)((()=>{t===e&&i&&r&&(c.current=(0,d.R5)(i,r,e))}),[i,r,t,e]);const[l,u]=(0,di.Z)(s?n:void 0,c.current,void 0,"media"===e?a.EN:a.pn);return[l,u,!(!l||!c.current||l[0]===c.current[0])]}const hi=(0,R.P2)((e=>e()),250,!1);let gi=!1;var pi=n(21273),fi=n(31876),vi=n(20787),Ii=n(70180),wi=n(13709),yi=n(45418),Zi=n(47262),Pi=n(41151),bi=n(22275);const Ci=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function Si(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Mi=(0,o.X$)((0,s.c$)(((e,t)=>{var n,s;let{chatId:a}=t;const o=(0,c.Z1)(e,a),i=(0,c.Zw)(e,a),{currentType:r,resultsByType:l}=(0,c.we)(e)||{},{foundIds:u}=l&&r&&l[r]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,p=o&&(0,d.Bf)(o),f=o&&(0,d.eA)(o),v=p||f&&(0,d.Nl)(o),I=null==o||null===(n=o.fullInfo)||void 0===n?void 0:n.members,w=v&&o&&(o.isForbidden||o.fullInfo&&!o.fullInfo.canViewMembers),y=v&&o&&((0,d.VE)(o,"inviteUsers")||!(0,d.Mg)(o,"inviteUsers")||o.isCreator),Z=v&&o&&((0,d.VE)(o,"banUsers")||o.isCreator),P=(0,c.xs)(e,a);let b,C,S;return(0,d.YC)(a)&&(C=a,S=(0,c.dy)(e,C),b=S&&!S.isSelf&&!(0,d.cS)(S)),{theme:(0,c.Pu)(e),isChannel:f,resolvedUserId:C,chatMessages:i,foundIds:u,mediaSearchType:r,hasCommonChatsTab:b,hasMembersTab:v,areMembersHidden:w,canAddMembers:y,canDeleteMembers:Z,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:null==o?void 0:o.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:P,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==o?void 0:o.isProtected,...v&&I&&{members:I},...b&&S&&{commonChatIds:null===(s=S.commonChats)||void 0===s?void 0:s.ids}}}))((e=>{let{chatId:t,profileState:n,onProfileStateChange:r,theme:c,isChannel:l,resolvedUserId:u,currentUserId:g,chatMessages:p,foundIds:f,mediaSearchType:v,hasCommonChatsTab:I,hasMembersTab:w,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,commonChatIds:b,members:C,usersById:S,userStatusesById:M,chatsById:E,isRightColumnShown:R,isRestricted:k,lastSyncTime:N,activeDownloadIds:A,serverTimeOffset:T,isChatProtected:B}=e;const{setLocalMediaSearchType:x,loadMoreMembers:L,loadCommonChats:O,openChat:U,searchMediaMessagesLocal:F,openMediaViewer:$,openAudioPlayer:q,focusMessage:D,loadProfilePhotos:j,setNewChatMembersDialogState:_}=(0,s.Sv)(),G=(0,o.sO)(null),H=(0,o.sO)(null),z=(0,ot.Z)(),[V,W]=(0,o.eJ)(0),[X,K]=(0,o.eJ)(),Y=(0,o.Ye)((()=>[...w?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...Ci,...I?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[I,w,l]),J=Y[V].type,[Q,ee,te,ne]=function(e,t,n,s,a,i,r,c,l,u,m,h,g,p,f){let v=arguments.length>15&&void 0!==arguments[15]?arguments[15]:0;const I="members"!==a&&i?i:a,w=(0,o.Ye)((()=>{if(r&&l&&u)return(0,d.Z0)(r.map((e=>{let{userId:t}=e;return t})),l,u,void 0,v)}),[r,v,l,u]),y=(0,o.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[Z,P,b]=ui(0,t,f,w),[C,S,M]=mi("media",I,s,f,h,g),[E,R,k]=mi("documents",I,s,f,h,g),[N,A,T]=mi("links",I,s,f,h,g),[B,x,L]=mi("audio",I,s,f,h,g),[O,U,F]=mi("voice",I,s,f,h,g),[$,q,D]=ui(0,n,f,y);let j,_,G=!1;switch(I){case"members":j=Z,_=P,G=b;break;case"commonChats":j=$,_=q,G=D;break;case"media":j=C,_=S,G=M;break;case"documents":j=E,_=R,G=k;break;case"links":j=N,_=A,G=T;break;case"audio":j=B,_=x,G=L;break;case"voice":j=O,_=U,G=F}return[I,j,_,G]}(R,L,O,F,J,v,C,b,S,M,E,p,f,t,N,T),se=Y.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:ae}=function(e,t,n,s){(0,An.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),gi=!0,(0,Un.Z)(n,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{gi=!1}),350))}}),[t,s]),(0,An.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||(gi=!0,(0,Un.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{gi=!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)((()=>{gi||a()}),[a,t]),{handleScroll:(0,o.I4)((()=>{gi||hi(a)}),[a])}}(G,J,n,r),{applyTransitionFix:oe,releaseTransitionFix:ie}=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}}(G),[re,ce]=(()=>{const[e,t]=(0,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),{observe:le}=(0,qn.S1)({rootRef:G,throttleMs:500}),de=(0,o.I4)((()=>{ie(),ce()}),[ie,ce]),ue=(0,o.I4)((()=>{_(m.WB.InProgress)}),[_]);(0,o.d4)((()=>{x({mediaType:J})}),[x,J]);const me=u||t;(0,o.d4)((()=>{N&&j({profileId:me})}),[j,me,N]);const he=(0,o.I4)((e=>{$({chatId:me,threadId:i._f,messageId:e,origin:m.bZ.SharedMedia})}),[me,$]),ge=(0,o.I4)((e=>{q({chatId:me,messageId:e})}),[me,q]),pe=(0,o.I4)((e=>{U({id:e})}),[U]),fe=(0,o.I4)((e=>{D({chatId:me,messageId:e})}),[me,D]),ve=(0,o.I4)((()=>{K(void 0)}),[]);let Ie;(0,o.d4)((()=>{if(H.current&&h.$b)return(0,Pt.sf)(H.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Pt.eM.Left?(W(Math.min(V+1,Y.length-1)),!0):t===Pt.eM.Right&&(W(Math.max(0,V-1)),!0)})}),[V,Y.length]);const we="members"===Q||!w&&"media"===Q;we?Ie=R?0:1e3:ee||(Ie=a.Y);const ye=(0,Lo.Z)([t,Q],Ie);return o.ZP.createElement(pi.Z,{ref:G,className:"Profile custom-scroll",itemSelector:Si(Q),items:ye?ee:void 0,cacheBuster:re,sensitiveArea:a.qU,preloadBackwards:ye?"members"===Q?a.Vk:a.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:te,onScroll:ae},!ne&&function(e,t){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(vi.Z,{userId:t||e}),o.ZP.createElement(Ii.Z,{chatOrUserId:t||e}))}(t,u),!k&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(at.Z,{ref:H,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:se,renderCount:Y.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:oe,onStop:de},function(){if(!ee||!ye||!p){const e=we&&!ye,t=Boolean("members"===Q&&y);return o.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&o.ZP.createElement(wt.Z,null),t&&o.ZP.createElement(Zi.Z,{text:"You have no access to group members list."}))}if(!ee.length){let e;switch(Q){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=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(Zi.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${Q}-list`,dir:z.isRtl&&"media"===Q?"rtl":void 0,teactFastList:!0},"media"===Q?ee.map((e=>p[e]&&o.ZP.createElement(wi.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>p[e]&&o.ZP.createElement(ms.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:A.includes(e),observeIntersection:le,onDateClick:fe}))):"links"===Q?ee.map((e=>p[e]&&o.ZP.createElement(yi.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onMessageClick:fe}))):"audio"===Q?ee.map((e=>p[e]&&o.ZP.createElement(hs.Z,{key:e,theme:c,message:p[e],origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,isDownloading:A.includes(e)}))):"voice"===Q?ee.map((e=>p[e]&&o.ZP.createElement(hs.Z,{key:e,theme:c,message:p[e],senderTitle:(0,li.F)(z,p[e],E,S),origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,isDownloading:A.includes(e)}))):"members"===Q?ee.map(((e,t)=>{return o.ZP.createElement(fi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>pe(e),contextActions:(n=e,n!==g&&P?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{K(n)}}]:void 0)},o.ZP.createElement(Yt.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>o.ZP.createElement(fi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},o.ZP.createElement(Jt.Z,{chatId:e})))):void 0)}()),o.ZP.createElement(bt.Z,{big:!0,activeTab:V,tabs:Y,onSwitchTab:W})),Z&&o.ZP.createElement(Pi.Z,{isShown:"members"===Q,onClick:ue,ariaLabel:z("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&o.ZP.createElement(bi.Z,{isOpen:Boolean(X),userId:X,onClose:ve}))}))),Ei=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)})),Ri=(0,o.X$)((e=>{const t=(0,Et.Z)(Mt.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)})),ki=e=>{const t=(0,Et.Z)(Mt.gl.Extra,"Statistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)},Ni=e=>{const t=(0,Et.Z)(Mt.gl.Extra,"MessageStatistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(Rt.Z,null)},Ai=(0,o.X$)((()=>{const e=(0,Et.Z)(Mt.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Rt.Z,null)})),Ti=(0,o.X$)((()=>{const e=(0,Et.Z)(Mt.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Rt.Z,null)})),Bi=(0,o.X$)((()=>{const e=(0,Et.Z)(Mt.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(Rt.Z,null)}));var xi=n(11820);const Li=(0,o.X$)((0,s.c$)(((e,t)=>{var n;let{chatId:s}=t;const a=(0,c.Z1)(e,s),{userIds:o}=e.contactList||{},{byId:i}=e.chats,{currentUserId:r,newChatMembersProgress:l}=e,u=a&&(0,d.eA)(a),{query:h,fetchingStatus:g,globalUserIds:p,localUserIds:f}=e.userSearch;return{isChannel:u,members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,currentUserId:r,chatsById:i,localContactIds:o,searchQuery:h,isSearching:g,isLoading:l===m.WB.Loading,globalUserIds:p,localUserIds:f}}))((e=>{let{isChannel:t,members:n,onNextStep:a,currentUserId:i,chatsById:r,localContactIds:c,isLoading:l,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,onClose:f,isActive:v}=e;const{setUserSearchQuery:I}=(0,s.Sv)(),w=(0,ot.Z)(),[y,Z]=(0,o.eJ)([]),P=(0,Vt.Z)(y)===y;(0,Ve.Z)({isActive:v,onBack:f});const b=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),C=(0,o.I4)((e=>{I({query:e})}),[I]),S=(0,o.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=c?(0,d.kK)(c,e,u):[];return(0,d.ih)((0,g.Tw)([...n,...h||[],...p||[]]).filter((n=>{const s=e[n];return!b.includes(n)&&n!==i&&(!s||!(0,d.cS)(s)||!t&&s.canBeInvitedToGroup)})),r)}),[c,r,u,h,p,i,b,t]),M=(0,o.I4)((()=>{y.length&&(I({query:""}),a(y))}),[y,I,a]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(xi.Z,{itemIds:S,selectedIds:y,filterValue:u,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:Z,onFilterChange:C,noScrollRestore:P}),o.ZP.createElement(Pi.Z,{isShown:Boolean(y.length),disabled:l,ariaLabel:w("lng_channel_add_users"),onClick:M},l?o.ZP.createElement(wt.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Oi=450+a.fK,Ui=Object.keys(m.qt).length/2,Fi=Object.keys(m.u1).length/2;function $i(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const qi=(0,o.X$)((0,s.c$)((e=>{var t;const{chatId:n,threadId:s}=(0,c.Bt)(e)||{},a=(0,c.g4)(e),o=n?null===(t=e.management.byChatId[n])||void 0===t?void 0:t.nextScreen:void 0;return{contentKey:(0,c.Wq)(e),chatId:n,threadId:s,isChatSelected:Boolean(n&&a),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,nextManagementScreen:o}}))((e=>{var t;let{contentKey:n,chatId:i,threadId:r,isChatSelected:c,shouldSkipHistoryAnimations:l,nextManagementScreen:d}=e;const{toggleChatInfo:u,toggleManagement:h,closeLocalTextSearch:g,setStickerSearchQuery:p,setGifSearchQuery:f,closePollResults:v,addChatMembers:I,setNewChatMembersDialogState:w,setEditingExportedInvite:y,toggleStatistics:Z,toggleMessageStatistics:P,setOpenedInviteInfo:b,requestNextManagementScreen:C}=(0,s.Sv)(),{width:S}=(0,Ht.Z)(),[M,E]=(0,o.eJ)(m.vi.Profile),[R,k]=(0,o.eJ)(m.u1.Initial),[N,A]=(0,o.eJ)(),[T,B]=(0,o.eJ)(),x=M!==m.vi.Profile,L=void 0!==n,O=n===m.qt.ChatInfo,U=n===m.qt.Search,F=n===m.qt.Management,$=n===m.qt.Statistics,q=n===m.qt.MessageStatistics,D=n===m.qt.StickerSearch,j=n===m.qt.GifSearch,_=n===m.qt.PollResults,G=n===m.qt.AddingMembers,H=S<=a._m,[z,V]=(0,o.eJ)(!L),W=null!==(t=(0,Kt.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){E(m.vi.Profile);break}u(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(R){case m.u1.Initial:h();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:k(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:k(m.u1.GroupPermissions),A(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),b({invite:void 0}),y({chatId:i,invite:void 0})}break;case m.qt.MessageStatistics:P();break;case m.qt.Statistics:Z();break;case m.qt.Search:$i(),g();break;case m.qt.StickerSearch:$i(),p({query:void 0});break;case m.qt.GifSearch:$i(),f({query:void 0});break;case m.qt.PollResults:v()}}),[n,x,u,v,w,R,h,g,p,f,y,i,b,Z,P]),K=(0,o.I4)(((e,t)=>{A(e),B(t)}),[]),Y=(0,o.I4)((e=>{I({chatId:i,memberIds:e})}),[I,i]);function J(e){if(-1!==W)switch(W){case m.qt.AddingMembers:return o.ZP.createElement(Li,{key:i,chatId:i,isActive:L&&e,onNextStep:Y,onClose:X});case m.qt.ChatInfo:return o.ZP.createElement(Mi,{key:i,chatId:i,profileState:M,onProfileStateChange:E});case m.qt.Search:return o.ZP.createElement(Ei,{chatId:i,threadId:r,onClose:X,isActive:L&&e});case m.qt.Management:return o.ZP.createElement(Ri,{key:i,chatId:i,currentScreen:R,isPromotedByCurrentUser:T,selectedChatMemberId:N,isActive:L&&e,onScreenSelect:k,onChatMemberSelect:K,onClose:X});case m.qt.Statistics:return o.ZP.createElement(ki,{chatId:i});case m.qt.MessageStatistics:return o.ZP.createElement(Ni,{chatId:i,isActive:L&&e});case m.qt.StickerSearch:return o.ZP.createElement(Ai,{onClose:X,isActive:L&&e});case m.qt.GifSearch:return o.ZP.createElement(Ti,{onClose:X,isActive:L&&e});case m.qt.PollResults:return o.ZP.createElement(Bi,{onClose:X,isActive:L&&e})}}return(0,o.d4)((()=>L?(0,et.Z)(X):void 0),[L,X]),(0,o.d4)((()=>{setTimeout((()=>{V(!L)}),Oi)}),[L]),(0,o.d4)((()=>{d&&(k(d),C(void 0))}),[d,C]),(0,o.d4)((()=>{L&&H&&X()}),[H]),(0,Nn.Z)((e=>{let[t]=e;t!==i&&(E(m.vi.Profile),k(m.u1.Initial))}),[i]),(0,Ve.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"},H&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:X}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(ci,{chatId:i,isColumnOpen:L,isProfile:O,isSearch:U,isManagement:F,isStatistics:$,isMessageStatistics:q,isStickerSearch:D,isGifSearch:j,isPollResults:_,isAddingChatMembers:G,profileState:M,managementScreen:R,onClose:X,onScreenSelect:k}),o.ZP.createElement(at.Z,{name:z||l?"none":"zoom-fade",renderCount:Ui+Fi,activeKey:F?Ui+R:W,shouldCleanup:!0,cleanupExceptionKey:W===m.qt.MessageStatistics?m.qt.Statistics:void 0},J)))}))),Di=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,Et.Z)(Mt.gl.Extra,"MediaViewer",!t);return n?o.ZP.createElement(n,null):void 0}));let ji=[],_i=!1;function Gi(e,t){ji.push({url:e,filename:t}),_i||(_i=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of ji)Hi(t),e++,10===e&&(await(0,R.wO)(1e3),e=0);ji=[]}(),_i=!1}),1e3))}function Hi(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 zi=new Set,Vi=new Set,Wi=(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}=(0,s.Sv)(),r=(0,Ln.Z)(1e3,!0),c=(0,o.I4)((e=>{Vi.add(e),r((()=>{Vi.size&&(a({messages:Array.from(Vi)}),Vi.clear())}))}),[a,r]);(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(zi.has(e))return;zi.add(e);const t=(0,d.Ti)(e,"download");if(!t)return void c(e);const n=de.UV(t);if(n)return Gi(n,(0,d.w6)(e)),void c(e);de.he(t,i.IU.BlobUrl,!0).then((t=>{t&&Gi(t,(0,d.w6)(e)),c(e)}))})):zi.clear()}),[n,t,a,c])})));var Xi=n(65116),Ki=n(13103);const Yi=(0,o.X$)((e=>{let{openedGame:t,gameTitle:n}=e;const{closeGame:s,showNotification:a,openForwardMenu:i}=(0,Xi.Sv)(),r=(0,ot.Z)(),{url:c,chatId:l,messageId:d}=t||{},u=Boolean(c),m=(0,ja.Z)(l);(0,Fn.Z)((()=>{m({type:"playingGame"})}),u?5e3:void 0);const h=(0,o.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:l,messageIds:[d],withMyScore:!0}),s()),"share_game"===t.eventType&&a({message:"Unsupported game action"})}catch(e){}}),[l,s,d,i,a]),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 pe.Z.disableRefresh(),()=>{pe.Z.enableRefresh()}}),[u]),o.ZP.createElement(Ki.Z,{className:"GameModal",isOpen:u,onClose:s,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"}))})),Ji=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,Et.Z)(Mt.gl.Extra,"Notifications",!t);return n?o.ZP.createElement(n,null):void 0})),Qi=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,Et.Z)(Mt.gl.Extra,"Dialogs",!t);return n?o.ZP.createElement(n,null):void 0})),er=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"ForwardPicker",!t);return n?o.ZP.createElement(n,e):void 0})),tr=(0,o.X$)((e=>{const{url:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),nr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),sr=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,Et.Z)(Mt.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),ar=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Et.Z)(Mt.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),or=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Et.Z)(Mt.gl.Calls,"PhoneCall",!t);return n?o.ZP.createElement(n,null):void 0}));var ir=n(15780);function rr(){return rr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},rr.apply(this,arguments)}const cr=(0,o.X$)((0,Xi.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,Xi.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},a=e=>{let{chatId:t,type:n,threadId:a}=e;(0,Ve.Z)({isActive:!0,hash:(0,ir.q)(t,n,a),onBack:s})};return o.ZP.createElement("div",null,null==t?void 0:t.map(((e,t)=>o.ZP.createElement(a,rr({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),lr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"NewContactModal",!t);return n?o.ZP.createElement(n,e):void 0})),dr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Et.Z)(Mt.gl.Calls,"RatePhoneCallModal",!t);return n?o.ZP.createElement(n,e):void 0})),ur=(0,o.X$)((e=>{const{webApp:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"WebAppModal",!t);return n?o.ZP.createElement(n,e):void 0})),mr=(0,o.X$)((e=>{const{bot:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"BotTrustModal",!t);return n?o.ZP.createElement(n,e):void 0})),hr=(0,o.X$)((e=>{const{bot:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"BotAttachModal",!t);return n?o.ZP.createElement(n,e):void 0})),gr=(0,o.X$)((e=>{const{urlAuth:t}=e,n=(0,Et.Z)(Mt.gl.Extra,"UrlAuthModal",!t);return n?o.ZP.createElement(n,e):void 0}));let pr,fr=!1;function vr(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 Ir(e){document.title!==e&&(document.title=e)}const wr=(0,o.X$)((0,s.c$)((e=>{var t,n,s;const{settings:{byKey:{animationLevel:a,language:o,wasTimeFormatSetManually:i}}}=e,{chatId:r,messageId:l}=e.audioPlayer,d=r&&l?(0,c.hj)(e,r,l):void 0,u=e.openedGame,m=u&&(0,c.hj)(e,u.chatId,u.messageId),h=null==m||null===(t=m.content.game)||void 0===t?void 0:t.title,g=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;return{connectionState:e.connectionState,authState:e.authState,lastSyncTime:e.lastSyncTime,isLeftColumnOpen:e.isLeftColumnShown,isRightColumnOpen:(0,c.Jf)(e),isMediaViewerOpen:(0,c.zQ)(e),isForwardModalOpen:(0,c.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:d,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:a,language:o,wasTimeFormatSetManually:i,isPhoneCallActive:Boolean(e.phoneCall),addedSetIds:e.stickers.added.setIds,newContactUserId:null===(n=e.newContact)||void 0===n?void 0:n.userId,newContactByPhoneNumber:null===(s=e.newContact)||void 0===s?void 0:s.isByPhoneNumber,openedGame:u,gameTitle:h,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall),botTrustRequest:e.botTrustRequest,botAttachRequest:e.botAttachRequest,webApp:e.webApp,currentUser:g,urlAuth:e.urlAuth}}))((e=>{let{connectionState:t,authState:n,lastSyncTime:i,isLeftColumnOpen:r,isRightColumnOpen:c,isMediaViewerOpen:l,isForwardModalOpen:d,hasNotifications:u,hasDialogs:m,audioMessage:g,activeGroupCallId:p,safeLinkModalUrl:f,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:I,openedStickerSetShortName:w,isServiceChatReady:y,animationLevel:Z,language:P,wasTimeFormatSetManually:b,addedSetIds:C,isPhoneCallActive:S,newContactUserId:M,newContactByPhoneNumber:E,openedGame:k,gameTitle:N,isRatePhoneCallModalOpen:A,botTrustRequest:T,botAttachRequest:B,webApp:x,currentUser:L,urlAuth:O}=e;const{sync:U,loadAnimatedEmojis:F,loadNotificationSettings:$,loadNotificationExceptions:q,updateIsOnline:D,loadTopInlineBots:j,loadEmojiKeywords:_,loadCountryList:G,loadAvailableReactions:H,loadStickerSets:V,loadAddedStickers:W,loadFavoriteStickers:X,ensureTimeFormat:K,openStickerSetShortName:Y,checkVersionNotification:J,loadAppConfig:Q,loadAttachMenuBots:ee,loadContactList:te}=(0,s.Sv)();a.eM&&!fr&&(fr=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{"connectionStateReady"===t&&"authorizationStateReady"===n&&U()}),[t,n,U]),(0,o.d4)((()=>{i&&(D(!0),Q(),H(),F(),$(),q(),j(),_({language:a.pR}),ee(),te())}),[i,F,_,q,$,j,D,H,Q,ee,te]),(0,o.d4)((()=>{i&&(P!==a.pR&&_({language:P}),G({langCode:P}))}),[P,i,G,_]),(0,o.d4)((()=>{i&&(C?W():(V(),X()))}),[i,C,V,X,W]),(0,o.d4)((()=>{i&&y&&J()}),[i,y,J]),(0,o.d4)((()=>{i&&!b&&K()}),[i,b,K]),(0,o.d4)((()=>{i&&Ve.O.startsWith("#?tgaddr=")&&(0,Ue.o)(decodeURIComponent(Ve.O.substr("#?tgaddr=".length)))}),[i]),(0,o.d4)((()=>{if(p)return pe.Z.disableRefresh(),()=>{pe.Z.enableRefresh()}}),[p]);const ne=(0,We.Z)(r,void 0,!0,void 0,I),se=(0,o.sO)(!1),ae=(0,ze.Z)();(0,De.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;se.current=!0,h.wZ&&(0,R.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!r)}));const n=(0,xe.YW)();(0,Oe.L)(document.getElementById("MiddleColumn"),(()=>{n(),se.current=!1,ae()}))}),[r]);const oe=(0,We.Z)(c,void 0,!0,void 0,I),ie=(0,o.sO)(!1),[re,ce]=(0,o.eJ)(c);(0,De.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;ie.current=!0;const n=(0,xe.YW)();(0,Oe.L)(document.getElementById("RightColumn"),(()=>{n(),ie.current=!1,ae(),ce(c)}))}),[c]);const le=(0,Le.Z)(ne.hasShownClass&&"left-column-shown",ne.hasOpenClass&&"left-column-open",se.current&&"left-column-animating",oe.hasShownClass&&"right-column-shown",oe.hasOpenClass&&"right-column-open",ie.current&&"right-column-animating",re&&"narrow-message-list",I&&"history-animation-disabled"),de=(0,o.I4)((()=>{D(!1);const e=(0,z.xW)();let t=0;clearInterval(pr),pr=window.setInterval((()=>{if(document.title.includes(a.ou))vr(!1);else{if(t%2==0){const t=(0,z.xW)()-e;t>0&&(Ir(`${t} notification${t>1?"s":""}`),vr(!0))}else Ir(a.Ti),vr(!1);t++}}),1e3)}),[D]),ue=(0,o.I4)((()=>{D(!0),clearInterval(pr),pr=void 0,document.title.includes(a.ou)||Ir(a.Ti),vr(!1)}),[D]),me=(0,o.I4)((()=>{Y({stickerSetShortName:void 0})}),[Y]);return(0,$e.Z)(de,ue),qe(de),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,o.d4)((()=>{if(h.$b){if(!e)return null==je||je.setAttribute("content",_e),h.cj&&!h.fl&&document.addEventListener("gesturestart",He),()=>{null==je||je.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",He)};null==je||je.setAttribute("content",Ge)}}),[e])}(l),o.ZP.createElement("div",{id:"Main",className:le,onDrop:Fe.Z,onDragOver:Fe.Z},o.ZP.createElement(Dt,null),o.ZP.createElement(ai,null),o.ZP.createElement(qi,null),o.ZP.createElement(Di,{isOpen:l}),o.ZP.createElement(er,{isOpen:d}),o.ZP.createElement(Ji,{isOpen:u}),o.ZP.createElement(Qi,{isOpen:m}),g&&o.ZP.createElement(Cn,{key:g.id,message:g,noUi:!0}),o.ZP.createElement(tr,{url:f}),o.ZP.createElement(gr,{urlAuth:O,currentUser:L}),o.ZP.createElement(nr,{isOpen:v}),o.ZP.createElement(Xe.Z,{isOpen:Boolean(w),onClose:me,stickerSetShortName:w}),p&&o.ZP.createElement(sr,{groupCallId:p}),o.ZP.createElement(ar,{isActive:Boolean(p||S)}),o.ZP.createElement(lr,{isOpen:Boolean(M||E),userId:M,isByPhoneNumber:E}),o.ZP.createElement(Yi,{openedGame:k,gameTitle:N}),o.ZP.createElement(ur,{webApp:x}),o.ZP.createElement(Wi,null),o.ZP.createElement(or,{isActive:S}),o.ZP.createElement(Qe,{isForAppBadge:!0}),o.ZP.createElement(dr,{isOpen:A}),o.ZP.createElement(mr,{bot:null==T?void 0:T.bot,type:null==T?void 0:T.type}),o.ZP.createElement(hr,{bot:null==B?void 0:B.bot}),o.ZP.createElement(cr,null))})));var yr=n(99364),Zr=n(88033);var Pr=n(2092);const br=(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:l,isLoading:d}=n,u=(0,ot.Z)(),[m,h]=(0,o.eJ)(""),[g,p]=(0,o.eJ)(!1),[f,v,I]=(0,nt.Z)(!1),{transitionClassNames:w,shouldRender:y}=(0,We.Z)(t);(0,Js.Z)(c,l&&l>=5?18e4:void 0);const Z=(0,o.I4)((()=>{h("")}),[]),P=(0,o.I4)((e=>{l&&l>=5?h(u("FloodWait")):(h(""),(0,M.so)(e).then(a,(()=>{r(),h(u("lng_passcode_wrong"))})))}),[l,u,r,a]);(0,o.d4)((()=>{l&&l>=5?h(u("FloodWait")):0===l&&h("")}),[l,u]);const b=(0,o.I4)((()=>{I(),i()}),[I,i]);if(y)return o.ZP.createElement("div",{className:(0,Le.Z)("src-components-main-LockScreen-module__container",w)},o.ZP.createElement("div",{className:"src-components-main-LockScreen-module__wrapper",dir:u.isRtl?"rtl":void 0},o.ZP.createElement(Cs.Z,{tgsUrl:Ps.l.Lock,previewUrl:Pr,size:160,className:"src-components-main-LockScreen-module__icon"}),o.ZP.createElement(yr.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:d,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:Z,isPasswordVisible:g,noRipple:!0,onChangePasswordVisibility:p,onSubmit:P}),o.ZP.createElement("div",{className:"src-components-main-LockScreen-module__help"},o.ZP.createElement("p",null,o.ZP.createElement(Zr.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),o.ZP.createElement("p",null,o.ZP.createElement(gt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},u("AccountSettings.Logout"))))),o.ZP.createElement(cn.Z,{isOpen:f,onClose:I,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:b,confirmIsDestructive:!0}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{connectionState:Cr,passcode:{isScreenLocked:Sr}}=(0,s.Rd)();Cr||Sr||(0,s.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558..js"}}]);
|
||
//# sourceMappingURL=5769.2b587ecb8f9bdaf55b4d.js.map
|