mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 18:57:12 +01:00
2 lines
248 KiB
JavaScript
2 lines
248 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[791],{9791:(e,t,n)=>{n.r(t),n.d(t,{Main:()=>ti});var a=n(5116),s=n(3716),o=n(4050),i=(n(7895),n(9959)),r=n(1638),c=n(735),d=n(2858);function l(e){const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};return t&&n?(e=(0,i.qr)(e,t,n,!1),e=(0,i.Pb)(e,t,n,void 0)):e}(0,a.Q6)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};if(t&&n)return(0,i.qr)(e,t,n,!0)})),(0,a.Q6)("closeLocalTextSearch",l),(0,a.Q6)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:a,threadId:s}=(0,r.Bt)(e)||{};if(!a||!s)return;const{query:o}=n,l=(0,d.uw)(a,s),{query:u}=e.localTextSearch.byChatThreadKey[l]||{};return o!==u&&(e=(0,i.Pb)(e,a,s,c.D)),(0,i.qr)(e,a,s,!0,o)})),(0,a.Q6)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:a}=(0,r.Bt)(e)||{};if(!a)return;const{mediaType:s}=n;return(0,i.z5)(e,a,s)})),(0,a.Q6)("openChat",((e,t,n)=>{const{id:s,threadId:o=-1,type:c="thread",shouldReplaceHistory:d=!1}=n,u=(0,r.Bt)(e);return u&&u.chatId===s&&u.threadId===o&&u.type===c||(e=(0,i.pf)(e,s,o,"replyStack",[]),e=l(e=(0,i.i9)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...s!==e.forwardMessages.toChatId&&{forwardMessages:{}}},(0,a.R3)(e)),(0,i.Wy)(e,s,o,c,d)})),(0,a.Q6)("openPreviousChat",(e=>(0,i.Wy)(e,void 0))),(0,a.Q6)("openChatWithInfo",((e,t,n)=>{(0,a.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,a.Q6)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,a.Q6)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,a.Q6)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s}=n,{chatId:o}=(0,r.Bt)(e)||{};if(!o)return void t.openChat({id:s[0]});const i=s.indexOf(o);if(-1===i)return;const c=s[i+a];t.openChat({id:c,shouldReplaceHistory:!0})}));var u=n(6137),m=n(1713),h=n(7361),g=n(782),f=n(2267),p=n(3099);const v=s.ck+s.fK;let I;(0,a.Q6)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o}=n;return(0,i.pf)(e,a,s,"scrollOffset",o)})),(0,a.Q6)("setReplyingToId",((e,t,n)=>{const{messageId:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o,threadId:c}=s;return(0,i.pf)(e,o,c,"replyingToId",a)})),(0,a.Q6)("setEditingId",((e,t,n)=>{const{messageId:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o,threadId:c,type:d}=s,l="scheduled"===d?"editingScheduledId":"editingId";return(0,i.pf)(e,o,c,l,a)})),(0,a.Q6)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};if(!t||!n)return;const a=(0,r.Zw)(e,t),s=(0,r.Cb)(e,t,n);if(!a||!s)return;const o=(0,g.dF)(s,(t=>Boolean(a[t]&&(0,r._k)(e,a[t],n).canEdit)));return o?(0,i.pf)(e,t,n,"editingId",o):void 0})),(0,a.Q6)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a}=n,{chatId:s,threadId:o}=(0,r.Bt)(e)||{};if(!s||!o)return;const i=(0,r.Zw)(e,s),c=(0,r.Cb)(e,s,o);if(!i||!c)return;const d=(0,r.Yy)(e,s,o);let l;if((0,r.b9)(e,s,o)&&d){const e=Object.keys(i),t=e.indexOf(d.toString())+a;l=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===u._f){var m;const t=(0,r.Z1)(e,s);l=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,r.tZ)(e,s,o);l=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:l}),t.focusMessage({chatId:s,threadId:o,messageId:l})})),(0,a.Q6)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c}=n;return{...e,mediaViewer:{chatId:a,threadId:s,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c},forwardMessages:{}}})),(0,a.Q6)("closeMediaViewer",(e=>({...e,mediaViewer:{}}))),(0,a.Q6)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d}=n;return{...e,audioPlayer:{chatId:a,threadId:s,messageId:o,origin:null!=i?i:e.audioPlayer.origin,volume:null!=r?r:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:d||e.audioPlayer.isMuted}}})),(0,a.Q6)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:a}}})),(0,a.Q6)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:a}}})),(0,a.Q6)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:a}}})),(0,a.Q6)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:a}}})),(0,a.Q6)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,a.Q6)("openPollResults",((e,t,n)=>{const{chatId:s,messageId:o}=n;(0,r.Jf)(e)?s===e.pollResults.chatId&&o===e.pollResults.messageId||(0,a.R3)({...e,pollResults:{chatId:s,messageId:o,voters:{}}}):window.setTimeout((()=>{const e=(0,a.Rd)();(0,a.R3)({...e,pollResults:{chatId:s,messageId:o,voters:{}}})}),450)})),(0,a.Q6)("closePollResults",(e=>{(0,a.R3)({...e,pollResults:{}})})),(0,a.Q6)("focusLastMessage",((e,t)=>{const n=(0,r.Bt)(e);if(!n)return;const{chatId:a,threadId:s}=n;let o;if(s===u._f){var i;const t=(0,r.Z1)(e,a);o=null==t||null===(i=t.lastMessage)||void 0===i?void 0:i.id}else{const t=(0,r.tZ)(e,a,s);o=null==t?void 0:t.lastMessageId}o&&t.focusMessage({chatId:a,threadId:s,messageId:o,noHighlight:!0})})),(0,a.Q6)("focusNextReply",((e,t)=>{const n=(0,r.Bt)(e);if(!n)return;const{chatId:s,threadId:o}=n,c=(0,r.p9)(e,s,o);if(c&&0!==c.length){const n=c.pop();e=(0,i.pf)(e,s,o,"replyStack",[...c]),(0,a.R3)(e),t.focusMessage({chatId:s,threadId:o,messageId:n})}else t.focusLastMessage()})),(0,a.Q6)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:o=u._f,messageListType:c="thread",noHighlight:d,groupedId:l,groupedChatId:h,replyMessageId:g,isResizingContainer:f}=n;let{messageId:p}=n;if(void 0!==l){const t=(0,r.y8)(e,h,l);null!=t&&t.length&&([p]=t)}const y=(0,r.Bt)(e),Z=!y||s!==y.chatId||o!==y.threadId||c!==y.type;if(I&&(clearTimeout(I),I=void 0),I=window.setTimeout((()=>{let e=(0,a.Rd)();e=(0,i.cq)(e),e=(0,i.wV)(e),(0,a.R3)(e)}),d?v:1500),e=(0,i.cq)(e,s,p,d,f),e=(0,i.wV)(e,void 0),g){const t=(0,r.p9)(e,s,o)||[];e=(0,i.pf)(e,s,o,"replyStack",[...t,g])}Z&&(e=(0,i.wV)(e,m.fo.Static));const P=(0,r.Cb)(e,s,o);if(P&&P.includes(p))return(0,a.R3)(e),void t.openChat({id:s,threadId:o});if(Z&&(e=(0,i.pf)(e,s,o,"viewportIds",void 0)),e=(0,i.pf)(e,s,o,"outlyingIds",void 0),P&&!Z){const t=p>P[0]?m.fo.Down:m.fo.Up;e=(0,i.wV)(e,t)}(0,a.R3)(e),t.openChat({id:s,threadId:o}),t.loadViewportMessages()})),(0,a.Q6)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o}=n;let i;return o&&(i=(0,r.xH)(e,a,o)),{...e,forwardMessages:{fromChatId:a,messageIds:i||s,isModalShown:!0}}})),(0,a.Q6)("exitForwardMode",(e=>{(0,a.R3)({...e,forwardMessages:{}})})),(0,a.Q6)("setForwardChatId",((e,t,n)=>{const{id:s}=n;(0,a.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:s,isModalShown:!1}}),t.openChat({id:s}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,a.Q6)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:a})})),(0,a.Q6)("cancelMessageMediaDownload",((e,t,n)=>{const{message:s}=n,o=e.activeDownloads.byChatId[s.chatId];o&&o.length&&(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:o.filter((e=>e!==s.id))}}})})),(0,a.Q6)("downloadMessageMedia",((e,t,n)=>{const{message:s}=n;s&&(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:[...e.activeDownloads.byChatId[s.chatId]||[],s.id]}}})})),(0,a.Q6)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages,{threadId:s}=(0,r.Bt)(e)||{},o=(0,r.Zw)(e,n);o&&s&&a.map((e=>o[e])).filter((t=>(0,r._k)(e,t,s).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,a.Q6)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a}=n||{},s=(0,r.jr)(e);return s?(0,i.M6)(e,s.id,a):e})),(0,a.Q6)("toggleMessageSelection",((e,t,n)=>{const{messageId:s,groupedId:o,childMessageIds:c,withShift:d}=n,l=(0,r.Bt)(e);if(!l)return;const{chatId:u,threadId:m,type:g}=l;e=(0,i.Ob)(e,u,m,g,s,o,c,d),(0,a.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,a.Q6)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.Q6)("exitMessageSelectMode",i.i9),(0,a.Q6)("openPollModal",(e=>({...e,isPollModalOpen:!0}))),(0,a.Q6)("closePollModal",(e=>({...e,isPollModalOpen:!1}))),(0,a.Q6)("checkVersionNotification",((e,t)=>{const n=s.Ji.split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((({version:e})=>e===n)))return;const o={chatId:s.aw,date:(0,f.b)(e.serverTimeOffset),content:{text:(0,p.Z)("**Telegram Web Z was updated to version 1.30**\n\n👏 **Harder**\n• Meet Message Reactions:\n - React to a message with ❤️🔥🎉😁😱🤩😢👎💩🤮 in the context menu.\n - Send a quick 👍 reaction by hovering over the bottom corner of a message.\n - You can change your default reaction to another emoji in Settings > General.\n - Group and Channel admins can enable and control reactions via their chat's Info Page > Edit > Reactions.\n\n• Interactive Emoji:\n - Added support for all interactive emoji, including fullscreen animations and sound effects. Try 🔥, 🍆, 🍑 and more.\n - Animations play simultaneously when both users have the chat open.\n – The “is watching…” status will appear when your chat partner is also seeing the animations.\n\n• Manage invite links for Groups and Channels:\n – Enable admin approval or limited duration and users.\n\n🤩 **Better**\n• Better quality for uploaded profile pictures.\n• Various UI improvements.\n\n🚀 **Faster**\n• Several optimizations for older devices – no more freezing while typing.\n\n💪 **Stronger**\n• Saved Messages now correctly renders in search results.\n• Fixed missing icons for muted chats in the chat list.\n• The context menu no longer flickers on older devices.\n• Fix re-scheduling messages to a previous date.\n")},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,a.Q6)("createServiceNotification",((e,t,n)=>{var o;const{message:i,version:c}=n,{serviceNotifications:d}=e,l=(0,r.Z1)(e,s.aw),u=Math.max((null===(o=l.lastMessage)||void 0===o?void 0:o.id)||0,...d.map((({id:e})=>e))),m=(d.length+1)/1e3,h=Math.floor(u)+m;i.id=h;const g={id:h,message:i,version:c,isUnread:!0};(0,a.R3)({...e,serviceNotifications:[...d.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(0,a.Q6)("openReactorListModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,reactorModal:{chatId:a,messageId:s}}})),(0,a.Q6)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,a.Q6)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,seenByModal:{chatId:a,messageId:s}}})),(0,a.Q6)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,a.Q6)("setGlobalSearchQuery",((e,t,n)=>{const{query:a}=n,{chatId:s}=e.globalSearch;return(0,i.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!s,messages:!0}}:{fetchingStatus:void 0},query:a})})),(0,a.Q6)("addRecentlyFoundChatId",((e,t,n)=>{const{id:a}=n,{recentlyFoundChatIds:s}=e.globalSearch;if(!s)return(0,i.No)(e,{recentlyFoundChatIds:[a]});const o=s.filter((e=>e!==a));return o.unshift(a),o.length>10&&o.pop(),(0,i.No)(e,{recentlyFoundChatIds:o})})),(0,a.Q6)("clearRecentlyFoundChats",(e=>(0,i.No)(e,{recentlyFoundChatIds:void 0}))),(0,a.Q6)("setGlobalSearchContent",((e,t,n)=>{const{content:a}=n;return(0,i.Og)(e,a)})),(0,a.Q6)("setGlobalSearchChatId",((e,t,n)=>{const{id:a}=n;return(0,i.No)(e,{chatId:a,query:void 0,resultsByType:void 0})})),(0,a.Q6)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,stickers:{...e.stickers,search:{query:a,resultIds:void 0}}}})),(0,a.Q6)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,gifs:{...e.gifs,search:{query:a,offsetId:void 0,results:void 0}}}})),(0,a.Q6)("openUserInfo",((e,t,n)=>{const{id:a}=n;t.openChat({id:a})})),(0,a.Q6)("openChat",(e=>(0,i.x1)(e,void 0))),(0,a.Q6)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;return(0,i.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a})})),n(3781);var y=n(1947),Z=n(6926);(0,a.Q6)("toggleChatInfo",(e=>({...e,isChatInfoShown:!e.isChatInfoShown}))),(0,a.Q6)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,a.Q6)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.Q6)("toggleManagement",(e=>{const{chatId:t}=(0,r.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,a.Q6)("closeManagement",(e=>{const{chatId:t}=(0,r.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,a.Q6)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,a.Q6)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,a.Q6)("addRecentEmoji",((e,t,n)=>{const{emoji:a}=n,{recentEmojis:s}=e;if(!s)return{...e,recentEmojis:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>18&&o.pop(),{...e,recentEmojis:o}})),(0,a.Q6)("addRecentSticker",((e,t,n)=>{const{sticker:a}=n,{recent:s}=e.stickers;if(!s)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const o=s.stickers.filter((e=>e.id!==a.id));return o.unshift(a),{...e,stickers:{...e.stickers,recent:{...s,stickers:o}}}})),(0,a.Q6)("showNotification",((e,t,n)=>{const a=n;a.localId=(0,Z.Z)({});const s=[...e.notifications],o=s.findIndex((e=>e.message===a.message));return-1!==o&&s.splice(o,1),s.push(a),{...e,notifications:s}})),(0,a.Q6)("dismissNotification",((e,t,n)=>{const a=e.notifications.filter((({localId:e})=>e!==n.localId));return{...e,notifications:a}})),(0,a.Q6)("showDialog",((e,t,n)=>{const{data:a}=n;if("message"in a&&a.hasErrorKey&&!(0,y.ZP)(a))return e;const s=[...e.dialogs];if("message"in a){const e=s.findIndex((e=>e.message===a.message));-1!==e&&s.splice(e,1)}return s.push(a),{...e,dialogs:s}})),(0,a.Q6)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,a.Q6)("toggleSafeLinkModal",((e,t,n)=>{const{url:a}=n;return{...e,safeLinkModalUrl:a}})),(0,a.Q6)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a}=n;return{...e,historyCalendarSelectedAt:a}})),(0,a.Q6)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,a.Q6)("openPaymentModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,payment:{...e.payment,chatId:a,messageId:s,isPaymentModalOpen:!0}}})),(0,a.Q6)("closePaymentModal",(e=>{const t=(0,i.bp)(e);return(0,i.WY)(t)})),(0,a.Q6)("addPaymentError",((e,t,n)=>{const{error:a}=n;return{...e,payment:{...e.payment,error:a}}})),n(1689),n(1363),n(6204);var P=n(1226),C=n(9118);const w=new Map,b=(0,C.Ds)((e=>e()),500,!1);async function E(e,t,n,o,c=!1,d=!1){const l=e.id;let u;switch(o){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(s.hT/2)+1);break;case m.Uq.Forwards:u=-(s.hT+1)}const h=await(0,P.t9)("fetchMessages",{chat:(0,r.Cm)((0,a.Rd)(),l,t),offsetId:n,addOffset:u,limit:s.hT,threadId:t});if(!h)return;const{messages:f,users:p,chats:v,threadInfos:I}=h;let y=(0,a.Rd)();const Z=l===s.aw?y.serviceNotifications.map((({message:e})=>e)):[],C=[].concat(f,Z),w=(0,g.ee)(C,"id"),b=Object.keys(w).map(Number);y=(0,i.c_)(y,l,w),y=c?(0,i.ff)(y,l,t,b):(0,i.xj)(y,l,t,b),y=(0,i.Sh)(y,(0,g.ee)(p,"id")),y=(0,i.fZ)(y,(0,g.ee)(v,"id")),y=(0,i.j6)(y,l,I);let E=(0,r.gb)(y,l,t);const M=(0,r.qC)(y,l,t);if(c&&E&&M&&(M.length&&!(0,g.YE)(E,M)||(y=(0,i.xj)(y,l,t,M),E=(0,r.gb)(y,l,t),y=(0,i.pf)(y,l,t,"outlyingIds",void 0),c=!1)),!d){const e=c?M:E,{newViewportIds:a}=S(e,n,o);y=(0,i.y9)(y,l,t,a)}(0,a.R3)(y)}function S(e,t,n){const{length:a}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,a)=>n===t||n<t&&e[a+1]>t))}(e,t):-1,i=n===m.Uq.Backwards?o:o+1||a,r=i-s.hT,c=i+s.hT-1,d=e.slice(Math.max(0,r),c+1);let l,u;switch(n){case m.Uq.Backwards:l=i>0,u=r>=0;break;case m.Uq.Forwards:l=i<a,u=c<=a-1;break;case m.Uq.Around:default:l=d.length>0,u=d.length===s.hT}return{newViewportIds:d,areSomeLocal:l,areAllLocal:u}}async function M(e){let t;const n=e.attachment?(e,s)=>{w.has(s)||(t=s,w.set(s,n));const o=(0,a.Rd)();(0,a.R3)({...o,fileUploads:{byMessageLocalId:{...o.fileUploads.byMessageLocalId,[s]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,C.Pn)();const s=(0,a.Rd)();e.serverTimeOffset=s.serverTimeOffset;const o=(0,r.Bt)(s);if(!o)return;const{threadId:i}=o;e.replyingTo||i===u._f||(e.replyingTo=(0,r.qS)(s,e.chat.id,i)),await(0,P.t9)("sendMessage",e,n),n&&t&&w.delete(t)}(0,a.Q6)("loadViewportMessages",((e,t,n)=>{const{direction:a=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:c,threadId:d}=n||{};if(!c){const t=(0,r.Bt)(e);if(!t)return;c=t.chatId,d=t.threadId}const l=(0,r.Z1)(e,c);if(!l||l.isRestricted)return;const u=(0,r.Cb)(e,c,d),h=(0,r.gb)(e,c,d),g=(0,r.qC)(e,c,d);if(u&&u.length&&a!==m.Uq.Around){const n=a===m.Uq.Backwards?u[0]:u[u.length-1],s=Boolean(g),r=s?g:h,{newViewportIds:f,areSomeLocal:p,areAllLocal:v}=S(r,n,a);if(p&&(e=(0,i.y9)(e,c,d,f)),async function(e,t,n,a,s,o,i,r){t||await E(s,o,r,i,n,a),a||(await Promise.resolve(),e.loadViewportMessages({chatId:s.id,threadId:o,direction:i,isBudgetPreload:!0}))}(t,v,s,o,l,d,a,n),o)return}else{const t=(0,r.G$)(e,c)||(0,r.rd)(e,c,d),n=Boolean(t&&h&&!h.includes(t)),a=(n?g:h)||[],{newViewportIds:u,areSomeLocal:f,areAllLocal:p}=S(a,t,m.Uq.Around);f&&u.length>=s.hT&&(e=(0,i.y9)(e,c,d,u)),p||E(l,d,t,m.Uq.Around,n,o)}return e})),(0,a.Q6)("loadMessage",((e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:c,threadUpdate:d}=n,l=(0,r.Z1)(e,s);l&&(async()=>{const e=await async function(e,t,n){const s=await(0,P.t9)("fetchMessage",{chat:e,messageId:t});if(!s)return;if(s===u._Q){if(n){let t=(0,a.Rd)();const s=(0,r.hj)(t,e.id,n);t=(0,i.cY)(t,e.id,n,{...s,replyToMessageId:void 0}),(0,a.R3)(t)}return}let o=(0,a.Rd)();return o=(0,i.cY)(o,e.id,t,s.message),o=(0,i.Sh)(o,(0,g.ee)(s.users,"id")),(0,a.R3)(o),s.message}(l,o,c);if(e&&d){const{lastMessageId:t,isDeleting:n}=d;(0,a.R3)((0,i.lG)((0,a.Rd)(),e,s,t,n))}})()})),(0,a.Q6)("sendMessage",((e,t,n)=>{const a=(0,r.Bt)(e);if(!a)return;const{chatId:o,threadId:i,type:c}=a;if("scheduled"===c&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const d=(0,r.Z1)(e,o),l={...n,chat:d,replyingTo:(0,r.Yy)(e,o,i),noWebPage:(0,r.tV)(e,o,i),sendAs:(0,r._5)(e,o)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1});const u=!n.attachments||n.attachments.length<=1,m=!u&&n.attachments&&n.attachments.length>1;if(u){const{attachments:e,...t}=l;M({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...a}=l,o=(0,g.Vl)(n,s.DU);for(let n=0;n<o.length;n++){const[s,...i]=o[n],r=`${Date.now()}${n}`;M({...a,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:s,groupedId:i.length>0?r:void 0}),i.forEach((e=>{M({...a,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:a,...s}=l;e&&M({...s,text:e,entities:t,replyingTo:a}),n.forEach((e=>{M({...s,attachment:e})}))}})),(0,a.Q6)("editMessage",((e,t,n)=>{const{serverTimeOffset:a}=e,{text:s,entities:o}=n,i=(0,r.Bt)(e);if(!i)return;const{chatId:c,threadId:d,type:l}=i,u=(0,r.Z1)(e,c),m=(0,r.kK)(e,c,d,l);u&&m&&((0,P.t9)("editMessage",{chat:u,message:m,text:s,entities:o,noWebPage:(0,r.tV)(e,c,d),serverTimeOffset:a}),t.setEditingId({messageId:void 0}))})),(0,a.Q6)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,r.hj)(e,a,s),i=o&&w.get(o.previousLocalId||o.id);i&&(0,P.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.Q6)("saveDraft",((e,t,n)=>{const{chatId:a,threadId:s,draft:o}=n;if(!o)return;const{text:c,entities:d}=o,l=(0,r.Z1)(e,a);return s===u._f&&(0,P.t9)("saveDraft",{chat:l,text:c,entities:d,replyToMsgId:(0,r.Yy)(e,a,s)}),e=(0,i.pf)(e,a,s,"draft",o),(0,i.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)})})),(0,a.Q6)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s,localOnly:o}=n;if(!(0,r.Ms)(e,a,s))return;const c=(0,r.Z1)(e,a);return o||s!==u._f||(0,P.t9)("clearDraft",c),e=(0,i.pf)(e,a,s,"draft",void 0),(0,i.a4)(e,a,{draftDate:void 0})})),(0,a.Q6)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,i.pf)(e,a,s,"noWebPage",o)})),(0,a.Q6)("pinMessage",((e,t,n)=>{const a=(0,r.jr)(e);if(!a)return;const{messageId:s,isUnpin:o,isOneSide:i,isSilent:c}=n;(0,P.t9)("pinMessage",{chat:a,messageId:s,isUnpin:o,isOneSide:i,isSilent:c})})),(0,a.Q6)("unpinAllMessages",((e,t,n)=>{const s=(0,r.Z1)(e,n.chatId);s&&async function(e){await(0,P.t9)("unpinAllMessages",{chat:e});let t=(0,a.Rd)();t=(0,i.pf)(t,e.id,u._f,"pinnedIds",[]),(0,a.R3)(t)}(s)})),(0,a.Q6)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s}=n,o=(0,r.Bt)(e);if(!o)return;const{chatId:i,threadId:c}=o,d=(0,r.Z1)(e,i);(0,P.t9)("deleteMessages",{chat:d,messageIds:a,shouldDeleteForAll:s});const l=(0,r._$)(e,i,c);a.includes(l)&&t.setEditingId({messageId:void 0})})),(0,a.Q6)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o}=s,i=(0,r.Z1)(e,o);(0,P.t9)("deleteScheduledMessages",{chat:i,messageIds:a});const c=(0,r.wU)(e,o);a.includes(c)&&t.setEditingId({messageId:void 0})})),(0,a.Q6)("deleteHistory",((e,t,n)=>{(async()=>{var a;const{chatId:s,shouldDeleteForAll:o}=n,i=(0,r.Z1)(e,s);if(!i)return;const c=null===(a=i.lastMessage)||void 0===a?void 0:a.id;await(0,P.t9)("deleteHistory",{chat:i,shouldDeleteForAll:o,maxId:c});const d=(0,r.Bt)(e);d&&d.chatId===s&&t.openChat({id:void 0})})()})),(0,a.Q6)("reportMessages",((e,t,n)=>{(async()=>{const{messageIds:a,reason:s,description:o}=n,i=(0,r.Bt)(e);if(!i)return;const{chatId:c}=i,d=(0,r.Z1)(e,c),l=await(0,P.t9)("reportMessages",{peer:d,messageIds:a,reason:s,description:o});t.showNotification({message:l?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()})),(0,a.Q6)("sendMessageAction",((e,t,n)=>{(async()=>{const{action:t,chatId:a,threadId:s}=n;if(a===e.currentUserId)return;const o=(0,r.Z1)(e,a);o&&await(0,P.t9)("sendMessageAction",{peer:o,threadId:s,action:t})})()})),(0,a.Q6)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:a}=e,o=(0,r.Bt)(e);if(!o)return;const{chatId:c,threadId:d}=o,l=(0,r.Cm)(e,c,d);if(!l)return;const{maxId:m}=n;if(b((()=>{(0,P.t9)("markMessageListRead",{serverTimeOffset:a,chat:l,threadId:d,maxId:m})})),d!==u._f)return;c===s.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,r.Cb)(e,c,d),g=(0,r.It)(e,c,d);if(!h||!g||!l.unreadCount)return e;const f=function(e,t,n){let a=0;for(let s=0,o=e.length;s<o&&(e[s]>=t&&e[s]<=n&&a++,!(e[s]>=n));s++);return a}(h,g,m);return f?(0,i.a4)(e,c,{lastReadInboxMessageId:m,unreadCount:Math.max(0,l.unreadCount-f)}):e})),(0,a.Q6)("markMessagesRead",((e,t,n)=>{const a=(0,r.jr)(e);if(!a)return;const{messageIds:s}=n;(0,P.t9)("markMessagesRead",{chat:a,messageIds:s})})),(0,a.Q6)("loadWebPagePreview",((e,t,n)=>{const{text:s}=n;!async function(e){const t=await(0,P.t9)("fetchWebPagePreview",{message:e});(0,a.R3)({...(0,a.Rd)(),webPagePreview:t})}(s)})),(0,a.Q6)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,a.Q6)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,r.Z1)(e,a);i&&(0,P.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.Q6)("loadPollOptionResults",((e,t,n)=>{const{chat:s,messageId:o,option:r,offset:c,limit:d,shouldResetVoters:l}=n;!async function(e,t,n,s,o,r){const c=await(0,P.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:s,limit:o});if(!c)return;let d=(0,a.Rd)();d=(0,i.Sh)(d,(0,g.ee)(c.users,"id"));const{voters:l}=d.pollResults;(0,a.R3)({...d,pollResults:{...d.pollResults,voters:{...l,[n]:(0,g.Tw)([...!r&&l&&l[n]?l[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...d.pollResults.offsets?d.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(s,o,r,c,d,l)})),(0,a.Q6)("forwardMessages",((e,t,n)=>{const{fromChatId:s,messageIds:o,toChatId:i}=e.forwardMessages,c=s?(0,r.Z1)(e,s):void 0,l=i?(0,r.Z1)(e,i):void 0,u=s&&o?o.sort(((e,t)=>e-t)).map((t=>(0,r.hj)(e,s,t))).filter(Boolean):void 0;if(!c||!l||!u)return;const{isSilent:m,scheduledAt:h}=n,g=(0,r._5)(e,i),f=u.filter((e=>!(0,d.jM)(e)));f.length&&(0,P.t9)("forwardMessages",{fromChat:c,toChat:l,messages:f,serverTimeOffset:(0,a.Rd)().serverTimeOffset,isSilent:m,scheduledAt:h,sendAs:g}),u.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:a,poll:s}=e.content;M({chat:l,text:t,entities:n,sticker:a,poll:s,isSilent:m,scheduledAt:h,sendAs:g})})),(0,a.R3)({...(0,a.Rd)(),forwardMessages:{}})})),(0,a.Q6)("loadScheduledHistory",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&async function(e){const t=await(0,P.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,s=(0,g.ee)(n,"id"),o=Object.keys(s).map(Number).sort(((e,t)=>t-e));let r=(0,a.Rd)();r=(0,i.w3)(r,e.id,s),r=(0,i.pf)(r,e.id,u._f,"scheduledIds",o),(0,a.R3)(r)}(o)})),(0,a.Q6)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,o=(0,r.Z1)(e,a);o&&(0,P.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.Q6)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,r.Z1)(e,a),c=i&&(0,r.Tm)(e,i.id,s);i&&c&&(0,P.t9)("rescheduleMessage",{chat:i,message:c,scheduledAt:o})})),(0,a.Q6)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:a,threadId:s}=n,o=(0,r.Cm)(e,a,s);o&&(0,P.t9)("requestThreadInfoUpdate",{chat:o,threadId:s})})),(0,a.Q6)("loadPinnedMessages",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&async function(e){const t=await(0,P.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:s,users:o}=t,r=(0,g.ee)(n,"id"),c=Object.keys(r).map(Number).sort(((e,t)=>t-e));let d=(0,a.Rd)();d=(0,i.c_)(d,e.id,r),d=(0,i.pf)(d,e.id,u._f,"pinnedIds",c),d=(0,i.Sh)(d,(0,g.ee)(o,"id")),d=(0,i.fZ)(d,(0,g.ee)(s,"id")),(0,a.R3)(d)}(o)})),(0,a.Q6)("loadSeenBy",((e,t,n)=>{const{chatId:s,messageId:o}=n,c=(0,r.Z1)(e,s);c&&(async()=>{const e=await(0,P.t9)("fetchSeenBy",{chat:c,messageId:o});e&&(0,a.R3)((0,i.cY)((0,a.Rd)(),s,o,{seenByUserIds:e}))})()})),(0,a.Q6)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,r.Z1)(e,a),c=(0,r.Z1)(e,s)||(0,r.dy)(e,s);if(o&&c)return(0,P.t9)("saveDefaultSendAs",{sendAs:c,chat:o}),(0,i.a4)(e,a,{fullInfo:{...o.fullInfo,sendAsId:s}})})),(0,a.Q6)("loadSendAs",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&(async()=>{const t=await(0,P.t9)("fetchSendAs",{chat:o});if(!t)return e=(0,i.a4)(e,s,{sendAsIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,i.Sh)(e,(0,g.ee)(t.users,"id")),e=(0,i.fZ)(e,(0,g.ee)(t.chats,"id")),e=(0,i.a4)(e,s,{sendAsIds:t.ids}),(0,a.R3)(e)})()})),(0,a.Q6)("loadSponsoredMessages",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&(async()=>{const e=await(0,P.t9)("fetchSponsoredMessages",{chat:o});if(!e)return;let t=(0,i.Fn)((0,a.Rd)(),s,e.messages[0]);t=(0,i.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,i.fZ)(t,(0,g.ee)(e.chats,"id")),(0,a.R3)(t)})()})),(0,a.Q6)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,r.Z1)(e,a),o=(0,r.fS)(e,a);s&&o&&(0,P.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})}));var R=n(5765);const k=(0,C.P2)((e=>e()),500,!1);async function T(e,t){const n=await(0,P.t9)("searchGifs",{query:e,offset:t});n&&(0,a.R3)((0,i.rq)((0,a.Rd)(),!t,n.gifs,n.nextOffset))}(0,a.Q6)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,P.t9)("fetchStickerSets",{hash:e});t&&(0,a.R3)((0,i.z3)((0,a.Rd)(),"added",t.hash,t.sets))}(t)})),(0,a.Q6)("loadAddedStickers",((e,t)=>{const{setIds:n}=e.stickers.added;n&&n.length&&(async()=>{for(let e=0;e<n.length;e++)t.loadStickers({stickerSetId:n[e]}),e%10==0&&e>0&&await(0,C.wO)(200)})()})),(0,a.Q6)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e){const t=await(0,P.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,recent:t}})}(t)})),(0,a.Q6)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,P.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,a.Q6)("loadGreetingStickers",(e=>{const{hash:t}=e.stickers.greeting||{};(async()=>{const e=await(0,P.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(!e)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,greeting:{hash:e.hash,stickers:e.stickers.filter((e=>"👋"===e.emoji))}}})})()})),(0,a.Q6)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,P.t9)("fetchFeaturedStickers",{hash:e});t&&(0,a.R3)((0,i.z3)((0,a.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,a.Q6)("loadStickers",((e,t,n)=>{const{stickerSetId:s,stickerSetShortName:o}=n;let{stickerSetAccessHash:c}=n;if(!c&&!o){const t=(0,r.Ny)(e,s);if(!t)return;c=t.accessHash}!async function(e,t,n){const s=await(0,P.t9)("fetchStickers",{stickerSetShortName:n,stickerSetId:e,accessHash:t});if(!s)return;const{set:o,stickers:r,packs:c}=s;let d=(0,a.Rd)();d=(0,i.Rg)(d,o.id,{...o,stickers:r,packs:c});const l=d.stickers.forEmoji.emoji;l&&c[l]&&(d=(0,i.vy)(d)),(0,a.R3)(d)}(s,c,o)})),(0,a.Q6)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,P.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)((0,i.g_)((0,a.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,P.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)({...(0,a.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,a.Q6)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,P.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,a.Q6)("faveSticker",((e,t,n)=>{const{sticker:a}=n;a&&(0,P.t9)("faveSticker",{sticker:a})})),(0,a.Q6)("unfaveSticker",((e,t,n)=>{const{sticker:s}=n;s&&function(e){const t=(0,a.Rd)();(0,a.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((({id:t})=>t!==e.id))}}}),(0,P.t9)("faveSticker",{sticker:e,unfave:!0})}(s)})),(0,a.Q6)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,r.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i}=s;(0,P.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:o})})),(0,a.Q6)("loadEmojiKeywords",((e,t,n)=>{var s;const{language:o}=n;let i=e.emojiKeywords[o];null!==(s=i)&&void 0!==s&&s.isLoading||((0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...i,isLoading:!0}}}),(async()=>{var t;const n=await(0,P.t9)("fetchEmojiKeywords",{language:o,fromVersion:i?i.version:0});e=(0,a.Rd)(),i=e.emojiKeywords[o],n?(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:n.version,keywords:{...null===(t=i)||void 0===t?void 0:t.keywords,...n.keywords}}}}):(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...i,isLoading:!1}}})})())})),(0,a.Q6)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;s&&k((()=>{!async function(e,t){const n=await(0,P.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const s=(0,a.Rd)(),{setsById:o,added:r}=s.stickers,c=n.sets.map((({id:e})=>e));r.setIds&&r.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=o[t]||{};n&&(0,R.Z)(n,e)&&c.unshift(t)}})),(0,a.R3)((0,i.z3)(s,"search",n.hash,n.sets,c))}(s)}))})),(0,a.Q6)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;"string"==typeof a&&k((()=>{T(a)}))})),(0,a.Q6)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&k((()=>{T(t,n)}))})),(0,a.Q6)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:o}=e.stickers.forEmoji;k((()=>{!async function(e,t){let n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const s=await(0,P.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,a.Rd)(),s&&n.stickers.forEmoji.emoji===e&&(n=(0,i.IM)(n,e,s.stickers,s.hash),(0,a.R3)(n))}(s,o)}))})),(0,a.Q6)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.Q6)("openStickerSetShortName",((e,t,n)=>{const{stickerSetShortName:a}=n;return{...e,openedStickerSetShortName:a}}));var N=n(790);const B=(0,C.P2)((e=>e()),500,!1);async function A(e="",t,n,o,c,d){let l;if(o){const a=await(0,P.t9)("searchMessagesLocal",{chatOrUser:o,query:e,type:t,limit:s.Hk,offsetId:n,minDate:d,maxDate:c});if(a){const{messages:e,users:t,totalCount:n,nextOffsetId:s}=a;l={messages:e,users:t,chats:[],totalCount:n,nextRate:s}}}else l=await(0,P.t9)("searchMessagesGlobal",{query:e,offsetRate:n,limit:s.Hk,type:t,maxDate:c,minDate:d});let u=(0,a.Rd)();const m=(0,r.JX)(u);if(!l||""!==e&&e!==m)return void(0,a.R3)((0,i.xv)(u,{messages:!1}));const{messages:h,users:f,chats:p,totalCount:v,nextRate:I}=l;p.length&&(u=(0,i.fZ)(u,(0,g.ee)(p,"id"))),f.length&&(u=(0,i.Sh)(u,(0,g.ee)(f,"id"))),h.length&&(u=(0,i.m6)(u,h)),u=(0,i.px)(u,h,v,t,I),(0,a.R3)(u)}(0,a.Q6)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:s}=e.globalSearch,{query:o}=n;o&&!s&&B((()=>{!async function(e){const t=await(0,P.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=(0,r.JX)(n);if(!t||!s||e!==s)return void(0,a.R3)((0,i.xv)(n,{chats:!1}));const{localChats:o,localUsers:c,globalChats:d,globalUsers:l}=t;(o.length||d.length)&&(n=(0,i.fZ)(n,(0,g.ee)([...o,...d],"id"))),(c.length||l.length)&&(n=(0,i.Sh)(n,(0,g.ee)([...c,...l],"id"))),n=(0,i.xv)(n,{chats:!1}),n=(0,i.No)(n,{localResults:{chatIds:o.map((({id:e})=>e)),userIds:c.map((({id:e})=>e))},globalResults:{...n.globalSearch.globalResults,chatIds:d.map((({id:e})=>e)),userIds:l.map((({id:e})=>e))}}),(0,a.R3)(n)}(o)}))})),(0,a.Q6)("setGlobalSearchDate",((e,t,n)=>{const{date:s}=n,o=s?(0,N.IS)(s):s,c=(0,i.No)(e,{date:s,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});(0,a.R3)(c);const{chatId:d}=e.globalSearch;A("","text",void 0,d?(0,r.Z1)(e,d):void 0,o,s)})),(0,a.Q6)("searchMessagesGlobal",((e,t,n)=>{var a;const{query:s,resultsByType:o,chatId:i,date:c}=e.globalSearch,d=c?(0,N.IS)(c):c,{type:l}=n;A(s,l,null==o||null===(a=o[l])||void 0===a?void 0:a.nextOffsetId,i?(0,r.Z1)(e,i):void 0,d,c)})),(0,a.Q6)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{},o=t?(0,r.Z1)(e,t):void 0,c=(0,r.n5)(e);if(!o||!c||!n)return;const{query:d,results:l}=c,m=null==l?void 0:l.nextOffsetId;let h;if(n!==u._f){const a=(0,r.tZ)(e,t,n);h=null==a?void 0:a.topMessageId}!async function(e,t,n,o,c){const d=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:"text",query:o,topMessageId:n,limit:s.pn,offsetId:c});if(!d)return;const{messages:l,users:u,totalCount:m,nextOffsetId:h}=d,f=(0,g.ee)(l,"id"),p=Object.keys(f).map(Number);let v=(0,a.Rd)();const I=(0,r.n5)(v);!I||o&&o!==I.query||(v=(0,i.c_)(v,e.id,f),v=(0,i.Sh)(v,(0,g.ee)(u,"id")),v=(0,i.dx)(v,e.id,t,p,m,h),(0,a.R3)(v))}(o,n,h,d,m)})),(0,a.Q6)("searchMediaMessagesLocal",(e=>{const t=(0,r.og)(e),n=t?e.users.byId[t]||e.chats.byId[t]:void 0,o=(0,r.we)(e);if(!n||!o)return;const{currentType:c,resultsByType:d}=o,l=c&&d&&d[c],u=null==l?void 0:l.nextOffsetId;c&&async function(e,t,n){const o=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:t,limit:s.EN,offsetId:n});if(!o)return;const{messages:c,users:d,totalCount:l,nextOffsetId:u}=o,m=(0,g.ee)(c,"id"),h=Object.keys(m).map(Number);let f=(0,a.Rd)();(0,r.we)(f)&&(f=(0,i.c_)(f,e.id,m),f=(0,i.Sh)(f,(0,g.ee)(d,"id")),f=(0,i.c1)(f,e.id,t,h,l,u),(0,a.R3)(f))}(n,c,u)})),(0,a.Q6)("searchMessagesByDate",((e,t,n)=>{const{timestamp:s}=n,{chatId:o}=(0,r.Bt)(e)||{};if(!o)return;const i=(0,r.Z1)(e,o);i&&async function(e,t){const n=await(0,P.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,a.uC)().focusMessage({chatId:e.id,messageId:n})}(i,s)})),(0,a.Q6)("checkPublicLink",((e,t,n)=>{const{chatId:s}=(0,r.Bt)(e)||{};if(!s)return;if(e.management.progress===m.wv.InProgress)return;const{username:o}=n;(async()=>{e=(0,i.H9)(e,m.wv.InProgress),e=(0,i.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e);const t=await(0,P.t9)("checkChatUsername",{username:o});e=(0,a.Rd)(),e=(0,i.H9)(e,t?m.wv.Complete:m.wv.Error),e=(0,i.fw)(e,s,{isUsernameAvailable:t}),(0,a.R3)(e)})()})),(0,a.Q6)("updatePublicLink",((e,t,n)=>{const{chatId:s}=(0,r.Bt)(e)||{};let o=s&&(0,r.Z1)(e,s);if(!s||!o)return;const{username:c}=n;(async()=>{if(e=(0,i.H9)(e,m.wv.InProgress),(0,a.R3)(e),(0,d.G9)(o)){if(o=await(0,P.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const n=await(0,P.t9)("setChatUsername",{chat:o,username:c});e=(0,a.Rd)(),e=(0,i.H9)(e,n?m.wv.Complete:m.wv.Error),e=(0,i.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e)})()})),(0,a.Q6)("updatePrivateLink",(e=>{const{chatId:t}=(0,r.Bt)(e)||{},n=t&&(0,r.Z1)(e,t);t&&n&&(0,P.t9)("updatePrivateLink",{chat:n})})),(0,a.Q6)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o}=n;(0,a.R3)((0,i.fw)(e,s,{editingInvite:o}))}));var x=n(7358);async function L(){const e=await(0,P.t9)("fetchChats",{limit:s.Ov,archived:!0,withPinned:!0,serverTimeOffset:(0,a.Rd)().serverTimeOffset});if(!e)return;let t=(0,a.Rd)();t=(0,i.eD)(t,(0,g.ee)(e.users,"id")),t=(0,i.zn)(t,e.userStatusesById),t=(0,i.GL)(t,(0,g.ee)(e.chats,"id")),t=(0,i.Mg)(t,"archived",e.chatIds),t=(0,i.vv)(t,"archived",e),(0,a.R3)(t)}async function O(){let e=(0,a.Rd)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:n}=e.contactList||{};if(!(n&&n.length||t&&t.length))return;const s=[...t||[],...n||[]].map((t=>(0,r.dy)(e,t))).filter(Boolean),o=await(0,P.t9)("fetchUsers",{users:s});if(!o)return;const{users:c,userStatusesById:d}=o;e=(0,a.Rd)(),e=(0,i.eD)(e,(0,g.ee)(c,"id")),e=(0,i.zn)(e,d),(0,a.R3)(e)}function U(e){return(0,P.t9)("fetchMessages",{chat:e,threadId:u._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(s.hT/2)+1),limit:s.hT})}(0,a.Q6)("sync",((e,t)=>{!async function(e){s.eM&&console.log(">>> START SYNC"),(0,a.R3)({...(0,a.Rd)(),isSyncing:!0}),await(0,P.t9)("fetchCurrentUser");const t=await async function(){var e;let t=(0,a.Rd)();const n=await(0,P.t9)("fetchChats",{limit:s.Ov,withPinned:!0,serverTimeOffset:t.serverTimeOffset,lastLocalServiceMessage:null===(e=(0,r.VF)(t))||void 0===e?void 0:e.message});if(!n)return;t=(0,a.Rd)();const{recentlyFoundChatIds:o}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:l}=t,m=[...o||[],...c||[],...l?[l]:[]],h=m.map((e=>(0,r.dy)(t,e))).filter(Boolean),f=m.map((e=>(0,r.Z1)(t,e))).filter(Boolean),{chatId:p}=(0,r.Bt)(t)||{};if(p){const e=(0,r.Z1)(t,p);if(e&&!m.includes(p)&&f.push(e),(0,d.YC)(p)){const e=(0,r.dy)(t,p);e&&!m.includes(p)&&h.push(e)}}return h.push(...n.users),f.push(...n.chats),t=(0,i.ps)(t,n.userStatusesById),t=(0,i.SL)(t,(0,g.ee)(f,"id")),t=(0,i.Mg)(t,"active",n.chatIds),t=(0,i.vv)(t,"active",n),Object.keys(n.draftsById).forEach((e=>{t=(0,i.pf)(t,e,u._f,"draft",n.draftsById[e])})),Object.keys(n.replyingToById).forEach((e=>{t=(0,i.pf)(t,e,u._f,"replyingToId",n.replyingToById[e])})),(0,a.R3)(t),p&&!t.chats.byId[p]&&(0,a.uC)().openChat({id:void 0}),h}();await async function(e){let t=!1,n=e||[],o=(0,a.Rd)();const{chatId:c,threadId:d}=(0,r.Bt)(o)||{},l=Object.keys(o.messages.byChatId).reduce(((e,t)=>{const n=(0,r.Ms)(o,t,u._f);return n&&(e[t]=n),e}),{});if(c){const e=await U(o.chats.byId[c]);o=(0,a.Rd)();const{chatId:l}=(0,r.Bt)(o)||{},m=d&&(0,r.tZ)(o,c,d);if(e&&l===c){const a=o.messages.byChatId[c],r=c===s.aw?o.serviceNotifications.map((({message:e})=>e)):[],l=[].concat(e.messages,r),h=(0,g.ee)(l,"id"),f=Object.keys(h).map(Number);if(o={...o,messages:{...o.messages,byChatId:{}}},o=(0,i.c_)(o,c,h),o=(0,i.xj)(o,c,u._f,f),o=(0,i.y9)(o,c,u._f,f),d&&m&&m.originChannelId){const{originChannelId:e}=m,t=o.messages.byChatId[e],n=await U(o.chats.byId[e]);if(n){const e=(0,g.ee)(n.messages,"id"),s=Object.keys(e).map(Number);o={...o,messages:{...o.messages,byChatId:{...o.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[u._f]:{...null==t?void 0:t.threadsById[u._f],listedIds:s,viewportIds:s,outlyingIds:void 0}}},[c]:{...o.messages.byChatId[c],threadsById:{...o.messages.byChatId[c].threadsById,[d]:{...null==a?void 0:a.threadsById[d],outlyingIds:void 0}}}}}}}}o=(0,i.GL)(o,(0,g.ee)(e.chats,"id")),o=(0,i.j6)(o,c,e.threadInfos),t=!0,n=Array.prototype.concat(n,e.users)}}t||(o={...o,messages:{...o.messages,byChatId:{}}}),Object.keys(l).forEach((e=>{o=(0,i.pf)(o,e,u._f,"draft",l[e])})),e?o=(0,i.s5)(o,(0,g.ee)(n,"id")):n&&(o=(0,i.eD)(o,(0,g.ee)(n,"id"))),(0,a.R3)(o);const{chatId:m,messageId:h}=o.audioPlayer;m&&h&&!(0,r.hj)(o,m,h)&&(0,a.uC)().closeAudioPlayer()}(t),(0,a.R3)({...(0,a.Rd)(),lastSyncTime:Date.now(),isSyncing:!1}),s.eM&&console.log(">>> FINISH SYNC"),e()}(t.afterSync)})),(0,a.Q6)("afterSync",(()=>{!async function(){s.eM&&console.log(">>> START AFTER-SYNC"),await Promise.all([O(),L()]),await(0,P.t9)("fetchCurrentUser"),(0,x.w)((0,r.A1)((0,a.Rd)())),s.eM&&console.log(">>> FINISH AFTER-SYNC")}()}));const F=(0,C.Ds)((e=>e()),500,!1,!0),$=(0,C.P2)((e=>e()),500,!1);function D(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,a.Q6)("loadFullUser",((e,t,n)=>{const{userId:a}=n,s=(0,r.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s;F((()=>(0,P.t9)("fetchFullUser",{id:o,accessHash:i})))})),(0,a.Q6)("loadUser",((e,t,n)=>{const{userId:s}=n,o=(0,r.dy)(e,s);o&&(async()=>{const t=await(0,P.t9)("fetchUsers",{users:[o]});if(!t)return;const{users:n,userStatusesById:s}=t;e=(0,a.Rd)(),e=(0,i.eD)(e,(0,g.ee)(n,"id")),(0,a.R3)((0,i.ps)(e,{...e.users.statusesById,...s})),(0,a.R3)(e)})()})),(0,a.Q6)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,f.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,P.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let s=(0,a.Rd)();s=(0,i.Sh)(s,(0,g.ee)(n,"id")),s={...s,topPeers:{...s.topPeers,userIds:t,lastRequestedAt:(0,f.b)(s.serverTimeOffset)}},(0,a.R3)(s)}()})),(0,a.Q6)("loadContactList",(()=>{!async function(){const e=await(0,P.t9)("fetchContactList");if(!e)return;let t=(0,i.Sh)((0,a.Rd)(),(0,g.ee)(e.users,"id"));t=(0,i.fZ)(t,(0,g.ee)(e.chats,"id"));const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),o=e.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,a.R3)({...t,contactList:{userIds:o.map((e=>e.id))}})}()})),(0,a.Q6)("loadCurrentUser",(()=>{(0,P.t9)("fetchCurrentUser")})),(0,a.Q6)("loadCommonChats",(e=>{var t;const{chatId:n}=(0,r.Bt)(e)||{},s=n?(0,r.dy)(e,n):void 0;!s||(0,d.cS)(s)||null!==(t=s.commonChats)&&void 0!==t&&t.isFullyLoaded||(async()=>{var t,n;const o=null===(t=s.commonChats)||void 0===t?void 0:t.maxId,r=await(0,P.t9)("fetchCommonChats",s.id,s.accessHash,o);if(!r)return;const{chats:c,chatIds:d,isFullyLoaded:l}=r;e=(0,a.Rd)(),c.length&&(e=(0,i.fZ)(e,(0,g.ee)(c,"id"))),e=(0,i.Nq)(e,s.id,{commonChats:{maxId:d.length?d[d.length-1]:"0",ids:(0,g.Tw)(((null===(n=s.commonChats)||void 0===n?void 0:n.ids)||[]).concat(d)),isFullyLoaded:l}}),(0,a.R3)(e)})()})),(0,a.Q6)("updateContact",((e,t,n)=>{const{userId:s,isMuted:o,firstName:c,lastName:d}=n;!async function(e,t,n,s){const o=(0,a.Rd)(),c=(0,r.dy)(o,e);if(!c)return;let d;if((0,a.uC)().updateChatMutedState({chatId:e,isMuted:t}),(0,a.R3)((0,i.H9)((0,a.Rd)(),m.wv.InProgress)),c.phoneNumber)d=await(0,P.t9)("updateContact",{phone:c.phoneNumber,firstName:n,lastName:s});else{const{id:e,accessHash:t}=c;d=await(0,P.t9)("addContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:s})}d&&(0,a.R3)((0,i.Nq)((0,a.Rd)(),c.id,{firstName:n,lastName:s})),(0,a.R3)((0,i.H9)((0,a.Rd)(),m.wv.Complete))}(s,o,c,d)})),(0,a.Q6)("deleteContact",((e,t,n)=>{const{userId:s}=n;!async function(e){const t=(0,a.Rd)(),n=(0,r.dy)(t,e);if(!n)return;const{id:s,accessHash:o}=n;await(0,P.t9)("deleteContact",{id:s,accessHash:o})}(s)})),(0,a.Q6)("loadProfilePhotos",((e,t,n)=>{const{profileId:s}=n,o=(0,d.YC)(s),c=o?(0,r.dy)(e,s):void 0,l=o?void 0:(0,r.Z1)(e,s);(c||l)&&(async()=>{const e=await(0,P.t9)("fetchProfilePhotos",c,l);if(!e||!e.photos)return;let t=(0,a.Rd)();o?t=(0,i.Nq)(t,s,{photos:e.photos}):(t=(0,i.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,i.a4)(t,s,{photos:e.photos})),(0,a.R3)(t)})()})),(0,a.Q6)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;s&&$((()=>{!async function(e){const t=await(0,P.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=n.userSearch.query;if(!t||!s||e!==s)return void(0,a.R3)((0,i.Q3)(n,!1));const{localUsers:o,globalUsers:r}=t;let c,d;o.length&&(n=(0,i.Sh)(n,(0,g.ee)(o,"id")),c=o.map((({id:e})=>e))),r.length&&(n=(0,i.Sh)(n,(0,g.ee)(r,"id")),d=r.map((({id:e})=>e))),n=(0,i.Q3)(n,!1),n=(0,i.Lm)(n,{localUserIds:c,globalUserIds:d}),(0,a.R3)(n)}(s)}))})),(0,a.Q6)("addContact",((e,t,n)=>{const{userId:a}=n,s=(0,r.dy)(e,a);s&&(0,P.t9)("addContact",(0,g.ei)(s,["id","accessHash","firstName","lastName","phoneNumber"]))}));const Q=(0,C.Ds)((e=>e()),500,!1);async function q(e,t,n,a,s){await(0,P.t9)("sendMessage",{chat:e,text:n,replyingTo:a,sendAs:s})}(0,a.Q6)("clickInlineButton",((e,t,n)=>{const{button:o}=n;switch(o.type){case"command":t.sendBotCommand({command:o.value});break;case"url":o.value.match(s.FS)||o.value.match(s.g$)?t.openTelegramLink({url:o.value}):t.toggleSafeLinkModal({url:o.value});break;case"callback":{const t=(0,r.jr)(e);if(!t)return;!async function(e,t,n){const s=await(0,P.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n});if(!s)return;const{showDialog:o,showNotification:i,toggleSafeLinkModal:r}=(0,a.uC)(),{message:c,alert:d,url:l}=s;d?o({data:{message:c||"Error"}}):c?i({message:c}):l&&r({url:l})}(t,o.messageId,o.value);break}case"requestPoll":t.openPollModal();break;case"requestSelfContact":{const n=e.currentUserId?(0,r.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"buy":{const n=(0,r.jr)(e),{messageId:a,value:s}=o;if(!n)return;s?t.getReceipt({receiptMessageId:s,chatId:n.id,messageId:a}):(t.getPaymentForm({chat:n,messageId:a}),t.setInvoiceMessageInfo((0,r.hj)(e,n.id,a)),t.openPaymentModal({chatId:n.id,messageId:a}));break}}})),(0,a.Q6)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s}=n,{currentUserId:o}=e,i=s?(0,r.Z1)(e,s):(0,r.jr)(e),c=(0,r.Bt)(e);if(!o||!i||!c)return;const{threadId:d}=c;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:d,value:!1}),q(i,0,a,(0,r.Yy)(e,i.id,d),(0,r._5)(e,s))})),(0,a.Q6)("restartBot",((e,t,n)=>{const{chatId:s}=n,{currentUserId:o}=e,c=(0,r.jr)(e),d=o&&(0,r.IK)(e,s);o&&c&&d&&(async()=>{await(0,P.t9)("unblockContact",d.id,d.accessHash)&&((0,a.R3)((0,i.rB)((0,a.Rd)(),d.id)),q(c,0,"/start",void 0,(0,r._5)(e,s)))})()})),(0,a.Q6)("loadTopInlineBots",(e=>{const{lastRequestedAt:t}=e.topInlineBots;t&&(0,f.b)(e.serverTimeOffset)-t<60||(async()=>{const t=await(0,P.t9)("fetchTopInlineBots");if(!t)return;const{ids:n,users:s}=t;let o=(0,a.Rd)();o=(0,i.Sh)(o,(0,g.ee)(s,"id")),o={...o,topInlineBots:{...o.topInlineBots,userIds:n,lastRequestedAt:(0,f.b)(e.serverTimeOffset)}},(0,a.R3)(o)})()})),(0,a.Q6)("queryInlineBot",((e,t,n)=>{const{chatId:s,username:o,query:c,offset:d}=n;(async()=>{let t=e.inlineBots.byUsername[o];if(!1!==t){if(void 0===t){const{user:n,chat:s}=await(0,P.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!n||!s)return void(0,a.R3)(D(e,o,!1));e=(0,i.Sh)(e,{[n.id]:n}),e=(0,i.fZ)(e,{[s.id]:s}),t={id:n.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=D(e,o,t),(0,a.R3)(e)}(c!==t.query||t.canLoadMore)&&Q((()=>{!async function({username:e,inlineBotData:t,chatId:n,query:s,offset:o}){let i=(0,a.Rd)();const c=(0,r.dy)(i,t.id),d=(0,r.Z1)(i,n);if(!c||!d)return;const l=t.query!==s;i=j(i,!0),i=D(i,e,{...t,query:s,...l&&{offset:void 0,results:[]}}),(0,a.R3)(i);const u=await(0,P.t9)("fetchInlineBotResults",{bot:c,chat:d,query:s,offset:l?void 0:o}),m=i.inlineBots.byUsername[e];if(i=j((0,a.Rd)(),!1),!u||!m||s!==m.query)return void(0,a.R3)(i);const h=new Set((m.results||[]).map((e=>e.id))),g=u.results.filter((e=>!h.has(e.id)));i=D(i,e,{...m,help:u.help,...g.length&&{isGallery:u.isGallery},...u.switchPm&&{switchPm:u.switchPm},canLoadMore:u.results.length>0&&Boolean(u.nextOffset),results:""===m.offset||m.offset===u.nextOffset?u.results:(m.results||[]).concat(g),offset:g.length?u.nextOffset:""}),(0,a.R3)(i)}({username:o,inlineBotData:t,chatId:s,query:c,offset:d})}))}})()})),(0,a.Q6)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s}=n,o=(0,r.Bt)(e);if(!o||!a)return;const{chatId:i,threadId:c}=o,d=(0,r.Z1)(e,i);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i,threadId:c,value:!1}),(0,P.t9)("sendInlineBotResult",{chat:d,resultId:a,queryId:s,replyingTo:(0,r.Yy)(e,i,c),sendAs:(0,r._5)(e,i)})})),(0,a.Q6)("resetInlineBot",((e,t,n)=>{const{username:s}=n;let o=e.inlineBots.byUsername[s];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,a.R3)(D(e,s,o)))})),(0,a.Q6)("startBot",((e,t,n)=>{const{botId:a,param:s}=n,o=(0,r.dy)(e,a);o&&(async()=>{await(0,P.t9)("startBot",{bot:o,startParam:s})})()})),n(9667),(0,a.Q6)("loadPasswordInfo",(()=>{(async()=>{const e=await(0,P.t9)("getPasswordInfo");if(!e)return;let t=(0,a.Rd)();t=(0,i.BI)(t,{hasPassword:e.hasPassword}),t=(0,i.IE)(t,{hint:e.hint}),(0,a.R3)(t)})()})),(0,a.Q6)("checkPassword",((e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("checkPassword",s);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&o()})()})),(0,a.Q6)("clearPassword",((e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("clearPassword",s);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&o()})()})),(0,a.Q6)("updatePassword",((e,t,n)=>{const{currentPassword:s,password:o,hint:r,email:c,onSuccess:d}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updatePassword",s,o,r,c);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&d()})()})),(0,a.Q6)("updateRecoveryEmail",((e,t,n)=>{const{currentPassword:s,email:o,onSuccess:r}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updateRecoveryEmail",s,o);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()})),(0,a.Q6)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,P.t9)("provideRecoveryEmailCode",a)})),(0,a.Q6)("clearTwoFaError",(e=>(0,i.IE)(e,{error:void 0}))),(0,a.Q6)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:s,saveInfo:o}=n,c=(0,r.gx)(e),d=c&&(0,r.Z1)(e,c),l=(0,r.Mz)(e);d&&l&&async function(e,t,n,s){const o=await(0,P.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:n,shouldSave:s});if(!o)return;const{id:r,shippingOptions:c}=o;if(!r)return;let d=(0,i.vT)((0,a.Rd)(),r);c?(d=(0,i.TM)(d,c),d=(0,i.Q$)(d,m.KB.Shipping)):d=(0,i.Q$)(d,m.KB.PaymentInfo),(0,a.R3)(d)}(d,l,s,o)})),(0,a.Q6)("getPaymentForm",((e,t,n)=>{const{chat:s,messageId:o}=n;s&&o&&async function(e,t){const n=await(0,P.t9)("getPaymentForm",{chat:e,messageId:t});if(!n)return;let s=(0,i._7)((0,a.Rd)(),n),o=m.KB.PaymentInfo;s.payment.invoice&&(s.payment.invoice.shippingAddressRequested||s.payment.invoice.nameRequested||s.payment.invoice.phoneRequested||s.payment.invoice.emailRequested)&&(o=m.KB.ShippingInfo),s=(0,i.Q$)(s,o),(0,a.R3)(s)}(s,o)})),(0,a.Q6)("getReceipt",((e,t,n)=>{const{receiptMessageId:s,chatId:o,messageId:c}=n,d=o&&(0,r.Z1)(e,o);c&&s&&d&&async function(e,t,n){const s=await(0,P.t9)("getReceipt",e,n);if(!s)return;let o=(0,a.Rd)();const c=(0,r.hj)(o,e.id,t);o=(0,i.Dq)(o,s,c),(0,a.R3)(o)}(d,c,s)})),(0,a.Q6)("clearPaymentError",(e=>{(0,a.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,a.Q6)("clearReceipt",(e=>{(0,a.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,a.Q6)("sendCredentialsInfo",((e,t,n)=>{const s=(0,r.$$)(e);if(!s)return;const{credentials:o}=n,{data:c}=o;!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}),s=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 s.json();if(o.error){const e=(0,d.Ow)(o.error),t=(0,a.Rd)();return void(0,a.R3)({...t,payment:{...t.payment,error:{...e}}})}let r=(0,i.QH)((0,a.Rd)(),{type:o.type,id:o.id});r=(0,i.Q$)(r,m.KB.Checkout),(0,a.R3)(r)}(c,s)})),(0,a.Q6)("sendPaymentForm",((e,t,n)=>{const{shippingOptionId:s,saveCredentials:o}=n,c=(0,r.gx)(e),d=c&&(0,r.Z1)(e,c),l=(0,r.Mz)(e),u=(0,r.eh)(e),m=(0,r.sp)(e),h=(0,r.$$)(e),g=(0,r.i3)(e);d&&l&&h&&u&&async function(e,t,n,s,o,r){if(await(0,P.t9)("sendPaymentForm",{chat:e,messageId:t,formId:n,credentials:s,requestedInfoId:o,shippingOptionId:r})){const e=(0,i.bp)((0,a.Rd)());(0,a.R3)((0,i.WY)(e))}}(d,l,u,{save:o,data:g},m,s)})),(0,a.Q6)("setPaymentStep",((e,t,n={})=>(0,i.Q$)(e,n.step||m.KB.ShippingInfo))),(0,a.Q6)("setInvoiceMessageInfo",((e,t,n)=>(0,i.nA)(e,n)));var G=n(647),H=n(3495);const _=728,z=424,V=288;var Y=n(3858);function X(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=Y.Z.get().width)>s._m?Math.min(Math.max(.25*n,V),.33*n):n>s.ks?Math.min(Math.max(.33*n,V),.4*n):z):0);var n}(0,a.Q6)("loadAvailableReactions",(()=>{(async()=>{const e=await(0,P.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&G.he(`sticker${e.aroundAnimation.id}`,u.IU.Lottie),e.centerIcon&&G.he(`sticker${e.centerIcon.id}`,u.IU.Lottie)})),(0,a.R3)({...(0,a.Rd)(),availableReactions:e}))})()})),(0,a.Q6)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:o,localEffect:i,startSize:r,isReversed:c}=n;return{...e,activeEmojiInteraction:{animatedEffect:a||i,x:X(e,s),y:o,startSize:r,isReversed:c}}})),(0,a.Q6)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:o,interactions:i,localEffect:c,x:d,y:l,startX:u,startY:m,startSize:h}=n,g=(0,r.Z1)(e,s);if(g&&(o||c)&&((0,P.t9)("sendEmojiInteraction",{chat:g,messageId:a,emoticon:o||(0,r.ji)(c),timestamps:i}),e.activeEmojiInteraction))return{...e,activeEmojiInteraction:{...e.activeEmojiInteraction,endX:X(e,d),endY:l,...u&&{x:X(e,u)},...m&&{y:m},...h&&{startSize:h}}}})),(0,a.Q6)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,x:o,y:i}=n,c=(0,r.q6)(e,a);c&&t.sendReaction({chatId:a,messageId:s,reaction:c,x:o,y:i})})),(0,a.Q6)("sendReaction",((e,t,n)=>{var a,o;const{chatId:i,messageId:c}=n;let{reaction:d}=n;const l=(0,r.Z1)(e,i),u=(0,r.hj)(e,i,c);if(!l||!u)return;null!==(a=u.reactions)&&void 0!==a&&null!==(o=a.results)&&void 0!==o&&o.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,P.t9)("sendReaction",{chat:l,messageId:c,reaction:d});const{animationLevel:m}=e.settings.byKey;return m===s.zy&&(e={...e,activeReactions:{...d?e.activeReactions:(0,g.CE)(e.activeReactions,[c]),...d&&{[c]:{reaction:d,messageId:c}}}}),function(e,t,n,a){const{reactions:s}=(0,r.hj)(e,t,n)||{};if(!s)return e;let o=s.results.map((e=>e.reaction===a?{...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}=s;if(a&&!o.some((e=>e.reaction===a))){const{currentUserId:t}=e;o=[...o,{reaction:a,isChosen:!0,count:1}],s.canSeeList&&(i=[...i||[],{userId:t,reaction:a}])}return(0,H.cY)(e,t,n,{reactions:{...s,results:o,recentReactions:i}})}(e,i,c,d)})),(0,a.Q6)("openChat",(e=>({...e,activeReactions:{}}))),(0,a.Q6)("stopActiveReaction",((e,t,n)=>{var a;const{messageId:s,reaction:o}=n;return(null===(a=e.activeReactions[s])||void 0===a?void 0:a.reaction)!==o?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[s])}})),(0,a.Q6)("setDefaultReaction",((e,t,n)=>{const{reaction:s}=n;(async()=>{await(0,P.t9)("setDefaultReaction",{reaction:s})&&(e=(0,a.Rd)(),(0,a.R3)({...e,appConfig:{...e.appConfig,defaultReaction:s}}))})()})),(0,a.Q6)("stopActiveEmojiInteraction",(e=>({...e,activeEmojiInteraction:void 0}))),(0,a.Q6)("loadReactors",((e,t,n)=>{var s;const{chatId:o,messageId:c,reaction:d}=n,l=(0,r.Z1)(e,o),u=(0,r.hj)(e,o,c);if(!l||!u)return;const m=null===(s=u.reactors)||void 0===s?void 0:s.nextOffset;(async()=>{var t,n;const s=await(0,P.t9)("fetchMessageReactionsList",{reaction:d,chat:l,messageId:c,offset:m});if(!s)return;e=(0,a.Rd)(),null!==(t=s.users)&&void 0!==t&&t.length&&(e=(0,i.Sh)(e,(0,g.ee)(s.users,"id")));const{nextOffset:r,count:h,reactions:f}=s;(0,a.R3)((0,i.cY)(e,o,c,{reactors:{nextOffset:r,count:h,reactions:[...(null===(n=u.reactors)||void 0===n?void 0:n.reactions)||[],...f]}}))})()})),(0,a.Q6)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,r.Z1)(e,s);o&&(0,P.t9)("fetchMessageReactions",{ids:a,chat:o})})),(0,a.Q6)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:a,emoticon:s,x:o,y:i,startSize:c,isReversed:d}=n,l=(0,r.Z1)(e,a);if(l&&e.activeEmojiInteraction)return(0,P.t9)("sendWatchingEmojiInteraction",{chat:l,emoticon:s}),{...e,activeEmojiInteraction:{...e.activeEmojiInteraction,x:X(e,o),y:i,startSize:c,isReversed:d}}})),n(4907);var K=n(8406);const W=(0,C.P2)((e=>e()),500,!0);function J(e,t){const n=typeof e;if(n!==typeof t)return!1;if("object"!==n)return e===t;const a=Array.isArray(e);if(a!==Array.isArray(t))return!1;if(a){const n=e,a=t;return n.length===a.length&&n.every(((e,t)=>J(e,a[t])))}const s=e,o=t;return Object.keys(s).every((e=>J(s[e],o[e])))}(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{n.noTopChatsRequest||(0,r.N)(e,n.id)||t.loadTopChats();const s=(0,i.a4)(e,n.id,n.chat,n.newProfilePhoto);(0,a.R3)(s),W((()=>(0,x.w)((0,r.A1)((0,a.Rd)())))),n.chat.id&&(0,K.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId});break}case"updateChatJoin":{const s=(0,r.Ek)(e,n.id);if(!s)break;e=(0,i.B1)(e,s,[n.id]),e=(0,i.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const o=(0,r.Z1)(e,n.id);o&&t.requestChatUpdate({chatId:o.id});break}case"updateChatLeave":(0,a.R3)((0,i.Dd)(e,n.id));break;case"updateChatInbox":(0,a.R3)((0,i.a4)(e,n.id,n.chat)),W((()=>(0,x.w)((0,r.A1)((0,a.Rd)()))));break;case"updateChatTypingStatus":{const{id:t,typingStatus:s}=n;(0,a.R3)((0,i.a4)(e,t,{typingStatus:s})),setTimeout((()=>{const e=(0,a.Rd)(),n=(0,r.Z1)(e,t);n&&s&&n.typingStatus&&n.typingStatus.timestamp===s.timestamp&&(0,a.R3)((0,i.a4)(e,t,{typingStatus:void 0}))}),6e3);break}case"newMessage":{const{message:s}=n,{chatId:o,threadId:c,type:d}=(0,r.Bt)(e)||{};if(s.senderId===e.currentUserId&&!s.isFromScheduled)return;const l=(0,r.Z1)(e,n.chatId);if(!l)return;"thread"===d&&c===u._f&&n.chatId===o?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):(0,a.R3)((0,i.a4)(e,n.chatId,{unreadCount:l.unreadCount?l.unreadCount+1:1,...n.message.hasUnreadMention&&{unreadMentionsCount:l.unreadMentionsCount?l.unreadMentionsCount+1:1}})),(0,x.w)((0,r.A1)((0,a.Rd)())),(0,K.zP)({chat:l,message:s});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;t.forEach((t=>{const a="channelId"in n?n.channelId:(0,r.X5)(e,t),s=(0,r.Z1)(e,a);null!=s&&s.unreadMentionsCount&&(e=(0,i.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1}))})),(0,a.R3)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=n,s=e.chats.byId[n.id];if(!s)return;(0,a.R3)((0,i.a4)(e,n.id,{fullInfo:{...s.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:o}=n,i=o===s.WS?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}},(0,a.R3)(e);break}case"updateChatPinned":{const{id:t,isPinned:o}=n,i=(0,r.Ek)(e,t);if(i){const{[i]:n}=e.chats.orderedPinnedIds;let a=n||[];if(o){if(!a.includes(t)){if("active"===i&&a.length>=s.EG){const t=e.chats.listIds.active;a=a.filter((e=>t&&t.includes(e)))}a=[t,...a]}}else a=a.filter((e=>e!==t));e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:a.length?a:void 0}}}}(0,a.R3)(e);break}case"updateChatListType":{const{id:t,folderId:s}=n;(0,a.R3)((0,i.Pi)(e,t,s));break}case"updateChatFolder":{const{id:t,folder:s}=n,{byId:o,orderedIds:i}=e.chatFolders,r=s?{...o,[t]:s}:(0,g.ei)(o,Object.keys(o).map(Number).filter((e=>e!==t))),c=s?i&&i.includes(t)?i:[...i||[],t]:i?i.filter((e=>e!==t)):void 0;(0,a.R3)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=n;(0,a.R3)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=n;(0,a.R3)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{var o;const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:r,deletedMemberId:c}=n;if(!t)return;let d=!1,l=null!==(o=t.fullInfo)&&void 0!==o&&o.members?[...t.fullInfo.members]:[];if(s)l=s,d=!0;else if(r)l.length&&l.some((e=>e.userId===r.userId))||(l.push(r),d=!0);else if(l.length&&c){const e=l.findIndex((e=>e.userId===c));e>-1&&(l.slice(e,1),d=!0)}if(d){const s=l.filter((({isOwner:e,isAdmin:t})=>e||t));(0,a.R3)((0,i.a4)(e,n.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:s}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,o=e.chats.byId[t];null!=o&&o.photos&&(0,a.R3)((0,i.a4)(e,t,{photos:o.photos.filter((e=>!s.includes(e.id)))}));break}case"draftMessage":{const{chatId:t,formattedText:s,date:o,replyingToId:r}=n;e.chats.byId[t]&&(e=(0,i.pf)(e,t,u._f,"draft",s),e=(0,i.pf)(e,t,u._f,"replyingToId",r),e=(0,i.a4)(e,t,{draftDate:o}),(0,a.R3)(e));break}case"showInvite":{const{data:e}=n;t.showDialog({data:e});break}}}));const ee=350;function te(e,t,n,a,s=!1){const o=s?(0,r.Tm)(e,t,n):(0,r.hj)(e,t,n);if(o&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,d.qp)(o);e&&a.content.photo?(a.content.photo.blobUrl=e.blobUrl,a.content.photo.thumbnail=e.thumbnail):t&&a.content.video?a.content.video.blobUrl=t.blobUrl:n&&a.content.sticker?a.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:s&&a.content.document&&(a.content.document.previewBlobUrl=s.previewBlobUrl)}return s?(0,i.P4)(e,t,n,a):(0,i.cY)(e,t,n,a)}function ne(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,r.Db)(e,s,n)||{};if(!o&&n.replyToMessageId){const o=(0,r.hj)(e,s,n.replyToMessageId);o?e=(0,i.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function ae(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,firstMessageId:c}=(0,r.Db)(e,s,n)||{},l=(0,r.Z1)(e,s),m=(null==l?void 0:l.unreadCount)&&!(0,r.gb)(e,s,u._f);if(e=ne(e,t,n),o&&(!c&&(0,d.CI)(n)||(e=(0,i.xj)(e,s,o.threadId,[a]),(0,r.b9)(e,s,o.threadId)&&(e=(0,i.$S)(e,s,o.threadId,a),c||(e=(0,i.pf)(e,s,o.threadId,"firstMessageId",n.id)))),e=(0,i.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id,messagesCount:o.messagesCount+1})),m)return e;if(e=(0,i.xj)(e,s,u._f,[a]),(0,r.b9)(e,s,u._f)){const t=(0,r.It)(e,s,u._f),n=(0,i.$S)(e,s,u._f,a),o=(0,r.Cb)(n,s,u._f);t&&!o.includes(t)||(e=n)}return e}function se(e,t,n,a=!1){var s;const{chats:o}=e,r=null===(s=o.byId[t])||void 0===s?void 0:s.lastMessage;return!r||a||r.id===n.id||r.id===n.previousLocalId||n.id>r.id?(0,i.a4)(e,t,{lastMessage:n}):e}function oe(e,t){const n=(0,r.Zw)(e,t),a=(0,r.gb)(e,t,u._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function ie(e,t,n,s){if(e){t.forEach((t=>{const n=oe(s=(0,i.cY)(s,e,t,{isDeleting:!0}),e);n&&(s=se(s,e,n,!0))})),(0,a.R3)(s),n.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const a=(0,r.hj)(s,e,t);if(!a)return;s=ne(s,n,a,!0);const{threadInfo:i}=(0,r.Db)(s,e,a)||{};i&&o.push(i.threadId)})),(0,a.R3)(s),void setTimeout((()=>{(0,a.R3)((0,i.K4)((0,a.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),ee)}const o=[];t.forEach((e=>{const t=(0,r.X5)(s,e);if(t){o.push(t);const n=oe(s=(0,i.cY)(s,t,e,{isDeleting:!0}),t);n&&(s=se(s,t,n,!0)),setTimeout((()=>{(0,a.R3)((0,i.K4)((0,a.Rd)(),t,[e]))}),ee)}})),(0,a.R3)(s),(0,g.Tw)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:o,id:c,message:l,shouldForceReply:m}=n;e=ae(e=te(e,o,c,l),t,l),l.threadInfo&&(e=(0,i.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),(0,a.R3)(e);const h=(0,r.hj)(e,o,c);if((0,r.hg)(e,o,l)){var s;if(l.isOutgoing&&(null===(s=l.content)||void 0===s||!s.action)){const n=(0,r.Bt)(e);n&&t.focusMessage({chatId:o,threadId:n.threadId,messageId:l.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,r.Db)(e,o,l)||{};n&&t.requestThreadInfoUpdate({chatId:o,threadId:n.threadId}),(0,d.CI)(l)||setTimeout((()=>{let e=(0,a.Rd)();m&&(e=(0,i.pf)(e,o,u._f,"replyingToId",c)),(0,a.R3)(se(e,o,h))}),ee)}else(0,a.R3)(se((0,a.Rd)(),o,h));(0,r.N)(e,o)||t.loadTopChats();break}case"updateStartEmojiInteraction":{const{chatId:t}=(0,r.Bt)(e)||{};if(e.activeEmojiInteraction||t!==n.id)return;const s=(0,r.CP)(e,n.emoji);e={...e,activeEmojiInteraction:{animatedEffect:s?(0,r.cu)(s):n.emoji,messageId:n.messageId}},(0,a.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:s,message:o}=n;e=te(e,t,s,o,!0);const c=(0,r.qy)(e,t)||[];e=(0,i.pf)(e,t,u._f,"scheduledIds",(0,g.Tw)([...c,s])),(0,a.R3)(e);break}case"updateMessage":{var o,c;const{chatId:s,id:d,message:l}=n;if(!(0,r.hj)(e,s,d))return;e=te(e,s,d,l);const m=(0,r.hj)(e,s,d);l.threadInfo&&(e=(0,i.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),e=se(e,s,m),(0,a.R3)(e);const h=(0,r.Z1)(e,s);h&&!l.isOutgoing&&(null===(o=h.lastMessage)||void 0===o?void 0:o.id)===l.id&&(0,r.xo)(e,h)&&(0,r.hg)(e,s,l)&&(0,r.b9)(e,s,(null===(c=l.threadInfo)||void 0===c?void 0:c.threadId)||u._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n;if(!(0,r.Tm)(e,t,s))return;e=te(e,t,s,o,!0);const c=Object.keys((0,r.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,i.pf)(e,t,u._f,"scheduledIds",c),(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:c}=n;e=ae(e,t,c);const d=(0,r.hj)(e,s,o);e=(0,i.K4)(e,s,[o]),c.isScheduled&&(e=(0,i.bV)(e,s,[o])),e=(0,i.cY)(e,s,c.id,{...d,...c,previousLocalId:o});const l=(0,r.hj)(e,s,c.id);e=se(e,s,l);const u=(0,r.Db)(e,s,c);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:c.id}),e=(0,i.pf)(e,s,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:c.id,lastReadInboxMessageId:c.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,c=(0,r.qy)(e,t)||[];e=(0,i.pf)(e,t,u._f,"scheduledIds",[...c,o.id]);const d=(0,r.Tm)(e,t,s);e=(0,i.bV)(e,t,[s]),e=(0,i.P4)(e,t,o.id,{...d,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,c=(0,r.KB)(e,t)||[],d=s?[...c,...o].sort(((e,t)=>t-e)):c.filter((e=>!o.includes(e)));(0,a.R3)((0,i.pf)(e,t,u._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:s,threadInfo:o,firstMessageId:c}=n,d={...(0,r.tZ)(e,t,s),...o};if(!d.threadId)return;e=(0,i.Xg)(e,t,s,d),c&&(e=(0,i.pf)(e,t,s,"firstMessageId",c)),(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,r.Zw)(e,s);o&&!(0,d.YC)(s)&&(e=(0,i.K4)(e,s,Object.keys(o).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;ie(s,a,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,i.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,i.bV)((0,a.Rd)(),e,t);const n=(0,r.Fn)(s,e);s=(0,i.pf)(s,e,u._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),ee))}(s,t,0,e);break}case"deleteHistory":{const{chatId:a}=n,s=e.messages.byChatId[a];s?ie(a,Object.keys(s.byId).map(Number),t,e):t.requestChatUpdate({chatId:a});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,r.X5)(e,t);n&&(e=(0,i.cY)(e,n,t,s))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:s,messageUpdate:o}=n;s.forEach((n=>{e=(0,i.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,r.ZB)(e,t);if(null!=o&&o.content.poll){const t={...o.content.poll,...s},{results:n}=t.results||{};if(n&&!n.some((e=>e.isChosen))){const{results:e}=o.content.poll.results,a=e&&e.filter((e=>e.isChosen));a&&a.forEach((e=>{const a=n.findIndex((t=>t.option===e.option));a>=0&&(t.results.results[a].isChosen=!0)}))}(0,a.R3)((0,i.cY)(e,o.chatId,o.id,{content:{...o.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:o}=n,c=(0,r.ZB)(e,t);if(!c||!c.content.poll||!c.content.poll.results)break;const{poll:d}=c.content,{recentVoterIds:l,totalVoters:u,results:m}=d.results,h=l?[...l]:[],g=u?u+1:1,f=m?[...m]:[];h.push(s),o.forEach((t=>{const n=f.find((e=>e.option===t)),a=f.findIndex((e=>e.option===t)),o=n?{...n}:{option:t,votersCount:0};o.votersCount+=1,s===e.currentUserId&&(o.isChosen=!0),a?f[a]=o:f.push(o)})),(0,a.R3)((0,i.cY)(e,c.chatId,c.id,{content:{...c.content,poll:{...d,results:{...d.results,recentVoterIds:h,totalVoters:g,results:f}}}}));break}case"updateServiceNotification":{const{message:a}=n;(0,r.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:o}=n,c=(0,r.hj)(e,t,s),d=null==c?void 0:c.reactions;if(d&&J(o,d))return;(0,a.R3)((0,i.cY)(e,t,s,{reactions:n.reactions}));break}}}));const re=(0,C.P2)((function(){const e=(0,a.Rd)();(0,a.R3)((0,i.ps)(e,{...e.users.statusesById,...ce})),ce={}}),3e3,!0);let ce={};(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,i.GK)(e,n.id);case"updateUser":return(0,i.Nq)(e,n.id,n.user);case"updateUserStatus":return a=n.userId,s=n.status,ce[a]=s,void re();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n,s=e.users.byId[t];if(!s)return;return(0,i.Nq)(e,t,{fullInfo:{...s.fullInfo,...a}})}}var a,s})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateStickerSet":return(0,i.Rg)(e,n.id,n.stickerSet)}})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,i.O4)((0,a.Rd)(),n.id):(0,i.rB)((0,a.Rd)(),n.id);case"updateResetContactList":(0,a.R3)({...(0,a.Rd)(),contactList:{userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[n.key]=n.rules}})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,i.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:s,isSilent:o,shouldShowPreviews:r}=n;e.chats.byId[t]&&(e=(0,i.a4)(e,t,{isMuted:s})),(0,a.R3)((0,i.aK)(e,t,{isMuted:s,isSilent:o,shouldShowPreviews:r}));break}}})),(0,a.Q6)("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 de=n(4446);(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":return"discarded"===n.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,de.dc)(e,n.call.id):(0,de.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,r.Z1)(e,n.chatId);return t&&(e=(0,i.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:s,nextOffset:o}=n,{currentUserId:i}=e;return e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,de.B6)(e,t,n.id,n,!!o||i===n.id))})),o&&(e=(0,de.AH)(e,t,{nextOffset:o})),e}}}));var le=n(8674),ue=n(6752),me=n(1279),he=n(3551),ge=n(3227),fe=n(1212),pe=n(5332);function ve(e){(0,o.d4)((()=>(0,C.Gq)(e)),[e])}var Ie=n(9290);const ye=document.querySelector('meta[name="viewport"]'),Ze=(null==ye?void 0:ye.getAttribute("content"))||"";function Pe(e){e.preventDefault()}var Ce=n(6590),we=n(3989),be=n(7529),Ee=n(3455),Se=n(706),Me=n(2255),Re=n(9107),ke=n(6917),Te=n(7926),Ne=n(1622);let Be;function Ae(e,t,n,a,s){let i,r,c;return i=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?Be.syncing:Be.online:Be.waitingForNetwork,r=i===Be.online?"none":a?"middleHeader":s?"minimized":"overlay",i===Be.waitingForNetwork?c=e("WaitingForNetwork"):i===Be.syncing&&(c=e("Updating")),"middleHeader"===r&&(c=c.toLowerCase().replace(/\.+$/,"")),{connectionStatus:i,connectionStatusPosition:r,connectionStatusText:c}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(Be||(Be={}));var xe=n(3106),Le=n(8964),Oe=n(231),Ue=n(9589),Fe=n(9187),$e=n(3321),De=n(126),je=n(9204);const Qe=(0,o.X$)((({connectionStatus:e,connectionStatusText:t,onClick:n})=>{const a=(0,Re.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:n},o.ZP.createElement(je.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(Me.Z,{activeKey:e,name:"slide-fade"},(()=>t))),o.ZP.createElement(Oe.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon-close"})))})),qe=[0,1,2],Ge=(0,o.X$)((0,a.c$)((e=>{const{query:t,fetchingStatus:n,chatId:a,date:s}=e.globalSearch,{currentUserId:o,connectionState:i,isSyncing:c}=e,{byId:d}=e.chats,{isConnectionStatusMinimized:l,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:o,chatsById:d,globalSearchChatId:a,searchDate:s,theme:(0,r.Pu)(e),animationLevel:u,connectionState:i,isSyncing:c,isConnectionStatusMinimized:l,isMessageListOpen:Boolean((0,r.Bt)(e))}}))((({content:e,contactsFilter:t,onSearchQuery:n,onSelectSettings:i,onSelectContacts:r,onSelectArchived:c,onReset:l,searchQuery:u,isLoading:g,shouldSkipTransition:f,currentUserId:p,globalSearchChatId:v,searchDate:I,theme:y,animationLevel:Z,chatsById:P,connectionState:C,isSyncing:w,isConnectionStatusMinimized:b,isMessageListOpen:E})=>{const{openChat:S,openTipsChat:M,setGlobalSearchDate:R,setSettingOption:k,setGlobalSearchChatId:T}=(0,a.uC)(),B=(0,Re.Z)(),A=e===m.du.ChatList,x=(0,o.Ye)((()=>I?(0,N.xH)(new Date(1e3*I)):void 0),[I]),L=(0,o.Ye)((()=>A&&P?Object.values(P).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[A,P]),{connectionStatus:O,connectionStatusText:U,connectionStatusPosition:F}=Ae(B,C,w,E,b),$="web.telegram.org"===window.location.hostname,D=(0,o.Ye)((()=>({onTrigger:e,isOpen:t})=>o.ZP.createElement(Oe.Z,{round:!0,ripple:A&&!h.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:A?e:()=>l(),ariaLabel:A?B("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,ue.Z)("animated-menu-icon",!A&&"state-back",f&&"no-animation")}))),[A,B,l,f]),j=(0,o.I4)((()=>{u||n("")}),[u,n]),Q=(0,o.I4)((()=>{k({isConnectionStatusMinimized:!b})}),[b,k]),q=(0,o.I4)((()=>{S({id:p,shouldReplaceHistory:!0})}),[p,S]),G=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";k({theme:t}),k({shouldUseSystemTheme:!1}),(0,ke.Z)(t,Z===s.zy)}),[Z,k,y]),H=(0,o.I4)((e=>{e.stopPropagation();const t=0===Z?2:0;qe.forEach(((e,n)=>{document.body.classList.toggle(`animation-level-${n}`,t===n)})),k({animationLevel:t})}),[Z,k]),_=Boolean(v)||e===m.du.GlobalSearch||e===m.du.Contacts,z=e===m.du.Contacts?B("SearchFriends"):B("Search");return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},o.ZP.createElement(xe.Z,{trigger:D,footer:`${s.iC} ${s.Ji}`},o.ZP.createElement(Le.Z,{icon:"saved-messages",onClick:q},B("SavedMessages")),o.ZP.createElement(Le.Z,{icon:"archive",onClick:c},o.ZP.createElement("span",{className:"menu-item-name"},B("ArchivedChats")),L>0&&o.ZP.createElement("div",{className:"archived-badge"},L)),o.ZP.createElement(Le.Z,{icon:"user",onClick:r},B("Contacts")),o.ZP.createElement(Le.Z,{icon:"settings",onClick:i},B("Settings")),o.ZP.createElement(Le.Z,{icon:"darkmode",onClick:G},o.ZP.createElement("span",{className:"menu-item-name"},B("lng_menu_night_mode")),o.ZP.createElement($e.Z,{id:"darkmode",label:B("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),o.ZP.createElement(Le.Z,{icon:"animations",onClick:H},o.ZP.createElement("span",{className:"menu-item-name capitalize"},B("Appearance.Animations").toLowerCase()),o.ZP.createElement($e.Z,{id:"animations",label:"Toggle Animations",checked:Z>0})),o.ZP.createElement(Le.Z,{icon:"help",onClick:()=>{M({langCode:B.code})}},B("TelegramFeatures")),o.ZP.createElement(Le.Z,{icon:"bug",href:s.mU},"Report Bug"),$&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Le.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{(0,Te.L)("K"),(0,Ne.W8)(),(0,Ce.Wv)()}},"Switch to K Version"),o.ZP.createElement(Le.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:Ce.Wv},"Switch to Old Version"))),o.ZP.createElement(Ue.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:v||I?"with-picker-item":"",value:t||u,focused:_,isLoading:g||"minimized"===F,spinnerColor:"minimized"===F?"yellow":void 0,spinnerBackgroundColor:"minimized"===F&&"light"===y?"light":void 0,placeholder:z,autoComplete:"off",canClose:Boolean(v||I),onChange:n,onReset:l,onFocus:j,onSpinnerClick:"minimized"===F?Q:void 0},x&&o.ZP.createElement(Fe.Z,{icon:"calendar",title:x,canClose:!0,isMinimized:Boolean(v),className:"search-date",onClick:R,clickArg:{date:void 0}}),v&&o.ZP.createElement(Fe.Z,{chatOrUserId:v,onClick:T,canClose:!0,clickArg:{id:void 0}})),o.ZP.createElement(De.Z,{isOpen:"overlay"===F,isCustom:!0,className:"connection-state-wrapper"},(()=>o.ZP.createElement(Qe,{connectionStatus:O,connectionStatusText:U,onClick:Q})))))})));var He=n(1174),_e=n(6071),ze=n(3133),Ve=n(1080);const Ye=(0,o.X$)((0,a.c$)((e=>{const{chats:{listIds:t,byId:n},users:{byId:a},chatFolders:{byId:s,orderedIds:o,activeChatFolder:i},currentUserId:c,lastSyncTime:d,shouldSkipHistoryAnimations:l}=e;return{allListIds:t,chatsById:n,usersById:a,chatFoldersById:s,orderedFolderIds:o,lastSyncTime:d,notifySettings:(0,r.dZ)(e),notifyExceptions:(0,r.NJ)(e),activeChatFolder:i,currentUserId:c,shouldSkipHistoryAnimations:l}}))((({allListIds:e,chatsById:t,usersById:n,chatFoldersById:i,notifySettings:r,notifyExceptions:c,orderedFolderIds:l,activeChatFolder:u,currentUserId:m,lastSyncTime:f,shouldSkipHistoryAnimations:p,foldersDispatch:v,onScreenSelect:I})=>{const{loadChatFolders:y,setActiveChatFolder:Z,openChat:P}=(0,a.uC)(),C=(0,o.sO)(null),w=(0,Re.Z)();(0,o.d4)((()=>{f&&y()}),[f,y]);const b=(0,o.Ye)((()=>l?l.map((e=>i[e]||{})).filter(Boolean):void 0),[i,l]),E=function(a,s,i){const l=(0,_e.Z)(3e3,!0),[u,m]=(0,o.eJ)(),[h,f,p]=(0,Se.Z)();return(0,le.ZP)(f,p),(0,Ie.Z)((()=>{h||l((()=>{m((()=>{if(!b||!b.length)return;const a=b.map((a=>{const{unreadDialogsCount:s,hasActiveDialogs:o}=(0,d.Fu)(e,t,n,a,r,c)||{};return{id:a.id,badgeCount:s,isBadgeActive:o}}));return(0,g.ee)(a,"id")})())}))}),[...i,h]),u}(0,0,[b,e,t,n,r,c]),S=(0,o.Ye)((()=>{if(b&&b.length)return[{title:"en"===w.code?"All":w("FilterAllChats"),id:s.Nf},...b.map((e=>({title:e.title,...null==E?void 0:E[e.id]})))]}),[b,E,w]),M=(0,o.I4)((e=>{Z(e,{forceOnHeavyAnimation:!0})}),[Z]);(0,o.d4)((()=>{S&&S.length&&u>=S.length&&Z(0)}),[u,S,Z]),(0,o.d4)((()=>{if(C.current&&h.$b&&S&&S.length)return(0,He.sf)(C.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===He.eM.Left?(Z(Math.min(u+1,S.length-1),{forceOnHeavyAnimation:!0}),!0):t===He.eM.Right&&(Z(Math.max(0,u-1),{forceOnHeavyAnimation:!0}),!0)})}),[u,S,Z]);const R=(0,o.sO)();R.current=0!==u,(0,o.d4)((()=>R.current?(0,we.Z)((()=>{R.current&&Z(0)})):void 0),[u,Z]),(0,Ce.ZP)(0!==u,(()=>Z(0,{forceOnHeavyAnimation:!0}))),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&S){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void P({id:m,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>S.length-1)return;Z(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}));const{shouldRender:k,transitionClassNames:T}=(0,fe.Z)(!l,void 0,!0);function N(e){const t=Object.values(i).find((({id:e})=>e===S[u].id));return t&&0!==u?o.ZP.createElement(Ve.Z,{folderType:"folder",folderId:t.id,isActive:e,onScreenSelect:I,foldersDispatch:v}):o.ZP.createElement(Ve.Z,{folderType:"all",isActive:e,foldersDispatch:v,onScreenSelect:I})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=S&&S.length?o.ZP.createElement(ze.Z,{tabs:S,activeTab:u,onSwitchTab:M}):k?o.ZP.createElement("div",{className:(0,ue.Z)("tabs-placeholder",T)}):void 0,o.ZP.createElement(Me.Z,{ref:C,name:p?"none":w.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:u,renderCount:S?S.length:void 0},N))})));var Xe=n(9203),Ke=n(8778),We=n(4288);const Je=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)})),et=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)}));var tt=n(2328);let nt;const at=(0,o.X$)((({isShown:e,onNewPrivateChat:t,onNewChannel:n,onNewGroup:a})=>{const[s,i]=(0,o.eJ)(!1);(0,o.d4)((()=>{e||i(!1)}),[e]);const r=(0,Re.Z)(),c=(0,ue.Z)("NewChatButton",e&&"revealed",s&&"menu-is-open"),d=(0,o.I4)((()=>{nt&&(clearTimeout(nt),nt=void 0)}),[]),l=(0,o.I4)((()=>{nt&&(clearTimeout(nt),nt=void 0),nt=window.setTimeout((()=>{i(!1)}),750)}),[]);return o.ZP.createElement("div",{className:c,onMouseEnter:d,onMouseLeave:l},o.ZP.createElement(Oe.Z,{round:!0,color:"primary",className:s?"active":"",onClick:()=>{i(!s)},ariaLabel:r(s?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(tt.Z,{isOpen:s,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{i(!1)}},o.ZP.createElement(Le.Z,{icon:"channel",onClick:n},r("NewChannel")),o.ZP.createElement(Le.Z,{icon:"group",onClick:a},r("NewGroup")),o.ZP.createElement(Le.Z,{icon:"user",onClick:t},r("NewMessageTitle"))))})),st=Object.keys(m.du).length/2;let ot;const it=(0,o.X$)((({content:e,searchQuery:t,searchDate:n,contactsFilter:a,shouldSkipTransition:s,foldersDispatch:i,onSearchQuery:r,onContentChange:c,onScreenSelect:d,onReset:l})=>{const[u,g]=(0,o.eJ)(h.$b),f=(0,o.sO)(!1),p=(0,o.I4)((()=>{c(m.du.Settings)}),[c]),v=(0,o.I4)((()=>{c(m.du.Contacts)}),[c]),I=(0,o.I4)((()=>{c(m.du.NewChannelStep1)}),[c]),y=(0,o.I4)((()=>{c(m.du.NewGroupStep1)}),[c]),Z=(0,o.I4)((()=>{c(m.du.Archived)}),[c]),P=(0,o.I4)((()=>{e===m.du.ChatList&&(f.current=!0,g(!0))}),[e]),C=(0,o.I4)((()=>{f.current=!1,ot&&(clearTimeout(ot),ot=void 0),ot=window.setTimeout((()=>{f.current||g(!1)}),250)}),[]);(0,o.d4)((()=>{let t;return e!==m.du.ChatList?t=window.setTimeout((()=>{g(!1)}),250):(f.current||h.$b)&&g(!0),()=>{t&&(clearTimeout(t),t=void 0)}}),[e]);const[w,b,E]=function(){const[e,t]=(0,Se.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:a}=(0,fe.Z)(e);return[n,a,()=>{window.location.reload()}]}(),S=(0,Re.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:P,onMouseLeave:h.$b?void 0:C},o.ZP.createElement(Ge,{content:e,contactsFilter:a,onSearchQuery:r,onSelectSettings:p,onSelectContacts:v,onSelectArchived:Z,onReset:l,shouldSkipTransition:s}),o.ZP.createElement(Me.Z,{name:s?"none":"zoom-fade",renderCount:st,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(s=>{switch(e){case m.du.ChatList:return o.ZP.createElement(Ye,{onScreenSelect:d,foldersDispatch:i});case m.du.GlobalSearch:return o.ZP.createElement(Je,{searchQuery:t,searchDate:n,isActive:s,onReset:l});case m.du.Contacts:return o.ZP.createElement(et,{filter:a,isActive:s,onReset:l});default:return}})),w&&o.ZP.createElement(Oe.Z,{fluid:!0,pill:!0,className:(0,ue.Z)("btn-update",b),onClick:E},S("lng_update_telegram")),o.ZP.createElement(at,{isShown:u,onNewPrivateChat:v,onNewChannel:I,onNewGroup:y}))})),rt=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)})),ct=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)})),dt=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)}));var lt;!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"}(lt||(lt={}));const ut=Object.keys(lt).length/2,mt=(0,o.X$)((0,a.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:a},shouldSkipHistoryAnimations:s,leftColumnWidth:o}=e;return{searchQuery:t,searchDate:n,activeChatFolder:a,shouldSkipHistoryAnimations:s,leftColumnWidth:o}}))((({searchQuery:e,searchDate:t,activeChatFolder:n,shouldSkipHistoryAnimations:s,leftColumnWidth:i})=>{const{setGlobalSearchQuery:r,setGlobalSearchChatId:c,resetChatCreation:d,setGlobalSearchDate:l,loadPasswordInfo:u,clearTwoFaError:g,setLeftColumnWidth:f,resetLeftColumnWidth:p}=(0,a.uC)(),v=(0,o.sO)(null),[I,y]=(0,o.eJ)(m.du.ChatList),[Z,P]=(0,o.eJ)(m.MT.Main),[C,w]=(0,o.eJ)(""),[b,E]=(0,Ee.ZP)(),[S,M]=(0,o.eJ)(0);let R=lt.Main;switch(I){case m.du.Archived:R=lt.Archived;break;case m.du.Settings:R=lt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:R=lt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:R=lt.NewGroup}const k=(0,o.I4)((e=>{if(I!==m.du.NewGroupStep2||e)if(I!==m.du.NewChannelStep2||e){if(I===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(I===m.du.Settings)switch(Z){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.Language:return void P(m.MT.Main);case m.MT.GeneralChatBackground:case m.MT.QuickReaction:return void P(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void P(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyActiveSessions:case m.MT.PrivacyBlockedUsers:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:return void P(m.MT.Privacy);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void P(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void P(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void P(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void P(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void P(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void P(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void P(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void P(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void P(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void P(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void P(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void P(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void P(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void P(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void P(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void P(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void P(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void P(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return y(m.du.ChatList),void P(m.MT.Main)}I!==m.du.ChatList||0!==n?(y(m.du.ChatList),w(""),r({query:""}),l({date:void 0}),c({id:void 0}),d(),setTimeout((()=>{M(Date.now())}),250)):y(m.du.GlobalSearch)}else y(m.du.NewChannelStep1);else y(m.du.NewGroupStep1)}),[I,n,Z,r,l,c,d]),T=(0,o.I4)((t=>{I!==m.du.Contacts?(y(m.du.GlobalSearch),t!==e&&r({query:t})):w(t)}),[I,e,r]);(0,o.d4)((()=>I!==m.du.ChatList||0===n?(0,we.Z)((()=>k())):void 0),[n,I,k]),(0,o.d4)((()=>{if(I!==m.du.GlobalSearch)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&e.shiftKey&&"f"===(0,be.Z)(e)&&(e.preventDefault(),y(m.du.GlobalSearch))}}),[I]),(0,o.d4)((()=>{g(),Z===m.MT.Privacy&&u()}),[g,u,Z]);const{initResize:N,resetResize:B,handleMouseUp:A}=((e,t,n,a)=>{const[s,i,r]=(0,Se.Z)(),[c,d]=(0,o.eJ)(),[l,u]=(0,o.eJ)();(0,o.d4)((()=>{e.current&&a&&(e.current.style.width=`${a}px`)}),[e,a]);const m=()=>{document.body.classList.remove("no-selection","cursor-ew-resize")};return(0,o.d4)((()=>{if(!s)return;const n=t=>{const n=Math.ceil(l+t.clientX-c);e.current.style.width=`${n}px`},a=()=>{m(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),t(e.current.offsetWidth),r()};document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1)}),[l,c,e,t,s,r]),{initResize:t=>{document.body.classList.add("no-selection","cursor-ew-resize"),d(t.clientX),u(e.current.offsetWidth),i()},resetResize:t=>{t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}})(v,f,p,i),x=e=>{y(m.du.Settings),P(e)};return o.ZP.createElement("div",{id:"LeftColumn",ref:v},o.ZP.createElement(Me.Z,{name:s?"none":h.s0,renderCount:ut,activeKey:R,shouldCleanup:!0,cleanupExceptionKey:lt.Main},(n=>{switch(R){case lt.Archived:return o.ZP.createElement(dt,{isActive:n,onReset:k,onContentChange:y});case lt.Settings:return o.ZP.createElement(rt,{isActive:n,currentScreen:Z,foldersState:b,foldersDispatch:E,onScreenSelect:x,onReset:k,shouldSkipTransition:s});case lt.NewChannel:return o.ZP.createElement(ct,{key:S,isActive:n,isChannel:!0,content:I,onContentChange:y,onReset:k});case lt.NewGroup:return o.ZP.createElement(ct,{key:S,isActive:n,content:I,onContentChange:y,onReset:k});default:return o.ZP.createElement(it,{content:I,searchQuery:e,searchDate:t,contactsFilter:C,foldersDispatch:E,onContentChange:y,onSearchQuery:T,onScreenSelect:x,onReset:k,shouldSkipTransition:s})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:N,onMouseUp:A,onDoubleClick:B}))})));var ht=n(2420),gt=n(5780),ft=n(9524),pt=n(1394);const vt=()=>{const[e,t]=(0,o.eJ)(Y.Z.get());return(0,o.d4)((()=>{const e=(0,C.P2)((()=>{t(Y.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var It=n(2678),yt=n(7204),Zt=n(5326),Pt=n(3570),Ct=n(5790),wt=n(8360),bt=n(2155),Et=n(6058),St=n(8799);const Mt=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"HeaderMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Rt=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{var s;const o=(0,r.Z1)(e,t),i=Boolean(o&&(0,d.eA)(o));if(!o||o.isRestricted||(0,r.CA)(e))return{noMenu:!0};const c=(0,r.IK)(e,t),l=(0,r.FM)(e,t),m="thread"===a&&n===u._f,g="thread"===a&&n!==u._f,f=(0,r.Jf)(e),p=Boolean(c&&(0,r.s4)(e,c.id)),v=!p&&Boolean((0,r.pk)(e,t)),I=Boolean(m&&(i||(0,d.ZV)(o))&&o.isNotJoined);return{noMenu:!1,isChannel:i,isRightColumnShown:f,canStartBot:v,canRestartBot:p,canSubscribe:I,canSearch:m||g,canCall:h.Bi&&(0,d.YC)(o.id)&&!l&&!c,canMute:m&&!l&&!I,canLeave:m&&!I,canEnterVoiceChat:h.Bi&&o.isCallActive,canCreateVoiceChat:h.Bi&&!o.isCallActive&&((null===(s=o.adminRights)||void 0===s?void 0:s.manageCall)||o.isCreator&&(0,d.G9)(o))}}))((({chatId:e,threadId:t,noMenu:n,isChannel:s,canStartBot:i,canRestartBot:r,canSubscribe:c,canSearch:d,canCall:l,canMute:u,canLeave:m,canEnterVoiceChat:g,canCreateVoiceChat:f,isRightColumnShown:p,canExpandActions:v})=>{const{joinChannel:I,sendBotCommand:y,openLocalTextSearch:Z,restartBot:P,openCallFallbackConfirm:C}=(0,a.uC)(),w=(0,o.sO)(null),[b,E]=(0,o.eJ)(!1),[S,M]=(0,o.eJ)(void 0),R=(0,o.I4)((()=>{E(!0);const e=w.current.getBoundingClientRect();M({x:e.right,y:e.bottom})}),[]),k=(0,o.I4)((()=>{E(!1)}),[]),T=(0,o.I4)((()=>{M(void 0)}),[]),N=(0,o.I4)((()=>{I({chatId:e})}),[I,e]),B=(0,o.I4)((()=>{y({command:"/start"})}),[y]),A=(0,o.I4)((()=>{P({chatId:e})}),[e,P]),x=(0,o.I4)((()=>{Z(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[Z]);(0,o.d4)((()=>{if(d)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){h.fl&&(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&!e.shiftKey&&"f"===(0,be.Z)(e)&&(e.preventDefault(),x())}}),[d,x]);const L=(0,Re.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,v&&c&&o.ZP.createElement(Oe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:N},L(s?"ProfileJoinChannel":"ProfileJoinGroup")),v&&i&&o.ZP.createElement(Oe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:B},L("BotStart")),v&&r&&o.ZP.createElement(Oe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:A},L("BotRestart")),d&&o.ZP.createElement(Oe.Z,{round:!0,ripple:p,color:"translucent",size:"smaller",onClick:x,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),l&&o.ZP.createElement(Oe.Z,{round:!0,color:"translucent",size:"smaller",onClick:C,ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),o.ZP.createElement(Oe.Z,{ref:w,className:b?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:n,ariaLabel:"More actions",onClick:R},o.ZP.createElement("i",{className:"icon-more"})),S&&o.ZP.createElement(Mt,{chatId:e,threadId:t,isOpen:b,anchor:S,withExtraActions:h.wB||!v,isChannel:s,canStartBot:i,canRestartBot:r,canSubscribe:c,canSearch:d,canCall:l,canMute:u,canLeave:m,canEnterVoiceChat:g,canCreateVoiceChat:f,onSubscribeChannel:N,onSearchClick:x,onClose:k,onCloseAnimationEnd:T}))})));var kt=n(4399),Tt=n(2340),Nt=n(6202),Bt=n(862);function At(e){var t;const n=e&&(0,d.DH)(e),a=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,i=n&&a&&!(0,h.on)()&&n.includes("image/webp"),[r,c]=(0,o.eJ)(Bt.Hu),l=null==e?void 0:e.id;return(0,o.bt)((()=>{i&&(0,Bt.p6)(`b64-${l}`,n).then(c).catch((e=>{s.eM&&console.error(e)}))}),[l,i,n]),i?r:n}var xt=n(7551),Lt=n(8512);function Ot(e,t,n,a,s){return`M${e},${t+s}a${s},${s},0,0,1,\n ${n},0v${a-2*s}a${s},${s},0,0,1,${-n},0Z`}const Ut=(0,o.X$)((({count:e,index:t})=>{const n=(0,o.sO)(null),a=(0,o.Ye)((()=>function(e,t){const n=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),s=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),i=`clipPath${e}`;return{markHeight:s,clipPath:function(e,t,n){let a="";if(3===n)a=Ot(0,0,2,t,1)+Ot(0,12,2,t+1,1)+Ot(0,25,2,t,1);else for(let e=0;e<n;e++)a+=Ot(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(i,a,e),markTranslateY:function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,a,e),trackTranslateY:function(e,t,n,a){return t<=4||e<=1?0:e>=t-2?a-36:(n+4)/2+(e-2)*(n+2)}(n,e,a,o),trackHeight:o,clipPathId:i}}(e,t)),[e,t]);if((0,o.d4)((()=>{if(!n.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:s,markTranslateY:o,clipPathId:i,clipPath:r}=a,c=n.current.firstElementChild;if(null!=n&&n.current){const a=n.current,{style:d}=a;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${s}px`,u.style.transform=`translateY(${o}px)`)}}),[a]),1===e)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:n}));const{trackHeight:s,trackTranslateY:i,markHeight:r,markTranslateY:c,clipPathId:d}=a;return o.ZP.createElement("div",{className:(0,ue.Z)("pinned-message-border",e>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:n,style:`clip-path: url("#${d}"); width: 2px;\n height: ${s}px; transform: translateY(-${i}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${c}px);`})))})),Ft=(0,o.X$)((({message:e,count:t,index:n,customTitle:a,className:s,onUnpinMessage:i,onClick:r,onAllPinnedClick:c})=>{const l=(0,Re.Z)(),u=At(e),m=(0,Nt.Z)((0,d.Ti)(e,"pictogram")),h=(0,d.MK)(l,e,Boolean(u)),[g,f,p]=(0,Se.Z)(),v=(0,o.I4)((()=>{p(),i&&i(e.id)}),[p,i,e.id]);return o.ZP.createElement("div",{className:(0,ue.Z)("HeaderPinnedMessage-wrapper",s)},t>1&&o.ZP.createElement(Oe.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:c},o.ZP.createElement("i",{className:"icon-pin-list"})),i&&o.ZP.createElement(Oe.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:l("UnpinMessageAlertTitle"),className:"unpin-button",onClick:f},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(xt.Z,{isOpen:g,onClose:p,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:v}),o.ZP.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:l.isRtl?"rtl":void 0},o.ZP.createElement(Ut,{count:t,index:n}),u&&function(e,t){const{width:n,height:a}=(0,kt.W7)();return o.ZP.createElement("img",{src:t||e,width:n,height:a,alt:""})}(u,m),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},a||`${l("PinnedMessage")} ${n>0?"#"+(t-n):""}`),o.ZP.createElement("p",{dir:"auto"},(0,Tt.Z)(h))),o.ZP.createElement(Lt.Z,null)))}));var $t=n(396),Dt=n(4532),jt=n(3186),Qt=n(711);function qt(e,t,n="image/png"){const a=e instanceof Blob?URL.createObjectURL(e):e,s=new Image;return new Promise((o=>{s.onload=()=>{Gt(s,s.width*t,s.height*t,n).then((e=>URL.createObjectURL(e))).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},s.src=a}))}async function Gt(e,t,n,a="image/png"){if(!("createImageBitmap"in window))return Ht(e,t,n,void 0,a);try{const s=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(s.height!==n||s.width!==t)throw new Error("Image bitmap resize not supported!");return await new Promise((e=>{const t=document.createElement("canvas");t.width=s.width,t.height=s.height;const n=t.getContext("bitmaprenderer");n?n.transferFromImageBitmap(s):t.getContext("2d").drawImage(s,0,0),t.toBlob(e,a)}))}catch(s){return Ht(e,t,n,void 0,a)}}function Ht(e,t,n,a=.5,s="image/png"){const o=document.createElement("canvas"),i=o.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(o.width=t,o.height=n,e.width*a>t){const n=1/a;let s={width:Math.floor(e.width*a),height:Math.floor(e.height*a)};for(r.width=s.width,r.height=s.height,c.drawImage(e,0,0,s.width,s.height);s.width*a>t;)s={width:Math.floor(s.width*a),height:Math.floor(s.height*a)},c.drawImage(r,0,0,s.width*n,s.height*n,0,0,s.width,s.height);i.drawImage(r,0,0,s.width,s.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);return new Promise((e=>{o.toBlob(e,s)}))}var _t=n(4524);const zt={width:200,height:200},Vt=115,Yt=(e,t,n)=>{const{audio:a,voice:s}=(0,d.qp)(e),i=a?a.title||a.fileName:s?"Voice message":"",r=a&&a.performer||t&&(0,d.OU)(Qt.i0,t),c=n&&(0,d.U)(Qt.i0,n)||"Telegram",l=a&&(0,d.MR)(a)&&(0,d.Ti)(e,"pictogram"),u=t&&(0,d.RT)(t,"big"),m=a&&l||s&&u,h=(0,Nt.Z)(m),g=(0,o.Ye)((()=>function(e,t,n){if(!n)return zt;if(e){if(!e.thumbnailSizes||0===e.thumbnailSizes.length)return;return e.thumbnailSizes.find((e=>"m"===e.type))||e.thumbnailSizes[0]}return t?kt.vY:void 0}(a,s,h)),[a,h,s]),{result:f}=((e,t,n)=>{const[a,s]=(0,o.eJ)(!1),[i,r]=(0,o.eJ)(),[c,d]=(0,o.eJ)(n);return(0,o.d4)((()=>{s(!0);let e=!1;return function(e,t){if(!e)return Promise.resolve(_t);if(!t)return function(e,t,n,a="image/png"){const s=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{Gt(o,t,n,a).then((e=>URL.createObjectURL(e))).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},o.src=s}))}(e,Vt,Vt);const n=Math.min(t.width,t.height);return n<Vt?qt(e,Vt/n):Promise.resolve(e)}(h,g).then((t=>{e||(s(!1),d(t))}),(t=>{e||(s(!1),r(t))})),()=>{e=!0}}),t),{isLoading:a,error:i,result:c}})(0,[h,g],_t);return(0,o.Ye)((()=>(0,Dt.Of)({title:i,artist:r,album:c,artwork:[{src:f}]})),[c,r,i,f])};var Xt=n(8051);const Kt=(0,a.c$)(((e,{message:t})=>{const n=(0,r.Ur)(e,t),a=(0,r.Z1)(e,t.chatId),{volume:s,playbackRate:o,isMuted:i}=e.audioPlayer;return{sender:n,chat:a,volume:s,playbackRate:o,isMuted:i}}))((({message:e,className:t,noUi:n,sender:s,chat:i,volume:r,playbackRate:c,isMuted:l})=>{const{setAudioPlayerVolume:u,setAudioPlayerPlaybackRate:m,setAudioPlayerMuted:g,focusMessage:f,closeAudioPlayer:p}=(0,a.uC)(),v=(0,Re.Z)(),{audio:I,voice:y,video:Z}=(0,d.qp)(e),P=Boolean(y||Z),C=s?(0,d.OU)(v,s):void 0,w=G.UV((0,d.Ti)(e,"inline")),b=Yt(e,s,i),{playPause:E,stop:S,isPlaying:M,requestNextTrack:R,requestPreviousTrack:k,isFirst:T,isLast:N,setVolume:B,toggleMuted:A,setPlaybackRate:x}=(0,jt.Z)((0,$t.An)(e),(0,d.XV)(e),P?"voice":"audio",w,void 0,b,void 0,!0,void 0,void 0,(0,d.CI)(e),!0),L=P&&M;(0,o.d4)((()=>{if(L)return Y.Z.disableRefresh(),()=>{Y.Z.enableRefresh()}}),[L]);const O=(0,o.I4)((()=>{f({chatId:e.chatId,messageId:e.id})}),[f,e.chatId,e.id]),U=(0,o.I4)((()=>{M&&E(),p(),(0,Dt.Ay)(),S()}),[p,M,E,S]),F=(0,o.I4)((e=>{u({volume:e/100}),g({isMuted:!1}),B(e/100)}),[g,u,B]),$=(0,o.I4)((()=>{h.$b&&!h.cj||(A(),g({isMuted:!l}))}),[l,g,A]),D=(0,o.I4)((()=>{1===c?(x(1.8),m({playbackRate:1.8})):(x(1),m({playbackRate:1}))}),[c,m,x]),j=(0,o.Ye)((()=>0===r||l?"icon-muted":r<.3?"icon-volume-1":r<.6?"icon-volume-2":"icon-volume-3"),[r,l]);if(!n)return o.ZP.createElement("div",{className:(0,ue.Z)("AudioPlayer",t),dir:v.isRtl?"rtl":void 0},o.ZP.createElement(Oe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:T(),onClick:k,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(Oe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,ue.Z)("toggle-play","player-button",M?"pause":"play"),onClick:E,ariaLabel:M?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(Oe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:N(),onClick:R,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:O},I?function(e){const{title:t,performer:n,fileName:a}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,Tt.Z)(t||a)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Tt.Z)(n)))}(I):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Tt.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(v("AttachAudio"),C),o.ZP.createElement(Lt.Z,null)),o.ZP.createElement(Oe.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",withClickPropagation:!0},o.ZP.createElement("i",{className:j,onClick:$}),!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(Xt.Z,{value:l?0:100*r,onChange:F})))),P&&o.ZP.createElement(Oe.Z,{round:!0,className:(0,ue.Z)("playback-button",1!==c&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:D},o.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),o.ZP.createElement(Oe.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:U,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var Wt=n(2607),Jt=n(172);const en=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{const n=(0,r.Z1)(e,t),a=(0,Wt.Bj)(e,t);return{groupCall:a,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(a?a.participantsCount>0&&a.isLoaded:n&&n.isCallNotEmpty&&n.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==a?void 0:a.id)}}))((({chatId:e,isActive:t,groupCall:n,hasPinnedOffset:s,usersById:i,chatsById:r})=>{const{joinGroupCall:c,subscribeToGroupCallUpdates:d}=(0,a.uC)(),l=(0,Re.Z)(),u=(0,o.I4)((()=>{c({chatId:e})}),[c,e]),m=null==n?void 0:n.participants,h=(0,o.Ye)((()=>m?Object.values(m).filter(((e,t)=>t<3)).map((({id:e,isUser:t})=>{if(t){if(!i[e])return;return{user:i[e]}}if(r[e])return{chat:r[e]}})).filter(Boolean):[]),[r,m,i]);if((0,o.d4)((()=>{if(null!=n&&n.id&&(t||!n.isLoaded))return d({id:n.id,subscribed:!0}),()=>{d({id:n.id,subscribed:!1})}}),[null==n?void 0:n.id,null==n?void 0:n.isLoaded,t,d]),n)return o.ZP.createElement("div",{className:(0,ue.Z)("GroupCallTopPane",s&&"has-pinned-offset",!t&&"is-hidden"),onClick:u},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},l("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},l("Participants",n.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},h.map((e=>{if(e)return e.user?o.ZP.createElement(Jt.Z,{key:e.user.id,user:e.user}):o.ZP.createElement(Jt.Z,{key:e.chat.id,chat:e.chat})}))),o.ZP.createElement(Oe.Z,{round:!0,className:"join"},l("VoipChatJoin")))}))),tn=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{const{isLeftColumnShown:s,lastSyncTime:o,shouldSkipHistoryAnimations:i}=e,c=(0,r.Z1)(e,t),{typingStatus:d}=c||{},{chatId:l,messageId:m}=e.audioPlayer,h=l&&m?(0,r.hj)(e,l,m):void 0;let g;if("pinned"===a){const n=(0,r.KB)(e,t);g=null==n?void 0:n.length}else if("scheduled"===a){const n=(0,r.qy)(e,t);g=null==n?void 0:n.length}else if("thread"===a&&n!==u._f){const a=(0,r.tZ)(e,t,n);g=(null==a?void 0:a.messagesCount)||0}const f={typingStatus:d,isLeftColumnShown:s,isRightColumnShown:(0,r.Jf)(e),isSelectModeActive:(0,r.CA)(e),audioMessage:h,chat:c,messagesCount:g,isChatWithSelf:(0,r.FM)(e,t),isChatWithBot:c&&(0,r.xo)(e,c),lastSyncTime:o,shouldSkipHistoryAnimations:i,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing},p=(0,r.Zw)(e,t);if("thread"!==a||!p)return f;if(Object.assign(f,{messagesById:p}),n!==u._f){const a=(0,r.qS)(e,t,n),s=a?(0,r.hj)(e,t,a):void 0,o=s?(0,r.cv)(e,s):void 0;return{...f,pinnedMessageIds:a,canUnpin:!1,topMessageSender:o}}const v=(0,r.KB)(e,t);if(null!=v&&v.length){const t=p[v[0]],{canUnpin:a}=t&&(0,r._k)(e,t,n)||{};return{...f,pinnedMessageIds:v,canUnpin:a}}return f}))((({chatId:e,threadId:t,messageListType:n,isReady:i,pinnedMessageIds:c,messagesById:l,canUnpin:m,topMessageSender:g,typingStatus:f,isSelectModeActive:p,isLeftColumnShown:v,isRightColumnShown:I,audioMessage:y,chat:Z,messagesCount:P,isChatWithSelf:C,isChatWithBot:w,lastSyncTime:b,shouldSkipHistoryAnimations:E,currentTransitionKey:S,connectionState:M,isSyncing:R})=>{const{openChatWithInfo:k,pinMessage:T,focusMessage:N,openChat:B,openPreviousChat:A,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,a.uC)(),U=(0,Re.Z)(),F=(0,o.sO)(!0),[$,D]=(0,o.eJ)(0),j=Array.isArray(c)?c[$]:c,Q=l&&j?l[j]:void 0,q=Array.isArray(c)?c.length:c?1:void 0,G=Z&&(0,d.U)(U,Z).length,H=g?(0,d.OU)(U,g):void 0;(0,o.d4)((()=>{t===u._f&&b&&i&&x({chatId:e})}),[e,x,b,t,i]),(0,o.d4)((()=>{D(0)}),[c]),(0,Ct.Z)(e,j,Q);const{width:_}=vt(),z=_<=s.ks,V=h.p7&&v,Y=(0,o.sO)(null),X=(0,o.sO)(!0),K=(0,o.I4)((()=>{k({id:e})}),[k,e]),W=(0,o.I4)((t=>{T({chatId:e,messageId:t,isUnpin:!0})}),[T,e]),J=(0,o.I4)((()=>{if(Q){N({chatId:Q.chatId,threadId:t,messageId:Q.id});const e=(0,Pt.Z)(q||1,$+1);D(e)}}),[Q,N,t,q,$]),ee=(0,o.I4)((()=>{B({id:e,threadId:u._f,type:"pinned"})}),[B,e]),te=(0,o.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),ne=(0,o.I4)((e=>{if(F.current){if(F.current=!1,h.wB){const e=document.getElementById(s.R2);e&&e.blur()}if(p)return O(),void te();if(t===u._f&&"thread"===n&&0===S)return h.wB||V?(e.stopPropagation(),B({id:void 0})):L(),void te();A(),te()}}),[t,n,S,p,A,V,B,L,O,te]),ae=(0,o.Ye)((()=>{if(z)return(0,r.A1)((0,a.Rd)())||void 0}),[z]),se=_>=s.ks&&_<s.jT||_>s.l3&&_<s.ks&&(!G||G>30),oe=se||_>s._m&&_<s.QU,{shouldRender:ie,transitionClassNames:re}=(0,fe.Z)(Boolean(y)),ce=(0,wt.Z)(y),{shouldRender:de,transitionClassNames:le}=(0,fe.Z)(Boolean(Q)),me=(0,wt.Z)(Q,!0),he=(0,wt.Z)(q,!0),ge=(0,wt.Z)(m,!0),pe=(0,wt.Z)(H),ve=de&&me||ie&&ce;(0,o.d4)((()=>{const e=Y.current;if(e)return oe&&ve?void(I||se?(X.current&&(e.classList.add("tools-stacked","animated"),X.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),X.current=!0)):(e.classList.remove("tools-stacked","animated"),void(X.current=!0))}),[oe,ve,se,I]);const{connectionStatusText:Ie}=Ae(U,M,R,!0);function ye(){return"thread"===n&&t===u._f?o.ZP.createElement(o.ZP.Fragment,null,(z||S>0)&&Ze(V,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:K},(0,d.YC)(e)?o.ZP.createElement(Et.Z,{userId:e,typingStatus:f,status:Ie,withDots:Boolean(Ie),withFullInfo:w,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(St.Z,{chatId:e,typingStatus:f,status:Ie,withDots:Boolean(Ie),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,noRtl:!0}))):"thread"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("CommentsCount",P,"i"))):"pinned"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("PinnedMessagesCount",P,"i"))):"scheduled"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,C?U("Reminders"):U("messages",P,"i"))):void 0}function Ze(e=!1,t=!1){return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(Oe.Z,{round:!0,size:"smaller",color:"translucent",onClick:ne,ariaLabel:U(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,ue.Z)("animated-close-icon",!e&&"state-back")})),t&&ae&&o.ZP.createElement("div",{className:"unread-count active"},(0,bt.bi)(ae)))}const Pe=Boolean(ie&&ce);return o.ZP.createElement("div",{className:"MiddleHeader",ref:Y},o.ZP.createElement(Me.Z,{name:E?"none":"slide-fade",activeKey:S},ye),o.ZP.createElement(en,{hasPinnedOffset:de&&!!me||ie&&!!ce,chatId:e}),de&&me&&o.ZP.createElement(Ft,{key:e,message:me,count:he||0,index:$,customTitle:pe,className:(0,ue.Z)(le,Pe&&"full-width"),onUnpinMessage:ge?W:void 0,onClick:J,onAllPinnedClick:ee}),o.ZP.createElement("div",{className:"header-tools"},Pe&&o.ZP.createElement(Kt,{key:(0,d.Tp)(ce),message:ce,className:re}),o.ZP.createElement(Rt,{chatId:e,threadId:t,messageListType:n,canExpandActions:!Pe})))})));var nn=n(2645),an=n(274);function sn(e){return"albumId"in e}function on(e,t){let n,a=[],s={originalDate:e[0].date,datetime:Number((0,N.$Y)(1e3*e[0].date)),senderGroups:[a]};const o=[s];return e.forEach(((i,r)=>{i.isInAlbum?n?(n.messages.push(i),i.content.text&&(n.mainMessage=i)):n={albumId:i.groupedId,messages:[i],mainMessage:i}:a.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(a.push(n),n=void 0),c){const e=Number((0,N.$Y)(1e3*c.date));s.datetime!==e?(s={originalDate:c.date,datetime:e,senderGroups:[]},o.push(s),a=[],s.senderGroups.push(a)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,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)&&(a=[],s.senderGroups.push(a))}})),o}var rn=n(386),cn=n(2202);var dn=n(7675),ln=n(539),un=n(2357),mn=n(3657);const hn=h.wZ?1e3:350,gn=h.wB?300:500;var fn=n(7240),pn=n(935);function vn(e){return"number"==typeof e}function In(e,t){return e?t?238:175:t?238:100}function yn(e,t){const n=(0,d.B4)(e),a=(0,d.MF)(e),s=(0,d.O$)(e)||(0,d.F$)(e),o=(0,d.b7)(e),i=Boolean((0,d.F$)(e)),{width:r,height:c}=s?(0,kt.Eh)(s,n,a,i,t):(0,kt.GC)(o,n,a,t),l=In(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}}function Zn(e,t){return e.reduce(((e,t)=>e+t),t)}function Pn(e,t,n){return e<t?t:e>n?n:e}function Cn(e){const t={width:0,height:0};return e.forEach((({dimensions:e,sides:n})=>{2&n&&(t.width=e.width+e.x),4&n&&(t.height=e.height+e.y)})),t}function wn(e,t,n,a){const s=function(e){return e.map((e=>{const t=yn(e);return t.width/t.height}))}(a.messages),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(s),i=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(s),r=s.length,c=s.some((e=>e>2)),d=(0,kt.kc)(e,t,!1,n)-(t?2.5:0)*kt.Gw;let l;const u={ratios:s,proportions:o,averageRatio:i,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return l=r>=5||c?function({ratios:e,averageRatio:t,maxWidth:n,minWidth:a,spacing:s,maxHeight:o=4*n/3}){const i=function(e,t){return e.map((e=>t>1.1?Pn(e,1,2.75):Pn(e,.6667,1)))}(e,t),r=e.length,c=new Array(r),d=[],l=e=>{const t=[];let a=0;e.forEach((e=>{t.push(((e,t)=>{const a=Zn(i.slice(e,e+t),0);return(n-(t-1)*s)/a})(a,e)),a+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&l([e,t])}for(let e=1;e!==r-1;++e)for(let n=1;n!==r-e;++n){const a=r-e-n;e<=3&&n<=(t<.85?4:3)&&a<=3&&l([e,n,a])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let n=1;n!==r-e-t;++n){const a=r-e-t-n;e<=3&&t<=3&&n<=3&&a<=4&&l([e,t,n,a])}let u,m=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:n}=d[e],i=n.length,r=Zn(t,0)+s*(i-1),c=Math.min(...t)<a?1.5:1,l=(()=>{for(let e=1;e!==i;++e)if(n[e-1]>n[e])return 1.5;return 1})(),h=Math.abs(r-o)*c*l;(!u||h<m)&&(u=d[e],m=h)}const h=u.lineCounts,g=u.heights,f=h.length;let p=0,v=0;for(let e=0;e!==f;++e){const t=h[e],a=g[e],o=Math.round(a);let r=0;for(let d=0;d!==t;++d){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===d?8:0)|(d===t-1?2:0),u=i[p],m=d===t-1?n-r:Math.round(u*a);c[p]={dimensions:{x:r,y:v,width:m,height:o},sides:l},r+=m+s,++p}v+=o+s}return c}(u):2===r?function(e){const{ratios:t,proportions:n,averageRatio:a}=e;return"ww"===n&&a>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(s-a)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:11},{dimensions:{x:0,y:o+a,width:n,height:o},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=(n-a)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],s)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:13},{dimensions:{x:o+a,y:0,width:o,height:i},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:a,spacing:s,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(a-s),(a-s)/t[0]/(1/t[0]+1/t[1]))),a-s-i),c=a-r-s,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+s,y:0,width:r,height:d},sides:7}]}(e)}(u):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:a,maxWidth:s,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,a[1]*(s-n)/(a[2]+a[1]))),c=i-r-n,d=Math.max(o,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(i*a[0]),s-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:a,spacing:s}=e,o=t,i=Math.round(Math.min(o/n[0],.66*(a-s))),r=(t-s)/2,c=Math.min(a-i-s,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+s,width:r,height:c},sides:12},{dimensions:{x:r+s,y:i+s,width:o-r-s,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:n,maxHeight:a,minWidth:s}){const o=e,i=Math.round(Math.min(o/t[0],.66*(a-n))),r=Math.round((e-2*n)/(t[1]+t[2]+t[3])),c=Math.max(s,Math.round(Math.min(.4*(e-2*n),r*t[1]))),d=Math.round(Math.max(Math.max(s,.33*(e-2*n)),r*t[3])),l=o-c-d-2*n,u=Math.min(a-i-n,r);return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+n,width:c,height:u},sides:12},{dimensions:{x:c+n,y:i+n,width:l,height:u},sides:4},{dimensions:{x:c+n+l+n,y:i+n,width:d,height:u},sides:6}]}(e):function({maxHeight:e,ratios:t,maxWidth:n,spacing:a,minWidth:s}){const o=e,i=Math.round(Math.min(o*t[0],.6*(n-a))),r=Math.round((e-2*a)/(1/t[1]+1/t[2]+1/t[3])),c=Math.round(r/t[1]),d=Math.round(r/t[2]),l=o-c-d-2*a,u=Math.max(s,Math.min(n-i-a,r));return[{dimensions:{x:0,y:0,width:i,height:o},sides:13},{dimensions:{x:i+a,y:0,width:u,height:c},sides:3},{dimensions:{x:i+a,y:c+a,width:u,height:d},sides:2},{dimensions:{x:i+a,y:c+d+2*a,width:u,height:l},sides:6}]}(e)}(u),{layout:l,containerStyle:Cn(l)}}let bn;function En(e){return bn||(bn=document.createElement("span"),bn.style.font=h.cj?'400 12px system-ui, -apple-system, BlinkMacSystemFont, "Roboto", "Apple Color Emoji", "Helvetica Neue", sans-serif':'400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',bn.style.whiteSpace="nowrap",bn.style.position="absolute",bn.style.left="-999px",bn.style.opacity=".01",document.body.appendChild(bn)),bn.innerHTML=e,bn.offsetWidth}function Sn(e,t,n,a,s,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,ln.Z)(t,e.current,s?"end":"centerOrTop",20,void 0!==a?1e3:void 0,a,void 0,i)}}),[e,t,n,a,s,i])}const Mn=3*kt.Gw,Rn=Number(kt.Gw),kn="data-is-document-group-hover";function Tn(e,t,n,s,i,r,c,d,l,u,m,g,f,p){const{setReplyingToId:v,sendDefaultReaction:I}=(0,a.uC)(),[y,Z,P]=(0,Se.Z)(),[C,w,b]=(0,Se.Z)(),E=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,He.sf)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,n)=>n===He.eM.Left&&(e||(e=Date.now()),w(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,v,w,b,r,m]),{handleMouseDown:i?void 0:function(e){(0,rn.q)(e),l(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return E.current?(clearInterval(E.current),E.current=void 0,void function(e){const{pageX:t,pageY:a}=e;I({chatId:u,messageId:n,x:t,y:a})}(t)):void(E.current=setTimeout((()=>{E.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;Y.Z.getIsKeyboardVisible()?setTimeout((()=>{d(e)}),350):d(e)}}(t)}),200))},handleContextMenu:i?c?ge.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]"))return;t.preventDefault(),e()}else d(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:a}=e,{x:s,width:o,y:i,height:r}=t.getBoundingClientRect(),c=Math.abs(f?n-s:s+o-n)<Mn,d=Math.abs(i+r-a)<Rn;c&&d?Z():P()},handleSendQuickReaction:function(e){const{x:t,y:a}=e.currentTarget.getBoundingClientRect();I({chatId:u,messageId:n,x:t,y:a})},handleMouseLeave:function(e){P(),p&&function(e){const t=Bn(e.currentTarget);t&&t.removeAttribute(kn)}(e)},isSwiped:C,isQuickReactionVisible:y,handleDocumentGroupMouseEnter:Nn}}function Nn(e){const t=Bn(e.currentTarget);t&&t.setAttribute(kn,"")}function Bn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var An=n(8005);const xn=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Ln=(0,o.X$)((0,a.c$)(((e,{message:t})=>{const{byId:n}=e.users,a=t.senderId,{targetUserIds:s,targetChatId:o}=t.content.action||{},i=t.replyToMessageId,c=i?(0,r.hj)(e,t.chatId,i):void 0,l=(0,r._X)(e,t),{direction:u,noHighlight:m}=l&&e.focusedMessage||{},h=(0,r.Z1)(e,t.chatId);return{usersById:n,sender:h&&((0,d.eA)(h)||a===t.chatId)?h:a?(0,r.dy)(e,a):void 0,targetChatId:o,targetUserIds:s,targetMessage:c,isFocused:l,...l&&{focusDirection:u,noFocusHighlight:m}}}))((({message:e,observeIntersection:t,isEmbedded:n,appearanceOrder:a=0,isLastInList:s,usersById:i,sender:r,targetUserIds:c,targetMessage:d,targetChatId:l,isFocused:u,focusDirection:m,noFocusHighlight:h})=>{const g=(0,o.sO)(null);(0,mn._N)(g,t),(0,Ct.Z)(e.chatId,e.replyToMessageId,d),Sn(g,e.chatId,u,m,h);const f=(0,Re.Z)(),p=a<=0,[v,I]=(0,Se.Z)(p);(0,o.d4)((()=>{p||setTimeout(I,10*a)}),[a,I,p]);const{transitionClassNames:y}=(0,fe.Z)(v,void 0,p,!1),Z=(0,o.Ye)((()=>c?c.map((e=>null==i?void 0:i[e])).filter(Boolean):void 0),[c,i]),P=(0,An.D)(f,e,r,Z,d,l,n?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:C,contextMenuPosition:w,handleBeforeContextMenu:b,handleContextMenu:E,handleContextMenuClose:S,handleContextMenuHide:M}=(0,fn.Z)(g),R=void 0!==w;if(n)return o.ZP.createElement("span",{className:"embedded-action-message"},(0,Tt.Z)(P));const k=(0,ue.Z)("ActionMessage message-list-item",u&&!h&&"focused",R&&"has-menu-open",s&&"last-in-list",y);return o.ZP.createElement("div",{ref:g,id:`message${e.id}`,className:k,"data-message-id":e.id,onMouseDown:e=>{(0,rn.q)(e),b(e)},onContextMenu:E},o.ZP.createElement("span",null,P),w&&o.ZP.createElement(xn,{isOpen:C,anchor:w,message:e,messageListType:"thread",onClose:S,onCloseAnimationEnd:M}))}))),On=({className:e,message:t,sender:n,title:a,customText:s,isProtected:i,observeIntersection:r,onClick:c})=>{const l=(0,o.sO)(null),u=(0,mn.Op)(l,r),m=(0,Nt.Z)(t&&(0,d.Ti)(t,"pictogram"),!u),h=t&&`sticker-reply-thumb${t.id}`,g=At(t),f=Boolean(t&&(0,d.Y5)(t)),p=(0,Re.Z)(),v=n&&(0,d.OU)(p,n);return o.ZP.createElement("div",{ref:l,className:(0,ue.Z)("EmbeddedMessage",e),onClick:t?c:void 0},g&&function(e,t,n,a,s){const{width:i,height:r}=(0,kt.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{id:e,src:n||t,width:i,height:r,alt:"",className:a?"round":"",draggable:!s}),s&&o.ZP.createElement("span",{className:"protector"}))}(h,g,m,f,i),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},t?(0,d.Lo)(t)?o.ZP.createElement(Ln,{message:t,isEmbedded:!0}):(0,Tt.Z)((0,d.MK)(p,t,Boolean(g))):s||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Tt.Z)(v||a||" "))))};var Un=n(2535),Fn=n(4752),$n=n(8018),Dn=n(8198),jn=n(7799);const Qn=(0,o.X$)((({reaction:e,activeReaction:t,isInMeta:n,availableReactions:s})=>{var i,r;const{stopActiveReaction:c}=(0,a.uC)(),d=null==s?void 0:s.find((t=>t.reaction===e)),l=null==d||null===(i=d.centerIcon)||void 0===i?void 0:i.id,m=null==d||null===(r=d.aroundAnimation)||void 0===r?void 0:r.id,h=(0,Nt.Z)(`sticker${l}`,!l,u.IU.Lottie),g=(0,Nt.Z)(`sticker${m}`,!m,u.IU.Lottie),f=Boolean((null==t?void 0:t.reaction)===e&&h&&g),{shouldRender:p,transitionClassNames:v}=(0,fe.Z)(f,void 0,!0,"slow"),I=(0,o.I4)((()=>{c({messageId:null==t?void 0:t.messageId,reaction:e})}),[null==t?void 0:t.messageId,e,c]),[y,Z,P]=(0,Se.Z)(),C=!f||!y,w=(0,ue.Z)("ReactionAnimatedEmoji",n&&"in-meta",p&&"is-animating");return o.ZP.createElement("div",{className:w},C&&o.ZP.createElement(Dn.Z,{reaction:e}),p&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(jn.Z,{key:l,id:`reaction_emoji_${l}`,className:v,size:30,animationData:h,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:Z,onEnded:P}),o.ZP.createElement(jn.Z,{key:m,id:`reaction_effect_${m}`,className:(0,ue.Z)("effect",v),size:100,animationData:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:I})))})),qn=(0,o.X$)((({message:e,outgoingStatus:t,signature:n,onClick:a,withReactions:s,activeReaction:i,withReactionOffset:r,availableReactions:c})=>{var d;const l=(0,Re.Z)(),[u,m]=(0,Se.Z)(),h=s&&(null===(d=e.reactions)||void 0===d?void 0:d.results.filter((e=>e.count>0))),g=(0,o.Ye)((()=>{if(!u)return;const t=(0,N.SA)(1e3*e.date,l.code),n=e.isEdited&&(0,N.SA)(1e3*e.editDate,l.code),a=e.forwardInfo&&(0,N.SA)(1e3*e.forwardInfo.date,l.code);let s=t;return n&&(s+="\n",s+=l("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=l("lng_forwarded_date").replace("{date}",a)),s}),[u,l,e]);return o.ZP.createElement("span",{className:(0,ue.Z)("MessageMeta",r&&"reactions-offset"),dir:l.isRtl?"rtl":"ltr",onClick:a},h&&h.map((e=>o.ZP.createElement(Qn,{activeReaction:i,reaction:e.reaction,isInMeta:!0,availableReactions:c}))),Boolean(e.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,bt.bi)(e.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),n&&o.ZP.createElement("span",{className:"message-signature"},(0,Tt.Z)(n)),o.ZP.createElement("span",{className:"message-time",title:g,onMouseEnter:m},e.isEdited&&`${l("EditedMessage")} `,(0,N.mr)(l,1e3*e.date)),t&&o.ZP.createElement($n.Z,{status:t}))}));var Gn=n(692),Hn=n(4851);const _n=({message:e,observeIntersection:t,observeIntersectionForPlaying:n,shouldLoop:a,lastSyncTime:i})=>{const r=(0,o.sO)(null),[c,l,u]=(0,Se.Z)(),m=e.content.sticker,{isAnimated:h,stickerSetId:g}=m,f=g===s.n,p=(0,mn.Op)(r,t),v=(0,mn.Op)(r,n),I=m.isPreloadedGlobally?`sticker${m.id}`:(0,d.Ti)(e,"inline"),y=At(e),Z=(0,Nt.Z)(I,!p,(0,d.kG)(e,"inline"),i),P=Boolean(Z),[C,w]=(0,Se.Z)(P),b=h?C:P,E=(0,Gn.Z)(b),{width:S,height:M}=(0,kt.Wr)(m),R=(0,ue.Z)("thumbnail",!y&&"empty"),k=(0,ue.Z)("Sticker media-inner",f&&"inactive");return o.ZP.createElement("div",{ref:r,className:k,onClick:f?void 0:l},!b&&o.ZP.createElement("img",{id:`sticker-thumb-${e.id}`,src:y,width:S,height:M,alt:"",className:R}),!h&&o.ZP.createElement("img",{id:`sticker-${e.id}`,src:Z,width:S,height:M,alt:"",className:(0,ue.Z)("full-media",E)}),h&&P&&o.ZP.createElement(jn.Z,{key:I,className:(0,ue.Z)("full-media",E),id:I,animationData:Z,size:S,play:v,noLoop:!a,onLoad:w}),o.ZP.createElement(Hn.Z,{isOpen:c,fromSticker:m,onClose:u}))};var zn=n(7854),Vn=n(2566),Yn=n(5866);function Xn(e,t){return(0,Yn.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const Kn={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};var Wn=n(9196);const Jn=({id:e,message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,isInSelectMode:i,isSelected:r,uploadProgress:c,size:l="inline",dimensions:u,nonInteractive:m,shouldAffectAppendix:h,isDownloading:g,isProtected:f,theme:p,onClick:v,onCancelUpload:I})=>{const y=(0,o.sO)(null),Z=((0,d.O$)(t)||(0,d.F$)(t)).blobUrl,P=(0,mn.Op)(y,n),[C,w]=(0,o.eJ)(s),b=C&&P,{mediaData:E,loadProgress:S}=(0,Vn.Z)((0,d.Ti)(t,l),!b),M=Z||E,R=Xn(t,M),{loadProgress:k}=(0,Vn.Z)((0,d.Ti)(t,"download"),!g),{isUploading:T,isTransferring:N,transferProgress:B}=(0,d.Sc)(t,c||(g?k:S),b&&!M),A=!1===(0,yt.Z)(C),x=(0,Gn.Z)(M),{shouldRender:L,transitionClassNames:O}=(0,fe.Z)(N,void 0,A,"slow"),{shouldRender:U,transitionClassNames:F}=(0,fe.Z)(!M&&!C),$=(0,o.I4)((()=>{T?I&&I(t):M?v&&v(t.id):w((e=>!e))}),[M,T,t,I,v]),D=(0,d.B4)(t);(0,o.bt)((()=>{if(!h)return;const e=y.current.closest(".message-content");M?function(e,t,n,a,s){return a?Promise.resolve(Kn[s||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.width||await new Promise((e=>{n.onload=e}));const a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.width,a.height=n.height,s.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(s.getImageData(o,i,1,1).data).join(",")})`}(e,t)}(M,D,0,r,p).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")})):e.classList.add("has-appendix-thumb")}),[M,D,h,i,r,p]);const{width:j,height:Q,isSmall:q}=u||yn(t,a),G=(0,ue.Z)("media-inner",!T&&!m&&"interactive",q&&"small-image",j===Q&&"square-image"),H=u?`width: ${j}px; height: ${Q}px; left: ${u.x}px; top: ${u.y}px;`:"";return o.ZP.createElement("div",{id:e,ref:y,className:G,style:H,onClick:T?void 0:$},o.ZP.createElement("canvas",{ref:R,className:"thumbnail",style:`width: ${j}px; height: ${Q}px`}),o.ZP.createElement("img",{src:M,className:`full-media ${x}`,width:j,height:Q,alt:"",draggable:!f}),f&&o.ZP.createElement("span",{className:"protector"}),L&&!U&&o.ZP.createElement("div",{className:`media-loading ${O}`},o.ZP.createElement(Wn.Z,{progress:B,onClick:T?$:void 0})),U&&o.ZP.createElement("i",{className:(0,ue.Z)("icon-download",F)}),N&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*B),"%"))};var ea=n(2019),ta=n(6898),na=n(4753);function aa(e,t){var n;const a=(0,o.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),s=(0,o.sO)();s.current=t;const i=(0,o.I4)((()=>{e.current&&(a.current=!e.current.paused,a.current&&e.current.pause())}),[e]),r=(0,o.I4)((()=>{e.current&&a.current&&s.current&&document.body.contains(e.current)&&(0,na.Z)(e.current)}),[e]),c=(0,o.I4)((()=>{(0,C.T2)(r)}),[r]);(0,pe.Z)(i,c),(0,le.ZP)(i,r)}function sa(){return(sa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}const oa=({id:e,message:t,observeIntersection:n,noAvatars:s,canAutoLoad:i,canAutoPlay:r,uploadProgress:c,lastSyncTime:l,dimensions:m,onClick:h,onCancelUpload:g,isDownloading:f,isProtected:p})=>{var v;const I=(0,o.sO)(null),y=(0,o.sO)(null),Z=(0,d.b7)(t)||(0,d.Cg)(t),P=Z.blobUrl,C=(0,mn.Op)(I,n),[w,b]=(0,o.eJ)(i),E=Boolean(w&&C&&l),[S,M]=(0,o.eJ)(r),R=(0,Nt.Z)((0,d.Ti)(t,"pictogram"),!(C&&l),(0,d.kG)(t,"pictogram"),l),k=(0,Gn.Z)(R),{mediaData:T,loadProgress:B}=(0,Vn.Z)((0,d.Ti)(t,"inline"),!E,(0,d.kG)(t,"inline"),l),A=P||T,x=Boolean(C&&A),L=Xn(t,R),{loadProgress:O}=(0,Vn.Z)((0,d.Ti)(t,"download"),!f,u.IU.BlobUrl,l),{isBuffered:U,bufferingHandlers:F}=(0,ea.Z)(!i),{isUploading:$,isTransferring:D,transferProgress:j}=(0,d.Sc)(t,c||(f?O:B),E&&!U||f),Q=!1===(0,yt.Z)(w),{shouldRender:q,transitionClassNames:G}=(0,fe.Z)(D,void 0,Q),{shouldRender:H,transitionClassNames:_}=(0,fe.Z)(w&&!S&&!q),[z,V]=(0,o.eJ)(0),Y=(0,o.I4)((e=>{V(Math.max(0,e.currentTarget.currentTime-1))}),[]),X=(null===(v=y.current)||void 0===v?void 0:v.duration)||Z.duration||0,K=(0,d.B4)(t),W=(0,d.MF)(t),{width:J,height:ee}=m||(0,kt.GC)(Z,K,W,s);aa(y,x),(0,ta.Z)(y,[x]);const te=(0,o.I4)((()=>{$?g&&g(t):f?(0,a.uC)().cancelMessageMediaDownload({message:t}):A?A&&!S?(M(!0),y.current.play()):h&&h(t.id):b((e=>!e))}),[$,f,A,S,h,g,t]),ne=(0,ue.Z)("media-inner dark",!$&&"interactive"),ae=m?`width: ${J}px; height: ${ee}px; left: ${m.x}px; top: ${m.y}px;`:"";return o.ZP.createElement("div",{ref:I,id:e,className:ne,style:ae,onClick:$?void 0:te},o.ZP.createElement("canvas",{ref:L,className:"thumbnail",style:`width: ${J}px; height: ${ee}px;`}),o.ZP.createElement("img",{src:R,className:(0,ue.Z)("thumbnail",k),style:`width: ${J}px; height: ${ee}px;`,alt:"",draggable:!p}),x&&o.ZP.createElement("video",sa({ref:y,className:"full-media",width:J,height:ee,autoPlay:S,muted:!0,loop:!0,playsInline:!0},F,{draggable:!p,onTimeUpdate:Y}),o.ZP.createElement("source",{src:A})),p&&o.ZP.createElement("span",{className:"protector"}),H&&o.ZP.createElement("i",{className:(0,ue.Z)("icon-large-play",_)}),q&&o.ZP.createElement("div",{className:(0,ue.Z)("media-loading",G)},o.ZP.createElement(Wn.Z,{progress:j,onClick:te})),!w&&o.ZP.createElement("i",{className:"icon-download"}),D?o.ZP.createElement("span",{className:"message-transfer-progress"},$||f?`${Math.round(100*j)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,N.k9)(Math.max(X-z,0))))};var ia=n(6272);const ra=(0,a.c$)(((e,{contact:t})=>{const{countryList:{phoneCodes:n}}=e;return{user:(0,r.dy)(e,t.userId),phoneCodeList:n}}))((({contact:e,user:t,phoneCodeList:n})=>{const{openUserInfo:s}=(0,a.uC)(),{firstName:i,lastName:r,phoneNumber:c,userId:d}=e,l=(0,o.I4)((()=>{s({id:d})}),[s,d]);return o.ZP.createElement("div",{className:(0,ue.Z)("Contact",Boolean(d)&&"interactive"),onClick:d?l:void 0},o.ZP.createElement(Jt.Z,{size:"large",user:t,text:i||r}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},i," ",r),o.ZP.createElement("div",{className:"contact-phone"},(0,ia.WZ)(n,c))))}));var ca=n(1218),da=n(4434),la=n(6937);function ua(e,t){return t>0?(e/t*100).toFixed():0}const ma=({answer:e,voteResults:t,totalVoters:n,maxVotersCount:a,correctResults:s,shouldAnimate:i})=>{const r=t&&t.find((t=>t.option===e.option)),c=0===s.length||-1!==s.indexOf(e.option),d=s.length>0&&c||(null==r?void 0:r.isChosen),l=r?ua(r.votersCount,n||0):0,[u,m]=(0,o.eJ)(i?0:l),h=(0,o.sO)(null),g=r?ua(r.votersCount,a||0):0,f=u<l;if((0,o.d4)((()=>{i&&m(l)}),[i,l]),(0,o.d4)((()=>{const e=h.current;if(e&&i){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,i]),!t||!r)return;const p=`width: ${g}%; transform:scaleX(${f?0:1})`;return o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===l?"limit-width":"")},l,"%",d&&o.ZP.createElement("span",{className:(0,ue.Z)("poll-option-chosen",!c&&"wrong",i&&"animate")},o.ZP.createElement("i",{className:c?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Tt.Z)(e.text)),o.ZP.createElement("div",{className:(0,ue.Z)("poll-option-answer",d&&!c&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:h}),o.ZP.createElement("div",{className:"poll-option-line",style:p}))))},ha=(0,o.X$)((0,a.c$)(((e,{poll:t})=>{const{recentVoterIds:n}=t.results,{serverTimeOffset:a,users:{byId:s}}=e;return n&&0!==n.length?{recentVoterIds:n,usersById:s,serverTimeOffset:a}:{}}))((({message:e,poll:t,recentVoterIds:n,usersById:s,onSendVote:i,serverTimeOffset:r})=>{const{loadMessage:c,openPollResults:d}=(0,a.uC)(),{id:l,chatId:u}=e,{summary:m,results:h}=t,[g,f]=(0,o.eJ)(!1),[p,v]=(0,o.eJ)([]),[I,y]=(0,o.eJ)(!1),[Z,P]=(0,o.eJ)(!1),[C,w]=(0,o.eJ)(!m.closed&&m.closeDate&&m.closeDate>0?Math.min(m.closeDate-Math.floor(Date.now()/1e3)+r,m.closePeriod):0),b=(0,o.sO)(null),{results:E,totalVoters:S}=h,M=E&&E.some((e=>e.isChosen)),R=!m.closed&&!M,k=!R&&m.isPublic&&Number(h.totalVoters)>0,T=R&&m.multipleChoice,B=E?Math.max(...E.map((e=>e.votersCount))):S,A=E?E.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],x=m.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(m.quiz&&m.closePeriod&&C<=0)})));(0,o.d4)((()=>{g&&t.results.results&&t.results.results.some((e=>e.isChosen))&&f(!1)}),[g,t.results.results]),(0,o.d4)((()=>{C>0&&setTimeout((()=>w(C-1)),1e3);const e=b.current;if(e){const t=12*Math.PI,n=e.lastElementChild,a=e.firstElementChild;if(C<=5&&e.classList.add("hurry-up"),n&&a){const e=(m.closePeriod-C)/m.closePeriod*t;a.textContent=(0,N.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,N.k9)(C)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[C,m.closePeriod]),(0,o.d4)((()=>{m.quiz&&(C<=0||M&&!m.closed)&&c({chatId:u,messageId:l})}),[u,C,M,c,l,m.closed,m.quiz]),(0,o.d4)((()=>{let e;return m.quiz&&!m.closed&&m.closePeriod&&m.closePeriod>0&&(e=window.setTimeout((()=>{c({chatId:u,messageId:l})}),1e3*m.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[R,u,c,l,m.closePeriod,m.closed,m.quiz]);const L=(0,o.Ye)((()=>n?n.reduce(((e,t)=>{const n=s[t];return n&&e.push(n),e}),[]):[]),[s,n]),O=(0,o.I4)((e=>{v([e]),f(!0),P(!0),i([e])}),[i]),U=(0,o.I4)((e=>{v(e)}),[]),F=(0,o.I4)((()=>{f(!0),P(!0),i(p)}),[i,p]),$=(0,o.I4)((()=>{d({chatId:u,messageId:l})}),[u,l,d]),D=(0,o.I4)((()=>{y(!0)}),[]),j=(0,o.I4)((()=>{y(!1),P(!1)}),[]);(0,o.d4)((()=>{Z&&M&&m.quiz&&h.results&&t.results.solution&&(h.results.find((e=>e.isChosen&&e.isCorrect))||y(!0))}),[M,Z,h.results,m.quiz,t.results.solution]);const Q=(0,Re.Z)();return o.ZP.createElement("div",{className:"Poll",dir:Q.isRtl?"auto":"ltr"},I&&t.results.solution&&o.ZP.createElement(la.Z,{message:(0,pn.H)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Tt.Z)(m.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},Q(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(m)),L.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>o.ZP.createElement(Jt.Z,{size:"micro",user:e})))),C>0&&R&&o.ZP.createElement("div",{ref:b,className:"poll-countdown"}),m.quiz&&t.results.solution&&!R&&o.ZP.createElement(Oe.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:I,onClick:D,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),R&&o.ZP.createElement("div",{className:"poll-answers"},T?o.ZP.createElement(ca.Z,{options:x,onChange:U,disabled:e.isScheduled||g,loadingOptions:g?p:void 0,round:!0}):o.ZP.createElement(da.Z,{name:`poll-${l}`,options:x,onChange:O,disabled:e.isScheduled||g,loadingOption:g?p[0]:void 0})),!R&&o.ZP.createElement("div",{className:"poll-results"},m.answers.map((function(e){return o.ZP.createElement(ma,{key:e.option,shouldAnimate:Z,answer:e,voteResults:E,totalVoters:S,maxVotersCount:B,correctResults:A})}))),!k&&!T&&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")}(Q,m.quiz,h.totalVoters)),T&&o.ZP.createElement(Oe.Z,{isText:!0,disabled:0===p.length,size:"tiny",onClick:F},Q("PollSubmitVotes")),k&&o.ZP.createElement(Oe.Z,{isText:!0,size:"tiny",onClick:$},Q("PollViewResults")))})));var ga=n(8035),fa=n(88);const pa=(0,o.X$)((({message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,canAutoPlay:s,inPreview:i,lastSyncTime:r,isDownloading:c=!1,isProtected:l,theme:u,onMediaClick:m,onCancelMediaTransfer:h})=>{const g=(0,d.s1)(e);let f=!1;if(null!=g&&g.photo&&!g.video){const{width:t,height:n}=yn(e);f=t===n}const p=(0,o.I4)((()=>{m()}),[m]);if(!g)return;const{siteName:v,url:I,displayUrl:y,title:Z,description:P,photo:C,video:w}=g,b=(C||w)&&m&&!f,E=(0,ga.Z)(P,170),S=(0,ue.Z)("WebPage",f&&"with-square-photo",!C&&!w&&!i&&"without-media",w&&"with-video");return o.ZP.createElement("div",{className:S,"data-initial":(v||y)[0],dir:"auto"},C&&!w&&o.ZP.createElement(Jn,{message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,size:f?"pictogram":"inline",nonInteractive:!b,onClick:b?p:void 0,onCancelUpload:h,isDownloading:c,isProtected:l,theme:u}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(fa.Z,{className:"site-name",url:I,text:v||y}),!i&&Z&&o.ZP.createElement("p",{className:"site-title"},(0,Tt.Z)(Z)),E&&o.ZP.createElement("p",{className:"site-description"},(0,Tt.Z)(E,["emoji","br"]))),!i&&w&&o.ZP.createElement(oa,{message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,canAutoPlay:s,lastSyncTime:r,onClick:b?p:void 0,onCancelUpload:h,isDownloading:c,isProtected:l}))}));var va=n(9937);const Ia=(0,o.X$)((({message:e})=>{const t=(0,Re.Z)(),n=(0,d.eO)(e),{title:a,text:s,amount:i,currency:r,isTest:c,photoUrl:l}=n;return o.ZP.createElement("div",{className:"Invoice"},a&&o.ZP.createElement("p",{className:"title"},(0,Tt.Z)(a)),s&&o.ZP.createElement("p",null,(0,Tt.Z)(s,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(l?"has-image":"")},l&&o.ZP.createElement("img",{className:"invoice-image",src:l,alt:""}),o.ZP.createElement("p",{className:"description-text"},(0,va.x)(i,r,t.code),c&&o.ZP.createElement("span",null,t("PaymentTestInvoice")))))}));function ya(e){return(0,o.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,r.CA)(e),isSelected:(0,r.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.uC)(),d=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:null==e?void 0:e.shiftKey})}),[c,i]),l=(0,o.Ye)((()=>({...t,isInSelectMode:n,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:n?void 0:t.onClick})),[t,n,s]);return o.ZP.createElement("div",{className:(0,ue.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},s&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,l))})))}const Za=ya(Jn),Pa=ya(oa),Ca=(0,a.c$)(((e,{album:t})=>{const{chatId:n}=t.mainMessage,a=(0,r.Pu)(e),s=(0,r.xs)(e,n);return{theme:a,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:s}}))((({album:e,observeIntersection:t,hasCustomAppendix:n,lastSyncTime:s,isOwn:i,isProtected:c,albumLayout:l,onMediaClick:u,uploadsById:m,activeDownloadIds:h,theme:g})=>{const{cancelSendingMessage:f}=(0,a.uC)(),p=e.messages.length,v=(0,o.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:I,height:y}=l.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${I}px; height: ${y}px;`},e.messages.map((function(e,f){const{photo:I,video:y}=(0,d.qp)(e),Z=m[e.previousLocalId||e.id],P=null==Z?void 0:Z.progress,{dimensions:C,sides:w}=l.layout[f],b=(0,r.bH)((0,a.Rd)(),e),E=(0,r.__)((0,a.Rd)(),e);if(I){const a=n&&(i?f===p-1:Boolean(8&w&&4&w));return o.ZP.createElement(Za,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:b,shouldAffectAppendix:a,uploadProgress:P,dimensions:C,isProtected:c,onClick:u,onCancelUpload:v,isDownloading:h.includes(e.id),theme:g})}if(y)return o.ZP.createElement(Pa,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:b,canAutoPlay:E,uploadProgress:P,lastSyncTime:s,dimensions:C,isProtected:c,onClick:u,onCancelUpload:v,isDownloading:h.includes(e.id),theme:g})})))}));function wa(){return(wa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let ba;const Ea=({message:e,observeIntersection:t,canAutoLoad:n,lastSyncTime:s,isDownloading:i})=>{const r=(0,o.sO)(null),c=(0,o.sO)(null),l=(0,o.sO)(null),m=e.content.video,h=(0,mn.Op)(r,t),[g,f]=(0,o.eJ)(n),p=Boolean(g&&h&&s),{mediaData:v,loadProgress:I}=(0,Vn.Z)((0,d.Ti)(e,"inline"),!p,(0,d.kG)(e,"inline"),s),{loadProgress:y}=(0,Vn.Z)((0,d.Ti)(e,"download"),!i,u.IU.BlobUrl,s),Z=Xn(e,v),{isBuffered:P,bufferingHandlers:w}=(0,ea.Z)(),b=g&&!P||i,E=!1===(0,yt.Z)(g),S=(0,Gn.Z)(v),{shouldRender:M,transitionClassNames:R}=(0,fe.Z)(b||!P,void 0,E),[k,T]=(0,o.eJ)(!1),[B,A]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!k)return;const e=kt.Rj/2,t=2*(e-6)*Math.PI,n=t-B*t,a=l.current,s=c.current,o=s.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${kt.Rj}px" height="${kt.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>`,A(a.currentTime/a.duration)}),[k,B]);const x=Boolean(v&&h),L=()=>{T(!1),A(0),(0,na.Z)(l.current),(0,C.T2)((()=>{c.current.innerHTML=""}))},O=(U=L,()=>{ba&&ba(),ba=U});var U;(0,o.d4)((()=>{l.current&&(x?(0,na.Z)(l.current):l.current.pause())}),[x]),aa(l,x),(0,ta.Z)(l,[v]);const F=(0,o.I4)((()=>{if(!v)return void f((e=>!e));if(i)return void(0,a.uC)().cancelMessageMediaDownload({message:e});const t=l.current;k?t.paused?((0,na.Z)(t),(0,$t.Es)()):t.pause():(O(),t.pause(),t.currentTime=0,(0,na.Z)(t),(0,$t.Es)(),T(!0))}),[O,k,i,v,e]),$=(0,o.I4)((e=>{const t=e.currentTarget;A(t.currentTime/t.duration)}),[]),D=(0,ue.Z)("full-media",S);return o.ZP.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:F},o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${kt.Rj}px; height: ${kt.Rj}px`})),v&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",wa({ref:l,className:D,width:kt.Rj,height:kt.Rj,autoPlay:!0,muted:!k,loop:!k,playsInline:!0,onEnded:k?L:void 0},w,{onTimeUpdate:k?$:void 0}),o.ZP.createElement("source",{src:v}))),o.ZP.createElement("div",{className:"progress",ref:c}),M&&o.ZP.createElement("div",{className:`media-loading ${R}`},o.ZP.createElement(Wn.Z,{progress:i?y:I})),!v&&!g&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},k?(0,N.k9)(l.current.currentTime):(0,N.k9)(m.duration),(!k||l.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},Sa=({message:e,onClick:t})=>{const n=(0,Re.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},e.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Oe.Z,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},(0,Tt.Z)(n(e.text)),"buy"===e.type&&o.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!e.value.match(s.FS)&&o.ZP.createElement("i",{className:"icon-arrow-right"}))))))))},Ma=(0,o.X$)((({threadInfo:e,disabled:t})=>{const{openChat:n}=(0,a.uC)(),s=(0,Re.Z)(),{threadId:i,chatId:r,messagesCount:c,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:m}=e,h=(0,o.I4)((()=>{n({id:r,threadId:i})}),[n,r,i]),g=(0,o.Ye)((()=>{if(null==m||!m.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return m.map((n=>(0,d.YC)(n)?e[n]:t[n])).filter(Boolean)}),[m]);if(void 0===c)return;const f=Boolean(u&&l&&u<l);return o.ZP.createElement("div",{"data-cnt":(0,bt.bi)(c),className:(0,ue.Z)("CommentButton",f&&"has-unread",t&&"disabled"),dir:s.isRtl?"rtl":"ltr",onClick:h},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!g||0===g.length)&&o.ZP.createElement("i",{className:"icon-comments"}),g&&g.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:s.isRtl?"rtl":"ltr"},g.map((e=>o.ZP.createElement(Jt.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"},c?s("Comments",c,"i"):s("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),Ra=(0,o.X$)((({reaction:e,message:t,activeReaction:n,availableReactions:s})=>{const{sendReaction:i}=(0,a.uC)(),{recentReactions:r}=t.reactions,c=(0,o.Ye)((()=>{if(!r||e.count>3)return;const t=(0,a.Rd)().users.byId;return r.filter((t=>t.reaction===e.reaction)).map((e=>t[e.userId])).filter(Boolean)}),[e,r]),d=(0,o.I4)((()=>{i({reaction:e.isChosen?void 0:e.reaction,chatId:t.chatId,messageId:t.id})}),[t,e,i]);return o.ZP.createElement(Oe.Z,{className:(0,ue.Z)(e.isChosen&&"chosen"),size:"tiny",onClick:d},o.ZP.createElement(Qn,{activeReaction:n,reaction:e.reaction,availableReactions:s}),null!=c&&c.length?o.ZP.createElement("div",{className:"avatars"},c.map((e=>o.ZP.createElement(Jt.Z,{user:e,size:"micro"})))):(0,bt.bi)(e.count))})),ka=(0,o.X$)((({message:e,isOutside:t,activeReaction:n,availableReactions:a,metaChildren:s})=>o.ZP.createElement("div",{className:(0,ue.Z)("Reactions",t&&"is-outside")},e.reactions.results.map((t=>o.ZP.createElement(Ra,{key:t.reaction,reaction:t,message:e,activeReaction:n,availableReactions:a}))),s)));var Ta=n(7324),Na=n(5296);const Ba=(0,o.X$)((({localSticker:e,localEffect:t,isOwn:n,soundId:a,size:s="medium",observeIntersection:i,messageId:r,chatId:c,activeEmojiInteraction:d})=>{const{playKey:l,ref:u,style:m,width:h,handleClick:g,markAnimationLoaded:f}=(0,Na.Z)(s,c,r,a,d,n,t),p=`local_emoji_${e}`,v=(0,mn.Op)(u,i),[I,y]=(0,o.eJ)();return(0,o.d4)((()=>{e&&(0,Ta.Z)(e).then((e=>{y(e)}))}),[e]),o.ZP.createElement("div",{ref:u,className:"AnimatedEmoji media-inner",style:m,onClick:g},I&&o.ZP.createElement(jn.Z,{key:p,id:p,animationData:I,size:h,quality:1,play:v&&l,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:f}))})),Aa={__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>'},xa={__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>'},La=(0,o.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,lastSyncTime:s}=e,{message:o,album:i,withSenderName:c,withAvatar:l,threadId:u,messageListType:m,isLastInDocumentGroup:h}=t,{id:g,chatId:f,viaBotId:p,replyToChatId:v,replyToMessageId:I,isOutgoing:y,threadInfo:Z}=o,P=(0,r.Z1)(e,f),C=(0,r.FM)(e,f),w=(0,d.pK)(f),b=P&&(0,d.eA)(P),E=null==P?void 0:P.username,S=!C&&(0,d.Ul)(o),M=c||l||S,R=(0,r.Ur)(e,o),k=(0,r.cv)(e,o),T=p?(0,r.dy)(e,p):void 0,N=u?(0,r.qS)(e,f,u):void 0,B=o.id===N,A=I===N,x=I&&!A?(0,r.hj)(e,w&&v?v:f,I):void 0,L=x&&(0,r.Ur)(e,x),O=(0,r.uZ)(e,o),U="thread"===m&&(i?i.messages.some((t=>(0,r._X)(e,t))):(0,r._X)(e,o)),{direction:F,noHighlight:$,isResizingContainer:D}=U&&n||{},j=a.messageIds&&a.messageIds.includes(g),{query:Q}=(0,r.n5)(e)||{},q=(0,d._O)(o);let G;G=null!=i&&i.messages?i.messages.every((({id:t})=>(0,r.vk)(e,t))):(0,r.vk)(e,g);const{canReply:H}="thread"===m&&(0,r._k)(e,o,u)||{},_=(0,r.te)(e,o),z=Z?(0,r.tZ)(e,Z.chatId,Z.threadId)||Z:void 0,V=Boolean(o.groupedId)&&!o.isInAlbum,Y=V?(0,r.xH)(e,f,o.groupedId)[0]:void 0,X=V?h?(0,r.hj)(e,f,Y):void 0:o,K=q?(0,r.CP)(e,q):void 0;return{theme:(0,r.Pu)(e),chatUsername:E,forceSenderName:S,sender:M?R:void 0,originSender:k,botSender:T,shouldHideReply:A,isThreadTop:B,replyMessage:x,replyMessageSender:L,isInDocumentGroup:V,isProtected:(0,r.EV)(e,o),isFocused:U,isForwarding:j,reactionMessage:X,isChatWithSelf:C,isRepliesChat:w,isChannel:b,canReply:H,lastSyncTime:s,highlight:Q,isSingleEmoji:Boolean(q),animatedEmoji:q?(0,r.zB)(e,q):void 0,animatedEmojiEffect:q&&(0,d.YC)(f)?(0,r.tH)(e,q):void 0,animatedEmojiSoundId:q?(0,r.Oh)(e,q):void 0,localSticker:K,localEffect:K&&(0,d.YC)(f)?(0,r.cu)(K):void 0,isInSelectMode:(0,r.CA)(e),isSelected:G,isGroupSelected:!!o.groupedId&&!o.isInAlbum&&(0,r.a6)(e,f,o.groupedId),threadId:u,isDownloading:_,isPinnedList:"pinned"===m,canAutoLoadMedia:(0,r.bH)(e,o),canAutoPlayMedia:(0,r.__)(e,o),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,r.yB)(e),threadInfo:z,availableReactions:e.availableReactions,defaultReaction:(0,r.q6)(e,f),activeReaction:e.activeReactions[g],activeEmojiInteraction:e.activeEmojiInteraction,...y&&{outgoingStatus:(0,r.dT)(e,o,"scheduled"===m)},..."number"==typeof O&&{uploadProgress:O},...U&&{focusDirection:F,noFocusHighlight:$,isResizingContainer:D}}}))((({message:e,chatUsername:t,observeIntersectionForBottom:n,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:i,album:r,noAvatars:c,withAvatar:l,withSenderName:g,areReactionsInMeta:f,noComments:p,appearanceOrder:v,isFirstInGroup:I,isLastInGroup:y,isFirstInDocumentGroup:Z,isLastInDocumentGroup:P,isLastInList:C,theme:w,forceSenderName:b,sender:E,originSender:S,botSender:M,isThreadTop:R,shouldHideReply:k,replyMessage:T,replyMessageSender:N,outgoingStatus:B,uploadProgress:A,isInDocumentGroup:x,isProtected:L,isFocused:O,focusDirection:U,noFocusHighlight:F,isResizingContainer:$,isForwarding:D,isChatWithSelf:j,isRepliesChat:Q,isChannel:q,canReply:G,lastSyncTime:H,highlight:_,animatedEmoji:z,localSticker:V,localEffect:Y,animatedEmojiEffect:X,animatedEmojiSoundId:K,isInSelectMode:W,isSelected:J,isGroupSelected:ee,threadId:te,reactionMessage:ne,availableReactions:ae,defaultReaction:se,activeReaction:oe,activeEmojiInteraction:ie,messageListType:re,isPinnedList:ce,isDownloading:de,canAutoLoadMedia:le,canAutoPlayMedia:me,shouldLoopStickers:he,autoLoadFileMaxSizeMb:ge,threadInfo:pe})=>{const{toggleMessageSelection:ve,clickInlineButton:Ie,disableContextMenuHint:ye}=(0,a.uC)(),Ze=(0,o.sO)(null),Pe=(0,o.sO)(null),Ce=(0,o.sO)(null),we=(0,Re.Z)();(0,mn._N)(Pe,n);const{isContextMenuOpen:be,contextMenuPosition:Ee,handleBeforeContextMenu:Me,handleContextMenu:ke,handleContextMenuClose:Te,handleContextMenuHide:Ne}=(0,fn.Z)(Ze,h.$b&&W,!0,h.wZ);(0,o.d4)((()=>{be&&ye()}),[be,ye]);const Be=v<=0,[Ae,xe]=(0,Se.Z)(Be);(0,o.d4)((()=>{Be||setTimeout(xe,10*v)}),[v,xe,Be]);const{transitionClassNames:Le}=(0,fe.Z)(Ae,void 0,Be,!1),{id:Ue,chatId:Fe,forwardInfo:$e,viaBotId:De}=e,je=(0,d.CI)(e),Qe=(0,d.B4)(e),qe="scheduled"===re||e.isScheduled,Ge=(0,d.ss)(e)&&!k,He=Boolean(pe)&&"thread"===re,_e=(0,d.$D)(e),ze=V||z,Ve=(null==ne?void 0:ne.reactions)&&!(0,d.JE)(ne.reactions),Ye=$e&&(!j||qe)&&!Q&&!$e.isLinkedChannelPost&&!_e,Xe=Boolean(r)&&r.messages.length>1,Ke=x&&!Z,We=x&&!P,Je=void 0!==Ee,et=!(Je||W||D||We),tt=q&&!qe,nt=Boolean(ce||$e&&($e.isChannelPost||j&&!Qe||Q)&&$e.fromMessageId),at=pe&&!We&&"thread"===re&&!p,st=!h.$b&&se&&!We,ot=(0,o.I4)(((e,t)=>{ve({messageId:Ue,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...Xe&&{childMessageIds:r.messages.map((({id:e})=>e))}})}),[ve,Ue,Xe,r]),it=$e&&(j||Q||!E)?S:E,rt=$e?S:E,{handleMouseDown:ct,handleClick:dt,handleContextMenu:lt,handleDoubleClick:ut,handleContentDoubleClick:mt,handleMouseMove:ht,handleSendQuickReaction:gt,handleMouseLeave:ft,isSwiped:pt,isQuickReactionVisible:vt,handleDocumentGroupMouseEnter:It}=Tn(ot,Ze,Ue,0,Boolean(W),Boolean(G),Boolean(L),ke,Me,Fe,Je,Ce,Qe,We),{handleAvatarClick:yt,handleSenderClick:Zt,handleViaBotClick:Pt,handleReplyClick:wt,handleMediaClick:bt,handleAudioPlay:Et,handleAlbumMediaClick:St,handleMetaClick:Mt,handleReadMedia:Rt,handleCancelUpload:Nt,handleVoteSend:Bt,handleGroupForward:At,handleForward:xt,handleFocus:Lt,handleFocusForwarded:Ot,handleDocumentGroupSelectAll:Ut}=function(e,t,n,s,i,r,c,l,h,g,f,p,v){const{openUserInfo:I,openChat:y,showNotification:Z,focusMessage:P,openMediaViewer:C,openAudioPlayer:w,markMessagesRead:b,cancelSendingMessage:E,sendPollVote:S,openForwardMenu:M,focusMessageInComments:R}=(0,a.uC)(),{id:k,forwardInfo:T,replyToMessageId:N,replyToChatId:B,replyToTopMessageId:A,groupedId:x}=n,L=(0,o.I4)((()=>{f&&((0,d.YC)(f.id)?I({id:f.id}):y({id:f.id}))}),[f,I,y]),O=(0,o.I4)((()=>{p?c&&null!=T&&T.channelPostId?P({chatId:p.id,messageId:T.channelPostId}):(0,d.YC)(p.id)?I({id:p.id}):y({id:p.id}):Z({message:e("HidAccount")})}),[c,P,T,e,y,I,p,Z]),U=(0,o.I4)((()=>{v&&I({id:v.id})}),[v,I]),F=(0,o.I4)((()=>{P({chatId:h&&B?B:s,threadId:i,messageId:N,replyMessageId:h&&B?void 0:k})}),[P,h,B,s,i,N,k]),$=(0,o.I4)((()=>{C({chatId:s,threadId:i,messageId:k,origin:l?m.bZ.ScheduledInline:m.bZ.Inline})}),[s,i,k,C,l]),D=(0,o.I4)((()=>{w({chatId:s,messageId:k})}),[s,k,w]),j=(0,o.I4)((e=>{C({chatId:s,threadId:i,messageId:e,origin:l?m.bZ.ScheduledAlbum:m.bZ.Album})}),[s,i,C,l]),Q=(0,o.I4)((()=>{b({messageIds:[k]})}),[k,b]),q=(0,o.I4)((()=>{E({chatId:s,messageId:k})}),[E,s,k]),G=(0,o.I4)((e=>{S({chatId:s,messageId:k,options:e})}),[s,k,S]),H=(0,o.I4)((()=>{M({fromChatId:s,groupedId:x})}),[M,s,x]),_=(0,o.I4)((()=>{if(g&&g.messages){const e=g.messages.map((({id:e})=>e));M({fromChatId:s,messageIds:e})}else M({fromChatId:s,messageIds:[k]})}),[g,M,s,k]),z=(0,o.I4)((()=>{P({chatId:s,threadId:u._f,messageId:k})}),[P,s,k]),V=(0,o.I4)((()=>{r?P({chatId:T.fromChatId,groupedId:x,groupedChatId:s}):h&&B?R({chatId:B,threadId:A,messageId:T.fromMessageId}):P({chatId:T.fromChatId,messageId:T.fromMessageId})}),[r,h,B,P,T,x,s,R,A]),Y=(0,o.I4)((e=>{e.stopPropagation(),t(e,x)}),[t,x]);return{handleAvatarClick:L,handleSenderClick:O,handleViaBotClick:U,handleReplyClick:F,handleMediaClick:$,handleAudioPlay:D,handleAlbumMediaClick:j,handleMetaClick:Y,handleReadMedia:Q,handleCancelUpload:q,handleVoteSend:G,handleGroupForward:H,handleForward:_,handleFocus:z,handleFocusForwarded:V,handleDocumentGroupSelectAll:Y}}(we,ot,e,Fe,te,x,Ye,qe,Q,r,it,rt,M),Ft=(0,ue.Z)("Message message-list-item",I&&"first-in-group",L&&"is-protected",y&&"last-in-group",Z&&"first-in-document-group",P&&"last-in-document-group",C&&"last-in-list",Qe&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Ge&&"has-reply",Je&&"has-menu-open",O&&!F&&"focused",D&&"is-forwarding",e.isDeleting&&"is-deleting",x&&"is-in-document-group",Xe&&"is-album",e.hasUnreadMention&&"has-unread-mention",J&&"is-selected",W&&"is-in-selection-mode",R&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",pt&&"is-swiped",Le,Boolean(oe)&&"has-active-reaction"),$t=function(e,{hasReply:t,customShape:n,isLastInGroup:a,asForwarded:s,hasThread:o,forceSenderName:i,hasComments:r,hasActionButton:c,hasReactions:l}={}){const{text:u,photo:m,video:h,audio:g,voice:f,document:p,poll:v,webPage:I,contact:y}=(0,d.qp)(e),Z=["message-content"],P=m||h,C=P&&!u,w=Boolean(e.viaBotId);return vn(n)?Z.push(`emoji-only emoji-only-${n}`):u&&Z.push("text"),c&&Z.push("has-action-button"),n&&(Z.push("custom-shape"),null!=h&&h.isRound&&Z.push("round"),r&&Z.push("has-comments")),m||h?Z.push("media"):g?Z.push("audio"):f?Z.push("voice"):p?Z.push("document"):y?Z.push("contact"):v?Z.push("poll"):I&&(Z.push("web-page"),(I.photo||I.video)&&Z.push("media")),s&&Z.push("is-forwarded"),t&&Z.push("is-reply"),o&&Z.push("has-replies"),l&&Z.push("has-reactions"),w&&Z.push("is-via-bot"),i&&Z.push("force-sender-name"),n||(Z.push("has-shadow"),P&&r&&Z.push("has-background"),(t||s||!C||w||i)&&Z.push("has-solid-background"),!a||!m&&C||Z.push("has-appendix")),Z.join(" ")}(e,{hasReply:Ge,customShape:_e,isLastInGroup:y,asForwarded:Ye,hasThread:He,forceSenderName:b,hasComments:pe&&(null==pe?void 0:pe.messagesCount)>0,hasActionButton:tt||nt,hasReactions:Ve}),Dt=$t.includes("has-appendix"),jt=(0,pn.X)(e,_,vn(_e)),{text:Qt,photo:qt,video:Gt,audio:Ht,voice:_t,document:zt,sticker:Vt,contact:Yt,poll:Xt,webPage:Kt,invoice:Wt}=(0,d.qp)(e);let en,tn;en=We?"none":!jt||ze||Kt?"standalone":"in-text",f?tn="in-meta":Ve?_e||(qt||Gt||ze)&&!jt?tn="outside":Ye?(en="standalone",tn="inside"):tn="inside":tn="none",(0,Ct.Z)(Q&&e.replyToChatId?e.replyToChatId:Fe,Ge?e.replyToMessageId:void 0,T,e.id),Sn(Ze,Fe,O,U,F,$);let nn,an="",sn=!1;const on=(0,o.Ye)((()=>Xe?wn(Qe,Boolean(Ye),Boolean(c),r):void 0),[Xe,Qe,Ye,c,r]),rn=Ye?28:0;if(Xe||!qt&&!Gt)on&&(nn=Math.max(In(Boolean(Qt),at),on.containerStyle.width),nn-on.containerStyle.width>18&&(sn=!0));else{let t;qt?t=yn(e,c).width:Gt&&(t=Gt.isRound?kt.Rj:yn(e,c).width),t&&(nn=Math.max(In(Boolean(Qt),at),t),nn-t>18&&(sn=!0))}nn&&(an=`width: ${nn+rn}px`);const cn=q&&e.adminTitle||!Ye&&(null==$e?void 0:$e.adminTitle)||void 0,dn=(0,o.Ye)((()=>cn?En(cn):void 0),[cn]);function ln(){const t=o.ZP.createElement(qn,{message:e,outgoingStatus:B,signature:cn,withReactions:"in-meta"===tn,withReactionOffset:"inside"===tn,availableReactions:ae,activeReaction:oe,onClick:Mt});return"inside"!==tn?t:o.ZP.createElement(ka,{activeReaction:oe,message:ne,metaChildren:t,availableReactions:ae})}return o.ZP.createElement("div",{ref:Ze,id:`message${Ue}`,className:Ft,style:dn?`--meta-safe-author-width: ${dn}px`:void 0,"data-message-id":Ue,onMouseDown:ct,onClick:dt,onContextMenu:lt,onDoubleClick:ut,onMouseEnter:We?It:void 0,onMouseMove:st?ht:void 0,onMouseLeave:st||We?ft:void 0},o.ZP.createElement("div",{ref:Pe,className:"bottom-marker","data-message-id":Ue,"data-last-message-id":r?r.messages[r.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!x&&o.ZP.createElement("div",{className:"message-select-control"},J&&o.ZP.createElement("i",{className:"icon-select"})),P&&o.ZP.createElement("div",{className:(0,ue.Z)("message-select-control group-select",ee&&"is-selected"),onClick:Ut},ee&&o.ZP.createElement("i",{className:"icon-select"})),l&&function(){const e=it&&(0,d.YC)(it.id),t=it&&e?it:void 0,n=it&&!e?it:void 0,a=!it&&$e?$e.hiddenUserName:void 0;return o.ZP.createElement(Jt.Z,{size:"small",user:t,chat:n,text:a,lastSyncTime:H,onClick:t||n?yt:void 0})}(),o.ZP.createElement("div",{className:(0,ue.Z)("message-content-wrapper",$t.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:Ce,className:$t,style:an,dir:"auto"},Ye&&!Ke&&o.ZP.createElement("div",{className:"message-title"},we("ForwardedMessage")),function(){const t=(0,ue.Z)("content-inner",Ye&&"forwarded-message",Ge&&"reply-message",sn&&"no-media-corners"),n=y&&!jt&&!Ye&&!He,a=(0,ue.Z)("text-content","in-text"===en&&"with-meta",B&&"with-outgoing-icon");return o.ZP.createElement("div",{className:t,onDoubleClick:mt,dir:"auto"},function(){if(_e&&!De||!(g&&!qt&&!Gt||Ye||De||b)||Ke||Ge&&_e)return;let t,n;return!rt||_e&&De?null!=$e&&$e.hiddenUserName&&(t=$e.hiddenUserName):(t=(0,d.OU)(we,rt),Ye||(n=`color-${(0,d.Rs)(rt)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},t?o.ZP.createElement("span",{className:(0,ue.Z)("interactive",n),onClick:Zt,dir:"auto"},(0,Tt.Z)(t)):M?void 0:" ",M&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},we("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:Pt},(0,Tt.Z)(`@${M.username}`))),null!=$e&&$e.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},we("DiscussChannel")):e.adminTitle&&!q?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Ge&&o.ZP.createElement(On,{message:T,isProtected:L,sender:N,observeIntersection:s,onClick:wt}),Vt&&o.ZP.createElement(_n,{message:e,observeIntersection:s,observeIntersectionForPlaying:i,shouldLoop:he,lastSyncTime:H}),z&&o.ZP.createElement(zn.Z,{size:"small",isOwn:Qe,sticker:z,effect:X,soundId:K,observeIntersection:s,lastSyncTime:H,forceLoadPreview:je,messageId:Ue,chatId:Fe,activeEmojiInteraction:ie}),V&&o.ZP.createElement(Ba,{size:"small",isOwn:Qe,localSticker:V,localEffect:Y,soundId:K,observeIntersection:s,lastSyncTime:H,forceLoadPreview:je,messageId:Ue,chatId:Fe,activeEmojiInteraction:ie}),Xe&&o.ZP.createElement(Ca,{album:r,albumLayout:on,observeIntersection:s,isOwn:Qe,isProtected:L,hasCustomAppendix:n,lastSyncTime:H,onMediaClick:St}),!Xe&&qt&&o.ZP.createElement(Jn,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:le,uploadProgress:A,shouldAffectAppendix:n,onClick:bt,onCancelUpload:Nt,isDownloading:de,isProtected:L,theme:w}),!Xe&&Gt&&Gt.isRound&&o.ZP.createElement(Ea,{message:e,observeIntersection:s,canAutoLoad:le,lastSyncTime:H,isDownloading:de}),!Xe&&Gt&&!Gt.isRound&&o.ZP.createElement(oa,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:le,canAutoPlay:me,uploadProgress:A,lastSyncTime:H,onClick:bt,onCancelUpload:Nt,isDownloading:de,isProtected:L}),(Ht||_t)&&o.ZP.createElement(Fn.Z,{theme:w,message:e,origin:m.Cr.Inline,uploadProgress:A,lastSyncTime:H,isSelectable:x,isSelected:J,onPlay:Et,onReadMedia:!_t||Qe&&!j?void 0:Rt,onCancelUpload:Nt,isDownloading:de}),zt&&o.ZP.createElement(Un.Z,{message:e,observeIntersection:s,canAutoLoad:le,autoLoadFileMaxSizeMb:ge,uploadProgress:A,isSelectable:x,isSelected:J,onMediaClick:bt,onCancelUpload:Nt,isDownloading:de}),Yt&&o.ZP.createElement(ra,{contact:Yt}),Xt&&o.ZP.createElement(ha,{message:e,poll:Xt,onSendVote:Bt}),!ze&&jt&&o.ZP.createElement("p",{className:a,dir:"auto"},jt,"in-text"===en&&ln()),Kt&&o.ZP.createElement(pa,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:le,canAutoPlay:me,lastSyncTime:H,onMediaClick:bt,onCancelMediaTransfer:Nt,isDownloading:de,isProtected:L,theme:w}),Wt&&o.ZP.createElement(Ia,{message:e}))}(),!We&&"standalone"===en&&ln(),et&&tt?o.ZP.createElement(Oe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:we("lng_context_forward_msg"),onClick:P?At:xt},o.ZP.createElement("i",{className:"icon-share-filled"})):et&&nt?o.ZP.createElement(Oe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ce?Lt:Ot},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,at&&o.ZP.createElement(Ma,{threadInfo:pe,disabled:p}),Dt&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:Qe?Aa:xa}),st&&o.ZP.createElement("div",{className:(0,ue.Z)("quick-reaction",vt&&!oe&&"visible"),onClick:gt},o.ZP.createElement(Dn.Z,{reaction:se}))),e.inlineButtons&&o.ZP.createElement(Sa,{message:e,onClick:Ie}),"outside"===tn&&o.ZP.createElement(ka,{message:ne,isOutside:!0,activeReaction:oe,availableReactions:ae})),Ee&&o.ZP.createElement(xn,{isOpen:be,anchor:Ee,message:e,album:r,chatUsername:t,messageListType:re,onClose:Te,onCloseAnimationEnd:Ne}))}))),Oa=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{const n=(0,r.fS)(e,t),{chatId:a,isBot:s}=n||{};return{message:n,bot:a&&s?(0,r.dy)(e,a):void 0,channel:!s&&a?(0,r.Z1)(e,a):void 0}}))((({chatId:e,message:t,containerRef:n,bot:s,channel:i})=>{const{viewSponsoredMessage:r,openChat:c,openChatByInvite:l,startBot:u,focusMessage:m}=(0,a.uC)(),h=(0,Re.Z)(),g=(0,o.sO)(null),f=Boolean(t),{observe:p}=(0,mn.S1)({rootRef:n,debounceMs:200,threshold:1});if((0,o.d4)((()=>f?p(g.current,(t=>{t.isIntersecting&&r({chatId:e})})):void 0),[e,f,p,r]),t)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"},s&&(0,Tt.Z)((0,d.Js)(s)||""),i&&(0,Tt.Z)(t.chatInviteTitle||(0,d.U)(h,i,s)||"")),o.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:g},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,pn.H)(t.text.text,t.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},h("SponsoredMessage")))),o.ZP.createElement(Oe.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:()=>{t.chatInviteHash?l({hash:t.chatInviteHash}):t.channelPostId?m({chatId:t.chatId,messageId:t.channelPostId}):(c({id:t.chatId}),t.startParam&&u({botId:t.chatId,param:t.startParam}))},className:"SponsoredMessage__button"},h(t.isBot?"Conversation.ViewBot":t.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),Ua=(0,o.X$)((({chatId:e,messageIds:t,messageGroups:n,isViewportNewest:i,isUnread:r,withUsers:c,areReactionsInMeta:l,noAvatars:u,containerRef:f,anchorIdRef:p,memoUnreadDividerBeforeIdRef:v,memoFirstUnreadIdRef:I,threadId:y,type:Z,isReady:P,isScrollingRef:w,isScrollPatchNeededRef:b,threadTopMessageId:E,hasLinkedChat:S,isSchedule:M,noAppearanceAnimation:R,onFabToggle:k,onNotchToggle:T})=>{const{openHistoryCalendar:B}=(0,a.uC)(),{observeIntersectionForMedia:A,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:L}=function(e,t,n){const{markMessageListRead:s,markMessagesRead:o}=(0,a.uC)(),{observe:i}=(0,mn.S1)({rootRef:t,throttleMs:hn,margin:gn}),{observe:r,freeze:c,unfreeze:d}=(0,mn.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const i=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:s}=n,o=Number(s.lastMessageId||s.messageId);o>a&&(a=o),s.hasUnreadMention&&i.push(o)})),n.current&&a>=n.current&&s({maxId:a}),i.length&&o({messageIds:i})}));(0,pe.Z)(c,d);const{observe:l}=(0,mn.S1)({rootRef:t,throttleMs:hn});return{observeIntersectionForMedia:i,observeIntersectionForReading:r,observeIntersectionForAnimatedStickers:l}}(Z,f,I),{backwardsTriggerRef:O,forwardsTriggerRef:U,fabTriggerRef:F}=function(e,t,n,i,r,c,d,l,u,g){const{loadViewportMessages:f}=(0,a.uC)(),[p,v]=(0,o.Ye)((()=>"thread"===e?[(0,C.Ds)((()=>f({direction:m.Uq.Backwards})),1e3,!0,!1),(0,C.Ds)((()=>f({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[f,n]),I=(0,o.sO)(null),y=(0,o.sO)(null),Z=(0,o.sO)(null);function P(){if(!l)return;if(!n||!n.length)return c(!1),void d(!1);if(!i)return c(!0),void d(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:a,scrollTop:s}=t.current,o=Math.round(a-s-e),u=o<=1;c(r?!u:!(o<=50)),d(!u)}const{observe:w}=(0,mn.S1)({rootRef:t,margin:h.gZ},(e=>{if(!v||!p)return;if(n[0]>=s.AE)return;const t=e.find((({isIntersecting:e})=>e));if(!t)return;const{target:a}=t;"backwards-trigger"===a.className?(h.i4&&u.current&&n.length<=s.hT&&(g.current=!0),p()):"forwards-trigger"===a.className&&v()}));(0,mn._N)(I,w),(0,mn._N)(y,w);const{observe:b,freeze:E,unfreeze:S}=(0,mn.S1)({rootRef:t,margin:100},P);(0,mn._N)(Z,b);const{observe:M,freeze:R,unfreeze:k}=(0,mn.S1)({rootRef:t,margin:1},P);return(0,mn._N)(Z,M),(0,Ie.Z)((()=>{l&&P()}),[l]),(0,Ie.Z)((()=>{E(),R(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:y,fabTriggerRef:Z}}(Z,f,t,i,r,k,T,P,w,b),$=(0,Re.Z)(),D=o.ZP.createElement("div",{className:(0,ue.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,$("UnreadMessages"))),j=R?0:n.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let Q=0;const q=n.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!sn(e[0])&&(0,d.Lo)(e[0])){const i=e[0],r=a===s.length-1&&t===n.length-1;return(0,g.oA)([i.id===v.current&&D,o.ZP.createElement(Ln,{key:i.id,message:i,observeIntersection:x,appearanceOrder:j-++Q,isLastInList:r})])}let i;return(0,g.xH)(e.map(((r,m)=>{const h=sn(r)?r.mainMessage:r,f=sn(r)?r:void 0,I=(0,d.B4)(h),P=sn(r),C=e[m+1];h.previousLocalId&&p.current===`message${h.previousLocalId}`&&(p.current=`message${h.id}`);const w=!P&&h.groupedId?h.groupedId:void 0,b=C&&!sn(C)?C.groupedId:void 0,M={isFirstInGroup:0===m,isLastInGroup:m===e.length-1,isFirstInDocumentGroup:Boolean(w&&w!==i),isLastInDocumentGroup:Boolean(w&&w!==b),isLastInList:m===e.length-1&&a===s.length-1&&t===n.length-1};i=w;const R=(0,d.KK)(h),k="scheduled"!==Z?R:`${h.date}_${R}`;return(0,g.oA)([h.id===v.current&&D,o.ZP.createElement(La,{key:k,message:h,observeIntersectionForBottom:x,observeIntersectionForMedia:A,observeIntersectionForAnimatedStickers:L,album:f,noAvatars:u,withAvatar:M.isLastInGroup&&c&&!I&&!(h.id===E),withSenderName:M.isFirstInGroup&&c&&!I,areReactionsInMeta:l,threadId:y,messageListType:Z,noComments:!1===S,appearanceOrder:j-++Q,isFirstInGroup:M.isFirstInGroup,isLastInGroup:M.isLastInGroup,isFirstInDocumentGroup:M.isFirstInDocumentGroup,isLastInDocumentGroup:M.isLastInDocumentGroup,isLastInList:M.isLastInList}),h.id===E&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,$("DiscussionStarted")))])})))}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:rn.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,ue.Z)("sticky-date",!M&&"interactive"),key:"date-header",onMouseDown:rn.q,onClick:M?void 0:()=>B({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},M&&e.originalDate===s.t4&&$("MessageScheduledUntilOnline"),M&&e.originalDate!==s.t4&&$("MessageScheduledOn",(0,N.j1)($,e.datetime,void 0,!0)),!M&&(0,N.j1)($,e.datetime))),(0,g.xH)(a))}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:O,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(q),i&&o.ZP.createElement(Oa,{key:e,chatId:e,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 Fa=n(3547);const $a=(0,o.X$)((0,a.c$)(((e,{userId:t})=>{const{stickers:n}=e.stickers.greeting,a=(0,d.db)(t)+(0,d.db)(e.currentUserId),s=null!=n&&n.length?n[a%n.length]:void 0,o=(0,r.Z1)(e,t);return o?{sticker:s,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((({sticker:e,connectionState:t,lastUnreadMessageId:n})=>{const{loadGreetingStickers:s,sendMessage:i,markMessageListRead:r}=(0,a.uC)(),c=(0,Re.Z)(),d=(0,o.sO)(null),{observe:l}=(0,mn.S1)({rootRef:d,debounceMs:200});(0,o.d4)((()=>{e||"connectionStateReady"!==t||s()}),[t,s,e]),(0,o.d4)((()=>{"connectionStateReady"===t&&n&&r({maxId:n})}),[t,r,n]);const u=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},i({sticker:e})}),[i]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:d},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},c("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},c("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},e&&o.ZP.createElement(Fa.Z,{sticker:e,onClick:u,clickArg:e,observeIntersection:l,size:160,className:"large"}))))}))),Da=(0,o.X$)((({isChatWithSelf:e,type:t,isGroupChatJustCreated:n})=>{const a=(0,Re.Z)();return"scheduled"===t?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(a):e?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):n?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")))})),ja=(0,C.Ds)((e=>e()),200,!1),Qa=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,type:a})=>{const s=(0,r.Z1)(e,t);if(!s)return{};const o=(0,r.$W)(e,t,n,a),i="scheduled"===a?(0,r.Fn)(e,t):(0,r.Zw)(e,t),c=(0,r.qS)(e,t,n);if(n!==u._f&&!(i&&c&&i[c]))return{};const{isRestricted:l,restrictionReason:m,lastMessage:h}=s,g=(0,r.G$)(e,t),f=n===u._f&&!o&&!s.unreadCount&&!g&&h&&!h.groupedId,p=(0,r.IK)(e,t);let v;return(0,r.pk)(e,t)&&(v=p.fullInfo?p.fullInfo.botDescription||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:l,restrictionReason:m,isChannelChat:(0,d.eA)(s),isGroupChat:(0,d.Bf)(s),isCreator:s.isCreator,isChatWithSelf:(0,r.FM)(e,t),isRepliesChat:(0,d.pK)(t),isBot:Boolean(p),messageIds:o,messagesById:i,firstUnreadId:(0,r.It)(e,t,n),isViewportNewest:"thread"!==a||(0,r.b9)(e,t,n),threadFirstMessageId:(0,r.yZ)(e,t,n),focusingId:g,isSelectModeActive:(0,r.CA)(e),botDescription:v,threadTopMessageId:c,hasLinkedChat:s.fullInfo&&"linkedChatId"in s.fullInfo?Boolean(s.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...f&&{lastMessage:h}}}))((({chatId:e,threadId:t,type:n,hasTools:i,onFabToggle:c,onNotchToggle:l,isChatLoaded:u,isChannelChat:h,isGroupChat:f,canPost:p,isReady:v,isChatWithSelf:I,isRepliesChat:y,isCreator:Z,isBot:P,messageIds:w,messagesById:b,firstUnreadId:E,isViewportNewest:S,threadFirstMessageId:M,isRestricted:R,restrictionReason:k,focusingId:T,isSelectModeActive:N,lastMessage:B,botDescription:A,threadTopMessageId:x,hasLinkedChat:L,lastSyncTime:O,withBottomShift:U})=>{var F,$,D,j,Q,q;const{loadViewportMessages:G,setScrollOffset:H,loadSponsoredMessages:_,loadMessageReactions:z}=(0,a.uC)(),V=(0,o.sO)(null),Y=(0,o.sO)("thread"===n&&(0,r.Vt)((0,a.Rd)(),e,t)||0),X=(0,o.sO)(),K=(0,o.sO)(),W=(0,o.sO)(),J=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(!1),ae=(0,o.sO)(Boolean(B)),[se,oe]=(0,o.eJ)(),ie=Boolean(w);(0,Ie.Z)((()=>{ie&&(0,C.R3)((()=>{ae.current=!1}))}),[ie]),(0,Ie.Z)((()=>{J.current=E}),[E]),(0,Ie.Z)((()=>{h&&v&&O&&_({chatId:e})}),[e,v,h,O]),(0,Ie.Z)((()=>{ie&&(ee.current=J.current)}),[ie]),(0,Ie.Z)((()=>{te.current=T}),[T]);const re=(0,o.Ye)((()=>{if(!w||!b)return;const e=!x||w[0]&&M!==w[0]?w:[x,...w];if(!e.length)return;const t=e.map((e=>b[e])).filter(Boolean);return on((0,g.Xo)(t,["date","id"]),ee.current)}),[w,b,M,x]);(0,un.Z)((()=>{if(!w||!b)return;const t=w.filter((e=>{var t;return null===(t=b[e])||void 0===t?void 0:t.reactions}));t.length&&z({chatId:e,ids:t})}),15e3);const ce=(0,o.Ye)((()=>{if("thread"===n)return(0,C.Ds)((()=>G({direction:m.Uq.Around})),1e3,!0,!1)}),[G,w]),{isScrolled:de,updateStickyDates:me}=function(){const[e,t]=(0,Se.Z)(!1),n=(0,cn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,C.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,C.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:s}=e,o=n-a;return-s<=o&&o<=(t?60:10)}))}(e,a);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),he=(0,o.sO)(),ge=(0,o.sO)(),fe=(0,o.I4)((()=>{if(ne.current)return void(ne.current=!1);he.current=!0;const a=V.current;te.current||me(a,i),ja((()=>{he.current=!1,(0,C.T2)((()=>{a.parentElement&&(Y.current=a.scrollHeight-a.scrollTop,"thread"===n&&H({chatId:e,threadId:t,scrollOffset:Y.current}))}))}))}),[me,i,n,H,e,t]);(0,o.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((([e])=>{e.target.offsetParent&&oe(e.contentRect.height)}));return e.observe(V.current),()=>{e.disconnect()}}),[]);const{height:pe}=vt();(0,o.d4)((()=>{V.current.dataset.normalHeight=String(V.current.offsetHeight)}),[pe,p]),(0,o.d4)((()=>{if(!ce||!u||R||T)return;if(w&&w[w.length-1]>=s.AE)return;const e=V.current;(!w||w.length<s.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ce()}),[u,w,ce,T,R]),(0,Ie.Z)((()=>{if(!w||!W.current)return;const e=W.current.filter((e=>w.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(X.current=t.id,K.current=t.getBoundingClientRect().top)}),[w,S,se,i]),(0,nn.Z)((([e,t,n])=>{const a=V.current;W.current=Array.from(a.querySelectorAll(".message-list-item"));const o=w&&e&&w[w.length-1]!==e[e.length-1],r=(null==w?void 0:w[0])!==(null==e?void 0:e[0])&&(null==w?void 0:w.length)===s.hT/2+1,c=o&&!r,d=w&&te.current===w[w.length-1],l=S&&c&&w&&w.length<s.hT/2&&!a.parentElement.classList.contains("force-messages-scroll")&&a.firstElementChild.clientHeight<=2*a.offsetHeight;l&&(a.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{a.parentElement&&a.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=a,g=Y.current,f=W.current[W.current.length-1];let p=g-(n||h);c&&(p-=f?f.offsetHeight:0);const v=S&&t&&p<=20;let I;if(c&&v&&!d&&(f&&(0,C.T2)((()=>{(0,ln.Z)(a,f,"end",20)})),I=m-h,Y.current=Math.max(Math.ceil(m-I),h),!l))return;const y=void 0!==n&&n!==se,Z=X.current&&a.querySelector(`#${X.current}`),P=!Z&&ee.current&&a.querySelector(".unread-divider");if(v&&y){if((0,ln.N)())return;I=m-h}else Z?(ge.current&&(ge.current=!1,(0,dn.z)(a)),I=u+(Z.getBoundingClientRect().top-(K.current||0))):I=P?Math.min(P.offsetTop-(i?60:10),m-g):m-g;(0,dn.Z)(a,Math.ceil(I)),te.current||(ne.current=!0,(0,C.T2)((()=>{ne.current=!1}))),Y.current=Math.max(Math.ceil(m-I),h)}),[w,S,se,i]),(0,an.Z)((([e])=>{void 0!==e&&(0,le.YW)(200+s.fK)}),[N]);const ve=(0,Re.Z)(),ye=Boolean(e&&(0,d.YC)(e)),Ze=Boolean(!ye&&!h||I||y),Pe=Boolean(!Ze||h),Ce=(0,d.YC)(e)&&!I&&!P&&(!re&&!B&&w&&(!W.current||0===W.current.length)||1===(null==w?void 0:w.length)&&"contactSignUp"===(null==b||null===(F=b[w[0]])||void 0===F||null===($=F.content.action)||void 0===$?void 0:$.type)||"contactSignUp"===(null==B||null===(D=B.content)||void 0===D||null===(j=D.action)||void 0===j?void 0:j.type)),we=f&&Z&&1===(null==w?void 0:w.length)&&"chatCreate"===(null==b||null===(Q=b[w[0]])||void 0===Q||null===(q=Q.content.action)||void 0===q?void 0:q.type),be=(0,ue.Z)("MessageList custom-scroll",Pe&&"no-avatars",!p&&"no-composer","pinned"===n&&"type-pinned",U&&"with-bottom-shift",N&&"select-mode-active",de&&"scrolled",!v&&"is-animating");return o.ZP.createElement("div",{ref:V,className:be,onScroll:fe,onMouseDown:rn.q},R?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,k?k.text:"This is a private "+(h?"channel":"chat"))):A?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,Tt.Z)(ve(A),["br","emoji","links"]))):Ce?o.ZP.createElement($a,{userId:e}):!w||re&&!we?w&&re||B?o.ZP.createElement(Ua,{chatId:e,messageIds:w||[B.id],messageGroups:re||on([B]),isViewportNewest:Boolean(S),isUnread:Boolean(E),withUsers:Ze,areReactionsInMeta:ye,noAvatars:Pe,containerRef:V,anchorIdRef:X,memoUnreadDividerBeforeIdRef:ee,memoFirstUnreadIdRef:J,threadId:t,type:n,isReady:v,isScrollingRef:he,isScrollPatchNeededRef:ge,threadTopMessageId:x,hasLinkedChat:L,isSchedule:!!re&&"scheduled"===n,noAppearanceAnimation:!re||!ae.current,onFabToggle:c,onNotchToggle:l}):o.ZP.createElement(We.Z,{color:"white",backgroundColor:"dark"}):o.ZP.createElement(Da,{chatId:e,type:n,isChatWithSelf:I,isGroupChatJustCreated:we}))}))),qa=(0,o.X$)((0,a.c$)((e=>{const t=(0,r.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,r.Z1)(e,n);return{messageListType:s,unreadCount:o&&a===u._f&&"thread"===s?o.unreadCount:void 0}}))((({isShown:e,canPost:t,messageListType:n,unreadCount:s,withExtraShift:i})=>{const{focusNextReply:r}=(0,a.uC)(),c=(0,Re.Z)(),d=(0,o.sO)(null),l=(0,o.I4)((()=>{if(e)if("thread"===n)r();else{const e=d.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,ln.Z)(e,n,"end",20)}}),[e,n,r]),u=(0,ue.Z)("ScrollDownButton",e&&"revealed",!t&&"no-composer",i&&"with-extra-shift");return o.ZP.createElement("div",{ref:d,className:u},o.ZP.createElement("div",{className:"ScrollDownButton-inner"},o.ZP.createElement(Oe.Z,{color:"secondary",round:!0,onClick:l,ariaLabel:c("AccDescrPageDown")},o.ZP.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&o.ZP.createElement("div",{className:"unread-count"},(0,bt.bi)(s))))})));var Ga=n(5723);const Ha=1280,_a=/\.[^/.]+$/;async function za(e,t,n,a){const o=URL.createObjectURL(t),{type:i,size:r}=t;let c,d;if(s.oG.has(i))if(n){const t=await(0,pt.pt)(o),{width:n,height:s}=t;if(n>Ha||s>Ha||"image/jpeg"!==i){const t=await qt(o,Ha/Math.max(n,s),"image/jpeg");return URL.revokeObjectURL(o),za(e,await(0,pt.gm)(t),!0,a)}"image/jpeg"===i&&(e=e.replace(_a,".jpg")),c={width:n,height:s}}else d=o;else if(s.wG.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,pt.jj)(o);c={width:e,height:t,duration:n},d=await(0,pt.ud)(o)}return{blobUrl:o,filename:e,mimeType:i,size:r,quick:c,previewBlobUrl:d,...a}}var Va=n(6391);let Ya;function Xa(e){Ya.focus(),e.focus()}h.cj&&(Ya=document.createElement("input"),Ya.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Ya));var Ka=n(4784),Wa=n(2400),Ja=n(6389),es=n(971);const ts={encoderPath:n.p+"c0155344d336103c2b6a0b28cc510750.js",reuseWorker:!0},ns={type:"audio/ogg"};let as,ss,os;async function is(){return as||(as=n.e(161).then(n.t.bind(n,1161,23)),ss=(await as).default,os=new ss(ts)),as}async function rs(e){await async function(){await is(),await os.start()}();const t=Date.now();let n;const a=[],s=[];os.ondataavailable=e=>{a.push(e)};const o=function(t,n){const a=t.sourceNode,o=a.context.createAnalyser();o.fftSize=64,a.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{s.push(255*t),e(t)})(n<.1?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(os);return{stop:()=>new Promise(((e,i)=>{os.onstop=()=>{e({blob:new Blob(a,ns),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},os.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{os.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{os.pause(),n=Date.now(),o()}),e)}}}const cs=["image/png","image/jpeg","image/gif"];function ds(e){const{text:t,entities:n}=e||{};if(!t)return"";const a=(0,pn.H)(t,n,void 0,void 0,!0);return Array.isArray(a)?a.join(""):a}let ls,us;var ms=n(3575),hs=n(9295);function gs(e,t,n){const a=(0,cn.Z)(t,!0),[s,i]=(0,o.eJ)(),[r,c,d]=(0,Se.Z)();return(0,le.ZP)(c,d),(0,Ie.Z)((()=>{r||a((()=>{i(e())}))}),[...n,r]),s}const fs=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,ps=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,vs={username:"",query:"",canShowHelp:!1,usernameLowered:""},Is=document.createElement("div");const ys=(0,C.P2)((e=>e()),500,!0),Zs=/^[\w@]{1,32}\s?/i,Ps=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function Cs(){return(Cs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}let ws,bs=!0;const Es=(0,o.X$)((({onActivate:e,...t})=>{const n=(0,o.sO)(!1),a=(0,o.I4)((()=>{if(n.current=!0,bs)return bs=!1,void e();ws&&(clearTimeout(ws),ws=void 0),ws=window.setTimeout((()=>{n.current&&e()}),200)}),[e]),s=(0,o.I4)((()=>{n.current=!1}),[]);return o.ZP.createElement(Oe.Z,Cs({},t,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:s,onClick:h.$b?e:void 0}))})),Ss=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"CalendarModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ms=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"AttachMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Rs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),ks=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Ts=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Ns=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"CustomSendMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Bs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var As=n(9830);const xs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Ls=n(6503);const Os=(0,o.X$)((0,a.c$)(((e,{messageId:t})=>{const{chatId:n}=(0,r.Bt)(e)||{};return n?{message:(0,r.hj)(e,n,t)}:{}}))((({isOpen:e,message:t,onClose:n})=>{const{clickInlineButton:s}=(0,a.uC)(),[i,r]=(0,Ls.Z)(e,n),{isKeyboardSingleUse:c}=t||{},[d,l,u]=(0,Se.Z)(!0),m=()=>{u(),n()};if((0,o.d4)((()=>{l()}),[l,null==t?void 0:t.keyboardButtons]),t&&t.keyboardButtons)return o.ZP.createElement(tt.Z,{isOpen:e||d,autoClose:c,positionX:"right",positionY:"bottom",onClose:m,className:"BotKeyboardMenu",onCloseAnimationEnd:m,onMouseEnter:h.$b?void 0:i,onMouseLeave:h.$b?void 0:r},o.ZP.createElement("div",{className:"content"},t.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Oe.Z,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>s({button:e})},e.text))))))))})));var Us=n(3616),Fs=n(7891);const $s=(0,o.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n,type:a}=(0,r.Bt)(e)||{};if(!t||!n||!a)return{};const{currentUserId:s,forwardMessages:{fromChatId:o,toChatId:i,messageIds:c}}=e,l=(0,r.Yy)(e,t,n),u="scheduled"===a?(0,r.wU)(e,t):(0,r._$)(e,t,n),m=e.settings.byKey.animationLevel>=1,h=i===t;let g,f;if(l?g=(0,r.hj)(e,t,l):u?g=(0,r.kK)(e,t,n,a):h&&1===c.length&&(g=(0,r.hj)(e,o,c[0])),l&&g){const{forwardInfo:n}=g,a=t===s;n&&(n.isChannelPost||a)&&(f=(0,r.cv)(e,g)),f||(f=(0,r.Ur)(e,g))}else h&&(f=(0,d.YC)(o)?(0,r.dy)(e,o):(0,r.Z1)(e,o));return{replyingToId:l,editingId:u,message:g,sender:f,shouldAnimate:m,forwardedMessagesCount:h?c.length:void 0}}))((({replyingToId:e,editingId:t,message:n,sender:s,shouldAnimate:i,forwardedMessagesCount:r})=>{const{setReplyingToId:c,setEditingId:d,focusMessage:l,exitForwardMode:u}=(0,a.uC)(),m=Boolean((e||t)&&n||s&&r),h=(0,Fs.Z)([r],r?300:void 0),{shouldRender:g,transitionClassNames:f}=(0,fe.Z)(h&&m,void 0,!i,void 0,!i),p=(0,o.I4)((()=>{e?c({messageId:void 0}):t?d({messageId:void 0}):r&&u()}),[e,t,r,c,d,u]);(0,o.d4)((()=>m?(0,we.Z)(p):void 0),[m,p]);const v=(0,o.I4)((()=>{l({chatId:n.chatId,messageId:n.id})}),[l,n]),I=(0,ue.Z)("ComposerEmbeddedMessage",f),y=r&&r>1?`${r} forwarded messages`:void 0;if(g)return o.ZP.createElement("div",{className:I},o.ZP.createElement("div",null,o.ZP.createElement(Oe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:p},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(On,{className:"inside-input",message:n,sender:s,customText:y,title:t?"Edit Message":void 0,onClick:v})))}))),Ds=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),js=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Qs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),qs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),Gs=new RegExp(s.FM,"i"),Hs=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n})=>{const a=(0,r.tV)(e,t,n);return{theme:(0,r.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:a}}))((({chatId:e,threadId:t,messageText:n,disabled:s,webPagePreview:i,noWebPage:r,theme:c})=>{const{loadWebPagePreview:d,clearWebPagePreview:l,toggleMessageWebPage:m}=(0,a.uC)(),h=gs((()=>{const{text:e,entities:t}=(0,p.Z)(n),a=t&&t.find((({type:e})=>e===u.Vv.TextUrl));if(a)return a.url;const s=e.match(Gs);return s?s[0]:void 0}),300,[n]);(0,o.d4)((()=>{h?d({text:h}):(l(),m({chatId:e,threadId:t}))}),[e,m,l,h,d,t]),(0,Ie.Z)((()=>{l(),m({chatId:e,threadId:t})}),[e]);const g=Boolean(i&&n.length&&!r&&!s),{shouldRender:f,transitionClassNames:v}=(0,fe.Z)(g),I=(0,wt.Z)(i,!0);if(!f||!I)return;const{photo:y,...Z}=I,P={content:{webPage:Z}};return o.ZP.createElement("div",{className:(0,ue.Z)("WebPagePreview",v)},o.ZP.createElement("div",null,o.ZP.createElement(Oe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{m({chatId:e,threadId:t,noWebPage:!0})}},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(pa,{message:P,inPreview:!0,theme:c})))}))),_s=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0}));var zs;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(zs||(zs={}));const Vs=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{var o,i,c,l,m;const h=(0,r.Z1)(e,t),g=h&&(0,r.Dg)(e,h),f=t!==s.FV?(0,r.IK)(e,t):void 0,p=Boolean(f),v=(0,r.FM)(e,t),I=p&&(0,r.FT)(e,t),y=(0,r.qy)(e,t),{language:Z,shouldSuggestStickers:P}=e.settings.byKey,C=e.emojiKeywords[s.pR],w=Z!==s.pR?e.emojiKeywords[Z]:void 0,b=I?I.id:void 0,E=b?(0,r.hj)(e,t,b):void 0,{currentUserId:S}=e,M=null!=h&&h.fullInfo?(null==h||null===(o=h.fullInfo)||void 0===o?void 0:o.sendAsId)||S:void 0,R=null!=h&&h.sendAsIds&&M&&h.sendAsIds.includes(M)?M:null!=h&&null!==(i=h.adminRights)&&void 0!==i&&i.anonymous?null==h?void 0:h.id:void 0,k=R?(0,r.dy)(e,R):void 0,T=!k&&R?(0,r.Z1)(e,R):void 0;return{editingMessage:(0,r.kK)(e,t,n,a),connectionState:e.connectionState,draft:(0,r.Ms)(e,t,n),chat:h,isChatWithBot:p,isChatWithSelf:v,canScheduleUntilOnline:Boolean(!v&&!p&&h&&g&&(0,d.YC)(t)&&(null===(c=(0,r.ss)(e,t))||void 0===c?void 0:c.wasOnline)),isRightColumnShown:(0,r.Jf)(e),isSelectModeActive:(0,r.CA)(e),withScheduledButton:n===u._f&&"thread"===a&&Boolean(null==y?void 0:y.length),shouldSchedule:"scheduled"===a,botKeyboardMessageId:b,botKeyboardPlaceholder:null==E?void 0:E.keyboardPlaceholder,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==h||null===(l=h.fullInfo)||void 0===l?void 0:l.members,topInlineBotIds:null===(m=e.topInlineBots)||void 0===m?void 0:m.userIds,currentUserId:S,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:P,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==C?void 0:C.keywords,emojiKeywords:null==w?void 0:w.keywords,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:h&&h.fullInfo&&h.fullInfo.botCommands,botCommands:f&&f.fullInfo?f.fullInfo.botCommands||!1:void 0,sendAsUser:k,sendAsChat:T,sendAsId:R}}))((({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:n,isReady:i,onDropHide:r,editingMessage:l,chatId:m,threadId:g,messageListType:v,draft:I,chat:y,connectionState:Z,isChatWithBot:P,isChatWithSelf:w,isRightColumnShown:b,isSelectModeActive:E,isForwarding:S,isPollModalOpen:M,botKeyboardMessageId:R,botKeyboardPlaceholder:k,withScheduledButton:T,stickersForEmoji:B,groupChatMembers:A,topInlineBotIds:x,currentUserId:L,lastSyncTime:O,contentToBeScheduled:U,shouldSuggestStickers:F,baseEmojiKeywords:$,emojiKeywords:D,serverTimeOffset:j,recentEmojis:Q,inlineBots:q,isInlineBotLoading:G,botCommands:H,chatBotCommands:_,sendAsUser:z,sendAsChat:V,sendAsId:X})=>{const{sendMessage:K,clearDraft:W,showDialog:J,setStickerSearchQuery:ee,setGifSearchQuery:te,forwardMessages:ne,openPollModal:ae,closePollModal:se,loadScheduledHistory:oe,openChat:ie,addRecentEmoji:re,sendInlineBotResult:ce,loadSendAs:de,loadFullChat:le}=(0,a.uC)(),me=(0,Re.Z)(),he=(0,o.sO)(null),[ge,fe]=(0,o.eJ)(""),ye=(0,es.Y)(ge),Ze=(0,o.sO)(),Pe=(0,yt.Z)(e),[Ce,be,Ee]=(0,Se.Z)(),[Me,ke]=(0,o.eJ)(),{width:Te}=Y.Z.get(),Ne=null==y?void 0:y.sendAsIds,Be=Ne&&(Ne.length>1||!Ne.includes(L)),Ae=(0,Ja.Z)(m,g);(0,o.d4)((()=>{Ze.current=void 0}),[m]),(0,o.d4)((()=>{m&&O&&g===u._f&&i&&oe({chatId:m})}),[i,m,oe,O,g]),(0,o.d4)((()=>{m&&y&&O&&!Ne&&i&&(0,d.ZV)(y)&&de({chatId:m})}),[y,m,i,O,de,Ne]),(0,o.d4)((()=>{m&&y&&O&&!y.fullInfo&&i&&(0,d.ZV)(y)&&le({chatId:m})}),[y,m,i,O,le]);const xe=(0,o.sO)(!1);(0,Ie.Z)((([e,t])=>{xe.current=Boolean(m===e&&Ne&&!t)}),[m,Ne]),(0,o.bt)((()=>{he.current&&(he.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>')}),[]),(0,o.d4)((()=>{U&&(ke(U),be())}),[U,be]);const[Le,Ue]=(0,o.eJ)([]),[Fe,$e,De]=(0,Se.Z)(),[Qe,qe,Ge]=(0,Se.Z)(),[He,_e,ze]=(0,Se.Z)(),[Ve,Ye,Xe]=(0,Se.Z)(),[Ke,We,Je]=(0,Se.Z)(),[et,tt,nt]=(0,Se.Z)(),[at,st]=(0,Se.Z)(),[ot,it,rt]=(0,Se.Z)(),{startRecordingVoice:ct,stopRecordingVoice:dt,pauseRecordingVoice:lt,activeVoiceRecording:ut,currentRecordTime:mt,recordButtonRef:gt,startRecordTimeRef:ft}=(()=>{const e=(0,o.sO)(null),[t,n]=(0,o.eJ)(),a=(0,o.sO)(),[s,i]=(0,o.eJ)();(0,o.d4)((()=>{h.s$&&h.mh&&is()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:s}=await rs((t=>{e.current&&(a.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),i(Date.now()))}));a.current=Date.now(),i(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}}),[]),c=(0,o.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),d=(0,o.I4)((()=>{if(t){n(void 0),a.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,we.Z)(d):void 0),[t,d]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:d,activeVoiceRecording:t,currentRecordTime:s,recordButtonRef:e,startRecordTimeRef:a}})();(0,un.Z)((()=>{Ae({type:"recordAudio"})}),ut&&s.o_),(0,o.d4)((()=>{ut||Ae({type:"cancel"})}),[ut,Ae]);const pt=l?zs.Edit:!h.mh||ut||ge&&!Le.length||S?t?zs.Schedule:zs.Send:zs.Record,vt=!t,{isMentionTooltipOpen:It,closeMentionTooltip:Zt,insertMention:Pt,mentionFilteredUsers:Ct}=(0,hs.Z)(!Le.length,ye,fe,void 0,A,x,L),{isOpen:wt,id:bt,isGallery:Et,switchPm:St,results:Mt,closeTooltip:Rt,help:kt,loadMore:Nt}=function(e,t,n,s){const{queryInlineBot:i,resetInlineBot:r}=(0,a.uC)(),[c,d,l]=(0,Se.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=gs((()=>function(e){const t=function(e){return Is.innerHTML=e.replace(/<br>/g,"\n"),Is.innerText}(e),n=t.match(fs);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(ps),usernameLowered:n[1].toLowerCase()}:vs}(n)),300,[n])||{},f=(0,yt.Z)(m),p=(0,yt.Z)(u),v=g?null==s?void 0:s[g]:void 0,{id:I,switchPm:y,offset:Z,results:P,isGallery:C,help:w}=v||{};(0,o.d4)((()=>{f!==m&&l()}),[f,m,l]),(0,o.d4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m})}),[m,e,i,t,g]);const b=(0,o.I4)((()=>{i({chatId:t,username:g,query:m,offset:Z})}),[Z,t,m,i,g]);return(0,o.d4)((()=>{e&&I&&(y||null!=P&&P.length)?d():l()}),[I,e,d,P,y,l]),p!==u&&r({username:p}),{isOpen:c,id:I,isGallery:C,switchPm:y,results:P,closeTooltip:l,help:h&&w?`@${u} ${w}`:void 0,loadMore:b}}(Boolean(!Le.length&&O),m,ge,q),{isOpen:Bt,close:At,filteredBotCommands:xt}=function(e,t,n,a){const[s,i,r]=(0,Se.Z)(),[c,d]=(0,o.eJ)(),l=(0,o.I4)((e=>{n||a?ys((()=>{const t=(n||a||[]).filter((({command:t})=>!e||t.includes(e)));d(t&&t.length?t:void 0)})):d(void 0)}),[n,a]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,Wa._)(t.substr(1)).match(Zs);l(e?e[0]:"")}else r();else r()}),[l,t,e,r]),(0,o.d4)((()=>{c&&c.length?i():r()}),[c,i,r]),{isOpen:s,close:r,filteredBotCommands:c}}(Boolean(H&&H.length||_&&_.length),ge,H,_),{isContextMenuOpen:Lt,handleContextMenu:Ot,handleContextMenuClose:Ut,handleContextMenuHide:Ft}=(0,fn.Z)(gt,!(pt===zs.Send&&vt)),{canSendStickers:$t,canSendGifs:Dt,canAttachMedia:jt,canAttachPolls:Qt,canAttachEmbedLinks:qt}=(0,o.Ye)((()=>(0,d.H5)(y,P)),[y,P]),Gt=y&&(0,d.Nl)(y),Ht=(0,d.Hd)(y),{isStickerTooltipOpen:_t,closeStickerTooltip:zt}=function(e,t,n,s=!1){const i=(0,o.Ye)((()=>(0,Wa._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.uC)(),d=h.op&&1===(0,Ka.Z)(i)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),l=Boolean(n)&&d;return(0,o.d4)((()=>{var t;s||(e&&d?r({emoji:h.op?i:null===(t=i.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!l&&d||c())}),[t,d,c,r,e,s]),{isStickerTooltipOpen:l,closeStickerTooltip:c}}(Boolean(F&&$t&&!Le.length),ge,B,!i),{isEmojiTooltipOpen:Vt,closeEmojiTooltip:Yt,filteredEmojis:Xt,insertEmoji:Kt}=(0,ms.Z)(Boolean(F&&$t&&!Le.length),ye,Q,void 0,fe,$,D,!i),Wt=(0,o.I4)(((e,t=s.R2)=>{const n=window.getSelection(),a=document.getElementById(t),o=(0,Tt.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,Va.R)(e,t))return function(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const n=t.getRangeAt(0);n.deleteContents();const a=n.createContextualFragment(e),s=a.lastChild;n.insertNode(a),s?(n.setStartAfter(s),n.setEndAfter(s)):n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}(o),void a.dispatchEvent(new Event("input",{bubbles:!0}))}fe(`${ye.current}${o}`),requestAnimationFrame((()=>{(0,Ga.Z)(a)}))}),[ye]),en=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Va.R)(t,s.R2))return void document.execCommand("delete",!1)}fe(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const a=n.textContent.length,s=document.createRange(),o=window.getSelection();s.setStart(n,a),s.setEnd(n,a),o.removeAllRanges(),o.addRange(s),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(ye.current))}),[ye]),tn=(0,o.I4)(((e=!1)=>{e||fe(""),Ue(c.D),zt(),Ee(),ke(void 0),Zt(),Yt(),h.wB?setTimeout((()=>Xe()),350):Xe()}),[zt,Ee,Zt,Yt,Xe]),nn=(0,o.sO)();nn.current=dt,(0,o.d4)((()=>()=>{nn.current(),tn()}),[m,tn,nn]);const an=((e,t,n,i,r)=>{const{editMessage:c}=(0,a.uC)();return(0,o.d4)((()=>{n?(t(ds(n.content.text)),requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,Ga.Z)(e,!0)}))):t("")}),[n,t]),(0,o.I4)((()=>{const{text:t,entities:a}=(0,p.Z)(e.current);n&&(t||(0,d.u8)(n)?(c({messageId:n.id,text:t,entities:a}),i()):r())}),[c,n,e,r,i])})(ye,fe,l,tn,tt);((e,t,n,i,r,c)=>{const{saveDraft:d,clearDraft:l}=(0,a.uC)(),u=(0,o.I4)(((e,t)=>{const n=i.current;n.length&&!c?d({chatId:e,threadId:t,draft:(0,p.Z)(n)}):l({chatId:e,threadId:t})}),[l,c,i,d]),m=(0,o.Ye)((()=>(0,C.Ds)((e=>e()),s.r_,!1)),[t]),g=(0,yt.Z)(t),f=(0,yt.Z)(n);(0,o.d4)((()=>(ls=t,us=n,()=>{ls=void 0,us=void 0,u(t,n)})),[t,n,u]),(0,o.d4)((()=>{t===g&&n===f||e&&(r(ds(e)),h.$b||requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,Ga.Z)(e,!0)})))}),[t,n,e,r,u,g,f]);const v=i.current,I=(0,yt.Z)(v);(0,o.d4)((()=>{t&&n&&g===t&&f===n&&I!==v&&(v.length?m((()=>{ls===t&&us===n&&u(t,n)})):u(t,n))}),[t,v,g,I,f,m,n,u]);const y=(0,o.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,pe.Z)(y),ve(y)})(I,m,g,ye,fe,l),((e,t,n)=>{(0,o.d4)((()=>{async function a(a){if(!a.clipboardData)return;const o=document.activeElement;if(o&&![s.R2,s.nY].includes(o.id))return;const{items:i}=a.clipboardData,r=Array.from(i).find((e=>cs.includes(e.type)&&"file"===e.kind)),c=r&&r.getAsFile(),d=a.clipboardData.getData("text").substring(0,4096);if(a.preventDefault(),c||d){if(c&&!n){const e=await za(c.name,c,!0);t((t=>[...t,e]))}d&&e(d,null==o?void 0:o.id)}}return document.addEventListener("paste",a,!1),()=>{document.removeEventListener("paste",a,!1)}}),[e,n,t])})(Wt,Ue,l);const sn=(0,o.I4)((async(e,t)=>{Ue(await Promise.all(e.map((e=>za(e.name,e,t)))))}),[]),on=(0,o.I4)((async(e,t)=>{Ue([...Le,...await Promise.all(e.map((e=>za(e.name,e,t))))])}),[Le]),rn=(0,o.I4)((()=>{Ue(c.D)}),[]),cn=(0,o.I4)((async(e=!1,t)=>{if("connectionStateReady"!==Z)return;let n=Le;if(ut){const e=await dt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await za("wonderful-voice-message.ogg",t,!1,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:o}=(0,p.Z)(ye.current);if(!n.length&&!a&&!S)return;const i=n.length?1024:4096;if((null==a?void 0:a.length)>i){const e=a.length-i;return void J({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const r=document.getElementById(s.R2);if(n.length||a){if(Ht&&!Gt){const e=(0,f.b)(j),t=Ze.current&&Math.floor(e-Ze.current),n=Ht.nextSendDate&&Ht.nextSendDate>e;if(t&&t<Ht.seconds||n){const a=n?Ht.nextSendDate-e:Ht.seconds-t;return J({data:{message:me("SlowModeHint",(0,N.k9)(a)),isSlowMode:!0,hasErrorKey:!1}}),void r.blur()}}K({text:a,entities:o,attachments:n,scheduledAt:t,isSilent:e})}S&&ne({scheduledAt:t,isSilent:e}),Ze.current=(0,f.b)(j),W({chatId:m,localOnly:!0}),h.cj&&r===document.activeElement&&Xa(r),requestAnimationFrame((()=>{tn()}))}),[Z,Le,ut,S,W,m,j,tn,dt,J,Ht,Gt,K,ne,me,ye]),dn=(0,o.I4)((()=>{Xe(),qe()}),[Xe,qe]),ln=(0,o.I4)((()=>{Ge(),Je(),Ye()}),[Ge,Je,Ye]),mn=(0,o.I4)(((e,n=!1)=>{e={...e,isPreloadedGlobally:!0},t?(ke({sticker:e}),be()):(K({sticker:e}),requestAnimationFrame((()=>{tn(n)})))}),[t,be,K,tn]),hn=(0,o.I4)((e=>{t?(ke({gif:e}),be()):(K({gif:e}),requestAnimationFrame((()=>{tn(!0)})))}),[t,be,K,tn]),gn=(0,o.I4)((e=>{if("connectionStateReady"!==Z)return;ce({id:e.id,queryId:e.queryId});const t=document.getElementById(s.R2);h.cj&&t===document.activeElement&&Xa(t),W({chatId:m,localOnly:!0}),requestAnimationFrame((()=>{tn()}))}),[m,W,Z,tn,ce]),pn=(0,o.I4)((()=>{W({chatId:m,localOnly:!0}),requestAnimationFrame((()=>{tn()}))}),[m,W,tn]),vn=(0,o.I4)((e=>{t?(ke({poll:e}),se(),be()):(K({poll:e}),se())}),[se,be,K,t]),In=(0,o.I4)((()=>{t?(ke({isSilent:!0}),be()):cn(!0)}),[cn,be,t]),yn=(0,o.I4)(((e,t=!1)=>{const{isSilent:n,...a}=Me||{},s=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:j);Me&&0!==Object.keys(a).length?(K({...Me,scheduledAt:s}),requestAnimationFrame((()=>{tn()}))):cn(!!n,s),Ee()}),[Ee,cn,tn,Me,K,j]),Zn=(0,o.I4)((()=>{yn(new Date(1e3*s.t4),!0)}),[yn]),Pn=(0,o.I4)((()=>{Ee(),ke(void 0)}),[Ee]),Cn=(0,o.I4)((e=>{"stickers"===e?(ee({query:""}),te({query:void 0})):(te({query:""}),ee({query:void 0}))}),[ee,te]),wn=(0,o.I4)((()=>{const e=document.getElementById(s.R2);h.wB&&e===document.activeElement?(e.blur(),setTimeout((()=>{Ge(),Ye()}),100)):Ye()}),[Ye,Ge]),bn=(0,o.I4)((()=>{const e=document.getElementById(s.R2);if(!h.wB||e!==document.activeElement)return Ge(),Xe(),void We();e.blur(),setTimeout((()=>{Ge(),Xe(),We()}),100)}),[Ge,Xe,We]),En=(0,o.I4)((()=>{ie({id:m,threadId:g,type:"scheduled"})}),[ie,m,g]);(0,o.d4)((()=>{b&&h.wB&&Xe()}),[b,Xe]),(0,o.d4)((()=>{i&&(E?it():setTimeout((()=>{rt()}),200))}),[E,rt,it,i]);const Sn=(0,o.I4)((()=>{switch(pt){case zs.Send:cn();break;case zs.Record:ct();break;case zs.Edit:an();break;case zs.Schedule:ut&<(),be()}}),[pt,cn,ct,an,ut,be,lt]),Mn=pt===zs.Record&&!jt,Rn=(0,yt.Z)(l,!0),kn=l||Rn,Tn=new Date;Tn.setSeconds(0),Tn.setMilliseconds(0);const Nn=new Date;Nn.setFullYear(Nn.getFullYear()+1);let Bn="SendMessage";switch(pt){case zs.Edit:Bn="Save edited message";break;case zs.Record:Bn=Mn?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const An=(0,ue.Z)("Composer",!E&&"shown",ot&&"hover-disabled"),xn=(0,ue.Z)("mobile-symbol-menu-button",!i&&"not-ready",at?Ve&&"menu-opened":Ve&&"is-loading"),Ln=pt===zs.Edit?an:pt===zs.Schedule?be:cn;return o.ZP.createElement("div",{className:An},jt&&i&&o.ZP.createElement(qs,{isOpen:e!==ht.t.None,withQuick:e===ht.t.QuickFile||Pe===ht.t.QuickFile,onHide:r,onFileSelect:sn}),o.ZP.createElement(Ds,{chatId:m,threadId:g,attachments:Le,caption:Le.length?ge:"",groupChatMembers:A,currentUserId:L,recentEmojis:Q,isReady:i,onCaptionUpdate:fe,baseEmojiKeywords:$,emojiKeywords:D,addRecentEmoji:re,onSend:t?be:cn,onFileAppend:on,onClear:rn}),o.ZP.createElement(Qs,{isOpen:Boolean(M),onClear:se,onSend:vn}),kn&&o.ZP.createElement(Ps,{isOpen:et,isSchedule:"scheduled"===v,onClose:nt,message:kn}),o.ZP.createElement(_s,{isOpen:Ke,onClose:Je,chatId:m,selectedSendAsId:X,sendAsIds:Ne}),o.ZP.createElement(Ts,{isOpen:It,onClose:Zt,onInsertUserName:Pt,filteredUsers:Ct}),o.ZP.createElement(ks,{isOpen:wt,botId:bt,isGallery:Et,inlineBotResults:Mt,switchPm:St,onSelectResult:gn,loadMore:Nt,onClose:Rt}),o.ZP.createElement(xs,{isOpen:Bt,withUsername:Boolean(_),botCommands:xt,onClick:pn,onClose:At}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:he}),o.ZP.createElement($s,null),o.ZP.createElement(Hs,{chatId:m,threadId:g,messageText:Le.length?"":ge,disabled:!qt}),o.ZP.createElement("div",{className:"message-input-wrapper"},P&&!1!==H&&!ut&&!l&&o.ZP.createElement(Es,{className:(0,ue.Z)("bot-commands",Qe&&"activated"),round:!0,disabled:void 0===H,color:"translucent",onActivate:dn,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),Be&&(z||V)&&o.ZP.createElement(Oe.Z,{round:!0,color:"translucent",onClick:Ke?Je:bn,ariaLabel:me("SendMessageAsTitle"),className:(0,ue.Z)("send-as-button",xe.current&&"appear-animation")},o.ZP.createElement(Jt.Z,{user:z,chat:V,size:"tiny"})),h.wB?o.ZP.createElement(Oe.Z,{className:xn,round:!0,color:"translucent",onClick:Ve?Xe:wn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),Ve&&!at&&o.ZP.createElement(je.Z,{color:"gray"})):o.ZP.createElement(Es,{className:Ve?"activated":"",round:!0,color:"translucent",onActivate:ln,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(Us.Z,{id:"message-input-text",chatId:m,threadId:g,html:Le.length?"":ge,placeholder:ut&&Te<=600?"":k||me("Message"),forcedPlaceholder:kt,canAutoFocus:i&&!Le.length,shouldSuppressFocus:h.wB&&Ve,shouldSuppressTextFormatter:Vt||It||wt,onUpdate:fe,onSend:Ln,onSuppressedFocus:Xe}),G&&Boolean(bt)&&o.ZP.createElement(je.Z,{color:"gray"}),T&&o.ZP.createElement(Oe.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:En,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),R&&!ut&&!l&&o.ZP.createElement(Es,{className:Fe?"activated":"",round:!0,color:"translucent",onActivate:$e,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),!ut&&!l&&o.ZP.createElement(Es,{className:He?"activated":"",round:!0,color:"translucent",onActivate:_e,ariaLabel:"Add an attachment"},o.ZP.createElement("i",{className:"icon-attach"})),ut&&mt&&o.ZP.createElement("span",{className:"recording-state"},(0,N.rM)(mt-ft.current)),o.ZP.createElement(Bs,{chatId:m,threadId:g,isOpen:_t,onStickerSelect:mn}),o.ZP.createElement(As.Z,{isOpen:Vt,emojis:Xt,onClose:Yt,onEmojiSelect:Kt,addRecentEmoji:re}),o.ZP.createElement(Ms,{isOpen:He,canAttachMedia:jt,canAttachPolls:Qt,onFileSelect:sn,onPollCreate:ae,onClose:ze}),R&&o.ZP.createElement(Os,{messageId:R,isOpen:Fe,onClose:De}),H&&o.ZP.createElement(js,{isOpen:Qe,botCommands:H,onClose:Ge}),o.ZP.createElement(Rs,{chatId:m,threadId:g,isOpen:Ve,canSendGifs:Dt,canSendStickers:$t,onLoad:st,onClose:Xe,onEmojiSelect:Wt,onStickerSelect:mn,onGifSelect:hn,onRemoveSymbol:en,onSearchOpen:Cn,addRecentEmoji:re}))),ut&&o.ZP.createElement(Oe.Z,{round:!0,color:"danger",className:"cancel",onClick:dt,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(Oe.Z,{ref:gt,round:!0,color:"secondary",className:(0,ue.Z)(pt,!i&&"not-ready",ut&&"recording"),disabled:Mn,ariaLabel:me(Bn),onClick:Sn,onContextMenu:pt===zs.Send&&vt?Ot: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"})),vt&&o.ZP.createElement(Ns,{isOpen:Lt,onSilentSend:w?void 0:In,onScheduleSend:t?void 0:be,onClose:Ut,onCloseAnimationEnd:Ft}),o.ZP.createElement(Ss,{isOpen:Ce,withTimePicker:!0,selectedAt:Tn.getTime(),maxAt:(0,N._F)(Nn),isFutureMode:!0,secondButtonLabel:n?me("Schedule.SendWhenOnline"):void 0,onClose:Pn,onSubmit:yn,onSecondButtonClick:n?Zn:void 0}))}))),Ys=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),Xs=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Ks=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ws=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),Js=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),eo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),to=(0,o.X$)((e=>{const{emojiInteraction:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),no=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),ao=h.wB?450+s.fK:void 0;function so(e){return"file"===e.kind&&e.type&&s.oG.has(e.type)}const oo=(0,o.X$)((0,a.c$)((e=>{const t=(0,r.Pu)(e),{isBlurred:n,background:a,backgroundColor:s,patternColor:o}=e.settings.themes[t]||{},{messageLists:i}=e.messages,c=(0,r.Bt)(e),{isLeftColumnShown:l,chats:{listIds:m},activeEmojiInteraction:g}=e,f={theme:t,customBackground:a,backgroundColor:s,patternColor:o,isLeftColumnShown:l,isRightColumnShown:(0,r.Jf)(e),isBackgroundBlurred:n,isMobileSearchActive:Boolean(h.wB&&(0,r.n5)(e)),isSelectModeActive:(0,r.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,e.messages.messageLists.length-1),activeEmojiInteraction:g};if(!c||!m.active)return f;const{chatId:p,threadId:v,type:I}=c,y=(0,r.Z1)(e,p),Z=(0,r.IK)(e,p),P=(0,r.KB)(e,p),{chatId:C,messageId:w}=e.audioPlayer,b=y&&(0,d.Qm)(y,v),E=(0,r.pk)(e,p),S="pinned"===I,M="scheduled"===I,R="thread"===I&&v===u._f,k=Boolean(y&&(0,d.eA)(y)),T=Boolean(y&&R&&(k||(0,d.ZV)(y))&&y.isNotJoined),N=Boolean(Z&&(0,r.s4)(e,Z.id)),B=!N&&E;return{...f,chatId:p,threadId:v,messageListType:I,isPrivate:(0,d.YC)(p),canPost:!S&&(!y||b)&&!E,isPinnedMessageList:S,isScheduledMessageList:M,currentUserBannedRights:null==y?void 0:y.currentUserBannedRights,defaultBannedRights:null==y?void 0:y.defaultBannedRights,hasPinnedOrAudioPlayer:v!==u._f||Boolean(!S&&(null==P?void 0:P.length))||Boolean(C&&w),pinnedMessagesCount:P?P.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:i,isChannel:k,canSubscribe:T,canStartBot:B,canRestartBot:N}}))((({chatId:e,threadId:t,messageListType:n,isPrivate:i,isPinnedMessageList:r,messageLists:c,canPost:l,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:f,customBackground:p,theme:v,backgroundColor:I,patternColor:y,isLeftColumnShown:Z,isRightColumnShown:P,isBackgroundBlurred:C,isMobileSearchActive:w,isSelectModeActive:b,isPaymentModalOpen:E,isReceiptModalOpen:S,isSeenByModalOpen:M,isReactorListModalOpen:R,animationLevel:k,shouldSkipHistoryAnimations:T,currentTransitionKey:N,isChannel:B,canSubscribe:A,canStartBot:x,canRestartBot:L,activeEmojiInteraction:O})=>{const{openChat:U,unpinAllMessages:F,loadUser:$,closeLocalTextSearch:D,exitMessageSelectMode:j,closePaymentModal:Q,clearReceipt:q,joinChannel:G,sendBotCommand:H,restartBot:Y}=(0,a.uC)(),{width:X}=vt(),K=(0,Re.Z)(),[W,J]=(0,o.eJ)(ht.t.None),[ee,te]=(0,o.eJ)(),[ne,ae]=(0,o.eJ)(),[se,oe]=(0,o.eJ)(!1),ie=g&&(X<s.l3||P&&X>s._m&&X<s.QU||X>=s.ks&&X<s.jT),re=(0,It.Z)(e,ao),ce=(0,It.Z)(t,ao),de=(0,It.Z)(n,ao),le=(0,It.Z)(A,ao),me=(0,It.Z)(x,ao),he=(0,It.Z)(L,ao),ge=(0,It.Z)(l,ao)&&!he&&!me&&!le,fe=(0,It.Z)(ie,ao),pe=(0,It.Z)(ee,ao),ve=(0,It.Z)(B,ao),ye=(0,yt.Z)(N),Ze=void 0!==ye&&ye<N?ye:void 0,{isReady:Pe,handleOpenEnd:be,handleSlideStop:Ee}=function(e,t,n,a){const[i,r]=(0,o.eJ)(!h.wB),c=(0,Zt.Z)(),d=void 0!==n&&n!==t;return d&&(e!==s.oB?r(!1):c()),(0,Ie.Z)((()=>{e===s.oB&&r(!0)}),[e]),{isReady:i&&!d,handleOpenEnd:e!==s.oB?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideStop:e!==s.oB?function(){r(!0)}:void 0}}(k,N,ye,e);(0,o.d4)((()=>e?(0,we.Z)((()=>{U({id:void 0})})):void 0),[e,U]),(0,Ie.Z)((()=>{J(ht.t.None),te(void 0),ae(void 0)}),[e]),(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)((()=>{i&&$({userId:e})}),[e,i,$]);const Se=(0,o.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(so);J(n?ht.t.QuickFile:ht.t.Document)}),[]),ke=(0,o.I4)((()=>{J(ht.t.None)}),[]),Te=(0,o.I4)((()=>{oe(!0)}),[]),Ne=(0,o.I4)((()=>{oe(!1)}),[]),Be=(0,o.I4)((()=>{F({chatId:e}),Ne(),U({id:e})}),[F,U,Ne,e]),Ae=(0,o.I4)((()=>{U({id:e})}),[U,e]),xe=(0,o.I4)((()=>{G({chatId:e})}),[G,e]),Le=(0,o.I4)((()=>{H({command:"/start"})}),[H]),Ue=(0,o.I4)((()=>{Y({chatId:e})}),[e,Y]),Fe=((e,t)=>{const[n,a]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?a(t):ft.fetch(s.fo,e,ft.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,pt.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(v,p),$e=(0,ue.Z)(fe&&"has-header-tools",p&&"custom-bg-image",I&&"custom-bg-color",p&&C&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),De=(0,ue.Z)("messaging-disabled",!b&&"shown"),je=(0,d.q8)(K,u,m),{composerHiddenScale:Qe,toolbarHiddenScale:qe,composerTranslateX:Ge,toolbarTranslateX:He,unpinHiddenScale:_e,toolbarForUnpinHiddenScale:ze}=(0,o.Ye)((()=>function(e,t){const n=e<=s.l3?16:32,a=function(e){if(e>s._m){const t=Math.min(Math.max(.25*e,V),z),n=Math.min(.25*e,z);return Math.min(e-t-n,_)}if(e>s.ks){const t=Math.min(Math.max(.4*e,V),z);return Math.min(e-t,_)}return e>_?_:e}(e),o=e<=s.l3?54:64,i=t?a-n-o:a-n,r=e>s.l3?Math.min(a-n,512):a-n,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}(X,ge)),[ge,X]),Ve=(0,ue.Z)("middle-column-footer",!ge&&"no-composer",ge&&ne&&!b&&"with-notch");(0,Ce.ZP)(re&&ce,(()=>{U({id:void 0},{forceSyncOnIOs:!0})}),void 0,void 0,void 0,(null==c?void 0:c.map(gt.q))||[]),(0,Ce.ZP)(w,D),(0,Ce.ZP)(b,j);const Ye=Boolean(!r&&!ge&&!he&&!me&&!le&&je),Xe=Boolean(he||le||me||r),Ke=Boolean(Ye||b||r);return o.ZP.createElement("div",{id:"MiddleColumn",className:$e,onTransitionEnd:be,style:`\n --composer-hidden-scale: ${Qe};\n --toolbar-hidden-scale: ${qe};\n --unpin-hidden-scale: ${_e};\n --toolbar-unpin-hidden-scale: ${ze};\n --composer-translate-x: ${Ge}px;\n --toolbar-translate-x: ${He}px;\n --pattern-color: ${y};\n --theme-background-color:\n ${I||("dark"===v?s.It:s.p3)};\n `,onClick:h.p7&&Z?Ae:void 0},o.ZP.createElement("div",{id:"middle-column-bg",style:Fe?`--custom-background: ${Fe}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),re&&ce&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:ge?Se:void 0},o.ZP.createElement(tn,{chatId:re,threadId:ce,messageListType:de,isReady:Pe}),o.ZP.createElement(Me.Z,{name:T?"none":k===s.zy?"slide":"fade",activeKey:N,shouldCleanup:!0,cleanupExceptionKey:Ze,onStop:Ee},(()=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Qa,{key:`${re}-${ce}-${de}`,chatId:re,threadId:ce,type:de,canPost:ge,hasTools:fe,onFabToggle:te,onNotchToggle:ae,isReady:Pe,withBottomShift:Xe}),o.ZP.createElement("div",{className:Ve},ge&&o.ZP.createElement(Vs,{chatId:re,threadId:ce,messageListType:de,dropAreaState:W,onDropHide:ke,isReady:Pe}),r&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},o.ZP.createElement(Oe.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Te},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,K("Chat.Pinned.UnpinAll",f,"i")))),Ye&&o.ZP.createElement("div",{className:De},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,je))),h.wB&&le&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},o.ZP.createElement(Oe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:xe},K(ve?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&me&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},o.ZP.createElement(Oe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Le},K("BotStart"))),h.wB&&he&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:K.isRtl?"rtl":void 0},o.ZP.createElement(Oe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ue},K("BotRestart"))),o.ZP.createElement(Xs,{messageListType:de,isActive:b,canPost:ge}),o.ZP.createElement(Ws,{isOpen:Boolean(E),onClose:Q}),o.ZP.createElement(Js,{isOpen:Boolean(S),onClose:q}),o.ZP.createElement(eo,{isOpen:M}),o.ZP.createElement(no,{isOpen:R}))))),o.ZP.createElement(qa,{isShown:pe,canPost:ge,withExtraShift:Ke})),h.wB&&o.ZP.createElement(Ys,{isActive:Boolean(w)})),e&&o.ZP.createElement(Ks,{isOpen:se,chatId:e,pinnedMessagesCount:f,onClose:Ne,onUnpin:Be}),O&&o.ZP.createElement(to,{emojiInteraction:O}))}))),io=(0,C.Ds)((e=>e()),200,!1);var ro;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Management=4]="Management",e[e.ManageInitial=5]="ManageInitial",e[e.ManageChannelSubscribers=6]="ManageChannelSubscribers",e[e.ManageChatAdministrators=7]="ManageChatAdministrators",e[e.ManageChatPrivacyType=8]="ManageChatPrivacyType",e[e.ManageDiscussion=9]="ManageDiscussion",e[e.ManageGroupPermissions=10]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=11]="ManageGroupRemovedUsers",e[e.ManageGroupUserPermissionsCreate=12]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=13]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=14]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=15]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=16]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=17]="ManageGroupMembers",e[e.ManageGroupAddAdmins=18]="ManageGroupAddAdmins",e[e.StickerSearch=19]="StickerSearch",e[e.GifSearch=20]="GifSearch",e[e.PollResults=21]="PollResults",e[e.AddingMembers=22]="AddingMembers",e[e.ManageInvites=23]="ManageInvites",e[e.ManageEditInvite=24]="ManageEditInvite",e[e.ManageReactions=25]="ManageReactions"}(ro||(ro={}));const co=(0,o.X$)((0,a.c$)(((e,{chatId:t,isProfile:n,isManagement:a})=>{var s;const{query:o}=(0,r.n5)(e)||{},{query:i}=(0,r.y5)(e)||{},{query:c}=(0,r.yN)(e)||{},l=t?(0,r.Z1)(e,t):void 0,u=l&&(0,d.eA)(l),m=n&&t&&(0,d.YC)(t)?(0,r.dy)(e,t):void 0,h=m&&(0,d.kw)(m),g=Boolean(!a&&n&&!h&&l&&!(0,r.FM)(e,l.id)&&((0,d.YC)(l.id)||((0,d.Nl)(l)||l.isCreator)&&!l.isNotJoined)),f=Boolean(t&&(null===(s=e.management.byChatId[t])||void 0===s?void 0:s.editingInvite));return{canManage:g,canAddContact:h,isChannel:u,userId:null==m?void 0:m.id,messageSearchQuery:o,stickerSearchQuery:i,gifSearchQuery:c,isEditingInvite:f}}))((({isColumnOpen:e,isProfile:t,isSearch:n,isManagement:s,isStickerSearch:i,isGifSearch:r,isPollResults:c,isAddingChatMembers:d,profileState:l,managementScreen:u,canAddContact:g,userId:f,canManage:p,isChannel:v,onClose:I,messageSearchQuery:y,stickerSearchQuery:Z,gifSearchQuery:P,shouldSkipAnimation:C,isEditingInvite:w})=>{var b;const{setLocalTextSearchQuery:E,setStickerSearchQuery:S,setGifSearchQuery:M,searchTextMessagesLocal:R,toggleManagement:k,openHistoryCalendar:T,addContact:B}=(0,a.uC)(),A=(0,o.sO)(null),x=(0,o.I4)((e=>{E({query:e}),e.length&&io(R)}),[R,E]),L=(0,o.I4)((e=>{S({query:e})}),[S]),O=(0,o.I4)((e=>{M({query:e})}),[M]),U=(0,o.I4)((()=>{B({userId:f})}),[B,f]),[F,$]=(0,o.eJ)(!e);(0,o.d4)((()=>{setTimeout((()=>{$(!e)}),300)}),[e]);const D=(0,Re.Z)(),j=t?l===m.vi.Profile?ro.Profile:l===m.vi.SharedMedia?ro.SharedMedia:l===m.vi.MemberList?ro.MemberList:-1:n?ro.Search:c?ro.PollResults:i?ro.StickerSearch:r?ro.GifSearch:d?ro.AddingMembers:s?u===m.u1.Initial?ro.ManageInitial:u===m.u1.ChatPrivacyType?ro.ManageChatPrivacyType:u===m.u1.Discussion?ro.ManageDiscussion:u===m.u1.ChannelSubscribers?ro.ManageChannelSubscribers:u===m.u1.GroupPermissions?ro.ManageGroupPermissions:u===m.u1.ChatAdministrators?ro.ManageChatAdministrators:u===m.u1.GroupRemovedUsers?ro.ManageGroupRemovedUsers:u===m.u1.GroupUserPermissionsCreate?ro.ManageGroupUserPermissionsCreate:u===m.u1.GroupUserPermissions?ro.ManageGroupUserPermissions:u===m.u1.GroupRecentActions?ro.ManageGroupRecentActions:u===m.u1.ChatAdminRights?ro.ManageGroupAdminRights:u===m.u1.ChatNewAdminRights?ro.ManageGroupNewAdminRights:u===m.u1.GroupMembers?ro.ManageGroupMembers:u===m.u1.Invites?ro.ManageInvites:u===m.u1.EditInvite?ro.ManageEditInvite:u===m.u1.GroupAddAdmins?ro.ManageGroupAddAdmins:u===m.u1.Reactions?ro.ManageReactions:void 0:void 0,Q=null!==(b=(0,wt.Z)(j,!0))&&void 0!==b?b:-1;function q(){if(-1!==Q)switch(Q){case ro.PollResults:return o.ZP.createElement("h3",null,D("PollResults"));case ro.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ue.Z,{parentContainerClassName:"RightSearch",value:y,onChange:x}),o.ZP.createElement(Oe.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>T({selectedAt:(0,N._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case ro.AddingMembers:return o.ZP.createElement("h3",null,D(v?"ChannelAddSubscribers":"GroupAddMembers"));case ro.ManageInitial:return o.ZP.createElement("h3",null,D("Edit"));case ro.ManageChatPrivacyType:return o.ZP.createElement("h3",null,D(v?"ChannelTypeHeader":"GroupTypeHeader"));case ro.ManageDiscussion:return o.ZP.createElement("h3",null,D("Discussion"));case ro.ManageChatAdministrators:return o.ZP.createElement("h3",null,D("ChannelAdministrators"));case ro.ManageGroupRecentActions:return o.ZP.createElement("h3",null,D("Group.Info.AdminLog"));case ro.ManageGroupAdminRights:return o.ZP.createElement("h3",null,D("EditAdminRights"));case ro.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,D("SetAsAdmin"));case ro.ManageGroupPermissions:return o.ZP.createElement("h3",null,D("ChannelPermissions"));case ro.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,D("ChannelBlockedUsers"));case ro.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,D("ChannelAddException"));case ro.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,D("UserRestrictions"));case ro.ManageInvites:return o.ZP.createElement("h3",null,D("lng_group_invite_title"));case ro.ManageEditInvite:return o.ZP.createElement("h3",null,D(w?"EditLink":"NewLink"));case ro.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,D("Channel.Management.AddModerator"));case ro.StickerSearch:return o.ZP.createElement(Ue.Z,{value:Z,placeholder:D("SearchStickersHint"),autoFocusSearch:!0,onChange:L});case ro.GifSearch:return o.ZP.createElement(Ue.Z,{value:P,placeholder:D("SearchGifsTitle"),autoFocusSearch:!0,onChange:O});case ro.SharedMedia:return o.ZP.createElement("h3",null,D("SharedMedia"));case ro.ManageChannelSubscribers:return o.ZP.createElement("h3",null,D("ChannelSubscribers"));case ro.MemberList:case ro.ManageGroupMembers:return o.ZP.createElement("h3",null,D("GroupMembers"));case ro.ManageReactions:return o.ZP.createElement("h3",null,D("Reactions"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},g&&o.ZP.createElement(Oe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:D("AddContact"),onClick:U},o.ZP.createElement("i",{className:"icon-add-user"})),p&&o.ZP.createElement(Oe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:D("Edit"),onClick:k},o.ZP.createElement("i",{className:"icon-edit"}))))}}const G=h.wB||j===ro.SharedMedia||j===ro.MemberList||j===ro.AddingMembers||s,H=(0,ue.Z)("animated-close-icon",G&&"state-back",(F||C)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(Oe.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:I,ariaLabel:D(G?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:A,className:H})),o.ZP.createElement(Me.Z,{name:F||C?"none":"slide-fade",activeKey:Q},q))})));var lo=n(91),uo=n(7407);function mo(e,t,n,a){const[o,i]=(0,uo.Z)(n?t:void 0,a,void 0,s.Vk);return[o,i,!(!o||!a||o[0]===a[0])]}function ho(e,t,n,a,i,r){const c=(0,o.sO)();(0,Ie.Z)((()=>{t===e&&i&&r&&(c.current=(0,d.R5)(i,r,e).reverse())}),[i,r,t,e]);const[l,u]=(0,uo.Z)(a?n:void 0,c.current,void 0,"media"===e?s.EN:s.pn);return[l,u,!(!l||!c.current||l[0]===c.current[0])]}const go=(0,C.P2)((e=>e()),250,!1);let fo=!1;var po=n(1273),vo=n(1876),Io=n(787),yo=n(180),Zo=n(3709),Po=n(5418),Co=n(7262),wo=n(1151),bo=n(2275);const Eo=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function So(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Mo=(0,o.X$)((0,a.c$)(((e,{chatId:t,userId:n})=>{var a,s;const o=(0,r.Z1)(e,t),i=(0,r.Zw)(e,n||t),{currentType:c,resultsByType:l}=(0,r.we)(e)||{},{foundIds:u}=l&&c&&l[c]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,f=o&&(0,d.Bf)(o),p=o&&(0,d.eA)(o),v=f||p&&(0,d.Nl)(o),I=null==o||null===(a=o.fullInfo)||void 0===a?void 0:a.members,y=v&&o&&o.fullInfo&&!o.fullInfo.canViewMembers,Z=v&&o&&((0,d.VE)(o,"inviteUsers")||o.isCreator),P=v&&o&&((0,d.VE)(o,"banUsers")||o.isCreator),C=(0,r.xs)(e,t);let w,b,E;return n?b=n:(0,d.YC)(t)&&(b=t),b&&(E=(0,r.dy)(e,b),w=E&&!E.isSelf&&!(0,d.cS)(E)),{theme:(0,r.Pu)(e),isChannel:p,resolvedUserId:b,chatMessages:i,foundIds:u,mediaSearchType:c,hasCommonChatsTab:w,hasMembersTab:v,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,currentUserId:e.currentUserId,isRightColumnShown:(0,r.Jf)(e),isRestricted:null==o?void 0:o.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:C,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==o?void 0:o.isProtected,...v&&I&&{members:I},...w&&E&&{commonChatIds:null===(s=E.commonChats)||void 0===s?void 0:s.ids}}}))((({chatId:e,profileState:t,onProfileStateChange:n,theme:i,isChannel:r,resolvedUserId:c,currentUserId:l,chatMessages:g,foundIds:f,mediaSearchType:p,hasCommonChatsTab:v,hasMembersTab:I,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,commonChatIds:C,members:w,usersById:b,userStatusesById:E,chatsById:S,isRightColumnShown:M,isRestricted:R,lastSyncTime:k,activeDownloadIds:T,serverTimeOffset:N,isChatProtected:B})=>{const{setLocalMediaSearchType:A,loadMoreMembers:x,loadCommonChats:L,openChat:O,searchMediaMessagesLocal:U,openMediaViewer:F,openAudioPlayer:$,openUserInfo:D,focusMessage:j,loadProfilePhotos:Q,setNewChatMembersDialogState:q}=(0,a.uC)(),G=(0,o.sO)(null),H=(0,o.sO)(null),_=(0,Re.Z)(),[z,V]=(0,o.eJ)(0),[Y,X]=(0,o.eJ)(),K=(0,o.Ye)((()=>[...I?[{type:"members",title:r?"ChannelSubscribers":"GroupMembers"}]:[],...Eo,...v?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[v,I,r]),W=K[z].type,[J,ee,te,ne]=function(e,t,n,a,s,i,r,c,l,u,m,h,g,f,p,v=0){const I="members"!==s&&i?i:s,y=(0,o.Ye)((()=>{if(r&&l&&u)return(0,d.Z0)(r.map((({userId:e})=>e)),l,u,void 0,v)}),[r,v,l,u]),Z=(0,o.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[P,C,w]=mo(0,t,p,y),[b,E,S]=ho("media",I,a,p,h,g),[M,R,k]=ho("documents",I,a,p,h,g),[T,N,B]=ho("links",I,a,p,h,g),[A,x,L]=ho("audio",I,a,p,h,g),[O,U,F]=ho("voice",I,a,p,h,g),[$,D,j]=mo(0,n,p,Z);let Q,q,G=!1;switch(I){case"members":Q=P,q=C,G=w;break;case"commonChats":Q=$,q=D,G=j;break;case"media":Q=b,q=E,G=S;break;case"documents":Q=M,q=R,G=k;break;case"links":Q=T,q=N,G=B;break;case"audio":Q=A,q=x,G=L;break;case"voice":Q=O,q=U,G=F}return[I,Q,q,G]}(0,x,L,U,W,p,w,C,b,E,S,g,f,0,k,N),ae=K.findIndex((({type:e})=>e===J)),{handleScroll:se}=function(e,t,n,a){(0,an.Z)((([n])=>{if(n&&n!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?m.vi.MemberList:m.vi.SharedMedia),fo=!0,(0,ln.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{fo=!1}),350))}}),[t,a]),(0,an.Z)((([t])=>{if(n!==m.vi.Profile||n===t)return;const s=e.current;if(!s)return;const o=s.querySelector(".TabList");!o||o.offsetTop>s.scrollTop||(fo=!0,(0,ln.Z)(s,s.firstElementChild,"start",void 0,2*s.offsetHeight),setTimeout((()=>{fo=!1}),350),a(n))}),[n]);const s=(0,o.I4)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let o=m.vi.Profile;n.scrollTop>=s.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),a(o)}),[e,a,t]);return(0,o.d4)((()=>{fo||s()}),[s,t]),{handleScroll:(0,o.I4)((()=>{fo||go(s)}),[s])}}(G,W,t,n),{applyTransitionFix:oe,releaseTransitionFix:ie}=function(e,t=".Transition.shared-media-transition"){return(0,o.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");a&&s&&(a.style.minHeight=n.offsetHeight-s.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]),{applyTransitionFix:(0,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]),releaseTransitionFix:(0,o.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e])}}(G),[re,ce]=(()=>{const[e,t]=(0,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),de=(0,o.I4)((()=>{ie(),ce()}),[ie,ce]),le=(0,o.I4)((()=>{q(m.WB.InProgress)}),[q]);(0,o.d4)((()=>{A({mediaType:W})}),[A,W]);const ue=c||e;(0,o.d4)((()=>{k&&Q({profileId:ue})}),[Q,ue,k]);const me=(0,o.I4)((e=>{F({chatId:ue,threadId:u._f,messageId:e,origin:m.bZ.SharedMedia})}),[ue,F]),he=(0,o.I4)((e=>{$({chatId:ue,messageId:e})}),[ue,$]),ge=(0,o.I4)((e=>{D({id:e})}),[D]),fe=(0,o.I4)((e=>{j({chatId:ue,messageId:e})}),[ue,j]),pe=(0,o.I4)((()=>{X(void 0)}),[]);let ve;(0,o.d4)((()=>{if(H.current&&h.$b)return(0,He.sf)(H.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===He.eM.Left?(V(Math.min(z+1,K.length-1)),!0):t===He.eM.Right&&(V(Math.max(0,z-1)),!0)})}),[z,K.length]);const Ie="members"===J||!I&&"media"===J;Ie?ve=M?0:1e3:ee||(ve=s.Y);const ye=(0,Fs.Z)([e,J],ve);function Ze(){if(!ee||!ye||!g){const e=Ie&&ee&&!ye;return o.ZP.createElement("div",{className:"content empty-list"},!e&&o.ZP.createElement(je.Z,null))}if(!ee.length){let e;switch(J){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=_("NoGroupsInCommon");break;case"documents":e=_("lng_media_file_empty");break;case"links":e=_("lng_media_link_empty");break;case"audio":e=_("lng_media_song_empty");break;case"voice":e=_("lng_media_audio_empty");break;default:e=_("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(Co.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${J}-list`,dir:_.isRtl&&"media"===J?"rtl":void 0,teactFastList:!0},"media"===J?ee.map((e=>g[e]&&o.ZP.createElement(Zo.Z,{key:e,message:g[e],isProtected:B||g[e].isProtected,onClick:me}))):"documents"===J?ee.map((e=>g[e]&&o.ZP.createElement(Un.Z,{key:e,message:g[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:fe,isDownloading:T.includes(e)}))):"links"===J?ee.map((e=>g[e]&&o.ZP.createElement(Po.Z,{key:e,message:g[e],isProtected:B||g[e].isProtected,onMessageClick:fe}))):"audio"===J?ee.map((e=>g[e]&&o.ZP.createElement(Fn.Z,{key:e,theme:i,message:g[e],origin:m.Cr.SharedMedia,date:g[e].date,lastSyncTime:k,className:"scroll-item",onPlay:he,onDateClick:fe,isDownloading:T.includes(e)}))):"voice"===J?ee.map((e=>g[e]&&o.ZP.createElement(Fn.Z,{key:e,theme:i,message:g[e],senderTitle:(0,lo.F)(_,g[e],S,b),origin:m.Cr.SharedMedia,date:g[e].date,lastSyncTime:k,className:"scroll-item",onPlay:he,onDateClick:fe,isDownloading:T.includes(e)}))):"members"===J?ee.map(((e,t)=>{return o.ZP.createElement(vo.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>ge(e),contextActions:(n=e,n!==l&&P?[{title:_("lng_context_remove_from_group"),icon:"stop",handler:()=>{X(n)}}]:void 0)},o.ZP.createElement(Et.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===J?ee.map(((e,t)=>o.ZP.createElement(vo.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>O({id:e})},o.ZP.createElement(St.Z,{chatId:e})))):void 0)}return o.ZP.createElement(po.Z,{ref:G,className:"Profile custom-scroll",itemSelector:So(J),items:ye?ee:void 0,cacheBuster:re,sensitiveArea:s.qU,preloadBackwards:ye?"members"===J?s.Vk:s.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:te,onScroll:se},!ne&&function(e,t){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(Io.Z,{userId:t||e}),o.ZP.createElement(yo.Z,{chatOrUserId:t||e}))}(e,c),!R&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(Me.Z,{ref:H,name:_.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ae,renderCount:K.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:oe,onStop:de},Ze),o.ZP.createElement(ze.Z,{big:!0,activeTab:z,tabs:K,onSwitchTab:V})),Z&&o.ZP.createElement(wo.Z,{isShown:"members"===J,onClick:le,ariaLabel:_("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&o.ZP.createElement(bo.Z,{isOpen:Boolean(Y),userId:Y,onClose:pe}))}))),Ro=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)})),ko=(0,o.X$)((e=>{const t=(0,Ke.Z)(Xe.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(We.Z,null)})),To=(0,o.X$)((()=>{const e=(0,Ke.Z)(Xe.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(We.Z,null)})),No=(0,o.X$)((()=>{const e=(0,Ke.Z)(Xe.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(We.Z,null)})),Bo=(0,o.X$)((()=>{const e=(0,Ke.Z)(Xe.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(We.Z,null)}));var Ao=n(1820);const xo=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{var n;const a=(0,r.Z1)(e,t),{userIds:s}=e.contactList||{},{byId:o}=e.chats,{currentUserId:i,newChatMembersProgress:c,connectionState:l}=e,u=a&&(0,d.eA)(a),{query:h,fetchingStatus:g,globalUserIds:f,localUserIds:p}=e.userSearch;return{isChannel:u,members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,currentUserId:i,chatsById:o,localContactIds:s,searchQuery:h,isSearching:g,isLoading:c===m.WB.Loading,globalUserIds:f,localUserIds:p,connectionState:l}}))((({isChannel:e,connectionState:t,members:n,onNextStep:s,currentUserId:i,chatsById:r,localContactIds:c,isLoading:l,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:f,onClose:p,isActive:v})=>{const{setUserSearchQuery:I,loadContactList:y}=(0,a.uC)(),Z=(0,Re.Z)(),[P,C]=(0,o.eJ)([]),w=(0,yt.Z)(P)===P;(0,o.d4)((()=>{v&&"connectionStateReady"===t&&y()}),[t,v,y]),(0,Ce.ZP)(v,p);const b=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),E=(0,o.I4)((e=>{I({query:e})}),[I]),S=(0,o.Ye)((()=>{const t=(0,a.Rd)().users.byId,n=c?(0,d.kK)(c,t,u):[];return(0,d.ih)((0,g.Tw)([...n,...h||[],...f||[]]).filter((n=>{const a=t[n];return!b.includes(n)&&n!==i&&(!a||!(0,d.cS)(a)||!e&&a.canBeInvitedToGroup)})),r)}),[c,r,u,h,f,i,b,e]),M=(0,o.I4)((()=>{P.length&&(I({query:""}),s(P))}),[P,I,s]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(Ao.Z,{itemIds:S,selectedIds:P,filterValue:u,filterPlaceholder:Z("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:C,onFilterChange:E,noScrollRestore:w}),o.ZP.createElement(wo.Z,{isShown:Boolean(P.length),disabled:l,ariaLabel:Z("lng_channel_add_users"),onClick:M},l?o.ZP.createElement(je.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Lo=Object.keys(m.qt).length/2,Oo=Object.keys(m.u1).length/2;function Uo(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Fo=(0,o.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{},a=(0,r.g4)(e);return{contentKey:(0,r.Wq)(e),chatId:t,threadId:n,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&a),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((({contentKey:e,chatId:t,threadId:n,currentProfileUserId:i,isChatSelected:r,shouldSkipHistoryAnimations:c})=>{var d;const{toggleChatInfo:l,toggleManagement:u,openUserInfo:h,closeLocalTextSearch:g,setStickerSearchQuery:f,setGifSearchQuery:p,closePollResults:v,addChatMembers:I,setNewChatMembersDialogState:y,setEditingExportedInvite:Z}=(0,a.uC)(),{width:P}=vt(),[C,w]=(0,o.eJ)(m.vi.Profile),[b,E]=(0,o.eJ)(m.u1.Initial),[S,M]=(0,o.eJ)(),[R,k]=(0,o.eJ)(),T=C!==m.vi.Profile,N=void 0!==e,B=e===m.qt.ChatInfo||e===m.qt.UserInfo,A=e===m.qt.Search,x=e===m.qt.Management,L=e===m.qt.StickerSearch,O=e===m.qt.GifSearch,U=e===m.qt.PollResults,F=e===m.qt.AddingMembers,$=P<=s._m,[D,j]=(0,o.eJ)(!N),Q=null!==(d=(0,wt.Z)(e,!0,!r))&&void 0!==d?d:-1,q=(0,o.I4)(((n=!0)=>{switch(e){case m.qt.AddingMembers:y(m.WB.Closed);break;case m.qt.ChatInfo:if(T&&n){w(m.vi.Profile);break}l(void 0,{forceSyncOnIOs:!0});break;case m.qt.UserInfo:if(T&&n){w(m.vi.Profile);break}h({id:void 0},{forceSyncOnIOs:!0});break;case m.qt.Management:switch(b){case m.u1.Initial:u();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:E(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:E(m.u1.GroupPermissions),M(void 0),k(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:E(m.u1.ChatAdministrators);break;case m.u1.EditInvite:E(m.u1.Invites),Z({chatId:t,invite:void 0})}break;case m.qt.Search:Uo(),g();break;case m.qt.StickerSearch:Uo(),f({query:void 0});break;case m.qt.GifSearch:Uo(),p({query:void 0});break;case m.qt.PollResults:v()}}),[e,T,l,h,v,y,b,u,g,f,p,Z,t]),G=(0,o.I4)(((e,t)=>{M(e),k(t)}),[]),H=(0,o.I4)((e=>{I({chatId:t,memberIds:e})}),[I,t]);function _(e){if(-1!==Q)switch(Q){case m.qt.AddingMembers:return o.ZP.createElement(xo,{chatId:t,onNextStep:H,isActive:N&&e,onClose:q});case m.qt.ChatInfo:case m.qt.UserInfo:return o.ZP.createElement(Mo,{key:i||t,chatId:t,userId:i,profileState:C,onProfileStateChange:w});case m.qt.Search:return o.ZP.createElement(Ro,{chatId:t,threadId:n,onClose:q,isActive:N&&e});case m.qt.Management:return o.ZP.createElement(ko,{chatId:t,currentScreen:b,isPromotedByCurrentUser:R,selectedChatMemberId:S,onScreenSelect:E,onChatMemberSelect:G,isActive:N&&e,onClose:q});case m.qt.StickerSearch:return o.ZP.createElement(To,{onClose:q,isActive:N&&e});case m.qt.GifSearch:return o.ZP.createElement(No,{onClose:q,isActive:N&&e});case m.qt.PollResults:return o.ZP.createElement(Bo,{onClose:q,isActive:N&&e})}}return(0,o.d4)((()=>N?(0,we.Z)(q):void 0),[N,q]),(0,o.d4)((()=>{setTimeout((()=>{j(!N)}),300)}),[N]),(0,o.d4)((()=>{N&&$&&q()}),[$]),(0,nn.Z)((([n,a])=>{(n===m.qt.ChatInfo&&e===m.qt.UserInfo||n===m.qt.UserInfo&&e===m.qt.ChatInfo||a!==t)&&(w(m.vi.Profile),E(m.u1.Initial))}),[e,t]),(0,Ce.ZP)(r&&(e===m.qt.ChatInfo||e===m.qt.UserInfo||e===m.qt.Management||e===m.qt.AddingMembers),(()=>q(!1)),l),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},$&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:q}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(co,{chatId:t,isColumnOpen:N,isProfile:B,isSearch:A,isManagement:x,isStickerSearch:L,isGifSearch:O,isPollResults:U,isAddingChatMembers:F,profileState:C,managementScreen:b,onClose:q,shouldSkipAnimation:D||c}),o.ZP.createElement(Me.Z,{name:D||c?"none":"zoom-fade",renderCount:Lo+Oo,activeKey:x?Lo+b:Q,shouldCleanup:!0,cleanupExceptionKey:m.qt.ChatInfo},_)))}))),$o=(0,o.X$)((({isOpen:e})=>{const t=(0,Ke.Z)(Xe.gl.Extra,"MediaViewer",!e);return t?o.ZP.createElement(t,null):void 0}));function Do(e,t){const n=document.createElement("a");n.href=e,n.download=t;try{n.click()}catch(e){console.error(e)}}const jo=new Set,Qo=(0,o.X$)((0,a.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((({activeDownloads:e,messages:t})=>{const{cancelMessageMediaDownload:n}=(0,a.uC)();(0,o.d4)((()=>{Object.entries(e).forEach((([e,a])=>{a.map((n=>t[Number(e)].byId[n])).forEach((e=>{const t=(0,d.Ti)(e,"download");if(t){if(!jo.has(t)){const a=G.UV(t);if(a)return jo.delete(t),Do(a,(0,d.w6)(e)),void n({message:e});G.he(t,u.IU.BlobUrl,!0).then((a=>{jo.delete(t),a&&Do(a,(0,d.w6)(e)),n({message:e})})),jo.add(t)}}else n({message:e})}))}))}),[n,t,e])}))),qo=(0,o.X$)((({isOpen:e})=>{const t=(0,Ke.Z)(Xe.gl.Extra,"Notifications",!e);return t?o.ZP.createElement(t,null):void 0})),Go=(0,o.X$)((({isOpen:e})=>{const t=(0,Ke.Z)(Xe.gl.Extra,"Dialogs",!e);return t?o.ZP.createElement(t,null):void 0})),Ho=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"ForwardPicker",!t);return n?o.ZP.createElement(n,e):void 0})),_o=(0,o.X$)((e=>{const{url:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),zo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ke.Z)(Xe.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Vo=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,Ke.Z)(Xe.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),Yo=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,Ke.Z)(Xe.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),Xo=(0,o.X$)((({isOpen:e})=>{const t=(0,Ke.Z)(Xe.gl.Calls,"CallFallbackConfirm",!e);return t?o.ZP.createElement(t,{isOpen:e}):void 0}));let Ko,Wo=!1;function Jo(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 ei(e){document.title!==e&&(document.title=e)}const ti=(0,o.X$)((0,a.c$)((e=>{const{settings:{byKey:{animationLevel:t,language:n,wasTimeFormatSetManually:a}}}=e,{chatId:s,messageId:o}=e.audioPlayer,i=s&&o?(0,r.hj)(e,s,o):void 0;return{lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:(0,r.Jf)(e),isMediaViewerOpen:(0,r.zQ)(e),isForwardModalOpen:(0,r.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:i,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,r.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:t,language:n,wasTimeFormatSetManually:a,isCallFallbackConfirmOpen:Boolean(e.groupCalls.isFallbackConfirmOpen),addedSetIds:e.stickers.added.setIds}}))((({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:n,isMediaViewerOpen:i,isForwardModalOpen:c,hasNotifications:d,hasDialogs:l,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:f,shouldSkipHistoryAnimations:p,openedStickerSetShortName:v,isServiceChatReady:I,animationLevel:y,language:Z,wasTimeFormatSetManually:P,isCallFallbackConfirmOpen:w,addedSetIds:b})=>{const{loadAnimatedEmojis:E,loadNotificationSettings:S,loadNotificationExceptions:M,updateIsOnline:R,loadTopInlineBots:k,loadEmojiKeywords:T,loadCountryList:N,loadAvailableReactions:B,loadStickerSets:A,loadAddedStickers:x,loadFavoriteStickers:L,ensureTimeFormat:O,openStickerSetShortName:U,checkVersionNotification:F,loadAppConfig:$}=(0,a.uC)(),D=Boolean(e);s.eM&&!Wo&&(Wo=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{e&&(R(!0),$(),B(),E(),S(),M(),k(),T({language:s.pR}))}),[e,E,T,M,S,k,R,B,$]),(0,o.d4)((()=>{e&&(Z!==s.pR&&T({language:Z}),N({langCode:Z}))}),[Z,e,N,T]),(0,o.d4)((()=>{D&&(b?x():(A(),L()))}),[D,b,A,L,x]),(0,o.d4)((()=>{e&&I&&F()}),[e,I,F]),(0,o.d4)((()=>{e&&!P&&O()}),[e,P,O]),(0,o.d4)((()=>{e&&Ce.Oy.startsWith("#?tgaddr=")&&(0,he.o)(decodeURIComponent(Ce.Oy.substr("#?tgaddr=".length)))}),[e]),(0,o.d4)((()=>{if(m)return Y.Z.disableRefresh(),()=>{Y.Z.enableRefresh()}}),[m]);const{transitionClassNames:j}=(0,fe.Z)(!t,void 0,!0,void 0,p),{transitionClassNames:Q}=(0,fe.Z)(n,void 0,!0,void 0,p),q=(0,ue.Z)(j.replace(/([\w-]+)/g,"middle-column-$1"),Q.replace(/([\w-]+)/g,"right-column-$1"),p&&"history-animation-disabled");(0,Ie.Z)((([e])=>{if(void 0===e||0===y)return;const t=(0,le.YW)();(0,me.L)(document.getElementById("MiddleColumn"),t)}),[t]),(0,Ie.Z)((([e])=>{if(void 0===e||0===y)return;(0,C.T2)((()=>{document.body.classList.add("animating-right-column")}));const t=(0,le.YW)();(0,me.L)(document.getElementById("RightColumn"),(()=>{t(),(0,C.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[n]);const G=(0,o.I4)((()=>{R(!1);const e=(0,r.A1)((0,a.Rd)());let t=0;clearInterval(Ko),Ko=window.setInterval((()=>{if(document.title.includes(s.ou))Jo(!1);else{if(t%2==0){const t=(0,r.A1)((0,a.Rd)())-e;t>0&&(ei(`${t} notification${t>1?"s":""}`),Jo(!0))}else ei(s.Ti),Jo(!1);t++}}),1e3)}),[R]),H=(0,o.I4)((()=>{R(!0),clearInterval(Ko),Ko=void 0,document.title.includes(s.ou)||ei(s.Ti),Jo(!1)}),[R]),_=(0,o.I4)((()=>{U({stickerSetShortName:void 0})}),[U]);return(0,pe.Z)(G,H),ve(G),function(e=!1){(0,o.d4)((()=>{if(h.$b){if(!e)return null==ye||ye.setAttribute("content",Ze),h.cj&&!h.fl&&document.addEventListener("gesturestart",Pe),()=>{null==ye||ye.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",Pe)};null==ye||ye.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(i),o.ZP.createElement("div",{id:"Main",className:q,onDrop:ge.Z,onDragOver:ge.Z},o.ZP.createElement(mt,null),o.ZP.createElement(oo,null),o.ZP.createElement(Fo,null),o.ZP.createElement($o,{isOpen:i}),o.ZP.createElement(Ho,{isOpen:c}),o.ZP.createElement(qo,{isOpen:d}),o.ZP.createElement(Go,{isOpen:l}),u&&o.ZP.createElement(Kt,{key:u.id,message:u,noUi:!0}),o.ZP.createElement(_o,{url:g}),o.ZP.createElement(zo,{isOpen:f}),o.ZP.createElement(Hn.Z,{isOpen:Boolean(v),onClose:_,stickerSetShortName:v}),m&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Vo,{groupCallId:m}),o.ZP.createElement(Yo,{groupCallId:m})),o.ZP.createElement(Qo,null),o.ZP.createElement(Xo,{isOpen:w}))})));s.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,a.Rd)().connectionState||(0,a.uC)().initApi()},4524:(e,t,n)=>{e.exports=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"}}]);
|
||
//# sourceMappingURL=791.3afcff552a6178cbcb09.js.map
|