telegram-tt/dist/977.e221174b69f7117724dc.js
Alexander Zinchuk 893f5b7ff9 [Build]
2021-12-13 15:40:21 +01:00

2 lines
228 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[977],{6977:(e,t,s)=>{s.r(t),s.d(t,{Main:()=>Eo});var n=s(5116),a=s(3716),o=s(4050),r=(s(7895),s(307)),i=s(1638),c=s(735),l=s(2858);function d(e){const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};return t&&s?(e=(0,r.qr)(e,t,s,!1),e=(0,r.Pb)(e,t,s,void 0)):e}(0,n.Q6)("openLocalTextSearch",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};if(t&&s)return(0,r.qr)(e,t,s,!0)})),(0,n.Q6)("closeLocalTextSearch",d),(0,n.Q6)("setLocalTextSearchQuery",((e,t,s)=>{const{chatId:n,threadId:a}=(0,i.Bt)(e)||{};if(!n||!a)return;const{query:o}=s,d=(0,l.uw)(n,a),{query:u}=e.localTextSearch.byChatThreadKey[d]||{};return o!==u&&(e=(0,r.Pb)(e,n,a,c.D)),(0,r.qr)(e,n,a,!0,o)})),(0,n.Q6)("setLocalMediaSearchType",((e,t,s)=>{const{chatId:n}=(0,i.Bt)(e)||{};if(!n)return;const{mediaType:a}=s;return(0,r.z5)(e,n,a)})),(0,n.Q6)("openChat",((e,t,s)=>{const{id:a,threadId:o=-1,type:c="thread",shouldReplaceHistory:l=!1}=s,u=(0,i.Bt)(e);return u&&u.chatId===a&&u.threadId===o&&u.type===c||(e=(0,r.pf)(e,a,o,"replyStack",[]),e=d(e=(0,r.i9)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...a!==e.forwardMessages.toChatId&&{forwardMessages:{}}},(0,n.R3)(e)),(0,r.Wy)(e,a,o,c,l)})),(0,n.Q6)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,n.Q6)("openChatWithInfo",((e,t,s)=>{(0,n.R3)({...e,isChatInfoShown:!0}),t.openChat(s)})),(0,n.Q6)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,n.Q6)("setNewChatMembersDialogState",((e,t,s)=>({...e,newChatMembersProgress:s}))),(0,n.Q6)("openNextChat",((e,t,s)=>{const{targetIndexDelta:n,orderedIds:a}=s,{chatId:o}=(0,i.Bt)(e)||{};if(!o)return void t.openChat({id:a[0]});const r=a.indexOf(o);if(-1===r)return;const c=a[r+n];t.openChat({id:c,shouldReplaceHistory:!0})}));var u=s(6137),m=s(1713),h=s(7361),g=s(782),p=s(2267),f=s(3099);const I=a.ck+a.fK;let v;(0,n.Q6)("setScrollOffset",((e,t,s)=>{const{chatId:n,threadId:a,scrollOffset:o}=s;return(0,r.pf)(e,n,a,"scrollOffset",o)})),(0,n.Q6)("setReplyingToId",((e,t,s)=>{const{messageId:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o,threadId:c}=a;return(0,r.pf)(e,o,c,"replyingToId",n)})),(0,n.Q6)("setEditingId",((e,t,s)=>{const{messageId:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o,threadId:c,type:l}=a,d="scheduled"===l?"editingScheduledId":"editingId";return(0,r.pf)(e,o,c,d,n)})),(0,n.Q6)("editLastMessage",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};if(!t||!s)return;const n=(0,i.Zw)(e,t),a=(0,i.Cb)(e,t,s);if(!n||!a)return;const o=(0,g.dF)(a,(t=>Boolean(n[t]&&(0,i._k)(e,n[t],s).canEdit)));return o?(0,r.pf)(e,t,s,"editingId",o):void 0})),(0,n.Q6)("replyToNextMessage",((e,t,s)=>{const{targetIndexDelta:n}=s,{chatId:a,threadId:o}=(0,i.Bt)(e)||{};if(!a||!o)return;const r=(0,i.Zw)(e,a),c=(0,i.Cb)(e,a,o);if(!r||!c)return;const l=(0,i.Yy)(e,a,o);let d;if((0,i.b9)(e,a,o)&&l){const e=Object.keys(r),t=e.indexOf(l.toString())+n;d=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===u._f){var m;const t=(0,i.Z1)(e,a);d=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,i.tZ)(e,a,o);d=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:d}),t.focusMessage({chatId:a,threadId:o,messageId:d})})),(0,n.Q6)("openMediaViewer",((e,t,s)=>{const{chatId:n,threadId:a,messageId:o,avatarOwnerId:r,profilePhotoIndex:i,origin:c}=s;return{...e,mediaViewer:{chatId:n,threadId:a,messageId:o,avatarOwnerId:r,profilePhotoIndex:i,origin:c},forwardMessages:{}}})),(0,n.Q6)("closeMediaViewer",(e=>({...e,mediaViewer:{}}))),(0,n.Q6)("openAudioPlayer",((e,t,s)=>{const{chatId:n,threadId:a,messageId:o,origin:r,volume:i,playbackRate:c,isMuted:l}=s;return{...e,audioPlayer:{chatId:n,threadId:a,messageId:o,origin:null!=r?r:e.audioPlayer.origin,volume:null!=i?i:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:l||e.audioPlayer.isMuted}}})),(0,n.Q6)("setAudioPlayerVolume",((e,t,s)=>{const{volume:n}=s;return{...e,audioPlayer:{...e.audioPlayer,volume:n}}})),(0,n.Q6)("setAudioPlayerPlaybackRate",((e,t,s)=>{const{playbackRate:n}=s;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:n}}})),(0,n.Q6)("setAudioPlayerMuted",((e,t,s)=>{const{isMuted:n}=s;return{...e,audioPlayer:{...e.audioPlayer,isMuted:n}}})),(0,n.Q6)("setAudioPlayerOrigin",((e,t,s)=>{const{origin:n}=s;return{...e,audioPlayer:{...e.audioPlayer,origin:n}}})),(0,n.Q6)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,n.Q6)("openPollResults",((e,t,s)=>{const{chatId:a,messageId:o}=s;(0,i.Jf)(e)?a===e.pollResults.chatId&&o===e.pollResults.messageId||(0,n.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}}):window.setTimeout((()=>{const e=(0,n.Rd)();(0,n.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}})}),450)})),(0,n.Q6)("closePollResults",(e=>{(0,n.R3)({...e,pollResults:{}})})),(0,n.Q6)("focusLastMessage",((e,t)=>{const s=(0,i.Bt)(e);if(!s)return;const{chatId:n,threadId:a}=s;let o;if(a===u._f){var r;const t=(0,i.Z1)(e,n);o=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,i.tZ)(e,n,a);o=null==t?void 0:t.lastMessageId}o&&t.focusMessage({chatId:n,threadId:a,messageId:o,noHighlight:!0})})),(0,n.Q6)("focusNextReply",((e,t)=>{const s=(0,i.Bt)(e);if(!s)return;const{chatId:a,threadId:o}=s,c=(0,i.p9)(e,a,o);if(c&&0!==c.length){const s=c.pop();e=(0,r.pf)(e,a,o,"replyStack",[...c]),(0,n.R3)(e),t.focusMessage({chatId:a,threadId:o,messageId:s})}else t.focusLastMessage()})),(0,n.Q6)("focusMessage",((e,t,s)=>{const{chatId:a,threadId:o=u._f,messageListType:c="thread",noHighlight:l,groupedId:d,groupedChatId:h,replyMessageId:g,isResizingContainer:p}=s;let{messageId:f}=s;if(void 0!==d){const t=(0,i.y8)(e,h,d);null!=t&&t.length&&([f]=t)}const y=(0,i.Bt)(e),Z=!y||a!==y.chatId||o!==y.threadId||c!==y.type;if(v&&(clearTimeout(v),v=void 0),v=window.setTimeout((()=>{let e=(0,n.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,n.R3)(e)}),l?I:1500),e=(0,r.cq)(e,a,f,l,p),e=(0,r.wV)(e,void 0),g){const t=(0,i.p9)(e,a,o)||[];e=(0,r.pf)(e,a,o,"replyStack",[...t,g])}Z&&(e=(0,r.wV)(e,m.fo.Static));const P=(0,i.Cb)(e,a,o);if(P&&P.includes(f))return(0,n.R3)(e),void t.openChat({id:a,threadId:o});if(Z&&(e=(0,r.pf)(e,a,o,"viewportIds",void 0)),e=(0,r.pf)(e,a,o,"outlyingIds",void 0),P&&!Z){const t=f>P[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,n.R3)(e),t.openChat({id:a,threadId:o}),t.loadViewportMessages()})),(0,n.Q6)("openForwardMenu",((e,t,s)=>{const{fromChatId:n,messageIds:a,groupedId:o}=s;let r;return o&&(r=(0,i.xH)(e,n,o)),{...e,forwardMessages:{fromChatId:n,messageIds:r||a,isModalShown:!0}}})),(0,n.Q6)("exitForwardMode",(e=>{(0,n.R3)({...e,forwardMessages:{}})})),(0,n.Q6)("setForwardChatId",((e,t,s)=>{const{id:a}=s;(0,n.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,isModalShown:!1}}),t.openChat({id:a}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,n.Q6)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:s,messageIds:n}=e.selectedMessages;t.openForwardMenu({fromChatId:s,messageIds:n})})),(0,n.Q6)("cancelMessageMediaDownload",((e,t,s)=>{const{message:a}=s,o=e.activeDownloads.byChatId[a.chatId];o&&o.length&&(0,n.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:o.filter((e=>e!==a.id))}}})})),(0,n.Q6)("downloadMessageMedia",((e,t,s)=>{const{message:a}=s;a&&(0,n.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[a.chatId]:[...e.activeDownloads.byChatId[a.chatId]||[],a.id]}}})})),(0,n.Q6)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:s,messageIds:n}=e.selectedMessages,{threadId:a}=(0,i.Bt)(e)||{},o=(0,i.Zw)(e,s);o&&a&&n.map((e=>o[e])).filter((t=>(0,i._k)(e,t,a).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,n.Q6)("enterMessageSelectMode",((e,t,s)=>{const{messageId:n}=s||{},a=(0,i.jr)(e);return a?(0,r.M6)(e,a.id,n):e})),(0,n.Q6)("toggleMessageSelection",((e,t,s)=>{const{messageId:a,groupedId:o,childMessageIds:c,withShift:l}=s,d=(0,i.Bt)(e);if(!d)return;const{chatId:u,threadId:m,type:g}=d;e=(0,r.Ob)(e,u,m,g,a,o,c,l),(0,n.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,n.Q6)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,n.Q6)("exitMessageSelectMode",r.i9),(0,n.Q6)("openPollModal",(e=>({...e,isPollModalOpen:!0}))),(0,n.Q6)("closePollModal",(e=>({...e,isPollModalOpen:!1}))),(0,n.Q6)("checkVersionNotification",((e,t)=>{const s=a.Ji.split(".").slice(0,2).join("."),{serviceNotifications:n}=e;if(n.find((({version:e})=>e===s)))return;const o={chatId:a.aw,date:(0,p.b)(e.serverTimeOffset),content:{text:(0,f.Z)("**Telegram Web Z was updated to version alpha 1.25**\n\n👏 **Harder**\n• Brand new Media Viewer for touch screens with swipe, pinch, double-tap and pan gestures.\n• Read receipts are available for your messages in groups.\n• Join Group, Subscribe to Channel and Start Bot buttons are now shown on mobile screens.\n• Added support for wide screens up to 4K.\n• More accessibility support.\n\n🤩 **Better**\n• Context menus are more compact.\n• Animations adjust to be more native on various devices.\n• Several UI improvements.\n\n🚀 **Faster**\n• Slide transitions and context menus were drastically optimized.\n• UI effects are faster and more efficient.\n\n💪 **Stronger**\n• Deep links properly open in Safari.\n• Increased protocol security.\n")},isOutgoing:!1};t.createServiceNotification({message:o,version:s})})),(0,n.Q6)("createServiceNotification",((e,t,s)=>{var o;const{message:r,version:c}=s,{serviceNotifications:l}=e,d=(0,i.Z1)(e,a.aw),u=Math.max((null===(o=d.lastMessage)||void 0===o?void 0:o.id)||0,...l.map((({id:e})=>e))),m=(l.length+1)/1e3,h=Math.floor(u)+m;r.id=h;const g={id:h,message:r,version:c,isUnread:!0};(0,n.R3)({...e,serviceNotifications:[...l.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:r.id,chatId:r.chatId,message:r})})),(0,n.Q6)("openSeenByModal",((e,t,s)=>{const{chatId:n,messageId:a}=s;return{...e,seenByModal:{chatId:n,messageId:a}}})),(0,n.Q6)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,n.Q6)("setGlobalSearchQuery",((e,t,s)=>{const{query:n}=s,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...n?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:n})})),(0,n.Q6)("addRecentlyFoundChatId",((e,t,s)=>{const{id:n}=s,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[n]});const o=a.filter((e=>e!==n));return o.unshift(n),o.length>10&&o.pop(),(0,r.No)(e,{recentlyFoundChatIds:o})})),(0,n.Q6)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,n.Q6)("setGlobalSearchContent",((e,t,s)=>{const{content:n}=s;return(0,r.Og)(e,n)})),(0,n.Q6)("setGlobalSearchChatId",((e,t,s)=>{const{id:n}=s;return(0,r.No)(e,{chatId:n,query:void 0,resultsByType:void 0})})),(0,n.Q6)("setStickerSearchQuery",((e,t,s)=>{const{query:n}=s;return{...e,stickers:{...e.stickers,search:{query:n,resultIds:void 0}}}})),(0,n.Q6)("setGifSearchQuery",((e,t,s)=>{const{query:n}=s;return{...e,gifs:{...e.gifs,search:{query:n,offsetId:void 0,results:void 0}}}})),(0,n.Q6)("openUserInfo",((e,t,s)=>{const{id:n}=s;t.openChat({id:n})})),(0,n.Q6)("openChat",(e=>(0,r.x1)(e,void 0))),(0,n.Q6)("setUserSearchQuery",((e,t,s)=>{const{query:n}=s;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(n),query:n})})),s(3781);var y=s(1947),Z=s(6926);(0,n.Q6)("toggleChatInfo",(e=>({...e,isChatInfoShown:!e.isChatInfoShown}))),(0,n.Q6)("setLeftColumnWidth",((e,t,s)=>({...e,leftColumnWidth:s}))),(0,n.Q6)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,n.Q6)("toggleManagement",(e=>{const{chatId:t}=(0,i.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,n.Q6)("closeManagement",(e=>{const{chatId:t}=(0,i.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,n.Q6)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,n.Q6)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,n.Q6)("addRecentEmoji",((e,t,s)=>{const{emoji:n}=s,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[n]};const o=a.filter((e=>e!==n));return o.unshift(n),o.length>18&&o.pop(),{...e,recentEmojis:o}})),(0,n.Q6)("addRecentSticker",((e,t,s)=>{const{sticker:n}=s,{recent:a}=e.stickers;if(!a)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[n]}}};const o=a.stickers.filter((e=>e.id!==n.id));return o.unshift(n),{...e,stickers:{...e.stickers,recent:{...a,stickers:o}}}})),(0,n.Q6)("showNotification",((e,t,s)=>{const n=s;n.localId=(0,Z.Z)({});const a=[...e.notifications],o=a.findIndex((e=>e.message===n.message));return-1!==o&&a.splice(o,1),a.push(n),{...e,notifications:a}})),(0,n.Q6)("dismissNotification",((e,t,s)=>{const n=e.notifications.filter((({localId:e})=>e!==s.localId));return{...e,notifications:n}})),(0,n.Q6)("showDialog",((e,t,s)=>{const{data:n}=s;if("message"in n&&n.hasErrorKey&&!(0,y.ZP)(n))return e;const a=[...e.dialogs];if("message"in n){const e=a.findIndex((e=>e.message===n.message));-1!==e&&a.splice(e,1)}return a.push(n),{...e,dialogs:a}})),(0,n.Q6)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,n.Q6)("toggleSafeLinkModal",((e,t,s)=>{const{url:n}=s;return{...e,safeLinkModalUrl:n}})),(0,n.Q6)("openHistoryCalendar",((e,t,s)=>{const{selectedAt:n}=s;return{...e,historyCalendarSelectedAt:n}})),(0,n.Q6)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,n.Q6)("openPaymentModal",((e,t,s)=>{const{chatId:n,messageId:a}=s;return{...e,payment:{...e.payment,chatId:n,messageId:a,isPaymentModalOpen:!0}}})),(0,n.Q6)("closePaymentModal",(e=>{const t=(0,r.bp)(e);return(0,r.WY)(t)})),(0,n.Q6)("addPaymentError",((e,t,s)=>{const{error:n}=s;return{...e,payment:{...e.payment,error:n}}})),s(1689),s(1363),s(6204);var P=s(1226),C=s(9118);const w=new Map,b=(0,C.Ds)((e=>e()),500,!1);async function M(e,t,s,o,c=!1,l=!1){const d=e.id;let u;switch(o){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(a.hT/2)+1);break;case m.Uq.Forwards:u=-(a.hT+1)}const h=await(0,P.t9)("fetchMessages",{chat:(0,i.Cm)((0,n.Rd)(),d,t),offsetId:s,addOffset:u,limit:a.hT,threadId:t});if(!h)return;const{messages:p,users:f,chats:I,threadInfos:v}=h;let y=(0,n.Rd)();const Z=d===a.aw?y.serviceNotifications.map((({message:e})=>e)):[],C=[].concat(p,Z),w=(0,g.ee)(C,"id"),b=Object.keys(w).map(Number);y=(0,r.c_)(y,d,w),y=c?(0,r.ff)(y,d,t,b):(0,r.xj)(y,d,t,b),y=(0,r.Sh)(y,(0,g.ee)(f,"id")),y=(0,r.fZ)(y,(0,g.ee)(I,"id")),y=(0,r.j6)(y,d,v);let M=(0,i.gb)(y,d,t);const E=(0,i.qC)(y,d,t);if(c&&M&&E&&(E.length&&!(0,g.YE)(M,E)||(y=(0,r.xj)(y,d,t,E),M=(0,i.gb)(y,d,t),y=(0,r.pf)(y,d,t,"outlyingIds",void 0),c=!1)),!l){const e=c?E:M,{newViewportIds:n}=S(e,s,o);y=(0,r.y9)(y,d,t,n)}(0,n.R3)(y)}function S(e,t,s){const{length:n}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((s,n)=>s===t||s<t&&e[n+1]>t))}(e,t):-1,r=s===m.Uq.Backwards?o:o+1||n,i=r-a.hT,c=r+a.hT-1,l=e.slice(Math.max(0,i),c+1);let d,u;switch(s){case m.Uq.Backwards:d=r>0,u=i>=0;break;case m.Uq.Forwards:d=r<n,u=c<=n-1;break;case m.Uq.Around:default:d=l.length>0,u=l.length===a.hT}return{newViewportIds:l,areSomeLocal:d,areAllLocal:u}}async function E(e){let t;const s=e.attachment?(e,a)=>{w.has(a)||(t=a,w.set(a,s));const o=(0,n.Rd)();(0,n.R3)({...o,fileUploads:{byMessageLocalId:{...o.fileUploads.byMessageLocalId,[a]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,C.Pn)();const a=(0,n.Rd)();e.serverTimeOffset=a.serverTimeOffset;const o=(0,i.Bt)(a);if(!o)return;const{threadId:r}=o;e.replyingTo||r===u._f||(e.replyingTo=(0,i.qS)(a,e.chat.id,r)),await(0,P.t9)("sendMessage",e,s),s&&t&&w.delete(t)}(0,n.Q6)("loadViewportMessages",((e,t,s)=>{const{direction:n=m.Uq.Around,isBudgetPreload:o=!1}=s||{};let{chatId:c,threadId:l}=s||{};if(!c){const t=(0,i.Bt)(e);if(!t)return;c=t.chatId,l=t.threadId}const d=(0,i.Z1)(e,c);if(!d||d.isRestricted)return;const u=(0,i.Cb)(e,c,l),h=(0,i.gb)(e,c,l),g=(0,i.qC)(e,c,l);if(u&&u.length&&n!==m.Uq.Around){const s=n===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),i=a?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:I}=S(i,s,n);if(f&&(e=(0,r.y9)(e,c,l,p)),async function(e,t,s,n,a,o,r,i){t||await M(a,o,i,r,s,n),n||(await Promise.resolve(),e.loadViewportMessages({chatId:a.id,threadId:o,direction:r,isBudgetPreload:!0}))}(t,I,a,o,d,l,n,s),o)return}else{const t=(0,i.G$)(e,c)||(0,i.rd)(e,c,l),s=Boolean(t&&h&&!h.includes(t)),n=(s?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=S(n,t,m.Uq.Around);p&&u.length>=a.hT&&(e=(0,r.y9)(e,c,l,u)),f||M(d,l,t,m.Uq.Around,s,o)}return e})),(0,n.Q6)("loadMessage",((e,t,s)=>{const{chatId:a,messageId:o,replyOriginForId:c,threadUpdate:l}=s,d=(0,i.Z1)(e,a);d&&(async()=>{const e=await async function(e,t,s){const a=await(0,P.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===u._Q){if(s){let t=(0,n.Rd)();const a=(0,i.hj)(t,e.id,s);t=(0,r.cY)(t,e.id,s,{...a,replyToMessageId:void 0}),(0,n.R3)(t)}return}let o=(0,n.Rd)();return o=(0,r.cY)(o,e.id,t,a.message),o=(0,r.Sh)(o,(0,g.ee)(a.users,"id")),(0,n.R3)(o),a.message}(d,o,c);if(e&&l){const{lastMessageId:t,isDeleting:s}=l;(0,n.R3)((0,r.lG)((0,n.Rd)(),e,a,t,s))}})()})),(0,n.Q6)("sendMessage",((e,t,s)=>{const n=(0,i.Bt)(e);if(!n)return;const{chatId:o,threadId:r,type:c}=n;if("scheduled"===c&&!s.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:s}};const l=(0,i.Z1)(e,o);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:r,value:!1});const d={...s,chat:l,replyingTo:(0,i.Yy)(e,o,r),noWebPage:(0,i.tV)(e,o,r)},u=!s.attachments||s.attachments.length<=1,m=!u&&s.attachments&&s.attachments.length>1;if(u){const{attachments:e,...t}=d;E({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:s,...n}=d,o=(0,g.Vl)(s,a.DU);for(let s=0;s<o.length;s++){const[a,...r]=o[s],i=`${Date.now()}${s}`;E({...n,text:0===s?e:void 0,entities:0===s?t:void 0,attachment:a,groupedId:r.length>0?i:void 0}),r.forEach((e=>{E({...n,attachment:e,groupedId:i})}))}}else{const{text:e,entities:t,attachments:s,replyingTo:n,...a}=d;e&&E({...a,text:e,entities:t,replyingTo:n}),s.forEach((e=>{E({...a,attachment:e})}))}})),(0,n.Q6)("editMessage",((e,t,s)=>{const{serverTimeOffset:n}=e,{text:a,entities:o}=s,r=(0,i.Bt)(e);if(!r)return;const{chatId:c,threadId:l,type:d}=r,u=(0,i.Z1)(e,c),m=(0,i.kK)(e,c,l,d);u&&m&&((0,P.t9)("editMessage",{chat:u,message:m,text:a,entities:o,noWebPage:(0,i.tV)(e,c,l),serverTimeOffset:n}),t.setEditingId({messageId:void 0}))})),(0,n.Q6)("cancelSendingMessage",((e,t,s)=>{const{chatId:n,messageId:a}=s,o=(0,i.hj)(e,n,a),r=o&&w.get(o.previousLocalId||o.id);r&&(0,P.u3)(r),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:n})})),(0,n.Q6)("saveDraft",((e,t,s)=>{const{chatId:n,threadId:a,draft:o}=s;if(!o)return;const{text:c,entities:l}=o,d=(0,i.Z1)(e,n);return a===u._f&&(0,P.t9)("saveDraft",{chat:d,text:c,entities:l,replyToMsgId:(0,i.Yy)(e,n,a)}),e=(0,r.pf)(e,n,a,"draft",o),(0,r.a4)(e,n,{draftDate:Math.round(Date.now()/1e3)})})),(0,n.Q6)("clearDraft",((e,t,s)=>{const{chatId:n,threadId:a,localOnly:o}=s;if(!(0,i.Ms)(e,n,a))return;const c=(0,i.Z1)(e,n);return o||a!==u._f||(0,P.t9)("clearDraft",c),e=(0,r.pf)(e,n,a,"draft",void 0),(0,r.a4)(e,n,{draftDate:void 0})})),(0,n.Q6)("toggleMessageWebPage",((e,t,s)=>{const{chatId:n,threadId:a,noWebPage:o}=s;return(0,r.pf)(e,n,a,"noWebPage",o)})),(0,n.Q6)("pinMessage",((e,t,s)=>{const n=(0,i.jr)(e);if(!n)return;const{messageId:a,isUnpin:o,isOneSide:r,isSilent:c}=s;(0,P.t9)("pinMessage",{chat:n,messageId:a,isUnpin:o,isOneSide:r,isSilent:c})})),(0,n.Q6)("unpinAllMessages",((e,t,s)=>{const a=(0,i.Z1)(e,s.chatId);a&&async function(e){await(0,P.t9)("unpinAllMessages",{chat:e});let t=(0,n.Rd)();t=(0,r.pf)(t,e.id,u._f,"pinnedIds",[]),(0,n.R3)(t)}(a)})),(0,n.Q6)("deleteMessages",((e,t,s)=>{const{messageIds:n,shouldDeleteForAll:a}=s,o=(0,i.Bt)(e);if(!o)return;const{chatId:r,threadId:c}=o,l=(0,i.Z1)(e,r);(0,P.t9)("deleteMessages",{chat:l,messageIds:n,shouldDeleteForAll:a});const d=(0,i._$)(e,r,c);n.includes(d)&&t.setEditingId({messageId:void 0})})),(0,n.Q6)("deleteScheduledMessages",((e,t,s)=>{const{messageIds:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o}=a,r=(0,i.Z1)(e,o);(0,P.t9)("deleteScheduledMessages",{chat:r,messageIds:n});const c=(0,i.wU)(e,o);n.includes(c)&&t.setEditingId({messageId:void 0})})),(0,n.Q6)("deleteHistory",((e,t,s)=>{(async()=>{var n;const{chatId:a,shouldDeleteForAll:o}=s,r=(0,i.Z1)(e,a);if(!r)return;const c=null===(n=r.lastMessage)||void 0===n?void 0:n.id;await(0,P.t9)("deleteHistory",{chat:r,shouldDeleteForAll:o,maxId:c});const l=(0,i.Bt)(e);l&&l.chatId===a&&t.openChat({id:void 0})})()})),(0,n.Q6)("reportMessages",((e,t,s)=>{(async()=>{const{messageIds:n,reason:a,description:o}=s,r=(0,i.Bt)(e);if(!r)return;const{chatId:c}=r,l=(0,i.Z1)(e,c),d=await(0,P.t9)("reportMessages",{peer:l,messageIds:n,reason:a,description:o});t.showNotification({message:d?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()})),(0,n.Q6)("markMessageListRead",((e,t,s)=>{const{serverTimeOffset:n}=e,o=(0,i.Bt)(e);if(!o)return;const{chatId:c,threadId:l}=o,d=(0,i.Cm)(e,c,l);if(!d)return;const{maxId:m}=s;if(b((()=>{(0,P.t9)("markMessageListRead",{serverTimeOffset:n,chat:d,threadId:l,maxId:m})})),l!==u._f)return;c===a.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,i.Cb)(e,c,l),g=(0,i.It)(e,c,l);if(!h||!g||!d.unreadCount)return e;const p=function(e,t,s){let n=0;for(let a=0,o=e.length;a<o&&(e[a]>=t&&e[a]<=s&&n++,!(e[a]>=s));a++);return n}(h,g,m);return p?(0,r.a4)(e,c,{lastReadInboxMessageId:m,unreadCount:Math.max(0,d.unreadCount-p)}):e})),(0,n.Q6)("markMessagesRead",((e,t,s)=>{const n=(0,i.jr)(e);if(!n)return;const{messageIds:a}=s;(0,P.t9)("markMessagesRead",{chat:n,messageIds:a})})),(0,n.Q6)("loadWebPagePreview",((e,t,s)=>{const{text:a}=s;!async function(e){const t=await(0,P.t9)("fetchWebPagePreview",{message:e});(0,n.R3)({...(0,n.Rd)(),webPagePreview:t})}(a)})),(0,n.Q6)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,n.Q6)("sendPollVote",((e,t,s)=>{const{chatId:n,messageId:a,options:o}=s,r=(0,i.Z1)(e,n);r&&(0,P.t9)("sendPollVote",{chat:r,messageId:a,options:o})})),(0,n.Q6)("loadPollOptionResults",((e,t,s)=>{const{chat:a,messageId:o,option:i,offset:c,limit:l,shouldResetVoters:d}=s;!async function(e,t,s,a,o,i){const c=await(0,P.t9)("loadPollOptionResults",{chat:e,messageId:t,option:s,offset:a,limit:o});if(!c)return;let l=(0,n.Rd)();l=(0,r.Sh)(l,(0,g.ee)(c.users,"id"));const{voters:d}=l.pollResults;(0,n.R3)({...l,pollResults:{...l.pollResults,voters:{...d,[s]:(0,g.Tw)([...!i&&d&&d[s]?d[s]:[],...c&&c.users.map((e=>e.id))])},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[s]:c.nextOffset||""}}})}(a,o,i,c,l,d)})),(0,n.Q6)("forwardMessages",((e,t,s)=>{const{fromChatId:a,messageIds:o,toChatId:r}=e.forwardMessages,c=a?(0,i.Z1)(e,a):void 0,d=r?(0,i.Z1)(e,r):void 0,u=a&&o?o.sort(((e,t)=>e-t)).map((t=>(0,i.hj)(e,a,t))).filter(Boolean):void 0;if(!c||!d||!u)return;const{isSilent:m,scheduledAt:h}=s,g=u.filter((e=>!(0,l.jM)(e)));g.length&&(0,P.t9)("forwardMessages",{fromChat:c,toChat:d,messages:g,serverTimeOffset:(0,n.Rd)().serverTimeOffset,isSilent:m,scheduledAt:h}),u.filter((e=>(0,l.jM)(e))).forEach((e=>{const{text:t,entities:s}=e.content.text||{},{sticker:n,poll:a}=e.content;E({chat:d,text:t,entities:s,sticker:n,poll:a,isSilent:m,scheduledAt:h})})),(0,n.R3)({...(0,n.Rd)(),forwardMessages:{}})})),(0,n.Q6)("loadScheduledHistory",((e,t,s)=>{const{chatId:a}=s,o=(0,i.Z1)(e,a);o&&async function(e){const t=await(0,P.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:s}=t,a=(0,g.ee)(s,"id"),o=Object.keys(a).map(Number).sort(((e,t)=>t-e));let i=(0,n.Rd)();i=(0,r.w3)(i,e.id,a),i=(0,r.pf)(i,e.id,u._f,"scheduledIds",o),(0,n.R3)(i)}(o)})),(0,n.Q6)("sendScheduledMessages",((e,t,s)=>{const{chatId:n,id:a}=s,o=(0,i.Z1)(e,n);o&&(0,P.t9)("sendScheduledMessages",{chat:o,ids:[a]})})),(0,n.Q6)("rescheduleMessage",((e,t,s)=>{const{chatId:n,messageId:a,scheduledAt:o}=s,r=(0,i.Z1)(e,n),c=r&&(0,i.Tm)(e,r.id,a);r&&c&&(0,P.t9)("rescheduleMessage",{chat:r,message:c,scheduledAt:o})})),(0,n.Q6)("requestThreadInfoUpdate",((e,t,s)=>{const{chatId:n,threadId:a}=s,o=(0,i.Cm)(e,n,a);o&&(0,P.t9)("requestThreadInfoUpdate",{chat:o,threadId:a})})),(0,n.Q6)("loadPinnedMessages",((e,t,s)=>{const{chatId:a}=s,o=(0,i.Z1)(e,a);o&&async function(e){const t=await(0,P.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:s,chats:a,users:o}=t,i=(0,g.ee)(s,"id"),c=Object.keys(i).map(Number).sort(((e,t)=>t-e));let l=(0,n.Rd)();l=(0,r.c_)(l,e.id,i),l=(0,r.pf)(l,e.id,u._f,"pinnedIds",c),l=(0,r.Sh)(l,(0,g.ee)(o,"id")),l=(0,r.fZ)(l,(0,g.ee)(a,"id")),(0,n.R3)(l)}(o)})),(0,n.Q6)("loadSeenBy",((e,t,s)=>{const{chatId:a,messageId:o}=s,c=(0,i.Z1)(e,a);c&&(async()=>{const e=await(0,P.t9)("fetchSeenBy",{chat:c,messageId:o});e&&(0,n.R3)((0,r.cY)((0,n.Rd)(),a,o,{seenByUserIds:e}))})()}));var k=s(5765);const R=(0,C.P2)((e=>e()),500,!1);async function T(e,t){const s=await(0,P.t9)("searchGifs",{query:e,offset:t});s&&(0,n.R3)((0,r.rq)((0,n.Rd)(),!t,s.gifs,s.nextOffset))}(0,n.Q6)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,P.t9)("fetchStickerSets",{hash:e});t&&(0,n.R3)((0,r.z3)((0,n.Rd)(),"added",t.hash,t.sets))}(t)})),(0,n.Q6)("loadAddedStickers",((e,t)=>{const{setIds:s}=e.stickers.added;s&&s.length&&(async()=>{for(let e=0;e<s.length;e++)t.loadStickers({stickerSetId:s[e]}),e%50==0&&e>0&&await(0,C.wO)(500)})()})),(0,n.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 s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,recent:t}})}(t)})),(0,n.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 s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,favorite:t}})}(t)})),(0,n.Q6)("loadGreetingStickers",(e=>{const{hash:t}=e.stickers.greeting||{};(async()=>{const e=await(0,P.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(!e)return;const s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,greeting:{hash:e.hash,stickers:e.stickers.filter((e=>"👋"===e.emoji))}}})})()})),(0,n.Q6)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,P.t9)("fetchFeaturedStickers",{hash:e});t&&(0,n.R3)((0,r.z3)((0,n.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,n.Q6)("loadStickers",((e,t,s)=>{const{stickerSetId:a,stickerSetShortName:o}=s;let{stickerSetAccessHash:c}=s;if(!c&&!o){const t=(0,i.Ny)(e,a);if(!t)return;c=t.accessHash}!async function(e,t,s){const a=await(0,P.t9)("fetchStickers",{stickerSetShortName:s,stickerSetId:e,accessHash:t});if(!a)return;const{set:o,stickers:i,packs:c}=a;let l=(0,n.Rd)();l=(0,r.Rg)(l,o.id,{...o,stickers:i,packs:c});const d=l.stickers.forEmoji.emoji;d&&c[d]&&(l=(0,r.vy)(l)),(0,n.R3)(l)}(a,c,o)})),(0,n.Q6)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,P.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:s}=e;(0,n.R3)((0,r.g_)((0,n.Rd)(),{...t,stickers:s}))}()})),(0,n.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 s=(0,n.Rd)();(0,n.R3)({...s,gifs:{...s.gifs,saved:t}})}(t)})),(0,n.Q6)("faveSticker",((e,t,s)=>{const{sticker:n}=s;n&&(0,P.t9)("faveSticker",{sticker:n})})),(0,n.Q6)("unfaveSticker",((e,t,s)=>{const{sticker:a}=s;a&&function(e){const t=(0,n.Rd)();(0,n.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})}(a)})),(0,n.Q6)("toggleStickerSet",((e,t,s)=>{const{stickerSetId:n}=s,a=(0,i.Ny)(e,n);if(!a)return;const{accessHash:o,installedDate:r}=a;(0,P.t9)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:n,accessHash:o})})),(0,n.Q6)("loadEmojiKeywords",((e,t,s)=>{var a;const{language:o}=s;let r=e.emojiKeywords[o];null!==(a=r)&&void 0!==a&&a.isLoading||((0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!0}}}),(async()=>{var t;const s=await(0,P.t9)("fetchEmojiKeywords",{language:o,fromVersion:r?r.version:0});e=(0,n.Rd)(),r=e.emojiKeywords[o],s?(0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:s.version,keywords:{...null===(t=r)||void 0===t?void 0:t.keywords,...s.keywords}}}}):(0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!1}}})})())})),(0,n.Q6)("setStickerSearchQuery",((e,t,s)=>{const{query:a}=s;a&&R((()=>{!async function(e,t){const s=await(0,P.t9)("searchStickers",{query:e,hash:void 0});if(!s)return;const a=(0,n.Rd)(),{setsById:o,added:i}=a.stickers,c=s.sets.map((({id:e})=>e));i.setIds&&i.setIds.forEach((t=>{if(!c.includes(t)){const{title:s}=o[t]||{};s&&(0,k.Z)(s,e)&&c.unshift(t)}})),(0,n.R3)((0,r.z3)(a,"search",s.hash,s.sets,c))}(a)}))})),(0,n.Q6)("setGifSearchQuery",((e,t,s)=>{const{query:n}=s;"string"==typeof n&&R((()=>{T(n)}))})),(0,n.Q6)("searchMoreGifs",(e=>{const{query:t,offset:s}=e.gifs.search;"string"==typeof t&&R((()=>{T(t,s)}))})),(0,n.Q6)("loadStickersForEmoji",((e,t,s)=>{const{emoji:a}=s,{hash:o}=e.stickers.forEmoji;R((()=>{!async function(e,t){let s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,forEmoji:{...s.stickers.forEmoji,emoji:e}}});const a=await(0,P.t9)("fetchStickersForEmoji",{emoji:e,hash:t});s=(0,n.Rd)(),a&&s.stickers.forEmoji.emoji===e&&(s=(0,r.IM)(s,e,a.stickers,a.hash),(0,n.R3)(s))}(a,o)}))})),(0,n.Q6)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,n.Q6)("openStickerSetShortName",((e,t,s)=>{const{stickerSetShortName:n}=s;return{...e,openedStickerSetShortName:n}}));var N=s(790);const B=(0,C.P2)((e=>e()),500,!1);async function x(e="",t,s,o,c,l){let d;if(o){const n=await(0,P.t9)("searchMessagesLocal",{chatOrUser:o,query:e,type:t,limit:a.Hk,offsetId:s,minDate:l,maxDate:c});if(n){const{messages:e,users:t,totalCount:s,nextOffsetId:a}=n;d={messages:e,users:t,chats:[],totalCount:s,nextRate:a}}}else d=await(0,P.t9)("searchMessagesGlobal",{query:e,offsetRate:s,limit:a.Hk,type:t,maxDate:c,minDate:l});let u=(0,n.Rd)();const m=(0,i.JX)(u);if(!d||""!==e&&e!==m)return void(0,n.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:I,nextRate:v}=d;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,I,t,v),(0,n.R3)(u)}(0,n.Q6)("setGlobalSearchQuery",((e,t,s)=>{const{chatId:a}=e.globalSearch,{query:o}=s;o&&!a&&B((()=>{!async function(e){const t=await(0,P.t9)("searchChats",{query:e});let s=(0,n.Rd)();const a=(0,i.JX)(s);if(!t||!a||e!==a)return void(0,n.R3)((0,r.xv)(s,{chats:!1}));const{localChats:o,localUsers:c,globalChats:l,globalUsers:d}=t;(o.length||l.length)&&(s=(0,r.fZ)(s,(0,g.ee)([...o,...l],"id"))),(c.length||d.length)&&(s=(0,r.Sh)(s,(0,g.ee)([...c,...d],"id"))),s=(0,r.xv)(s,{chats:!1}),s=(0,r.No)(s,{localResults:{chatIds:o.map((({id:e})=>e)),userIds:c.map((({id:e})=>e))},globalResults:{...s.globalSearch.globalResults,chatIds:l.map((({id:e})=>e)),userIds:d.map((({id:e})=>e))}}),(0,n.R3)(s)}(o)}))})),(0,n.Q6)("setGlobalSearchDate",((e,t,s)=>{const{date:a}=s,o=a?(0,N.IS)(a):a,c=(0,r.No)(e,{date:a,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});(0,n.R3)(c);const{chatId:l}=e.globalSearch;x("","text",void 0,l?(0,i.Z1)(e,l):void 0,o,a)})),(0,n.Q6)("searchMessagesGlobal",((e,t,s)=>{var n;const{query:a,resultsByType:o,chatId:r,date:c}=e.globalSearch,l=c?(0,N.IS)(c):c,{type:d}=s;x(a,d,null==o||null===(n=o[d])||void 0===n?void 0:n.nextOffsetId,r?(0,i.Z1)(e,r):void 0,l,c)})),(0,n.Q6)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{},o=t?(0,i.Z1)(e,t):void 0,c=(0,i.n5)(e);if(!o||!c||!s)return;const{query:l,results:d}=c,m=null==d?void 0:d.nextOffsetId;let h;if(s!==u._f){const n=(0,i.tZ)(e,t,s);h=null==n?void 0:n.topMessageId}!async function(e,t,s,o,c){const l=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:"text",query:o,topMessageId:s,limit:a.pn,offsetId:c});if(!l)return;const{messages:d,users:u,totalCount:m,nextOffsetId:h}=l,p=(0,g.ee)(d,"id"),f=Object.keys(p).map(Number);let I=(0,n.Rd)();const v=(0,i.n5)(I);!v||o&&o!==v.query||(I=(0,r.c_)(I,e.id,p),I=(0,r.Sh)(I,(0,g.ee)(u,"id")),I=(0,r.dx)(I,e.id,t,f,m,h),(0,n.R3)(I))}(o,s,h,l,m)})),(0,n.Q6)("searchMediaMessagesLocal",(e=>{const t=(0,i.og)(e),s=t?e.users.byId[t]||e.chats.byId[t]:void 0,o=(0,i.we)(e);if(!s||!o)return;const{currentType:c,resultsByType:l}=o,d=c&&l&&l[c],u=null==d?void 0:d.nextOffsetId;c&&async function(e,t,s){const o=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:t,limit:a.EN,offsetId:s});if(!o)return;const{messages:c,users:l,totalCount:d,nextOffsetId:u}=o,m=(0,g.ee)(c,"id"),h=Object.keys(m).map(Number);let p=(0,n.Rd)();(0,i.we)(p)&&(p=(0,r.c_)(p,e.id,m),p=(0,r.Sh)(p,(0,g.ee)(l,"id")),p=(0,r.c1)(p,e.id,t,h,d,u),(0,n.R3)(p))}(s,c,u)})),(0,n.Q6)("searchMessagesByDate",((e,t,s)=>{const{timestamp:a}=s,{chatId:o}=(0,i.Bt)(e)||{};if(!o)return;const r=(0,i.Z1)(e,o);r&&async function(e,t){const s=await(0,P.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});s&&(0,n.uC)().focusMessage({chatId:e.id,messageId:s})}(r,a)})),(0,n.Q6)("checkPublicLink",((e,t,s)=>{const{chatId:a}=(0,i.Bt)(e)||{};if(!a)return;if(e.management.progress===m.wv.InProgress)return;const{username:o}=s;(async()=>{e=(0,r.H9)(e,m.wv.InProgress),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,n.R3)(e);const t=await(0,P.t9)("checkChatUsername",{username:o});e=(0,n.Rd)(),e=(0,r.H9)(e,t?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:t}),(0,n.R3)(e)})()})),(0,n.Q6)("updatePublicLink",((e,t,s)=>{const{chatId:a}=(0,i.Bt)(e)||{};let o=a&&(0,i.Z1)(e,a);if(!a||!o)return;const{username:c}=s;(async()=>{if(e=(0,r.H9)(e,m.wv.InProgress),(0,n.R3)(e),(0,l.G9)(o)){if(o=await(0,P.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const s=await(0,P.t9)("setChatUsername",{chat:o,username:c});e=(0,n.Rd)(),e=(0,r.H9)(e,s?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,n.R3)(e)})()})),(0,n.Q6)("updatePrivateLink",(e=>{const{chatId:t}=(0,i.Bt)(e)||{},s=t&&(0,i.Z1)(e,t);t&&s&&(0,P.t9)("updatePrivateLink",{chat:s})}));var L=s(7358);async function A(){const e=await(0,P.t9)("fetchChats",{limit:a.Ov,archived:!0,withPinned:!0,serverTimeOffset:(0,n.Rd)().serverTimeOffset});if(!e)return;let t=(0,n.Rd)();t=(0,r.eD)(t,(0,g.ee)(e.users,"id")),t=(0,r.zn)(t,e.userStatusesById),t=(0,r.GL)(t,(0,g.ee)(e.chats,"id")),t=(0,r.Mg)(t,"archived",e.chatIds),t=(0,r.vv)(t,"archived",e),(0,n.R3)(t)}async function O(){let e=(0,n.Rd)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:s}=e.contactList||{};if(!(s&&s.length||t&&t.length))return;const a=[...t||[],...s||[]].map((t=>(0,i.dy)(e,t))).filter(Boolean),o=await(0,P.t9)("fetchUsers",{users:a});if(!o)return;const{users:c,userStatusesById:l}=o;e=(0,n.Rd)(),e=(0,r.eD)(e,(0,g.ee)(c,"id")),e=(0,r.zn)(e,l),(0,n.R3)(e)}function U(e){return(0,P.t9)("fetchMessages",{chat:e,threadId:u._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(a.hT/2)+1),limit:a.hT})}(0,n.Q6)("sync",((e,t)=>{!async function(e){a.eM&&console.log(">>> START SYNC"),await(0,P.t9)("fetchCurrentUser");const t=await async function(){var e;let t=(0,n.Rd)();const s=await(0,P.t9)("fetchChats",{limit:a.Ov,withPinned:!0,serverTimeOffset:t.serverTimeOffset,lastLocalServiceMessage:null===(e=(0,i.VF)(t))||void 0===e?void 0:e.message});if(!s)return;t=(0,n.Rd)();const{recentlyFoundChatIds:o}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:d}=t,m=[...o||[],...c||[],...d?[d]:[]],h=m.map((e=>(0,i.dy)(t,e))).filter(Boolean),p=m.map((e=>(0,i.Z1)(t,e))).filter(Boolean),{chatId:f}=(0,i.Bt)(t)||{};if(f){const e=(0,i.Z1)(t,f);if(e&&!m.includes(f)&&p.push(e),(0,l.YC)(f)){const e=(0,i.dy)(t,f);e&&!m.includes(f)&&h.push(e)}}return h.push(...s.users),p.push(...s.chats),t=(0,r.ps)(t,s.userStatusesById),t=(0,r.SL)(t,(0,g.ee)(p,"id")),t=(0,r.Mg)(t,"active",s.chatIds),t=(0,r.vv)(t,"active",s),Object.keys(s.draftsById).forEach((e=>{t=(0,r.pf)(t,e,u._f,"draft",s.draftsById[e])})),Object.keys(s.replyingToById).forEach((e=>{t=(0,r.pf)(t,e,u._f,"replyingToId",s.replyingToById[e])})),(0,n.R3)(t),f&&!t.chats.byId[f]&&(0,n.uC)().openChat({id:void 0}),h}();await async function(e){let t=!1,s=e||[],o=(0,n.Rd)();const{chatId:c,threadId:l}=(0,i.Bt)(o)||{},d=Object.keys(o.messages.byChatId).reduce(((e,t)=>{const s=(0,i.Ms)(o,t,u._f);return s&&(e[t]=s),e}),{});if(c){const e=await U(o.chats.byId[c]);o=(0,n.Rd)();const{chatId:d}=(0,i.Bt)(o)||{},m=l&&(0,i.tZ)(o,c,l);if(e&&d===c){const n=o.messages.byChatId[c],i=c===a.aw?o.serviceNotifications.map((({message:e})=>e)):[],d=[].concat(e.messages,i),h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);if(o={...o,messages:{...o.messages,byChatId:{}}},o=(0,r.c_)(o,c,h),o=(0,r.xj)(o,c,u._f,p),o=(0,r.y9)(o,c,u._f,p),l&&m&&m.originChannelId){const{originChannelId:e}=m,t=o.messages.byChatId[e],s=await U(o.chats.byId[e]);if(s){const e=(0,g.ee)(s.messages,"id"),a=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:a,viewportIds:a,outlyingIds:void 0}}},[c]:{...o.messages.byChatId[c],threadsById:{...o.messages.byChatId[c].threadsById,[l]:{...null==n?void 0:n.threadsById[l],outlyingIds:void 0}}}}}}}}o=(0,r.GL)(o,(0,g.ee)(e.chats,"id")),o=(0,r.j6)(o,c,e.threadInfos),t=!0,s=Array.prototype.concat(s,e.users)}}t||(o={...o,messages:{...o.messages,byChatId:{}}}),Object.keys(d).forEach((e=>{o=(0,r.pf)(o,e,u._f,"draft",d[e])})),e?o=(0,r.s5)(o,(0,g.ee)(s,"id")):s&&(o=(0,r.eD)(o,(0,g.ee)(s,"id"))),(0,n.R3)(o);const{chatId:m,messageId:h}=o.audioPlayer;m&&h&&!(0,i.hj)(o,m,h)&&(0,n.uC)().closeAudioPlayer()}(t),(0,n.R3)({...(0,n.Rd)(),lastSyncTime:Date.now()}),a.eM&&console.log(">>> FINISH SYNC"),e()}(t.afterSync)})),(0,n.Q6)("afterSync",((e,t)=>{!async function(e){a.eM&&console.log(">>> START AFTER-SYNC"),e.loadFavoriteStickers(),await Promise.all([O(),A()]),await(0,P.t9)("fetchCurrentUser"),(0,L.w)((0,i.A1)((0,n.Rd)())),a.eM&&console.log(">>> FINISH AFTER-SYNC")}(t)}));const F=(0,C.Ds)((e=>e()),500,!1,!0),$=(0,C.P2)((e=>e()),500,!1);function D(e,t,s){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:s}}}}function Q(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,n.Q6)("loadFullUser",((e,t,s)=>{const{userId:n}=s,a=(0,i.dy)(e,n);if(!a)return;const{id:o,accessHash:r}=a;F((()=>(0,P.t9)("fetchFullUser",{id:o,accessHash:r})))})),(0,n.Q6)("loadUser",((e,t,s)=>{const{userId:a}=s,o=(0,i.dy)(e,a);o&&(async()=>{const t=await(0,P.t9)("fetchUsers",{users:[o]});if(!t)return;const{users:s,userStatusesById:a}=t;e=(0,n.Rd)(),e=(0,r.eD)(e,(0,g.ee)(s,"id")),(0,n.R3)((0,r.ps)(e,{...e.users.statusesById,...a})),(0,n.R3)(e)})()})),(0,n.Q6)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,P.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:s}=e;let a=(0,n.Rd)();a=(0,r.Sh)(a,(0,g.ee)(s,"id")),a={...a,topPeers:{...a.topPeers,userIds:t,lastRequestedAt:(0,p.b)(a.serverTimeOffset)}},(0,n.R3)(a)}()})),(0,n.Q6)("loadContactList",(()=>{!async function(){const e=await(0,P.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,n.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id"));const s=e=>e.lastName||e.firstName||"",a=new Intl.Collator("en-US"),o=e.users.sort(((e,t)=>a.compare(s(e),s(t)))).filter((e=>!e.isSelf));(0,n.R3)({...t,contactList:{userIds:o.map((e=>e.id))}})}()})),(0,n.Q6)("loadCurrentUser",(()=>{(0,P.t9)("fetchCurrentUser")})),(0,n.Q6)("loadCommonChats",(e=>{var t;const{chatId:s}=(0,i.Bt)(e)||{},a=s?(0,i.dy)(e,s):void 0;!a||(0,l.cS)(a)||null!==(t=a.commonChats)&&void 0!==t&&t.isFullyLoaded||(async()=>{var t,s;const o=null===(t=a.commonChats)||void 0===t?void 0:t.maxId,i=await(0,P.t9)("fetchCommonChats",a.id,a.accessHash,o);if(!i)return;const{chats:c,chatIds:l,isFullyLoaded:d}=i;e=(0,n.Rd)(),c.length&&(e=(0,r.fZ)(e,(0,g.ee)(c,"id"))),e=(0,r.Nq)(e,a.id,{commonChats:{maxId:l.length?l[l.length-1]:"0",ids:(0,g.Tw)(((null===(s=a.commonChats)||void 0===s?void 0:s.ids)||[]).concat(l)),isFullyLoaded:d}}),(0,n.R3)(e)})()})),(0,n.Q6)("updateContact",((e,t,s)=>{const{userId:a,isMuted:o,firstName:c,lastName:l}=s;!async function(e,t,s,a){const o=(0,n.Rd)(),c=(0,i.dy)(o,e);if(!c)return;let l;if((0,n.uC)().updateChatMutedState({chatId:e,isMuted:t}),(0,n.R3)((0,r.H9)((0,n.Rd)(),m.wv.InProgress)),c.phoneNumber)l=await(0,P.t9)("updateContact",{phone:c.phoneNumber,firstName:s,lastName:a});else{const{id:e,accessHash:t}=c;l=await(0,P.t9)("addContact",{id:e,accessHash:t,phoneNumber:"",firstName:s,lastName:a})}l&&(0,n.R3)((0,r.Nq)((0,n.Rd)(),c.id,{firstName:s,lastName:a})),(0,n.R3)((0,r.H9)((0,n.Rd)(),m.wv.Complete))}(a,o,c,l)})),(0,n.Q6)("deleteUser",((e,t,s)=>{const{userId:a}=s;!async function(e){const t=(0,n.Rd)(),s=(0,i.dy)(t,e);if(!s)return;const{id:a,accessHash:o}=s;await(0,P.t9)("deleteUser",{id:a,accessHash:o})}(a)})),(0,n.Q6)("loadProfilePhotos",((e,t,s)=>{const{profileId:a}=s,o=(0,l.YC)(a),c=o?(0,i.dy)(e,a):void 0,d=o?void 0:(0,i.Z1)(e,a);(c||d)&&(async()=>{const e=await(0,P.t9)("fetchProfilePhotos",c,d);if(!e||!e.photos)return;let t=(0,n.Rd)();o?t=(0,r.Nq)(t,a,{photos:e.photos}):(t=(0,r.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,r.a4)(t,a,{photos:e.photos})),(0,n.R3)(t)})()})),(0,n.Q6)("setUserSearchQuery",((e,t,s)=>{const{query:a}=s;a&&$((()=>{!async function(e){const t=await(0,P.t9)("searchChats",{query:e});let s=(0,n.Rd)();const a=s.userSearch.query;if(!t||!a||e!==a)return void(0,n.R3)((0,r.Q3)(s,!1));const{localUsers:o,globalUsers:i}=t;let c,l;o.length&&(s=(0,r.Sh)(s,(0,g.ee)(o,"id")),c=o.map((({id:e})=>e))),i.length&&(s=(0,r.Sh)(s,(0,g.ee)(i,"id")),l=i.map((({id:e})=>e))),s=(0,r.Q3)(s,!1),s=(0,r.Lm)(s,{localUserIds:c,globalUserIds:l}),(0,n.R3)(s)}(a)}))})),(0,n.Q6)("addContact",((e,t,s)=>{const{userId:n}=s,a=(0,i.dy)(e,n);a&&(0,P.t9)("addContact",(0,g.ei)(a,["id","accessHash","firstName","lastName","phoneNumber"]))}));const q=(0,C.Ds)((e=>e()),500,!1);async function G(e,t,s,n){await(0,P.t9)("sendMessage",{chat:e,text:s,replyingTo:n})}(0,n.Q6)("clickInlineButton",((e,t,s)=>{const{button:o}=s;switch(o.type){case"command":t.sendBotCommand({command:o.value});break;case"url":o.value.match(a.FS)||o.value.match(a.g$)?t.openTelegramLink({url:o.value}):t.toggleSafeLinkModal({url:o.value});break;case"callback":{const t=(0,i.jr)(e);if(!t)return;!async function(e,t,s){const a=await(0,P.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:s});if(!a)return;const{showDialog:o,showNotification:r,toggleSafeLinkModal:i}=(0,n.uC)(),{message:c,alert:l,url:d}=a;l?o({data:{message:c||"Error"}}):c?r({message:c}):d&&i({url:d})}(t,o.messageId,o.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const s=(0,i.jr)(e),{messageId:n,value:a}=o;if(!s)return;a?t.getReceipt({receiptMessageId:a,chatId:s.id,messageId:n}):(t.getPaymentForm({chat:s,messageId:n}),t.setInvoiceMessageInfo((0,i.hj)(e,s.id,n)),t.openPaymentModal({chatId:s.id,messageId:n}));break}}})),(0,n.Q6)("sendBotCommand",((e,t,s)=>{const{command:n,chatId:a}=s,{currentUserId:o}=e,r=a?(0,i.Z1)(e,a):(0,i.jr)(e),c=(0,i.Bt)(e);if(!o||!r||!c)return;const{threadId:l}=c;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:r.id,threadId:l,value:!1}),G(r,0,n,(0,i.Yy)(e,r.id,l))})),(0,n.Q6)("restartBot",((e,t,s)=>{const{chatId:a}=s,{currentUserId:o}=e,c=(0,i.jr)(e),l=o&&(0,i.IK)(e,a);o&&c&&l&&(async()=>{await(0,P.t9)("unblockContact",l.id,l.accessHash)&&((0,n.R3)((0,r.rB)((0,n.Rd)(),l.id)),G(c,0,"/start"))})()})),(0,n.Q6)("loadTopInlineBots",(e=>{const{lastRequestedAt:t}=e.topInlineBots;t&&(0,p.b)(e.serverTimeOffset)-t<60||(async()=>{const t=await(0,P.t9)("fetchTopInlineBots");if(!t)return;const{ids:s,users:a}=t;let o=(0,n.Rd)();o=(0,r.Sh)(o,(0,g.ee)(a,"id")),o={...o,topInlineBots:{...o.topInlineBots,userIds:s,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,n.R3)(o)})()})),(0,n.Q6)("queryInlineBot",((e,t,s)=>{const{chatId:a,username:o,query:c,offset:l}=s;(async()=>{let t=e.inlineBots.byUsername[o];if(!1!==t){if(void 0===t){const{user:s,chat:a}=await(0,P.t9)("fetchInlineBot",{username:o})||{};if(e=(0,n.Rd)(),!s||!a)return void(0,n.R3)(D(e,o,!1));e=(0,r.Sh)(e,{[s.id]:s}),e=(0,r.fZ)(e,{[a.id]:a}),t={id:s.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=D(e,o,t),(0,n.R3)(e)}(c!==t.query||t.canLoadMore)&&q((()=>{!async function({username:e,inlineBotData:t,chatId:s,query:a,offset:o}){let r=(0,n.Rd)();const c=(0,i.dy)(r,t.id),l=(0,i.Z1)(r,s);if(!c||!l)return;const d=t.query!==a;r=Q(r,!0),r=D(r,e,{...t,query:a,...d&&{offset:void 0,results:[]}}),(0,n.R3)(r);const u=await(0,P.t9)("fetchInlineBotResults",{bot:c,chat:l,query:a,offset:d?void 0:o}),m=r.inlineBots.byUsername[e];if(r=Q((0,n.Rd)(),!1),!u||!m||a!==m.query)return void(0,n.R3)(r);const h=new Set((m.results||[]).map((e=>e.id))),g=u.results.filter((e=>!h.has(e.id)));r=D(r,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,n.R3)(r)}({username:o,inlineBotData:t,chatId:a,query:c,offset:l})}))}})()})),(0,n.Q6)("sendInlineBotResult",((e,t,s)=>{const{id:n,queryId:a}=s,o=(0,i.Bt)(e);if(!o||!n)return;const{chatId:r,threadId:c}=o,l=(0,i.Z1)(e,r);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:r,threadId:c,value:!1}),(0,P.t9)("sendInlineBotResult",{chat:l,resultId:n,queryId:a,replyingTo:(0,i.Yy)(e,r,c)})})),(0,n.Q6)("resetInlineBot",((e,t,s)=>{const{username:a}=s;let o=e.inlineBots.byUsername[a];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,n.R3)(D(e,a,o)))})),(0,n.Q6)("startBot",((e,t,s)=>{const{botId:n,param:a}=s,o=(0,i.dy)(e,n);o&&(async()=>{await(0,P.t9)("startBot",{bot:o,startParam:a})})()})),s(9667),(0,n.Q6)("loadPasswordInfo",(()=>{(async()=>{const e=await(0,P.t9)("getPasswordInfo");if(!e)return;let t=(0,n.Rd)();t=(0,r.BI)(t,{hasPassword:e.hasPassword}),t=(0,r.IE)(t,{hint:e.hint}),(0,n.R3)(t)})()})),(0,n.Q6)("checkPassword",((e,t,s)=>{const{currentPassword:a,onSuccess:o}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("checkPassword",a);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&o()})()})),(0,n.Q6)("clearPassword",((e,t,s)=>{const{currentPassword:a,onSuccess:o}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("clearPassword",a);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&o()})()})),(0,n.Q6)("updatePassword",((e,t,s)=>{const{currentPassword:a,password:o,hint:i,email:c,onSuccess:l}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updatePassword",a,o,i,c);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&l()})()})),(0,n.Q6)("updateRecoveryEmail",((e,t,s)=>{const{currentPassword:a,email:o,onSuccess:i}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updateRecoveryEmail",a,o);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&i()})()})),(0,n.Q6)("provideTwoFaEmailCode",((e,t,s)=>{const{code:n}=s;(0,P.t9)("provideRecoveryEmailCode",n)})),(0,n.Q6)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,n.Q6)("validateRequestedInfo",((e,t,s)=>{const{requestInfo:a,saveInfo:o}=s,c=(0,i.gx)(e),l=c&&(0,i.Z1)(e,c),d=(0,i.Mz)(e);l&&d&&async function(e,t,s,a){const o=await(0,P.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:s,shouldSave:a});if(!o)return;const{id:i,shippingOptions:c}=o;if(!i)return;let l=(0,r.vT)((0,n.Rd)(),i);c?(l=(0,r.TM)(l,c),l=(0,r.Q$)(l,m.KB.Shipping)):l=(0,r.Q$)(l,m.KB.PaymentInfo),(0,n.R3)(l)}(l,d,a,o)})),(0,n.Q6)("getPaymentForm",((e,t,s)=>{const{chat:a,messageId:o}=s;a&&o&&async function(e,t){const s=await(0,P.t9)("getPaymentForm",{chat:e,messageId:t});if(!s)return;let a=(0,r._7)((0,n.Rd)(),s),o=m.KB.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(o=m.KB.ShippingInfo),a=(0,r.Q$)(a,o),(0,n.R3)(a)}(a,o)})),(0,n.Q6)("getReceipt",((e,t,s)=>{const{receiptMessageId:a,chatId:o,messageId:c}=s,l=o&&(0,i.Z1)(e,o);c&&a&&l&&async function(e,t,s){const a=await(0,P.t9)("getReceipt",e,s);if(!a)return;let o=(0,n.Rd)();const c=(0,i.hj)(o,e.id,t);o=(0,r.Dq)(o,a,c),(0,n.R3)(o)}(l,c,a)})),(0,n.Q6)("clearPaymentError",(e=>{(0,n.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,n.Q6)("clearReceipt",(e=>{(0,n.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,n.Q6)("sendCredentialsInfo",((e,t,s)=>{const a=(0,i.$$)(e);if(!a)return;const{credentials:o}=s,{data:c}=o;!async function(e,t){const s=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),a=await fetch(`https://api.stripe.com/v1/tokens${s}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),o=await a.json();if(o.error){const e=(0,l.Ow)(o.error),t=(0,n.Rd)();return void(0,n.R3)({...t,payment:{...t.payment,error:{...e}}})}let i=(0,r.QH)((0,n.Rd)(),{type:o.type,id:o.id});i=(0,r.Q$)(i,m.KB.Checkout),(0,n.R3)(i)}(c,a)})),(0,n.Q6)("sendPaymentForm",((e,t,s)=>{const{shippingOptionId:a,saveCredentials:o}=s,c=(0,i.gx)(e),l=c&&(0,i.Z1)(e,c),d=(0,i.Mz)(e),u=(0,i.eh)(e),m=(0,i.sp)(e),h=(0,i.$$)(e),g=(0,i.i3)(e);l&&d&&h&&u&&async function(e,t,s,a,o,i){if(await(0,P.t9)("sendPaymentForm",{chat:e,messageId:t,formId:s,credentials:a,requestedInfoId:o,shippingOptionId:i})){const e=(0,r.bp)((0,n.Rd)());(0,n.R3)((0,r.WY)(e))}}(l,d,u,{save:o,data:g},m,a)})),(0,n.Q6)("setPaymentStep",((e,t,s={})=>(0,r.Q$)(e,s.step||m.KB.ShippingInfo))),(0,n.Q6)("setInvoiceMessageInfo",((e,t,s)=>(0,r.nA)(e,s))),s(4907);var j=s(8406);const H=(0,C.P2)((e=>e()),500,!0);(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateChat":{s.noTopChatsRequest||(0,i.N)(e,s.id)||t.loadTopChats();const a=(0,r.a4)(e,s.id,s.chat,s.newProfilePhoto);(0,n.R3)(a),H((()=>(0,L.w)((0,i.A1)((0,n.Rd)())))),s.chat.id&&(0,j.Vr)({chatId:s.chat.id,lastReadInboxMessageId:s.chat.lastReadInboxMessageId});break}case"updateChatJoin":{const a=(0,i.Ek)(e,s.id);if(!a)break;e=(0,r.B1)(e,a,[s.id]),e=(0,r.a4)(e,s.id,{isNotJoined:!1}),(0,n.R3)(e);const o=(0,i.Z1)(e,s.id);o&&t.requestChatUpdate({chatId:o.id});break}case"updateChatLeave":(0,n.R3)((0,r.Dd)(e,s.id));break;case"updateChatInbox":(0,n.R3)((0,r.a4)(e,s.id,s.chat)),H((()=>(0,L.w)((0,i.A1)((0,n.Rd)()))));break;case"updateChatTypingStatus":{const{id:t,typingStatus:a}=s;(0,n.R3)((0,r.a4)(e,t,{typingStatus:a})),setTimeout((()=>{const e=(0,n.Rd)(),s=(0,i.Z1)(e,t);s&&a&&s.typingStatus&&s.typingStatus.timestamp===a.timestamp&&(0,n.R3)((0,r.a4)(e,t,{typingStatus:void 0}))}),6e3);break}case"newMessage":{const{message:a}=s,{chatId:o,threadId:c,type:l}=(0,i.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const d=(0,i.Z1)(e,s.chatId);if(!d)return;"thread"===l&&c===u._f&&s.chatId===o?setTimeout((()=>{t.requestChatUpdate({chatId:s.chatId})}),1500):(0,n.R3)((0,r.a4)(e,s.chatId,{unreadCount:d.unreadCount?d.unreadCount+1:1,...s.message.hasUnreadMention&&{unreadMentionsCount:d.unreadMentionsCount?d.unreadMentionsCount+1:1}})),(0,L.w)((0,i.A1)((0,n.Rd)())),(0,j.zP)({chat:d,message:a});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=s;if(!1!==a.hasUnreadMention)return;t.forEach((t=>{const n="channelId"in s?s.channelId:(0,i.X5)(e,t),a=(0,i.Z1)(e,n);null!=a&&a.unreadMentionsCount&&(e=(0,r.a4)(e,n,{unreadMentionsCount:a.unreadMentionsCount-1}))})),(0,n.R3)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=s,a=e.chats.byId[s.id];if(!a)return;(0,n.R3)((0,r.a4)(e,s.id,{fullInfo:{...a.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:o}=s,r=o===a.WS?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},(0,n.R3)(e);break}case"updateChatPinned":{const{id:t,isPinned:o}=s,r=(0,i.Ek)(e,t);if(r){const{[r]:s}=e.chats.orderedPinnedIds;let n=s||[];if(o){if(!n.includes(t)){if("active"===r&&n.length>=a.EG){const t=e.chats.listIds.active;n=n.filter((e=>t&&t.includes(e)))}n=[t,...n]}}else n=n.filter((e=>e!==t));e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:n.length?n:void 0}}}}(0,n.R3)(e);break}case"updateChatListType":{const{id:t,folderId:a}=s;(0,n.R3)((0,r.Pi)(e,t,a));break}case"updateChatFolder":{const{id:t,folder:a}=s,{byId:o,orderedIds:r}=e.chatFolders,i=a?{...o,[t]:a}:(0,g.ei)(o,Object.keys(o).map(Number).filter((e=>e!==t))),c=a?r&&r.includes(t)?r:[...r||[],t]:r?r.filter((e=>e!==t)):void 0;(0,n.R3)({...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:c}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=s;(0,n.R3)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=s;(0,n.R3)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{var o;const t=e.chats.byId[s.id],{replacedMembers:a,addedMember:i,deletedMemberId:c}=s;if(!t)return;let l=!1,d=null!==(o=t.fullInfo)&&void 0!==o&&o.members?[...t.fullInfo.members]:[];if(a)d=a,l=!0;else if(i)d.length&&d.some((e=>e.userId===i.userId))||(d.push(i),l=!0);else if(d.length&&c){const e=d.findIndex((e=>e.userId===c));e>-1&&(d.slice(e,1),l=!0)}if(l){const a=d.filter((({isOwner:e,isAdmin:t})=>e||t));(0,n.R3)((0,r.a4)(e,s.id,{membersCount:d.length,fullInfo:{...t.fullInfo,members:d,adminMembers:a}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:a}=s,o=e.chats.byId[t];null!=o&&o.photos&&(0,n.R3)((0,r.a4)(e,t,{photos:o.photos.filter((e=>!a.includes(e.id)))}));break}case"draftMessage":{const{chatId:t,formattedText:a,date:o,replyingToId:i}=s;e.chats.byId[t]&&(e=(0,r.pf)(e,t,u._f,"draft",a),e=(0,r.pf)(e,t,u._f,"replyingToId",i),e=(0,r.a4)(e,t,{draftDate:o}),(0,n.R3)(e));break}case"showInvite":{const{data:e}=s;t.showDialog({data:e});break}}}));const _=350;function z(e,t,s,n,a=!1){const o=a?(0,i.Tm)(e,t,s):(0,i.hj)(e,t,s);if(o&&n.content){const{photo:e,video:t,sticker:s,document:a}=(0,l.qp)(o);e&&n.content.photo?(n.content.photo.blobUrl=e.blobUrl,n.content.photo.thumbnail=e.thumbnail):t&&n.content.video?n.content.video.blobUrl=t.blobUrl:s&&n.content.sticker?n.content.sticker.isPreloadedGlobally=s.isPreloadedGlobally:a&&n.content.document&&(n.content.document.previewBlobUrl=a.previewBlobUrl)}return a?(0,r.P4)(e,t,s,n):(0,r.cY)(e,t,s,n)}function V(e,t,s,n){const{chatId:a}=s,{threadInfo:o}=(0,i.Db)(e,a,s)||{};if(!o&&s.replyToMessageId){const o=(0,i.hj)(e,a,s.replyToMessageId);o?e=(0,r.lG)(e,o,a,s.id,n):t.loadMessage({chatId:a,messageId:s.replyToMessageId,threadUpdate:{isDeleting:n,lastMessageId:s.id}})}return e}function W(e,t,s){const{id:n,chatId:a}=s,{threadInfo:o,firstMessageId:c}=(0,i.Db)(e,a,s)||{},d=(0,i.Z1)(e,a),m=(null==d?void 0:d.unreadCount)&&!(0,i.gb)(e,a,u._f);if(e=V(e,t,s),o&&(!c&&(0,l.CI)(s)||(e=(0,r.xj)(e,a,o.threadId,[n]),(0,i.b9)(e,a,o.threadId)&&(e=(0,r.$S)(e,a,o.threadId,n),c||(e=(0,r.pf)(e,a,o.threadId,"firstMessageId",s.id)))),e=(0,r.pf)(e,a,o.threadId,"threadInfo",{...o,lastMessageId:s.id,messagesCount:o.messagesCount+1})),m)return e;if(e=(0,r.xj)(e,a,u._f,[n]),(0,i.b9)(e,a,u._f)){const t=(0,i.It)(e,a,u._f),s=(0,r.$S)(e,a,u._f,n),o=(0,i.Cb)(s,a,u._f);t&&!o.includes(t)||(e=s)}return e}function Y(e,t,s,n=!1){var a;const{chats:o}=e,i=null===(a=o.byId[t])||void 0===a?void 0:a.lastMessage;return!i||n||i.id===s.id||i.id===s.previousLocalId||s.id>i.id?(0,r.a4)(e,t,{lastMessage:s}):e}function X(e,t){const s=(0,i.Zw)(e,t),n=(0,i.gb)(e,t,u._f);if(!s||!n)return;let a=n.length;for(;a--;){const e=s[n[a]];if(!e.isDeleting)return e}}function K(e,t,s,a){if(e){t.forEach((t=>{const s=X(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);s&&(a=Y(a,e,s,!0))})),(0,n.R3)(a),s.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const n=(0,i.hj)(a,e,t);if(!n)return;a=V(a,s,n,!0);const{threadInfo:r}=(0,i.Db)(a,e,n)||{};r&&o.push(r.threadId)})),(0,n.R3)(a),void setTimeout((()=>{(0,n.R3)((0,r.K4)((0,n.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{s.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),_)}const o=[];t.forEach((e=>{const t=(0,i.X5)(a,e);if(t){o.push(t);const s=X(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);s&&(a=Y(a,t,s,!0)),setTimeout((()=>{(0,n.R3)((0,r.K4)((0,n.Rd)(),t,[e]))}),_)}})),(0,n.R3)(a),(0,g.Tw)(o).forEach((e=>{s.requestChatUpdate({chatId:e})}))}(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"newMessage":{const{chatId:o,id:c,message:d,shouldForceReply:m}=s;e=W(e=z(e,o,c,d),t,d),d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),(0,n.R3)(e);const h=(0,i.hj)(e,o,c);if((0,i.hg)(e,o,d)){var a;if(d.isOutgoing&&(null===(a=d.content)||void 0===a||!a.action)){const s=(0,i.Bt)(e);s&&t.focusMessage({chatId:o,threadId:s.threadId,messageId:d.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:s}=(0,i.Db)(e,o,d)||{};s&&t.requestThreadInfoUpdate({chatId:o,threadId:s.threadId}),(0,l.CI)(d)||setTimeout((()=>{let e=(0,n.Rd)();m&&(e=(0,r.pf)(e,o,u._f,"replyingToId",c)),(0,n.R3)(Y(e,o,h))}),_)}else(0,n.R3)(Y((0,n.Rd)(),o,h));(0,i.N)(e,o)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:a,message:o}=s;e=z(e,t,a,o,!0);const c=(0,i.qy)(e,t)||[];e=(0,r.pf)(e,t,u._f,"scheduledIds",(0,g.Tw)([...c,a])),(0,n.R3)(e);break}case"updateMessage":{var o,c;const{chatId:a,id:l,message:d}=s;if(!(0,i.hj)(e,a,l))return;e=z(e,a,l,d);const m=(0,i.hj)(e,a,l);d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),e=Y(e,a,m),(0,n.R3)(e);const h=(0,i.Z1)(e,a);h&&!d.isOutgoing&&(null===(o=h.lastMessage)||void 0===o?void 0:o.id)===d.id&&(0,i.xo)(e,h)&&(0,i.hg)(e,a,d)&&(0,i.b9)(e,a,(null===(c=d.threadInfo)||void 0===c?void 0:c.threadId)||u._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:a,message:o}=s;if(!(0,i.Tm)(e,t,a))return;e=z(e,t,a,o,!0);const c=Object.keys((0,i.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,u._f,"scheduledIds",c),(0,n.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:o,message:c}=s;e=W(e,t,c);const l=(0,i.hj)(e,a,o);e=(0,r.K4)(e,a,[o]),c.isScheduled&&(e=(0,r.bV)(e,a,[o])),e=(0,r.cY)(e,a,c.id,{...l,...c,previousLocalId:o});const d=(0,i.hj)(e,a,c.id);e=Y(e,a,d);const u=(0,i.Db)(e,a,c);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:c.id}),e=(0,r.pf)(e,a,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:c.id,lastReadInboxMessageId:c.id})),(0,n.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:a,message:o}=s,c=(0,i.qy)(e,t)||[];e=(0,r.pf)(e,t,u._f,"scheduledIds",[...c,o.id]);const l=(0,i.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,o.id,{...l,...o,previousLocalId:a}),(0,n.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:o}=s,c=(0,i.KB)(e,t)||[],l=a?[...c,...o].sort(((e,t)=>t-e)):c.filter((e=>!o.includes(e)));(0,n.R3)((0,r.pf)(e,t,u._f,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:o,firstMessageId:c}=s,l={...(0,i.tZ)(e,t,a),...o};if(!l.threadId)return;e=(0,r.Xg)(e,t,a,l),c&&(e=(0,r.pf)(e,t,a,"firstMessageId",c)),(0,n.R3)(e);break}case"resetMessages":{const{id:a}=s,o=(0,i.Zw)(e,a);o&&!(0,l.YC)(a)&&(e=(0,r.K4)(e,a,Object.keys(o).map(Number)),(0,n.R3)(e),t.loadFullChat({chatId:a,force:!0}));break}case"deleteMessages":{const{ids:n,chatId:a}=s;K(a,n,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:a}=s;!function(e,t,s,a){e&&(t.forEach((t=>{a=(0,r.P4)(a,e,t,{isDeleting:!0})})),(0,n.R3)(a),setTimeout((()=>{a=(0,r.bV)((0,n.Rd)(),e,t);const s=(0,i.Fn)(a,e);a=(0,r.pf)(a,e,u._f,"scheduledIds",Object.keys(s||{}).map(Number)),(0,n.R3)(a)}),_))}(a,t,0,e);break}case"deleteHistory":{const{chatId:n}=s,a=e.messages.byChatId[n];a?K(n,Object.keys(a.byId).map(Number),t,e):t.requestChatUpdate({chatId:n});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:a}=s;t.forEach((t=>{const s=(0,i.X5)(e,t);s&&(e=(0,r.cY)(e,s,t,a))})),(0,n.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:a,messageUpdate:o}=s;a.forEach((s=>{e=(0,r.cY)(e,t,s,o)})),(0,n.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:a}=s,o=(0,i.ZB)(e,t);if(null!=o&&o.content.poll){const t={...o.content.poll,...a},{results:s}=t.results||{};if(s&&!s.some((e=>e.isChosen))){const{results:e}=o.content.poll.results,n=e&&e.filter((e=>e.isChosen));n&&n.forEach((e=>{const n=s.findIndex((t=>t.option===e.option));n>=0&&(t.results.results[n].isChosen=!0)}))}(0,n.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:a,options:o}=s,c=(0,i.ZB)(e,t);if(!c||!c.content.poll||!c.content.poll.results)break;const{poll:l}=c.content,{recentVoterIds:d,totalVoters:u,results:m}=l.results,h=d?[...d]:[],g=u?u+1:1,p=m?[...m]:[];h.push(a),o.forEach((t=>{const s=p.find((e=>e.option===t)),n=p.findIndex((e=>e.option===t)),o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,a===e.currentUserId&&(o.isChosen=!0),n?p[n]=o:p.push(o)})),(0,n.R3)((0,r.cY)(e,c.chatId,c.id,{content:{...c.content,poll:{...l,results:{...l.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:n}=s;(0,i.UW)(e)&&t.createServiceNotification({message:n});break}}}));const J=(0,C.P2)((function(){const e=(0,n.Rd)();(0,n.R3)((0,r.ps)(e,{...e.users.statusesById,...ee})),ee={}}),3e3,!0);let ee={};(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"deleteUser":return(0,r.h8)(e,s.id);case"updateUser":return(0,r.Nq)(e,s.id,s.user);case"updateUserStatus":return n=s.userId,a=s.status,ee[n]=a,void J();case"updateUserFullInfo":{const{id:t,fullInfo:n}=s,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...n}})}}var n,a})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateStickerSet":return(0,r.Rg)(e,s.id,s.stickerSet)}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updatePeerBlocked":return s.isBlocked?(0,r.O4)((0,n.Rd)(),s.id):(0,r.rB)((0,n.Rd)(),s.id);case"updateResetContactList":(0,n.R3)({...(0,n.Rd)(),contactList:{userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[s.key]=s.rules}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateNotifySettings":return(0,r.HN)(e,s.peerType,s.isSilent,s.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent:o,shouldShowPreviews:i}=s;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:a})),(0,n.R3)((0,r.aK)(e,t,{isMuted:a,isSilent:o,shouldShowPreviews:i}));break}}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:s.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:s.message}}}}));var te=s(4446);(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateGroupCall":return"discarded"===s.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,te.dc)(e,s.call.id):(0,te.AH)(e,s.call.id,(0,g.CE)(s.call,["connectionState"]),void 0,s.call.participantsCount);case"updateGroupCallChatId":{const t=(0,i.Z1)(e,s.chatId);return t&&(e=(0,r.a4)(e,s.chatId,{fullInfo:{...t.fullInfo,groupCallId:s.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:a,nextOffset:o}=s,{currentUserId:r}=e;return e=(0,n.Rd)(),a.forEach((s=>{s.id&&(e=(0,te.B6)(e,t,s.id,s,!!o||r===s.id))})),o&&(e=(0,te.AH)(e,t,{nextOffset:o})),e}}}));var se=s(8674),ne=s(6752),ae=s(1279),oe=s(3551),re=s(3858),ie=s(1212),ce=s(5332);function le(e){(0,o.d4)((()=>(0,C.Gq)(e)),[e])}var de=s(9290);const ue=document.querySelector('meta[name="viewport"]'),me=(null==ue?void 0:ue.getAttribute("content"))||"";function he(e){e.preventDefault()}var ge=s(6590),pe=s(3989),fe=s(3455),Ie=s(706),ve=s(2255);function ye(){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}var Ze=s(9107),Pe=s(6917),Ce=s(3106),we=s(8964),be=s(231),Me=s(9589),Se=s(9187),Ee=s(3321);const ke=[0,1,2],Re=(0,o.X$)((0,n.c$)((e=>{const{query:t,fetchingStatus:s,chatId:n,date:a}=e.globalSearch,{currentUserId:o}=e,{byId:r}=e.chats,{animationLevel:c}=e.settings.byKey;return{searchQuery:t,isLoading:!!s&&Boolean(s.chats||s.messages),currentUserId:o,chatsById:r,globalSearchChatId:n,searchDate:a,theme:(0,i.Pu)(e),animationLevel:c}}),((e,t)=>(0,g.ei)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"])))((({content:e,contactsFilter:t,onSearchQuery:s,onSelectSettings:n,onSelectContacts:r,onSelectArchived:i,setGlobalSearchChatId:c,onReset:d,searchQuery:u,isLoading:g,shouldSkipTransition:p,currentUserId:f,globalSearchChatId:I,searchDate:v,theme:y,animationLevel:Z,chatsById:P,openChat:C,openTipsChat:w,setGlobalSearchDate:b,setSettingOption:M})=>{const S=(0,Ze.Z)(),E=e===m.du.ChatList,k=(0,o.Ye)((()=>v?(0,N.xH)(new Date(1e3*v)):void 0),[v]),R=(0,o.Ye)((()=>E&&P?Object.values(P).reduce(((e,t)=>(0,l.pE)(t)&&t.unreadCount?e+1:e),0):0),[E,P]),T="web.telegram.org"===window.location.hostname,B=(0,o.Ye)((()=>({onTrigger:e,isOpen:t})=>o.ZP.createElement(be.Z,{round:!0,ripple:E&&!h.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:E?e:()=>d(),ariaLabel:E?S("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,ne.Z)("animated-menu-icon",!E&&"state-back",p&&"no-animation")}))),[E,S,d,p]),x=(0,o.I4)((()=>{u||s("")}),[u,s]),L=(0,o.I4)((()=>{C({id:f,shouldReplaceHistory:!0})}),[f,C]),A=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";M({theme:t}),M({shouldUseSystemTheme:!1}),(0,Pe.Z)(t,Z===a.zy)}),[Z,M,y]),O=(0,o.I4)((e=>{e.stopPropagation();const t=0===Z?2:0;ke.forEach(((e,s)=>{document.body.classList.toggle(`animation-level-${s}`,t===s)})),M({animationLevel:t})}),[Z,M]),U=Boolean(I)||e===m.du.GlobalSearch||e===m.du.Contacts,F=e===m.du.Contacts?S("SearchFriends"):S("Search");return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},o.ZP.createElement(Ce.Z,{trigger:B,footer:`${a.iC} alpha ${a.Ji}`},o.ZP.createElement(we.Z,{icon:"saved-messages",onClick:L},S("SavedMessages")),o.ZP.createElement(we.Z,{icon:"archive",onClick:i},o.ZP.createElement("span",{className:"menu-item-name"},S("ArchivedChats")),R>0&&o.ZP.createElement("div",{className:"archived-badge"},R)),o.ZP.createElement(we.Z,{icon:"user",onClick:r},S("Contacts")),o.ZP.createElement(we.Z,{icon:"settings",onClick:n},S("Settings")),o.ZP.createElement(we.Z,{icon:"darkmode",onClick:A},o.ZP.createElement("span",{className:"menu-item-name"},S("lng_menu_night_mode")),o.ZP.createElement(Ee.Z,{id:"darkmode",label:S("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),o.ZP.createElement(we.Z,{icon:"animations",onClick:O},o.ZP.createElement("span",{className:"menu-item-name capitalize"},S("Appearance.Animations").toLowerCase()),o.ZP.createElement(Ee.Z,{id:"animations",label:"Toggle Animations",checked:Z>0})),o.ZP.createElement(we.Z,{icon:"help",onClick:()=>{w({langCode:S.code})}},S("TelegramFeatures")),o.ZP.createElement(we.Z,{icon:"bug",href:a.mU},"Report Bug"),T&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(we.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,ge.Wv)()}},"Switch to K Version"),o.ZP.createElement(we.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:ge.Wv},"Switch to Old Version"))),o.ZP.createElement(Me.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||v?"with-picker-item":"",value:t||u,focused:U,isLoading:g,placeholder:F,autoComplete:"off",canClose:Boolean(I||v),onChange:s,onReset:d,onFocus:x},k&&o.ZP.createElement(Se.Z,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:b,clickArg:{date:void 0}}),I&&o.ZP.createElement(Se.Z,{chatOrUserId:I,onClick:c,canClose:!0,clickArg:{id:void 0}}))))})));var Te=s(9204);const Ne=(0,o.X$)((()=>{const e=(0,Ze.Z)();return o.ZP.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},o.ZP.createElement(Te.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}));var Be=s(1174),xe=s(6071),Le=s(3133),Ae=s(1080);const Oe=(0,o.X$)((0,n.c$)((e=>{const{chats:{listIds:t,byId:s},users:{byId:n},chatFolders:{byId:a,orderedIds:o,activeChatFolder:r},currentUserId:c,lastSyncTime:l,shouldSkipHistoryAnimations:d}=e;return{allListIds:t,chatsById:s,usersById:n,chatFoldersById:a,orderedFolderIds:o,lastSyncTime:l,notifySettings:(0,i.dZ)(e),notifyExceptions:(0,i.NJ)(e),activeChatFolder:r,currentUserId:c,shouldSkipHistoryAnimations:d}}),((e,t)=>(0,g.ei)(t,["loadChatFolders","setActiveChatFolder","openChat"])))((({allListIds:e,chatsById:t,usersById:s,chatFoldersById:n,notifySettings:a,notifyExceptions:r,orderedFolderIds:i,activeChatFolder:c,currentUserId:d,lastSyncTime:u,shouldSkipHistoryAnimations:m,foldersDispatch:p,onScreenSelect:f,loadChatFolders:I,setActiveChatFolder:v,openChat:y})=>{const Z=(0,o.sO)(null),P=(0,Ze.Z)();(0,o.d4)((()=>{u&&I()}),[u,I]);const C=(0,o.Ye)((()=>i?i.map((e=>n[e]||{})).filter(Boolean):void 0),[n,i]),w=((n,i,c)=>{const d=(0,xe.Z)(3e3,!0),[u,m]=(0,o.eJ)(),[h,p,f]=(0,Ie.Z)();return(0,se.ZP)(p,f),(0,de.Z)((()=>{h||d((()=>{m((()=>{if(!C||!C.length)return;const n=C.map((n=>{const{unreadDialogsCount:o,hasActiveDialogs:i}=(0,l.Fu)(e,t,s,n,a,r)||{};return{id:n.id,badgeCount:o,isBadgeActive:i}}));return(0,g.ee)(n,"id")})())}))}),c.concat([h])),u})(0,0,[C,e,t,s,a,r]),b=(0,o.Ye)((()=>{if(C&&C.length)return[{title:"en"===P.code?"All":P("FilterAllChats")},...C.map((e=>({title:e.title,...null==w?void 0:w[e.id]})))]}),[C,w,P]),M=(0,o.I4)((e=>{v(e,{forceOnHeavyAnimation:!0})}),[v]);(0,o.d4)((()=>{b&&b.length&&c>=b.length&&v(0)}),[c,b,v]),(0,o.d4)((()=>{if(Z.current&&h.$b&&b&&b.length)return(0,Be.s)(Z.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Be.e.Left?(v(Math.min(c+1,b.length-1),{forceOnHeavyAnimation:!0}),!0):t===Be.e.Right&&(v(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,b,v]);const S=(0,o.sO)();S.current=0!==c,(0,o.d4)((()=>S.current?(0,pe.Z)((()=>{S.current&&v(0)})):void 0),[c,v]),(0,ge.ZP)(0!==c,(()=>v(0,{forceOnHeavyAnimation:!0}))),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&b){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void y({id:d,shouldReplaceHistory:!0});const s=Number(t)-1;if(s>b.length-1)return;v(s,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}));const{shouldRender:E,transitionClassNames:k}=(0,ie.Z)(!i,void 0,!0);function R(e){const t=Object.values(n).find((({title:e})=>e===b[c].title));return t&&0!==c?o.ZP.createElement(Ae.Z,{folderType:"folder",folderId:t.id,isActive:e,onScreenSelect:f,foldersDispatch:p}):o.ZP.createElement(Ae.Z,{folderType:"all",isActive:e,foldersDispatch:p,onScreenSelect:f})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=b&&b.length?o.ZP.createElement(Le.Z,{tabs:b,activeTab:c,onSwitchTab:M}):E?o.ZP.createElement("div",{className:(0,ne.Z)("tabs-placeholder",k)}):void 0,o.ZP.createElement(ve.Z,{ref:Z,name:m?"none":P.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:b?b.length:void 0},R))})));var Ue=s(9203),Fe=s(8778),$e=s(4288);const De=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)})),Qe=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)}));var qe=s(2328);let Ge;const je=(0,o.X$)((({isShown:e,onNewPrivateChat:t,onNewChannel:s,onNewGroup:n})=>{const[a,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{e||r(!1)}),[e]);const i=(0,Ze.Z)(),c=(0,ne.Z)("NewChatButton",e&&"revealed",a&&"menu-is-open"),l=(0,o.I4)((()=>{Ge&&(clearTimeout(Ge),Ge=void 0)}),[]),d=(0,o.I4)((()=>{Ge&&(clearTimeout(Ge),Ge=void 0),Ge=window.setTimeout((()=>{r(!1)}),750)}),[]);return o.ZP.createElement("div",{className:c,onMouseEnter:l,onMouseLeave:d},o.ZP.createElement(be.Z,{round:!0,color:"primary",className:a?"active":"",onClick:()=>{r(!a)},ariaLabel:i(a?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(qe.Z,{isOpen:a,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},o.ZP.createElement(we.Z,{icon:"channel",onClick:s},i("NewChannel")),o.ZP.createElement(we.Z,{icon:"group",onClick:n},i("NewGroup")),o.ZP.createElement(we.Z,{icon:"user",onClick:t},i("NewMessageTitle"))))}));var He=s(126);const _e=Object.keys(m.du).length/2;let ze;const Ve=(0,n.c$)((e=>(0,g.ei)(e,["connectionState"])))((({content:e,searchQuery:t,searchDate:s,contactsFilter:n,shouldSkipTransition:a,foldersDispatch:r,onSearchQuery:i,onContentChange:c,onScreenSelect:l,onReset:d,connectionState:u})=>{const[g,p]=(0,o.eJ)(h.$b),f=!ye()||"connectionStateConnecting"===u,I=(0,o.sO)(!1),v=(0,o.I4)((()=>{c(m.du.Settings)}),[c]),y=(0,o.I4)((()=>{c(m.du.Contacts)}),[c]),Z=(0,o.I4)((()=>{c(m.du.NewChannelStep1)}),[c]),P=(0,o.I4)((()=>{c(m.du.NewGroupStep1)}),[c]),C=(0,o.I4)((()=>{c(m.du.Archived)}),[c]),w=(0,o.I4)((()=>{e===m.du.ChatList&&(I.current=!0,p(!0))}),[e]),b=(0,o.I4)((()=>{I.current=!1,ze&&(clearTimeout(ze),ze=void 0),ze=window.setTimeout((()=>{I.current||p(!1)}),250)}),[]);(0,o.d4)((()=>{let t;return e!==m.du.ChatList?t=window.setTimeout((()=>{p(!1)}),250):(I.current||h.$b)&&p(!0),()=>{t&&(clearTimeout(t),t=void 0)}}),[e]);const[M,S,E]=function(){const[e,t]=(0,Ie.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:s,transitionClassNames:n}=(0,ie.Z)(e);return[s,n,()=>{window.location.reload()}]}(),k=(0,Ze.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:w,onMouseLeave:h.$b?void 0:b},o.ZP.createElement(Re,{content:e,contactsFilter:n,onSearchQuery:i,onSelectSettings:v,onSelectContacts:y,onSelectArchived:C,onReset:d,shouldSkipTransition:a}),o.ZP.createElement(He.Z,{isOpen:f,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},(()=>o.ZP.createElement(Ne,null))),o.ZP.createElement(ve.Z,{name:a?"none":"zoom-fade",renderCount:_e,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList,className:f?"pull-down":void 0},(a=>{switch(e){case m.du.ChatList:return o.ZP.createElement(Oe,{onScreenSelect:l,foldersDispatch:r});case m.du.GlobalSearch:return o.ZP.createElement(De,{searchQuery:t,searchDate:s,isActive:a,onReset:d});case m.du.Contacts:return o.ZP.createElement(Qe,{filter:n,isActive:a,onReset:d});default:return}})),M&&o.ZP.createElement(be.Z,{fluid:!0,pill:!0,className:(0,ne.Z)("btn-update",S),onClick:E},k("lng_update_telegram")),o.ZP.createElement(je,{isShown:g,onNewPrivateChat:y,onNewChannel:Z,onNewGroup:P}))})),We=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)})),Ye=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)})),Xe=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)}));var Ke;!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"}(Ke||(Ke={}));const Je=Object.keys(Ke).length/2,et=(0,o.X$)((0,n.c$)((e=>{const{globalSearch:{query:t,date:s},chatFolders:{activeChatFolder:n},shouldSkipHistoryAnimations:a,leftColumnWidth:o}=e;return{searchQuery:t,searchDate:s,activeChatFolder:n,shouldSkipHistoryAnimations:a,leftColumnWidth:o}}),((e,t)=>(0,g.ei)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError","setLeftColumnWidth","resetLeftColumnWidth"])))((({searchQuery:e,searchDate:t,activeChatFolder:s,shouldSkipHistoryAnimations:n,leftColumnWidth:a,setGlobalSearchQuery:r,setGlobalSearchChatId:i,resetChatCreation:c,setGlobalSearchDate:l,loadPasswordInfo:d,clearTwoFaError:u,setLeftColumnWidth:g,resetLeftColumnWidth:p})=>{const f=(0,o.sO)(null),[I,v]=(0,o.eJ)(m.du.ChatList),[y,Z]=(0,o.eJ)(m.MT.Main),[P,C]=(0,o.eJ)(""),[w,b]=(0,fe.ZP)(),[M,S]=(0,o.eJ)(0);let E=Ke.Main;switch(I){case m.du.Archived:E=Ke.Archived;break;case m.du.Settings:E=Ke.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:E=Ke.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:E=Ke.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(y){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 Z(m.MT.Main);case m.MT.GeneralChatBackground:return void Z(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void Z(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 Z(m.MT.Privacy);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void Z(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void Z(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void Z(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void Z(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void Z(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void Z(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void Z(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void Z(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void Z(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void Z(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void Z(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void Z(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void Z(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void Z(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void Z(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void Z(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void Z(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void Z(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return v(m.du.ChatList),void Z(m.MT.Main)}I!==m.du.ChatList||0!==s?(v(m.du.ChatList),C(""),r({query:""}),l({date:void 0}),i({id:void 0}),c(),setTimeout((()=>{S(Date.now())}),250)):v(m.du.GlobalSearch)}else v(m.du.NewChannelStep1);else v(m.du.NewGroupStep1)}),[I,s,y,r,l,i,c]),R=(0,o.I4)((t=>{I!==m.du.Contacts?(v(m.du.GlobalSearch),t!==e&&r({query:t})):C(t)}),[I,e,r]);(0,o.d4)((()=>I!==m.du.ChatList||0===s?(0,pe.Z)((()=>k())):void 0),[s,I,k]),(0,o.d4)((()=>{u(),y===m.MT.Privacy&&d()}),[u,d,y]);const{initResize:T,resetResize:N,handleMouseUp:B}=((e,t,s,n)=>{const[a,r,i]=(0,Ie.Z)(),[c,l]=(0,o.eJ)(),[d,u]=(0,o.eJ)();(0,o.d4)((()=>{e.current&&n&&(e.current.style.width=`${n}px`)}),[e,n]);const m=()=>{document.body.classList.remove("no-selection","cursor-ew-resize")};return(0,o.d4)((()=>{if(!a)return;const s=t=>{const s=Math.ceil(d+t.clientX-c);e.current.style.width=`${s}px`},n=()=>{m(),document.removeEventListener("mousemove",s,!1),document.removeEventListener("mouseup",n,!1),document.removeEventListener("blur",n,!1),t(e.current.offsetWidth),i()};document.addEventListener("mousemove",s,!1),document.addEventListener("mouseup",n,!1),document.addEventListener("blur",n,!1)}),[d,c,e,t,a,i]),{initResize:t=>{document.body.classList.add("no-selection","cursor-ew-resize"),l(t.clientX),u(e.current.offsetWidth),r()},resetResize:t=>{t.preventDefault(),e.current.style.width="",s()},handleMouseUp:m}})(f,g,p,a),x=e=>{v(m.du.Settings),Z(e)};return o.ZP.createElement("div",{id:"LeftColumn",ref:f},o.ZP.createElement(ve.Z,{name:n?"none":h.s0,renderCount:Je,activeKey:E,shouldCleanup:!0,cleanupExceptionKey:Ke.Main},(s=>{switch(E){case Ke.Archived:return o.ZP.createElement(Xe,{isActive:s,onReset:k,onContentChange:v});case Ke.Settings:return o.ZP.createElement(We,{isActive:s,currentScreen:y,foldersState:w,foldersDispatch:b,onScreenSelect:x,onReset:k,shouldSkipTransition:n});case Ke.NewChannel:return o.ZP.createElement(Ye,{key:M,isActive:s,isChannel:!0,content:I,onContentChange:v,onReset:k});case Ke.NewGroup:return o.ZP.createElement(Ye,{key:M,isActive:s,content:I,onContentChange:v,onReset:k});default:return o.ZP.createElement(Ve,{content:I,searchQuery:e,searchDate:t,contactsFilter:P,foldersDispatch:b,onContentChange:v,onSearchQuery:R,onScreenSelect:x,onReset:k,shouldSkipTransition:n})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:T,onMouseUp:B,onDoubleClick:N}))})));var tt=s(2420),st=s(5780),nt=s(9524),at=s(1394);const ot=()=>{const[e,t]=(0,o.eJ)(re.Z.get());return(0,o.d4)((()=>{const e=(0,C.P2)((()=>{t(re.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var rt=s(2678),it=s(7204);const ct=728;var lt=s(3570),dt=s(5790),ut=s(8360),mt=s(2155),ht=s(6058),gt=s(8799);const pt=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"HeaderMenuContainer",!t);return s?o.ZP.createElement(s,e):void 0})),ft=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{var a;const o=(0,i.Z1)(e,t),r=Boolean(o&&(0,l.eA)(o));if(!o||o.isRestricted||(0,i.CA)(e))return{noMenu:!0};const c=(0,i.IK)(e,t),d=(0,i.FM)(e,t),m="thread"===n&&s===u._f,g="thread"===n&&s!==u._f,p=(0,i.Jf)(e),f=Boolean(c&&(0,i.s4)(e,c.id)),I=!f&&Boolean((0,i.pk)(e,t)),v=Boolean(m&&(r||(0,l.ZV)(o))&&o.isNotJoined);return{noMenu:!1,isChannel:r,isRightColumnShown:p,canStartBot:I,canRestartBot:f,canSubscribe:v,canSearch:m||g,canCall:h.Bi&&(0,l.YC)(o.id)&&!d&&!c,canMute:m&&!d&&!v,canLeave:m&&!v,canEnterVoiceChat:h.Bi&&o.isCallActive,canCreateVoiceChat:h.Bi&&!o.isCallActive&&((null===(a=o.adminRights)||void 0===a?void 0:a.manageCall)||o.isCreator&&(0,l.G9)(o))}}),((e,t)=>(0,g.ei)(t,["joinChannel","sendBotCommand","openLocalTextSearch","restartBot","openCallFallbackConfirm"])))((({chatId:e,threadId:t,noMenu:s,isChannel:n,canStartBot:a,canRestartBot:r,canSubscribe:i,canSearch:c,canCall:l,canMute:d,canLeave:u,canEnterVoiceChat:m,canCreateVoiceChat:g,isRightColumnShown:p,canExpandActions:f,joinChannel:I,sendBotCommand:v,openLocalTextSearch:y,restartBot:Z,openCallFallbackConfirm:P})=>{const C=(0,o.sO)(null),[w,b]=(0,o.eJ)(!1),[M,S]=(0,o.eJ)(void 0),E=(0,o.I4)((()=>{b(!0);const e=C.current.getBoundingClientRect();S({x:e.right,y:e.bottom})}),[]),k=(0,o.I4)((()=>{b(!1)}),[]),R=(0,o.I4)((()=>{S(void 0)}),[]),T=(0,o.I4)((()=>{I({chatId:e})}),[I,e]),N=(0,o.I4)((()=>{v({command:"/start"})}),[v]),B=(0,o.I4)((()=>{Z({chatId:e})}),[e,Z]),x=(0,o.I4)((()=>{y(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[y]),L=(0,Ze.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,f&&i&&o.ZP.createElement(be.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:T},L(n?"ProfileJoinChannel":"ProfileJoinGroup")),f&&a&&o.ZP.createElement(be.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:N},L("BotStart")),f&&r&&o.ZP.createElement(be.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:B},L("BotRestart")),c&&o.ZP.createElement(be.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(be.Z,{round:!0,color:"translucent",size:"smaller",onClick:P,ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),o.ZP.createElement(be.Z,{ref:C,className:w?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:s,ariaLabel:"More actions",onClick:E},o.ZP.createElement("i",{className:"icon-more"})),M&&o.ZP.createElement(pt,{chatId:e,threadId:t,isOpen:w,anchor:M,withExtraActions:h.wB||!f,isChannel:n,canStartBot:a,canRestartBot:r,canSubscribe:i,canSearch:c,canCall:l,canMute:d,canLeave:u,canEnterVoiceChat:m,canCreateVoiceChat:g,onSubscribeChannel:T,onSearchClick:x,onClose:k,onCloseAnimationEnd:R}))})));var It=s(4399),vt=s(2340),yt=s(6202),Zt=s(862);function Pt(e){var t;const s=e&&(0,l.DH)(e),n=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,r=s&&n&&!(0,h.on)()&&s.includes("image/webp"),[i,c]=(0,o.eJ)(Zt.Hu),d=null==e?void 0:e.id;return(0,o.bt)((()=>{r&&(0,Zt.p6)(`b64-${d}`,s).then(c).catch((e=>{a.eM&&console.error(e)}))}),[d,r,s]),r?i:s}var Ct=s(7551),wt=s(8512);function bt(e,t,s,n,a){return`M${e},${t+a}a${a},${a},0,0,1,\n ${s},0v${n-2*a}a${a},${a},0,0,1,${-s},0Z`}const Mt=(0,o.X$)((({count:e,index:t})=>{const s=(0,o.sO)(null),n=(0,o.Ye)((()=>function(e,t){const s=e-t-1,n=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),a=function(e,t){let s=36;return 1===e?s=36:2===e?s=17:3===e?s=1===t?12:11:(4===e||e>3)&&(s=7.5),s}(e,s),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,n),r=`clipPath${e}`;return{markHeight:a,clipPath:function(e,t,s){let n="";if(3===s)n=bt(0,0,2,t,1)+bt(0,12,2,t+1,1)+bt(0,25,2,t,1);else for(let e=0;e<s;e++)n+=bt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${n}" />\n </clipPath>`}(r,n,e),markTranslateY:function(e,t,s){return 1===s?0:2===s?0===e?0:t+2:3===s?0===e?0:1===e?12:25:(t+2)*e}(s,n,e),trackTranslateY:function(e,t,s,n){return t<=4||e<=1?0:e>=t-2?n-36:(s+4)/2+(e-2)*(s+2)}(s,e,n,o),trackHeight:o,clipPathId:r}}(e,t)),[e,t]);if((0,o.d4)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:a,markTranslateY:o,clipPathId:r,clipPath:i}=n,c=s.current.firstElementChild;if(null!=s&&s.current){const n=s.current,{style:l}=n;l.height=`${e}px`,l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${r}")`;const d=n.querySelector("svg"),u=n.querySelector("div"),m=n.querySelector("defs");d||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${i} </defs></svg>`),m&&(m.innerHTML=i),u&&(u.style.height=`${a}px`,u.style.transform=`translateY(${o}px)`)}}),[n]),1===e)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:s}));const{trackHeight:a,trackTranslateY:r,markHeight:i,markTranslateY:c,clipPathId:l}=n;return o.ZP.createElement("div",{className:(0,ne.Z)("pinned-message-border",e>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:s,style:`clip-path: url("#${l}"); width: 2px;\n height: ${a}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${i}px; transform: translateY(${c}px);`})))})),St=(0,o.X$)((({message:e,count:t,index:s,customTitle:n,className:a,onUnpinMessage:r,onClick:i,onAllPinnedClick:c})=>{const d=(0,Ze.Z)(),u=Pt(e),m=(0,yt.Z)((0,l.Ti)(e,"pictogram")),h=(0,l.MK)(d,e,Boolean(u)),[g,p,f]=(0,Ie.Z)(),I=(0,o.I4)((()=>{f(),r&&r(e.id)}),[f,r,e.id]);return o.ZP.createElement("div",{className:(0,ne.Z)("HeaderPinnedMessage-wrapper",a)},t>1&&o.ZP.createElement(be.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:d("EventLogFilterPinnedMessages"),onClick:c},o.ZP.createElement("i",{className:"icon-pin-list"})),r&&o.ZP.createElement(be.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:d("UnpinMessageAlertTitle"),className:"unpin-button",onClick:p},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Ct.Z,{isOpen:g,onClose:f,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:I}),o.ZP.createElement("div",{className:"HeaderPinnedMessage",onClick:i,dir:d.isRtl?"rtl":void 0},o.ZP.createElement(Mt,{count:t,index:s}),u&&function(e,t){const{width:s,height:n}=(0,It.W7)();return o.ZP.createElement("img",{src:t||e,width:s,height:n,alt:""})}(u,m),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},n||`${d("PinnedMessage")} ${s>0?"#"+(t-s):""}`),o.ZP.createElement("p",{dir:"auto"},(0,vt.Z)(h))),o.ZP.createElement(wt.Z,null)))}));var Et=s(647),kt=s(396),Rt=s(4532),Tt=s(3186),Nt=s(663);function Bt(e,t,s="image/png"){const n=e instanceof Blob?URL.createObjectURL(e):e,a=new Image;return new Promise((o=>{a.onload=()=>{xt(a,a.width*t,a.height*t,s).then((e=>URL.createObjectURL(e))).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(n)}))},a.src=n}))}async function xt(e,t,s,n="image/png"){if(!("createImageBitmap"in window))return Lt(e,t,s,void 0,n);try{const a=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:s,resizeQuality:"high"});if(a.height!==s||a.width!==t)throw new Error("Image bitmap resize not supported!");return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const s=t.getContext("bitmaprenderer");s?s.transferFromImageBitmap(a):t.getContext("2d").drawImage(a,0,0),t.toBlob(e,n)}))}catch(a){return Lt(e,t,s,void 0,n)}}function Lt(e,t,s,n=.5,a="image/png"){const o=document.createElement("canvas"),r=o.getContext("2d"),i=document.createElement("canvas"),c=i.getContext("2d");if(o.width=t,o.height=s,e.width*n>t){const s=1/n;let a={width:Math.floor(e.width*n),height:Math.floor(e.height*n)};for(i.width=a.width,i.height=a.height,c.drawImage(e,0,0,a.width,a.height);a.width*n>t;)a={width:Math.floor(a.width*n),height:Math.floor(a.height*n)},c.drawImage(i,0,0,a.width*s,a.height*s,0,0,a.width,a.height);r.drawImage(i,0,0,a.width,a.height,0,0,o.width,o.height)}else r.drawImage(e,0,0,o.width,o.height);return new Promise((e=>{o.toBlob(e,a)}))}var At=s(4524);const Ot={width:200,height:200},Ut=115,Ft=(e,t,s)=>{const{audio:n,voice:a}=(0,l.qp)(e),r=n?n.title||n.fileName:a?"Voice message":"",i=n&&n.performer||t&&(0,l.OU)(Nt.i0,t),c=s&&(0,l.U)(Nt.i0,s)||"Telegram",d=n&&(0,l.MR)(n)&&(0,l.Ti)(e,"pictogram"),u=t&&(0,l.RT)(t,"big"),m=n&&d||a&&u,h=(0,yt.Z)(m),g=(0,o.Ye)((()=>function(e,t,s){if(!s)return Ot;if(e){if(!e.thumbnailSizes||0===e.thumbnailSizes.length)return;return e.thumbnailSizes.find((e=>"m"===e.type))||e.thumbnailSizes[0]}return t?It.vY:void 0}(n,a,h)),[n,h,a]),{result:p}=((e,t,s)=>{const[n,a]=(0,o.eJ)(!1),[r,i]=(0,o.eJ)(),[c,l]=(0,o.eJ)(s);return(0,o.d4)((()=>{a(!0);let e=!1;return function(e,t){if(!e)return Promise.resolve(At);if(!t)return function(e,t,s,n="image/png"){const a=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((r=>{o.onload=()=>{xt(o,t,s,n).then((e=>URL.createObjectURL(e))).then(r).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},o.src=a}))}(e,Ut,Ut);const s=Math.min(t.width,t.height);return s<Ut?Bt(e,Ut/s):Promise.resolve(e)}(h,g).then((t=>{e||(a(!1),l(t))}),(t=>{e||(a(!1),i(t))})),()=>{e=!0}}),t),{isLoading:n,error:r,result:c}})(0,[h,g],At);return(0,o.Ye)((()=>(0,Rt.Of)({title:r,artist:i,album:c,artwork:[{src:p}]})),[c,i,r,p])};var $t=s(8051);const Dt=(0,n.c$)(((e,{message:t})=>{const s=(0,i.Ur)(e,t),n=(0,i.Z1)(e,t.chatId),{volume:a,playbackRate:o,isMuted:r}=e.audioPlayer;return{sender:s,chat:n,volume:a,playbackRate:o,isMuted:r}}),((e,t)=>(0,g.ei)(t,["focusMessage","closeAudioPlayer","setAudioPlayerVolume","setAudioPlayerPlaybackRate","setAudioPlayerMuted"])))((({message:e,className:t,noUi:s,sender:n,chat:a,volume:r,playbackRate:i,isMuted:c,setAudioPlayerVolume:d,setAudioPlayerPlaybackRate:u,setAudioPlayerMuted:m,focusMessage:g,closeAudioPlayer:p})=>{const f=(0,Ze.Z)(),{audio:I,voice:v,video:y}=(0,l.qp)(e),Z=Boolean(v||y),P=n?(0,l.OU)(f,n):void 0,C=Et.UV((0,l.Ti)(e,"inline")),w=Ft(e,n,a),{playPause:b,stop:M,isPlaying:S,requestNextTrack:E,requestPreviousTrack:k,isFirst:R,isLast:T,setVolume:N,toggleMuted:B,setPlaybackRate:x}=(0,Tt.Z)((0,kt.An)(e),(0,l.XV)(e),Z?"voice":"audio",C,void 0,w,void 0,!0,void 0,void 0,(0,l.CI)(e),!0),L=Z&&S;(0,o.d4)((()=>{if(L)return re.Z.disableRefresh(),()=>{re.Z.enableRefresh()}}),[L]);const A=(0,o.I4)((()=>{g({chatId:e.chatId,messageId:e.id})}),[g,e.chatId,e.id]),O=(0,o.I4)((()=>{S&&b(),p(),(0,Rt.Ay)(),M()}),[p,S,b,M]),U=(0,o.I4)((e=>{d({volume:e/100}),m({isMuted:!1}),N(e/100)}),[m,d,N]),F=(0,o.I4)((()=>{h.$b&&!h.cj||(B(),m({isMuted:!c}))}),[c,m,B]),$=(0,o.I4)((()=>{1===i?(x(1.8),u({playbackRate:1.8})):(x(1),u({playbackRate:1}))}),[i,u,x]),D=(0,o.Ye)((()=>0===r||c?"icon-muted":r<.3?"icon-volume-1":r<.6?"icon-volume-2":"icon-volume-3"),[r,c]);if(!s)return o.ZP.createElement("div",{className:(0,ne.Z)("AudioPlayer",t),dir:f.isRtl?"rtl":void 0},o.ZP.createElement(be.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:R(),onClick:k,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(be.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,ne.Z)("toggle-play","player-button",S?"pause":"play"),onClick:b,ariaLabel:S?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(be.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:T(),onClick:E,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:A},I?function(e){const{title:t,performer:s,fileName:n}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,vt.Z)(t||n)),s&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,vt.Z)(s)))}(I):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,vt.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(f("AttachAudio"),P),o.ZP.createElement(wt.Z,null)),o.ZP.createElement(be.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",withClickPropagation:!0},o.ZP.createElement("i",{className:D,onClick:F}),!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($t.Z,{value:c?0:100*r,onChange:U})))),Z&&o.ZP.createElement(be.Z,{round:!0,className:(0,ne.Z)("playback-button",1!==i&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:$},o.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),o.ZP.createElement(be.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var Qt=s(2607),qt=s(172);const Gt=(0,o.X$)((0,n.c$)(((e,{chatId:t})=>{const s=(0,i.Z1)(e,t),n=(0,Qt.Bj)(e,t);return{groupCall:n,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(n?n.participantsCount>0&&n.isLoaded:s&&s.isCallNotEmpty&&s.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==n?void 0:n.id)}}),((e,t)=>(0,g.ei)(t,["joinGroupCall","subscribeToGroupCallUpdates"])))((({chatId:e,isActive:t,groupCall:s,hasPinnedOffset:n,joinGroupCall:a,subscribeToGroupCallUpdates:r,usersById:i,chatsById:c})=>{const l=(0,Ze.Z)(),d=(0,o.I4)((()=>{a({chatId:e})}),[a,e]),u=null==s?void 0:s.participants,m=(0,o.Ye)((()=>u?Object.values(u).filter(((e,t)=>t<3)).map((({id:e,isUser:t})=>{if(t){if(!i[e])return;return{user:i[e]}}if(c[e])return{chat:c[e]}})).filter(Boolean):[]),[c,u,i]);if((0,o.d4)((()=>{if(null!=s&&s.id&&(t||!s.isLoaded))return r({id:s.id,subscribed:!0}),()=>{r({id:s.id,subscribed:!1})}}),[null==s?void 0:s.id,null==s?void 0:s.isLoaded,t,r]),s)return o.ZP.createElement("div",{className:(0,ne.Z)("GroupCallTopPane",n&&"has-pinned-offset",!t&&"is-hidden"),onClick:d},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},l("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},l("Participants",s.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},m.map((e=>{if(e)return e.user?o.ZP.createElement(qt.Z,{key:e.user.id,user:e.user}):o.ZP.createElement(qt.Z,{key:e.chat.id,chat:e.chat})}))),o.ZP.createElement(be.Z,{round:!0,className:"join"},l("VoipChatJoin")))}))),jt=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{const{isLeftColumnShown:a,lastSyncTime:o,shouldSkipHistoryAnimations:r}=e,{byId:c}=e.chats,l=(0,i.Z1)(e,t),{typingStatus:d}=l||{},{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,i.hj)(e,m,h):void 0;let p;if("pinned"===n){const s=(0,i.KB)(e,t);p=null==s?void 0:s.length}else if("scheduled"===n){const s=(0,i.qy)(e,t);p=null==s?void 0:s.length}else if("thread"===n&&s!==u._f){const n=(0,i.tZ)(e,t,s);p=(null==n?void 0:n.messagesCount)||0}const f={typingStatus:d,isLeftColumnShown:a,isRightColumnShown:(0,i.Jf)(e),isSelectModeActive:(0,i.CA)(e),audioMessage:g,chat:l,chatsById:c,messagesCount:p,isChatWithSelf:(0,i.FM)(e,t),isChatWithBot:l&&(0,i.xo)(e,l),lastSyncTime:o,shouldSkipHistoryAnimations:r,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState},I=(0,i.Zw)(e,t);if("thread"!==n||!I)return f;if(Object.assign(f,{messagesById:I}),s!==u._f){const n=(0,i.qS)(e,t,s),a=n?(0,i.hj)(e,t,n):void 0,o=a?(0,i.cv)(e,a):void 0;return{...f,pinnedMessageIds:n,canUnpin:!1,topMessageSender:o}}const v=(0,i.KB)(e,t);if(null!=v&&v.length){const t=I[v[0]],{canUnpin:n}=t&&(0,i._k)(e,t,s)||{};return{...f,pinnedMessageIds:v,canUnpin:n}}return f}),((e,t)=>(0,g.ei)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","openPreviousChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"])))((({chatId:e,threadId:t,messageListType:s,isReady:r,pinnedMessageIds:c,messagesById:d,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:y,chat:Z,chatsById:P,messagesCount:C,isChatWithSelf:w,isChatWithBot:b,lastSyncTime:M,shouldSkipHistoryAnimations:S,currentTransitionKey:E,connectionState:k,openChatWithInfo:R,pinMessage:T,focusMessage:N,openChat:B,openPreviousChat:x,loadPinnedMessages:L,toggleLeftColumn:A,exitMessageSelectMode:O})=>{const U=(0,Ze.Z)(),F=(0,o.sO)(!0),[$,D]=(0,o.eJ)(0),Q=Array.isArray(c)?c[$]:c,q=d&&Q?d[Q]:void 0,G=Array.isArray(c)?c.length:c?1:void 0,j=Z&&(0,l.U)(U,Z).length,H=g?(0,l.OU)(U,g):void 0;(0,o.d4)((()=>{t===u._f&&M&&r&&L({chatId:e})}),[e,L,M,t,r]),(0,o.d4)((()=>{D(0)}),[c]),(0,dt.Z)(e,Q,q);const{width:_}=ot(),z=_<=a.ks,V=h.p7&&I,W=(0,o.sO)(null),Y=(0,o.sO)(!0),X=(0,o.I4)((()=>{R({id:e})}),[R,e]),K=(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,lt.Z)(G||1,$+1);D(e)}}),[q,N,t,G,$]),ee=(0,o.I4)((()=>{B({id:e,threadId:u._f,type:"pinned"})}),[B,e]),te=(0,o.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),se=(0,o.I4)((e=>{if(F.current){if(F.current=!1,h.wB){const e=document.getElementById(a.R2);e&&e.blur()}if(f)return O(),void te();if(t===u._f&&"thread"===s&&0===E)return h.wB||V?(e.stopPropagation(),B({id:void 0})):A(),void te();x(),te()}}),[t,s,E,f,x,V,B,A,O,te]),ae=(0,o.Ye)((()=>{if(z&&P)return(0,i.A1)((0,n.Rd)())||void 0}),[z,P]),oe=_>=a.ks&&_<a.jT||_>a.l3&&_<a.ks&&(!j||j>30),re=oe||_>a._m&&_<a.QU,{shouldRender:ce,transitionClassNames:le}=(0,ie.Z)(Boolean(y)),de=(0,ut.Z)(y),{shouldRender:ue,transitionClassNames:me}=(0,ie.Z)(Boolean(q)),he=(0,ut.Z)(q,!0),ge=(0,ut.Z)(G,!0),pe=(0,ut.Z)(m,!0),fe=(0,ut.Z)(H),Ie=ue&&he||ce&&de;(0,o.d4)((()=>{const e=W.current;if(e)return re&&Ie?void(v||oe?(Y.current&&(e.classList.add("tools-stacked","animated"),Y.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),Y.current=!0)):(e.classList.remove("tools-stacked","animated"),void(Y.current=!0))}),[re,Ie,oe,v]);const Pe=(!ye()||"connectionStateConnecting"===k)&&(h.wB||h.p7&&!V);function Ce(){return Pe?o.ZP.createElement(o.ZP.Fragment,null,we(),o.ZP.createElement("h3",null,U("WaitingForNetwork"))):"thread"===s&&t===u._f?o.ZP.createElement(o.ZP.Fragment,null,(z||E>0)&&we(V,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:X},(0,l.YC)(e)?o.ZP.createElement(ht.Z,{userId:e,typingStatus:p,withFullInfo:b,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(gt.Z,{chatId:e,typingStatus:p,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===s?o.ZP.createElement(o.ZP.Fragment,null,we(),o.ZP.createElement("h3",null,U("CommentsCount",C,"i"))):"pinned"===s?o.ZP.createElement(o.ZP.Fragment,null,we(),o.ZP.createElement("h3",null,U("PinnedMessagesCount",C,"i"))):"scheduled"===s?o.ZP.createElement(o.ZP.Fragment,null,we(),o.ZP.createElement("h3",null,w?U("Reminders"):U("messages",C,"i"))):void 0}function we(e=!1,t=!1){return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(be.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:U(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,ne.Z)("animated-close-icon",!e&&"state-back")})),t&&ae&&o.ZP.createElement("div",{className:"unread-count active"},(0,mt.bi)(ae)))}const Me=Boolean(ce&&de);return o.ZP.createElement("div",{className:"MiddleHeader",ref:W},o.ZP.createElement(ve.Z,{name:S?"none":"slide-fade",activeKey:Pe?1/0:E},Ce),o.ZP.createElement(Gt,{hasPinnedOffset:ue&&!!he||ce&&!!de,chatId:e}),ue&&he&&o.ZP.createElement(St,{key:e,message:he,count:ge||0,index:$,customTitle:fe,className:(0,ne.Z)(me,Me&&"full-width"),onUnpinMessage:pe?K:void 0,onClick:J,onAllPinnedClick:ee}),o.ZP.createElement("div",{className:"header-tools"},Me&&o.ZP.createElement(Dt,{key:(0,l.Tp)(de),message:de,className:le}),o.ZP.createElement(ft,{chatId:e,threadId:t,messageListType:s,canExpandActions:!Me})))})));var Ht=s(2645),_t=s(274);function zt(e){return"albumId"in e}function Vt(e,t){let s,n=[],a={originalDate:e[0].date,datetime:Number((0,N.$Y)(1e3*e[0].date)),senderGroups:[n]};const o=[a];return e.forEach(((r,i)=>{r.isInAlbum?s?(s.messages.push(r),r.content.text&&(s.mainMessage=r)):s={albumId:r.groupedId,messages:[r],mainMessage:r}:n.push(r);const c=e[i+1];if(!s||c&&c.groupedId&&c.groupedId===s.albumId||(n.push(s),s=void 0),c){const e=Number((0,N.$Y)(1e3*c.date));a.datetime!==e?(a={originalDate:c.date,datetime:e,senderGroups:[]},o.push(a),n=[],a.senderGroups.push(n)):(c.id===t||r.senderId!==c.senderId||r.isOutgoing!==c.isOutgoing||(0,l.Lo)(r)||(0,l.Lo)(c)||r.forwardInfo&&c.forwardInfo&&(r.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||r.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||r.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||r.inlineButtons||c.inlineButtons||c.date-r.date>600)&&(n=[],a.senderGroups.push(n))}})),o}var Wt=s(386),Yt=s(2202);var Xt=s(7675),Kt=s(539),Jt=s(3657);const es=h.wZ?1e3:350,ts=h.wB?300:500;var ss=s(7240),ns=s(935);function as(e){return"number"==typeof e}function os(e,t){return e?t?238:175:t?238:100}function rs(e,t){const s=(0,l.B4)(e),n=(0,l.MF)(e),a=(0,l.O$)(e)||(0,l.F$)(e),o=(0,l.b7)(e),r=Boolean((0,l.F$)(e)),{width:i,height:c}=a?(0,It.Eh)(a,s,n,r,t):(0,It.GC)(o,s,n,t),d=os(Boolean((0,l.UD)(e)));let u=1;i<d&&d-i<12&&(u=d/i),c*u<90&&90-c*u<12&&(u=90/c);const m=Math.round(i*u),h=Math.round(c*u);return{width:m,height:h,isSmall:m<d||h<90}}function is(e,t){return e.reduce(((e,t)=>e+t),t)}function cs(e,t,s){return e<t?t:e>s?s:e}function ls(e){const t={width:0,height:0};return e.forEach((({dimensions:e,sides:s})=>{2&s&&(t.width=e.width+e.x),4&s&&(t.height=e.height+e.y)})),t}function ds(e,t,s,n){const a=n.messages.map((e=>{const t=rs(e);return t.width/t.height})),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(a),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(a),i=a.length,c=a.some((e=>e>2)),l=(0,It.kc)(e,t,!1,s)-(t?2.5:0)*It.Gw;let d;const u={ratios:a,proportions:o,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=i>=5||c?function({ratios:e,averageRatio:t,maxWidth:s,minWidth:n,spacing:a,maxHeight:o=4*s/3}){const r=function(e,t){return e.map((e=>t>1.1?cs(e,1,2.75):cs(e,.6667,1)))}(e,t),i=e.length,c=new Array(i),l=[],d=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=is(r.slice(e,e+t),0);return(s-(t-1)*a)/n})(n,e)),n+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==i;++e){const t=i-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==i-1;++e)for(let s=1;s!==i-e;++s){const n=i-e-s;e<=3&&s<=(t<.85?4:3)&&n<=3&&d([e,s,n])}for(let e=1;e!==i-1;++e)for(let t=1;t!==i-e;++t)for(let s=1;s!==i-e-t;++s){const n=i-e-t-s;e<=3&&t<=3&&s<=3&&n<=4&&d([e,t,s,n])}let u,m=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:s}=l[e],r=s.length,i=is(t,0)+a*(r-1),c=Math.min(...t)<n?1.5:1,d=(()=>{for(let e=1;e!==r;++e)if(s[e-1]>s[e])return 1.5;return 1})(),h=Math.abs(i-o)*c*d;(!u||h<m)&&(u=l[e],m=h)}const h=u.lineCounts,g=u.heights,p=h.length;let f=0,I=0;for(let e=0;e!==p;++e){const t=h[e],n=g[e],o=Math.round(n);let i=0;for(let l=0;l!==t;++l){const d=0|(0===e?1:0)|(e===p-1?4:0)|(0===l?8:0)|(l===t-1?2:0),u=r[f],m=l===t-1?s-i:Math.round(u*n);c[f]={dimensions:{x:i,y:I,width:m,height:o},sides:d},i+=m+a,++f}I+=o+a}return c}(u):2===i?function(e){const{ratios:t,proportions:s,averageRatio:n}=e;return"ww"===s&&n>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:s,spacing:n,maxHeight:a}=e,o=Math.round(Math.min(s/t[0],Math.min(s/t[1],(a-n)/2)));return[{dimensions:{x:0,y:0,width:s,height:o},sides:11},{dimensions:{x:0,y:o+n,width:s,height:o},sides:14}]}(e):"ww"===s||"qq"===s?function(e){const{ratios:t,maxWidth:s,spacing:n,maxHeight:a}=e,o=(s-n)/2,r=Math.round(Math.min(o/t[0],Math.min(o/t[1],a)));return[{dimensions:{x:0,y:0,width:o,height:r},sides:13},{dimensions:{x:o+n,y:0,width:o,height:r},sides:7}]}(e):function(e){const{ratios:t,minWidth:s,maxWidth:n,spacing:a,maxHeight:o}=e,r=Math.round(1.5*s),i=Math.min(Math.round(Math.max(.4*(n-a),(n-a)/t[0]/(1/t[0]+1/t[1]))),n-a-r),c=n-i-a,l=Math.min(o,Math.round(Math.min(c/t[0],i/t[1])));return[{dimensions:{x:0,y:0,width:c,height:l},sides:13},{dimensions:{x:c+a,y:0,width:i,height:l},sides:7}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:s,ratios:n,maxWidth:a,minWidth:o}=e,r=t,i=Math.round(Math.min((t-s)/2,n[1]*(a-s)/(n[2]+n[1]))),c=r-i-s,l=Math.max(o,Math.round(Math.min((a-s)/2,Math.min(i*n[2],c*n[1])))),d=Math.min(Math.round(r*n[0]),a-s-l);return[{dimensions:{x:0,y:0,width:d,height:r},sides:13},{dimensions:{x:d+s,y:0,width:l,height:c},sides:3},{dimensions:{x:d+s,y:c+s,width:l,height:i},sides:6}]}(e):function(e){const{maxWidth:t,ratios:s,maxHeight:n,spacing:a}=e,o=t,r=Math.round(Math.min(o/s[0],.66*(n-a))),i=(t-a)/2,c=Math.min(n-r-a,Math.round(Math.min(i/s[1],i/s[2])));return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+a,width:i,height:c},sides:12},{dimensions:{x:i+a,y:r+a,width:o-i-a,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:s,maxHeight:n,minWidth:a}){const o=e,r=Math.round(Math.min(o/t[0],.66*(n-s))),i=Math.round((e-2*s)/(t[1]+t[2]+t[3])),c=Math.max(a,Math.round(Math.min(.4*(e-2*s),i*t[1]))),l=Math.round(Math.max(Math.max(a,.33*(e-2*s)),i*t[3])),d=o-c-l-2*s,u=Math.min(n-r-s,i);return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+s,width:c,height:u},sides:12},{dimensions:{x:c+s,y:r+s,width:d,height:u},sides:4},{dimensions:{x:c+s+d+s,y:r+s,width:l,height:u},sides:6}]}(e):function({maxHeight:e,ratios:t,maxWidth:s,spacing:n,minWidth:a}){const o=e,r=Math.round(Math.min(o*t[0],.6*(s-n))),i=Math.round((e-2*n)/(1/t[1]+1/t[2]+1/t[3])),c=Math.round(i/t[1]),l=Math.round(i/t[2]),d=o-c-l-2*n,u=Math.max(a,Math.min(s-r-n,i));return[{dimensions:{x:0,y:0,width:r,height:o},sides:13},{dimensions:{x:r+n,y:0,width:u,height:c},sides:3},{dimensions:{x:r+n,y:c+n,width:u,height:l},sides:2},{dimensions:{x:r+n,y:c+l+2*n,width:u,height:d},sides:6}]}(e)}(u),{layout:d,containerStyle:ls(d)}}let us;function ms(e){return us||(us=document.createElement("span"),us.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',us.style.whiteSpace="nowrap",us.style.position="absolute",us.style.left="-999px",us.style.opacity=".01",document.body.appendChild(us)),us.innerHTML=e,us.offsetWidth}function hs(e,t,s,n,a,r){(0,o.bt)((()=>{if(s&&e.current){const t=e.current.closest(".MessageList");(0,Kt.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==n?1e3:void 0,n,void 0,r)}}),[e,t,s,n,a,r])}var gs=s(8005);const ps=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"ContextMenuContainer",!t);return s?o.ZP.createElement(s,e):void 0})),fs=(0,o.X$)((0,n.c$)(((e,{message:t})=>{const{byId:s}=e.users,n=t.senderId,{targetUserIds:a,targetChatId:o}=t.content.action||{},r=t.replyToMessageId,c=r?(0,i.hj)(e,t.chatId,r):void 0,d=(0,i._X)(e,t),{direction:u,noHighlight:m}=d&&e.focusedMessage||{},h=(0,i.Z1)(e,t.chatId);return{usersById:s,sender:h&&((0,l.eA)(h)||n===t.chatId)?h:n?(0,i.dy)(e,n):void 0,targetChatId:o,targetUserIds:a,targetMessage:c,isFocused:d,...d&&{focusDirection:u,noFocusHighlight:m}}}))((({message:e,observeIntersection:t,isEmbedded:s,appearanceOrder:n=0,isLastInList:a,usersById:r,sender:i,targetUserIds:c,targetMessage:l,targetChatId:d,isFocused:u,focusDirection:m,noFocusHighlight:h})=>{const g=(0,o.sO)(null);(0,Jt._N)(g,t),(0,dt.Z)(e.chatId,e.replyToMessageId,l),hs(g,e.chatId,u,m,h);const p=(0,Ze.Z)(),f=n<=0,[I,v]=(0,Ie.Z)(f);(0,o.d4)((()=>{f||setTimeout(v,10*n)}),[n,v,f]);const{transitionClassNames:y}=(0,ie.Z)(I,void 0,f,!1),Z=(0,o.Ye)((()=>c?c.map((e=>null==r?void 0:r[e])).filter(Boolean):void 0),[c,r]),P=(0,gs.D)(p,e,i,Z,l,d,s?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:C,contextMenuPosition:w,handleBeforeContextMenu:b,handleContextMenu:M,handleContextMenuClose:S,handleContextMenuHide:E}=(0,ss.Z)(g),k=void 0!==w;if(s)return o.ZP.createElement("span",{className:"embedded-action-message"},(0,vt.Z)(P));const R=(0,ne.Z)("ActionMessage message-list-item",u&&!h&&"focused",k&&"has-menu-open",a&&"last-in-list",y);return o.ZP.createElement("div",{ref:g,id:`message${e.id}`,className:R,"data-message-id":e.id,onMouseDown:e=>{(0,Wt.q)(e),b(e)},onContextMenu:M},o.ZP.createElement("span",null,P),w&&o.ZP.createElement(ps,{isOpen:C,anchor:w,message:e,messageListType:"thread",onClose:S,onCloseAnimationEnd:E}))}))),Is=({className:e,message:t,sender:s,title:n,customText:a,observeIntersection:r,onClick:i})=>{const c=(0,o.sO)(null),d=(0,Jt.Op)(c,r),u=(0,yt.Z)(t&&(0,l.Ti)(t,"pictogram"),!d),m=t&&`sticker-reply-thumb${t.id}`,h=Pt(t),g=Boolean(t&&(0,l.Y5)(t)),p=(0,Ze.Z)(),f=s&&(0,l.OU)(p,s);return o.ZP.createElement("div",{ref:c,className:(0,ne.Z)("EmbeddedMessage",e),onClick:t?i:void 0},h&&function(e,t,s,n){const{width:a,height:r}=(0,It.W7)();return o.ZP.createElement("img",{id:e,src:s||t,width:a,height:r,alt:"",className:n?"round":""})}(m,h,u,g),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},t?(0,l.Lo)(t)?o.ZP.createElement(fs,{message:t,isEmbedded:!0}):(0,vt.Z)((0,l.MK)(p,t,Boolean(h))):a||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,vt.Z)(f||n||" "))))};var vs=s(2535),ys=s(4752),Zs=s(8018);const Ps=(0,o.X$)((({message:e,outgoingStatus:t,signature:s,onClick:n})=>{const a=(0,Ze.Z)();return o.ZP.createElement("span",{className:"MessageMeta",dir:a.isRtl?"rtl":"ltr",onClick:n},Boolean(e.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,mt.bi)(e.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),s&&o.ZP.createElement("span",{className:"message-signature"},(0,vt.Z)(s)),o.ZP.createElement("span",{className:"message-time"},e.isEdited&&`${a("EditedMessage")} `,(0,N.mr)(1e3*e.date,a)),t&&o.ZP.createElement(Zs.Z,{status:t}))}));var Cs=s(692),ws=s(7799),bs=s(4851);const Ms=({message:e,observeIntersection:t,observeIntersectionForPlaying:s,shouldLoop:n,lastSyncTime:r})=>{const i=(0,o.sO)(null),[c,d,u]=(0,Ie.Z)(),m=e.content.sticker,{isAnimated:h,stickerSetId:g}=m,p=g===a.n,f=(0,Jt.Op)(i,t),I=(0,Jt.Op)(i,s),v=m.isPreloadedGlobally?`sticker${m.id}`:(0,l.Ti)(e,"inline"),y=Pt(e),Z=(0,yt.Z)(v,!f,(0,l.kG)(e,"inline",!0),r),P=Boolean(Z),[C,w]=(0,Ie.Z)(P),b=h?C:P,M=(0,Cs.Z)(b),{width:S,height:E}=(0,It.Wr)(m),k=(0,ne.Z)("thumbnail",!y&&"empty"),R=(0,ne.Z)("Sticker media-inner",p&&"inactive");return o.ZP.createElement("div",{ref:i,className:R,onClick:p?void 0:d},!b&&o.ZP.createElement("img",{id:`sticker-thumb-${e.id}`,src:y,width:S,height:E,alt:"",className:k}),!h&&o.ZP.createElement("img",{id:`sticker-${e.id}`,src:Z,width:S,height:E,alt:"",className:(0,ne.Z)("full-media",M)}),h&&P&&o.ZP.createElement(ws.Z,{key:v,className:(0,ne.Z)("full-media",M),id:v,animationData:Z,size:S,play:I,noLoop:!n,onLoad:w}),o.ZP.createElement(bs.Z,{isOpen:c,fromSticker:m,onClose:u}))};var Ss=s(7854),Es=s(2566),ks=s(5866);function Rs(e,t){return(0,ks.Z)((0,l.DH)(e),Boolean(t),h.wB&&!h.vX)}const Ts={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};var Ns=s(9196);const Bs=({id:e,message:t,observeIntersection:s,noAvatars:n,canAutoLoad:a,isInSelectMode:r,isSelected:i,uploadProgress:c,size:d="inline",dimensions:u,nonInteractive:m,shouldAffectAppendix:h,isDownloading:g,theme:p,onClick:f,onCancelUpload:I})=>{const v=(0,o.sO)(null),y=((0,l.O$)(t)||(0,l.F$)(t)).blobUrl,Z=(0,Jt.Op)(v,s),[P,C]=(0,o.eJ)(a),w=P&&Z,{mediaData:b,loadProgress:M}=(0,Es.Z)((0,l.Ti)(t,d),!w),S=y||b,E=Rs(t,S),{loadProgress:k}=(0,Es.Z)((0,l.Ti)(t,"download"),!g),{isUploading:R,isTransferring:T,transferProgress:N}=(0,l.Sc)(t,c||(g?k:M),w&&!S),B=!1===(0,it.Z)(P),x=(0,Cs.Z)(S),{shouldRender:L,transitionClassNames:A}=(0,ie.Z)(T,void 0,B,"slow"),{shouldRender:O,transitionClassNames:U}=(0,ie.Z)(!S&&!P),F=(0,o.I4)((()=>{R?I&&I(t):S?f&&f(t.id):C((e=>!e))}),[S,R,t,I,f]),$=(0,l.B4)(t);(0,o.bt)((()=>{if(!h)return;const e=v.current.closest(".message-content");S?function(e,t,s,n,a){return n?Promise.resolve(Ts[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const s=new Image;s.src=e,s.width||await new Promise((e=>{s.onload=e}));const n=document.createElement("canvas"),a=n.getContext("2d");n.width=s.width,n.height=s.height,a.drawImage(s,0,0,s.width,s.height);const o=t?s.width-1:0,r=s.height-1;return`rgba(${Array.from(a.getImageData(o,r,1,1).data).join(",")})`}(e,t)}(S,$,0,i,p).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")})):e.classList.add("has-appendix-thumb")}),[S,$,h,r,i,p]);const{width:D,height:Q,isSmall:q}=u||rs(t,n),G=(0,ne.Z)("media-inner",!R&&!m&&"interactive",q&&"small-image",D===Q&&"square-image"),j=u?`width: ${D}px; height: ${Q}px; left: ${u.x}px; top: ${u.y}px;`:"";return o.ZP.createElement("div",{id:e,ref:v,className:G,style:j,onClick:R?void 0:F},o.ZP.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${D}px; height: ${Q}px`}),o.ZP.createElement("img",{src:S,className:`full-media ${x}`,width:D,height:Q,alt:""}),L&&!O&&o.ZP.createElement("div",{className:`media-loading ${A}`},o.ZP.createElement(Ns.Z,{progress:N,onClick:R?F:void 0})),O&&o.ZP.createElement("i",{className:(0,ne.Z)("icon-download",U)}),T&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*N),"%"))};var xs=s(2019),Ls=s(6898),As=s(4753);function Os(e,t){var s;const n=(0,o.sO)(null===(s=e.current)||void 0===s?void 0:s.paused),a=(0,o.sO)();a.current=t;const r=(0,o.I4)((()=>{e.current&&(n.current=!e.current.paused,n.current&&e.current.pause())}),[e]),i=(0,o.I4)((()=>{e.current&&n.current&&a.current&&document.body.contains(e.current)&&(0,As.Z)(e.current)}),[e]),c=(0,o.I4)((()=>{(0,C.T2)(i)}),[i]);(0,ce.Z)(r,c),(0,se.ZP)(r,i)}function Us(){return(Us=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const Fs=({id:e,message:t,observeIntersection:s,noAvatars:a,canAutoLoad:r,canAutoPlay:i,uploadProgress:c,lastSyncTime:d,dimensions:m,onClick:h,onCancelUpload:g,isDownloading:p})=>{var f;const I=(0,o.sO)(null),v=(0,o.sO)(null),y=(0,l.b7)(t)||(0,l.Cg)(t),Z=y.blobUrl,P=(0,Jt.Op)(I,s),[C,w]=(0,o.eJ)(r),b=Boolean(C&&P&&d),[M,S]=(0,o.eJ)(i),E=(0,yt.Z)((0,l.Ti)(t,"pictogram"),!(P&&d),(0,l.kG)(t,"pictogram"),d),k=(0,Cs.Z)(E),{mediaData:R,loadProgress:T}=(0,Es.Z)((0,l.Ti)(t,"inline"),!b,(0,l.kG)(t,"inline"),d),B=Z||R,x=Boolean(P&&B),L=Rs(t,E),{loadProgress:A}=(0,Es.Z)((0,l.Ti)(t,"download"),!p,u.IU.BlobUrl,d),{isBuffered:O,bufferingHandlers:U}=(0,xs.Z)(!r),{isUploading:F,isTransferring:$,transferProgress:D}=(0,l.Sc)(t,c||(p?A:T),b&&!O||p),Q=!1===(0,it.Z)(C),{shouldRender:q,transitionClassNames:G}=(0,ie.Z)($,void 0,Q),{shouldRender:j,transitionClassNames:H}=(0,ie.Z)(C&&!M&&!q),[_,z]=(0,o.eJ)(0),V=(0,o.I4)((e=>{z(Math.max(0,e.currentTarget.currentTime-1))}),[]),W=(null===(f=v.current)||void 0===f?void 0:f.duration)||y.duration||0,Y=(0,l.B4)(t),X=(0,l.MF)(t),{width:K,height:J}=m||(0,It.GC)(y,Y,X,a);Os(v,x),(0,Ls.Z)(v,[x]);const ee=(0,o.I4)((()=>{F?g&&g(t):p?(0,n.uC)().cancelMessageMediaDownload({message:t}):B?B&&!M?(S(!0),v.current.play()):h&&h(t.id):w((e=>!e))}),[F,p,B,M,h,g,t]),te=(0,ne.Z)("media-inner dark",!F&&"interactive"),se=m?`width: ${K}px; height: ${J}px; left: ${m.x}px; top: ${m.y}px;`:"";return o.ZP.createElement("div",{ref:I,id:e,className:te,style:se,onClick:F?void 0:ee},o.ZP.createElement("canvas",{ref:L,className:"thumbnail",style:`width: ${K}px; height: ${J}px;`}),o.ZP.createElement("img",{src:E,className:(0,ne.Z)("thumbnail",k),style:`width: ${K}px; height: ${J}px;`,alt:""}),x&&o.ZP.createElement("video",Us({ref:v,className:"full-media",width:K,height:J,autoPlay:M,muted:!0,loop:!0,playsInline:!0},U,{onTimeUpdate:V}),o.ZP.createElement("source",{src:B})),j&&o.ZP.createElement("i",{className:(0,ne.Z)("icon-large-play",H)}),q&&o.ZP.createElement("div",{className:(0,ne.Z)("media-loading",G)},o.ZP.createElement(Ns.Z,{progress:D,onClick:ee})),!C&&o.ZP.createElement("i",{className:"icon-download"}),$?o.ZP.createElement("span",{className:"message-transfer-progress"},F||p?`${Math.round(100*D)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},y.isGif?"GIF":(0,N.k9)(Math.max(W-_,0))))};var $s=s(6272);const Ds=(0,n.c$)(((e,{contact:t})=>{const{countryList:{phoneCodes:s}}=e;return{user:(0,i.dy)(e,t.userId),phoneCodeList:s}}),((e,t)=>(0,g.ei)(t,["openUserInfo"])))((({contact:e,user:t,openUserInfo:s,phoneCodeList:n})=>{const{firstName:a,lastName:r,phoneNumber:i,userId:c}=e,l=(0,o.I4)((()=>{s({id:c})}),[s,c]);return o.ZP.createElement("div",{className:(0,ne.Z)("Contact",Boolean(c)&&"interactive"),onClick:c?l:void 0},o.ZP.createElement(qt.Z,{size:"large",user:t,text:a||r}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},a," ",r),o.ZP.createElement("div",{className:"contact-phone"},(0,$s.WZ)(n,i))))}));var Qs=s(1218),qs=s(4434),Gs=s(6937);function js(e,t){return t>0?(e/t*100).toFixed():0}const Hs=({answer:e,voteResults:t,totalVoters:s,maxVotersCount:n,correctResults:a,shouldAnimate:r})=>{const i=t&&t.find((t=>t.option===e.option)),c=0===a.length||-1!==a.indexOf(e.option),l=a.length>0&&c||(null==i?void 0:i.isChosen),d=i?js(i.votersCount,s||0):0,[u,m]=(0,o.eJ)(r?0:d),h=(0,o.sO)(null),g=i?js(i.votersCount,n||0):0,p=u<d;if((0,o.d4)((()=>{r&&m(d)}),[r,d]),(0,o.d4)((()=>{const e=h.current;if(e&&r){const t=e.firstElementChild,s=p?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",s):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${s}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[p,r]),!t||!i)return;const f=`width: ${g}%; transform:scaleX(${p?0:1})`;return o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&o.ZP.createElement("span",{className:(0,ne.Z)("poll-option-chosen",!c&&"wrong",r&&"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,vt.Z)(e.text)),o.ZP.createElement("div",{className:(0,ne.Z)("poll-option-answer",l&&!c&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:h}),o.ZP.createElement("div",{className:"poll-option-line",style:f}))))},_s=(0,o.X$)((0,n.c$)(((e,{poll:t})=>{const{recentVoterIds:s}=t.results,{serverTimeOffset:n,users:{byId:a}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:a,serverTimeOffset:n}:{}}),((e,t)=>(0,g.ei)(t,["loadMessage","openPollResults"])))((({message:e,poll:t,recentVoterIds:s,usersById:n,loadMessage:a,onSendVote:r,openPollResults:i,serverTimeOffset:c})=>{const{id:l,chatId:d}=e,{summary:u,results:m}=t,[h,g]=(0,o.eJ)(!1),[p,f]=(0,o.eJ)([]),[I,v]=(0,o.eJ)(!1),[y,Z]=(0,o.eJ)(!1),[P,C]=(0,o.eJ)(!u.closed&&u.closeDate&&u.closeDate>0?Math.min(u.closeDate-Math.floor(Date.now()/1e3)+c,u.closePeriod):0),w=(0,o.sO)(null),{results:b,totalVoters:M}=m,S=b&&b.some((e=>e.isChosen)),E=!u.closed&&!S,k=!E&&u.isPublic&&Number(m.totalVoters)>0,R=E&&u.multipleChoice,T=b?Math.max(...b.map((e=>e.votersCount))):M,B=b?b.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],x=u.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(u.quiz&&u.closePeriod&&P<=0)})));(0,o.d4)((()=>{h&&t.results.results&&t.results.results.some((e=>e.isChosen))&&g(!1)}),[h,t.results.results]),(0,o.d4)((()=>{P>0&&setTimeout((()=>C(P-1)),1e3);const e=w.current;if(e){const t=12*Math.PI,s=e.lastElementChild,n=e.firstElementChild;if(P<=5&&e.classList.add("hurry-up"),s&&n){const e=(u.closePeriod-P)/u.closePeriod*t;n.textContent=(0,N.k9)(P),s.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,N.k9)(P)}</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>`}}),[P,u.closePeriod]),(0,o.d4)((()=>{u.quiz&&(P<=0||S&&!u.closed)&&a({chatId:d,messageId:l})}),[d,P,S,a,l,u.closed,u.quiz]),(0,o.d4)((()=>{let e;return u.quiz&&!u.closed&&u.closePeriod&&u.closePeriod>0&&(e=window.setTimeout((()=>{a({chatId:d,messageId:l})}),1e3*u.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[E,d,a,l,u.closePeriod,u.closed,u.quiz]);const L=(0,o.Ye)((()=>s?s.reduce(((e,t)=>{const s=n[t];return s&&e.push(s),e}),[]):[]),[n,s]),A=(0,o.I4)((e=>{f([e]),g(!0),Z(!0),r([e])}),[r]),O=(0,o.I4)((e=>{f(e)}),[]),U=(0,o.I4)((()=>{g(!0),Z(!0),r(p)}),[r,p]),F=(0,o.I4)((()=>{i({chatId:d,messageId:l})}),[d,l,i]),$=(0,o.I4)((()=>{v(!0)}),[]),D=(0,o.I4)((()=>{v(!1),Z(!1)}),[]);(0,o.d4)((()=>{y&&S&&u.quiz&&m.results&&t.results.solution&&(m.results.find((e=>e.isChosen&&e.isCorrect))||v(!0))}),[S,y,m.results,u.quiz,t.results.solution]);const Q=(0,Ze.Z)();return o.ZP.createElement("div",{className:"Poll",dir:Q.isRtl?"auto":"ltr"},I&&t.results.solution&&o.ZP.createElement(Gs.Z,{message:(0,ns.H)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:D,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,vt.Z)(u.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"}(u)),L.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>o.ZP.createElement(qt.Z,{size:"micro",user:e})))),P>0&&E&&o.ZP.createElement("div",{ref:w,className:"poll-countdown"}),u.quiz&&t.results.solution&&!E&&o.ZP.createElement(be.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:I,onClick:$,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),E&&o.ZP.createElement("div",{className:"poll-answers"},R?o.ZP.createElement(Qs.Z,{options:x,onChange:O,disabled:e.isScheduled||h,loadingOptions:h?p:void 0,round:!0}):o.ZP.createElement(qs.Z,{name:`poll-${l}`,options:x,onChange:A,disabled:e.isScheduled||h,loadingOption:h?p[0]:void 0})),!E&&o.ZP.createElement("div",{className:"poll-results"},u.answers.map((function(e){return o.ZP.createElement(Hs,{key:e.option,shouldAnimate:y,answer:e,voteResults:b,totalVoters:M,maxVotersCount:T,correctResults:B})}))),!k&&!R&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,s){return s?e(t?"Answer":"Vote",s,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(Q,u.quiz,m.totalVoters)),R&&o.ZP.createElement(be.Z,{isText:!0,disabled:0===p.length,size:"tiny",onClick:U},Q("PollSubmitVotes")),k&&o.ZP.createElement(be.Z,{isText:!0,size:"tiny",onClick:F},Q("PollViewResults")))})));var zs=s(8035),Vs=s(88);const Ws=(0,o.X$)((({message:e,observeIntersection:t,noAvatars:s,canAutoLoad:n,canAutoPlay:a,inPreview:r,lastSyncTime:i,isDownloading:c=!1,theme:d,onMediaClick:u,onCancelMediaTransfer:m})=>{const h=(0,l.s1)(e);let g=!1;if(null!=h&&h.photo&&!h.video){const{width:t,height:s}=rs(e);g=t===s}const p=(0,o.I4)((()=>{u()}),[u]);if(!h)return;const{siteName:f,url:I,displayUrl:v,title:y,description:Z,photo:P,video:C}=h,w=(P||C)&&u&&!g,b=(0,zs.Z)(Z,170),M=(0,ne.Z)("WebPage",g&&"with-square-photo",!P&&!C&&!r&&"without-media",C&&"with-video");return o.ZP.createElement("div",{className:M,"data-initial":(f||v)[0],dir:"auto"},P&&!C&&o.ZP.createElement(Bs,{message:e,observeIntersection:t,noAvatars:s,canAutoLoad:n,size:g?"pictogram":"inline",nonInteractive:!w,onClick:w?p:void 0,onCancelUpload:m,isDownloading:c,theme:d}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(Vs.Z,{className:"site-name",url:I,text:f||v}),!r&&y&&o.ZP.createElement("p",{className:"site-title"},(0,vt.Z)(y)),b&&o.ZP.createElement("p",{className:"site-description"},(0,vt.Z)(b,["emoji","br"]))),!r&&C&&o.ZP.createElement(Fs,{message:e,observeIntersection:t,noAvatars:s,canAutoLoad:n,canAutoPlay:a,lastSyncTime:i,onClick:w?p:void 0,onCancelUpload:m,isDownloading:c}))}));var Ys=s(9937);const Xs=(0,o.X$)((({message:e})=>{const t=(0,Ze.Z)(),s=(0,l.eO)(e),{title:n,text:a,amount:r,currency:i,isTest:c,photoUrl:d}=s;return o.ZP.createElement("div",{className:"Invoice"},n&&o.ZP.createElement("p",{className:"title"},(0,vt.Z)(n)),a&&o.ZP.createElement("p",null,(0,vt.Z)(a,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(d?"has-image":"")},d&&o.ZP.createElement("img",{className:"invoice-image",src:d,alt:""}),o.ZP.createElement("p",{className:"description-text"},(0,Ys.x)(r,i,t.code),c&&o.ZP.createElement("span",null,t("PaymentTestInvoice")))))}));function Ks(e){return(0,o.X$)((0,n.c$)(((e,t)=>{const{message:s}=t;return{isInSelectMode:(0,i.CA)(e),isSelected:(0,i.vk)(e,s.id)}}),((e,t)=>(0,g.ei)(t,["toggleMessageSelection"])))((t=>{const{isInSelectMode:s,isSelected:n,message:a,toggleMessageSelection:r,dimensions:i}=t,c=(0,o.I4)((e=>{e.stopPropagation(),r({messageId:a.id,withShift:null==e?void 0:e.shiftKey})}),[r,a]),l=(0,o.Ye)((()=>({...t,isInSelectMode:s,isSelected:n,dimensions:{...t.dimensions,x:0,y:0},onClick:s?void 0:t.onClick})),[t,s,n]);return o.ZP.createElement("div",{className:(0,ne.Z)("album-item-select-wrapper",n&&"is-selected"),style:i?`left: ${i.x}px; top: ${i.y}px;`:"",onClick:s?c:void 0},s&&o.ZP.createElement("div",{className:"message-select-control"},n&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,l))})))}const Js=Ks(Bs),en=Ks(Fs),tn=(0,n.c$)(((e,{album:t})=>{const{chatId:s}=t.mainMessage,n=(0,i.Pu)(e),a=(0,i.xs)(e,s);return{theme:n,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:a}}),((e,t)=>(0,g.ei)(t,["cancelSendingMessage"])))((({album:e,observeIntersection:t,hasCustomAppendix:s,lastSyncTime:a,isOwn:r,albumLayout:c,onMediaClick:d,uploadsById:u,activeDownloadIds:m,theme:h,cancelSendingMessage:g})=>{const p=e.messages.length,f=(0,o.I4)((e=>{g({chatId:e.chatId,messageId:e.id})}),[g]),{width:I,height:v}=c.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${I}px; height: ${v}px;`},e.messages.map((function(e,g){const{photo:I,video:v}=(0,l.qp)(e),y=u[e.previousLocalId||e.id],Z=null==y?void 0:y.progress,{dimensions:P,sides:C}=c.layout[g],w=(0,i.bH)((0,n.Rd)(),e),b=(0,i.__)((0,n.Rd)(),e);if(I){const n=s&&(r?g===p-1:Boolean(8&C&&4&C));return o.ZP.createElement(Js,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:w,shouldAffectAppendix:n,uploadProgress:Z,dimensions:P,onClick:d,onCancelUpload:f,isDownloading:m.includes(e.id),theme:h})}if(v)return o.ZP.createElement(en,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:w,canAutoPlay:b,uploadProgress:Z,lastSyncTime:a,dimensions:P,onClick:d,onCancelUpload:f,isDownloading:m.includes(e.id),theme:h})})))}));function sn(){return(sn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let nn;const an=({message:e,observeIntersection:t,canAutoLoad:s,lastSyncTime:a,isDownloading:r})=>{const i=(0,o.sO)(null),c=(0,o.sO)(null),d=(0,o.sO)(null),m=e.content.video,h=(0,Jt.Op)(i,t),[g,p]=(0,o.eJ)(s),f=Boolean(g&&h&&a),{mediaData:I,loadProgress:v}=(0,Es.Z)((0,l.Ti)(e,"inline"),!f,(0,l.kG)(e,"inline"),a),{loadProgress:y}=(0,Es.Z)((0,l.Ti)(e,"download"),!r,u.IU.BlobUrl,a),Z=Rs(e,I),{isBuffered:P,bufferingHandlers:w}=(0,xs.Z)(),b=g&&!P||r,M=!1===(0,it.Z)(g),S=(0,Cs.Z)(I),{shouldRender:E,transitionClassNames:k}=(0,ie.Z)(b||!P,void 0,M),[R,T]=(0,o.eJ)(!1),[B,x]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!R)return;const e=It.Rj/2,t=2*(e-6)*Math.PI,s=t-B*t,n=d.current,a=c.current,o=a.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",s.toString()):a.innerHTML=`\n <svg width="${It.Rj}px" height="${It.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,x(n.currentTime/n.duration)}),[R,B]);const L=Boolean(I&&h),A=()=>{T(!1),x(0),(0,As.Z)(d.current),(0,C.T2)((()=>{c.current.innerHTML=""}))},O=(U=A,()=>{nn&&nn(),nn=U});var U;(0,o.d4)((()=>{d.current&&(L?(0,As.Z)(d.current):d.current.pause())}),[L]),Os(d,L),(0,Ls.Z)(d,[I]);const F=(0,o.I4)((()=>{if(!I)return void p((e=>!e));if(r)return void(0,n.uC)().cancelMessageMediaDownload({message:e});const t=d.current;R?t.paused?((0,As.Z)(t),(0,kt.Es)()):t.pause():(O(),t.pause(),t.currentTime=0,(0,As.Z)(t),(0,kt.Es)(),T(!0))}),[O,R,r,I,e]),$=(0,o.I4)((e=>{const t=e.currentTarget;x(t.currentTime/t.duration)}),[]),D=(0,ne.Z)("full-media",S);return o.ZP.createElement("div",{ref:i,className:"RoundVideo media-inner",onClick:F},o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${It.Rj}px; height: ${It.Rj}px`})),I&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",sn({ref:d,className:D,width:It.Rj,height:It.Rj,autoPlay:!0,muted:!R,loop:!R,playsInline:!0,onEnded:R?A:void 0},w,{onTimeUpdate:R?$:void 0}),o.ZP.createElement("source",{src:I}))),o.ZP.createElement("div",{className:"progress",ref:c}),E&&o.ZP.createElement("div",{className:`media-loading ${k}`},o.ZP.createElement(Ns.Z,{progress:r?y:v})),!I&&!g&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},R?(0,N.k9)(d.current.currentTime):(0,N.k9)(m.duration),(!R||d.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},on=({message:e,onClick:t})=>{const s=(0,Ze.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},e.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(be.Z,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},(0,vt.Z)(s(e.text)),"buy"===e.type&&o.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!e.value.match(a.FS)&&o.ZP.createElement("i",{className:"icon-arrow-right"}))))))))},rn=(0,o.X$)((({threadInfo:e,disabled:t,openChat:s})=>{const a=(0,Ze.Z)(),{threadId:r,chatId:i,messagesCount:c,lastMessageId:d,lastReadInboxMessageId:u,recentReplierIds:m}=e,h=(0,o.I4)((()=>{s({id:i,threadId:r})}),[s,i,r]),g=(0,o.Ye)((()=>{if(null==m||!m.length)return;const{users:{byId:e},chats:{byId:t}}=(0,n.Rd)();return m.map((s=>(0,l.YC)(s)?e[s]:t[s])).filter(Boolean)}),[m]);if(void 0===c)return;const p=Boolean(u&&d&&u<d);return o.ZP.createElement("div",{"data-cnt":(0,mt.bi)(c),className:(0,ne.Z)("CommentButton",p&&"has-unread",t&&"disabled"),dir:a.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:a.isRtl?"rtl":"ltr"},g.map((e=>o.ZP.createElement(qt.Z,{key:e.id,size:"small",user:(0,l.YC)(e.id)?e:void 0,chat:(0,l.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},c?a("Comments",c,"i"):a("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),cn="data-is-document-group-hover",ln={__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>'},dn={__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>'};function un(e){const t=hn(e.currentTarget);t&&t.setAttribute(cn,"")}function mn(e){const t=hn(e.currentTarget);t&&t.removeAttribute(cn)}function hn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}const gn=(0,o.X$)((0,n.c$)(((e,t)=>{const{focusedMessage:s,forwardMessages:n,lastSyncTime:a}=e,{message:o,album:r,withSenderName:c,withAvatar:d,threadId:u,messageListType:m}=t,{id:h,chatId:g,viaBotId:p,replyToChatId:f,replyToMessageId:I,isOutgoing:v,threadInfo:y}=o,Z=(0,i.Z1)(e,g),P=(0,i.FM)(e,g),C=(0,l.pK)(g),w=Z&&(0,l.eA)(Z),b=null==Z?void 0:Z.username,M=!P&&(0,l.Ul)(o),S=c||d||M,E=(0,i.Ur)(e,o),k=(0,i.cv)(e,o),R=p?(0,i.dy)(e,p):void 0,T=u?(0,i.qS)(e,g,u):void 0,N=o.id===T,B=I===T,x=I&&!B?(0,i.hj)(e,C&&f?f:g,I):void 0,L=x&&(0,i.Ur)(e,x),A=(0,i.uZ)(e,o),O="thread"===m&&(r?r.messages.some((t=>(0,i._X)(e,t))):(0,i._X)(e,o)),{direction:U,noHighlight:F,isResizingContainer:$}=O&&s||{},D=n.messageIds&&n.messageIds.includes(h),{query:Q}=(0,i.n5)(e)||{},q=(0,l._O)(o);let G;G=null!=r&&r.messages?r.messages.every((({id:t})=>(0,i.vk)(e,t))):(0,i.vk)(e,h);const{canReply:j}="thread"===m&&(0,i._k)(e,o,u)||{},H=(0,i.te)(e,o),_=y?(0,i.tZ)(e,y.chatId,y.threadId)||y:void 0;return{theme:(0,i.Pu)(e),chatUsername:b,forceSenderName:M,sender:S?E:void 0,originSender:k,botSender:R,shouldHideReply:B,isThreadTop:N,replyMessage:x,replyMessageSender:L,isFocused:O,isForwarding:D,isChatWithSelf:P,isRepliesChat:C,isChannel:w,canReply:j,lastSyncTime:a,highlight:Q,isSingleEmoji:Boolean(q),animatedEmoji:q?(0,i.zB)(e,q):void 0,isInSelectMode:(0,i.CA)(e),isSelected:G,isGroupSelected:!!o.groupedId&&!o.isInAlbum&&(0,i.a6)(e,g,o.groupedId),threadId:u,isDownloading:H,isPinnedList:"pinned"===m,canAutoLoadMedia:(0,i.bH)(e,o),canAutoPlayMedia:(0,i.__)(e,o),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,i.yB)(e),threadInfo:_,...v&&{outgoingStatus:(0,i.dT)(e,o,"scheduled"===m)},..."number"==typeof A&&{uploadProgress:A},...O&&{focusDirection:U,noFocusHighlight:F,isResizingContainer:$}}}),((e,t)=>(0,g.ei)(t,["toggleMessageSelection","clickInlineButton","disableContextMenuHint","openChat"])))((({message:e,chatUsername:t,observeIntersectionForBottom:s,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:r,album:i,noAvatars:c,withAvatar:d,withSenderName:g,noComments:p,appearanceOrder:f,isFirstInGroup:I,isLastInGroup:v,isFirstInDocumentGroup:y,isLastInDocumentGroup:Z,isLastInList:P,theme:C,forceSenderName:w,sender:b,originSender:M,botSender:S,isThreadTop:E,shouldHideReply:k,replyMessage:R,replyMessageSender:T,outgoingStatus:N,uploadProgress:B,isFocused:x,focusDirection:L,noFocusHighlight:A,isResizingContainer:O,isForwarding:U,isChatWithSelf:F,isRepliesChat:$,isChannel:D,canReply:Q,lastSyncTime:q,highlight:G,animatedEmoji:j,isInSelectMode:H,isSelected:_,isGroupSelected:z,threadId:V,messageListType:W,isPinnedList:Y,isDownloading:X,canAutoLoadMedia:K,canAutoPlayMedia:J,shouldLoopStickers:ee,autoLoadFileMaxSizeMb:te,threadInfo:se,toggleMessageSelection:ae,clickInlineButton:oe,disableContextMenuHint:ce,openChat:le})=>{const de=(0,o.sO)(null),ue=(0,o.sO)(null),me=(0,Ze.Z)();(0,Jt._N)(ue,s);const{isContextMenuOpen:he,contextMenuPosition:ge,handleBeforeContextMenu:pe,handleContextMenu:fe,handleContextMenuClose:ve,handleContextMenuHide:ye}=(0,ss.Z)(de,h.$b&&H,!0,h.wZ);(0,o.d4)((()=>{he&&ce()}),[he,ce]);const Pe=f<=0,[Ce,we]=(0,Ie.Z)(Pe);(0,o.d4)((()=>{Pe||setTimeout(we,10*f)}),[f,we,Pe]);const{transitionClassNames:Me}=(0,ie.Z)(Ce,void 0,Pe,!1),{id:Se,chatId:Ee}=e,ke=(0,l.CI)(e),Re=(0,l.B4)(e),Te="scheduled"===W||e.isScheduled,Ne=(0,l.ss)(e)&&!k,xe=Boolean(se)&&"thread"===W,{forwardInfo:Le,viaBotId:Ae}=e,Oe=Le&&(!F||Te)&&!$&&!Le.isLinkedChannelPost,Ue=Boolean(e.groupedId)&&!e.isInAlbum,Fe=Boolean(i)&&i.messages.length>1,{text:$e,photo:De,video:Qe,audio:qe,voice:Ge,document:je,sticker:He,contact:_e,poll:ze,webPage:Ve,invoice:We}=(0,l.qp)(e),Ye=(0,l.$D)(e),Xe=(0,ns.X)(e,G,as(Ye)),Ke=void 0!==ge,Je=D&&e.adminTitle||Le&&!Oe&&Le.adminTitle||void 0,et=(0,o.Ye)((()=>Je?ms(Je):void 0),[Je]),tt=!(Ke||H||U)&&(!Ue||Z),st=D&&!Te,nt=Boolean(Y||Le&&(Le.isChannelPost||F&&!Re||$)&&Le.fromMessageId),at=Le&&(F||$||!b)?M:b,ot=Le?M:b,rt=(0,o.I4)(((e,t)=>{ae({messageId:Se,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...Fe&&{childMessageIds:i.messages.map((({id:e})=>e))}})}),[ae,Se,Fe,i]),{handleMouseDown:it,handleClick:ct,handleContextMenu:lt,handleDoubleClick:ut,handleContentDoubleClick:mt,isSwiped:ht}=function(e,t,s,a,r,i,c,l){const{setReplyingToId:d}=(0,n.uC)(),[u,m,g]=(0,Ie.Z)();return(0,o.d4)((()=>{if(!h.$b||r||!i)return;let e;return(0,Be.s)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,s)=>s===Be.e.Left&&(e||(e=Date.now()),m(),!0),onRelease:()=>{e&&(d({messageId:s}),setTimeout(g,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,r,s,d,m,g,i]),{handleMouseDown:r?void 0:function(e){(0,Wt.q)(e),l(e)},handleClick:function(t){if(r)e(t);else if(h.wZ){const e=t.target;if(!e.classList.contains("text-content")&&!e.classList.contains("Message"))return;re.Z.getIsKeyboardVisible()?setTimeout((()=>{c(t)}),350):c(t)}},handleContextMenu:r?void 0:function(t){if(h.wZ){if(t.target.matches("a[href]"))return;t.preventDefault(),e()}else c(t)},handleDoubleClick:r?void 0:function(){d({messageId:s})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},isSwiped:u}}(rt,de,Se,0,Boolean(H),Boolean(Q),fe,pe),{handleAvatarClick:gt,handleSenderClick:pt,handleViaBotClick:ft,handleReplyClick:yt,handleMediaClick:Zt,handleAudioPlay:Pt,handleAlbumMediaClick:Ct,handleMetaClick:wt,handleReadMedia:bt,handleCancelUpload:Mt,handleVoteSend:St,handleGroupForward:Et,handleForward:kt,handleFocus:Rt,handleFocusForwarded:Tt,handleDocumentGroupSelectAll:Nt}=function(e,t,s,a,r,i,c,d,h,g,p,f){const{openUserInfo:I,openChat:v,showNotification:y,focusMessage:Z,openMediaViewer:P,openAudioPlayer:C,markMessagesRead:w,cancelSendingMessage:b,sendPollVote:M,openForwardMenu:S,focusMessageInComments:E}=(0,n.uC)(),{id:k,forwardInfo:R,replyToMessageId:T,replyToChatId:N,replyToTopMessageId:B,groupedId:x}=s,L=(0,o.I4)((()=>{g&&((0,l.YC)(g.id)?I({id:g.id}):v({id:g.id}))}),[g,I,v]),A=(0,o.I4)((()=>{p?(0,l.YC)(p.id)?I({id:p.id}):v({id:p.id}):y({message:e("HidAccount")})}),[p,y,e,I,v]),O=(0,o.I4)((()=>{f&&I({id:f.id})}),[f,I]),U=(0,o.I4)((()=>{Z({chatId:d&&N?N:a,threadId:r,messageId:T,replyMessageId:d&&N?void 0:k})}),[Z,d,N,a,r,T,k]),F=(0,o.I4)((()=>{P({chatId:a,threadId:r,messageId:k,origin:c?m.bZ.ScheduledInline:m.bZ.Inline})}),[a,r,k,P,c]),$=(0,o.I4)((()=>{C({chatId:a,messageId:k})}),[a,k,C]),D=(0,o.I4)((e=>{P({chatId:a,threadId:r,messageId:e,origin:c?m.bZ.ScheduledAlbum:m.bZ.Album})}),[a,r,P,c]),Q=(0,o.I4)((()=>{w({messageIds:[k]})}),[k,w]),q=(0,o.I4)((()=>{b({chatId:a,messageId:k})}),[b,a,k]),G=(0,o.I4)((e=>{M({chatId:a,messageId:k,options:e})}),[a,k,M]),j=(0,o.I4)((()=>{S({fromChatId:a,groupedId:x})}),[S,a,x]),H=(0,o.I4)((()=>{if(h&&h.messages){const e=h.messages.map((({id:e})=>e));S({fromChatId:a,messageIds:e})}else S({fromChatId:a,messageIds:[k]})}),[h,S,a,k]),_=(0,o.I4)((()=>{Z({chatId:a,threadId:u._f,messageId:k})}),[Z,a,k]),z=(0,o.I4)((()=>{i?Z({chatId:R.fromChatId,groupedId:x,groupedChatId:a}):d&&N?E({chatId:N,threadId:B,messageId:R.fromMessageId}):Z({chatId:R.fromChatId,messageId:R.fromMessageId})}),[i,d,N,Z,R,x,a,E,B]),V=(0,o.I4)((e=>{e.stopPropagation(),t(e,x)}),[t,x]);return{handleAvatarClick:L,handleSenderClick:A,handleViaBotClick:O,handleReplyClick:U,handleMediaClick:F,handleAudioPlay:$,handleAlbumMediaClick:D,handleMetaClick:V,handleReadMedia:Q,handleCancelUpload:q,handleVoteSend:G,handleGroupForward:j,handleForward:H,handleFocus:_,handleFocusForwarded:z,handleDocumentGroupSelectAll:V}}(me,rt,e,Ee,V,Ue,Boolean(Te),$,i,at,ot,S),Bt=(0,ne.Z)("Message message-list-item",I&&"first-in-group",v&&"last-in-group",y&&"first-in-document-group",Z&&"last-in-document-group",P&&"last-in-list",Re&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Ne&&"has-reply",Ke&&"has-menu-open",x&&!A&&"focused",U&&"is-forwarding",e.isDeleting&&"is-deleting",Ue&&"is-in-document-group",Fe&&"is-album",e.hasUnreadMention&&"has-unread-mention",_&&"is-selected",H&&"is-in-selection-mode",E&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",ht&&"is-swiped",Me),xt=function(e,{hasReply:t,customShape:s,isLastInGroup:n,asForwarded:a,hasThread:o,forceSenderName:r,hasComments:i,hasActionButton:c}={}){const{text:d,photo:u,video:m,audio:h,voice:g,document:p,poll:f,webPage:I,contact:v}=(0,l.qp)(e),y=["message-content"],Z=u||m,P=Z&&!d,C=Boolean(e.viaBotId);return as(s)?y.push(`emoji-only emoji-only-${s}`):d&&y.push("text"),c&&y.push("has-action-button"),s&&(y.push("custom-shape"),null!=m&&m.isRound&&y.push("round"),i&&y.push("has-comments")),u||m?y.push("media"):h?y.push("audio"):g?y.push("voice"):p?y.push("document"):v?y.push("contact"):f?y.push("poll"):I&&(y.push("web-page"),(I.photo||I.video)&&y.push("media")),a&&!s&&y.push("is-forwarded"),t&&y.push("is-reply"),o&&y.push("has-replies"),C&&y.push("is-via-bot"),r&&y.push("force-sender-name"),s||(y.push("has-shadow"),Z&&i&&y.push("has-background"),(t||a||!P||C||r)&&y.push("has-solid-background"),!n||!u&&P||y.push("has-appendix")),y.join(" ")}(e,{hasReply:Ne,customShape:Ye,isLastInGroup:v,asForwarded:Oe,hasThread:xe,forceSenderName:w,hasComments:se&&(null==se?void 0:se.messagesCount)>0,hasActionButton:st||nt}),Lt=se&&(!Ue||Z)&&"thread"===W&&!p,At=xt.includes("has-appendix");(0,dt.Z)($&&e.replyToChatId?e.replyToChatId:Ee,Ne?e.replyToMessageId:void 0,R,e.id),hs(de,Ee,x,L,A,O);let Ot,Ut="",Ft=!1;const $t=(0,o.Ye)((()=>Fe?ds(Re,Boolean(Oe),Boolean(c),i):void 0),[Fe,Re,Oe,c,i]),Dt=Oe?28:0;if(Fe||!De&&!Qe)$t&&(Ot=Math.max(os(Boolean($e),Lt),$t.containerStyle.width),Ot-$t.containerStyle.width>18&&(Ft=!0));else{let t;De?t=rs(e,c).width:Qe&&(t=Qe.isRound?It.Rj:rs(e,c).width),t&&(Ot=Math.max(os(Boolean($e),Lt),t),Ot-t>18&&(Ft=!0))}return Ot&&(Ut=`width: ${Ot+Dt}px`),o.ZP.createElement("div",{ref:de,id:`message${Se}`,className:Bt,style:et?`--meta-safe-author-width: ${et}px`:void 0,"data-message-id":Se,onMouseDown:it,onClick:ct,onContextMenu:lt,onDoubleClick:ut,onMouseEnter:Ue&&!Z?un:void 0,onMouseLeave:Ue&&!Z?mn:void 0},o.ZP.createElement("div",{ref:ue,className:"bottom-marker","data-message-id":Se,"data-last-message-id":i?i.messages[i.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Ue&&o.ZP.createElement("div",{className:"message-select-control"},_&&o.ZP.createElement("i",{className:"icon-select"})),Z&&o.ZP.createElement("div",{className:(0,ne.Z)("message-select-control group-select",z&&"is-selected"),onClick:Nt},z&&o.ZP.createElement("i",{className:"icon-select"})),d&&function(){const e=at&&(0,l.YC)(at.id),t=at&&e?at:void 0,s=at&&!e?at:void 0,n=!at&&Le?Le.hiddenUserName:void 0;return o.ZP.createElement(qt.Z,{size:"small",user:t,chat:s,text:n,lastSyncTime:q,onClick:t||s?gt:void 0})}(),o.ZP.createElement("div",{className:(0,ne.Z)("message-content-wrapper",xt.includes("text")&&"can-select-text")},o.ZP.createElement("div",{className:xt,style:Ut,dir:"auto"},Oe&&!Ye&&(!Ue||y)&&o.ZP.createElement("div",{className:"message-title"},me("ForwardedMessage")),function(){const t=(0,ne.Z)("content-inner",Oe&&!Ye&&"forwarded-message",Ne&&"reply-message",Ft&&"no-media-corners"),s=v&&!Xe&&!Oe&&!xe,n=!Ve&&!j&&Xe,d=(0,ne.Z)("text-content",n&&"with-meta",N&&"with-outgoing-icon");return o.ZP.createElement("div",{className:t,onDoubleClick:mt,dir:"auto"},function(){if(Ye&&!Ae||!(g&&!De&&!Qe||Oe||Ae||w)||Ue&&!y||Ne&&Ye)return;let t,s;return!ot||Ye&&Ae?null!=Le&&Le.hiddenUserName&&(t=Le.hiddenUserName):(t=(0,l.OU)(me,ot),Oe||(s=`color-${(0,l.Rs)(ot)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},t?o.ZP.createElement("span",{className:(0,ne.Z)("interactive",s),onClick:pt,dir:"auto"},(0,vt.Z)(t)):S?void 0:" ",S&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},me("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:ft},(0,vt.Z)(`@${S.username}`))),null!=Le&&Le.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},me("DiscussChannel")):e.adminTitle&&!D?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Ne&&o.ZP.createElement(Is,{message:R,sender:T,observeIntersection:a,onClick:yt}),He&&o.ZP.createElement(Ms,{message:e,observeIntersection:a,observeIntersectionForPlaying:r,shouldLoop:ee,lastSyncTime:q}),j&&o.ZP.createElement(Ss.Z,{size:"small",sticker:j,observeIntersection:a,lastSyncTime:q,forceLoadPreview:ke}),Fe&&o.ZP.createElement(tn,{album:i,albumLayout:$t,observeIntersection:a,isOwn:Re,hasCustomAppendix:s,lastSyncTime:q,onMediaClick:Ct}),!Fe&&De&&o.ZP.createElement(Bs,{message:e,observeIntersection:a,noAvatars:c,canAutoLoad:K,uploadProgress:B,shouldAffectAppendix:s,onClick:Zt,onCancelUpload:Mt,isDownloading:X,theme:C}),!Fe&&Qe&&Qe.isRound&&o.ZP.createElement(an,{message:e,observeIntersection:a,canAutoLoad:K,lastSyncTime:q,isDownloading:X}),!Fe&&Qe&&!Qe.isRound&&o.ZP.createElement(Fs,{message:e,observeIntersection:a,noAvatars:c,canAutoLoad:K,canAutoPlay:J,uploadProgress:B,lastSyncTime:q,onClick:Zt,onCancelUpload:Mt,isDownloading:X}),(qe||Ge)&&o.ZP.createElement(ys.Z,{theme:C,message:e,origin:m.Cr.Inline,uploadProgress:B,lastSyncTime:q,isSelectable:Ue,isSelected:_,onPlay:Pt,onReadMedia:!Ge||Re&&!F?void 0:bt,onCancelUpload:Mt,isDownloading:X}),je&&o.ZP.createElement(vs.Z,{message:e,observeIntersection:a,canAutoLoad:K,autoLoadFileMaxSizeMb:te,uploadProgress:B,isSelectable:Ue,isSelected:_,onMediaClick:Zt,onCancelUpload:Mt,isDownloading:X}),_e&&o.ZP.createElement(Ds,{contact:_e}),ze&&o.ZP.createElement(_s,{message:e,poll:ze,onSendVote:St}),!j&&Xe&&o.ZP.createElement("p",{className:d,dir:"auto"},Xe,n&&o.ZP.createElement(Ps,{message:e,outgoingStatus:N,signature:Je,onClick:wt})),Ve&&o.ZP.createElement(Ws,{message:e,observeIntersection:a,noAvatars:c,canAutoLoad:K,canAutoPlay:J,lastSyncTime:q,onMediaClick:Zt,onCancelMediaTransfer:Mt,isDownloading:X,theme:C}),We&&o.ZP.createElement(Xs,{message:e}))}(),(!Ue||Z)&&!(!Ve&&!j&&Xe)&&o.ZP.createElement(Ps,{message:e,outgoingStatus:N,signature:Je,onClick:wt}),tt&&st?o.ZP.createElement(be.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:me("lng_context_forward_msg"),onClick:Z?Et:kt},o.ZP.createElement("i",{className:"icon-share-filled"})):tt&&nt?o.ZP.createElement(be.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:Y?Rt:Tt},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,Lt&&o.ZP.createElement(rn,{threadInfo:se,disabled:p,openChat:le}),At&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:Re?ln:dn})),e.inlineButtons&&o.ZP.createElement(on,{message:e,onClick:oe})),ge&&o.ZP.createElement(ps,{isOpen:he,anchor:ge,message:e,album:i,chatUsername:t,messageListType:W,onClose:ve,onCloseAnimationEnd:ye}))}))),pn=(0,o.X$)((({messageIds:e,messageGroups:t,isViewportNewest:s,isUnread:r,withUsers:i,noAvatars:c,containerRef:d,anchorIdRef:u,memoUnreadDividerBeforeIdRef:h,memoFirstUnreadIdRef:p,threadId:f,type:I,isReady:v,threadTopMessageId:y,hasLinkedChat:Z,isSchedule:P,noAppearanceAnimation:w,onFabToggle:b,onNotchToggle:M,openHistoryCalendar:S})=>{const{observeIntersectionForMedia:E,observeIntersectionForReading:k,observeIntersectionForAnimatedStickers:R}=function(e,t,s){const{markMessageListRead:a,markMessagesRead:o}=(0,n.uC)(),{observe:r}=(0,Jt.S1)({rootRef:t,throttleMs:es,margin:ts}),{observe:i,freeze:c,unfreeze:l}=(0,Jt.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let n=0;const r=[];t.forEach((e=>{const{isIntersecting:t,target:s}=e;if(!t)return;const{dataset:a}=s,o=Number(a.lastMessageId||a.messageId);o>n&&(n=o),a.hasUnreadMention&&r.push(o)})),s.current&&n>=s.current&&a({maxId:n}),r.length&&o({messageIds:r})}));(0,ce.Z)(c,l);const{observe:d}=(0,Jt.S1)({rootRef:t,throttleMs:es});return{observeIntersectionForMedia:r,observeIntersectionForReading:i,observeIntersectionForAnimatedStickers:d}}(I,d,p),{backwardsTriggerRef:T,forwardsTriggerRef:B,fabTriggerRef:x}=function(e,t,s,r,i,c,l,d){const{loadViewportMessages:u}=(0,n.uC)(),[h,g]=(0,o.Ye)((()=>"thread"===e?[(0,C.Ds)((()=>u({direction:m.Uq.Backwards})),1e3,!0,!1),(0,C.Ds)((()=>u({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[u,s]),p=(0,o.sO)(null),f=(0,o.sO)(null),I=(0,o.sO)(null);function v(){if(!d)return;if(!s||!s.length)return c(!1),void l(!1);if(!r)return c(!0),void l(!0);const{offsetHeight:e,scrollHeight:n,scrollTop:a}=t.current,o=Math.round(n-a-e),u=o<=1;c(i?!u:!(o<=50)),l(!u)}const{observe:y}=(0,Jt.S1)({rootRef:t,margin:a.gZ},(e=>{if(!g||!h)return;if(s[0]>=a.AE)return;const n=e.find((({isIntersecting:e})=>e));if(!n)return;const{target:o}=n;"backwards-trigger"===o.className?((0,Xt.Z)(t.current),h()):"forwards-trigger"===o.className&&((0,Xt.Z)(t.current),g())}));(0,Jt._N)(p,y),(0,Jt._N)(f,y);const{observe:Z,freeze:P,unfreeze:w}=(0,Jt.S1)({rootRef:t,margin:100},v);(0,Jt._N)(I,Z);const{observe:b,freeze:M,unfreeze:S}=(0,Jt.S1)({rootRef:t,margin:1},v);return(0,Jt._N)(I,b),(0,de.Z)((()=>{d&&v()}),[d]),(0,de.Z)((()=>{P(),M(),setTimeout((()=>{S(),w()}),250)}),[s]),{backwardsTriggerRef:p,forwardsTriggerRef:f,fabTriggerRef:I}}(I,d,e,s,r,b,M,v),L=(0,Ze.Z)(),A=o.ZP.createElement("div",{className:(0,ne.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,L("UnreadMessages"))),O=w?0:t.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let U=0;const F=t.map(((e,t,s)=>{const n=e.senderGroups.map(((e,n,a)=>{if(1===e.length&&!zt(e[0])&&(0,l.Lo)(e[0])){const r=e[0],i=n===a.length-1&&t===s.length-1;return(0,g.oA)([r.id===h.current&&A,o.ZP.createElement(fs,{key:r.id,message:r,observeIntersection:k,appearanceOrder:O-++U,isLastInList:i})])}let r;return(0,g.xH)(e.map(((d,m)=>{const p=zt(d)?d.mainMessage:d,v=zt(d)?d:void 0,P=(0,l.B4)(p),C=zt(d),w=e[m+1];p.previousLocalId&&u.current===`message${p.previousLocalId}`&&(u.current=`message${p.id}`);const b=!C&&p.groupedId?p.groupedId:void 0,M=w&&!zt(w)?w.groupedId:void 0,S={isFirstInGroup:0===m,isLastInGroup:m===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==r),isLastInDocumentGroup:Boolean(b&&b!==M),isLastInList:m===e.length-1&&n===a.length-1&&t===s.length-1};r=b;const T=(0,l.KK)(p),N="scheduled"!==I?T:`${p.date}_${T}`;return(0,g.oA)([p.id===h.current&&A,o.ZP.createElement(gn,{key:N,message:p,observeIntersectionForBottom:k,observeIntersectionForMedia:E,observeIntersectionForAnimatedStickers:R,album:v,noAvatars:c,withAvatar:S.isLastInGroup&&i&&!P&&!(p.id===y),withSenderName:S.isFirstInGroup&&i&&!P,threadId:f,messageListType:I,noComments:!1===Z,appearanceOrder:O-++U,isFirstInGroup:S.isFirstInGroup,isLastInGroup:S.isLastInGroup,isFirstInDocumentGroup:S.isFirstInDocumentGroup,isLastInDocumentGroup:S.isLastInDocumentGroup,isLastInList:S.isLastInList}),p.id===y&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,L("DiscussionStarted")))])})))}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Wt.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,ne.Z)("sticky-date",!P&&"interactive"),key:"date-header",onMouseDown:Wt.q,onClick:P?void 0:()=>S({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},P&&e.originalDate===a.t4&&L("MessageScheduledUntilOnline"),P&&e.originalDate!==a.t4&&L("MessageScheduledOn",(0,N.j1)(L,e.datetime,void 0,!0)),!P&&(0,N.j1)(L,e.datetime))),(0,g.xH)(n))}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:T,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(F),o.ZP.createElement("div",{ref:B,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:x,key:"fab-trigger",className:"fab-trigger"}))}));var fn=s(3547);const In=(0,o.X$)((0,n.c$)(((e,{userId:t})=>{const{stickers:s}=e.stickers.greeting,n=(0,l.db)(t)+(0,l.db)(e.currentUserId),a=null!=s&&s.length?s[n%s.length]:void 0,o=(0,i.Z1)(e,t);return o?{sticker:a,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState}:{}}),((e,t)=>(0,g.ei)(t,["loadGreetingStickers","sendMessage","markMessageListRead"])))((({sticker:e,connectionState:t,lastUnreadMessageId:s,loadGreetingStickers:n,sendMessage:a,markMessageListRead:r})=>{const i=(0,Ze.Z)(),c=(0,o.sO)(null),{observe:l}=(0,Jt.S1)({rootRef:c,debounceMs:200});(0,o.d4)((()=>{e||"connectionStateReady"!==t||n()}),[t,n,e]),(0,o.d4)((()=>{"connectionStateReady"===t&&s&&r({maxId:s})}),[t,r,s]);const d=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},a({sticker:e})}),[a]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:c},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},i("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},i("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},e&&o.ZP.createElement(fn.Z,{sticker:e,onClick:d,clickArg:e,observeIntersection:l,size:160,className:"large"}))))}))),vn=(0,o.X$)((({isChatWithSelf:e,type:t,isGroupChatJustCreated:s})=>{const n=(0,Ze.Z)();return"scheduled"===t?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(n):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")))))}(n):s?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},o.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),o.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),o.ZP.createElement("ul",{className:"list-checkmarks"},o.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(n):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,n("NoMessages")))})),yn=(0,C.Ds)((e=>e()),200,!1),Zn=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,type:n})=>{const a=(0,i.Z1)(e,t);if(!a)return{};const o=(0,i.$W)(e,t,s,n),r="scheduled"===n?(0,i.Fn)(e,t):(0,i.Zw)(e,t),c=(0,i.qS)(e,t,s);if(s!==u._f&&!(r&&c&&r[c]))return{};const{isRestricted:d,restrictionReason:m,lastMessage:h}=a,g=(0,i.G$)(e,t),p=s===u._f&&!o&&!a.unreadCount&&!g&&h&&!h.groupedId,f=(0,i.IK)(e,t);let I;return(0,i.pk)(e,t)&&(I=f.fullInfo?f.fullInfo.botDescription||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:d,restrictionReason:m,isChannelChat:(0,l.eA)(a),isGroupChat:(0,l.Bf)(a),isCreator:a.isCreator,isChatWithSelf:(0,i.FM)(e,t),isRepliesChat:(0,l.pK)(t),isBot:Boolean(f),messageIds:o,messagesById:r,firstUnreadId:(0,i.It)(e,t,s),isViewportNewest:"thread"!==n||(0,i.b9)(e,t,s),threadFirstMessageId:(0,i.yZ)(e,t,s),focusingId:g,isSelectModeActive:(0,i.CA)(e),botDescription:I,threadTopMessageId:c,hasLinkedChat:a.fullInfo&&"linkedChatId"in a.fullInfo?Boolean(a.fullInfo.linkedChatId):void 0,...p&&{lastMessage:h}}}),((e,t)=>(0,g.ei)(t,["loadViewportMessages","setScrollOffset","openHistoryCalendar"])))((({chatId:e,threadId:t,type:s,hasTools:r,onFabToggle:c,onNotchToggle:d,isChatLoaded:u,isChannelChat:h,isGroupChat:p,canPost:f,isReady:I,isChatWithSelf:v,isRepliesChat:y,isCreator:Z,isBot:P,messageIds:w,messagesById:b,firstUnreadId:M,isViewportNewest:S,threadFirstMessageId:E,isRestricted:k,restrictionReason:R,focusingId:T,isSelectModeActive:N,loadViewportMessages:B,setScrollOffset:x,lastMessage:L,botDescription:A,threadTopMessageId:O,hasLinkedChat:U,withBottomShift:F,openHistoryCalendar:$})=>{var D,Q,q,G,j,H;const _=(0,o.sO)(null),z=(0,o.sO)("thread"===s&&(0,i.Vt)((0,n.Rd)(),e,t)||0),V=(0,o.sO)(),W=(0,o.sO)(),Y=(0,o.sO)(),X=(0,o.sO)(),K=(0,o.sO)(),J=(0,o.sO)(),ee=(0,o.sO)(!1),te=(0,o.sO)(Boolean(L)),[ae,oe]=(0,o.eJ)(),re=Boolean(w);(0,de.Z)((()=>{re&&(0,C.R3)((()=>{te.current=!1}))}),[re]),(0,de.Z)((()=>{X.current=M}),[M]),(0,de.Z)((()=>{re&&(K.current=X.current)}),[re]),(0,de.Z)((()=>{J.current=T}),[T]);const ie=(0,o.Ye)((()=>{if(!w||!b)return;const e=!O||w[0]&&E!==w[0]?w:[O,...w];if(!e.length)return;const t=e.map((e=>b[e])).filter(Boolean);return Vt((0,g.Xo)(t,["date","id"]),K.current)}),[w,b,E,O]),ce=(0,o.Ye)((()=>{if("thread"===s)return(0,C.Ds)((()=>B({direction:m.Uq.Around})),1e3,!0,!1)}),[B,w]),{isScrolled:le,updateStickyDates:ue}=function(){const[e,t]=(0,Ie.Z)(!1),s=(0,Yt.Z)(1e3,!1);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,n)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,C.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),s((()=>{(0,C.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const s=function(e,t){const s=e.querySelectorAll(".sticky-date"),n=e.scrollTop;return Array.from(s).find((e=>{const{offsetTop:s,offsetHeight:a}=e,o=s-n;return-a<=o&&o<=(t?60:10)}))}(e,n);s&&s.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,s])}}(),me=(0,o.I4)((()=>{if(ee.current)return void(ee.current=!1);const n=_.current;J.current||ue(n,r),yn((()=>{(0,C.T2)((()=>{n.parentElement&&(z.current=n.scrollHeight-n.scrollTop,"thread"===s&&x({chatId:e,threadId:t,scrollOffset:z.current}))}))}))}),[ue,r,s,x,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(_.current),()=>{e.disconnect()}}),[]);const{height:he}=ot();(0,o.d4)((()=>{I&&(_.current.dataset.normalHeight=String(_.current.offsetHeight))}),[he,I,f]),(0,o.d4)((()=>{if(!ce||!u||k||T)return;if(w&&w[w.length-1]>=a.AE)return;const e=_.current;(!w||w.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ce()}),[u,w,ce,T,k]),(0,de.Z)((()=>{if(!w||!Y.current||!I)return;const e=Y.current.filter((e=>w.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(V.current=t.id,W.current=t.getBoundingClientRect().top)}),[w,S,ae,r,I]),(0,Ht.Z)((([e,t,s])=>{const n=_.current;if(Y.current=Array.from(n.querySelectorAll(".message-list-item")),!n.offsetParent)return;const o=w&&e&&w[w.length-1]!==e[e.length-1],i=(null==w?void 0:w[0])!==(null==e?void 0:e[0])&&(null==w?void 0:w.length)===a.hT/2+1,c=o&&!i,l=w&&J.current===w[w.length-1],d=S&&c&&w&&w.length<a.hT/2&&!n.parentElement.classList.contains("force-messages-scroll")&&n.firstElementChild.clientHeight<=2*n.offsetHeight;d&&(n.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{n.parentElement&&n.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=n,g=z.current,p=Y.current[Y.current.length-1];let f=g-(s||h);c&&(f-=p?p.offsetHeight:0);const I=S&&t&&f<=20;let v;if(c&&I&&!l&&(p&&(0,C.T2)((()=>{(0,Kt.Z)(n,p,"end",20)})),v=m-h,z.current=Math.max(Math.ceil(m-v),h),!d))return;const y=void 0!==s&&s!==ae,Z=V.current&&document.getElementById(V.current),P=!Z&&K.current&&n.querySelector(".unread-divider");if(I&&y){if((0,Kt.N)())return;v=m-h}else v=Z?u+(Z.getBoundingClientRect().top-(W.current||0)):P?Math.min(P.offsetTop-(r?60:10),m-g):m-g;(0,Xt.Z)(n,Math.ceil(v)),J.current||(ee.current=!0,(0,C.T2)((()=>{ee.current=!1}))),z.current=Math.max(Math.ceil(m-v),h)}),[w,S,ae,r]),(0,_t.Z)((([e])=>{void 0!==e&&(0,se.YW)(200+a.fK)}),[N]);const ge=(0,Ze.Z)(),pe=Boolean(e&&(0,l.YC)(e)),fe=Boolean(!pe&&!h||v||y),ve=Boolean(!fe||h),ye=(0,l.YC)(e)&&!v&&!P&&(!ie&&!L&&w&&(!Y.current||0===Y.current.length)||1===(null==w?void 0:w.length)&&"contactSignUp"===(null==b||null===(D=b[w[0]])||void 0===D||null===(Q=D.content.action)||void 0===Q?void 0:Q.type)||"contactSignUp"===(null==L||null===(q=L.content)||void 0===q||null===(G=q.action)||void 0===G?void 0:G.type)),Pe=p&&Z&&1===(null==w?void 0:w.length)&&"chatCreate"===(null==b||null===(j=b[w[0]])||void 0===j||null===(H=j.content.action)||void 0===H?void 0:H.type),Ce=(0,ne.Z)("MessageList custom-scroll",ve&&"no-avatars",!f&&"no-composer","pinned"===s&&"type-pinned",F&&"with-bottom-shift",N&&"select-mode-active",le&&"scrolled",!I&&"is-animating");return o.ZP.createElement("div",{ref:_,className:Ce,onScroll:me,onMouseDown:Wt.q},k?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,R?R.text:"This is a private "+(h?"channel":"chat"))):A?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,vt.Z)(ge(A),["br","emoji","links"]))):ye?o.ZP.createElement(In,{userId:e}):!w||ie&&!Pe?w&&ie||L?o.ZP.createElement(pn,{messageIds:w||[L.id],messageGroups:ie||Vt([L]),isViewportNewest:Boolean(S),isUnread:Boolean(M),withUsers:fe,noAvatars:ve,containerRef:_,anchorIdRef:V,memoUnreadDividerBeforeIdRef:K,memoFirstUnreadIdRef:X,threadId:t,type:s,isReady:I,threadTopMessageId:O,hasLinkedChat:U,isSchedule:!!ie&&"scheduled"===s,noAppearanceAnimation:!ie||!te.current,onFabToggle:c,onNotchToggle:d,openHistoryCalendar:$}):o.ZP.createElement($e.Z,{color:"white"}):o.ZP.createElement(vn,{chatId:e,type:s,isChatWithSelf:v,isGroupChatJustCreated:Pe}))}))),Pn=(0,o.X$)((0,n.c$)((e=>{const t=(0,i.Bt)(e);if(!t)return{};const{chatId:s,threadId:n,type:a}=t,o=(0,i.Z1)(e,s);return{messageListType:a,unreadCount:o&&n===u._f&&"thread"===a?o.unreadCount:void 0}}),((e,t)=>(0,g.ei)(t,["focusNextReply"])))((({isShown:e,canPost:t,messageListType:s,unreadCount:n,withExtraShift:a,focusNextReply:r})=>{const i=(0,Ze.Z)(),c=(0,o.sO)(null),l=(0,o.I4)((()=>{if(e)if("thread"===s)r();else{const e=c.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),s=t[t.length-1];if(!s)return;(0,Kt.Z)(e,s,"end",20)}}),[e,s,r]),d=(0,ne.Z)("ScrollDownButton",e&&"revealed",!t&&"no-composer",a&&"with-extra-shift");return o.ZP.createElement("div",{ref:c,className:d},o.ZP.createElement("div",{className:"ScrollDownButton-inner"},o.ZP.createElement(be.Z,{color:"secondary",round:!0,onClick:l,ariaLabel:i("AccDescrPageDown")},o.ZP.createElement("i",{className:"icon-arrow-down"})),Boolean(n)&&o.ZP.createElement("div",{className:"unread-count"},(0,mt.bi)(n))))})));var Cn=s(5723);const wn=1280,bn=/\.[^/.]+$/;async function Mn(e,t,s,n){const o=URL.createObjectURL(t),{type:r,size:i}=t;let c,l;if(a.oG.has(r))if(s){const t=await(0,at.pt)(o),{width:s,height:a}=t;if(s>wn||a>wn||"image/jpeg"!==r){const t=await Bt(o,wn/Math.max(s,a),"image/jpeg");return URL.revokeObjectURL(o),Mn(e,await(0,at.gm)(t),!0,n)}"image/jpeg"===r&&(e=e.replace(bn,".jpg")),c={width:s,height:a}}else l=o;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:s}=await(0,at.jj)(o);c={width:e,height:t,duration:s},l=await(0,at.ud)(o)}return{blobUrl:o,filename:e,mimeType:r,size:i,quick:c,previewBlobUrl:l,...n}}var Sn=s(6391);let En;function kn(e){En.focus(),e.focus()}h.cj&&(En=document.createElement("input"),En.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(En));const Rn={encoderPath:s.p+"c0155344d336103c2b6a0b28cc510750.js",reuseWorker:!0},Tn={type:"audio/ogg"};let Nn,Bn,xn;async function Ln(){return Nn||(Nn=s.e(161).then(s.t.bind(s,1161,23)),Bn=(await Nn).default,xn=new Bn(Rn)),Nn}async function An(e){await async function(){await Ln(),await xn.start()}();const t=Date.now();let s;const n=[],a=[];xn.ondataavailable=e=>{n.push(e)};const o=function(t,s){const n=t.sourceNode,o=n.context.createAnalyser();o.fftSize=64,n.connect(o);const r=o.frequencyBinCount,i=new Uint8Array(r);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(i);const s=i.reduce(((e,t)=>e+t),0)/r/255;(t=>{a.push(255*t),e(t)})(s<.1?0:s),requestAnimationFrame(t)}(),()=>{c=!0}}(xn);return{stop:()=>new Promise(((e,r)=>{xn.onstop=()=>{e({blob:new Blob(n,Tn),duration:Math.round(((s||Date.now())-t)/1e3),waveform:a})},xn.onerror=r;const i=Math.max(0,t+1e3-Date.now());setTimeout((()=>{xn.stop(),o()}),i)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{xn.pause(),s=Date.now(),o()}),e)}}}const On=["image/png","image/jpeg","image/gif"];function Un(e){const{text:t,entities:s}=e||{};if(!t)return"";const n=(0,ns.H)(t,s,void 0,void 0,!0);return Array.isArray(n)?n.join(""):n}let Fn,$n;var Dn=s(4784),Qn=s(2400),qn=s(3575),Gn=s(2365);const jn=document.createElement("div"),Hn=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,_n=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i;const zn=(0,C.P2)((e=>e()),500,!0),Vn=/^[\w@]{1,32}\s?/i,Wn=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"DeleteMessageModal",!t);return s?o.ZP.createElement(s,e):void 0}));function Yn(){return(Yn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let Xn,Kn=!0;const Jn=(0,o.X$)((({onActivate:e,...t})=>{const s=(0,o.sO)(!1),n=(0,o.I4)((()=>{if(s.current=!0,Kn)return Kn=!1,void e();Xn&&(clearTimeout(Xn),Xn=void 0),Xn=window.setTimeout((()=>{s.current&&e()}),200)}),[e]),a=(0,o.I4)((()=>{s.current=!1}),[]);return o.ZP.createElement(be.Z,Yn({},t,{onMouseEnter:h.$b?void 0:n,onMouseLeave:h.$b?void 0:a,onClick:h.$b?e:void 0}))})),ea=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"AttachMenu",!t);return s?o.ZP.createElement(s,e):void 0})),ta=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"SymbolMenu",!t);return s?o.ZP.createElement(s,e):void 0})),sa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"InlineBotTooltip",!t);return s?o.ZP.createElement(s,e):void 0})),na=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"MentionTooltip",!t);return s?o.ZP.createElement(s,e):void 0})),aa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"CustomSendMenu",!t);return s?o.ZP.createElement(s,e):void 0})),oa=e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"StickerTooltip",!t);return s?o.ZP.createElement(s,e):void 0};var ra=s(9830);const ia=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"BotCommandTooltip",!t);return s?o.ZP.createElement(s,e):void 0}));var ca=s(6503);const la=(0,o.X$)((0,n.c$)(((e,{messageId:t})=>{const{chatId:s}=(0,i.Bt)(e)||{};return s?{message:(0,i.hj)(e,s,t)}:{}}),((e,t)=>(0,g.ei)(t,["clickInlineButton"])))((({isOpen:e,message:t,onClose:s,clickInlineButton:n})=>{const[a,r]=(0,ca.Z)(e,s),{isKeyboardSingleUse:i}=t||{},[c,l,d]=(0,Ie.Z)(!0),u=()=>{d(),s()};if((0,o.d4)((()=>{l()}),[l,t]),t&&t.keyboardButtons)return o.ZP.createElement(qe.Z,{isOpen:e||c,autoClose:i,positionX:"right",positionY:"bottom",onClose:u,className:"BotKeyboardMenu",onCloseAnimationEnd:u,onMouseEnter:h.$b?void 0:a,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(be.Z,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>n({button:e})},e.text))))))))})));var da=s(3616),ua=s(7891);const ma=(0,o.X$)((0,n.c$)((e=>{const{chatId:t,threadId:s,type:n}=(0,i.Bt)(e)||{};if(!t||!s||!n)return{};const{currentUserId:a,forwardMessages:{fromChatId:o,toChatId:r,messageIds:c}}=e,d=(0,i.Yy)(e,t,s),u="scheduled"===n?(0,i.wU)(e,t):(0,i._$)(e,t,s),m=e.settings.byKey.animationLevel>=1,h=r===t;let g,p;if(d?g=(0,i.hj)(e,t,d):u?g=(0,i.kK)(e,t,s,n):h&&1===c.length&&(g=(0,i.hj)(e,o,c[0])),d&&g){const{forwardInfo:s}=g,n=t===a;s&&(s.isChannelPost||n)&&(p=(0,i.cv)(e,g)),p||(p=(0,i.Ur)(e,g))}else h&&(p=(0,l.YC)(o)?(0,i.dy)(e,o):(0,i.Z1)(e,o));return{replyingToId:d,editingId:u,message:g,sender:p,shouldAnimate:m,forwardedMessagesCount:h?c.length:void 0}}),((e,t)=>(0,g.ei)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"])))((({replyingToId:e,editingId:t,message:s,sender:n,shouldAnimate:a,forwardedMessagesCount:r,setReplyingToId:i,setEditingId:c,focusMessage:l,exitForwardMode:d})=>{const u=Boolean((e||t)&&s||n&&r),m=(0,ua.Z)([r],r?300:void 0),{shouldRender:h,transitionClassNames:g}=(0,ie.Z)(m&&u,void 0,!a,void 0,!a),p=(0,o.I4)((()=>{e?i({messageId:void 0}):t?c({messageId:void 0}):r&&d()}),[e,t,r,i,c,d]);(0,o.d4)((()=>u?(0,pe.Z)(p):void 0),[u,p]);const f=(0,o.I4)((()=>{l({chatId:s.chatId,messageId:s.id})}),[l,s]),I=(0,ne.Z)("ComposerEmbeddedMessage",g),v=r&&r>1?`${r} forwarded messages`:void 0;if(h)return o.ZP.createElement("div",{className:I},o.ZP.createElement("div",null,o.ZP.createElement(be.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:p},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Is,{className:"inside-input",message:s,sender:n,customText:v,title:t?"Edit Message":void 0,onClick:f})))}))),ha=(0,o.X$)((e=>{const{attachments:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"AttachmentModal",!t.length);return s?o.ZP.createElement(s,e):void 0})),ga=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"BotCommandMenu",!t);return s?o.ZP.createElement(s,e):void 0})),pa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"PollModal",!t);return s?o.ZP.createElement(s,e):void 0})),fa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"DropArea",!t);return s?o.ZP.createElement(s,e):void 0})),Ia=new RegExp(a.FM,"i"),va=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s})=>{const n=(0,i.tV)(e,t,s);return{theme:(0,i.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:n}}),((e,t)=>(0,g.ei)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"])))((({chatId:e,threadId:t,messageText:s,disabled:n,webPagePreview:a,noWebPage:r,theme:i,loadWebPagePreview:c,clearWebPagePreview:l,toggleMessageWebPage:d})=>{const m=(0,o.Ye)((()=>{const{text:e,entities:t}=(0,f.Z)(s),n=t&&t.find((({type:e})=>e===u.Vv.TextUrl));if(n)return n.url;const a=e.match(Ia);return a?a[0]:void 0}),[s]);(0,o.d4)((()=>{m?c({text:m}):(l(),d({chatId:e,threadId:t}))}),[e,d,l,m,c,t]),(0,de.Z)((()=>{l(),d({chatId:e,threadId:t})}),[e]);const h=Boolean(a&&s.length&&!r&&!n),{shouldRender:g,transitionClassNames:p}=(0,ie.Z)(h),I=(0,ut.Z)(a,!0);if(!g||!I)return;const{photo:v,...y}=I,Z={content:{webPage:y}};return o.ZP.createElement("div",{className:(0,ne.Z)("WebPagePreview",p)},o.ZP.createElement("div",null,o.ZP.createElement(be.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{d({chatId:e,threadId:t,noWebPage:!0})}},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Ws,{message:Z,inPreview:!0,theme:i})))})));var ya=s(2898);const Za=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"CalendarModal",!t);return s?o.ZP.createElement(s,e):void 0}));var Pa;!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Pa||(Pa={}));const Ca=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{var o,r,c;const d=(0,i.Z1)(e,t),m=d&&(0,i.Dg)(e,d),h=t!==a.FV?(0,i.IK)(e,t):void 0,g=Boolean(h),p=(0,i.FM)(e,t),f=g&&(0,i.FT)(e,t),I=(0,i.qy)(e,t),{language:v,shouldSuggestStickers:y}=e.settings.byKey,Z=e.emojiKeywords[a.pR],P=v!==a.pR?e.emojiKeywords[v]:void 0,C=f?f.id:void 0,w=C?(0,i.hj)(e,t,C):void 0;return{editingMessage:(0,i.kK)(e,t,s,n),connectionState:e.connectionState,draft:(0,i.Ms)(e,t,s),chat:d,isChatWithBot:g,isChatWithSelf:p,canScheduleUntilOnline:Boolean(!p&&!g&&d&&m&&(0,l.YC)(t)&&(null===(o=(0,i.ss)(e,t))||void 0===o?void 0:o.wasOnline)),isRightColumnShown:(0,i.Jf)(e),isSelectModeActive:(0,i.CA)(e),withScheduledButton:s===u._f&&"thread"===n&&Boolean(null==I?void 0:I.length),shouldSchedule:"scheduled"===n,botKeyboardMessageId:C,botKeyboardPlaceholder:null==w?void 0:w.keyboardPlaceholder,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==d||null===(r=d.fullInfo)||void 0===r?void 0:r.members,topInlineBotIds:null===(c=e.topInlineBots)||void 0===c?void 0:c.userIds,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:y,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==Z?void 0:Z.keywords,emojiKeywords:null==P?void 0:P.keywords,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:d&&d.fullInfo&&d.fullInfo.botCommands,botCommands:h&&h.fullInfo?h.fullInfo.botCommands||!1:void 0}}),((e,t)=>(0,g.ei)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","loadScheduledHistory","openChat","addRecentEmoji","sendInlineBotResult"])))((({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:s,isReady:r,onDropHide:i,editingMessage:c,chatId:d,threadId:m,messageListType:g,draft:I,chat:v,connectionState:y,isChatWithBot:Z,isChatWithSelf:P,isRightColumnShown:w,isSelectModeActive:b,isForwarding:M,isPollModalOpen:S,botKeyboardMessageId:E,botKeyboardPlaceholder:k,withScheduledButton:R,stickersForEmoji:T,groupChatMembers:B,topInlineBotIds:x,currentUserId:L,usersById:A,lastSyncTime:O,contentToBeScheduled:U,shouldSuggestStickers:F,baseEmojiKeywords:$,emojiKeywords:D,serverTimeOffset:Q,recentEmojis:q,inlineBots:G,isInlineBotLoading:j,botCommands:H,chatBotCommands:_,sendMessage:z,editMessage:V,saveDraft:W,clearDraft:Y,showDialog:X,setStickerSearchQuery:K,setGifSearchQuery:J,forwardMessages:ee,openPollModal:te,closePollModal:se,loadScheduledHistory:ae,openChat:oe,addRecentEmoji:ie,sendInlineBotResult:de})=>{const ue=(0,Ze.Z)(),me=(0,o.sO)(null),[he,ge]=(0,o.eJ)(""),fe=(0,o.sO)(),ve=(0,it.Z)(e),[ye,Pe,Ce]=(0,Ie.Z)(),[we,Me]=(0,o.eJ)(),{width:Se}=re.Z.get(),Ee=(0,o.sO)(he);(0,o.d4)((()=>{Ee.current=he}),[he]),(0,o.d4)((()=>{fe.current=void 0}),[d]),(0,o.d4)((()=>{d&&O&&m===u._f&&r&&ae({chatId:d})}),[r,d,ae,O,m]),(0,o.bt)((()=>{me.current&&(me.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&&(Me(U),Pe())}),[U,Pe]);const[ke,Re]=(0,o.eJ)([]),[Ne,Be,xe]=(0,Ie.Z)(),[Le,Ae,Oe]=(0,Ie.Z)(),[Ue,Fe,$e]=(0,Ie.Z)(),[De,Qe,qe]=(0,Ie.Z)(),[Ge,je,He]=(0,Ie.Z)(),[_e,ze]=(0,Ie.Z)(),[Ve,We,Ye]=(0,Ie.Z)(),{startRecordingVoice:Xe,stopRecordingVoice:Ke,pauseRecordingVoice:Je,activeVoiceRecording:et,currentRecordTime:st,recordButtonRef:nt,startRecordTimeRef:at}=(()=>{const e=(0,o.sO)(null),[t,s]=(0,o.eJ)(),n=(0,o.sO)(),[a,r]=(0,o.eJ)();(0,o.d4)((()=>{h.s$&&h.mh&&Ln()}),[]);const i=(0,o.I4)((async()=>{try{const{stop:t,pause:a}=await An((t=>{e.current&&(n.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),r(Date.now()))}));n.current=Date.now(),r(Date.now()),s({stop:t,pause:a})}catch(e){console.error(e)}}),[]),c=(0,o.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),l=(0,o.I4)((()=>{if(t){s(void 0),n.current=void 0,r(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,pe.Z)(l):void 0),[t,l]),{startRecordingVoice:i,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:n}})(),ot=c?Pa.Edit:!h.mh||et||he&&!ke.length||M?Pa.Send:Pa.Record,rt=!t,{isMentionTooltipOpen:ct,closeMentionTooltip:lt,insertMention:dt,mentionFilteredUsers:ut}=(0,Gn.Z)(!ke.length,he,ge,void 0,B,x,L,A),{isOpen:mt,id:ht,isGallery:gt,switchPm:pt,results:ft,closeTooltip:It,help:yt,loadMore:Zt}=function(e,t,s,a){const[r,i,c]=(0,Ie.Z)(),l=function(e){return jn.innerHTML=e.replace(/<br>/g,"\n"),jn.innerText}(s),{queryInlineBot:d,resetInlineBot:u}=(0,n.uC)(),{username:m,query:h,canShowHelp:g}=function(e){const t=e.match(Hn);return t?{username:t[1],query:t[2],canShowHelp:""===t[2]&&!e.match(_n)}:{username:"",query:"",canShowHelp:!1}}(l),p=m.toLowerCase(),f=(0,it.Z)(h),I=(0,it.Z)(m),v=null==a?void 0:a[p],{id:y,switchPm:Z,offset:P,results:C,isGallery:w,help:b}=v||{};(0,o.d4)((()=>{f!==h&&c()}),[f,h,c]),(0,o.d4)((()=>{e&&p&&t&&d({chatId:t,username:p,query:h})}),[h,e,d,t,p]);const M=(0,o.I4)((()=>{d({chatId:t,username:p,query:h,offset:P})}),[P,t,h,d,p]);return(0,o.d4)((()=>{e&&y&&(Z||null!=C&&C.length)?i():c()}),[y,e,i,C,Z,c]),I!==m&&u({username:I}),{isOpen:r,closeTooltip:c,loadMore:M,username:m,id:y,isGallery:w,switchPm:Z,results:C,help:g&&b?`@${m} ${b}`:void 0}}(Boolean(!ke.length&&O),d,he,G),{isOpen:Pt,close:Ct,filteredBotCommands:wt}=function(e,t,s,n){const[a,r,i]=(0,Ie.Z)(),[c,l]=(0,o.eJ)(),d=(0,o.I4)((e=>{s||n?zn((()=>{const t=(s||n||[]).filter((({command:t})=>!e||t.includes(e)));l(t&&t.length?t:void 0)})):l(void 0)}),[s,n]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,Qn._)(t.substr(1)).match(Vn);d(e?e[0]:"")}else i();else i()}),[d,t,e,i]),(0,o.d4)((()=>{c&&c.length?r():i()}),[c,r,i]),{isOpen:a,close:i,filteredBotCommands:c}}(Boolean(H&&H.length||_&&_.length),he,H,_),{isContextMenuOpen:bt,handleContextMenu:Mt,handleContextMenuClose:St,handleContextMenuHide:Et}=(0,ss.Z)(nt,!(ot===Pa.Send&&rt)),kt=(0,o.Ye)((()=>(0,l.H5)(v,Z)),[v,Z]),Rt=v&&(0,l.Nl)(v),Tt=(0,l.Hd)(v),{isStickerTooltipOpen:Nt,closeStickerTooltip:Bt}=function(e,t,s,a=!1){const r=(0,o.Ye)((()=>(0,Qn._)(t).trim()),[t]),{loadStickersForEmoji:i,clearStickersForEmoji:c}=(0,n.uC)(),l=h.op&&1===(0,Dn.Z)(r)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),d=Boolean(s)&&l;return(0,o.d4)((()=>{a||(e&&l?i({emoji:r}):!d&&l||c())}),[t,l,c,i,e,a]),{isStickerTooltipOpen:d,closeStickerTooltip:c}}(Boolean(F&&kt.canSendStickers&&!ke.length),he,T,!r),{isEmojiTooltipOpen:xt,closeEmojiTooltip:Lt,filteredEmojis:At,insertEmoji:Ot}=(0,qn.Z)(Boolean(F&&kt.canSendStickers&&!ke.length),he,q,void 0,ge,$,D,!r),Ut=(0,o.I4)(((e,t=a.R2)=>{const s=window.getSelection(),n=document.getElementById(t),o=(0,vt.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(s.rangeCount){const e=s.getRangeAt(0);if((0,Sn.R)(e,t))return function(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const s=t.getRangeAt(0);s.deleteContents();const n=s.createContextualFragment(e),a=n.lastChild;s.insertNode(n),a?(s.setStartAfter(a),s.setEndAfter(a)):s.collapse(!1),t.removeAllRanges(),t.addRange(s)}}(o),void n.dispatchEvent(new Event("input",{bubbles:!0}))}ge(`${Ee.current}${o}`),requestAnimationFrame((()=>{(0,Cn.Z)(n)}))}),[]),Ft=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Sn.R)(t,a.R2))return void document.execCommand("delete",!1)}ge(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 s=t.lastChild;if(s.lastChild)for(;s.lastChild;)s=s.lastChild;const n=s.textContent.length,a=document.createRange(),o=window.getSelection();a.setStart(s,n),a.setEnd(s,n),o.removeAllRanges(),o.addRange(a),document.execCommand("delete",!1);const r=t.innerHTML;return document.body.removeChild(t),r}(Ee.current))}),[]),$t=(0,o.I4)(((e=!1)=>{e||ge(""),Re([]),Bt(),Ce(),Me(void 0),lt(),Lt(),h.wB?setTimeout((()=>qe()),350):qe()}),[Bt,Ce,lt,Lt,qe]),Dt=(0,o.sO)();Dt.current=Ke,(0,o.d4)((()=>()=>{Dt.current(),$t()}),[d,$t,Dt]);const Qt=((e,t,s,n,r,i)=>((0,o.d4)((()=>{s?(t(Un(s.content.text)),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Cn.Z)(e,!0)}))):t("")}),[s,t]),(0,o.I4)((()=>{const{text:t,entities:a}=(0,f.Z)(e.current);s&&(t||(0,l.u8)(s)?(i({messageId:s.id,text:t,entities:a}),n()):r())}),[i,s,e,r,n])))(Ee,ge,c,$t,je,V);((e,t,s,n,r,i,c,l,d)=>{const u=(0,o.I4)(((e,t)=>{r.current.length&&!c?l({chatId:e,threadId:t,draft:(0,f.Z)(r.current)}):d({chatId:e,threadId:t})}),[d,c,r,l]),m=(0,o.Ye)((()=>(0,C.Ds)((e=>e()),a.r_,!1)),[t]),g=(0,it.Z)(t),p=(0,it.Z)(s);(0,o.d4)((()=>(Fn=t,$n=s,()=>{Fn=void 0,$n=void 0,u(t,s)})),[t,s,u]),(0,o.d4)((()=>{t===g&&s===p||e&&(i(Un(e)),h.$b||requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Cn.Z)(e,!0)})))}),[t,s,e,i,u,g,p]);const I=(0,it.Z)(n);(0,o.d4)((()=>{t&&s&&g===t&&p===s&&I!==n&&(n.length?m((()=>{Fn===t&&$n===s&&u(t,s)})):u(t,s))}),[t,n,g,I,p,m,s,u]);const v=(0,o.I4)((()=>{t&&s&&u(t,s)}),[t,s,u]);(0,ce.Z)(v),le(v)})(I,d,m,he,Ee,ge,c,W,Y),((e,t,s)=>{(0,o.d4)((()=>{async function n(n){if(!n.clipboardData)return;const o=document.activeElement;if(o&&![a.R2,a.nY].includes(o.id))return;const{items:r}=n.clipboardData,i=Array.from(r).find((e=>On.includes(e.type)&&"file"===e.kind)),c=i&&i.getAsFile(),l=n.clipboardData.getData("text").substring(0,4096);if(n.preventDefault(),c||l){if(c&&!s){const e=await Mn(c.name,c,!0);t((t=>[...t,e]))}l&&e(l,null==o?void 0:o.id)}}return document.addEventListener("paste",n,!1),()=>{document.removeEventListener("paste",n,!1)}}),[e,s,t])})(Ut,Re,c);const qt=(0,o.I4)((async(e,t)=>{Re(await Promise.all(e.map((e=>Mn(e.name,e,t)))))}),[]),Gt=(0,o.I4)((async(e,t)=>{Re([...ke,...await Promise.all(e.map((e=>Mn(e.name,e,t))))])}),[ke]),jt=(0,o.I4)((()=>{Re([])}),[]),Ht=(0,o.I4)((async(e=!1,t)=>{if("connectionStateReady"!==y)return;let s=ke;if(et){const e=await Ke();if(e){const{blob:t,duration:n,waveform:a}=e;s=[await Mn("wonderful-voice-message.ogg",t,!1,{voice:{duration:n,waveform:a}})]}}const{text:n,entities:o}=(0,f.Z)(Ee.current);if(!s.length&&!n&&!M)return;const r=s.length?1024:4096;if((null==n?void 0:n.length)>r){const e=n.length-r;return void X({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const i=document.getElementById(a.R2);if(s.length||n){if(Tt&&!Rt){const e=(0,p.b)(Q),t=fe.current&&Math.floor(e-fe.current),s=Tt.nextSendDate&&Tt.nextSendDate>e;if(t&&t<Tt.seconds||s){const n=s?Tt.nextSendDate-e:Tt.seconds-t;return X({data:{message:ue("SlowModeHint",(0,N.k9)(n)),isSlowMode:!0,hasErrorKey:!1}}),void i.blur()}}z({text:n,entities:o,attachments:s,scheduledAt:t,isSilent:e})}M&&ee({scheduledAt:t,isSilent:e}),fe.current=(0,p.b)(Q),Y({chatId:d,localOnly:!0}),h.cj&&i===document.activeElement&&kn(i),requestAnimationFrame((()=>{$t()}))}),[y,ke,et,M,Y,d,Q,$t,Ke,X,Tt,Rt,z,ee,ue]),_t=(0,o.I4)((()=>{qe(),Ae()}),[qe,Ae]),zt=(0,o.I4)((()=>{Oe(),Qe()}),[Oe,Qe]),Vt=(0,o.I4)(((e,s=!1)=>{e={...e,isPreloadedGlobally:!0},t?(Me({sticker:e}),Pe()):(z({sticker:e}),requestAnimationFrame((()=>{$t(s)})))}),[t,Pe,z,$t]),Wt=(0,o.I4)((e=>{t?(Me({gif:e}),Pe()):(z({gif:e}),requestAnimationFrame((()=>{$t(!0)})))}),[t,Pe,z,$t]),Yt=(0,o.I4)((e=>{if("connectionStateReady"!==y)return;de({id:e.id,queryId:e.queryId});const t=document.getElementById(a.R2);h.cj&&t===document.activeElement&&kn(t),Y({chatId:d,localOnly:!0}),requestAnimationFrame((()=>{$t()}))}),[d,Y,y,$t,de]),Xt=(0,o.I4)((()=>{Y({chatId:d,localOnly:!0}),requestAnimationFrame((()=>{$t()}))}),[d,Y,$t]),Kt=(0,o.I4)((e=>{t?(Me({poll:e}),se(),Pe()):(z({poll:e}),se())}),[se,Pe,z,t]),Jt=(0,o.I4)((()=>{t?(Me({isSilent:!0}),Pe()):Ht(!0)}),[Ht,Pe,t]),es=(0,o.I4)(((e,t=!1)=>{const{isSilent:s,...n}=we||{},a=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:Q);we&&0!==Object.keys(n).length?(z({...we,scheduledAt:a}),requestAnimationFrame((()=>{$t()}))):Ht(!!s,a),Ce()}),[Ce,Ht,$t,we,z,Q]),ts=(0,o.I4)((()=>{es(new Date(1e3*a.t4),!0)}),[es]),ns=(0,o.I4)((()=>{Ce(),Me(void 0)}),[Ce]),as=(0,o.I4)((e=>{"stickers"===e?(K({query:""}),J({query:void 0})):(J({query:""}),K({query:void 0}))}),[K,J]),os=(0,o.I4)((()=>{const e=document.getElementById(a.R2);h.wB&&e===document.activeElement?(e.blur(),setTimeout((()=>{Oe(),Qe()}),100)):Qe()}),[Qe,Oe]),rs=(0,o.I4)((()=>{oe({id:d,threadId:m,type:"scheduled"})}),[oe,d,m]);(0,o.d4)((()=>{w&&h.wB&&qe()}),[w,qe]),(0,o.d4)((()=>{r&&(b?We():setTimeout((()=>{Ye()}),200))}),[b,Ye,We,r]);const is=(0,o.I4)((()=>{switch(ot){case Pa.Send:t?(et&&Je(),Pe()):Ht();break;case Pa.Record:Xe();break;case Pa.Edit:Qt()}}),[ot,t,Xe,Qt,et,Pe,Je,Ht]),cs=ot===Pa.Record&&!kt.canAttachMedia,ls=(0,it.Z)(c,!0),ds=c||ls,us=new Date;us.setSeconds(0),us.setMilliseconds(0);const ms=new Date;ms.setFullYear(ms.getFullYear()+1);let hs="SendMessage";switch(ot){case Pa.Edit:hs="Save edited message";break;case Pa.Record:hs=cs?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const gs=(0,ne.Z)("Composer",!b&&"shown",Ve&&"hover-disabled"),ps=(0,ne.Z)("mobile-symbol-menu-button",!r&&"not-ready",_e?De&&"menu-opened":De&&"is-loading"),fs=ot===Pa.Edit?Qt:t?Pe:Ht;return o.ZP.createElement("div",{className:gs},kt.canAttachMedia&&r&&o.ZP.createElement(ya.Z,{containerId:"#middle-column-portals"},o.ZP.createElement(fa,{isOpen:e!==tt.t.None,withQuick:[e,ve].includes(tt.t.QuickFile),onHide:i,onFileSelect:qt})),o.ZP.createElement(ha,{chatId:d,threadId:m,attachments:ke,caption:ke.length?he:"",groupChatMembers:B,currentUserId:L,usersById:A,recentEmojis:q,isReady:r,onCaptionUpdate:ge,baseEmojiKeywords:$,emojiKeywords:D,addRecentEmoji:ie,onSend:t?Pe:Ht,onFileAppend:Gt,onClear:jt}),o.ZP.createElement(pa,{isOpen:Boolean(S),onClear:se,onSend:Kt}),ds&&o.ZP.createElement(Wn,{isOpen:Ge,isSchedule:"scheduled"===g,onClose:He,message:ds}),o.ZP.createElement(na,{isOpen:ct,onClose:lt,onInsertUserName:dt,filteredUsers:ut,usersById:A}),o.ZP.createElement(sa,{isOpen:mt,botId:ht,allowedAttachmentOptions:kt,isGallery:gt,inlineBotResults:ft,switchPm:pt,onSelectResult:Yt,loadMore:Zt,onClose:It}),o.ZP.createElement(ia,{isOpen:Pt,withUsername:Boolean(_),botCommands:wt,onClick:Xt,onClose:Ct}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:me}),o.ZP.createElement(ma,null),o.ZP.createElement(va,{chatId:d,threadId:m,messageText:ke.length?"":he,disabled:!kt.canAttachEmbedLinks}),o.ZP.createElement("div",{className:"message-input-wrapper"},Z&&!1!==H&&!et&&!c&&o.ZP.createElement(Jn,{className:(0,ne.Z)("bot-commands",Le&&"activated"),round:!0,disabled:void 0===H,color:"translucent",onActivate:_t,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),h.wB?o.ZP.createElement(be.Z,{className:ps,round:!0,color:"translucent",onClick:De?qe:os,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),De&&!_e&&o.ZP.createElement(Te.Z,{color:"gray"})):o.ZP.createElement(Jn,{className:De?"activated":"",round:!0,color:"translucent",onActivate:zt,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(da.Z,{id:"message-input-text",chatId:d,threadId:m,html:ke.length?"":he,placeholder:et&&Se<=600?"":k||ue("Message"),forcedPlaceholder:yt,canAutoFocus:r&&!ke.length,shouldSuppressFocus:h.wB&&De,shouldSuppressTextFormatter:xt||ct||mt,onUpdate:ge,onSend:fs,onSuppressedFocus:qe}),j&&Boolean(ht)&&o.ZP.createElement(Te.Z,{color:"gray"}),R&&o.ZP.createElement(be.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:rs,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),E&&!et&&!c&&o.ZP.createElement(Jn,{className:Ne?"activated":"",round:!0,color:"translucent",onActivate:Be,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),!et&&!c&&o.ZP.createElement(Jn,{className:Ue?"activated":"",round:!0,color:"translucent",onActivate:Fe,ariaLabel:"Add an attachment"},o.ZP.createElement("i",{className:"icon-attach"})),et&&st&&o.ZP.createElement("span",{className:"recording-state"},(0,N.rM)(st-at.current)),o.ZP.createElement(oa,{isOpen:Nt,onStickerSelect:Vt}),o.ZP.createElement(ra.Z,{isOpen:xt,emojis:At,onClose:Lt,onEmojiSelect:Ot,addRecentEmoji:ie}),o.ZP.createElement(ea,{isOpen:Ue,allowedAttachmentOptions:kt,onFileSelect:qt,onPollCreate:te,onClose:$e}),E&&o.ZP.createElement(la,{messageId:E,isOpen:Ne,onClose:xe}),H&&o.ZP.createElement(ga,{isOpen:Le,botCommands:H,onClose:Oe}),o.ZP.createElement(ta,{isOpen:De,allowedAttachmentOptions:kt,onLoad:ze,onClose:qe,onEmojiSelect:Ut,onStickerSelect:Vt,onGifSelect:Wt,onRemoveSymbol:Ft,onSearchOpen:as,addRecentEmoji:ie}))),et&&o.ZP.createElement(be.Z,{round:!0,color:"danger",className:"cancel",onClick:Ke,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(be.Z,{ref:nt,round:!0,color:"secondary",className:(0,ne.Z)(ot,!r&&"not-ready",et&&"recording"),disabled:cs,ariaLabel:ue(hs),onClick:is,onContextMenu:ot===Pa.Send&&rt?Mt:void 0},o.ZP.createElement("i",{className:"icon-send"}),o.ZP.createElement("i",{className:"icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon-check"})),rt&&o.ZP.createElement(aa,{isOpen:bt,onSilentSend:P?void 0:Jt,onScheduleSend:t?void 0:Pe,onClose:St,onCloseAnimationEnd:Et}),o.ZP.createElement(Za,{isOpen:ye,withTimePicker:!0,selectedAt:us.getTime(),maxAt:(0,N._F)(ms),isFutureMode:!0,secondButtonLabel:s?ue("Schedule.SendWhenOnline"):void 0,onClose:ns,onSubmit:es,onSecondButtonClick:s?ts:void 0}))}))),wa=(0,o.X$)((e=>{const{isActive:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"MobileSearch",!t,!0);return s?o.ZP.createElement(s,e):void 0})),ba=(0,o.X$)((e=>{const{isActive:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"MessageSelectToolbar",!t);return s?o.ZP.createElement(s,e):void 0})),Ma=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"UnpinAllMessagesModal",!t);return s?o.ZP.createElement(s,e):void 0})),Sa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"PaymentModal",!t);return s?o.ZP.createElement(s,e):void 0})),Ea=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"ReceiptModal",!t);return s?o.ZP.createElement(s,e):void 0})),ka=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"SeenByModal",!t);return s?o.ZP.createElement(s,e):void 0})),Ra=h.wB?450+a.fK:void 0;function Ta(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const Na=(0,o.X$)((0,n.c$)((e=>{const t=(0,i.Pu)(e),{isBlurred:s,background:n,backgroundColor:a,patternColor:o}=e.settings.themes[t]||{},{messageLists:r}=e.messages,c=(0,i.Bt)(e),{isLeftColumnShown:d,chats:{listIds:m}}=e,g={theme:t,customBackground:n,backgroundColor:a,patternColor:o,isLeftColumnShown:d,isRightColumnShown:(0,i.Jf)(e),isBackgroundBlurred:s,isMobileSearchActive:Boolean(h.wB&&(0,i.n5)(e)),isSelectModeActive:(0,i.CA)(e),isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),isSeenByModalOpen:Boolean(e.seenByModal),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1)};if(!c||!m.active)return g;const{chatId:p,threadId:f,type:I}=c,v=(0,i.Z1)(e,p),y=(0,i.IK)(e,p),Z=(0,i.KB)(e,p),{chatId:P,messageId:C}=e.audioPlayer,w=v&&(0,l.Qm)(v,f),b=(0,i.pk)(e,p),M="pinned"===I,S="scheduled"===I,E="thread"===I&&f===u._f,k=Boolean(v&&(0,l.eA)(v)),R=Boolean(v&&E&&(k||(0,l.ZV)(v))&&v.isNotJoined),T=Boolean(y&&(0,i.s4)(e,y.id)),N=!T&&b;return{...g,chatId:p,threadId:f,messageListType:I,isPrivate:(0,l.YC)(p),canPost:!M&&(!v||w)&&!b,isPinnedMessageList:M,isScheduledMessageList:S,currentUserBannedRights:null==v?void 0:v.currentUserBannedRights,defaultBannedRights:null==v?void 0:v.defaultBannedRights,hasPinnedOrAudioPlayer:f!==u._f||Boolean(!M&&(null==Z?void 0:Z.length))||Boolean(P&&C),pinnedMessagesCount:Z?Z.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:r,isChannel:k,canSubscribe:R,canStartBot:N,canRestartBot:T}}),((e,t)=>(0,g.ei)(t,["openChat","unpinAllMessages","loadUser","closeLocalTextSearch","exitMessageSelectMode","closePaymentModal","clearReceipt","joinChannel","sendBotCommand","restartBot"])))((({chatId:e,threadId:t,messageListType:s,isPrivate:n,isPinnedMessageList:r,messageLists:i,canPost:c,currentUserBannedRights:d,defaultBannedRights:u,hasPinnedOrAudioPlayer:m,pinnedMessagesCount:g,customBackground:p,theme:f,backgroundColor:I,patternColor:v,isLeftColumnShown:y,isRightColumnShown:Z,isBackgroundBlurred:P,isMobileSearchActive:C,isSelectModeActive:w,isPaymentModalOpen:b,isReceiptModalOpen:M,isSeenByModalOpen:S,animationLevel:E,shouldSkipHistoryAnimations:k,currentTransitionKey:R,isChannel:T,canSubscribe:N,canStartBot:B,canRestartBot:x,openChat:L,unpinAllMessages:A,loadUser:O,closeLocalTextSearch:U,exitMessageSelectMode:F,closePaymentModal:$,clearReceipt:D,joinChannel:Q,sendBotCommand:q,restartBot:G})=>{const{width:j}=ot(),H=(0,Ze.Z)(),[_,z]=(0,o.eJ)(tt.t.None),[V,W]=(0,o.eJ)(),[Y,X]=(0,o.eJ)(),[K,J]=(0,o.eJ)(!1),[ee,te]=(0,o.eJ)(!h.wB||E===a.oB),se=m&&(j<a.l3||Z&&j>a._m&&j<a.QU||j>=a.ks&&j<a.jT),ae=(0,rt.Z)(e,Ra),oe=(0,rt.Z)(t,Ra),re=(0,rt.Z)(s,Ra),ie=(0,rt.Z)(N,Ra),ce=(0,rt.Z)(B,Ra),le=(0,rt.Z)(x,Ra),de=(0,rt.Z)(c,Ra)&&!le&&!ce&&!ie,ue=(0,rt.Z)(se,Ra),me=(0,rt.Z)(V,Ra),he=(0,rt.Z)(T,Ra),fe=(0,it.Z)(R),Ie=void 0!==fe&&fe!==R;Ie&&te(!1);const ye=void 0!==fe&&fe<R?fe:void 0;(0,o.d4)((()=>e?(0,pe.Z)((()=>{L({id:void 0})})):void 0),[e,L]),(0,o.d4)((()=>{z(tt.t.None),W(void 0),X(void 0)}),[e]),(0,o.d4)((()=>{E===a.oB&&te(!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)((()=>{n&&O({userId:e})}),[e,n,O]);const Pe=(0,o.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},s=t&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Ta);z(s?tt.t.QuickFile:tt.t.Document)}),[]),Ce=(0,o.I4)((()=>{z(tt.t.None)}),[]),we=(0,o.I4)((()=>{J(!0)}),[]),Me=(0,o.I4)((()=>{J(!1)}),[]),Se=(0,o.I4)((()=>{A({chatId:e}),Me(),L({id:e})}),[A,L,Me,e]),Ee=(0,o.I4)((()=>{L({id:e})}),[L,e]),ke=(0,o.I4)((()=>{Q({chatId:e})}),[Q,e]),Re=(0,o.I4)((()=>{q({command:"/start"})}),[q]),Te=(0,o.I4)((()=>{G({chatId:e})}),[e,G]),Ne=((e,t)=>{const[s,n]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?n(t):nt.fetch(a.fo,e,nt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,at.pt)(t).then((()=>{n(`url(${t})`)}))})))}),[t,e]),t?s:void 0})(f,p),Be=(0,ne.Z)(ue&&"has-header-tools",p&&"custom-bg-image",I&&"custom-bg-color",p&&P&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),xe=(0,ne.Z)("messaging-disabled",!w&&"shown"),Le=(0,l.q8)(H,d,u),{composerHiddenScale:Ae,toolbarHiddenScale:Oe,composerTranslateX:Ue,toolbarTranslateX:Fe,unpinHiddenScale:$e,toolbarForUnpinHiddenScale:De}=(0,o.Ye)((()=>function(e,t){const s=e<=a.l3?16:32,n=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,288),424),s=Math.min(.25*e,424);return Math.min(e-t-s,ct)}if(e>a.ks){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,ct)}return e>ct?ct:e}(e),o=e<=a.l3?54:64,r=t?n-s-o:n-s,i=e>a.l3?Math.min(n-s,512):n-s,c=i/r,l=r/i;return{composerHiddenScale:c,toolbarHiddenScale:l,composerTranslateX:t?o/2*l:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:i/258,toolbarForUnpinHiddenScale:258/i}}(j,de)),[de,j]),Qe=(0,ne.Z)("middle-column-footer",!de&&"no-composer",de&&Y&&!w&&"with-notch");(0,ge.ZP)(ae&&oe,(()=>{L({id:void 0},{forceSyncOnIOs:!0})}),void 0,void 0,void 0,(null==i?void 0:i.map(st.q))||[]),(0,ge.ZP)(C,U),(0,ge.ZP)(w,F);const qe=Boolean(!r&&!de&&Le),Ge=Boolean(le||ie||ce||r),je=Boolean(qe||w||Ge);return o.ZP.createElement("div",{id:"MiddleColumn",className:Be,onTransitionEnd:t=>{"transform"===t.propertyName&&t.target===t.currentTarget&&te(Boolean(e))},style:`\n --composer-hidden-scale: ${Ae};\n --toolbar-hidden-scale: ${Oe};\n --unpin-hidden-scale: ${$e};\n --toolbar-unpin-hidden-scale: ${De};\n --composer-translate-x: ${Ue}px;\n --toolbar-translate-x: ${Fe}px;\n --pattern-color: ${v};\n --theme-background-color:\n ${I||("dark"===f?a.It:a.p3)};\n `,onClick:h.p7&&y?Ee:void 0},o.ZP.createElement("div",{id:"middle-column-bg",style:Ne?`--custom-background: ${Ne}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),ae&&oe&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:de?Pe:void 0},o.ZP.createElement(jt,{chatId:ae,threadId:oe,messageListType:re,isReady:ee&&!Ie}),o.ZP.createElement(ve.Z,{name:k?"none":E===a.zy?"slide":"fade",activeKey:R,shouldCleanup:!0,cleanupExceptionKey:ye,onStop:()=>te(!0)},(()=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Zn,{key:`${ae}-${oe}-${re}`,chatId:ae,threadId:oe,type:re,canPost:de,hasTools:ue,onFabToggle:W,onNotchToggle:X,isReady:ee&&!Ie,withBottomShift:Ge}),o.ZP.createElement("div",{className:Qe},de&&o.ZP.createElement(Ca,{chatId:ae,threadId:oe,messageListType:re,dropAreaState:_,onDropHide:Ce,isReady:ee&&!Ie}),r&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:H.isRtl?"rtl":void 0},o.ZP.createElement(be.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:we},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,H("Chat.Pinned.UnpinAll",g,"i")))),qe&&o.ZP.createElement("div",{className:xe},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,Le))),h.wB&&ie&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:H.isRtl?"rtl":void 0},o.ZP.createElement(be.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ke},H(he?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&ce&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:H.isRtl?"rtl":void 0},o.ZP.createElement(be.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Re},H("BotStart"))),h.wB&&le&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:H.isRtl?"rtl":void 0},o.ZP.createElement(be.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Te},H("BotRestart"))),o.ZP.createElement(ba,{messageListType:re,isActive:w,canPost:de}),o.ZP.createElement(Sa,{isOpen:Boolean(b),onClose:$}),o.ZP.createElement(Ea,{isOpen:Boolean(M),onClose:D}),o.ZP.createElement(ka,{isOpen:S}))))),o.ZP.createElement(Pn,{isShown:me,canPost:de,withExtraShift:je})),h.wB&&o.ZP.createElement(wa,{isActive:Boolean(C)})),e&&o.ZP.createElement(Ma,{isOpen:K,chatId:e,pinnedMessagesCount:g,onClose:Me,onUnpin:Se}))}))),Ba=(0,C.Ds)((e=>e()),200,!1);var xa;!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.ManageGroupMembers=16]="ManageGroupMembers",e[e.StickerSearch=17]="StickerSearch",e[e.GifSearch=18]="GifSearch",e[e.PollResults=19]="PollResults",e[e.AddingMembers=20]="AddingMembers"}(xa||(xa={}));const La=(0,o.X$)((0,n.c$)(((e,{chatId:t,isProfile:s,isManagement:n})=>{const{query:a}=(0,i.n5)(e)||{},{query:o}=(0,i.y5)(e)||{},{query:r}=(0,i.yN)(e)||{},c=t?(0,i.Z1)(e,t):void 0,d=c&&(0,l.eA)(c),u=s&&t&&(0,l.YC)(t)?(0,i.dy)(e,t):void 0,m=u&&(0,l.kw)(u);return{canManage:Boolean(!n&&s&&!m&&c&&!(0,i.FM)(e,c.id)&&((0,l.YC)(c.id)||((0,l.Nl)(c)||c.isCreator)&&!c.isNotJoined)),canAddContact:m,isChannel:d,userId:null==u?void 0:u.id,messageSearchQuery:a,stickerSearchQuery:o,gifSearchQuery:r}}),((e,t)=>(0,g.ei)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar","addContact"])))((({isColumnOpen:e,isProfile:t,isSearch:s,isManagement:n,isStickerSearch:a,isGifSearch:r,isPollResults:i,isAddingChatMembers:c,profileState:l,managementScreen:d,canAddContact:u,userId:g,canManage:p,isChannel:f,onClose:I,messageSearchQuery:v,stickerSearchQuery:y,gifSearchQuery:Z,setLocalTextSearchQuery:P,setStickerSearchQuery:C,setGifSearchQuery:w,searchTextMessagesLocal:b,toggleManagement:M,openHistoryCalendar:S,shouldSkipAnimation:E,addContact:k})=>{var R;const T=(0,o.sO)(null),B=(0,o.I4)((e=>{P({query:e}),e.length&&Ba(b)}),[b,P]),x=(0,o.I4)((e=>{C({query:e})}),[C]),L=(0,o.I4)((e=>{w({query:e})}),[w]),A=(0,o.I4)((()=>{k({userId:g})}),[k,g]),[O,U]=(0,o.eJ)(!e);(0,o.d4)((()=>{setTimeout((()=>{U(!e)}),300)}),[e]);const F=(0,Ze.Z)(),$=t?l===m.vi.Profile?xa.Profile:l===m.vi.SharedMedia?xa.SharedMedia:l===m.vi.MemberList?xa.MemberList:-1:s?xa.Search:i?xa.PollResults:a?xa.StickerSearch:r?xa.GifSearch:c?xa.AddingMembers:n?d===m.u1.Initial?xa.ManageInitial:d===m.u1.ChatPrivacyType?xa.ManageChatPrivacyType:d===m.u1.Discussion?xa.ManageDiscussion:d===m.u1.ChannelSubscribers?xa.ManageChannelSubscribers:d===m.u1.GroupPermissions?xa.ManageGroupPermissions:d===m.u1.ChatAdministrators?xa.ManageChatAdministrators:d===m.u1.GroupRemovedUsers?xa.ManageGroupRemovedUsers:d===m.u1.GroupUserPermissionsCreate?xa.ManageGroupUserPermissionsCreate:d===m.u1.GroupUserPermissions?xa.ManageGroupUserPermissions:d===m.u1.GroupRecentActions?xa.ManageGroupRecentActions:d===m.u1.ChatAdminRights?xa.ManageGroupAdminRights:d===m.u1.GroupMembers?xa.ManageGroupMembers:void 0:void 0,D=null!==(R=(0,ut.Z)($,!0))&&void 0!==R?R:-1;function Q(){if(-1!==D)switch(D){case xa.PollResults:return o.ZP.createElement("h3",null,F("PollResults"));case xa.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Me.Z,{parentContainerClassName:"RightSearch",value:v,onChange:B}),o.ZP.createElement(be.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>S({selectedAt:(0,N._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case xa.AddingMembers:return o.ZP.createElement("h3",null,F("GroupAddMembers"));case xa.ManageInitial:return o.ZP.createElement("h3",null,F("Edit"));case xa.ManageChatPrivacyType:return o.ZP.createElement("h3",null,F(f?"ChannelTypeHeader":"GroupTypeHeader"));case xa.ManageDiscussion:return o.ZP.createElement("h3",null,F("Discussion"));case xa.ManageChatAdministrators:return o.ZP.createElement("h3",null,F("ChannelAdministrators"));case xa.ManageGroupRecentActions:return o.ZP.createElement("h3",null,F("Group.Info.AdminLog"));case xa.ManageGroupAdminRights:return o.ZP.createElement("h3",null,F("EditAdminRights"));case xa.ManageGroupPermissions:return o.ZP.createElement("h3",null,F("ChannelPermissions"));case xa.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,F("ChannelBlockedUsers"));case xa.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,F("ChannelAddException"));case xa.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,F("UserRestrictions"));case xa.StickerSearch:return o.ZP.createElement(Me.Z,{value:y,placeholder:F("SearchStickersHint"),autoFocusSearch:!0,onChange:x});case xa.GifSearch:return o.ZP.createElement(Me.Z,{value:Z,placeholder:F("SearchGifsTitle"),autoFocusSearch:!0,onChange:L});case xa.SharedMedia:return o.ZP.createElement("h3",null,F("SharedMedia"));case xa.ManageChannelSubscribers:return o.ZP.createElement("h3",null,F("ChannelSubscribers"));case xa.MemberList:case xa.ManageGroupMembers:return o.ZP.createElement("h3",null,F("GroupMembers"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},u&&o.ZP.createElement(be.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:F("AddContact"),onClick:A},o.ZP.createElement("i",{className:"icon-add-user"})),p&&o.ZP.createElement(be.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:F("Edit"),onClick:M},o.ZP.createElement("i",{className:"icon-edit"}))))}}const q=h.wB||$===xa.SharedMedia||$===xa.MemberList||$===xa.AddingMembers||n,G=(0,ne.Z)("animated-close-icon",q&&"state-back",(O||E)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(be.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:I,ariaLabel:F(q?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:T,className:G})),o.ZP.createElement(ve.Z,{name:O||E?"none":"slide-fade",activeKey:D},Q))})));var Aa=s(91),Oa=s(7407);function Ua(e,t,s,n){const[o,r]=(0,Oa.Z)(s?t:void 0,n,void 0,a.Vk);return[o,r,!(!o||!n||o[0]===n[0])]}function Fa(e,t,s,n,r,i){const c=(0,o.sO)();(0,de.Z)((()=>{t===e&&r&&i&&(c.current=(0,l.R5)(r,i,e).reverse())}),[r,i,t,e]);const[d,u]=(0,Oa.Z)(n?s:void 0,c.current,void 0,"media"===e?a.EN:a.pn);return[d,u,!(!d||!c.current||d[0]===c.current[0])]}const $a=(0,C.P2)((e=>e()),250,!1);let Da=!1;var Qa=s(1273),qa=s(1876),Ga=s(787),ja=s(180),Ha=s(3709),_a=s(5418),za=s(7262),Va=s(1151),Wa=s(2275);const Ya=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function Xa(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Ka=(0,o.X$)((0,n.c$)(((e,{chatId:t,userId:s})=>{var n,a;const o=(0,i.Z1)(e,t),r=(0,i.Zw)(e,s||t),{currentType:c,resultsByType:d}=(0,i.we)(e)||{},{foundIds:u}=d&&c&&d[c]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,p=o&&(0,l.Bf)(o),f=o&&(0,l.eA)(o),I=p||f&&(0,l.Nl)(o),v=null==o||null===(n=o.fullInfo)||void 0===n?void 0:n.members,y=I&&o&&o.fullInfo&&!o.fullInfo.canViewMembers,Z=I&&o&&((0,l.VE)(o,"inviteUsers")||o.isCreator),P=I&&o&&((0,l.VE)(o,"banUsers")||o.isCreator),C=(0,i.xs)(e,t);let w,b,M;return s?b=s:(0,l.YC)(t)&&(b=t),b&&(M=(0,i.dy)(e,b),w=M&&!M.isSelf&&!(0,l.cS)(M)),{theme:(0,i.Pu)(e),isChannel:f,resolvedUserId:b,chatMessages:r,foundIds:u,mediaSearchType:c,hasCommonChatsTab:w,hasMembersTab:I,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,currentUserId:e.currentUserId,isRightColumnShown:(0,i.Jf)(e),isRestricted:null==o?void 0:o.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:C,usersById:m,userStatusesById:h,chatsById:g,...I&&v&&{members:v},...w&&M&&{commonChatIds:null===(a=M.commonChats)||void 0===a?void 0:a.ids}}}),((e,t)=>(0,g.ei)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos","setNewChatMembersDialogState","loadCommonChats","openChat"])))((({chatId:e,profileState:t,onProfileStateChange:s,theme:n,isChannel:r,resolvedUserId:i,currentUserId:c,chatMessages:d,foundIds:g,mediaSearchType:p,hasCommonChatsTab:f,hasMembersTab:I,areMembersHidden:v,canAddMembers:y,canDeleteMembers:Z,commonChatIds:P,members:C,usersById:w,userStatusesById:b,chatsById:M,isRightColumnShown:S,isRestricted:E,lastSyncTime:k,activeDownloadIds:R,serverTimeOffset:T,setLocalMediaSearchType:N,loadMoreMembers:B,loadCommonChats:x,openChat:L,searchMediaMessagesLocal:A,openMediaViewer:O,openAudioPlayer:U,openUserInfo:F,focusMessage:$,loadProfilePhotos:D,setNewChatMembersDialogState:Q})=>{const q=(0,o.sO)(null),G=(0,o.sO)(null),j=(0,Ze.Z)(),[H,_]=(0,o.eJ)(0),[z,V]=(0,o.eJ)(),W=(0,o.Ye)((()=>[...I?[{type:"members",title:r?"ChannelSubscribers":"GroupMembers"}]:[],...Ya,...f?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[f,I,r]),Y=W[H].type,[X,K,J,ee]=function(e,t,s,n,a,r,i,c,d,u,m,h,g,p,f,I=0){const v="members"!==a&&r?r:a,y=(0,o.Ye)((()=>{if(i&&d&&u)return(0,l.Z0)(i.map((({userId:e})=>e)),d,u,void 0,I)}),[i,I,d,u]),Z=(0,o.Ye)((()=>{if(c&&m)return(0,l.ih)(c,m,!0)}),[m,c]),[P,C,w]=Ua(0,t,f,y),[b,M,S]=Fa("media",v,n,f,h,g),[E,k,R]=Fa("documents",v,n,f,h,g),[T,N,B]=Fa("links",v,n,f,h,g),[x,L,A]=Fa("audio",v,n,f,h,g),[O,U,F]=Fa("voice",v,n,f,h,g),[$,D,Q]=Ua(0,s,f,Z);let q,G,j=!1;switch(v){case"members":q=P,G=C,j=w;break;case"commonChats":q=$,G=D,j=Q;break;case"media":q=b,G=M,j=S;break;case"documents":q=E,G=k,j=R;break;case"links":q=T,G=N,j=B;break;case"audio":q=x,G=L,j=A;break;case"voice":q=O,G=U,j=F}return[v,q,G,j]}(0,B,x,A,Y,p,C,P,w,b,M,d,g,0,k,T),te=W.findIndex((({type:e})=>e===X)),{handleScroll:se}=function(e,t,s,n){(0,_t.Z)((([s])=>{if(s&&s!==t){const s=e.current,a=s.querySelector(".TabList");s.scrollTop<a.offsetTop&&(n("members"===t?m.vi.MemberList:m.vi.SharedMedia),Da=!0,(0,Kt.Z)(s,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{Da=!1}),350))}}),[t,n]),(0,_t.Z)((([t])=>{if(s!==m.vi.Profile||s===t)return;const a=e.current;a&&a.querySelector(".TabList")&&(Da=!0,(0,Kt.Z)(a,a.firstElementChild,"start",void 0,2*a.offsetHeight),setTimeout((()=>{Da=!1}),350),n(s))}),[s]);const a=(0,o.I4)((()=>{const s=e.current;if(!s)return;const a=s.querySelector(".TabList");if(!a)return;let o=m.vi.Profile;s.scrollTop>=a.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),n(o)}),[e,n,t]);return(0,o.d4)((()=>{Da||a()}),[a,t]),{handleScroll:(0,o.I4)((()=>{Da||$a(a)}),[a])}}(q,Y,t,s),{applyTransitionFix:ne,releaseTransitionFix:ae}=function(e,t=".Transition.shared-media-transition"){return(0,o.d4)((()=>{function s(){const s=e.current,n=s.querySelector(t),a=s.querySelector(".TabList");n&&a&&(n.style.minHeight=s.offsetHeight-a.offsetHeight+"px")}return s(),window.addEventListener("resize",s,!1),()=>{window.removeEventListener("resize",s,!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])}}(q),[oe,re]=(()=>{const[e,t]=(0,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),ie=(0,o.I4)((()=>{ae(),re()}),[ae,re]),ce=(0,o.I4)((()=>{Q(m.WB.InProgress)}),[Q]);(0,o.d4)((()=>{N({mediaType:Y})}),[N,Y]);const le=i||e;(0,o.d4)((()=>{k&&D({profileId:le})}),[D,le,k]);const de=(0,o.I4)((e=>{O({chatId:le,threadId:u._f,messageId:e,origin:m.bZ.SharedMedia})}),[le,O]),ue=(0,o.I4)((e=>{U({chatId:le,messageId:e})}),[le,U]),me=(0,o.I4)((e=>{F({id:e})}),[F]),he=(0,o.I4)((e=>{$({chatId:le,messageId:e})}),[le,$]),ge=(0,o.I4)((()=>{V(void 0)}),[]);let pe;(0,o.d4)((()=>{if(G.current&&h.$b)return(0,Be.s)(G.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Be.e.Left?(_(Math.min(H+1,W.length-1)),!0):t===Be.e.Right&&(_(Math.max(0,H-1)),!0)})}),[H,W.length]);const fe="members"===X||!I&&"media"===X;fe?pe=S?0:1e3:K||(pe=a.Y);const Ie=(0,ua.Z)([e,X],pe);function ye(){if(!K||!Ie||!d){const e=fe&&K&&!Ie;return o.ZP.createElement("div",{className:"content empty-list"},!e&&o.ZP.createElement(Te.Z,null))}if(!K.length){let e;switch(X){case"members":e=v?"You have no access to group members list.":"No members found";break;case"commonChats":e=j("NoGroupsInCommon");break;case"documents":e=j("lng_media_file_empty");break;case"links":e=j("lng_media_link_empty");break;case"audio":e=j("lng_media_song_empty");break;case"voice":e=j("lng_media_audio_empty");break;default:e=j("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(za.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${X}-list`,dir:j.isRtl&&"media"===X?"rtl":void 0,teactFastList:!0},"media"===X?K.map((e=>d[e]&&o.ZP.createElement(Ha.Z,{key:e,message:d[e],onClick:de}))):"documents"===X?K.map((e=>d[e]&&o.ZP.createElement(vs.Z,{key:e,message:d[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:he,isDownloading:R.includes(e)}))):"links"===X?K.map((e=>d[e]&&o.ZP.createElement(_a.Z,{key:e,message:d[e],onMessageClick:he}))):"audio"===X?K.map((e=>d[e]&&o.ZP.createElement(ys.Z,{key:e,theme:n,message:d[e],origin:m.Cr.SharedMedia,date:d[e].date,lastSyncTime:k,className:"scroll-item",onPlay:ue,onDateClick:he,isDownloading:R.includes(e)}))):"voice"===X?K.map((e=>d[e]&&o.ZP.createElement(ys.Z,{key:e,theme:n,message:d[e],senderTitle:(0,Aa.F)(j,d[e],M,w),origin:m.Cr.SharedMedia,date:d[e].date,lastSyncTime:k,className:"scroll-item",onPlay:ue,onDateClick:he,isDownloading:R.includes(e)}))):"members"===X?K.map(((e,t)=>{return o.ZP.createElement(qa.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>me(e),contextActions:(s=e,s!==c&&Z?[{title:j("lng_context_remove_from_group"),icon:"stop",handler:()=>{V(s)}}]:void 0)},o.ZP.createElement(ht.Z,{userId:e,forceShowSelf:!0}));var s})):"commonChats"===X?K.map(((e,t)=>o.ZP.createElement(qa.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>L({id:e})},o.ZP.createElement(gt.Z,{chatId:e})))):void 0)}return o.ZP.createElement(Qa.Z,{ref:q,className:"Profile custom-scroll",itemSelector:Xa(X),items:Ie?K:void 0,cacheBuster:oe,sensitiveArea:a.qU,preloadBackwards:Ie?"members"===X?a.Vk:a.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:J,onScroll:se},!ee&&function(e,t){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(Ga.Z,{userId:t||e}),o.ZP.createElement(ja.Z,{chatOrUserId:t||e}))}(e,i),!E&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(ve.Z,{ref:G,name:j.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:te,renderCount:W.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ne,onStop:ie},ye),o.ZP.createElement(Le.Z,{big:!0,activeTab:H,tabs:W,onSwitchTab:_})),y&&o.ZP.createElement(Va.Z,{isShown:"members"===X,onClick:ce,ariaLabel:j("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),Z&&o.ZP.createElement(Wa.Z,{isOpen:Boolean(z),userId:z,onClose:ge}))}))),Ja=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)})),eo=(0,o.X$)((e=>{const t=(0,Fe.Z)(Ue.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement($e.Z,null)})),to=(0,o.X$)((()=>{const e=(0,Fe.Z)(Ue.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement($e.Z,null)})),so=(0,o.X$)((()=>{const e=(0,Fe.Z)(Ue.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement($e.Z,null)})),no=(0,o.X$)((()=>{const e=(0,Fe.Z)(Ue.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement($e.Z,null)}));var ao=s(1820);const oo=(0,o.X$)((0,n.c$)(((e,{chatId:t})=>{var s;const n=(0,i.Z1)(e,t),{userIds:a}=e.contactList||{},{byId:o}=e.users,{byId:r}=e.chats,{currentUserId:c,newChatMembersProgress:d,connectionState:u}=e,h=n&&(0,l.eA)(n),{query:g,fetchingStatus:p,globalUserIds:f,localUserIds:I}=e.userSearch;return{isChannel:h,members:null==n||null===(s=n.fullInfo)||void 0===s?void 0:s.members,currentUserId:c,usersById:o,chatsById:r,localContactIds:a,searchQuery:g,isSearching:p,isLoading:d===m.WB.Loading,globalUserIds:f,localUserIds:I,connectionState:u}}),((e,t)=>(0,g.ei)(t,["loadContactList","setUserSearchQuery"])))((({isChannel:e,connectionState:t,members:s,onNextStep:n,currentUserId:a,usersById:r,chatsById:i,localContactIds:c,isLoading:d,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,setUserSearchQuery:f,onClose:I,isActive:v,loadContactList:y})=>{const Z=(0,Ze.Z)(),[P,C]=(0,o.eJ)([]),w=(0,it.Z)(P)===P;(0,o.d4)((()=>{v&&"connectionStateReady"===t&&y()}),[t,v,y]),(0,ge.ZP)(v,I);const b=(0,o.Ye)((()=>s?s.map((e=>e.userId)):[]),[s]),M=(0,o.I4)((e=>{f({query:e})}),[f]),S=(0,o.Ye)((()=>{const t=c?(0,l.ih)(c.filter((e=>e!==a)),i):[];if(!u)return t.filter((e=>!b.includes(e)));const s=t.filter((e=>{const t=r[e];if(!t)return!1;const s=(0,l.Js)(t);return s&&(0,k.Z)(s,u)}));return(0,l.ih)((0,g.Tw)([...s,...h||[],...p||[]]).filter((t=>{const s=r[t];return!b.includes(t)&&(!s||!(0,l.cS)(s)||!e&&s.canBeInvitedToGroup)})),i)}),[c,i,u,h,p,a,r,b,e]),E=(0,o.I4)((()=>{P.length&&(f({query:""}),n(P))}),[P,f,n]);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:M,noScrollRestore:w}),o.ZP.createElement(Va.Z,{isShown:Boolean(P.length),disabled:d,ariaLabel:Z("lng_channel_add_users"),onClick:E},d?o.ZP.createElement(Te.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),ro=Object.keys(m.qt).length/2,io=Object.keys(m.u1).length/2;function co(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const lo=(0,o.X$)((0,n.c$)((e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{},n=(0,i.g4)(e);return{contentKey:(0,i.Wq)(e),chatId:t,threadId:s,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&n),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}),((e,t)=>(0,g.ei)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults","addChatMembers","setNewChatMembersDialogState"])))((({contentKey:e,chatId:t,threadId:s,currentProfileUserId:n,isChatSelected:r,toggleChatInfo:i,toggleManagement:c,openUserInfo:l,closeLocalTextSearch:d,setStickerSearchQuery:u,setGifSearchQuery:h,closePollResults:g,addChatMembers:p,setNewChatMembersDialogState:f,shouldSkipHistoryAnimations:I})=>{var v;const{width:y}=ot(),[Z,P]=(0,o.eJ)(m.vi.Profile),[C,w]=(0,o.eJ)(m.u1.Initial),[b,M]=(0,o.eJ)(),[S,E]=(0,o.eJ)(),k=Z!==m.vi.Profile,R=void 0!==e,T=e===m.qt.ChatInfo||e===m.qt.UserInfo,N=e===m.qt.Search,B=e===m.qt.Management,x=e===m.qt.StickerSearch,L=e===m.qt.GifSearch,A=e===m.qt.PollResults,O=e===m.qt.AddingMembers,U=y<=a._m,[F,$]=(0,o.eJ)(!R),D=null!==(v=(0,ut.Z)(e,!0,!r))&&void 0!==v?v:-1,Q=(0,o.I4)(((t=!0)=>{switch(e){case m.qt.AddingMembers:f(m.WB.Closed);break;case m.qt.ChatInfo:if(k&&t){P(m.vi.Profile);break}i(void 0,{forceSyncOnIOs:!0});break;case m.qt.UserInfo:if(k&&t){P(m.vi.Profile);break}l({id:void 0},{forceSyncOnIOs:!0});break;case m.qt.Management:switch(C){case m.u1.Initial:c();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:w(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:w(m.u1.GroupPermissions),M(void 0),E(void 0);break;case m.u1.ChatAdminRights:case m.u1.GroupRecentActions:w(m.u1.ChatAdministrators)}break;case m.qt.Search:co(),d();break;case m.qt.StickerSearch:co(),u({query:void 0});break;case m.qt.GifSearch:co(),h({query:void 0});break;case m.qt.PollResults:g()}}),[e,k,i,l,g,f,C,c,d,u,h]),q=(0,o.I4)(((e,t)=>{M(e),E(t)}),[]),G=(0,o.I4)((e=>{p({chatId:t,memberIds:e})}),[p,t]);function j(e){if(-1!==D)switch(D){case m.qt.AddingMembers:return o.ZP.createElement(oo,{chatId:t,onNextStep:G,isActive:R&&e,onClose:Q});case m.qt.ChatInfo:case m.qt.UserInfo:return o.ZP.createElement(Ka,{key:n||t,chatId:t,userId:n,profileState:Z,onProfileStateChange:P});case m.qt.Search:return o.ZP.createElement(Ja,{chatId:t,threadId:s,onClose:Q,isActive:R&&e});case m.qt.Management:return o.ZP.createElement(eo,{chatId:t,currentScreen:C,isPromotedByCurrentUser:S,selectedChatMemberId:b,onScreenSelect:w,onChatMemberSelect:q,isActive:R&&e,onClose:Q});case m.qt.StickerSearch:return o.ZP.createElement(to,{onClose:Q,isActive:R&&e});case m.qt.GifSearch:return o.ZP.createElement(so,{onClose:Q,isActive:R&&e});case m.qt.PollResults:return o.ZP.createElement(no,{onClose:Q,isActive:R&&e})}}return(0,o.d4)((()=>R?(0,pe.Z)(Q):void 0),[R,Q]),(0,o.d4)((()=>{setTimeout((()=>{$(!R)}),300)}),[R]),(0,o.d4)((()=>{R&&U&&Q()}),[U]),(0,Ht.Z)((([s,n])=>{(s===m.qt.ChatInfo&&e===m.qt.UserInfo||s===m.qt.UserInfo&&e===m.qt.ChatInfo||n!==t)&&(P(m.vi.Profile),w(m.u1.Initial))}),[e,t]),(0,ge.ZP)(r&&(e===m.qt.ChatInfo||e===m.qt.UserInfo||e===m.qt.Management||e===m.qt.AddingMembers),(()=>Q(!1)),i),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},U&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:Q}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(La,{chatId:t,isColumnOpen:R,isProfile:T,isSearch:N,isManagement:B,isStickerSearch:x,isGifSearch:L,isPollResults:A,isAddingChatMembers:O,profileState:Z,managementScreen:C,onClose:Q,shouldSkipAnimation:F||I}),o.ZP.createElement(ve.Z,{name:F||I?"none":"zoom-fade",renderCount:ro+io,activeKey:B?ro+C:D,shouldCleanup:!0,cleanupExceptionKey:m.qt.ChatInfo},j)))}))),uo=(0,o.X$)((({isOpen:e})=>{const t=(0,Fe.Z)(Ue.gl.Extra,"MediaViewer",!e);return t?o.ZP.createElement(t,null):void 0}));function mo(e,t){const s=document.createElement("a");s.href=e,s.download=t;try{s.click()}catch(e){console.error(e)}}const ho=new Set,go=(0,o.X$)((0,n.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})),((e,t)=>(0,g.ei)(t,["cancelMessageMediaDownload"])))((({activeDownloads:e,messages:t,cancelMessageMediaDownload:s})=>{(0,o.d4)((()=>{Object.entries(e).forEach((([e,n])=>{n.map((s=>t[Number(e)].byId[s])).forEach((e=>{const t=(0,l.Ti)(e,"download");if(t){if(!ho.has(t)){const n=Et.UV(t);if(n)return ho.delete(t),mo(n,(0,l.w6)(e)),void s({message:e});Et.he(t,u.IU.BlobUrl,!0).then((n=>{ho.delete(t),n&&mo(n,(0,l.w6)(e)),s({message:e})})),ho.add(t)}}else s({message:e})}))}))}),[s,t,e])}))),po=(0,o.X$)((({isOpen:e})=>{const t=(0,Fe.Z)(Ue.gl.Extra,"Notifications",!e);return t?o.ZP.createElement(t,null):void 0})),fo=(0,o.X$)((({isOpen:e})=>{const t=(0,Fe.Z)(Ue.gl.Extra,"Dialogs",!e);return t?o.ZP.createElement(t,null):void 0})),Io=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"ForwardPicker",!t);return s?o.ZP.createElement(s,e):void 0})),vo=(0,o.X$)((e=>{const{url:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"SafeLinkModal",!t);return s?o.ZP.createElement(s,e):void 0})),yo=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,Fe.Z)(Ue.gl.Extra,"HistoryCalendar",!t);return s?o.ZP.createElement(s,e):void 0})),Zo=(0,o.X$)((e=>{const{groupCallId:t}=e,s=(0,Fe.Z)(Ue.gl.Calls,"GroupCall",!t);return s?o.ZP.createElement(s,e):void 0})),Po=(0,o.X$)((e=>{const{groupCallId:t}=e,s=(0,Fe.Z)(Ue.gl.Calls,"ActiveCallHeader",!t);return s?o.ZP.createElement(s,null):void 0})),Co=(0,o.X$)((({isOpen:e})=>{const t=(0,Fe.Z)(Ue.gl.Calls,"CallFallbackConfirm",!e);return t?o.ZP.createElement(t,{isOpen:e}):void 0}));let wo,bo=!1;function Mo(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 So(e){document.title!==e&&(document.title=e)}const Eo=(0,o.X$)((0,n.c$)((e=>{const{settings:{byKey:{animationLevel:t,language:s,wasTimeFormatSetManually:n}}}=e,{chatId:a,messageId:o}=e.audioPlayer,r=a&&o?(0,i.hj)(e,a,o):void 0;return{lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:(0,i.Jf)(e),isMediaViewerOpen:(0,i.zQ)(e),isForwardModalOpen:(0,i.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:r,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,i.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:t,language:s,wasTimeFormatSetManually:n,isCallFallbackConfirmOpen:Boolean(e.groupCalls.isFallbackConfirmOpen)}}),((e,t)=>(0,g.ei)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots","loadEmojiKeywords","openStickerSetShortName","loadCountryList","ensureTimeFormat","checkVersionNotification"])))((({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:s,isMediaViewerOpen:r,isForwardModalOpen:c,hasNotifications:l,hasDialogs:d,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:f,openedStickerSetShortName:I,isServiceChatReady:v,animationLevel:y,language:Z,wasTimeFormatSetManually:P,isCallFallbackConfirmOpen:w,loadAnimatedEmojis:b,loadNotificationSettings:M,loadNotificationExceptions:S,updateIsOnline:E,loadTopInlineBots:k,loadEmojiKeywords:R,loadCountryList:T,ensureTimeFormat:N,openStickerSetShortName:B,checkVersionNotification:x})=>{a.eM&&!bo&&(bo=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{e&&(E(!0),b(),M(),S(),k(),R({language:a.pR}))}),[e,b,R,S,M,k,E]),(0,o.d4)((()=>{e&&(Z!==a.pR&&R({language:Z}),T({langCode:Z}))}),[Z,e,T,R]),(0,o.d4)((()=>{e&&v&&x()}),[e,v,x]),(0,o.d4)((()=>{e&&!P&&N()}),[e,P,N]),(0,o.d4)((()=>{e&&ge.Oy.startsWith("#?tgaddr=")&&(0,oe.o)(decodeURIComponent(ge.Oy.substr("#?tgaddr=".length)))}),[e]),(0,o.d4)((()=>{if(m)return re.Z.disableRefresh(),()=>{re.Z.enableRefresh()}}),[m]);const{transitionClassNames:L}=(0,ie.Z)(!t,void 0,!0,void 0,f),{transitionClassNames:A}=(0,ie.Z)(s,void 0,!0,void 0,f),O=(0,ne.Z)(L.replace(/([\w-]+)/g,"middle-column-$1"),A.replace(/([\w-]+)/g,"right-column-$1"),f&&"history-animation-disabled");(0,de.Z)((([e])=>{if(void 0===e||0===y)return;const t=(0,se.YW)();(0,ae.L)(document.getElementById("MiddleColumn"),t)}),[t]),(0,de.Z)((([e])=>{if(void 0===e||0===y)return;(0,C.T2)((()=>{document.body.classList.add("animating-right-column")}));const t=(0,se.YW)();(0,ae.L)(document.getElementById("RightColumn"),(()=>{t(),(0,C.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[s]);const U=(0,o.I4)((()=>{E(!1);const e=(0,i.A1)((0,n.Rd)());let t=0;clearInterval(wo),wo=window.setInterval((()=>{if(document.title.includes(a.ou))Mo(!1);else{if(t%2==0){const t=(0,i.A1)((0,n.Rd)())-e;t>0&&(So(`${t} notification${t>1?"s":""}`),Mo(!0))}else So(a.Ti),Mo(!1);t++}}),1e3)}),[E]),F=(0,o.I4)((()=>{E(!0),clearInterval(wo),wo=void 0,document.title.includes(a.ou)||So(a.Ti),Mo(!1)}),[E]),$=(0,o.I4)((()=>{B({stickerSetShortName:void 0})}),[B]);function D(e){e.preventDefault(),e.stopPropagation()}return(0,ce.Z)(U,F),le(U),function(e=!1){(0,o.d4)((()=>{if(h.$b){if(!e)return null==ue||ue.setAttribute("content",me),h.cj&&!h.fl&&document.addEventListener("gesturestart",he),()=>{null==ue||ue.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",he)};null==ue||ue.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(r),o.ZP.createElement("div",{id:"Main",className:O,onDrop:D,onDragOver:D},o.ZP.createElement(et,null),o.ZP.createElement(Na,null),o.ZP.createElement(lo,null),o.ZP.createElement(uo,{isOpen:r}),o.ZP.createElement(Io,{isOpen:c}),o.ZP.createElement(po,{isOpen:l}),o.ZP.createElement(fo,{isOpen:d}),u&&o.ZP.createElement(Dt,{key:u.id,message:u,noUi:!0}),o.ZP.createElement(vo,{url:g}),o.ZP.createElement(yo,{isOpen:p}),o.ZP.createElement(bs.Z,{isOpen:Boolean(I),onClose:$,stickerSetShortName:I}),m&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Zo,{groupCallId:m}),o.ZP.createElement(Po,{groupCallId:m})),o.ZP.createElement(go,null),o.ZP.createElement(Co,{isOpen:w}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,n.Rd)().connectionState||(0,n.uC)().initApi()},4524:(e,t,s)=>{e.exports=s.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"}}]);
//# sourceMappingURL=977.e221174b69f7117724dc.js.map