telegram-tt/dist/4.df68acb615ff7e070772.js
Alexander Zinchuk 3aba9fa599 [Build]
2021-07-15 21:58:27 +03:00

2 lines
217 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.

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{102:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return Un}));var s=a(2),n=a(1),c=a(0),o=(a(84),a(34)),r=a(7),i=a(49),l=a(4);function d(e){const{chatId:t,threadId:a}=Object(r.z)(e)||{};return t&&a?(e=Object(o.Z)(e,t,a,!1),e=Object(o.u)(e,t,a,void 0)):e}Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(t&&a)return Object(o.Z)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",d),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(r.z)(e)||{};if(!s||!n)return;const{query:c}=a,d=Object(l.a)(s,n),{query:b}=e.localTextSearch.byChatThreadKey[d]||{};return c!==b&&(e=Object(o.u)(e,s,n,i.a)),e=Object(o.Z)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(r.z)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(o.Y)(e,s,n)}),Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c=-1,type:i="thread"}=a,l=Object(r.z)(e);return l&&l.chatId===n&&l.threadId===c&&l.type===i||(e=Object(o.y)(e,n,c,"replyStack",[]),e=d(e=Object(o.o)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(o.O)(e,n,c,i)}),Object(s.b)("openChatWithInfo",(e,t,a)=>{Object(s.g)({...e,isChatInfoShown:!0}),t.openChat(a)}),Object(s.b)("resetChatCreation",e=>({...e,chatCreation:void 0})),Object(s.b)("openNextChat",(e,t,a)=>{const{targetIndexDelta:s,orderedIds:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return void t.openChat({id:n[0]});const o=n.indexOf(c);if(-1===o)return;const i=n[o+s];t.openChat({id:i})});var b=a(6),u=a(19),m=a(5),h=a(3);const O=n.A+n.c;let j;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(o.y)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(o.y)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(o.y)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(!t||!a)return;const s=Object(r.n)(e,t),n=Object(r.Jb)(e,t,a);if(!s||!n)return;const c=Object(h.g)(n,t=>Boolean(s[t]&&Object(r.b)(e,s[t],a).canEdit));return c?Object(o.y)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(r.z)(e)||{};if(!n||!c)return;const o=Object(r.n)(e,n),i=Object(r.Jb)(e,n,c);if(!o||!i)return;const l=Object(r.nb)(e,n,c);let d;if(Object(r.X)(e,n,c)&&l){const e=Object.keys(o),t=e.indexOf(l.toString())+s;d=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(c===b.MAIN_THREAD_ID){const t=Object(r.g)(e,n);d=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Eb)(e,n,c);d=t?t.lastMessageId:void 0}t.setReplyingToId({messageId:d}),t.focusMessage({chatId:n,threadId:c,messageId:d})}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i},forwardMessages:{}}}),Object(s.b)("closeMediaViewer",e=>({...e,mediaViewer:{}})),Object(s.b)("openAudioPlayer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c}=a;return{...e,audioPlayer:{chatId:s,threadId:n,messageId:c}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:n,messageId:c}=a;Object(r.W)(e)?n===e.pollResults.chatId&&c===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}})},450)}),Object(s.b)("closePollResults",e=>{Object(s.g)({...e,pollResults:{}})}),Object(s.b)("focusLastMessage",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===b.MAIN_THREAD_ID){const t=Object(r.g)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Eb)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusNextReply",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:n,threadId:c}=a,i=Object(r.mb)(e,n,c);if(i&&0!==i.length){const a=i.pop();e=Object(o.y)(e,n,c,"replyStack",[...i]),Object(s.g)(e),t.focusMessage({chatId:n,threadId:c,messageId:a})}else t.focusLastMessage()}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=b.MAIN_THREAD_ID,messageListType:i="thread",noHighlight:l,groupedId:d,groupedChatId:m,replyMessageId:h}=a;let{messageId:g}=a;if(void 0!==d){const t=Object(r.J)(e,m,d);t&&t.length&&([g]=t)}const f=Object(r.z)(e),p=!f||n!==f.chatId||c!==f.threadId||i!==f.type;if(j&&(clearTimeout(j),j=void 0),j=window.setTimeout(()=>{let e=Object(s.e)();e=Object(o.Q)(e),e=Object(o.P)(e),Object(s.g)(e)},l?O:1500),e=Object(o.Q)(e,n,g,l),e=Object(o.P)(e,void 0),h){const t=Object(r.mb)(e,n,c)||[];e=Object(o.y)(e,n,c,"replyStack",[...t,h])}p&&(e=Object(o.P)(e,u.b.Static));const I=Object(r.Jb)(e,n,c);if(I&&I.includes(g))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(p&&(e=Object(o.y)(e,n,c,"viewportIds",void 0)),e=Object(o.y)(e,n,c,"outlyingIds",void 0),I&&!p){const t=g>I[0]?u.b.Down:u.b.Up;e=Object(o.P)(e,t)}Object(s.g)(e),t.openChat({id:n,threadId:c}),t.loadViewportMessages()}),Object(s.b)("openForwardMenu",(e,t,a)=>{const{fromChatId:s,messageIds:n,groupedId:c}=a;let o;return c&&(o=Object(r.ab)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:o||n,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:n}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:n,isModalShown:!1}}),t.openChat({id:n}),t.closeMediaViewer(),t.exitMessageSelectMode()}),Object(s.b)("openForwardMenuForSelectedMessages",(e,t)=>{if(!e.selectedMessages)return;const{chatId:a,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:a,messageIds:s})}),Object(s.b)("enterMessageSelectMode",(e,t,a)=>{const{messageId:s}=a||{},n=Object(r.s)(e);return n?Object(o.n)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:n,groupedId:c,childMessageIds:i,withShift:l}=a,d=Object(r.z)(e);if(!d)return;const{chatId:b,threadId:u,type:h}=d;e=Object(o.H)(e,b,u,h,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${m.m?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",o.o),Object(s.b)("openPollModal",e=>({...e,isPollModalOpen:!0})),Object(s.b)("closePollModal",e=>({...e,isPollModalOpen:!1}));Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{query:s}=a,{chatId:n}=e.globalSearch;return Object(o.S)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!n,messages:!0}}:{fetchingStatus:void 0},query:s})}),Object(s.b)("addRecentlyFoundChatId",(e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:n}=e.globalSearch;if(!n)return Object(o.S)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(o.S)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(o.S)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(o.T)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(o.S)(e,{chatId:s,query:void 0,resultsByType:void 0})}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}}),Object(s.b)("openUserInfo",(e,t,a)=>{const{id:s}=a;t.openChat({id:s})});Object(s.b)("openChat",e=>Object(o.gb)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(o.w)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(o.x)(e,s,n)});var g=a(169);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}}),Object(s.b)("closeManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("openChat",(e,t,a)=>{if(!m.k&&!m.l)return;const{id:s}=a;return{...e,isLeftColumnShown:void 0===s}}),Object(s.b)("toggleLeftColumn",e=>({...e,isLeftColumnShown:!e.isLeftColumnShown})),Object(s.b)("addRecentEmoji",(e,t,a)=>{const{emoji:s}=a,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[s]};const c=n.filter(e=>e!==s);return c.unshift(s),c.length>18&&c.pop(),{...e,recentEmojis:c}}),Object(s.b)("addRecentSticker",(e,t,a)=>{const{sticker:s}=a,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[s]}}};const c=n.stickers.filter(e=>e.id!==s.id);return c.unshift(s),{...e,stickers:{...e.stickers,recent:{...n,stickers:c}}}}),Object(s.b)("showNotification",(e,t,a)=>{const s=a,n=[...e.notifications],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,notifications:n}}),Object(s.b)("dismissNotification",e=>{const t=[...e.notifications];return t.pop(),{...e,notifications:t}}),Object(s.b)("showDialog",(e,t,a)=>{const{data:s}=a;if("message"in s&&s.hasErrorKey&&!Object(g.a)(s))return e;const n=[...e.dialogs];if("message"in s){const e=n.findIndex(e=>e.message===s.message);-1!==e&&n.splice(e,1)}return n.push(s),{...e,dialogs:n}}),Object(s.b)("dismissDialog",e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}}),Object(s.b)("toggleSafeLinkModal",(e,t,a)=>{const{url:s}=a;return{...e,safeLinkModalUrl:s}}),Object(s.b)("openHistoryCalendar",(e,t,a)=>{const{selectedAt:s}=a;return{...e,historyCalendarSelectedAt:s}}),Object(s.b)("closeHistoryCalendar",e=>({...e,historyCalendarSelectedAt:void 0})),Object(s.b)("openPaymentModal",(e,t,a)=>{const{messageId:s}=a;return{...e,payment:{...e.payment,messageId:s,isPaymentModalOpen:!0}}}),Object(s.b)("closePaymentModal",e=>{const t=Object(o.i)(e);return Object(o.j)(t)});a(85);var f=a(10),p=a(9);const I=Object(p.h)(e=>e(),1e3,!0),v=Object(p.h)(e=>e(),3e3,!0),y=Object(p.a)(e=>e(),500,!1,!0);async function C(e,t,a){const c=await Object(f.a)("fetchChats",{limit:n.l,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e],serverTimeOffset:Object(s.e)().serverTimeOffset});if(!c)return;const{chatIds:r}=c;r.length>0&&r[0]===t&&r.shift();let i=Object(s.e)();i=Object(o.g)(i,Object(h.c)(c.users,"id")),i=Object(o.N)(i,Object(h.c)(c.chats,"id")),i=Object(o.J)(i,e,r),i=Object(o.K)(i,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==r.length||i.chats.isFullyLoaded[e]||(i={...i,chats:{...i.chats,isFullyLoaded:{...i.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(i)}async function w(e){const t=await Object(f.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(o.g)(c,Object(h.c)(a,"id"))),c=Object(o.I)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function E(e,t,a){const n=Object(s.e)(),c=Object(r.i)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(r.s)(n);e.openChat({id:-1});const l=await Object(f.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(o.I)(Object(s.e)(),l.id,l)),a?e.focusMessage({chatId:l.id,messageId:a}):e.openChat({id:l.id})}Object(s.b)("preloadTopChatMessages",(e,t)=>{(async()=>{const a=[];for(let c=0;c<n.Kb;c++){await Object(p.f)(100);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:o}}=Object(s.e)().chats;if(!c)return;const{chatId:i}=Object(r.z)(e)||{},{pinnedChats:d,otherChats:u}=Object(l.Fb)(n,c,o),m=[...d,...u].find(({id:e})=>e!==i&&!a.includes(e));if(!m)return;a.push(m.id),t.loadViewportMessages({chatId:m.id,threadId:b.MAIN_THREAD_ID})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,o=Object(r.g)(e,s);if(o&&o.hasUnreadMark&&t.toggleChatUnread({id:s}),o)Object(l.pb)(o)&&!o.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(f.a)("fetchChat",{type:"self"});else{const t=Object(r.Ib)(e,s);t&&Object(f.a)("fetchChat",{type:"user",user:t})}if(n!==b.MAIN_THREAD_ID){Object(r.Gb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(r.Bb)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(f.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.Jb})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,n=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const c=n?n.map(t=>e.chats.byId[t]).filter(t=>Boolean(t&&t.lastMessage)&&!Object(r.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;I(c?()=>C(s,c.id,c.lastMessage.date):()=>C(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(r.g)(e,s);c&&(n?w(c):y(()=>w(c)))}),Object(s.b)("loadTopChats",()=>{v(()=>C("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(r.g)(e,n);c&&Object(f.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:n}=e,{chatId:c,isMuted:i}=a,l=Object(r.g)(e,c);l&&(Object(s.g)(Object(o.I)(e,c,{isMuted:i})),Object(f.a)("updateChatMutedState",{chat:l,isMuted:i,serverTimeOffset:n}))}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:l}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const c=await Object(f.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:r,accessHash:i}=c;let l=Object(s.e)();l=Object(o.I)(l,r,c),l={...l,chatCreation:{...l.chatCreation,progress:c?u.a.Complete:u.a.Error}},Object(s.g)(l),Object(s.d)().openChat({id:r}),r&&i&&n&&await Object(f.a)("editChatPhoto",{chatId:r,accessHash:i,photo:n})}(n,l.map(t=>Object(r.Ib)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&Object(f.a)("joinChannel",{channelId:c,accessHash:o})}),Object(s.b)("deleteChatUser",(e,t,a)=>{(async()=>{const{chatId:s,userId:n}=a,c=Object(r.g)(e,s),o=Object(r.Ib)(e,n);if(!c||!o)return;await Object(f.a)("deleteChatUser",{chat:c,user:o});const i=Object(r.z)(e);i&&i.chatId===s&&e.currentUserId===n&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChat",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;await Object(f.a)("deleteChat",{chatId:n.id});const c=Object(r.z)(e);c&&c.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(f.a)("leaveChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(f.a)("deleteChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("createGroupChat",(e,t,a)=>{const{title:n,memberIds:c,photo:i}=a;!async function(e,t,a){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const n=await Object(f.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let r=Object(s.e)();r=Object(o.I)(r,c,n),r={...r,chatCreation:{...r.chatCreation,progress:n?u.a.Complete:u.a.Error}},Object(s.g)(r),Object(s.d)().openChat({id:c}),c&&a&&await Object(f.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(r.Ib)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,o=Object(r.g)(e,s);if(o)if(c){const t=Object(r.j)(e,c);if(t){const a=!Object(r.N)(e,s,c),{pinnedChatIds:n,includedChatIds:o}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...o];Object(f.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(r.k)(e,s),a=Object(r.N)(e,s,"archived"===t?n.i:void 0);Object(f.a)("toggleChatPinned",{chat:o,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(r.g)(e,s);c&&Object(f.a)("toggleChatArchived",{chat:c,folderId:Object(l.kb)(c)?0:n.i})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(f.a)("fetchChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,...e}})}}()}),Object(s.b)("loadRecommendedChatFolders",()=>{!async function(){const e=await Object(f.a)("fetchRecommendedChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()}),Object(s.b)("editChatFolder",(e,t,a)=>{const{id:s,folderUpdate:n}=a,c=Object(r.j)(e,s);c&&Object(f.a)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:c.emoticon,pinnedChatIds:c.pinnedChatIds,...n}})}),Object(s.b)("addChatFolder",(e,t,a)=>{const{folder:c}=a,{orderedIds:o}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(f.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const o=Object(s.e)(),{recommended:r}=o.chatFolders;r&&Object(s.g)({...o,chatFolders:{...o.chatFolders,recommended:r.filter(({id:e})=>e!==a)}})}(c,o&&o.length?Math.max.apply(Math.max,o):n.i)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(r.j)(e,s)&&async function(e){await Object(f.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,{serverTimeOffset:n}=e,c=Object(r.g)(e,s);c&&(c.unreadCount?Object(f.a)("markMessageListRead",{serverTimeOffset:n,chat:c,threadId:b.MAIN_THREAD_ID}):Object(f.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let c=n.ob.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(f.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.pb.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0;E(t,e,a)}}),Object(s.b)("acceptInviteConfirmation",(e,t,a)=>{const{hash:s}=a;(async()=>{const e=await Object(f.a)("importChatInvite",{hash:s});e&&t.openChat({id:e.id})})()}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;E(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:n}=a;let c=Object(r.g)(e,s);c&&(async()=>{if(Object(l.lb)(c)){if(c=await Object(f.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(f.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let d=Object(r.g)(e,n);const b=Object(r.Ib)(e,c);d&&b&&(async()=>{if(Object(l.lb)(d)){if(d=await Object(f.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(f.a)("updateChatMemberBannedRights",{chat:d,user:b,bannedRights:i});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{members:u,kickedMembers:m}=a.fullInfo,h=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...u&&h&&{members:u.filter(e=>e.userId!==c)},...u&&!h&&{members:u.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&m&&{kickedMembers:m.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:d}=a;let b=Object(r.g)(e,n);const u=Object(r.Ib)(e,c);b&&u&&(async()=>{if(Object(l.lb)(b)){if(b=await Object(f.a)("migrateChat",b),!b)return;t.openChat({id:b.id})}await Object(f.a)("updateChatAdmin",{chat:b,user:u,adminRights:i,customTitle:d});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:m}=a.fullInfo,h=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...m&&h&&{adminMembers:m.filter(e=>e.userId!==c)},...m&&!h&&{adminMembers:m.map(e=>e.userId===c?{...e,adminRights:i,customTitle:d}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:l}=a,d=Object(r.g)(e,n);d&&(async()=>{Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress)),await Promise.all([d.title!==c?Object(f.a)("updateChatTitle",d,c):void 0,d.fullInfo&&d.fullInfo.about!==i?Object(f.a)("updateChatAbout",d,i):void 0,l?Object(f.a)("editChatPhoto",{chatId:n,accessHash:d.accessHash,photo:l}):void 0]),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(f.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(o.c)(Object(s.e)(),t);Object(s.g)({...a,chats:{...a.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()}),Object(s.b)("linkDiscussionGroup",(e,t,a)=>{const{channelId:s,chatId:n}=a,c=Object(r.g)(e,s);let o=Object(r.g)(e,n);c&&o&&(async()=>{if(Object(l.lb)(o)){if(o=await Object(f.a)("migrateChat",o),!o)return;t.openChat({id:o.id})}let{fullInfo:e}=o;if(!e){const t=await Object(f.a)("fetchFullChat",o);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(f.a)("togglePreHistoryHidden",{chat:o,isEnabled:!1}),Object(f.a)("setDiscussionGroup",{channel:c,chat:o})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(r.g)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(r.g)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(f.a)("setDiscussionGroup",{channel:n}),c&&w(c)})()}),Object(s.b)("setActiveChatFolder",(e,t,a)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:a}})),Object(s.b)("loadMoreMembers",e=>{(async()=>{const{chatId:t}=Object(r.z)(e)||{},a=t?Object(r.g)(e,t):void 0;if(!a||Object(l.lb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(f.a)("fetchMembers",a.id,a.accessHash,"recent",n);if(!c)return;const{members:i,users:d}=c;i&&i.length&&(e=Object(s.e)(),e=Object(o.g)(e,Object(h.c)(d,"id")),e=Object(o.I)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var M=a(152);const S=new Map,k=Object(p.h)(e=>e(),1e3,!0);async function N(e,t,a,c,i=!1,l=!1){const d=e.id;let b;switch(c){case u.e.Backwards:b=void 0;break;case u.e.Around:b=-(Math.round(n.bb/2)+1);break;case u.e.Forwards:b=-(n.bb+1)}const m=await Object(f.a)("fetchMessages",{chat:Object(r.Fb)(Object(s.e)(),d,t),offsetId:a,addOffset:b,limit:n.bb,threadId:t});if(!m)return;const{messages:O,users:j,chats:g,threadInfos:p}=m,I=Object(h.c)(O,"id"),v=Object.keys(I).map(Number);let y=Object(s.e)();y=Object(o.b)(y,d,I),y=i?Object(o.eb)(y,d,t,v):Object(o.W)(y,d,t,v),y=Object(o.g)(y,Object(h.c)(j,"id")),y=Object(o.c)(y,Object(h.c)(g,"id")),y=Object(o.mb)(y,d,p);let C=Object(r.Y)(y,d,t);const w=Object(r.gb)(y,d,t);if(i&&C&&w&&Object(h.b)(C,w)&&(y=Object(o.W)(y,d,t,w),C=Object(r.Y)(y,d,t),y=Object(o.y)(y,d,t,"outlyingIds",void 0),i=!1),!l){const e=i?w:C,{newViewportIds:s}=T(e,a,c);y=Object(o.A)(y,d,t,s)}Object(s.g)(y)}function T(e,t,a){const{length:s}=e,c=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||a<t&&e[s+1]>t)}(e,t):-1,o=a===u.e.Backwards?c:c+1||s,r=o-n.bb,i=o+n.bb-1,l=e.slice(Math.max(0,r),i+1);let d,b;switch(a){case u.e.Backwards:d=o>0,b=r>=0;break;case u.e.Forwards:d=o<s,b=i<=s-1;break;case u.e.Around:default:d=l.length>0,b=l.length===n.bb}return{newViewportIds:l,areSomeLocal:d,areAllLocal:b}}async function P(e){let t;const a=e.attachment?(e,n)=>{S.has(n)||(t=n,S.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;(e.replyingTo||m.e)&&await Object(p.g)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(r.z)(n);if(!c)return;const{threadId:o}=c;e.replyingTo||o===b.MAIN_THREAD_ID||(e.replyingTo=Object(r.Gb)(n,e.chat.id,o)),await Object(f.a)("sendMessage",e,a),a&&t&&S.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=u.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:l}=a||{};if(!i){const t=Object(r.z)(e);if(!t)return;i=t.chatId,l=t.threadId}const d=Object(r.g)(e,i);if(!d||d.isRestricted)return;const b=Object(r.Jb)(e,i,l),m=Object(r.Y)(e,i,l),h=Object(r.gb)(e,i,l);if(b&&b.length&&s!==u.e.Around){const a=s===u.e.Backwards?b[0]:b[b.length-1],n=Boolean(h),r=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=T(r,a,s);if(j&&(e=Object(o.A)(e,i,l,O)),async function(e,t,a,s,n,c,o,r){t||await N(n,c,r,o,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:o,isBudgetPreload:!0}))}(t,g,n,c,d,l,s,a),c)return}else{const t=Object(r.I)(e,i)||Object(r.lb)(e,i,l),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:b,areSomeLocal:O,areAllLocal:j}=T(s,t,u.e.Around);O&&b.length>=n.bb&&(e=Object(o.A)(e,i,l,b)),j||N(d,l,t,u.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:i}=a,l=Object(r.g)(e,n);l&&async function(e,t,a){const n=await Object(f.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===b.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(r.l)(t,e.id,a);t=Object(o.M)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(o.M)(c,e.id,t,n.message),c=Object(o.g)(c,Object(h.c)(n.users,"id")),Object(s.g)(c)}(l,c,i)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(r.z)(e);if(!s)return;const{chatId:c,threadId:o,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(r.g)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:o,value:!1});const d={...a,chat:l,replyingTo:Object(r.nb)(e,c,o),noWebPage:Object(r.cb)(e,c,o)},b=!a.attachments||a.attachments.length<=1,u=!b&&a.attachments&&a.attachments.length>1;if(b){const{attachments:e,...t}=d;P({...t,attachment:e?e[0]:void 0})}else if(u){const{text:e,entities:t,attachments:a,...s}=d,c=Object(h.n)(a,n.R);for(let a=0;a<c.length;a++){const[n,...o]=c[a],r=`${Date.now()}${a}`;P({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:n,groupedId:o.length>0?r:void 0}),o.forEach(e=>{P({...s,attachment:e,groupedId:r})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=d;e&&P({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{P({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{serverTimeOffset:s}=e,{text:n,entities:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i,threadId:l,type:d}=o,b=Object(r.g)(e,i),u=Object(r.E)(e,i,l,d);b&&u&&(Object(f.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(r.cb)(e,i,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:n}=a,c=Object(r.l)(e,s,n),o=c&&S.get(c.previousLocalId||c.id);o&&Object(f.b)(o),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:n,draft:c}=a;if(!c)return;const{text:i,entities:l}=c,d=Object(r.g)(e,s);return n===b.MAIN_THREAD_ID&&Object(f.a)("saveDraft",{chat:d,text:i,entities:l,replyToMsgId:Object(r.nb)(e,s,n)}),e=Object(o.y)(e,s,n,"draft",c),e=Object(o.I)(e,s,{draftDate:Math.round(Date.now()/1e3)})}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(r.C)(e,s,n))return;const i=Object(r.g)(e,s);return c||n!==b.MAIN_THREAD_ID||Object(f.a)("clearDraft",i),e=Object(o.y)(e,s,n,"draft",void 0),e=Object(o.I)(e,s,{draftDate:void 0})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(o.y)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:o,isSilent:i}=a;Object(f.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:o,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(r.g)(e,a.chatId);n&&async function(e){await Object(f.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(o.y)(t,e.id,b.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(r.z)(e);if(!c)return;const{chatId:o,threadId:i}=c,l=Object(r.g)(e,o);Object(f.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(r.D)(e,o,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c}=n,o=Object(r.g)(e,c);Object(f.a)("deleteScheduledMessages",{chat:o,messageIds:s});const i=Object(r.F)(e,c);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{(async()=>{const{chatId:s,shouldDeleteForAll:n}=a,c=Object(r.g)(e,s);if(!c)return;const o=c.lastMessage&&c.lastMessage.id;await Object(f.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("reportMessages",(e,t,a)=>{(async()=>{const{messageIds:s,reason:n,description:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i}=o,l=Object(r.g)(e,i),d=await Object(f.a)("reportMessages",{peer:l,messageIds:s,reason:n,description:c});t.showNotification({message:d?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:o}=n,i=Object(r.Fb)(e,c,o);if(!i)return;const{maxId:l}=a;k(()=>{Object(f.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:o,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageIds:n}=a;Object(f.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(f.a)("fetchWebPagePreview",{message:e});Object(s.g)({...Object(s.e)(),webPagePreview:t})}(n)}),Object(s.b)("clearWebPagePreview",e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}}),Object(s.b)("sendPollVote",(e,t,a)=>{const{chatId:s,messageId:n,options:c}=a,o=Object(r.g)(e,s);o&&Object(f.a)("sendPollVote",{chat:o,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:r,offset:i,limit:l,shouldResetVoters:d}=a;!async function(e,t,a,n,c,r){const i=await Object(f.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(o.g)(l,Object(h.c)(i.users,"id"));const{voters:d}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...d,[a]:[...!r&&d&&d[a]?d[a]:[],...i&&i.users.map(e=>e.id)].filter((e,t,a)=>a.indexOf(e)===t)},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[a]:i.nextOffset||""}}})}(n,c,r,i,l,d)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(r.g)(e,t):void 0,o=n?Object(r.g)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(r.l)(e,t,a)).filter(Boolean):void 0;c&&o&&i&&i.length&&function(e,t,a){Object(f.a)("forwardMessages",{fromChat:e,toChat:t,messages:a,serverTimeOffset:Object(s.e)().serverTimeOffset}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,o,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(r.s)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(f.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,r=Object(h.c)(c,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.v)(l,e.id,r,n),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(l)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(r.g)(e,s);c&&Object(f.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,o=Object(r.g)(e,s),i=o&&Object(r.qb)(e,o.id,n);o&&i&&Object(f.a)("rescheduleMessage",{chat:o,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(r.Fb)(e,s,n);c&&Object(f.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(r.g)(e,n);c&&async function(e){const t=await Object(f.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,r=Object(h.c)(a,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.b)(l,e.id,r),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"pinnedIds",i),l=Object(o.g)(l,Object(h.c)(c,"id")),l=Object(o.c)(l,Object(h.c)(n,"id")),Object(s.g)(l)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(r.g)(e,n),o=Object(r.l)(e,n,s);c&&o&&(async()=>{const e=await Object(f.a)("fetchMessageLink",{chat:c,message:o});e&&Object(M.c)(e.link)})()});var A=a(53);const x=Object(p.h)(e=>e(),500,!1);async function R(e,t){const a=await Object(f.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(o.R)(Object(s.e)(),!t,a.gifs,a.nextOffset))}Object(s.b)("loadStickerSets",e=>{const{hash:t}=e.stickers.added||{};!async function(e=0){const t=await Object(f.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"added",t.hash,t.sets))}(t)}),Object(s.b)("loadAddedStickers",(e,t)=>{const{setIds:a}=e.stickers.added;a&&a.length&&(async()=>{for(let e=0;e<a.length;e++)t.loadStickers({stickerSetId:a[e]}),e%50==0&&e>0&&await Object(p.f)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(f.a)("fetchRecentStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,recent:t}})}(t)}),Object(s.b)("loadFavoriteStickers",e=>{const{hash:t}=e.stickers.favorite||{};!async function(e=0){const t=await Object(f.a)("fetchFavoriteStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,favorite:t}})}(t)}),Object(s.b)("loadFeaturedStickers",e=>{const{hash:t}=e.stickers.featured||{};!async function(e=0){const t=await Object(f.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"featured",t.hash,t.sets))}(t)}),Object(s.b)("loadStickers",(e,t,a)=>{const{stickerSetId:n}=a;let{stickerSetAccessHash:c}=a;if(!c){const t=Object(r.yb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(f.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:n,stickers:c,packs:r}=a;let i=Object(s.e)();i=Object(o.ib)(i,n.id,{...n,stickers:c,packs:r});const l=i.stickers.forEmoji.emoji;l&&r[l]&&(i=Object(o.p)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(f.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(o.r)(Object(s.e)(),{...t,stickers:a}))}()}),Object(s.b)("loadSavedGifs",e=>{const{hash:t}=e.gifs.saved;!async function(e=0){const t=await Object(f.a)("fetchSavedGifs",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,gifs:{...a.gifs,saved:t}})}(t)}),Object(s.b)("faveSticker",(e,t,a)=>{const{sticker:s}=a;s&&Object(f.a)("faveSticker",{sticker:s})}),Object(s.b)("unfaveSticker",(e,t,a)=>{const{sticker:n}=a;n&&function(e){const t=Object(s.e)();Object(s.g)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter(({id:t})=>t!==e.id)}}}),Object(f.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(r.yb)(e,s);if(!n)return;const{accessHash:c,installedDate:o}=n;Object(f.a)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=e.emojiKeywords[n];c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(f.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=e.emojiKeywords[n],t?Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:t.version,keywords:{...c&&c.keywords,...t.keywords}}}}):Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!1}}})})())}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:n}=a;n&&x(()=>{!async function(e,t=0){const a=await Object(f.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:r}=n.stickers,i=a.sets.map(({id:e})=>e);r.setIds&&r.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(A.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(o.jb)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&x(()=>{R(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&x(()=>{R(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;x(()=>{!async function(e,t=0){let a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,forEmoji:{...a.stickers.forEmoji,emoji:e}}});const n=await Object(f.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(o.kb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var L=a(39);const D=Object(p.h)(e=>e(),500,!1);async function F(e="",t,a,c,i,l){let d;if(c){const s=await Object(f.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.E,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;d={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else d=await Object(f.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.E,type:t,maxDate:i,minDate:l});let b=Object(s.e)();const u=Object(r.u)(b);if(!d||""!==e&&e!==u)return void Object(s.g)(Object(o.U)(b,{messages:!1}));const{messages:m,users:O,chats:j,totalCount:g,nextRate:p}=d;j.length&&(b=Object(o.c)(b,Object(h.c)(j,"id"))),O.length&&(b=Object(o.g)(b,Object(h.c)(O,"id"))),m.length&&(b=Object(o.d)(b,m)),b=Object(o.V)(b,m,g,t,p),Object(s.g)(b)}async function B(){const e=await Object(f.a)("fetchChats",{limit:n.l,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(o.pb)(t,Object(h.c)(e.users,"id")),t=Object(o.N)(t,Object(h.c)(e.chats,"id")),t=Object(o.s)(t,"archived",e.chatIds),t=Object(o.K)(t,"archived",e),Object(s.g)(t)}async function U(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const n=[...t||[],...a||[]].map(t=>Object(r.Ib)(e,t)).filter(Boolean),c=await Object(f.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(o.pb)(e,Object(h.c)(c,"id")),Object(s.g)(e))}function H(e){return Object(f.a)("fetchMessages",{chat:e,threadId:b.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.bb/2)+1),limit:n.bb})}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&D(()=>{!async function(e){const t=await Object(f.a)("searchChats",{query:e});let a=Object(s.e)();const n=Object(r.u)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(o.U)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:d}=t;(c.length||l.length)&&(a=Object(o.c)(a,Object(h.c)([...c,...l],"id")));(i.length||d.length)&&(a=Object(o.g)(a,Object(h.c)([...i,...d],"id")));a=Object(o.U)(a,{chats:!1}),a=Object(o.S)(a,{localResults:{chatIds:c.map(({id:e})=>e),userIds:i.map(({id:e})=>e)},globalResults:{...a.globalSearch.globalResults,chatIds:d.map(({id:e})=>e),userIds:l.map(({id:e})=>e)}}),Object(s.g)(a)}(c)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(L.m)(n):n,i=Object(o.S)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;F("","text",void 0,l?Object(r.g)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:o}=e.globalSearch,i=o?Object(L.m)(o):o,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};F(s,l,d,c?Object(r.g)(e,c):void 0,i,o)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},c=t?Object(r.g)(e,t):void 0,i=Object(r.B)(e);if(!c||!i||!a)return;const{query:l,results:d}=i,u=d?d.nextOffsetId:void 0;let m;if(a!==b.MAIN_THREAD_ID){const s=Object(r.Eb)(e,t,a);m=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(f.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.db,offsetId:i});if(!l)return;const{messages:d,users:b,totalCount:u,nextOffsetId:m}=l,O=Object(h.c)(d,"id"),j=Object.keys(O).map(Number);let g=Object(s.e)();const p=Object(r.B)(g);if(!p||c&&c!==p.query)return;g=Object(o.b)(g,e.id,O),g=Object(o.g)(g,Object(h.c)(b,"id")),g=Object(o.ab)(g,e.id,t,j,u,m),Object(s.g)(g)}(c,a,m,l,u)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(r.x)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(r.w)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,d=i&&l&&l[i],b=d?d.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(f.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.vb,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:d,nextOffsetId:b}=c,u=Object(h.c)(i,"id"),m=Object.keys(u).map(Number);let O=Object(s.e)();if(!Object(r.w)(O))return;O=Object(o.b)(O,e.id,u),O=Object(o.g)(O,Object(h.c)(l,"id")),O=Object(o.X)(O,e.id,t,m,d,b),Object(s.g)(O)}(a,i,b)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return;const o=Object(r.g)(e,c);o&&async function(e,t){const a=await Object(f.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(o,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};if(!n)return;if(e.management.progress===u.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(o.cb)(e,u.f.InProgress),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(f.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(o.cb)(e,t?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};let c=n&&Object(r.g)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(o.cb)(e,u.f.InProgress),Object(s.g)(e),Object(l.lb)(c)){if(c=await Object(f.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(f.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(o.cb)(e,a?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(r.z)(e)||{},a=t&&Object(r.g)(e,t);t&&a&&Object(f.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.r&&console.log(">>> START SYNC");await Object(f.a)("fetchCurrentUser");const t=await async function(){const e=await Object(f.a)("fetchChats",{limit:n.l,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:i}=t,d=[...a||[],...c||[],...i?[i]:[]],u=d.map(e=>Object(r.Ib)(t,e)).filter(Boolean),m=d.map(e=>Object(r.g)(t,e)).filter(Boolean),{chatId:O}=Object(r.z)(t)||{};if(O){const e=Object(r.g)(t,O);if(e&&!d.includes(O)&&m.push(e),Object(l.ob)(O)){const e=Object(r.Ib)(t,O);e&&!d.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(o.t)(t,Object(h.c)(m,"id")),t=Object(o.s)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(o.K)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"replyingToId",e.replyingToById[a])}),Object(s.g)(t),O&&!t.chats.byId[O]&&Object(s.d)().openChat({id:void 0});return u}();await async function(e){let t=!1,a=e||[],n=Object(s.e)();const{chatId:c,threadId:i}=Object(r.z)(n)||{},l=Object.keys(n.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(r.C)(n,t,b.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(c){const e=await H(n.chats.byId[c]);n=Object(s.e)();const{chatId:l}=Object(r.z)(n)||{},d=i&&Object(r.Eb)(n,c,i);if(e&&l===c){const s=n.messages.byChatId[c],r=Object(h.c)(e.messages,"id"),l=Object.keys(r).map(Number);if(n={...n,messages:{...n.messages,byChatId:{[c]:{byId:r,threadsById:{[b.MAIN_THREAD_ID]:{...s&&s.threadsById[b.MAIN_THREAD_ID],listedIds:l,viewportIds:l,outlyingIds:void 0}}}}}},i&&d&&d.originChannelId){const{originChannelId:e}=d,t=n.messages.byChatId[e],a=await H(n.chats.byId[e]);if(a){const e=Object(h.c)(a.messages,"id"),o=Object.keys(e).map(Number);n={...n,messages:{...n.messages,byChatId:{...n.messages.byChatId,[d.originChannelId]:{byId:e,threadsById:{[b.MAIN_THREAD_ID]:{...t&&t.threadsById[b.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}},[c]:{...n.messages.byChatId[c],threadsById:{...n.messages.byChatId[c].threadsById,[i]:{...s&&s.threadsById[i],outlyingIds:void 0}}}}}}}}n=Object(o.N)(n,Object(h.c)(e.chats,"id")),n=Object(o.mb)(n,c,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(l).map(Number).forEach(e=>{n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"draft",l[e])}),e?n=Object(o.z)(n,Object(h.c)(a,"id")):a&&(n=Object(o.pb)(n,Object(h.c)(a,"id")));Object(s.g)(n);const{chatId:d,messageId:u}=n.audioPlayer;d&&u&&!Object(r.l)(n,d,u)&&Object(s.d)().closeAudioPlayer()}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.r&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.r&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([U(),B()]),await Object(f.a)("fetchCurrentUser"),n.r&&console.log(">>> FINISH AFTER-SYNC")}(t)});const q=Object(p.a)(e=>e(),500,!1,!0);function G(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,o={visibility:t};let r,i;const d=e=>{if(!Object(l.ob)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},b=e=>{if(Object(l.ob)(e))return;const t=c[e];return t?{id:t.id}:void 0};return"contacts"!==t&&"nobody"!==t||(r=a.map(d).filter(Boolean),i=a.map(b).filter(Boolean),r.length>0&&(o.allowedUsers=r),i.length>0&&(o.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(r=s.map(d).filter(Boolean),i=s.map(b).filter(Boolean),r.length>0&&(o.blockedUsers=r),i.length>0&&(o.blockedChats=i)),o}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(r.Ib)(e,s);if(!n)return;const{id:c,accessHash:o}=n;q(()=>Object(f.a)("fetchFullUser",{id:c,accessHash:o}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(r.Ib)(e,n);c&&(async()=>{const t=await Object(f.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(o.pb)(e,Object(h.c)(t,"id")),Object(s.g)(e))})()}),Object(s.b)("loadTopUsers",e=>{const{serverTimeOffset:t,topPeers:{hash:a,lastRequestedAt:n}}=e;(!n||Date.now()/1e3+t-n>60)&&async function(e){const t=await Object(f.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let r=Object(s.e)();r=Object(o.g)(r,Object(h.c)(c,"id")),r={...r,topPeers:{...r.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+r.serverTimeOffset}},Object(s.g)(r)}(a)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(f.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(o.g)(Object(s.e)(),Object(h.c)(t.users,"id"));a=Object(o.c)(a,Object(h.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),r=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:r.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(f.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:l}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(r.Ib)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress));await Object(f.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(o.ob)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))}(n,c,i,l)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(r.Ib)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(f.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(l.ob)(n),i=c?Object(r.Ib)(e,n):void 0,d=c?void 0:Object(r.g)(e,n);(async()=>{const e=await Object(f.a)("fetchProfilePhotos",i,d);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(o.ob)(t,n,{photos:e.photos}):(t=Object(o.g)(t,Object(h.c)(e.users,"id")),t=Object(o.I)(t,n,{photos:e.photos})),Object(s.g)(t)})()}),Object(s.b)("clickInlineButton",(e,t,a)=>{const{button:c}=a;switch(c.type){case"command":t.sendBotCommand({command:c.value});break;case"url":c.value.match(n.ob)||c.value.match(n.pb)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(r.s)(e);if(!t)return;!async function(e,t,a){const n=await Object(f.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:o}=n;o?Object(s.d)().showDialog({data:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(r.s)(e),{messageId:s,value:n}=c;if(!a)return;n?t.getReceipt({receiptMessageId:n,chatId:a.id,messageId:s}):(t.getPaymentForm({messageId:s}),t.setInvoiceMessageInfo(Object(r.l)(e,a.id,s)),t.openPaymentModal({messageId:s}));break}}}),Object(s.b)("sendBotCommand",(e,t,a)=>{const{command:s}=a,{currentUserId:n}=e,c=Object(r.s)(e);n&&c&&async function(e,t,a){await Object(f.a)("sendMessage",{chat:e,text:a})}(c,0,s)}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:n,firstName:c,lastName:i,bio:l,username:d}=a;(async()=>{const{currentUserId:t}=e;if(t){if(Object(s.g)({...Object(s.e)(),profileEdit:{progress:u.j.InProgress}}),n&&await Object(f.a)("updateProfilePhoto",n),c||i||l){if(await Object(f.a)("updateProfile",{firstName:c,lastName:i,about:l})){e=Object(s.e)();const a=t&&Object(r.Ib)(e,t);a&&Object(s.g)(Object(o.ob)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:l}}))}}if(d){await Object(f.a)("updateUsername",d)&&t&&Object(s.g)(Object(o.ob)(Object(s.e)(),t,{username:d}))}Object(s.g)({...Object(s.e)(),profileEdit:{progress:u.j.Complete}})}})()}),Object(s.b)("checkUsername",(e,t,a)=>{const{username:n}=a;(async()=>{if(e.profileEdit&&e.profileEdit.progress===u.j.InProgress)return;Object(s.g)({...e,profileEdit:{progress:e.profileEdit?e.profileEdit.progress:u.j.Idle,isUsernameAvailable:void 0}});const t=await Object(f.a)("checkUsername",n);e=Object(s.e)(),Object(s.g)({...e,profileEdit:{...e.profileEdit,isUsernameAvailable:t}})})()}),Object(s.b)("loadWallpapers",()=>{(async()=>{const e=await Object(f.a)("fetchWallpapers",0);if(!e)return;const t=Object(s.e)();Object(s.g)({...t,settings:{...t.settings,loadedWallpapers:e.wallpapers}})})()}),Object(s.b)("uploadWallpaper",(e,t,a)=>{const n=a,c=URL.createObjectURL(n);Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[{slug:u.n,document:{fileName:"",size:n.size,mimeType:n.type,previewBlobUrl:c}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(f.a)("uploadWallpaper",n);if(!t)return;const{wallpaper:a}=t;if(!(e=Object(s.e)()).settings.loadedWallpapers)return;const o=e.settings.loadedWallpapers[0];if(!o||o.slug!==u.n)return;const r={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[r,...e.settings.loadedWallpapers.slice(1)]}})})()}),Object(s.b)("loadBlockedContacts",()=>{(async()=>{const e=await Object(f.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(o.g)(t,Object(h.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(o.N)(t,Object(h.c)(e.chats,"id"))),t={...t,blocked:{...t.blocked,ids:[...t.blocked.ids||[],...e.blockedIds],totalCount:e.totalCount}},Object(s.g)(t)})()}),Object(s.b)("blockContact",(e,t,a)=>{const{contactId:n}=a;(async()=>{if(!await Object(f.a)("blockContact",n))return;const e=Object(s.e)();Object(s.g)(Object(o.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(l.ob)(n)){const t=Object(r.Ib)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(f.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(o.q)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(f.a)("fetchAuthorizations");e&&Object(s.g)({...Object(s.e)(),activeSessions:e})})()}),Object(s.b)("terminateAuthorization",(e,t,a)=>{const{hash:n}=a;(async()=>{if(!await Object(f.a)("terminateAuthorization",n))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.hash!==n)})})()}),Object(s.b)("terminateAllAuthorizations",()=>{(async()=>{if(!await Object(f.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationExceptions",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(f.a)("fetchNotificationExceptions",{serverTimeOffset:t});e&&Object(s.g)(Object(o.f)(Object(s.e)(),e))})()}),Object(s.b)("loadNotificationSettings",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(f.a)("fetchNotificationSettings",{serverTimeOffset:t});e&&Object(s.g)(Object(o.w)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:r}=a;(async()=>{await Object(f.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:r})&&Object(s.g)(Object(o.db)(Object(s.e)(),n,c,r))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(f.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(o.w)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(f.a)("fetchLanguages");e&&Object(s.g)(Object(o.w)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(f.a)("fetchPrivacySettings","phoneNumber"),Object(f.a)("fetchPrivacySettings","lastSeen"),Object(f.a)("fetchPrivacySettings","profilePhoto"),Object(f.a)("fetchPrivacySettings","forwards"),Object(f.a)("fetchPrivacySettings","chatInvite")]);if(!(e&&t&&a&&n&&c))return;const o=Object(s.e)();o.settings.privacy.phoneNumber=e,o.settings.privacy.lastSeen=t,o.settings.privacy.profilePhoto=a,o.settings.privacy.forwards=n,o.settings.privacy.chatInvite=c,Object(s.g)(o)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const r=G(e,{visibility:c,allowedIds:[...o.allowUserIds,...o.allowChatIds],deniedIds:[...o.blockUserIds,...o.blockChatIds]});(async()=>{const e=await Object(f.a)("setPrivacySettings",n,r);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("setPrivacySettings",(e,t,a)=>{const{privacyKey:n,isAllowList:c,contactsIds:o}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const i=G(e,{visibility:r.visibility,allowedIds:c?o:[...r.allowUserIds,...r.allowChatIds],deniedIds:c?[...r.blockUserIds,...r.blockChatIds]:o});(async()=>{const e=await Object(f.a)("setPrivacySettings",n,i);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("updateIsOnline",(e,t,a)=>{Object(f.a)("updateIsOnline",a)}),Object(s.b)("loadContentSettings",()=>{(async()=>{const e=await Object(f.a)("fetchContentSettings");e&&Object(s.g)(Object(o.w)(Object(s.e)(),e))})()}),Object(s.b)("updateContentSettings",(e,t,a)=>{(async()=>{Object(s.g)(Object(o.w)(Object(s.e)(),{isSensitiveEnabled:a}));await Object(f.a)("updateContentSettings",a)||Object(s.g)(Object(o.w)(Object(s.e)(),{isSensitiveEnabled:!a}))})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(f.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(o.w)(t,{hasPassword:e.hasPassword}),t=Object(o.nb)(t,{hint:e.hint}),Object(s.g)(t)})()}),Object(s.b)("checkPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("checkPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("clearPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:r,email:i,onSuccess:l}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("updatePassword",n,c,r,i);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:r}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(f.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(f.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(o.nb)(e,{error:void 0}));var _=a(61);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(r.hb)(e);i&&async function(e,t,a){const n=await Object(f.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:r}=n;if(!c)return;let i=Object(o.F)(Object(s.e)(),c);r?(i=Object(o.hb)(i,r),i=Object(o.D)(i,u.i.Shipping)):i=Object(o.D)(i,u.i.PaymentInfo);Object(s.g)(i)}(i,n,c)}),Object(s.b)("getPaymentForm",(e,t,a)=>{const{messageId:n}=a;n&&async function(e){const t=await Object(f.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(o.C)(Object(s.e)(),t),n=u.i.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=u.i.ShippingInfo);a=Object(o.D)(a,n),Object(s.g)(a)}(n)}),Object(s.b)("getReceipt",(e,t,a)=>{const{receiptMessageId:n,chatId:c,messageId:i}=a;i&&n&&c&&async function(e,t,a){const n=await Object(f.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(r.l)(c,a,e);c=Object(o.E)(c,n,i),Object(s.g)(c)}(i,n,c)}),Object(s.b)("clearPaymentError",e=>{Object(s.g)({...e,payment:{...e.payment,error:void 0}})}),Object(s.b)("clearReceipt",e=>{Object(s.g)({...e,payment:{...e.payment,receipt:void 0}})}),Object(s.b)("sendCredentialsInfo",(e,t,a)=>{const n=Object(r.kb)(e);if(!n)return;const{credentials:c}=a,{data:i}=c;!async function(e,t){const a=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}),n=await fetch("https://api.stripe.com/v1/tokens"+a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+t}}),c=await n.json();if(c.error){const e=Object(_.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let r=Object(o.G)(Object(s.e)(),{type:c.type,id:c.id});r=Object(o.D)(r,u.i.Checkout),Object(s.g)(r)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(r.hb)(e),l=Object(r.ib)(e),d=Object(r.kb)(e),b=Object(r.Ab)(e);i&&d&&async function(e,t,a,n){if(await Object(f.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(o.i)(Object(s.e)());Object(s.g)(Object(o.j)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(o.D)(e,a.step||u.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(o.B)(e,a));a(86);var z=a(31),$=a(78);const W=Object(p.h)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(r.M)(e,a.id)||t.loadTopChats();const n=Object(o.I)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(r.r)(n);W(()=>Object($.a)(c));break}case"updateChatJoin":{const n=Object(r.k)(e,a.id);if(!n)break;e=Object(o.J)(e,n,[a.id]),e=Object(o.I)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(r.g)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(r.k)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(o.s)(e,t,n.filter(e=>e!==a.id))),e=Object(o.I)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(o.I)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(o.I)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(r.g)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(o.I)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:i,type:l}=Object(r.z)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const d=Object(r.g)(e,a.chatId);if(!d)return;const u="thread"===l&&i===b.MAIN_THREAD_ID&&a.chatId===c;u?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(o.I)(e,a.chatId,{unreadCount:d.unreadCount?d.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:d.unreadMentionsCount?d.unreadMentionsCount+1:1}}));const m=Object(r.r)(Object(s.e)());Object($.a)(m),Object(z.b)({chat:d,message:n,isActiveChat:u});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:n}=a;if(!1!==n.hasUnreadMention)return;t.forEach(t=>{const s="channelId"in a?a.channelId:Object(r.q)(e,t),n=Object(r.g)(e,s);n&&n.unreadMentionsCount&&(e=Object(o.I)(e,s,{unreadMentionsCount:n.unreadMentionsCount-1}))}),Object(s.g)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=a,n=e.chats.byId[a.id];if(!n)return;Object(s.g)(Object(o.I)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,o=c===n.i?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,o=Object(r.k)(e,t);if(o){const{[o]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===o&&s.length>=n.Q){const t=e.chats.listIds.active;s=s.filter(e=>t&&t.includes(e))}s=[t,...s]}}else s=s.filter(e=>e!==t);e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(o.L)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:o}=e.chatFolders,r=n?{...c,[t]:n}:Object(h.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?o&&o.includes(t)?o:[...o||[],t]:o?o.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:i}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{const t=e.chats.byId[a.id],{replacedMembers:n,addedMember:c,deletedMemberId:r}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(n)l=n,i=!0;else if(c)l.length&&l.some(e=>e.userId===c.userId)||(l.push(c),i=!0);else if(l.length&&r){const e=l.findIndex(e=>e.userId===r);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(o.I)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:n}=a,c=e.chats.byId[t];c&&c.photos&&Object(s.g)(Object(o.I)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,date:c,replyingToId:r}=a;e.chats.byId[t]&&(e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"draft",n),e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"replyingToId",r),e=Object(o.I)(e,t,{draftDate:c}),Object(s.g)(e));break}case"showInvite":{const{data:e}=a;t.showDialog({data:e});break}}});function V(e,t,a,s,n=!1){const c=n?Object(r.qb)(e,t,a):Object(r.l)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(l.v)(c);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:a&&s.content.sticker?s.content.sticker.isPreloadedGlobally=a.isPreloadedGlobally:n&&s.content.document&&(s.content.document.previewBlobUrl=n.previewBlobUrl)}return n?Object(o.fb)(e,t,a,s):Object(o.M)(e,t,a,s)}function K(e,t){const{id:a,chatId:s}=t,n=Object(r.g)(e,s);if(n&&n.unreadCount&&!Object(r.Y)(e,s,b.MAIN_THREAD_ID))return e;if(e=Object(o.W)(e,s,b.MAIN_THREAD_ID,[a]),Object(r.X)(e,s,b.MAIN_THREAD_ID)){const t=Object(r.H)(e,s,b.MAIN_THREAD_ID),n=Object(o.h)(e,s,b.MAIN_THREAD_ID,a),c=Object(r.Jb)(n,s,b.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:i}=Object(r.Db)(e,s,t)||{};return!i&&Object(l.xb)(t)||c&&(e=Object(o.W)(e,s,c.threadId,[a]),Object(r.X)(e,s,c.threadId)&&(e=Object(o.h)(e,s,c.threadId,a),i||(e=Object(o.y)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(o.y)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function Q(e,t,a,s=!1){const{chats:n}=e,c=n.byId[t]&&n.byId[t].lastMessage;if(c&&!s){if(!(c.id===a.id||c.id===a.previousLocalId||a.id>c.id))return e}return Object(o.I)(e,t,{lastMessage:a})}function Y(e,t){const a=Object(r.n)(e,t),s=Object(r.Y)(e,t,b.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function J(e,t,a,n){if(e){t.forEach(t=>{const a=Y(n=Object(o.M)(n,e,t,{isDeleting:!0}),e);a&&(n=Q(n,e,a,!0))}),Object(s.g)(n),a.requestChatUpdate({chatId:e});const c=[];return t.forEach(t=>{const a=Object(r.l)(n,e,t);if(!a)return;const{threadInfo:s}=Object(r.Db)(n,e,a)||{};s&&c.push(s.threadId)}),Object(h.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(r.q)(n,e);if(t){c.push(t);const a=Y(n=Object(o.M)(n,t,e,{isDeleting:!0}),t);a&&(n=Q(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(h.o)(c).forEach(e=>{a.requestChatUpdate({chatId:e})})}Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:c,message:i}=a;e=K(e=V(e,n,c,i),i),i.threadInfo&&(e=Object(o.lb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const d=Object(r.l)(e,n,c);if(Object(r.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(r.z)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(r.Db)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(l.xb)(i)||setTimeout(()=>{Object(s.g)(Q(Object(s.e)(),n,d))},350)}else Object(s.g)(Q(Object(s.e)(),n,d));Object(r.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=V(e,t,n,c,!0);const i=Object(r.pb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",Object(h.o)([...i,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.l)(e,t,n))return;e=V(e,t,n,c);const i=Object(r.l)(e,t,n);c.threadInfo&&(e=Object(o.lb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=Q(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.qb)(e,t,n))return;e=V(e,t,n,c,!0);const i=Object.keys(Object(r.rb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=K(e,c);const i=Object(r.l)(e,t,n);e=Object(o.k)(e,t,[n]),c.isScheduled&&(e=Object(o.l)(e,t,[n])),e=Object(o.M)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(r.l)(e,t,c.id);e=Q(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,i=Object(r.pb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",[...i,c.id]);const l=Object(r.qb)(e,t,n);e=Object(o.l)(e,t,[n]),e=Object(o.fb)(e,t,c.id,{...l,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,i=Object(r.jb)(e,t)||[],l=n?[...i,...c].sort((e,t)=>t-e):i.filter(e=>!c.includes(e));Object(s.g)(Object(o.y)(e,t,b.MAIN_THREAD_ID,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(r.Eb)(e,t,n),...c};if(!l.threadId)return;e=Object(o.lb)(e,t,n,l),i&&(e=Object(o.y)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(r.n)(e,n);c&&!Object(l.ob)(n)&&(e=Object(o.k)(e,n,Object.keys(c).map(Number)),Object(s.g)(e),t.loadFullChat({chatId:n,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:n}=a;J(n,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){if(!e)return;t.forEach(t=>{n=Object(o.fb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(o.l)(Object(s.e)(),e,t);const a=Object(r.rb)(n,e);n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"scheduledIds",Object.keys(a||{}).map(Number)),Object(s.g)(n)},350)}(n,t,0,e);break}case"deleteHistory":{const{chatId:s}=a,n=e.messages.byChatId[s];if(n){J(s,Object.keys(n.byId).map(Number),t,e)}else t.requestChatUpdate({chatId:s});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(r.q)(e,t);a&&(e=Object(o.M)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(o.M)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(r.m)(e,t);if(c&&c.content.poll){const t={...c.content.poll,...n},{results:a}=t.results||{};if(a&&!a.some(e=>e.isChosen)){const{results:e}=c.content.poll.results,s=e&&e.filter(e=>e.isChosen);s&&s.forEach(e=>{const s=a.findIndex(t=>t.option===e.option);s>=0&&(t.results.results[s].isChosen=!0)})}Object(s.g)(Object(o.M)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(r.m)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:l}=i.content,{recentVoterIds:d,totalVoters:b,results:u}=l.results,m=d?[...d]:[],h=b?b+1:1,O=u?[...u]:[];m.push(n),c.forEach(t=>{const a=O.find(e=>e.option===t),s=O.findIndex(e=>e.option===t),c=a?{...a}:{option:t,votersCount:0};c.votersCount+=1,n===e.currentUserId&&(c.isChosen=!0),s?O[s]=c:O.push(c)}),Object(s.g)(Object(o.M)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const X=Object(p.h)((function(){let e=Object(s.e)();Z.forEach(([t,a])=>{e=Object(o.ob)(e,t,{status:a})}),Object(s.g)(e),Z=[]}),3e3,!0);let Z=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(o.m)(e,a.id);case"updateUser":return Object(o.ob)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,Z.push([s,n]),void X();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(o.ob)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(o.ib)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(o.a)(Object(s.e)(),a.id):Object(o.q)(Object(s.e)(),a.id);case"updateResetContactList":Object(s.g)({...Object(s.e)(),contactList:{hash:0,userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[a.key]=a.rules}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateNotifySettings":return Object(o.db)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:c,shouldShowPreviews:r}=a;e.chats.byId[t]&&(e=Object(o.I)(e,t,{isMuted:n})),Object(s.g)(Object(o.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:r}));break}}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var ee=a(50),te=a(8),ae=a(38),se=a(122);function ne(e){Object(c.n)(()=>Object(p.c)(e),[e])}var ce=a(48),oe=a(110);var re=a(37),ie=a(26),le=a(44),de=a(36),be=a(63),ue=a(42),me=a(24),he=a(153),Oe=a(140);a(197);var je=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:o,inactive:r,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(te.a)("Switcher",o&&"disabled",r&&"inactive",i&&"no-animation");return c.a.createElement("label",{className:u,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:o,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(198);const ge=[0,1,2];var fe=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:o}=e.chats,{animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:o,globalSearchChatId:s,searchDate:n,theme:Object(r.Cb)(e),animationLevel:i}},(e,t)=>Object(h.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:o,onSelectArchived:r,setGlobalSearchChatId:i,onReset:d,searchQuery:b,isLoading:h,shouldSkipTransition:O,currentUserId:j,globalSearchChatId:g,searchDate:f,theme:p,animationLevel:I,chatsById:v,openChat:y,openTipsChat:C,setGlobalSearchDate:w,setSettingOption:E})=>{const M=Object(ie.a)(),S=e===u.d.ChatList,k={date:void 0},N={id:void 0},T=Object(c.p)(()=>f?Object(L.a)(new Date(1e3*f)):void 0,[f]),P=Object(c.p)(()=>S&&v?Object.values(v).reduce((e,t)=>Object(l.kb)(t)&&t.unreadCount?e+1:e,0):0,[S,v]),A="web.telegram.org"===window.location.hostname,x=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(me.a,{round:!0,ripple:S&&!m.k,size:"smaller",color:"translucent",className:t?"active":"",onClick:S?e:()=>d(),ariaLabel:S?M("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(te.a)("animated-menu-icon",!S&&"state-back",O&&"no-animation")})),[S,M,d,O]),R=Object(c.m)(()=>{b||a("")},[b,a]),D=Object(c.m)(()=>{y({id:j})},[j,y]),F=Object(c.m)(e=>{e.stopPropagation();const t="light"===p?"dark":"light";E({theme:t}),E({shouldUseSystemTheme:!1}),Object(le.a)(t,I===n.e)},[I,E,p]),B=Object(c.m)(e=>{e.stopPropagation();const t=0===I?2:0;ge.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),E({animationLevel:t})},[I,E]),U=Boolean(g)||e===u.d.GlobalSearch||e===u.d.Contacts,H=e===u.d.Contacts?M("SearchFriends"):M("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(be.a,{trigger:x,footer:`${n.g} alpha ${n.h}`},c.a.createElement(ue.a,{icon:"saved-messages",onClick:D},M("SavedMessages")),c.a.createElement(ue.a,{icon:"archive",onClick:r},c.a.createElement("span",{className:"menu-item-name"},M("ArchivedChats")),P>0&&c.a.createElement("div",{className:"archived-badge"},P)),c.a.createElement(ue.a,{icon:"user",onClick:o},M("Contacts")),c.a.createElement(ue.a,{icon:"settings",onClick:s},M("Settings")),c.a.createElement(ue.a,{icon:"darkmode",onClick:F},c.a.createElement("span",{className:"menu-item-name"},M("lng_menu_night_mode")),c.a.createElement(je,{id:"darkmode",label:M("dark"===p?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===p,noAnimation:!0})),c.a.createElement(ue.a,{icon:"animations",onClick:B},c.a.createElement("span",{className:"menu-item-name capitalize"},M("Appearance.Animations").toLowerCase()),c.a.createElement(je,{id:"animations",label:"Toggle Animations",checked:I>0})),c.a.createElement(ue.a,{icon:"help",onClick:C},M("TelegramFeatures")),c.a.createElement(ue.a,{icon:"bug",href:n.D},"Report Bug"),A&&c.a.createElement(c.a.Fragment,null,c.a.createElement(ue.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K")),Object(de.b)()}},"Switch to K Version"),c.a.createElement(ue.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:de.b},"Switch to Old Version"))),c.a.createElement(he.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:g||f?"with-picker-item":"",value:t||b,focused:U,isLoading:h,placeholder:H,autoComplete:"off",canClose:Boolean(g||f),onChange:a,onReset:d,onFocus:R},T&&c.a.createElement(Oe.a,{icon:"calendar",title:T,canClose:!0,isMinimized:Boolean(g),className:"search-date",onClick:w,clickArg:k}),g&&c.a.createElement(Oe.a,{chatOrUserId:g,onClick:i,canClose:!0,clickArg:N}))))})),pe=a(21);a(199);var Ie=Object(c.h)(()=>{const e=Object(ie.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(pe.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),ve=a(131),ye=a(52),Ce=a(28),we=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(p.h)(e=>e(),e),[e]))(t),o=Object(Ce.a)();return Object(ye.a)(()=>{let t=!0;n(()=>{s.current=e(),t||o()}),t=!1},a),s.current},Ee=a(168),Me=a(189);var Se=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:o,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e),activeChatFolder:c,currentUserId:o}},(e,t)=>Object(h.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:o,activeChatFolder:r,currentUserId:i,lastSyncTime:d,loadChatFolders:b,setActiveChatFolder:u,openChat:O})=>{const j=Object(c.q)(null),g=Object(ie.a)();Object(c.n)(()=>{d&&b()},[d,b]);const f=Object(c.p)(()=>o?o.map(e=>a[e]||{}).filter(Boolean):void 0,[a,o]),p=we(()=>{if(!f||!f.length)return;const a=Object.keys(e).map(Number),c=f.map(c=>{const{unreadDialogsCount:o,hasActiveDialogs:r}=Object(l.o)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:o,isBadgeActive:r}});return Object(h.c)(c,"id")},3e3,[f,e,t,s,n]),I=Object(c.p)(()=>{if(f&&f.length)return[{title:g("FilterAllChats")},...f.map(e=>({title:e.title,...p&&p[e.id]}))]},[f,p,g]),v=Object(c.m)(e=>{u(e)},[u]);Object(c.n)(()=>{I&&I.length&&r>=I.length&&u(0)},[r,I,u]),Object(c.n)(()=>{if(j.current&&m.m&&I&&I.length)return Object(ve.b)(j.current,{onSwipe:(e,t)=>{t===ve.a.Left?u(Math.min(r+1,I.length-1)):t===ve.a.Right&&u(Math.max(0,r-1))}})},[r,I,u]);const y=Object(c.q)();y.current=0!==r,Object(c.n)(()=>y.current?Object(ce.a)(()=>{y.current&&u(0)}):void 0,[r,u]),Object(de.a)(0!==r,()=>u(0)),Object(c.n)(()=>{const e=e=>{if(e.metaKey&&e.code.startsWith("Digit")&&I){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void O({id:i});const a=Number(t)-1;if(a>I.length-1)return;u(a),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}});const{shouldRender:C,transitionClassNames:w}=Object(ae.a)(!o,void 0,!0);function E(e){const t=Object.values(a).find(({title:e})=>e===I[r].title);return t&&0!==r?c.a.createElement(Me.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(Me.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(Ee.a,{tabs:I,activeTab:r,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(te.a)("tabs-placeholder",w)}):void 0,c.a.createElement(oe.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:r,renderCount:I?I.length:void 0},E))})),ke=a(12),Ne=a(20),Te=a(17);var Pe=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});var Ae=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)}),xe=a(54);a(210);let Re;var Le=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,o]=Object(c.r)(!1);Object(c.n)(()=>{e||o(!1)},[e]);const r=Object(ie.a)(),i=Object(te.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Re&&(clearTimeout(Re),Re=void 0)},[]),d=Object(c.m)(()=>{Re&&(clearTimeout(Re),Re=void 0),Re=window.setTimeout(()=>{o(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(me.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{o(!n)},ariaLabel:r(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(xe.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{o(!1)}},c.a.createElement(ue.a,{icon:"channel",onClick:a},r("NewChannel")),c.a.createElement(ue.a,{icon:"group",onClick:s},r("NewGroup")),c.a.createElement(ue.a,{icon:"user",onClick:t},r("NewMessageTitle"))))}),De=a(157);a(211);const Fe=Object.keys(u.d).length/2;let Be;var Ue=Object(s.h)(e=>Object(h.l)(e,["connectionState"]))(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,shouldSkipTransition:n,onSearchQuery:o,onContentChange:r,onReset:i,connectionState:l})=>{const[d,b]=Object(c.r)(m.m),h=!function(){const[e,t]=Object(c.r)(window.navigator.onLine);return Object(c.n)(()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}},[]),e}()||"connectionStateConnecting"===l,O=Object(c.q)(!1),j=Object(c.m)(()=>{r(u.d.Settings)},[r]),g=Object(c.m)(()=>{r(u.d.Contacts)},[r]),f=Object(c.m)(()=>{r(u.d.NewChannelStep1)},[r]),p=Object(c.m)(()=>{r(u.d.NewGroupStep1)},[r]),I=Object(c.m)(()=>{r(u.d.Archived)},[r]),v=Object(c.m)(()=>{e===u.d.ChatList&&(O.current=!0,b(!0))},[e]),y=Object(c.m)(()=>{O.current=!1,Be&&(clearTimeout(Be),Be=void 0),Be=window.setTimeout(()=>{O.current||b(!1)},250)},[]);Object(c.n)(()=>{let t;return e!==u.d.ChatList?t=window.setTimeout(()=>{b(!1)},250):(O.current||m.m)&&b(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]);const[C,w,E]=function(){const[e,t]=Object(re.a)(!1);Object(c.n)(()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}},[t]);const{shouldRender:a,transitionClassNames:s}=Object(ae.a)(e);return[a,s,()=>{window.location.reload()}]}(),M=Object(ie.a)();return c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:m.m?void 0:v,onMouseLeave:m.m?void 0:y},c.a.createElement(fe,{content:e,contactsFilter:s,onSearchQuery:o,onSelectSettings:j,onSelectContacts:g,onSelectArchived:I,onReset:i,shouldSkipTransition:n}),c.a.createElement(De.a,{isOpen:h,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(Ie,null)),c.a.createElement(oe.a,{name:n?"none":"zoom-fade",renderCount:Fe,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:u.d.ChatList,className:h?"pull-down":void 0},n=>{switch(e){case u.d.ChatList:return c.a.createElement(Se,null);case u.d.GlobalSearch:return c.a.createElement(Pe,{searchQuery:t,searchDate:a,isActive:n,onReset:i});case u.d.Contacts:return c.a.createElement(Ae,{filter:s,isActive:n,onReset:i});default:return}}),C&&c.a.createElement(me.a,{fluid:!0,pill:!0,className:Object(te.a)("btn-update",w),onClick:E},M("lng_update_telegram")),c.a.createElement(Le,{isShown:d,onNewPrivateChat:g,onNewChannel:f,onNewGroup:p}))});var He=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});var qe=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});var Ge,_e=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});a(212);!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"}(Ge||(Ge={}));const ze=Object.keys(Ge).length/2;var $e=Object(c.h)(Object(s.h)(e=>{const{globalSearch:{query:t,date:a},chatFolders:{activeChatFolder:s},shouldSkipHistoryAnimations:n}=e;return{searchQuery:t,searchDate:a,activeChatFolder:s,shouldSkipHistoryAnimations:n}},(e,t)=>Object(h.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,activeChatFolder:a,shouldSkipHistoryAnimations:s,setGlobalSearchQuery:n,setGlobalSearchChatId:o,resetChatCreation:r,setGlobalSearchDate:i,loadPasswordInfo:l,clearTwoFaError:d})=>{const[b,h]=Object(c.r)(u.d.ChatList),[O,j]=Object(c.r)(u.m.Main),[g,f]=Object(c.r)(""),[p,I]=Object(c.r)(0);let v=Ge.Main;switch(b){case u.d.Archived:v=Ge.Archived;break;case u.d.Settings:v=Ge.Settings;break;case u.d.NewChannelStep1:case u.d.NewChannelStep2:v=Ge.NewChannel;break;case u.d.NewGroupStep1:case u.d.NewGroupStep2:v=Ge.NewGroup}const y=Object(c.m)(e=>{if(b!==u.d.NewGroupStep2||e)if(b!==u.d.NewChannelStep2||e){if(b===u.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(b===u.d.Settings)switch(O){case u.m.EditProfile:case u.m.Folders:case u.m.General:case u.m.Notifications:case u.m.Privacy:case u.m.Language:return void j(u.m.Main);case u.m.GeneralChatBackground:return void j(u.m.General);case u.m.GeneralChatBackgroundColor:return void j(u.m.GeneralChatBackground);case u.m.PrivacyPhoneNumber:case u.m.PrivacyLastSeen:case u.m.PrivacyProfilePhoto:case u.m.PrivacyForwarding:case u.m.PrivacyGroupChats:case u.m.PrivacyActiveSessions:case u.m.PrivacyBlockedUsers:case u.m.TwoFaDisabled:case u.m.TwoFaEnabled:case u.m.TwoFaCongratulations:return void j(u.m.Privacy);case u.m.PrivacyPhoneNumberAllowedContacts:case u.m.PrivacyPhoneNumberDeniedContacts:return void j(u.m.PrivacyPhoneNumber);case u.m.PrivacyLastSeenAllowedContacts:case u.m.PrivacyLastSeenDeniedContacts:return void j(u.m.PrivacyLastSeen);case u.m.PrivacyProfilePhotoAllowedContacts:case u.m.PrivacyProfilePhotoDeniedContacts:return void j(u.m.PrivacyProfilePhoto);case u.m.PrivacyForwardingAllowedContacts:case u.m.PrivacyForwardingDeniedContacts:return void j(u.m.PrivacyForwarding);case u.m.PrivacyGroupChatsAllowedContacts:case u.m.PrivacyGroupChatsDeniedContacts:return void j(u.m.PrivacyGroupChats);case u.m.TwoFaNewPassword:return void j(u.m.TwoFaDisabled);case u.m.TwoFaNewPasswordConfirm:return void j(u.m.TwoFaNewPassword);case u.m.TwoFaNewPasswordHint:return void j(u.m.TwoFaNewPasswordConfirm);case u.m.TwoFaNewPasswordEmail:return void j(u.m.TwoFaNewPasswordHint);case u.m.TwoFaNewPasswordEmailCode:return void j(u.m.TwoFaNewPasswordEmail);case u.m.TwoFaChangePasswordCurrent:case u.m.TwoFaTurnOff:case u.m.TwoFaRecoveryEmailCurrentPassword:return void j(u.m.TwoFaEnabled);case u.m.TwoFaChangePasswordNew:return void j(u.m.TwoFaChangePasswordCurrent);case u.m.TwoFaChangePasswordConfirm:return void j(u.m.TwoFaChangePasswordNew);case u.m.TwoFaChangePasswordHint:return void j(u.m.TwoFaChangePasswordConfirm);case u.m.TwoFaRecoveryEmail:return void j(u.m.TwoFaRecoveryEmailCurrentPassword);case u.m.TwoFaRecoveryEmailCode:return void j(u.m.TwoFaRecoveryEmail);case u.m.FoldersCreateFolder:case u.m.FoldersEditFolder:return void j(u.m.Folders)}b!==u.d.ChatList||0!==a?(h(u.d.ChatList),f(""),n({query:""}),i({date:void 0}),o({id:void 0}),r(),setTimeout(()=>{I(Date.now())},250)):h(u.d.GlobalSearch)}else h(u.d.NewChannelStep1);else h(u.d.NewGroupStep1)},[b,a,O,n,i,o,r]),C=Object(c.m)(t=>{b!==u.d.Contacts?(h(u.d.GlobalSearch),t!==e&&n({query:t})):f(t)},[b,e,n]);Object(c.n)(()=>b!==u.d.ChatList||0===a?Object(ce.a)(()=>y()):void 0,[a,b,y]),Object(c.n)(()=>{d(),O===u.m.Privacy&&l()},[d,l,O]);const w=e=>{h(u.d.Settings),j(e)};return c.a.createElement(oe.a,{id:"LeftColumn",name:s?"none":m.o,renderCount:ze,activeKey:v,shouldCleanup:!0,cleanupExceptionKey:Ge.Main},a=>{switch(v){case Ge.Archived:return c.a.createElement(_e,{isActive:a,onReset:y,onContentChange:h});case Ge.Settings:return c.a.createElement(He,{isActive:a,currentScreen:O,onScreenSelect:w,onReset:y,shouldSkipTransition:s});case Ge.NewChannel:return c.a.createElement(qe,{key:p,isActive:a,isChannel:!0,content:b,onContentChange:h,onReset:y});case Ge.NewGroup:return c.a.createElement(qe,{key:p,isActive:a,content:b,onContentChange:h,onReset:y});default:return c.a.createElement(Ue,{content:b,searchQuery:e,searchDate:t,contactsFilter:g,onContentChange:h,onSearchQuery:C,onReset:y,shouldSkipTransition:s})}})})),We=a(138),Ve=a(11),Ke=a(13),Qe=a(56);var Ye=()=>{const[e,t]=Object(c.r)(Qe.a.get());return Object(c.n)(()=>{const e=Object(p.h)(()=>{t(Qe.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},Je=a(174);function Xe(e,t){const a=e<=n.jb?16:32,s=function(e){if(e>n.gb){const t=Math.min(Math.max(.25*e,288),424),a=Math.min(.25*e,424);return Math.min(e-t-a,728)}if(e>n.fb){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,728)}if(e>728)return 728;return e}(e),c=e<=n.jb?54:64,o=t?s-a-c:s-a,r=e>n.jb?Math.min(s-a,512):s-a,i=r/o,l=o/r;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}var Ze=a(133),et=a(143),tt=a(134),at=a(51),st=a(108),nt=a(124);var ct=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var ot=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.g)(e,t),c=Boolean(n&&Object(l.mb)(n));if(n&&n.isRestricted)return{noMenu:!0};const o=Object(r.P)(e,t),i="thread"===s&&a===b.MAIN_THREAD_ID,d="thread"===s&&a!==b.MAIN_THREAD_ID,u=Object(r.W)(e),h=Boolean(Object(r.L)(e,t)),O=Boolean(i&&n&&(c||Object(l.qb)(n))&&n.isNotJoined),j=i||d,g=i&&!o&&!O,f=!Object(r.S)(e),p=i&&!O;return{noMenu:!(m.k&&O||m.k&&j||g||f||p),isChannel:c,isRightColumnShown:u,canStartBot:h,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(h.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canSubscribe:o,canSearch:r,canMute:i,canSelect:l,canLeave:d,isRightColumnShown:b,joinChannel:u,sendBotCommand:h,openLocalTextSearch:O})=>{const j=Object(c.q)(null),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(void 0),v=Object(c.m)(()=>{f(!0);const e=j.current.getBoundingClientRect();I({x:e.right,y:e.bottom})},[]),y=Object(c.m)(()=>{f(!1)},[]),C=Object(c.m)(()=>{I(void 0)},[]),w=Object(c.m)(()=>{u({chatId:e})},[u,e]),E=Object(c.m)(()=>{h({command:"/start"})},[h]),M=Object(c.m)(()=>{if(O(),m.k){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(ie.a)();return c.a.createElement("div",{className:"HeaderActions"},!m.k&&o&&c.a.createElement(me.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!m.k&&n&&c.a.createElement(me.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("BotStart")),!m.k&&r&&c.a.createElement(me.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(m.k||!o)&&c.a.createElement(me.a,{ref:j,className:g?"active":"",round:!0,ripple:!m.k,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(ct,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:o,canSearch:r,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:w,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),rt=a(114),it=a(25),lt=a(107),dt=a(45);function bt(e){const t=e&&Object(l.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(m.s)()&&t.includes("image/webp"),[o,r]=Object(c.r)(dt.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(dt.c)("b64-"+i,t).then(r).catch(e=>{n.r&&console.error(e)})},[i,s,t]),s?o:t}var ut=a(116),mt=a(43);function ht(e,t,a,s,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${a},0v${s-2*n}a${n},${n},0,0,1,${-a},0Z`}var Ot=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),o="clipPath"+e,r=function(e,t,a){let s="";if(3===a)s=ht(0,0,2,t,1)+ht(0,12,2,t+1,1)+ht(0,25,2,t,1);else for(let e=0;e<a;e++)s+=ht(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(o,s,e),i=function(e,t,a){if(1===a)return 0;if(2===a)return 0===e?0:t+2;return 3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),l=function(e,t,a,s){if(t<=4)return 0;if(e<=1)return 0;if(e>=t-2)return s-36;return(a+4)/2+(e-2)*(a+2)}(a,e,s,c);return{markHeight:n,clipPath:r,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:o}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:o,clipPath:r}=s,i=a.current.firstElementChild;if(a&&a.current){const s=a.current,{style:l}=s;l.height=e+"px",l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),u&&(u.innerHTML=r),b&&(b.style.height=n+"px",b.style.transform=`translateY(${c}px)`)}},[s]),1===e)return c.a.createElement("div",{className:"pinned-message-border"},c.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:n,trackTranslateY:o,markHeight:r,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(te.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},c.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${n}px; transform: translateY(-${o}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${i}px);`})))});var jt=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:o,onClick:r,onAllPinnedClick:i})=>{const d=Object(ie.a)(),b=bt(e),u=Object(lt.a)(Object(l.E)(e,"pictogram")),m=Object(l.O)(d,e,Boolean(b)),[h,O,j]=Object(re.a)(),g=Object(c.m)(()=>{j(),o&&o(e.id)},[j,o,e.id]);return c.a.createElement("div",{className:Object(te.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(me.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:d("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),o&&c.a.createElement(me.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:d("UnpinMessageAlertTitle"),className:"unpin-button",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(ut.a,{isOpen:h,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:d.isRtl?"rtl":void 0},c.a.createElement(Ot,{count:t,index:a}),b&&function(e,t){const{width:a,height:s}=Object(rt.m)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(b,u),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title",dir:"auto"},s||`${d("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",{dir:"auto"},Object(it.a)(m))),c.a.createElement(mt.a,null)))}),gt=a(55),ft=a(175);a(215);var pt=Object(s.h)((e,{message:t})=>({sender:Object(r.ub)(e,t)}),(e,t)=>Object(h.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:o})=>{const r=Object(ie.a)(),i=s?Object(l.X)(r,s):void 0,d=gt.c(Object(l.E)(e,"inline")),{playPause:b,isPlaying:u}=Object(ft.a)(Object(l.C)(e),Object(l.q)(e),d,void 0,void 0,!0),h=Object(c.m)(()=>{n({chatId:e.chatId,messageId:e.id})},[n,e.chatId,e.id]),O=Object(c.m)(()=>{u&&b(),o()},[o,u,b]);if(a)return;const j=Object(l.t)(e);return c.a.createElement("div",{className:Object(te.a)("AudioPlayer",t),dir:r.isRtl?"rtl":void 0},c.a.createElement(me.a,{round:!0,ripple:!m.k,color:"translucent",size:"smaller",className:Object(te.a)("toggle-play",u?"pause":"play"),onClick:b,ariaLabel:u?"Pause audio":"Play audio"},c.a.createElement("i",{className:"icon-play"}),c.a.createElement("i",{className:"icon-pause"})),c.a.createElement("div",{className:"AudioPlayer-content",onClick:h},j?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},Object(it.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(it.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(it.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(r("AttachAudio"),i),c.a.createElement(mt.a,null)),c.a.createElement(me.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(216);var It=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c,shouldSkipHistoryAnimations:o}=e,{byId:i}=e.chats,l=Object(r.g)(e,t),{typingStatus:d}=l||{},{chatId:u,messageId:m}=e.audioPlayer,h=u&&m?Object(r.l)(e,u,m):void 0,O=Object(r.Fb)(e,t,a);let j;if("pinned"===s){const a=Object(r.jb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(r.pb)(e,t);j=a&&a.length}else if("thread"===s&&a!==b.MAIN_THREAD_ID){const s=Object(r.Eb)(e,t,a);s&&(j=s.messagesCount)}const g={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),audioMessage:h,chat:l,chatsById:i,originChatId:O?O.id:t,messagesCount:j,isChatWithSelf:Object(r.P)(e,t),isChatWithBot:l&&Object(r.O)(e,l),lastSyncTime:c,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e),shouldSkipHistoryAnimations:o},f=Object(r.n)(e,t);if("thread"!==s||!f)return g;if(Object.assign(g,{messagesById:f}),a!==b.MAIN_THREAD_ID){const s=Object(r.Gb)(e,t,a),n=s?Object(r.l)(e,t,s):void 0,c=n?Object(r.K)(e,n):void 0;return{...g,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const p=Object(r.jb)(e,t);if(p&&p.length){const t=f[p[0]],{canUnpin:s}=t&&Object(r.b)(e,t,a)||{};return{...g,pinnedMessageIds:p,canUnpin:s}}return g},(e,t)=>Object(h.l)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isReady:s,pinnedMessageIds:o,messagesById:r,canUnpin:i,topMessageSender:d,typingStatus:u,isSelectModeActive:h,isLeftColumnShown:O,isRightColumnShown:j,audioMessage:g,chat:f,chatsById:p,originChatId:I,messagesCount:v,isChatWithSelf:y,isChatWithBot:C,lastSyncTime:w,notifySettings:E,notifyExceptions:M,shouldSkipHistoryAnimations:S,openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:P,loadPinnedMessages:A,toggleLeftColumn:x,exitMessageSelectMode:R})=>{const L=Object(ie.a)(),[D,F]=Object(c.r)(0),B=Array.isArray(o)?o[D]:o,U=r&&B?r[B]:void 0,H=Array.isArray(o)?o.length:o?1:0,q=f&&Object(l.k)(L,f).length,G=d?Object(l.X)(L,d):void 0;Object(c.n)(()=>{t===b.MAIN_THREAD_ID&&w&&s&&A({chatId:e})},[e,A,w,t,s]),Object(c.n)(()=>{F(0)},[o]),Object(et.a)(e,B,U);const{width:_}=Ye(),z=_<=n.fb,$=m.l&&O,W=Object(c.q)(null),V=Object(c.q)(!0),K=Object(c.m)(()=>{k({id:e})},[k,e]),Q=Object(c.m)(t=>{N({chatId:e,messageId:t,isUnpin:!0})},[N,e]),Y=Object(c.m)(()=>{if(U){T({chatId:U.chatId,threadId:t,messageId:U.id});const e=Object(Ze.a)(H,D+1);F(e)}},[U,T,t,H,D]),J=Object(c.m)(()=>{P({id:e,threadId:b.MAIN_THREAD_ID,type:"pinned"})},[P,e]),X=Object(c.m)(e=>{if(m.k){const e=document.getElementById(n.x);e&&e.blur()}t!==b.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&h&&R(),P({id:I,threadId:b.MAIN_THREAD_ID})):m.k||$?(e.stopPropagation(),P({id:void 0})):x()},[P,I,t,a,x,h,R,$]),Z=Object(c.p)(()=>{if(!z||!p)return;let e=!1;const t=Object.values(p).reduce((t,a)=>{if(Object(l.kb)(a))return t;const s=a.unreadCount||0;return!s||Object(l.Hb)(a,E,M)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[z,p,E,M]),ee=_>=n.fb&&_<n.qb||_>n.jb&&_<n.fb&&(!q||q>30),se=ee||_>n.gb&&_<n.rb,{shouldRender:ne,transitionClassNames:ce}=Object(ae.a)(Boolean(g)),re=Object(tt.a)(g),{shouldRender:le,transitionClassNames:de}=Object(ae.a)(U&&!ne),be=Object(tt.a)(U),ue=Object(tt.a)(G),he=le&&be||ne&&re;function Oe(){return"thread"===a&&t===b.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,z&&je($,Z),c.a.createElement("div",{className:"chat-info-wrapper",onClick:K},Object(l.ob)(e)?c.a.createElement(st.a,{userId:e,typingStatus:u,withFullInfo:C,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):c.a.createElement(nt.a,{chatId:e,typingStatus:u,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,L("CommentsCount",v))):"pinned"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,L("PinnedMessagesCount",v))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,y?L("Reminders"):L("messages",v))):void 0}function je(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(me.a,{round:!0,size:"smaller",color:"translucent",onClick:X,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(te.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(at.b)(t.totalCount)))}return Object(c.n)(()=>{const e=W.current;if(e)return se&&he?void(j||ee?(V.current&&(e.classList.add("tools-stacked","animated"),V.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),V.current=!0)):(e.classList.remove("tools-stacked","animated"),void(V.current=!0))},[se,he,ee,j]),c.a.createElement("div",{className:"MiddleHeader",ref:W},c.a.createElement(oe.a,{name:S?"none":"slide-fade",activeKey:"thread"===a?t:1},Oe),c.a.createElement("div",{className:"header-tools"},le&&be&&!ne&&c.a.createElement(jt,{key:e,message:be,count:H,index:D,customTitle:ue,className:de,onUnpinMessage:i?Q:void 0,onClick:Y,onAllPinnedClick:J}),ne&&re&&c.a.createElement(pt,{key:Object(l.C)(re),message:re,className:ce}),c.a.createElement(ot,{chatId:e,threadId:t,messageListType:a})))})),vt=a(159);function yt(e){return"albumId"in e}function Ct(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(L.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((o,r)=>{o.isInAlbum?a?(a.messages.push(o),o.content.text&&(a.mainMessage=o)):a={albumId:o.groupedId,messages:[o],mainMessage:o}:s.push(o);const i=e[r+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(L.j)(1e3*i.date));n.datetime!==e?(n={originalDate:i.date,datetime:e,senderGroups:[]},c.push(n),s=[],n.senderGroups.push(s)):(i.id===t||o.senderId!==i.senderId||o.isOutgoing!==i.isOutgoing||Object(l.gb)(o)||Object(l.gb)(i)||o.forwardInfo&&i.forwardInfo&&(o.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||o.inlineButtons||i.inlineButtons||i.date-o.date>600)&&(s=[],n.senderGroups.push(s))}}),c}function wt(e){!m.k&&document.activeElement&&document.activeElement.id===n.x&&e.target===e.currentTarget&&e.preventDefault()}var Et=a(106);function Mt(){const[e,t]=Object(re.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(p.a)(e=>e(),s,n,o),[s,n,o]));var s,n,o;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(p.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(p.b)(()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const a=function(e,t){const a=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(a).find(e=>{const{offsetTop:a,offsetHeight:n}=e,c=a-s;return-n<=c&&c<=(t?60:10)})}(e,s);a&&a.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")})})},[t,a])}}var St=a(154),kt=a(125);var Nt=({containerRef:e,className:t,messageIds:a,loadMoreForwards:s,loadMoreBackwards:o,isViewportNewest:r,firstUnreadId:i,onFabToggle:l,onNotchToggle:d,children:b})=>{const u=Object(c.q)(null),m=Object(c.q)(null),h=Object(c.q)(null),O=Object(c.m)(()=>{if(!a||!a.length)return l(!1),void d(!1);if(!r)return l(!0),void d(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t,o=c<=0;l(i?!o:!(c<=50)),d(!o)},[a,r,e,l,i,d]),{observe:j}=Object(Et.a)({rootRef:e,margin:n.ab},t=>{if(!s||!o)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:n}=a;"backwards-trigger"===n.className?(Object(St.a)(e.current),o()):"forwards-trigger"===n.className&&(Object(St.a)(e.current),s())});Object(Et.c)(u,j),Object(Et.c)(m,j);const{observe:g,freeze:f,unfreeze:p}=Object(Et.a)({rootRef:e,margin:50},O);Object(Et.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(Et.a)({rootRef:e},O);return Object(Et.c)(h,I),Object(ye.a)(()=>{f(),v(),setTimeout(()=>{y(),p()},100)},[a]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:u,key:"backwards-trigger",className:"backwards-trigger"}),b,c.a.createElement("div",{ref:m,key:"forwards-trigger",className:"forwards-trigger"}),c.a.createElement("div",{ref:h,key:"fab-trigger",className:"fab-trigger"}))},Tt=a(144),Pt=a(145);function At(e){return"number"==typeof e}function xt(e,t){return e?t?238:175:100}function Rt(e,t){const a=Object(l.yb)(e),s=Object(l.tb)(e),n=Object(l.H)(e)||Object(l.S)(e),c=Object(l.Q)(e),o=Boolean(Object(l.S)(e)),{width:r,height:i}=n?Object(rt.g)(n,a,s,o,t):Object(rt.i)(c,a,s,t),d=xt(Boolean(Object(l.P)(e)));let b=1;r<d&&d-r<12&&(b=d/r),i*b<90&&90-i*b<12&&(b=90/i);const u=Math.round(r*b),m=Math.round(i*b);return{width:u,height:m,isSmall:u<d||m<90}}const Lt=0,Dt=1,Ft=2,Bt=4,Ut=8;function Ht(e,t){return e.reduce((e,t)=>e+t,t)}function qt(e,t,a){return e<t?t:e>a?a:e}function Gt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&Ft&&(t.width=e.width+e.x),a&Bt&&(t.height=e.height+e.y)}),t}function _t(e,t,a,s){const n=s.messages.map(e=>{const t=Rt(e);return t.width/t.height});const c=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(n),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(n),r=n.length,i=n.some(e=>e>2),l=Object(rt.j)(e,t,!1,a)-(t?2.5:0)*rt.d;let d;const b={ratios:n,proportions:c,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||i?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const o=function(e,t){return e.map(e=>t>1.1?qt(e,1,2.75):qt(e,.6667,1))}(e,t),r=e.length,i=new Array(r),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=Ht(o.slice(e,e+t),0);return(a-(t-1)*n)/s})(s,e)),s+=e}),l.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==r-1;++e)for(let a=1;a!==r-e;++a){const s=r-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let a=1;a!==r-e-t;++a){const s=r-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&d([e,t,a,s])}let b,u=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:a}=l[e],o=a.length,r=Ht(t,0)+n*(o-1),i=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==o;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(r-c)*i*d;(!b||m<u)&&(b=l[e],u=m)}const m=b.lineCounts,h=b.heights,O=m.length;let j=0,g=0;for(let e=0;e!==O;++e){const t=m[e],s=h[e],c=Math.round(s);let r=0;for(let l=0;l!==t;++l){const d=Lt|(0===e?Dt:Lt)|(e===O-1?Bt:Lt)|(0===l?Ut:Lt)|(l===t-1?Ft:Lt),b=o[j],u=l===t-1?a-r:Math.round(b*s);i[j]={dimensions:{x:r,y:g,width:u,height:c},sides:d},r+=u+n,++j}g+=c+n}return i}(b):2===r?function(e){const{ratios:t,proportions:a,averageRatio:s}=e;return"ww"===a&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=Math.round(Math.min(a/t[0],Math.min(a/t[1],(n-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:c},sides:Ut|Dt|Ft},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Ut|Bt|Ft}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,o=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:o},sides:Dt|Ut|Bt},{dimensions:{x:c+s,y:0,width:c,height:o},sides:Dt|Ft|Bt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,o=Math.round(1.5*a),r=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-o),i=s-r-n,l=Math.min(c,Math.round(Math.min(i/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:Dt|Ut|Bt},{dimensions:{x:i+n,y:0,width:r,height:l},sides:Dt|Ft|Bt}]}(e)}(b):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,o=t,r=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=o-r-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(r*s[2],i*s[1])))),d=Math.min(Math.round(o*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:Dt|Ut|Bt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:Dt|Ft},{dimensions:{x:d+a,y:i+a,width:l,height:r},sides:Bt|Ft}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,o=Math.round(Math.min(c/a[0],.66*(s-n))),r=(t-n)/2,i=Math.min(s-o-n,Math.round(Math.min(r/a[1],r/a[2])));return[{dimensions:{x:0,y:0,width:c,height:o},sides:Ut|Dt|Ft},{dimensions:{x:0,y:o+n,width:r,height:i},sides:Bt|Ut},{dimensions:{x:r+n,y:o+n,width:c-r-n,height:i},sides:Bt|Ft}]}(e)}(b):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,o=Math.round(Math.min(c/t[0],.66*(s-a))),r=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),r*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),r*t[3])),d=c-i-l-2*a,b=Math.min(s-o-a,r);return[{dimensions:{x:0,y:0,width:c,height:o},sides:Ut|Dt|Ft},{dimensions:{x:0,y:o+a,width:i,height:b},sides:Bt|Ut},{dimensions:{x:i+a,y:o+a,width:d,height:b},sides:Bt},{dimensions:{x:i+a+d+a,y:o+a,width:l,height:b},sides:Ft|Bt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,o=Math.round(Math.min(c*t[0],.6*(a-s))),r=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(r/t[1]),l=Math.round(r/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-o-s,r));return[{dimensions:{x:0,y:0,width:o,height:c},sides:Dt|Ut|Bt},{dimensions:{x:o+s,y:0,width:b,height:i},sides:Dt|Ft},{dimensions:{x:o+s,y:i+s,width:b,height:l},sides:Ft},{dimensions:{x:o+s,y:i+l+2*s,width:b,height:d},sides:Bt|Ft}]}(e)}(b),{layout:d,containerStyle:Gt(d)}}let zt;function $t(e){return zt||(zt=document.createElement("span"),zt.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',zt.style.whiteSpace="nowrap",zt.style.position="absolute",zt.style.left="-999px",zt.style.opacity=".01",document.body.appendChild(zt)),zt.innerHTML=e,zt.offsetWidth}function Wt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(kt.a)(t,e.current,n?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s)}},[e,t,a,s,n])}var Vt=a(111),Kt=a(68);var Qt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var Yt=Object(c.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:n}=t.content.action||{},c=t.replyToMessageId,o=c?Object(r.l)(e,t.chatId,c):void 0,i=Object(r.U)(e,t),{direction:d,noHighlight:b}=i&&e.focusedMessage||{},u=Object(r.g)(e,t.chatId);return{sender:u&&(Object(l.mb)(u)||a===t.chatId)?u:a?Object(r.Ib)(e,a):void 0,...s&&{targetUser:Object(r.Ib)(e,s)},targetChatId:n,targetMessage:o,isFocused:i,...i&&{focusDirection:d,noFocusHighlight:b}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,sender:o,targetUser:r,targetMessage:i,targetChatId:l,isFocused:d,focusDirection:b,noFocusHighlight:u})=>{const m=Object(c.q)(null);Object(Et.c)(m,t),Object(et.a)(e.chatId,e.replyToMessageId,i),Wt(m,e.chatId,d,b,u);const h=Object(ie.a)(),O=s<=0,[j,g]=Object(re.a)(O);Object(c.n)(()=>{O||setTimeout(g,10*s)},[s,g,O]);const{transitionClassNames:f}=Object(ae.a)(j,void 0,O,!1),p=Object(Kt.a)(h,e,o,r,i,l,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:I,contextMenuPosition:v,handleBeforeContextMenu:y,handleContextMenu:C,handleContextMenuClose:w,handleContextMenuHide:E}=Object(Tt.a)(m),M=void 0!==v;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(it.a)(p));const S=Object(te.a)("ActionMessage message-list-item",d&&!u&&"focused",M&&"has-menu-open",n&&"last-in-list",f);return c.a.createElement("div",{ref:m,id:"message"+e.id,className:S,"data-message-id":e.id,onMouseDown:e=>{wt(e),y(e)},onContextMenu:C},c.a.createElement("span",null,p),v&&c.a.createElement(Qt,{isOpen:I,anchor:v,message:e,messageListType:"thread",onClose:w,onCloseAnimationEnd:E}))}));a(217);var Jt=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:o,onClick:r})=>{const i=Object(c.q)(null),d=Object(Et.b)(i,o),b=Object(lt.a)(t&&Object(l.E)(t,"pictogram"),!d),u=t&&"sticker-reply-thumb"+t.id,m=bt(t),h=Boolean(t&&Object(l.J)(t)),O=Object(ie.a)(),j=a&&Object(l.X)(O,a);return c.a.createElement("div",{ref:i,className:Object(te.a)("EmbeddedMessage",e),onClick:t?r:void 0},m&&function(e,t,a,s){const{width:n,height:o}=Object(rt.m)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:o,alt:"",className:s?"round":""})}(u,m,b,h),c.a.createElement("div",{className:"message-text"},c.a.createElement("p",{dir:"auto"},t?Object(l.gb)(t)?c.a.createElement(Yt,{message:t,isEmbedded:!0}):Object(it.a)(Object(l.O)(O,t,Boolean(m))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(it.a)(j||s||" "))))},Xt=a(160),Zt=a(167),ea=a(172);a(221);var ta=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(ie.a)();return c.a.createElement("span",{className:"MessageMeta",dir:n.isRtl?"rtl":"ltr",onClick:s},Boolean(e.views)&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"message-views"},Object(at.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(it.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(L.h)(1e3*e.date)),t&&c.a.createElement(ea.a,{status:t}))}),aa=a(113),sa=a(115),na=a(161);a(222);var ca=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:o})=>{const r=Object(c.q)(null),[i,d,b]=Object(re.a)(),u=e.content.sticker,{isAnimated:m,stickerSetId:h}=u,O=h===n.Y,j=Object(Et.b)(r,t),g=Object(Et.b)(r,a),f=u.isPreloadedGlobally?"sticker"+u.id:Object(l.E)(e,"inline"),p=bt(e),I=Object(lt.a)(f,!j,Object(l.D)(e,"inline",!0),o),v=Boolean(I),[y,C]=Object(re.a)(v),w=m?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(aa.a)(w,"slow"),{width:S,height:k}=Object(rt.n)(u),N=Object(te.a)("thumbnail",!p&&"empty"),T=Object(te.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:r,className:T,onClick:O?void 0:d},!w&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!m&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(te.a)("full-media",M)}),m&&v&&c.a.createElement(sa.a,{key:f,className:Object(te.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(na.a,{isOpen:i,fromSticker:u,onClose:b}))},oa=a(128),ra=a(119),ia=a(162);function la(e,t){return Object(ia.a)(Object(l.F)(e),Boolean(t),m.k&&!m.c)}var da=a(27);const ba=Promise.resolve("rgba(255,255,255,1)");function ua(e,t,a,s){return s?ba:async function(e,t){const a=new Image;a.src=e,a.width||await new Promise(e=>{a.onload=e});const s=document.createElement("canvas"),n=s.getContext("2d");s.width=a.width,s.height=a.height,n.drawImage(a,0,0,a.width,a.height);const c=t?a.width-1:0,o=a.height-1;return`rgba(${Array.from(n.getImageData(c,o,1,1).data).join(",")})`}(e,t)}var ma=a(120);var ha=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,isInSelectMode:o,isSelected:r,uploadProgress:i,size:d="inline",dimensions:b,nonInteractive:u,shouldAffectAppendix:m,onClick:h,onCancelUpload:O})=>{const j=Object(c.q)(null),g=(Object(l.H)(t)||Object(l.S)(t)).blobUrl,f=Object(Et.b)(j,a),[p,I]=Object(c.r)(n),v=p&&f,{mediaData:y,downloadProgress:C}=Object(ra.a)(Object(l.E)(t,d),!v),w=g||y,E=la(t,w),{isUploading:M,isTransferring:S,transferProgress:k}=Object(l.r)(t,i||C,v&&!w),N=!1===Object(da.a)(p),{shouldRender:T,transitionClassNames:P}=Object(ae.a)(S,void 0,N,"slow"),{shouldRenderThumb:A,shouldRenderFullMedia:x,transitionClassNames:R}=Object(aa.a)(w,"slow"),L=Object(c.m)(()=>{M?O&&O(t):w?h&&h(t.id):I(e=>!e)},[w,M,t,O,h]),D=Object(l.yb)(t);Object(c.o)(()=>{if(!m)return;const e=j.current.closest(".message-content");w?ua(w,D,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[w,D,m,o,r]);const{width:F,height:B,isSmall:U}=b||Rt(t,s),H=Object(te.a)("media-inner",!M&&!u&&"interactive",U&&"small-image",F===B&&"square-image"),q=b?`width: ${F}px; height: ${B}px; left: ${b.x}px; top: ${b.y}px;`:"";return c.a.createElement("div",{id:e,ref:j,className:H,style:q,onClick:M?void 0:L},A&&c.a.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${F}px; height: ${B}px`}),x&&c.a.createElement("img",{src:w,className:"full-media "+R,width:F,height:B,alt:""}),T&&c.a.createElement("div",{className:"media-loading "+P},c.a.createElement(ma.a,{progress:k,onClick:M?L:void 0})),!w&&!p&&c.a.createElement("i",{className:"icon-download"}),S&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*k),"%"))},Oa=a(136),ja=a(135);function ga(e,t){const a=Object(c.q)();a.current=t;const s=Object(c.m)(()=>{e.current&&e.current.pause()},[e]),n=Object(c.m)(()=>{e.current&&a.current&&Object(ja.a)(e.current)},[e]);Object(ee.a)(s,n)}var fa=a(146),pa=(e,t=!1)=>{const a=Object(c.q)(!1),s=Object(c.q)(!1),n=Object(c.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),o=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(ja.a)(e.current),a.current=!1,s.current=!1},[t,e]),r=Object(c.m)(()=>{Object(p.b)(o)},[o]);document.hasFocus()||n(),Object(se.a)(n,r)};function Ia(){return(Ia=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}var va=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,shouldAutoPlay:o,uploadProgress:r,lastSyncTime:i,dimensions:d,onClick:b,onCancelUpload:u})=>{const m=Object(c.q)(null),h=Object(c.q)(null),O=Object(l.Q)(t)||Object(l.T)(t),j=O.blobUrl,g=Object(Et.b)(m,a),[f,p]=Object(c.r)(n),I=Boolean(f&&g&&i),[v,y]=Object(c.r)(o),C=Object(lt.a)(Object(l.E)(t,"pictogram"),!(g&&i),Object(l.D)(t,"pictogram"),i),w=la(t),{mediaData:E,downloadProgress:M}=Object(ra.a)(Object(l.E)(t,"inline"),!I,Object(l.D)(t,"inline"),i),S=j||E,k=Boolean(g&&S),{isBuffered:N,bufferingHandlers:T}=Object(Oa.a)(!n),{isUploading:P,isTransferring:A,transferProgress:x}=Object(l.r)(t,r||M,I&&!N),R=!1===Object(da.a)(f),{shouldRender:D,transitionClassNames:F}=Object(ae.a)(A,void 0,R),{shouldRenderThumb:B,transitionClassNames:U}=Object(aa.a)(S,"slow"),[H,q]=Object(c.r)(0),G=Object(c.m)(e=>{q(Math.max(0,e.currentTarget.currentTime-1))},[]),_=O.duration||h.current&&h.current.duration||0,z=Object(l.yb)(t),$=Object(l.tb)(t),{width:W,height:V}=d||Object(rt.i)(O,z,$,s);ga(h,Boolean(k&&o)),pa(h,v),Object(fa.a)(h,[k]);const K=Object(c.m)(()=>{P?u&&u(t):S?S&&!v?(y(!0),h.current.play()):b&&b(t.id):p(e=>!e)},[P,S,v,b,u,t]),Q=Object(te.a)("media-inner dark",!P&&"interactive"),Y=Object(te.a)("full-media",U),J=d?`width: ${W}px; height: ${V}px; left: ${d.x}px; top: ${d.y}px;`:"",X=k,Z=f&&!v&&!D,ee=!f;return c.a.createElement("div",{ref:m,id:e,className:Q,style:J,onClick:P?void 0:K},(!k||B||X)&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${W}px; height: ${V}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${W}px; height: ${V}px;`,alt:""}),X&&c.a.createElement("video",Ia({ref:h,className:Y,width:W,height:V,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:G}),c.a.createElement("source",{src:S})),Z&&c.a.createElement("i",{className:"icon-large-play"}),D&&c.a.createElement("div",{className:"media-loading "+F},c.a.createElement(ma.a,{progress:x,onClick:P?K:void 0})),ee&&c.a.createElement("i",{className:"icon-download"}),A?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},O.isGif?"GIF":Object(L.e)(Math.max(_-H,0))))},ya=a(18);a(224);var Ca=Object(s.h)((e,{contact:t})=>({user:Object(r.Ib)(e,t.userId)}),(e,t)=>Object(h.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:o,userId:r}=e,i=Object(c.m)(()=>{a({id:r})},[a,r]);return c.a.createElement("div",{className:Object(te.a)("Contact",Boolean(r)&&"interactive"),onClick:r?i:void 0},c.a.createElement(Vt.a,{size:"large",user:t,text:s||n}),c.a.createElement("div",{className:"contact-info"},c.a.createElement("div",{className:"contact-name"},s," ",n),c.a.createElement("div",{className:"contact-phone"},Object(ya.c)(o))))}),wa=a(47);var Ea=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:o,onChange:r})=>{const[i,l]=Object(c.r)([]),d=Object(c.m)(e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?[...i,t]:i.filter(e=>e!==t),l(s),r(s)},[r,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(wa.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:o?-1!==o.indexOf(e.value):void 0,onChange:d})))}),Ma=a(121),Sa=a(180);a(227);function ka(e,t){return t>0?(e/t*100).toFixed():0}var Na=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:o})=>{const r=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||r&&r.isChosen,d=r?ka(r.votersCount,a||0):0,[b,u]=Object(c.r)(o?0:d),m=Object(c.q)(null),h=r?ka(r.votersCount,s||0):0,O=b<d;if(Object(c.n)(()=>{o&&u(d)},[o,d]),Object(c.n)(()=>{const e=m.current;if(e&&o){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${a}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}},[O,o]),!t||!r)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption",dir:"ltr"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(te.a)("poll-option-chosen",!i&&"wrong",o&&"animate")},c.a.createElement("i",{className:i?"icon-check":"icon-close"}))),c.a.createElement("div",{className:"poll-option-right"},c.a.createElement("div",{className:"poll-option-text",dir:"auto"},Object(it.a)(e.text)),c.a.createElement("div",{className:Object(te.a)("poll-option-answer",l&&!i&&"wrong")},c.a.createElement("div",{className:"poll-option-corner",ref:m}),c.a.createElement("div",{className:"poll-option-line",style:j}))))};a(228);var Ta=Object(c.h)(Object(s.h)((e,{poll:t})=>{const{recentVoterIds:a}=t.results,{serverTimeOffset:s,users:{byId:n}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:n,serverTimeOffset:s}:{}},(e,t)=>Object(h.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:o,openPollResults:r,serverTimeOffset:i})=>{const{id:l,chatId:d}=e,{summary:b,results:u}=t,[m,h]=Object(c.r)(!1),[O,j]=Object(c.r)([]),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(!1),[v,y]=Object(c.r)(!b.closed&&b.closeDate&&b.closeDate>0?Math.min(b.closeDate-Math.floor(Date.now()/1e3)+i,b.closePeriod):0),C=Object(c.q)(null),{results:w,totalVoters:E}=u,M=w&&w.some(e=>e.isChosen),S=!b.closed&&!M,k=!S&&b.isPublic&&Number(u.totalVoters)>0,N=S&&b.multipleChoice,T=w?Math.max(...w.map(e=>e.votersCount)):E,P=w?w.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],A=b.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(b.quiz&&b.closePeriod&&v<=0)}));Object(c.n)(()=>{m&&t.results.results&&t.results.results.some(e=>e.isChosen)&&h(!1)},[m,t.results.results]),Object(c.n)(()=>{v>0&&setTimeout(()=>y(v-1),1e3);const e=C.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(v<=5&&e.classList.add("hurry-up"),a&&s){const e=(b.closePeriod-v)/b.closePeriod*t;s.textContent=Object(L.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(L.e)(v)}</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>`}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||M&&!b.closed)&&n({chatId:d,messageId:l})},[d,v,M,n,l,b.closed,b.quiz]),Object(c.n)(()=>{let e;return b.quiz&&!b.closed&&b.closePeriod&&b.closePeriod>0&&(e=window.setTimeout(()=>{n({chatId:d,messageId:l})},1e3*b.closePeriod)),()=>{e&&window.clearTimeout(e)}},[S,d,n,l,b.closePeriod,b.closed,b.quiz]);const x=Object(c.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),R=Object(c.m)(e=>{j([e]),h(!0),I(!0),o([e])},[o]),D=Object(c.m)(e=>{j(e)},[]),F=Object(c.m)(()=>{h(!0),I(!0),o(O)},[o,O]),B=Object(c.m)(()=>{r({chatId:d,messageId:l})},[d,l,r]),U=Object(c.m)(()=>{f(!0)},[]),H=Object(c.m)(()=>{f(!1),I(!1)},[]);Object(c.n)(()=>{if(p&&M&&b.quiz&&u.results&&t.results.solution){u.results.find(e=>e.isChosen&&e.isCorrect)||f(!0)}},[M,p,u.results,b.quiz,t.results.solution]);const q=Object(ie.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(Sa.a,{message:Object(Pt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:H,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(it.a)(b.question)),c.a.createElement("div",{className:"poll-type"},q(function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"QuizPoll":"AnonymousQuizPoll";if(e.closed)return"FinalResults";return e.isPublic?"PublicPoll":"AnonymousPoll"}(b)),x.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},x.map(e=>c.a.createElement(Vt.a,{size:"micro",user:e}))),v>0&&S&&c.a.createElement("div",{ref:C,className:"poll-countdown"}),b.quiz&&t.results.solution&&!S&&c.a.createElement(me.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:g,onClick:U,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),S&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(Ea,{options:A,onChange:D,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(Ma.a,{name:"poll-"+l,options:A,onChange:R,disabled:e.isScheduled||m,loadingOption:m?O[0]:void 0})),!S&&c.a.createElement("div",{className:"poll-results"},b.answers.map((function(e){return c.a.createElement(Na,{key:e.option,shouldAnimate:p,answer:e,voteResults:w,totalVoters:E,maxVotersCount:T,correctResults:P})}))),!k&&!N&&c.a.createElement("div",{className:"poll-voters-count"},function(e,t,a){if(!a)return e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty");return e(t?"Answer":"Vote",a,"i")}(q,b.quiz,u.totalVoters)),N&&c.a.createElement(me.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:F},q("PollSubmitVotes")),k&&c.a.createElement(me.a,{isText:!0,size:"tiny",onClick:B},q("PollViewResults")))})),Pa=a(40),Aa=a(59);a(229);var xa=Object(c.h)(({message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,inPreview:o,lastSyncTime:r,onMediaClick:i,onCancelMediaTransfer:d})=>{const b=Object(l.R)(e);let u=!1;if(b&&b.photo&&!b.video){const{width:t,height:a}=Rt(e);u=t===a}const m=Object(c.m)(()=>{i()},[i]);if(!b)return;const{siteName:h,url:O,displayUrl:j,title:g,description:f,photo:p,video:I}=b,v=(p||I)&&i&&!u,y=Object(Pa.a)(f,170),C=Object(te.a)("WebPage",u&&"with-square-photo",!p&&!I&&!o&&"without-media",I&&"with-video");return c.a.createElement("div",{className:C,"data-initial":(h||j)[0],dir:"auto"},p&&!I&&c.a.createElement(ha,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,size:u?"pictogram":"inline",nonInteractive:!v,onClick:v?m:void 0,onCancelUpload:d}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Aa.a,{className:"site-name",url:O,text:h||j}),!o&&g&&c.a.createElement("p",{className:"site-title"},Object(it.a)(g)),y&&c.a.createElement("p",{className:"site-description"},Object(it.a)(y,["emoji","br"]))),!o&&I&&c.a.createElement(va,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:r,onClick:v?m:void 0,onCancelUpload:d}))});a(230);var Ra=Object(c.h)(({message:e})=>{const t=Object(l.B)(e),{title:a,text:s,description:n,photoUrl:o}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(it.a)(a)),s&&c.a.createElement("p",null,Object(it.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(o?"has-image":"")},o&&c.a.createElement("img",{className:"invoice-image",src:o,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(it.a)(n,["emoji","br"]))))});function La(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(r.S)(e),isSelected:Object(r.V)(e,a.id)}},(e,t)=>Object(h.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:o,dimensions:r}=t,i=Object(c.m)(e=>{e.stopPropagation(),o({messageId:n.id,withShift:e&&e.shiftKey})},[o,n]),l=Object(c.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return c.a.createElement("div",{className:Object(te.a)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:a?i:void 0},a&&c.a.createElement("div",{className:"message-select-control"},s&&c.a.createElement("i",{className:"icon-select"})),c.a.createElement(e,l))}))}a(231);const Da=La(ha),Fa=La(va);var Ba=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(h.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:o,isOwn:r,albumLayout:i,onMediaClick:d,uploadsById:b,cancelSendingMessage:u})=>{const m=e.messages.length,h=Object(c.m)(e=>{u({chatId:e.chatId,messageId:e.id})},[u]);const{width:O,height:j}=i.containerStyle;return c.a.createElement("div",{className:"Album",style:`width: ${O}px; height: ${j}px;`},e.messages.map((function(e,u){const{photo:O,video:j}=Object(l.v)(e),g=b[e.previousLocalId||e.id],f=g?g.progress:void 0,{dimensions:p,sides:I}=i.layout[u];if(O){const s=n&&(r?u===m-1:Boolean(I&Ut&&I&Bt));return c.a.createElement(Da,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:d,onCancelUpload:h})}if(j)return c.a.createElement(Fa,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:o,dimensions:p,onClick:d,onCancelUpload:h})})))});a(232);function Ua(){return(Ua=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let Ha;var qa=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:n})=>{const o=Object(c.q)(null),r=Object(c.q)(null),i=Object(c.q)(null),d=e.content.video,b=Object(Et.b)(o,t),[u,m]=Object(c.r)(a&&s),h=Boolean(u&&b&&n),{mediaData:O,downloadProgress:j}=Object(ra.a)(Object(l.E)(e,"inline"),!h,Object(l.D)(e,"inline"),n),g=la(e,O),{isBuffered:f,bufferingHandlers:p}=Object(Oa.a)(),I=u&&!f,v=!1===Object(da.a)(u),{shouldRender:y,transitionClassNames:C}=Object(ae.a)(I||!f,void 0,v),{shouldRenderThumb:w,transitionClassNames:E}=Object(aa.a)(O,"slow"),[M,S]=Object(c.r)(!1),[k,N]=Object(c.r)(0);Object(c.n)(()=>{if(!M)return;const e=188*Math.PI,t=e-k*e,a=i.current,s=r.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.innerHTML=`<svg width="200px" height="200px">\n <circle cx="100" cy="100" r="94" class="progress-circle" transform="rotate(-90, 100, 100)"\n stroke-dasharray="${e} ${e}"\n stroke-dashoffset="${e}"\n />\n </svg>`,N(a.currentTime/a.duration)},[M,k]);const T=Boolean(O&&b),P=()=>{S(!1),N(0),Object(ja.a)(i.current),requestAnimationFrame(()=>{r.current.innerHTML=""})},A=(x=P,()=>{Ha&&Ha(),Ha=x});var x;Object(c.n)(()=>{i.current&&(T?Object(ja.a)(i.current):i.current.pause())},[T]),ga(i,T),pa(i,Boolean(O)),Object(fa.a)(i,[O]);const R=Object(c.m)(()=>{if(!O)return void m(e=>!e);const e=i.current;M?e.paused?Object(ja.a)(e):e.pause():(A(),e.currentTime=0,S(!0))},[A,M,O]),D=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),F=Object(te.a)("full-media",E);return c.a.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:R},(w||O)&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${rt.e}px; height: ${rt.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Ua({ref:i,className:F,width:rt.e,height:rt.e,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,onEnded:M?P:void 0},p,{onTimeUpdate:M?D:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:r}),y&&c.a.createElement("div",{className:"media-loading "+C},c.a.createElement(ma.a,{progress:j})),!O&&!u&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},M?Object(L.e)(i.current.currentTime):Object(L.e)(d.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(233);var Ga=({message:e,onClick:t})=>c.a.createElement("div",{className:"InlineButtons"},e.inlineButtons.map(e=>c.a.createElement("div",{className:"row"},e.map(e=>c.a.createElement(me.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},Object(it.a)(e.text),"url"===e.type&&!e.value.match(n.pb)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(234);var _a=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(r.Eb)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:o}=e.chats;return{threadInfo:n,usersById:c,chatsById:o}},(e,t)=>Object(h.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const o=Object(ie.a)(),{threadId:r,chatId:i,messagesCount:d,lastMessageId:b,lastReadInboxMessageId:u,recentReplierIds:m}=t,h=Object(c.m)(()=>{n({id:i,threadId:r})},[n,i,r]);if(void 0===d)return;const O=m&&m.map(e=>Object(l.ob)(e)?a[e]:s[e]).filter(Boolean);const j=Boolean(u&&b&&u<b);return c.a.createElement("div",{"data-cnt":Object(at.b)(d),className:Object(te.a)("CommentButton",j&&"has-unread",e&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:h},c.a.createElement("i",{className:"icon-comments-sticker"}),(!O||0===O.length)&&c.a.createElement("i",{className:"icon-comments"}),O&&O.length>0&&c.a.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},O.map(e=>c.a.createElement(Vt.a,{key:e.id,size:"small",user:Object(l.ob)(e.id)?e:void 0,chat:Object(l.ob)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label",dir:"auto"},d?o("Comments",d,"i"):o("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(235);function za(e){const t=Wa(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function $a(e){const t=Wa(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Wa(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Va=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:o,withSenderName:i,withAvatar:d,threadId:b,messageListType:u}=t,{id:m,chatId:h,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(r.g)(e,h),p=Object(r.P)(e,h),I=f&&Object(l.mb)(f),v=!p&&Object(l.hb)(c),y=i||d||v?Object(r.ub)(e,c):void 0,C=Object(r.K)(e,c),w=O?Object(r.Ib)(e,O):void 0,E=b?Object(r.Gb)(e,h,b):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(r.l)(e,h,j):void 0,N=k&&Object(r.ub)(e,k),T=Object(r.Hb)(e,c),P="thread"===u&&(o?o.messages.some(t=>Object(r.U)(e,t)):Object(r.U)(e,c)),{direction:A,noHighlight:x}=P&&a||{},R=s.messageIds&&s.messageIds.includes(m),{query:L}=Object(r.B)(e)||{},D=Object(l.M)(c);let F;return F=o&&o.messages?o.messages.every(({id:t})=>Object(r.V)(e,t)):Object(r.V)(e,m),{theme:Object(r.Cb)(e),forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(r.fb)(e,c,"scheduled"===u)},..."number"==typeof T&&{uploadProgress:T},isFocused:P,...P&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:L,isSingleEmoji:Boolean(D),animatedEmoji:D?Object(r.c)(e,D):void 0,isInSelectMode:Object(r.S)(e),isSelected:F,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(r.Q)(e,h,c.groupedId),threadId:b,isPinnedList:"pinned"===u,shouldAutoLoadMedia:f?Object(r.vb)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(r.wb)(e,c),shouldLoopStickers:Object(r.xb)(e)}},(e,t)=>Object(h.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton","disableContextMenuHint"]))(({message:e,observeIntersectionForBottom:t,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:s,album:n,noAvatars:o,withAvatar:r,withSenderName:i,noComments:d,appearanceOrder:h,isFirstInGroup:O,isLastInGroup:j,isFirstInDocumentGroup:g,isLastInDocumentGroup:f,isLastInList:p,theme:I,forceSenderName:v,sender:y,originSender:C,botSender:w,isThreadTop:E,shouldHideReply:M,replyMessage:S,replyMessageSender:k,outgoingStatus:N,uploadProgress:T,isFocused:P,focusDirection:A,noFocusHighlight:x,isForwarding:R,isChatWithSelf:L,isChannel:D,lastSyncTime:F,highlight:B,animatedEmoji:U,isInSelectMode:H,isSelected:q,isGroupSelected:G,threadId:_,messageListType:z,isPinnedList:$,shouldAutoLoadMedia:W,shouldAutoPlayMedia:V,shouldLoopStickers:K,focusMessage:Q,openMediaViewer:Y,openAudioPlayer:J,openUserInfo:X,openChat:Z,cancelSendingMessage:ee,markMessagesRead:se,sendPollVote:ne,toggleMessageSelection:ce,setReplyingToId:oe,openForwardMenu:le,clickInlineButton:de,disableContextMenuHint:be})=>{const ue=Object(c.q)(null),he=Object(c.q)(null),Oe=Object(c.q)(null);Object(Et.c)(he,t);const{isContextMenuOpen:je,contextMenuPosition:ge,handleBeforeContextMenu:fe,handleContextMenu:pe,handleContextMenuClose:Ie,handleContextMenuHide:ve}=Object(Tt.a)(ue,!1,!0);Object(c.n)(()=>{je&&be()},[je,be]);const ye=h<=0,[Ce,we]=Object(re.a)(ye);Object(c.n)(()=>{ye||setTimeout(we,10*h)},[h,we,ye]);const{transitionClassNames:Ee}=Object(ae.a)(Ce,void 0,ye,!1),{chatId:Me,id:Se,threadInfo:ke}=e,Ne=Object(l.xb)(e),Te=Object(l.yb)(e),Pe="scheduled"===z||e.isScheduled,Ae=Object(l.zb)(e)&&!M,xe=Boolean(ke)&&"thread"===z,{forwardInfo:Re,viaBotId:Le}=e,De=Re&&!L&&!Re.isLinkedChannelPost,Fe=!!e.groupedId&&!e.isInAlbum,Be=Boolean(n)&&n.messages.length>1,{text:Ue,photo:He,video:qe,audio:Ge,voice:_e,document:ze,sticker:$e,contact:We,poll:Ve,webPage:Ke,invoice:Qe}=Object(l.v)(e),Ye=Object(l.x)(e),Je=Object(Pt.a)(e,B,At(Ye)),Xe=void 0!==ge,Ze=D&&e.adminTitle||Re&&!De&&Re.adminTitle||void 0,tt=Object(c.p)(()=>Ze?$t(Ze):void 0,[Ze]),at=!(Xe||H||R)&&(!Fe||f),st=at&&D&&!Pe,nt=Boolean(at&&(Re&&(Re.isChannelPost||L&&!Te)&&Re.fromMessageId||$)),ct=!Re||!L&&y?y:C,ot=Re?C:y,lt=Object(te.a)("Message message-list-item",O&&"first-in-group",j&&"last-in-group",g&&"first-in-document-group",f&&"last-in-document-group",p&&"last-in-list",Te&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Ae&&"has-reply",Xe&&"has-menu-open",P&&!x&&"focused",R&&"is-forwarding",e.isDeleting&&"is-deleting",Fe&&"is-in-document-group",Be&&"is-album",e.hasUnreadMention&&"has-unread-mention",q&&"is-selected",H&&"is-in-selection-mode",E&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",Ee),dt=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:o,hasComments:r}={}){const{text:i,photo:d,video:b,audio:u,voice:m,document:h,poll:O,webPage:j,contact:g}=Object(l.v)(e),f=["message-content"],p=(d||b)&&!i,I=Boolean(e.viaBotId);return At(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),b&&b.isRound&&f.push("round"),r&&f.push("has-comments")),d||b?f.push("media"):u?f.push("audio"):m?f.push("voice"):h?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),(j.photo||j.video)&&f.push("media")),n&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),c&&f.push("has-replies"),I&&f.push("is-via-bot"),o&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||o)&&f.push("has-solid-background"),!s||!d&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Ae,customShape:Ye,isLastInGroup:j,asForwarded:De,hasThread:xe,forceSenderName:v,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),bt=e.threadInfo&&(!Fe||f)&&"thread"===z&&!d,ut=dt.includes("has-appendix");Object(et.a)(Me,Ae?e.replyToMessageId:void 0,S,e.id),Wt(ue,Me,P,A,x),Object(c.o)(()=>{Oe.current&&(Oe.current.innerHTML=Te?'<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>':'<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>')},[Te,ut]);const mt=Object(c.m)(t=>{t.stopPropagation(),ce({messageId:Se,groupedId:e.groupedId})},[Se,e.groupedId,ce]),ht=Object(c.m)(e=>{if(Ne)return;const t=Be&&n&&n.messages?{messageId:Se,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Se,withShift:e&&e.shiftKey};ce(t)},[Ne,Be,n,Se,ce]),Ot=Object(c.m)(()=>{oe({messageId:Se})},[oe,Se]),jt=Object(c.m)(e=>{e.stopPropagation()},[]),gt=Object(c.m)(()=>{ct&&(Object(l.ob)(ct.id)?X({id:ct.id}):Z({id:ct.id}))},[ct,X,Z]),ft=Object(c.m)(()=>{ot&&(Object(l.ob)(ot.id)?X({id:ot.id}):Z({id:ot.id}))},[ot,X,Z]),pt=Object(c.m)(()=>{w&&X({id:w.id})},[w,X]),It=Object(c.m)(()=>{Q({chatId:Me,threadId:_,messageId:e.replyToMessageId,replyMessageId:Se})},[Q,Me,_,e.replyToMessageId,Se]),vt=Object(c.m)(()=>{Y({chatId:Me,threadId:_,messageId:Se,origin:Pe?u.h.ScheduledInline:u.h.Inline})},[Me,_,Se,Y,Pe]),yt=Object(c.m)(()=>{J({chatId:Me,messageId:Se})},[Me,Se,J]),Ct=Object(c.m)(e=>{Y({chatId:Me,threadId:_,messageId:e,origin:Pe?u.h.ScheduledAlbum:u.h.Album})},[Me,_,Y,Pe]),Mt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&(m.b?setTimeout(()=>{pe(e)},150):pe(e))},[pe]),St=Object(c.m)(()=>{se({messageIds:[Se]})},[Se,se]),kt=Object(c.m)(()=>{ee({chatId:Me,messageId:Se})},[ee,Me,Se]),Nt=Object(c.m)(e=>{ne({chatId:Me,messageId:Se,options:e})},[Me,Se,ne]),Lt=Object(c.m)(()=>{le({fromChatId:Me,groupedId:e.groupedId})},[le,Me,e.groupedId]),Dt=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);le({fromChatId:Me,messageIds:e})}else le({fromChatId:Me,messageIds:[Se]})},[n,le,Me,Se]),Ft=Object(c.m)(()=>{Q({chatId:Me,threadId:b.MAIN_THREAD_ID,messageId:Se})},[Q,Me,Se]),Bt=Object(c.m)(()=>{Q(Fe?{chatId:Re.fromChatId,groupedId:e.groupedId,groupedChatId:Me}:{chatId:Re.fromChatId,messageId:Re.fromMessageId})},[Q,Re,e,Me,Fe]),Ut=Object(ie.a)();let Ht,qt="",Gt=!1;const zt=Object(c.p)(()=>Be?_t(Te,Boolean(De),Boolean(o),n):void 0,[Be,Te,De,o,n]),Kt=De?28:0;if(Be||!He&&!qe)zt&&(Ht=Math.max(xt(Boolean(Ue),bt),zt.containerStyle.width),Ht-zt.containerStyle.width>18&&(Gt=!0));else{let t;He?t=Rt(e,o).width:qe&&(t=qe.isRound?rt.e:Rt(e,o).width),t&&(Ht=Math.max(xt(Boolean(Ue),bt),t),Ht-t>18&&(Gt=!0))}return Ht&&(qt=`width: ${Ht+Kt}px`),c.a.createElement("div",{ref:ue,id:"message"+Se,className:lt,style:tt?`--meta-safe-author-width: ${tt}px`:void 0,"data-message-id":Se,onClick:H?ht:m.b?Mt:void 0,onDoubleClick:H?void 0:Ot,onMouseDown:H?void 0:e=>{wt(e),Ne||fe(e)},onContextMenu:H||Ne?void 0:pe,onMouseEnter:Fe&&!f?za:void 0,onMouseLeave:Fe&&!f?$a:void 0},c.a.createElement("div",{ref:he,className:"bottom-marker","data-message-id":Se,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Ne&&!Fe&&c.a.createElement("div",{className:"message-select-control"},q&&c.a.createElement("i",{className:"icon-select"})),!Ne&&f&&c.a.createElement("div",{className:Object(te.a)("message-select-control group-select",G&&"is-selected"),onClick:mt},G&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=ct&&Object(l.ob)(ct.id),t=ct&&e?ct:void 0,a=ct&&!e?ct:void 0,s=!ct&&Re?Re.hiddenUserName:void 0;return c.a.createElement(Vt.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:F,onClick:t||a?gt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:H&&Fe?ht:void 0},c.a.createElement("div",{className:dt,style:qt,dir:"auto"},De&&!Ye&&(!Fe||g)&&c.a.createElement("div",{className:"message-title"},Ut("ForwardedMessage")),function(){const t=Object(te.a)("content-inner",De&&!Ye&&"forwarded-message",Ae&&"reply-message",Gt&&"no-media-corners"),r=j&&!Je&&!De&&!xe,d=!Ke&&!U&&Je;return c.a.createElement("div",{className:t,onDoubleClick:jt,dir:"auto"},function(){if(Ye||!(i&&!He&&!qe||De||Le||v)||Fe&&!g)return;let t,a;ot?(t=Object(l.X)(Ut,ot),De||(a="color-"+Object(l.Z)(ot))):Re&&Re.hiddenUserName&&(t=Re.hiddenUserName);return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(te.a)(ot&&"interactive",a),onClick:ot?ft:void 0,dir:"auto"},Object(it.a)(t)):w?void 0:" ",w&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Ut("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:pt},Object(it.a)("@"+w.username))),Re&&Re.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},Ut("DiscussChannel")):e.adminTitle&&!D?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Ae&&c.a.createElement(Jt,{message:S,sender:k,observeIntersection:a,onClick:It}),$e&&c.a.createElement(ca,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:K,lastSyncTime:F}),U&&c.a.createElement(oa.a,{isInline:!0,sticker:U,observeIntersection:a,lastSyncTime:F,forceLoadPreview:Ne}),Be&&c.a.createElement(Ba,{album:n,albumLayout:zt,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:V,isOwn:Te,hasCustomAppendix:r,lastSyncTime:F,onMediaClick:Ct}),!Be&&He&&c.a.createElement(ha,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,uploadProgress:T,shouldAffectAppendix:r,onClick:vt,onCancelUpload:kt}),!Be&&qe&&qe.isRound&&c.a.createElement(qa,{message:e,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:V,lastSyncTime:F}),!Be&&qe&&!qe.isRound&&c.a.createElement(va,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:V,uploadProgress:T,lastSyncTime:F,onClick:vt,onCancelUpload:kt}),(Ge||_e)&&c.a.createElement(Zt.a,{theme:I,message:e,uploadProgress:T,lastSyncTime:F,isSelectable:Fe,isSelected:q,onPlay:yt,onReadMedia:!_e||Te&&!L?void 0:St,onCancelUpload:kt}),ze&&c.a.createElement(Xt.a,{message:e,observeIntersection:a,uploadProgress:T,isSelectable:Fe,isSelected:q,onMediaClick:vt,onCancelUpload:kt}),We&&c.a.createElement(Ca,{contact:We}),Ve&&c.a.createElement(Ta,{message:e,poll:Ve,onSendVote:Nt}),!U&&Je&&c.a.createElement("p",{className:"text-content "+(d?"with-meta":""),dir:"auto"},Je,d&&c.a.createElement(ta,{message:e,outgoingStatus:N,signature:Ze,onClick:ht})),Ke&&c.a.createElement(xa,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:V,lastSyncTime:F,onMediaClick:vt,onCancelMediaTransfer:kt}),Qe&&c.a.createElement(Ra,{message:e}))}(),(!Fe||f)&&!(!Ke&&!U&&Je)&&c.a.createElement(ta,{message:e,outgoingStatus:N,signature:Ze,onClick:ht}),st?c.a.createElement(me.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ut("lng_context_forward_msg"),onClick:f?Lt:Dt},c.a.createElement("i",{className:"icon-share-filled"})):nt?c.a.createElement(me.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:$?Ft:Bt},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,bt&&c.a.createElement(_a,{message:e,disabled:d}),ut&&c.a.createElement("div",{className:"svg-appendix",ref:Oe})),e.inlineButtons&&c.a.createElement(Ga,{message:e,onClick:de})),ge&&c.a.createElement(Qt,{isOpen:je,anchor:ge,message:e,album:n,messageListType:z,onClose:Ie,onCloseAnimationEnd:ve}))}));a(236);const Ka=m.b?1e3:350,Qa=m.k?300:500,Ya=Object(p.a)(e=>e(),200,!1);var Ja=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(r.g)(e,t);if(!n)return{};const c=Object(r.y)(e,t,a,s),o="scheduled"===s?Object(r.rb)(e,t):Object(r.n)(e,t),i=Object(r.Gb)(e,t,a);if(a!==b.MAIN_THREAD_ID&&!(o&&i&&o[i]))return{};const{isRestricted:d,restrictionReason:u,lastMessage:m}=n,h=Object(r.I)(e,t),O=a===b.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&m&&!m.groupedId;let j;if(Object(r.L)(e,t)){const a=Object(r.h)(e,t);j=a.fullInfo?a.fullInfo.botDescription||"NoMessages":"Updating bot info..."}return{isChatLoaded:!0,isRestricted:d,restrictionReason:u,isChannelChat:Object(l.mb)(n),isChatWithSelf:Object(r.P)(e,t),messageIds:c,messagesById:o,firstUnreadId:Object(r.H)(e,t,a),isViewportNewest:"thread"!==s||Object(r.X)(e,t,a),threadFirstMessageId:Object(r.G)(e,t,a),focusingId:h,isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel,...O&&{lastMessage:m},botDescription:j,threadTopMessageId:i,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0}},(e,t)=>Object(h.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:o,onFabToggle:i,onNotchToggle:d,isChatLoaded:b,isChannelChat:m,canPost:O,isReady:j,isChatWithSelf:g,messageIds:f,messagesById:I,firstUnreadId:v,isViewportNewest:y,threadFirstMessageId:C,isRestricted:w,restrictionReason:E,focusingId:M,isSelectModeActive:S,animationLevel:k,loadViewportMessages:N,markMessageListRead:T,markMessagesRead:P,setScrollOffset:A,lastMessage:x,botDescription:R,threadTopMessageId:D,hasLinkedChat:F,openHistoryCalendar:B})=>{const U=Object(c.q)(null),H=Object(c.q)("thread"===a&&Object(r.sb)(Object(s.e)(),e,t)||0),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),z=Object(c.q)(),$=Object(c.q)(),W=Object(c.q)(),V=Object(c.q)(!1),K=Object(c.q)(Boolean(x)),[Q,Y]=Object(c.r)(),[J,X]=Object(c.r)(Boolean(M)),Z=Boolean(f);Object(ye.a)(()=>{Z&&Object(p.e)(()=>{K.current=!1})},[Z]),Object(ye.a)(()=>{$.current=v,z.current||(z.current=v)},[v]);const{observe:ae}=Object(Et.a)({rootRef:U,throttleMs:Ka,margin:Qa}),{observe:ne,freeze:ce,unfreeze:oe}=Object(Et.a)({rootRef:U},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:n}=e;if(!a)return;const{dataset:c}=n,o=Number(c.lastMessageId||c.messageId);o>t&&(t=o),c.hasUnreadMention&&s.push(o)}),$.current&&t>=$.current&&T({maxId:t}),s.length&&P({messageIds:s})});Object(se.a)(ce,oe),Object(ye.a)(()=>{W.current=M},[M]);const{observe:re}=Object(Et.a)({rootRef:U,throttleMs:Ka});Object(c.n)(()=>{M?X(!0):setTimeout(()=>{X(!1)},200)},[M]);const le=Object(c.p)(()=>{if(!f||!I)return;const e=!D||f[0]&&C!==f[0]?f:[D,...f];if(!e.length)return;const t=e.map(e=>I[e]).filter(Boolean);return Ct(Object(h.k)(t,["date","id"]),z.current)},[f,I,C,D]),[de,be,ue]=Object(c.p)(()=>"thread"===a?[Object(p.a)(()=>N({direction:u.e.Backwards}),1e3,!0,!1),Object(p.a)(()=>N({direction:u.e.Forwards}),1e3,!0,!1),Object(p.a)(()=>N({direction:u.e.Around}),1e3,!0,!1)]:[],[N,f]),{isScrolled:me,updateStickyDates:he}=Mt(),Oe=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=U.current;W.current||he(s,o),Ya(()=>{Object(p.b)(()=>{s.parentElement&&(H.current=s.scrollHeight-s.scrollTop,"thread"===a&&A({chatId:e,threadId:t,scrollOffset:H.current}))})})},[he,o,a,A,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&Y(e.contentRect.height)});return e.observe(U.current),()=>{e.disconnect()}},[]);const{height:je}=Ye();Object(c.n)(()=>{j&&(U.current.dataset.normalHeight=String(U.current.offsetHeight))},[je,j]),Object(c.n)(()=>{if(!ue||!b||w||M)return;const e=U.current;(!f||f.length<n.bb/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ue()},[b,f,ue,M,w]),Object(ye.a)(()=>{if(!f||!_.current||!j)return;const e=_.current.filter(e=>f.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(q.current=t.id,G.current=t.getBoundingClientRect().top)},[f,y,Q,o,j]),Object(vt.a)(([e,t,a])=>{const s=U.current;if(_.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=y&&f&&f.length<n.bb/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;c&&(s.parentElement.classList.add("force-messages-scroll"),setTimeout(()=>{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:r,scrollHeight:i,offsetHeight:l}=s,d=H.current,b=_.current[_.current.length-1],u=b?b.offsetHeight:0,m=y&&t&&d-(a||l)-u<=100;let h;const O=f&&e&&f[0]!==e[0],j=f&&e&&f[f.length-1]!==e[e.length-1],g=f&&W.current===f[f.length-1];if(m&&j&&!O&&!g&&(b&&Object(p.b)(()=>{Object(kt.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,H.current=Math.max(i-h,l),!c))return;const I=void 0!==a&&a!==Q,v=q.current&&s.querySelector("#"+q.current),C=!v&&z.current&&s.querySelector(".unread-divider");if(m&&I){if(Object(kt.b)())return;h=i-l}else if(v){h=r+(v.getBoundingClientRect().top-(G.current||0))}else h=C?Math.min(C.offsetTop-(o?60:10),i-d):i-d;Object(St.a)(s,h),W.current||(V.current=!0,Object(p.b)(()=>{V.current=!1})),H.current=Math.max(i-h,l)},[f,y,Q,o]),Object(c.n)(()=>{(!k||k>0)&&Object(ee.b)(200+n.c)},[k,S]);const ge=Object(ie.a)(),fe=Boolean(e&&Object(l.ob)(e)),pe=Boolean(!fe&&!m||g),Ie=Boolean(!pe||m),ve=Object(te.a)("MessageList custom-scroll",Ie&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",S&&"select-mode-active",J&&"has-focusing",me&&"scrolled",!j&&"is-animating");return c.a.createElement("div",{ref:U,className:ve,onScroll:Oe,onMouseDown:wt},w?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(m?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(it.a)(ge(R),["br","emoji","links"]))):f&&!le?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,ge("NoMessages"))):f&&le||x?c.a.createElement(Nt,{containerRef:U,className:"messages-container",messageIds:f||[x.id],loadMoreForwards:be,loadMoreBackwards:de,isViewportNewest:y,firstUnreadId:v,onFabToggle:i,onNotchToggle:d},function(e,t,a,s,o,r,i,d,b,u,m,O,j,g,f,p,I){const v=c.a.createElement("div",{className:Object(te.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),y=p?0:t.reduce((e,t)=>e+Object(h.h)(t.senderGroups).length,0);let C=0;const w=t.map((t,j,p)=>{const w=t.senderGroups.map((t,n,f)=>{if(1===t.length&&!yt(t[0])&&Object(l.gb)(t[0])){const e=t[0],s=n===f.length-1&&j===p.length-1;return Object(h.e)([e.id===b.current&&v,c.a.createElement(Yt,{key:e.id,message:e,observeIntersection:a,appearanceOrder:y-++C,isLastInList:s})])}let I;return Object(h.h)(t.map((w,E)=>{const M=yt(w)?w.mainMessage:w,S=yt(w)?w:void 0,k=Object(l.yb)(M),N=yt(w),T=t[E+1];M.previousLocalId&&d.current==="message"+M.previousLocalId&&(d.current="message"+M.id);const P=!N&&M.groupedId?M.groupedId:void 0,A=T&&!yt(T)?T.groupedId:void 0,x={isFirstInGroup:0===E,isLastInGroup:E===t.length-1,isFirstInDocumentGroup:Boolean(P&&P!==I),isLastInDocumentGroup:Boolean(P&&P!==A),isLastInList:E===t.length-1&&n===f.length-1&&j===p.length-1};I=P;const R=Object(l.G)(M),L="scheduled"!==m?R:`${M.date}_${R}`;return Object(h.e)([M.id===b.current?v:void 0,c.a.createElement(Va,{key:L,message:M,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:o,album:S,noAvatars:i,withAvatar:x.isLastInGroup&&r&&!k&&!(M.id===O),withSenderName:x.isFirstInGroup&&r&&!k,threadId:u,messageListType:m,noComments:!1===g,appearanceOrder:y-++C,isFirstInGroup:x.isFirstInGroup,isLastInGroup:x.isLastInGroup,isFirstInDocumentGroup:x.isFirstInDocumentGroup,isLastInDocumentGroup:x.isLastInDocumentGroup,isLastInList:x.isLastInList}),M.id===O&&c.a.createElement("div",{className:"local-action-message",key:"discussion-started"},c.a.createElement("span",null,e("DiscussionStarted")))])}))});return c.a.createElement("div",{className:"message-date-group",key:t.datetime,onMouseDown:wt,teactFastList:!0},c.a.createElement("div",{className:Object(te.a)("sticky-date",!f&&"interactive"),key:"date-header",onMouseDown:wt,onClick:f?void 0:()=>I({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},f&&t.originalDate===n.sb&&e("MessageScheduledUntilOnline"),f&&t.originalDate!==n.sb&&e("MessageScheduledOn",Object(L.c)(e,t.datetime,void 0,!0)),!f&&Object(L.c)(e,t.datetime))),Object(h.h)(w))});return Object(h.h)(w)}(ge,le||Ct([x]),ne,ae,re,pe,Ie,q,z,t,a,D,0,F,!!le&&"scheduled"===a,!le||!K.current,B)):c.a.createElement(Te.a,{color:"white"}))}));a(237);var Xa=Object(c.h)(Object(s.h)(e=>{const t=Object(r.z)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(r.g)(e,a);return{messageListType:n,unreadCount:c&&s===b.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(h.l)(t,["focusNextReply"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusNextReply:n})=>{const o=Object(ie.a)(),r=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(kt.a)(e,a,"end",20)}},[e,a,n]),l=Object(te.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:r,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(me.a,{color:"secondary",round:!0,onClick:i,ariaLabel:o("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(at.b)(s))))})),Za=a(129),es=a(137);async function ts(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:o}=t;let r,i;if(c.startsWith("image/"))if(a){const a=await Object(Ke.g)(n),{width:o,height:i}=a;if(o>1280||i>1280||"image/jpeg"!==c){const c=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:n,height:c}=e;(n>1280||c>1280)&&(n>=c?(c*=1280/n,n=1280):(n*=1280/c,c=1280)),a.width=n,a.height=c,s.drawImage(e,0,0,e.width,e.height,0,0,n,c),a.toBlob(t,"image/jpeg",100)})}(a);return c?(URL.revokeObjectURL(n),ts(e,c,!0,s)):ts(e,t,!1,s)}r={width:o,height:i}}else i=n;else if(c.startsWith("video/")){if(o<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Ke.h)(n);r={width:e,height:t,duration:a}}i=await Object(Ke.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:o,quick:r,previewBlobUrl:i,...s}}var as=a(181);let ss;m.e&&(ss=document.createElement("input"),ss.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(ss));var ns=a.p+"c0155344d336103c2b6a0b28cc510750.js";const cs={encoderPath:ns,reuseWorker:!0},os={type:"audio/ogg"};let rs,is,ls;async function ds(){return rs||(rs=a.e(10).then(a.t.bind(null,318,7)),is=(await rs).default,ls=new is(cs)),rs}async function bs(e){await async function(){await ds(),await ls.start()}();const t=Date.now();let a;const s=[],n=[];ls.ondataavailable=e=>{s.push(e)};const c=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const n=s.frequencyBinCount,c=new Uint8Array(n);let o=!1;return function e(){if(o)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),r=a/n/255;t(r<.1?0:r),requestAnimationFrame(e)}(),()=>{o=!0}}(ls,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,o)=>{ls.onstop=()=>{e({blob:new Blob(s,os),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},ls.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout(()=>{ls.stop(),c()},r)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{ls.pause(),a=Date.now(),c()},e)}}}const us=["image/png","image/jpeg","image/gif"];function ms(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Pt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let hs,Os;var js=a(65);var gs=a(182),fs=a(190);var ps=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function Is(){return(Is=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let vs,ys=!0;var Cs=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,ys)return ys=!1,void e();vs&&(clearTimeout(vs),vs=void 0),vs=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(me.a,Is({},t,{onMouseEnter:m.m?void 0:s,onMouseLeave:m.m?void 0:n,onClick:m.m?e:void 0}))});var ws=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var Es=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var Ms=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var Ss=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var ks=e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},Ns=a(183);var Ts=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),Ps=a(184),As=a(118);a(239);var xs=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(r.z)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:o,messageIds:i}}=e,d=Object(r.nb)(e,t,a),b="scheduled"===s?Object(r.F)(e,t):Object(r.D)(e,t,a),u=e.settings.byKey.animationLevel>=1,m=o===t;let h,O;if(d?h=Object(r.l)(e,t,d):b?h=Object(r.E)(e,t,a,s):m&&1===i.length&&(h=Object(r.l)(e,c,i[0])),d&&h){const{forwardInfo:a}=h,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(r.K)(e,h)),O||(O=Object(r.ub)(e,h))}else m&&(O=Object(l.ob)(c)?Object(r.Ib)(e,c):Object(r.g)(e,c));return{replyingToId:d,editingId:b,message:h,sender:O,shouldAnimate:u,forwardedMessagesCount:m?i.length:void 0}},(e,t)=>Object(h.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:o,setReplyingToId:r,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&o),u=Object(As.a)([o],o?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(ae.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?r({messageId:void 0}):t?i({messageId:void 0}):o&&d()},[e,t,o,r,i,d]);Object(c.n)(()=>b?Object(ce.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(te.a)("ComposerEmbeddedMessage",h),f=o&&o>1?o+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(me.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Jt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var Rs=Object(c.h)(e=>{const{attachments:t}=e,a=Object(Ne.a)(ke.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var Ls=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ds=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(240);const Fs=new RegExp(n.mb,"i");var Bs=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(r.cb)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(h.l)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"]))(({chatId:e,threadId:t,messageText:a,disabled:s,webPagePreview:n,noWebPage:o,loadWebPagePreview:r,clearWebPagePreview:i,toggleMessageWebPage:l})=>{const d=Object(c.p)(()=>{const{text:e,entities:t}=Object(es.a)(a),s=t&&t.find(({type:e})=>e===b.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Fs);return n?n[0]:void 0},[a]);Object(c.n)(()=>{d?r({text:d}):(i(),l({chatId:e,threadId:t}))},[e,l,i,d,r,t]),Object(ye.a)(()=>{i(),l({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!o&&!s),{shouldRender:m,transitionClassNames:h}=Object(ae.a)(u),O=Object(tt.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(te.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(me.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{l({chatId:e,threadId:t,noWebPage:!0})}},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(xa,{message:f,inPreview:!0})))})),Us=a(123);var Hs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var qs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var Gs,_s=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(241);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Gs||(Gs={}));var zs=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const c=Object(r.g)(e,t),o=c&&Object(r.p)(e,c),i=c?Object(r.O)(e,c):void 0,d=Object(r.P)(e,t),u=i&&Object(r.bb)(e,t),m=Object(r.pb)(e,t),{language:h}=e.settings.byKey,O=e.emojiKeywords[n.j],j=h!==n.j?e.emojiKeywords[h]:void 0;return{editingMessage:Object(r.E)(e,t,a,s),connectionState:e.connectionState,draft:Object(r.C)(e,t,a),chat:c,isChatWithBot:i,isChatWithSelf:d,canScheduleUntilOnline:!d&&!i&&c&&o&&Object(l.ob)(t)&&o.status&&Boolean(o.status.wasOnline),isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),withScheduledButton:a===b.MAIN_THREAD_ID&&"thread"===s&&Boolean(m&&m.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:u?u.id:void 0,isForwarding:t===e.forwardMessages.toChatId,canSuggestMembers:c&&Object(l.nb)(c),isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:c&&c.fullInfo&&c.fullInfo.members,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis,language:h,baseEmojiKeywords:O?O.keywords:void 0,emojiKeywords:j?j.keywords:void 0,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(h.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","loadEmojiKeywords"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:o,isReady:r,editingMessage:i,chatId:d,threadId:u,messageListType:h,draft:O,chat:j,connectionState:g,isChatWithBot:f,isChatWithSelf:I,isRightColumnShown:v,isSelectModeActive:y,isForwarding:C,canSuggestMembers:w,isPollModalOpen:E,isPaymentModalOpen:M,isReceiptModalOpen:S,botKeyboardMessageId:k,withScheduledButton:N,stickersForEmoji:T,groupChatMembers:P,currentUserId:A,usersById:x,lastSyncTime:R,contentToBeScheduled:D,shouldSuggestStickers:F,language:B,baseEmojiKeywords:U,emojiKeywords:H,serverTimeOffset:q,recentEmojis:G,sendMessage:_,editMessage:z,saveDraft:$,clearDraft:W,showDialog:V,setStickerSearchQuery:K,setGifSearchQuery:Q,forwardMessages:Y,openPollModal:J,closePollModal:X,loadScheduledHistory:Z,closePaymentModal:ee,openChat:ae,clearReceipt:oe,addRecentEmoji:le,loadEmojiKeywords:de})=>{const be=Object(c.q)(null),[ue,he]=Object(c.r)(""),Oe=Object(c.q)(),je=Object(da.a)(e),[ge,fe,Ie]=Object(re.a)(),[ve,ye]=Object(c.r)(),Ce=Object(ie.a)(),we=Object(c.q)(ue);Object(c.n)(()=>{we.current=ue},[ue]),Object(c.n)(()=>{Oe.current=void 0},[d]),Object(c.n)(()=>{d&&R&&u===b.MAIN_THREAD_ID&&r&&Z()},[r,d,Z,R,u]),Object(c.n)(()=>{R&&r&&(de({language:n.j}),B!==n.j&&de({language:B}))},[de,B,R,r]),Object(c.o)(()=>{be.current&&(be.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>')},[]),Object(c.n)(()=>{D&&(ye(D),fe())},[D,fe]);const[Ee,Me]=Object(c.r)([]),[Se,ke,Ne]=Object(re.a)(),[Te,Pe,Ae]=Object(re.a)(),[xe,Re,Le]=Object(re.a)(),[De,Fe,Be]=Object(re.a)(),[Ue,He]=Object(re.a)(),[qe,Ge,_e]=Object(re.a)(),{startRecordingVoice:ze,stopRecordingVoice:$e,pauseRecordingVoice:Ve,activeVoiceRecording:Ke,currentRecordTime:Qe,recordButtonRef:Ye,startRecordTimeRef:Je}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,o]=Object(c.r)();Object(c.n)(()=>{m.e&&ds()},[]);const r=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await bs(t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))});s.current=Date.now(),o(Date.now()),a({stop:t,pause:n})}catch(e){console.error(e)}},[]),i=Object(c.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(c.m)(()=>{if(t){a(void 0),s.current=void 0,o(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}},[t]);return Object(c.n)(()=>t?Object(ce.a)(l):void 0,[t,l]),{startRecordingVoice:r,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),Xe=i?Gs.Edit:!m.n||Ke||ue&&!Ee.length||C?Gs.Send:Gs.Record,Ze=!t,{isMentionTooltipOpen:et,mentionFilter:tt,closeMentionTooltip:at,insertMention:st,mentionFilteredMembers:nt}=Object(fs.a)(w&&!Ee.length,ue,he,void 0,P,A,x),{isContextMenuOpen:ct,handleContextMenu:ot,handleContextMenuClose:rt,handleContextMenuHide:lt}=Object(Tt.a)(Ye,!(Xe===Gs.Send&&Ze)),dt=Object(c.p)(()=>Object(l.b)(j,f),[j,f]),bt=j&&Object(l.jb)(j),ut=Object(l.j)(j),{isStickerTooltipOpen:mt,closeStickerTooltip:ht}=function(e,t,a,n=!1){const{loadStickersForEmoji:o,clearStickersForEmoji:r}=Object(s.d)(),i=m.d&&1===Object(js.a)(t)||!m.d&&Boolean(t.match(/^<img.[^>]*?>$/g)),l=Boolean(a)&&i;return Object(c.n)(()=>{n||(e&&i?o({emoji:t}):!l&&i||r())},[t,i,r,o,e,n]),{isStickerTooltipOpen:l,closeStickerTooltip:r}}(Boolean(F&&dt.canSendStickers&&!Ee.length),ue,T,!r),{isEmojiTooltipOpen:Ot,closeEmojiTooltip:jt,filteredEmojis:gt,insertEmoji:ft}=Object(gs.a)(Boolean(F&&dt.canSendStickers&&!Ee.length),ue,G,void 0,he,U,H,!r),pt=Object(c.m)((e,t=n.x)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(it.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(as.a)(e,t))return function(e){const t=window.getSelection();if(t&&t.getRangeAt&&t.rangeCount){const a=t.getRangeAt(0);a.deleteContents();const s=a.createContextualFragment(e),n=s.lastChild;a.insertNode(s),n&&(a.setStartAfter(n),a.setEndAfter(n),t.removeAllRanges(),t.addRange(a))}}(c),void s.dispatchEvent(new Event("input",{bubbles:!0}))}he(`${we.current}${c}`),m.k||requestAnimationFrame(()=>{Object(Za.a)(s)})},[]),It=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(as.a)(t,n.x))return void document.execCommand("delete",!1)}he(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 a=t.lastChild;if(a.lastChild)for(;a.lastChild;)a=a.lastChild;const s=a.textContent.length,n=document.createRange(),c=window.getSelection();n.setStart(a,s),n.setEnd(a,s),c.removeAllRanges(),c.addRange(n),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}(we.current))},[]),vt=Object(c.m)(()=>{he(""),Me([]),ht(),Ie(),ye(void 0),at(),jt(),m.k?setTimeout(()=>Le(),350):Le()},[ht,Ie,at,jt,Le]),yt=Object(da.a)(d);Object(c.n)(()=>{yt&&d!==yt&&($e(),vt())},[d,yt,vt,$e]);const Ct=((e,t,a,s,o,r)=>{Object(c.n)(()=>{a?(t(ms(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.x);Object(Za.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(es.a)(e.current);a&&(t||Object(l.fb)(a)?(r({messageId:a.id,text:t,entities:n}),s()):o())},[r,a,e,o,s])})(we,he,i,vt,Fe,z);((e,t,a,s,o,r,i,l,d)=>{const b=Object(c.m)((e,t)=>{o.current.length&&!i?l({chatId:e,threadId:t,draft:Object(es.a)(o.current)}):d({chatId:e,threadId:t})},[d,i,o,l]),u=Object(c.p)(()=>Object(p.a)(e=>e(),n.w,!1),[t]),m=Object(da.a)(t),h=Object(da.a)(a);Object(c.n)(()=>(hs=t,Os=a,()=>{hs=void 0,Os=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(r(ms(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.x);Object(Za.a)(e,!0)}))},[t,a,e,r,b,m,h]);const O=Object(da.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{hs===t&&Os===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]);const j=Object(c.m)(()=>{t&&a&&b(t,a)},[t,a,b]);Object(se.a)(j),ne(j)})(O,d,u,ue,we,he,i,$,W),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&![n.x,n.y].includes(c.id))return;const{items:o}=s.clipboardData,r=Array.from(o).find(e=>us.includes(e.type)),i=r&&r.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await ts(i.name,i,!0);t(t=>[...t,e])}l&&e(l,c?c.id:void 0)}}return document.addEventListener("paste",s,!1),()=>{document.removeEventListener("paste",s,!1)}},[e,a,t])})(pt,Me,i);const wt=Object(c.m)(async(e,t)=>{Me(await Promise.all(e.map(e=>ts(e.name,e,t))))},[]),Et=Object(c.m)(async(e,t)=>{Me([...Ee,...await Promise.all(e.map(e=>ts(e.name,e,t)))])},[Ee]),Mt=Object(c.m)(()=>{Me([])},[]),St=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==g)return;let a=Ee;if(Ke){const e=await $e();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await ts("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(es.a)(we.current);if(!a.length&&!s&&!C)return;if(a.length&&s&&s.length>1024){const e=s.length-1024;return void V({data:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const o=document.getElementById(n.x);if(a.length||s){if(ut&&!bt){const e=Math.floor(Date.now()/1e3)+q,t=Oe.current&&Math.floor(e-Oe.current),a=ut.nextSendDate&&ut.nextSendDate>e;if(t&&t<ut.seconds||a){const s=a?ut.nextSendDate-e:ut.seconds-t;return V({data:{message:Ce("SlowModeHint",Object(L.e)(s)),isSlowMode:!0,hasErrorKey:!1}}),void o.blur()}}_({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}var r;C&&Y(),Oe.current=Math.floor(Date.now()/1e3)+q,W({chatId:d,localOnly:!0}),m.e&&o===document.activeElement&&(r=o,ss.focus(),r.focus()),requestAnimationFrame(vt)},[g,Ee,Ke,C,q,W,d,vt,$e,V,ut,bt,_,Y,Ce]),kt=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(ye({sticker:e}),fe()):(_({sticker:e}),requestAnimationFrame(vt))},[t,fe,_,vt]),Nt=Object(c.m)(e=>{t?(ye({gif:e}),fe()):(_({gif:e}),requestAnimationFrame(vt))},[t,fe,_,vt]),Pt=Object(c.m)(e=>{t?(ye({poll:e}),X(),fe()):(_({poll:e}),X())},[X,fe,_,t]),At=Object(c.m)(()=>{t?(ye({isSilent:!0}),fe()):St(!0)},[St,fe,t]),xt=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=ve||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:q);ve&&0!==Object.keys(s).length?(_({...ve,scheduledAt:n}),requestAnimationFrame(vt)):St(!!a,n),Ie()},[Ie,St,vt,ve,_,q]),Rt=Object(c.m)(()=>{xt(new Date(1e3*n.sb),!0)},[xt]),Lt=Object(c.m)(()=>{Ie(),ye(void 0)},[Ie]),Dt=Object(c.m)(e=>{"stickers"===e?(K({query:""}),Q({query:void 0})):(Q({query:""}),K({query:void 0}))},[K,Q]),Ft=Object(c.m)(()=>{const e=document.getElementById(n.x);m.k&&e===document.activeElement?(e.blur(),setTimeout(()=>{Re()},100)):Re()},[Re]),Bt=Object(c.m)(()=>{ae({id:d,threadId:u,type:"scheduled"})},[ae,d,u]);Object(c.n)(()=>{v&&m.k&&Le()},[v,Le]),Object(c.n)(()=>{r&&(y?Ge():setTimeout(()=>{_e()},200))},[y,_e,Ge,r]);const Ut=Object(c.m)(()=>{switch(Xe){case Gs.Send:t?(Ke&&Ve(),fe()):(St(),requestAnimationFrame(vt));break;case Gs.Record:ze();break;case Gs.Edit:Ct()}},[Xe,vt,t,ze,Ct,Ke,fe,Ve,St]),Ht=Xe===Gs.Record&&!dt.canAttachMedia,qt=Object(da.a)(i,!0),Gt=i||qt,_t=new Date;_t.setSeconds(0),_t.setMilliseconds(0);const zt=new Date;zt.setFullYear(zt.getFullYear()+1);let $t="SendMessage";switch(Xe){case Gs.Edit:$t="Save edited message";break;case Gs.Record:$t=Ht?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const Wt=Object(te.a)("Composer",!y&&"shown",qe&&"hover-disabled"),Vt=Object(te.a)("mobile-symbol-menu-button",Ue?xe&&"menu-opened":xe&&"is-loading"),Kt=Xe===Gs.Edit?Ct:t?fe:St;return c.a.createElement("div",{className:Wt},dt.canAttachMedia&&r&&c.a.createElement(Us.a,{containerId:"#middle-column-portals"},c.a.createElement(Ds,{isOpen:e!==We.a.None,withQuick:[e,je].includes(We.a.QuickFile),onHide:o,onFileSelect:wt})),c.a.createElement(Rs,{attachments:Ee,caption:Ee.length?ue:"",canSuggestMembers:w,groupChatMembers:P,currentUserId:A,usersById:x,recentEmojis:G,onCaptionUpdate:he,baseEmojiKeywords:U,emojiKeywords:H,addRecentEmoji:le,onSend:t?fe:St,onFileAppend:Et,onClear:Mt}),c.a.createElement(Ls,{isOpen:Boolean(E),onClear:X,onSend:Pt}),c.a.createElement(qs,{isOpen:Boolean(M),onClose:ee}),c.a.createElement(_s,{isOpen:Boolean(S),onClose:oe}),Gt&&c.a.createElement(ps,{isOpen:De,isSchedule:"scheduled"===h,onClose:Be,message:Gt}),c.a.createElement(Ms,{isOpen:et,filter:tt,onClose:at,onInsertUserName:st,filteredChatMembers:nt,usersById:x}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:be}),c.a.createElement(xs,null),c.a.createElement(Bs,{chatId:d,threadId:u,messageText:Ee.length?"":ue,disabled:!dt.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},m.k?c.a.createElement(me.a,{className:Vt,round:!0,color:"translucent",onClick:xe?Le:Ft,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),!Ue&&c.a.createElement(pe.a,{color:"gray"})):c.a.createElement(Cs,{className:""+(xe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Re,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(Ps.a,{id:"message-input-text",html:Ee.length?"":ue,placeholder:Ke&&window.innerWidth<=600?"":Ce("Message"),shouldSetFocus:xe,shouldSuppressFocus:m.k&&xe,shouldSuppressTextFormatter:Ot||et,onUpdate:he,onSend:Kt,onSuppressedFocus:Le}),N&&c.a.createElement(me.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Bt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),k&&!Ke&&!i&&c.a.createElement(Cs,{className:""+(Se?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ke,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!Ke&&!i&&c.a.createElement(Cs,{className:""+(Te?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Pe,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),Ke&&Qe&&c.a.createElement("span",{className:"recording-state"},Object(L.i)(Qe-Je.current)),c.a.createElement(ks,{isOpen:mt,onStickerSelect:kt}),c.a.createElement(Ns.a,{isOpen:Ot,emojis:gt,onClose:jt,onEmojiSelect:ft,addRecentEmoji:le}),c.a.createElement(ws,{isOpen:Te,allowedAttachmentOptions:dt,onFileSelect:wt,onPollCreate:J,onClose:Ae}),k&&c.a.createElement(Ts,{messageId:k,isOpen:Se,onClose:Ne}),c.a.createElement(Es,{isOpen:xe,allowedAttachmentOptions:dt,onLoad:He,onClose:Le,onEmojiSelect:pt,onStickerSelect:kt,onGifSelect:Nt,onRemoveSymbol:It,onSearchOpen:Dt,addRecentEmoji:le}))),Ke&&c.a.createElement(me.a,{round:!0,color:"danger",className:"cancel",onClick:$e,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(me.a,{ref:Ye,round:!0,color:"secondary",className:`${Xe} ${Ke?"recording":""}`,disabled:Ht,ariaLabel:Ce($t),onClick:Ut,onContextMenu:Xe===Gs.Send&&Ze?ot:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),Ze&&c.a.createElement(Ss,{isOpen:ct,onSilentSend:I?void 0:At,onScheduleSend:t?void 0:fe,onClose:rt,onCloseAnimationEnd:lt}),c.a.createElement(Hs,{isOpen:ge,withTimePicker:!0,selectedAt:_t.getTime(),maxAt:Object(L.k)(zt),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Lt,onSubmit:xt,onSecondButtonClick:a?Rt:void 0}))}));var $s=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Ne.a)(ke.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var Ws=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Ne.a)(ke.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var Vs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(242);const Ks=m.k?450+n.c:void 0;function Qs(e){return"file"===e.kind&&e.type&&n.n.has(e.type)}var Ys=Object(c.h)(Object(s.h)(e=>{const t=Object(r.Cb)(e),{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},o=Object(r.z)(e),{isLeftColumnShown:i,chats:{listIds:d}}=e,u={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isLeftColumnShown:i,isRightColumnShown:Object(r.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(m.k&&Object(r.B)(e)),isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel};if(!o||!d.active)return u;const{chatId:h,threadId:O,type:j}=o,g=Object(r.g)(e,h),f=Object(r.jb)(e,h),{chatId:p,messageId:I}=e.audioPlayer,v=g&&Object(l.d)(g,O),y=Object(r.L)(e,h),C="pinned"===j,w="scheduled"===j,E=Object(r.Fb)(e,h,O);return{...u,chatId:h,threadId:O,messageListType:j,originChatId:E?E.id:h,isPrivate:Object(l.ob)(h),canPost:!C&&(!g||v)&&(!y||m.k),isPinnedMessageList:C,isScheduledMessageList:w,messageSendingRestrictionReason:g&&Object(l.L)(g),hasPinnedOrAudioMessage:O!==b.MAIN_THREAD_ID||Boolean(f&&f.length)||Boolean(p&&I),pinnedMessagesCount:f?f.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["openChat","unpinAllMessages","loadUser","closeLocalTextSearch","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:o,isScheduledMessageList:r,canPost:i,messageSendingRestrictionReason:l,hasPinnedOrAudioMessage:d,pinnedMessagesCount:u,customBackground:h,theme:O,backgroundColor:j,patternColor:g,isLeftColumnShown:f,isRightColumnShown:p,isBackgroundBlurred:I,isMobileSearchActive:v,isSelectModeActive:y,animationLevel:C,originChatId:w,shouldSkipHistoryAnimations:E,openChat:M,unpinAllMessages:S,loadUser:k,closeLocalTextSearch:N,exitMessageSelectMode:T})=>{const{width:P}=Ye(),[A,x]=Object(c.r)(We.a.None),[R,L]=Object(c.r)(),[D,F]=Object(c.r)(),[B,U]=Object(c.r)(!1),[H,q]=Object(c.r)(!m.k||C===n.f),G=d&&(P<n.jb||p&&P>n.gb&&P<n.rb||P>=n.fb&&P<n.qb),_=Object(Je.a)(e,Ks),z=Object(Je.a)(t,Ks),$=Object(Je.a)(a,Ks),W=Object(Je.a)(i,Ks),V=Object(Je.a)(G,Ks),K=Object(Je.a)(R,Ks);Object(c.n)(()=>e?Object(ce.a)(()=>{M({id:void 0})}):void 0,[e,M]),Object(c.n)(()=>{x(We.a.None),L(void 0),F(void 0)},[e]),Object(c.n)(()=>{C===n.f&&q(!0)},[C]);Object(c.n)(()=>{s&&k({userId:e})},[e,s,k]);const Q=Object(c.m)(e=>{if(m.m)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).filter(e=>"text/uri-list"!==e.type).every(Qs);x(a?We.a.QuickFile:We.a.Document)},[]),Y=Object(c.m)(()=>{x(We.a.None)},[]),J=Object(c.m)(()=>{U(!0)},[]),X=Object(c.m)(()=>{U(!1)},[]),Z=Object(c.m)(()=>{S({chatId:e}),X(),M({id:e})},[S,M,X,e]),ee=Object(c.m)(()=>{M({id:e})},[M,e]),ae=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):Ve.c(n.o,e,Ve.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(Ke.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(O,h),se=Object(te.a)(V&&"has-header-tools",h&&"custom-bg-image",j&&"custom-bg-color",h&&I&&"blurred",m.p?"mask-image-disabled":"mask-image-enabled"),ne=Object(te.a)("messaging-disabled",!y&&"shown"),{composerHiddenScale:re,toolbarHiddenScale:le,composerTranslateX:be,toolbarTranslateX:ue,unpinHiddenScale:he,toolbarForUnpinHiddenScale:Oe}=Object(c.p)(()=>Xe(P,W),[W,P]),je=Object(ie.a)(),ge=Object(te.a)("middle-column-footer",!W&&"no-composer",W&&D&&!y&&"with-notch"),fe=()=>{z!==b.MAIN_THREAD_ID?M({id:w,threadId:b.MAIN_THREAD_ID},!0):o||r?M({id:e,type:"thread"}):M({id:void 0},!0)};Object(de.a)(_&&z,fe,M,{id:e,threadId:b.MAIN_THREAD_ID});const pe=_&&z!==b.MAIN_THREAD_ID;return Object(de.a)(pe||o||r,fe,M,{id:e,threadId:z}),Object(de.a)(v,N),Object(de.a)(y,T),c.a.createElement("div",{id:"MiddleColumn",className:se,onTransitionEnd:t=>{"transform"===t.propertyName&&t.target===t.currentTarget&&q(Boolean(e))},style:`\n --composer-hidden-scale: ${re};\n --toolbar-hidden-scale: ${le};\n --unpin-hidden-scale: ${he};\n --toolbar-unpin-hidden-scale: ${Oe};\n --composer-translate-x: ${be}px;\n --toolbar-translate-x: ${ue}px;\n --pattern-color: ${g};\n --theme-background-color:\n ${j||("dark"===O?n.p:n.O)};\n `,onClick:m.l&&f?ee:void 0},c.a.createElement("div",{id:"middle-column-bg",style:ae?"--custom-background: "+ae:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),_&&z&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:W?Q:void 0},c.a.createElement(It,{chatId:_,threadId:z,messageListType:$,isReady:H}),c.a.createElement(oe.a,{name:E?"none":C===n.e?"slide":"fade",activeKey:"thread"===$&&z===b.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(Ja,{key:`${_}-${z}-${$}`,chatId:_,threadId:z,type:$,canPost:W,hasTools:V,onFabToggle:L,onNotchToggle:F,isReady:H}),c.a.createElement("div",{className:ge},W&&c.a.createElement(zs,{chatId:_,threadId:z,messageListType:$,dropAreaState:A,onDropHide:Y,isReady:H}),o&&c.a.createElement("div",{className:"unpin-button-container",dir:je.isRtl?"rtl":void 0},c.a.createElement(me.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:J},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,je("Chat.Pinned.UnpinAll",u,"i")))),!o&&!W&&l&&c.a.createElement("div",{className:ne},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Ws,{messageListType:$,isActive:y,canPost:W})))),c.a.createElement(Xa,{isShown:K,canPost:W})),m.k&&c.a.createElement($s,{isActive:Boolean(v)})),e&&c.a.createElement(Vs,{isOpen:B,chatId:e,pinnedMessagesCount:u,onClose:X,onUnpin:Z}))}));a(243);const Js=Object(p.a)(e=>e(),200,!1);var Xs;!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"}(Xs||(Xs={}));var Zs=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(r.B)(e)||{},{query:c}=Object(r.A)(e)||{},{query:o}=Object(r.t)(e)||{},i=t?Object(r.g)(e,t):void 0,d=i&&Object(l.mb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(r.P)(e,i.id)&&(Object(l.ob)(i.id)||(Object(l.jb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:d,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:o}},(e,t)=>Object(h.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:o,isPollResults:r,profileState:i,managementScreen:l,canManage:d,isChannel:b,onClose:h,messageSearchQuery:O,stickerSearchQuery:j,gifSearchQuery:g,setLocalTextSearchQuery:f,setStickerSearchQuery:p,setGifSearchQuery:I,searchTextMessagesLocal:v,toggleManagement:y,openHistoryCalendar:C,shouldSkipAnimation:w})=>{var E;const M=Object(c.q)(null),S=Object(c.m)(e=>{f({query:e}),e.length&&Js(v)},[v,f]),k=Object(c.m)(e=>{p({query:e})},[p]),N=Object(c.m)(e=>{I({query:e})},[I]),[T,P]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{P(!e)},300)},[e]);const A=Object(ie.a)(),x=t?i===u.k.Profile?Xs.Profile:i===u.k.SharedMedia?Xs.SharedMedia:i===u.k.MemberList?Xs.MemberList:-1:a?Xs.Search:r?Xs.PollResults:n?Xs.StickerSearch:o?Xs.GifSearch:s?l===u.g.Initial?Xs.ManageInitial:l===u.g.ChatPrivacyType?Xs.ManageChatPrivacyType:l===u.g.Discussion?Xs.ManageDiscussion:l===u.g.ChannelSubscribers?Xs.ManageChannelSubscribers:l===u.g.GroupPermissions?Xs.ManageGroupPermissions:l===u.g.ChatAdministrators?Xs.ManageChatAdministrators:l===u.g.GroupRemovedUsers?Xs.ManageGroupRemovedUsers:l===u.g.GroupUserPermissionsCreate?Xs.ManageGroupUserPermissionsCreate:l===u.g.GroupUserPermissions?Xs.ManageGroupUserPermissions:l===u.g.GroupRecentActions?Xs.ManageGroupRecentActions:l===u.g.ChatAdminRights?Xs.ManageGroupAdminRights:l===u.g.GroupMembers?Xs.ManageGroupMembers:void 0:void 0,R=null!==(E=Object(tt.a)(x,!0))&&void 0!==E?E:-1;function D(){if(-1!==R)switch(R){case Xs.PollResults:return c.a.createElement("h3",null,A("PollResults"));case Xs.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(he.a,{parentContainerClassName:"RightSearch",value:O,onChange:S}),c.a.createElement(me.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>C({selectedAt:Object(L.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case Xs.ManageInitial:return c.a.createElement("h3",null,A("Edit"));case Xs.ManageChatPrivacyType:return c.a.createElement("h3",null,A(b?"ChannelTypeHeader":"GroupTypeHeader"));case Xs.ManageDiscussion:return c.a.createElement("h3",null,A("Discussion"));case Xs.ManageChatAdministrators:return c.a.createElement("h3",null,A("ChannelAdministrators"));case Xs.ManageGroupRecentActions:return c.a.createElement("h3",null,A("Group.Info.AdminLog"));case Xs.ManageGroupAdminRights:return c.a.createElement("h3",null,A("EditAdminRights"));case Xs.ManageGroupPermissions:return c.a.createElement("h3",null,A("ChannelPermissions"));case Xs.ManageGroupRemovedUsers:return c.a.createElement("h3",null,A("ChannelBlockedUsers"));case Xs.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,A("ChannelAddException"));case Xs.ManageGroupUserPermissions:return c.a.createElement("h3",null,A("UserRestrictions"));case Xs.StickerSearch:return c.a.createElement(he.a,{value:j,placeholder:A("SearchStickersHint"),onChange:k});case Xs.GifSearch:return c.a.createElement(he.a,{value:g,placeholder:A("SearchGifsTitle"),onChange:N});case Xs.SharedMedia:return c.a.createElement("h3",null,A("SharedMedia"));case Xs.ManageChannelSubscribers:return c.a.createElement("h3",null,A("ChannelSubscribers"));case Xs.MemberList:case Xs.ManageGroupMembers:return c.a.createElement("h3",null,A("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,"Profile"),c.a.createElement("section",{className:"tools"},d&&c.a.createElement(me.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:A("Edit"),onClick:y},c.a.createElement("i",{className:"icon-edit"}))))}}const F=m.k||x===Xs.SharedMedia||x===Xs.MemberList||s,B=Object(te.a)("animated-close-icon",(T||w)&&"no-transition");return Object(c.n)(()=>{M.current.classList.toggle("state-back",F)},[F]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(me.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:h,ariaLabel:A(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:M,className:B})),c.a.createElement(oe.a,{name:T||w?"none":"slide-fade",activeKey:R},D))})),en=a(127);function tn(e,t,a,s,o,r,i,d,b,u,m,h=0){const O="members"!==s&&o?o:s,j=Object(c.p)(()=>{if(r&&i)return Object(l.Jb)(r.map(({userId:e})=>e),i,void 0,h)},[r,h,i]),[g,f,p]=function(e,t,a,s){const[c,o]=Object(en.a)(a?t:void 0,s,void 0,n.X),r=!c||!s||c[0]===s[0];return[c,o,!r]}(0,t,m,j),[I,v,y]=an("media",O,a,m,d,b),[C,w,E]=an("documents",O,a,m,d,b),[M,S,k]=an("links",O,a,m,d,b),[N,T,P]=an("audio",O,a,m,d,b);let A,x,R=!1;switch(O){case"members":A=g,x=f,R=p;break;case"media":A=I,x=v,R=y;break;case"documents":A=C,x=w,R=E;break;case"links":A=M,x=S,R=k;break;case"audio":A=N,x=T,R=P}return[O,A,x,R]}function an(e,t,a,s,o,r){const i=Object(c.q)();Object(ye.a)(()=>{t===e&&o&&r&&(i.current=Object(l.w)(o,r,e).reverse())},[o,r,t,e]);const[d,b]=Object(en.a)(s?a:void 0,i.current,void 0,"media"===e?n.vb:n.db);return[d,b,!(!d||!i.current||d[0]===i.current[0])]}var sn=a(58);const nn=Object(p.h)(e=>e(),250,!1);let cn=!1;var on=a(112),rn=a(105);var ln=a(132),dn=a(191);a(244);var bn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:o,onClick:r})=>{const i=Object(ie.a)(),d=t&&Object(l.sb)(t);function u(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let o;return n||d||(t?o=Object(l.e)(t,s):e&&(o=Object(l.e)(e,s))),o}const m=u(),h=Object(lt.a)(m,!1,b.ApiMediaFormat.BlobUrl,o),O=Object(lt.a)(!h&&s?u("normal",!0):void 0,!1,b.ApiMediaFormat.BlobUrl,o),j=Object(dn.a)(!h&&a&&a.thumbnail&&a.thumbnail.dataUri),g=h||O||j,f=Object(da.a)(g);let p="";if(n)p=c.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(d)p=c.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(g)p=c.a.createElement("img",{src:g,className:"avatar-media",alt:"",decoding:"async"});else if(!g&&t){const e=Object(l.bb)(t);p=e?Object(at.c)(e,2):void 0}else if(!g&&e){const t=Object(l.k)(i,e);p=t&&Object(at.c)(t,Object(l.ob)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(pe.a,{color:"white"}));const I=Object(te.a)("ProfilePhoto","color-bg-"+Object(l.Z)(t||e),n&&"saved-messages",d&&"deleted-account",!n&&!g&&"no-photo");return c.a.createElement("div",{className:I,onClick:g?r:void 0},f&&g&&f!==g&&c.a.createElement("img",{src:f,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof p?Object(it.a)(p,["hq_emoji"]):p)});a(245);var un=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(r.Ib)(e,t),o=Object(r.g)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:o,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(h.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:o,openMediaViewer:r,serverTimeOffset:i})=>{const{id:d}=e||{},{id:h}=t||{},O=e?Object(l.bb)(e):t?t.title:"",j=(e?e.photos:t?t.photos:void 0)||[],g=n>=1?"slide":"none",[f,p]=Object(c.r)(0),I=a||j.length<=1||0===f,v=a||j.length<=1||f===j.length-1;Object(c.n)(()=>{f>j.length&&p(Math.max(0,j.length-1))},[f,j.length]);const y=Object(ie.a)();Object(c.n)(()=>{s&&d&&o({userId:d})},[d,o,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{gt.c(`photo${e.id}?size=c`)||gt.b(`photo${e.id}?size=c`,b.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{r({avatarOwnerId:d||h,profilePhotoIndex:f,origin:u.h.ProfileAvatar})},[r,d,h,f]),w=Object(c.m)(()=>{I||p(f-1)},[f,I]),E=Object(c.m)(()=>{v||p(f+1)},[f,v]);if(Object(c.n)(()=>{const e=document.querySelector(".profile-slide-container > .active, .profile-slide-container > .to");if(e)return Object(ve.b)(e,{excludedClosestSelector:".navigation",onSwipe:m.m?(e,t)=>{t===ve.a.Right?w():t===ve.a.Left&&E()}:void 0})},[E,w]),!e&&!t)return;function M(){const s=!a&&j&&j.length>0?j[f]:void 0;return c.a.createElement(bn,{key:f,user:e,chat:t,photo:s,isSavedMessages:a,isFirstPhoto:I,onClick:C})}const S=e&&e.isVerified||t&&t.isVerified;return c.a.createElement("div",{className:"ProfileInfo",dir:y.isRtl?"rtl":void 0},c.a.createElement("div",{className:"photo-wrapper"},function(){if(!(a||!j||j.length<=1))return c.a.createElement("div",{className:"photo-dashes"},j.map((e,t)=>c.a.createElement("span",{className:"photo-dash "+(t===f?"current":"")})))}(),c.a.createElement(oe.a,{activeKey:f,name:g,className:"profile-slide-container"},M),!I&&c.a.createElement("button",{type:"button",className:"navigation prev","aria-label":y("AccDescrPrevious"),onClick:w}),!v&&c.a.createElement("button",{type:"button",className:"navigation next","aria-label":y("Next"),onClick:E})),c.a.createElement("div",{className:"info",dir:y.isRtl?"rtl":"auto"},a?c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},y("SavedMessages"))):c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},O&&Object(it.a)(O)),S&&c.a.createElement(ln.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(l.Cb)(e)?"online":"")},c.a.createElement("span",{className:"user-status",dir:"auto"},Object(l.cb)(y,e,i))):c.a.createElement("span",{className:"status",dir:"auto"},Object(l.mb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))}));var mn=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(r.g)(e,t):void 0,n=Object(l.ob)(t)?Object(r.Ib)(e,t):void 0,c=s&&Object(l.Hb)(s,Object(r.eb)(e),Object(r.db)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&!n&&(!Object(l.mb)(s)&&!Object(l.Db)(s,"inviteUsers")||Object(l.p)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(h.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,isMuted:o,loadFullUser:r,showNotification:i,updateChatMutedState:d})=>{const{id:b,fullInfo:u,username:m,phoneNumber:h,isSelf:O}=t||{},{id:j}=a||{},g=Object(ie.a)();Object(c.n)(()=>{e&&b&&r({userId:b})},[r,b,e]);const f=Object(c.m)(()=>{d({chatId:j,isMuted:!o})},[j,o,d]);if(!a||a.isRestricted||O&&!s)return;function p(e,t){Object(M.c)(e),i({message:t+" was copied"})}const I=h&&Object(ya.c)(h),v=Object(l.g)(a),y=u&&u.bio||Object(l.f)(a);return c.a.createElement("div",{className:"ChatExtra"},I&&!!I.length&&c.a.createElement(rn.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(I,g("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},I),c.a.createElement("span",{className:"subtitle"},g("Phone"))),m&&c.a.createElement(rn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p("@"+m,g("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(it.a)(m)),c.a.createElement("span",{className:"subtitle"},g("Username"))),y&&!!y.length&&c.a.createElement(rn.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(it.a)(y,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},g(b?"UserBio":"Info"))),(n||!m)&&!!v.length&&c.a.createElement(rn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>p(v,g("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},v),c.a.createElement("span",{className:"subtitle"},g("SetUrlPlaceholder"))),c.a.createElement(rn.a,{icon:"unmute",ripple:!0,onClick:f},c.a.createElement("span",null,g("Notifications")),c.a.createElement(je,{id:"group-notifications",label:b?"Toggle User Notifications":"Toggle Chat Notifications",checked:!o,inactive:!0})))})),hn=a(165),On=a(185),jn=a(117);a(249);const gn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function fn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var pn=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(r.g)(e,t),n=Object(r.n)(e,a||t),{currentType:c,resultsByType:o}=Object(r.w)(e)||{},{foundIds:i}=o&&c&&o[c]||{},{byId:d}=e.users,b=s&&Object(l.nb)(s),u=s&&Object(l.mb)(s),m=b||u&&Object(l.jb)(s),h=s&&s.fullInfo&&s.fullInfo.members,O=m&&s&&s.fullInfo&&!s.fullInfo.canViewMembers;let j;return a?j=a:Object(l.ob)(t)&&(j=t),{theme:Object(r.Cb)(e),isChannel:u,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:m,areMembersHidden:O,...m&&h&&{members:h,usersById:d},isRightColumnShown:Object(r.W)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(h.l)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos"]))(({chatId:e,profileState:t,onProfileStateChange:a,theme:s,isChannel:o,resolvedUserId:r,chatMessages:i,foundIds:l,mediaSearchType:d,hasMembersTab:h,areMembersHidden:O,members:j,usersById:g,isRightColumnShown:f,isRestricted:p,lastSyncTime:I,setLocalMediaSearchType:v,loadMoreMembers:y,searchMediaMessagesLocal:C,openMediaViewer:w,openAudioPlayer:E,openUserInfo:M,focusMessage:S,loadProfilePhotos:k,serverTimeOffset:N})=>{const T=Object(c.q)(null),P=Object(c.q)(null),A=Object(ie.a)(),[x,R]=Object(c.r)(0),L=Object(c.p)(()=>[...h?[{type:"members",title:o?"ChannelSubscribers":"GroupMembers"}]:[],...gn],[h,o]),D=L[x].type,[F,B,U,H]=tn(0,y,C,D,d,j,g,i,l,0,I,N),q=L.findIndex(({type:e})=>e===F),{handleScroll:G}=function(e,t,a,s){Object(sn.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop<n.offsetTop&&(s("members"===t?u.k.MemberList:u.k.SharedMedia),cn=!0,Object(kt.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{cn=!1},350))}},[t,s]),Object(sn.a)(([t])=>{if(a!==u.k.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||(cn=!0,Object(kt.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{cn=!1},350),s(a))},[a]);const n=Object(c.m)(()=>{const a=e.current;if(!a)return;const n=a.querySelector(".TabList");if(!n)return;let c=u.k.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?u.k.MemberList:u.k.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{cn||n()},[n,t]),{handleScroll:Object(c.m)(()=>{cn||nn(n)},[n])}}(T,D,t,a),{applyTransitionFix:_,releaseTransitionFix:z}=function(e,t=".Transition.shared-media-transition"){return Object(c.n)(()=>{function a(){const a=e.current,s=a.querySelector(t),n=a.querySelector(".TabList");s&&n&&(s.style.minHeight=a.offsetHeight-n.offsetHeight+"px")}return a(),window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[e,t]),{applyTransitionFix:Object(c.m)(()=>{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:Object(c.m)(()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"},[e])}}(T),[$,W]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),V=Object(c.m)(()=>{z(),W()},[z,W]);Object(c.n)(()=>{v({mediaType:D})},[v,D]);const K=r||e;Object(c.n)(()=>{I&&k({profileId:K})},[k,K,I]);const Q=Object(c.m)(e=>{w({chatId:K,threadId:b.MAIN_THREAD_ID,messageId:e,origin:u.h.SharedMedia})},[K,w]),Y=Object(c.m)(e=>{E({chatId:K,messageId:e})},[K,E]),J=Object(c.m)(e=>{M({id:e})},[M]),X=Object(c.m)(e=>{S({chatId:K,messageId:e})},[K,S]);let Z;Object(c.n)(()=>{if(P.current&&m.m)return Object(ve.b)(P.current,{onSwipe:(e,t)=>{t===ve.a.Left?R(Math.min(x+1,L.length-1)):t===ve.a.Right&&R(Math.max(0,x-1))}})},[x,L.length]);const ee="members"===F||!h&&"media"===F;ee?Z=f?0:1e3:B||(Z=n.wb);const te=Object(As.a)([e,F],Z);function ae(){if(!B||!te||!i){const e=ee&&B&&!te;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(pe.a,null))}if(!B.length){let e;switch(F){case"members":e=O?"You have no access to group members list.":"No members found";break;case"documents":e=A("lng_media_file_empty_search");break;case"links":e=A("lng_media_link_empty_search");break;case"audio":e=A("lng_media_song_empty_search");break;default:e=A("SharedMedia.EmptyTitle")}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(jn.a,{text:e}))}return c.a.createElement("div",{className:`content ${F}-list`,dir:A.isRtl&&"media"===F?"rtl":void 0,teactFastList:!0},"media"===F?B.map(e=>i[e]&&c.a.createElement(hn.a,{key:e,message:i[e],onClick:Q})):"documents"===F?B.map(e=>i[e]&&c.a.createElement(Xt.a,{key:e,message:i[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:X})):"links"===F?B.map(e=>i[e]&&c.a.createElement(On.a,{key:e,message:i[e],onMessageClick:X})):"audio"===F?B.map(e=>i[e]&&c.a.createElement(Zt.a,{key:e,theme:s,message:i[e],target:"sharedMedia",date:i[e].date,lastSyncTime:I,className:"scroll-item",onPlay:Y,onDateClick:X})):"members"===F?B.map((e,t)=>c.a.createElement(rn.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>J(e)},c.a.createElement(st.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(on.a,{ref:T,className:"Profile custom-scroll",itemSelector:fn(F),items:te?B:void 0,cacheBuster:$,sensitiveArea:n.lb,preloadBackwards:te?"members"===F?n.X:n.vb:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:U,onScroll:G},!H&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(un,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(mn,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(oe.a,{ref:P,name:A.isRtl?"slide-reversed":"slide",activeKey:q,renderCount:L.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:_,onStop:V},ae),c.a.createElement(Ee.a,{big:!0,activeTab:x,tabs:L,onSwitchTab:R})))}));var In=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});var vn=Object(c.h)(e=>{const t=Object(Ne.a)(ke.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Te.a,null)});var yn=Object(c.h)(()=>{const e=Object(Ne.a)(ke.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Te.a,null)});var Cn=Object(c.h)(()=>{const e=Object(Ne.a)(ke.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Te.a,null)});var wn=Object(c.h)(()=>{const e=Object(Ne.a)(ke.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Te.a,null)});a(250);const En=Object.keys(u.l).length/2,Mn=Object.keys(u.g).length/2;function Sn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var kn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},s=Object(r.d)(e);return{contentKey:Object(r.ob)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:o,toggleChatInfo:r,toggleManagement:i,openUserInfo:l,closeLocalTextSearch:d,setStickerSearchQuery:b,setGifSearchQuery:m,closePollResults:h,shouldSkipHistoryAnimations:O})=>{var j;const{width:g}=Ye(),[f,p]=Object(c.r)(u.k.Profile),[I,v]=Object(c.r)(u.g.Initial),[y,C]=Object(c.r)(),[w,E]=Object(c.r)(),M=f!==u.k.Profile,S=void 0!==e,k=e===u.l.ChatInfo||e===u.l.UserInfo,N=e===u.l.Search,T=e===u.l.Management,P=e===u.l.StickerSearch,A=e===u.l.GifSearch,x=e===u.l.PollResults,R=g<=n.gb,[L,D]=Object(c.r)(!S),F=null!==(j=Object(tt.a)(e,!0,!o))&&void 0!==j?j:-1,B=Object(c.m)((t=!0)=>{switch(e){case u.l.ChatInfo:if(M&&t){p(u.k.Profile);break}r(void 0,!0);break;case u.l.UserInfo:if(M&&t){p(u.k.Profile);break}l({id:void 0},!0);break;case u.l.Management:switch(I){case u.g.Initial:i();break;case u.g.ChatPrivacyType:case u.g.Discussion:case u.g.GroupPermissions:case u.g.GroupType:case u.g.ChatAdministrators:case u.g.ChannelSubscribers:case u.g.GroupMembers:v(u.g.Initial);break;case u.g.GroupUserPermissionsCreate:case u.g.GroupRemovedUsers:case u.g.GroupUserPermissions:v(u.g.GroupPermissions),C(void 0),E(void 0);break;case u.g.ChatAdminRights:case u.g.GroupRecentActions:v(u.g.ChatAdministrators)}break;case u.l.Search:Sn(),d();break;case u.l.StickerSearch:Sn(),b({query:void 0});break;case u.l.GifSearch:Sn(),m({query:void 0});break;case u.l.PollResults:h()}},[e,M,r,l,h,I,i,d,b,m]),U=Object(c.m)((e,t)=>{C(e),E(t)},[]);function H(e){if(-1!==F)switch(F){case u.l.ChatInfo:case u.l.UserInfo:return c.a.createElement(pn,{key:s||t,chatId:t,userId:s,profileState:f,onProfileStateChange:p});case u.l.Search:return c.a.createElement(In,{chatId:t,threadId:a,onClose:B,isActive:S&&e});case u.l.Management:return c.a.createElement(vn,{chatId:t,currentScreen:I,isPromotedByCurrentUser:w,selectedChatMemberId:y,onScreenSelect:v,onChatMemberSelect:U,isActive:S&&e,onClose:B});case u.l.StickerSearch:return c.a.createElement(yn,{onClose:B,isActive:S&&e});case u.l.GifSearch:return c.a.createElement(Cn,{onClose:B,isActive:S&&e});case u.l.PollResults:return c.a.createElement(wn,{onClose:B,isActive:S&&e})}}return Object(c.n)(()=>S?Object(ce.a)(B):void 0,[S,B]),Object(c.n)(()=>{setTimeout(()=>{D(!S)},300)},[S]),Object(c.n)(()=>{S&&R&&B()},[R]),Object(vt.a)(([a,s])=>{(a===u.l.ChatInfo&&e===u.l.UserInfo||a===u.l.UserInfo&&e===u.l.ChatInfo||s!==t)&&(p(u.k.Profile),v(u.g.Initial))},[e,t]),Object(de.a)(o&&(e===u.l.ChatInfo||e===u.l.UserInfo||e===u.l.Management),()=>B(!1),r),c.a.createElement("div",{id:"RightColumn-wrapper",className:o?void 0:"is-hidden"},R&&c.a.createElement("div",{className:"overlay-backdrop",onClick:B}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(Zs,{chatId:t,isColumnOpen:S,isProfile:k,isSearch:N,isManagement:T,isStickerSearch:P,isGifSearch:A,isPollResults:x,profileState:f,managementScreen:I,onClose:B,shouldSkipAnimation:L||O}),c.a.createElement(oe.a,{name:L||O?"none":"zoom-fade",renderCount:En+Mn,activeKey:T?En+I:F,shouldCleanup:!0,cleanupExceptionKey:u.l.ChatInfo},H)))}));var Nn=Object(c.h)(({isOpen:e})=>{const t=Object(Ne.a)(ke.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var Tn=Object(c.h)(({isOpen:e})=>{const t=Object(Ne.a)(ke.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var Pn=Object(c.h)(({isOpen:e})=>{const t=Object(Ne.a)(ke.a.Extra,"Dialogs",!e);return t?c.a.createElement(t,null):void 0});var An=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var xn=Object(c.h)(e=>{const{url:t}=e,a=Object(Ne.a)(ke.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var Rn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ne.a)(ke.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(251);let Ln,Dn,Fn=!1;function Bn(e){document.querySelectorAll('link[rel="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")})}var Un=Object(c.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(r.l)(e,t,a):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(r.W)(e),isMediaViewerOpen:Object(r.T)(e),isForwardModalOpen:Object(r.R)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:o,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasDialogs:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,shouldSkipHistoryAnimations:O,loadAnimatedEmojis:j,loadNotificationSettings:g,loadNotificationExceptions:f,updateIsOnline:p})=>{n.r&&!Fn&&(Fn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(p(!0),j(),g(),f())},[e,j,f,g,p]);const{transitionClassNames:I}=Object(ae.a)(!t,void 0,!0,void 0,O),{transitionClassNames:v}=Object(ae.a)(a,void 0,!0,void 0,O),y=Object(te.a)(I.replace(/([\w-]+)/g,"middle-column-$1"),v.replace(/([\w-]+)/g,"right-column-$1"),O&&"history-animation-disabled");Object(c.n)(()=>{l>0&&(document.body.classList.add("animating-right-column"),Object(ee.b)(350+n.c),Ln&&(clearTimeout(Ln),Ln=void 0),Ln=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Ln=void 0},350+n.c))},[l,a]);const C=Object(c.m)(()=>{p(!1);const e=Object(r.r)(Object(s.e)());let t=0;clearInterval(Dn),Dn=window.setInterval(()=>{if(document.title.includes(n.J))Bn(!1);else{if(t%2==0){const t=Object(r.r)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Bn(!0))}else document.title=n.kb,Bn(!1);t++}},1e3)},[p]),w=Object(c.m)(()=>{p(!0),clearInterval(Dn),Dn=void 0,document.title.includes(n.J)||(document.title=n.kb),Bn(!1)},[p]);function E(e){e.preventDefault(),e.stopPropagation()}return Object(se.a)(C,w),ne(C),c.a.createElement("div",{id:"Main",className:y,onDrop:E,onDragOver:E},c.a.createElement($e,null),c.a.createElement(Ys,null),c.a.createElement(kn,null),c.a.createElement(Nn,{isOpen:o}),c.a.createElement(An,{isOpen:i}),c.a.createElement(Tn,{isOpen:d}),c.a.createElement(Pn,{isOpen:b}),u&&c.a.createElement(pt,{key:u.id,message:u,noUi:!0}),c.a.createElement(xn,{url:m}),c.a.createElement(Rn,{isOpen:h}))}));n.r&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},197:function(e,t,a){},198:function(e,t,a){},199:function(e,t,a){},210:function(e,t,a){},211:function(e,t,a){},212:function(e,t,a){},215:function(e,t,a){},216:function(e,t,a){},217:function(e,t,a){},221:function(e,t,a){},222:function(e,t,a){},224:function(e,t,a){},227:function(e,t,a){},228:function(e,t,a){},229:function(e,t,a){},230:function(e,t,a){},231:function(e,t,a){},232:function(e,t,a){},233:function(e,t,a){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},237:function(e,t,a){},239:function(e,t,a){},240:function(e,t,a){},241:function(e,t,a){},242:function(e,t,a){},243:function(e,t,a){},244:function(e,t,a){},245:function(e,t,a){},249:function(e,t,a){},250:function(e,t,a){},251:function(e,t,a){}}]);
//# sourceMappingURL=4.df68acb615ff7e070772.js.map